akhauriyash/Code-Regression huggingface dataset:
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
using namespace __gnu_pbds; 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;

typedef tree<
pii,
null_type,
less<pii>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int N = 3e5 + 123;

int n, m, l;

int a[N];
map < int , int > cnt;
int dp[104][104];
char ch[103][103];
main(){

	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n;
	int sum = 0;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		sum += a[i];
	}
	if(sum % 10 != 0)
		ans = sum;
	
	for(int i = 1; i <= n; i++){
		if((sum - a[i])%10 != 0)
			ans = max(ans, sum - a[i]);
	}
	ret(ans);
	

}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n"; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug() << imie(x) imie(y)
//debugging ends


int solve(){
    int d,t,s;
    cin>>d>>t>>s;
    if(d<=s*t) cout<<"Yes";
    else cout<<"No";
    return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cerr<<fixed<<setprecision(10);
  auto start = chrono::high_resolution_clock::now();
  int t=1;
  //cin>>t;
  while(t--)
    solve(),cout<<"\n";

  auto stop = chrono::high_resolution_clock::now(); 
  auto duration = chrono::duration_cast<chrono::nanoseconds>(stop - start); 
  cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s \n";      
  
  return 0;
}


Measured memory_bytes: 3756
#include<iostream>
#include<string.h>
using namespace std;

int m,n,w,h;
char b[102][102];
bool v[102][102];

void dfs(int y,int x){
    if(v[y][x]){
        cout<<"LOOP"<<endl;
        return;
    }
    v[y][x]=1;
    if(b[y][x]=='>'){
        dfs(y,x+1);
        return;
    }
    if(b[y][x]=='v'){
        dfs(y+1,x);
        return;
    }
    if(b[y][x]=='<'){
        dfs(y,x-1);return;
    }
    if(b[y][x]=='^'){
        dfs(y-1,x);return;
    }
    cout<<x<<" "<<y<<endl;
}

int main(){
    while(cin>>h>>w,w||h){
        for(int i=0;i<h;i++)
            cin>>b[i];
        memset(v,0,sizeof(v));
        dfs(0,0);
    }
}

Measured memory_bytes: 1192
# import numpy as np
import math
n = int(input());
orig = n
i = 2
l = []
while i<=math.sqrt(orig):
    while n%i== 0:
        n /= i
        l.append(i)
    i += 1
if n != 1:
    l.append(int(n))
# if len(l) == 0:
#     print("{0}: {1}".format(orig, orig))
# else:
print("{}:".format(orig), *l)


Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define int long long
using namespace std;
int xa[100010],ya[100010],za[100010];
int x,y,z;
int n;
bool cmp(int i,int j){
    if (ya[i]-xa[i] > ya[j]-xa[j]) return 1;
    return 0;
}
vector<int> v;
int ans1[100010],ans2[100010];
void solve1(){
    int base = 0;
    multiset<int> use,rest;
    for (int i = 1; i <= x; i++){
        base += xa[v[i]];
        rest.insert(za[v[i]]-xa[v[i]]);
    }

    ans1[x] = base;
    int optdif = 0;
   // cout << x << " " << ans1[x-1] << "\n";
    for (int i = x+1; i <= x+z; i++){
        rest.insert(za[v[i]]-xa[v[i]]);
        int v1 = *(--rest.end());
        base += xa[v[i]];
        optdif += v1;
        rest.erase(rest.find(v1));
        use.insert(v1);
        ans1[i] = base+optdif;
      //  cout << i << " " << ans1[i] << "\n";
    }
}
void solve2(){
    int base = 0;
    multiset<int> use,rest;
    for (int i = n; i > n-y; i--){
        base += ya[v[i]];
        rest.insert(za[v[i]]-ya[v[i]]);
    }
    //cout << n-y+1 << " " << ans2[n-y+1] << "\n";
    ans2[n-y+1] = base;
    int optdif = 0;
    for (int i = n-y; i > n-y-z; i--){
        rest.insert(za[v[i]]-ya[v[i]]);
        int v1 = *(--rest.end());
        base += ya[v[i]];
        optdif += v1;
        rest.erase(rest.find(v1));
        use.insert(v1);
        ans2[i] = base+optdif;
        //cout << i << " " << ans2[i]<< "\n";
    }
}
main(){
    cin >> x >> y >> z;
    n = x+y+z;
    for (int i = 1; i <= n; i++) {
        cin >> xa[i] >> ya[i] >> za[i];
        v.push_back(i);
    }
    sort(v.begin(),v.end(),cmp);
    v.push_back(0);
    reverse(v.begin(),v.end());
    //for (int i = 1; i <= n; i++) cout << v[i] << " ";
    //cout << "\n";
    solve1();
    solve2();
    int ans = 0;
    for (int i = x; i <= n-y; i++) ans = max(ans1[i]+ans2[i+1],ans);
    cout << ans;
}


Measured memory_bytes: 8820
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string s, t;
	cin >> s >> t;
	int ans = 1e9;
	for (int i = 0; i < s.size(); i++)
	{
		int ans1 = 0; int f = 0;
		for (int j = 0; j < t.size(); j++)
		{
			// cout << i + j << endl;
			if (i + j >= s.size())
			{f = 1; break;}
			if (s[i + j] != t[j])
				ans1++;
		}
		if (f == 0)
			ans = min(ans1, ans);
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 3596
import java.util.Scanner;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String args[]){
		Main app=new Main();
		while(true){
			int n=sc.nextInt();
			if(n==0)break;
			findans(n);
		}

	}
	static void findans(int n){
		for(int i=0;i<n;i++){
			int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
			if(a==100||b==100||c==100) System.out.println("A");
			else if(a+b>=180)System.out.println("A");
			else if(a+b+c>=240)System.out.println("A");
			else if(a+b+c>=210)System.out.println("B");
			else if(a+b+c>=150&&(a>=80||b>=80))System.out.println("B");
			else  System.out.println("C");

		}

	}
}

Measured memory_bytes: 28480
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin>>n>>m;
  pair<int, int> ab[n];
  for (int i=0; i<n; i++) cin>>ab[i].first>>ab[i].second;
  sort(ab, ab + n);
  long long ans = 0;
  priority_queue<int> pq;
  int idx = 0;
  for (int i=m-1; i>=0; i--) {
    while (idx < n && ab[idx].first <= m - i) {
      pq.push(ab[idx].second);
      ++idx;
    }
    if (!pq.empty()) {
      int top = pq.top();
      pq.pop();
      ans += top;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1660
#include <iostream>
#include <utility>

using namespace std;

int main(){
  int cnt=0;
  int n; cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=0;i<n;i++){
    int minj=i;
    for(int j=i;j<n;j++){
      if(a[j]<a[minj]) minj=j;
    }
    if(i!=minj) cnt++;
    swap(a[i],a[minj]);
  }
  for(int i=0;i<n;i++){
    if(i==n-1) cout << a[n-1] << endl;
    else cout << a[i] << " ";
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;

int main(){
  int H , W;
  cin >> H >> W;
  vector<vector<char>> data(H , vector<char>(W));
  
  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      cin >> data.at(i).at(j);
    }
  }
  
  for(int i = 0;i < H;i++){ //横一列を確認
    for(int j = 0;j < W;j++){
      if(data.at(i).at(j) == '.'){
        if(j == W - 1){
          for(int k = 0;k < W;k++){
            data.at(i).at(k) = 'x';
          }
        }
        else{
          continue;
        }
      }
      
      if(data.at(i).at(j) == '#'){
        break;
      }
    }
  }
  
  for(int i = 0;i < W;i++){ //縦一列を確認
    for(int j = 0;j < H;j++){
      if(data.at(j).at(i) == '.' || data.at(j).at(i) == 'x'){
        if(j == H - 1){
          for(int k = 0;k < H;k++){
            data.at(k).at(i) = 'x';
          }
        }
        else{
          continue;
        }
      }
      
      if(data.at(j).at(i) == '#'){
        break;
      }
    }
  }
  
  for(int i = 0 ; i < H;i++){
    for(int j = 0;j < W;j++){
      if(data.at(i).at(j) == '#' || data.at(i).at(j) == '.'){
        cout << data.at(i).at(j);
      }
      if(j == W - 1){
        cout << endl;
      }
    }
  }
      
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, h, m;
    scanf("%d %d %d %d",&a, &b, &h, &m);
    double hour = (h*60)+m;
    hour = (double)hour*0.5;
    double min = m*6;
    double angular_d =abs(hour - min);
    double pi = 2*acos(0);
    double angle = (angular_d*pi)/180;
    double ans = sqrt((a*a)+(b*b)-(2*a*b*cos(angle)));
    printf("%.20lf\n",ans);
    return 0;
    
}

Measured memory_bytes: 4280
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <string.h>
#include <queue>
#include <functional>

#define NMAX 100010
#define MOD 1000000007
#define INF 2000000000
#define PI 3.1415926535
#define EPS 1.e10-6

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) > 0 ? (a) : (-a))

typedef unsigned long long ull;
typedef long long ll;

using namespace std;

int n, m;
bool ac[NMAX];
int wa[NMAX];
int acCount, waCount;

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int p;
		char rep[3];

		cin >> p >> rep;
		if (rep[0] == 'A')
		{
			if (!ac[p])
			{
				ac[p] = 1;
				acCount++;
				waCount += wa[p];
			}
		}
		else if (rep[0] == 'W')
		{
			if (!ac[p])
				wa[p]++;
		}
	}
	cout << acCount << ' ' << waCount << '\n';
}


Measured memory_bytes: 768
#include<bits/stdc++.h>

using namespace std;

int main(){
    int n, res = 0;
    cin >> n;
    for(int i=1;i<=n;i++){
        int x;
        cin >> x;
        if(x%2==1 && i%2==1) res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int a = sc.nextInt();

        if(a==0) {
        System.out.println(1);
        } else {
        	System.out.println(0);
        }
    }
}


Measured memory_bytes: 35568
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;


long long cnt;
int n;
int A[1000000];
vector<int> G;


void insertionSort(int A[], int n, int g)
{
    for (int i = g; i < n; ++i)
    {
        int v = A[i], 
            j = i - g;

        while (j >= 0 && A[j] > v)
        {
            A[j+g] = A[j];
            j -= g;
            ++cnt;
        }

        A[j+g] = v;
    }
}

void shellSort(int A[], int n)
{
    for (int h = 1; ; )
    {
        if (h > n)
        {
            break;
        }

        G.push_back(h);

        h = (h*3) + 1;
    }

    for (int i = G.size()-1; i >= 0; --i)
    {
        insertionSort(A, n, G[i]);
    }
}

int main()
{
    cin >> n;

    for (int i = 0; i != n; ++i)
    {
        scanf("%d", &A[i]);
    }

    shellSort(A, n);

    printf("%d\n", G.size());

    for (int i = G.size()-1; i >= 0; --i)
    {
        printf("%d", G[i]);

        if (i)
        {
            printf(" ");
        }

    }

    printf("\n%d\n", cnt);

    for (int i = 0; i != n; ++i)
    {
        printf("%d\n", A[i]);
    }

    return 0;
}


Measured memory_bytes: 7176
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for(int i = 0; i < N; i++)
  {
    cin >> A.at(i) >> B.at(i);
  }
  
  long long ans = 0;
  for(int i = N - 1; i >= 0; i--)
  {
    ans += (B.at(i) - ((ans + A.at(i)) % B.at(i))) % B.at(i);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define MAX 100005
#define NIL -1

typedef struct {int p, l, r;} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if( T[u].p == NIL ) printf("root, ");
  else if( T[u].l == NIL ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0, c=T[u].l; c != NIL; i++, c=T[c].r) {
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void rec(int u, int p) {
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(void) {
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++) {
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++) {
      scanf("%d",&c);
      if(j==0) T[v].l=c;
      else T[l].r =c;
      l = c;
      T[c].p = v;
    }
  }
  for(i=0;i<n;i++) {
    if(T[i].p == NIL) r = i;
  }
  
  rec(r,0);
  
  for(i=0;i<n;i++) print(i);
  
  return 0;
}


Measured memory_bytes: 6372
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
bool pos(int x,int y){
  return 0<=x&&x<8&&0<=y&&y<8;
}
int main(){
  string in;
  int fld[8][8];
  while(cin>>in){
    for(int i=0;i<8;i++)fld[i][0]=in[i]-'0';
    for(int i=1;i<8;i++){
      cin>>in;
      for(int j=0;j<8;j++){
        fld[j][i]=in[j]-'0';
      }
    }
    char ans='.';
    for(int x=0;x<8;x++){
      if(ans!='.')break;
      for(int y=0;y<8;y++){
        if(ans!='.')break;
        if(fld[x][y]){
          if(fld[x+1][y]&&pos(x+1,y)){
            if(fld[x][y+1]&&pos(x,y+1)){
              if(fld[x+1][y+1]&&pos(x+1,y+1))ans='A';
              else if(fld[x-1][y+1]&&pos(x-1,y+1))ans='G';
            }
            if(fld[x+2][y]&&fld[x+3][y]&&pos(x+2,y)&&pos(x+3,y))ans='C';
            if(fld[x+1][y+1]&&fld[x+2][y+1]&&pos(x+1,y+1)&&pos(x+2,y+1))ans='E';
          }else if(fld[x][y+1]&&pos(x,y+1)){
            if(fld[x][y+2]&&pos(x,y+2)&&fld[x][y+3]&&pos(x,y+3))ans='B';
            if(fld[x-1][y+1]&&pos(x-1,y+2)&&fld[x-1][y+2]&&pos(x-1,y+2))ans='D';
            if(fld[x+1][y+1]&&pos(x+1,y+1)&&fld[x+1][y+2]&&pos(x+1,y+2)) ans='F';
          }
        }
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1176
#include <iostream>
using namespace std;
int main(void){
    int r, c;
    
    cin >> r >> c;
    int sheet[c+1][r+1];
    
    for(int i=0; i < r+1; i++){
        for(int j=0; j < c+1; j++){
            sheet[j][i] = 0;
        }
    }
    
    for(int i=0; i < r; i++){
        for(int j=0; j < c; j++){
            cin >> sheet[j][i];
            sheet[c][i] += sheet[j][i];
            sheet[j][r] += sheet[j][i];
            sheet[c][r] += sheet[j][i];
        }
    }
    
    for(int i=0; i < r+1; i++){
        for(int j=0; j < c+1; j++){
            cout << sheet[j][i];
            if(j != c)
                cout << " ";
            else
                cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;

int main(){
string N;
cin >> N;
if((N.at(0) == N.at(1) && N.at(1) == N.at(2)) || (N.at(1) == N.at(2) && N.at(2) == N.at(3))){
       cout << "Yes" << endl;
}
else {
       cout << "No" << endl; 
}
}

Measured memory_bytes: 256
#include <climits>
#include <iostream>
#include <vector>
using namespace std;

bool check(int N, vector<int>& a, int t) {
	for (int i = 0; i + t < N; i++)
		if (a[i] != a[i + t])
			return false;
	return true;
}

int main() {
	int N; cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++)
		scanf("%d", &a[i]);
	int mi = INT_MAX;
	for (int d = 1; d * d <= N; d++)
		if (N % d == 0) {
			if (check(N, a, d)) mi = min(mi, d);
			if (check(N, a, N / d)) mi = min(mi, N / d);
		}
	cout << N / mi << endl;
}

Measured memory_bytes: 3632
def f(nums, K, w):
  h=len(nums)
  counter=[nums[x][0] for x in range(h)]
  if max(counter)>K:
    return float('inf')
  
  out=0
  for i in range(1, w):
    for x in range(h):
      counter[x]+=nums[x][i]
      
    if max(counter)>K:
      out+=1
      counter=[nums[x][i] for x in range(h)]
      
  return out

H, W, K=map(int, input().split())
S=[input() for _ in range(H)]
S=[[int(S[i][j]) for j in range(W)] for i in range(H)]
ans=float('inf')
for p in range(2**(H-1)):
  q='0'+format(p, '0'+str(H-1)+'b')+'1'
  i=0
  c=0
  nums=[]
  while i<H:
    j=1
    while i+j<H and q[i+j]=='0':
      j+=1
    tmp=S[i:i+j]
    nums.append([sum([tmp[y][x] for y in range(j)]) for x in range(W)])
    i+=j
    
  cand=f(nums, K, W)+q.count('1')-1
  if ans>cand:
    ans=cand
    
print(ans)

Measured memory_bytes: 72540
a=[]
a.append(list(map(int,input().split())))
a.append(list(map(int,input().split())))
a.append(list(map(int,input().split())))
n=int(input())
for _ in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                a[i][j]=0
ans = 0
for i in range(3):
    if sum(a[i]) == 0:
        ans+=1
    if sum([a[j][i] for j in range(3)]) == 0:
        ans+=1
if a[0][0]+a[1][1]+a[2][2]==0:
     ans +=1
if a[2][0]+a[1][1]+a[0][2]==0:
     ans +=1
print('Yes' if ans > 0 else 'No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = 0, id = 1;
    rep(i, n){
        if(a[i] != id) ans++;//砕く
        else id++; //あってた
    }
    if(ans == n) ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>

using namespace std;
int main(){
    long n,d,count=0;
    cin >> n >> d;
    while(n--){
       long a,b;
       cin >> a >> b;
       if(sqrt(a*a+b*b) <= d)
          count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main() {
	int n;cin >> n;
  vector<int> a(n),c(3,0);
  rep(i,n) cin >> a[i];
  ll ans = 1;
  rep(i,n){
    ll cnt = 0,id = -1;
    if(a[i]==c[0]){cnt++;id=0;}
    if(a[i]==c[1]){cnt++;id=1;}
    if(a[i]==c[2]){cnt++;id=2;}
    if(id==-1){
      cout << 0<<endl;
      return 0;
    }ans *= cnt;ans %=1000000007;c[id]++;
  }cout << ans << endl;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

ll fact[(ll)(1e5+2)] = {1};

ll pow(ll a, ll b){
	return (b ? (((b & 1) ? a * pow(a, b - 1) % mod : pow(a * a % mod, b / 2) % mod)) : 1);
}

ll comb(ll n, ll k){
	return (n < k ? 0 : (fact[n] % mod) * pow(fact[n - k] * fact[k] % mod, mod - 2) % mod);
}

int main(){
	ll n; cin >> n;
	for(ll i = 1; i <= (ll)1e5 + 1; ++i) fact[i] = i * fact[i - 1] % mod;
	ll pos[n] = {};
	ll kaburi, kaburiburi;
	for(ll i = 1; i <= n + 1; ++i){
		ll a; cin >> a;
		if(pos[--a]){
			kaburi = pos[a];
			kaburiburi = i;
		}else{
			pos[a] = i;
		}
	}
	for(ll k = 1; k <= n + 1; ++k){
		ll po = comb(n + 1, k) - comb(n + 1 - (kaburiburi - kaburi + 1), k - 1);
		cout << (po < 0 ? po + mod : po) << endl;
	}
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }
 
  int main(){
      lint a,b,c,d;
      cin>>a>>b>>c>>d;
      d-=b;c-=a;
      rep(i,c){
          cout<<'R';
      }
      rep(i,d){
          cout<<'U';
      }
        rep(i,c){
          cout<<'L';
      }
      rep(i,d+1){
          cout<<'D';
      }
       rep(i,c+1){
          cout<<'R';
      }
         rep(i,d+1){
          cout<<'U';
      }
      cout<<"LU";
        rep(i,c+1){
          cout<<'L';
      }
      rep(i,d+1){
          cout<<'D';
      }
      cout<<'R';


}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	double x1,y1,x2,y2,xq,yq;
	double m,x,y,c;
	while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq)){
		if(x2==x1){
			xq *=-1;
			printf("%.6f %.6f\n",xq,yq);
		}else{
			m = (y2-y1)/(x2-x1);
			c = y2-m*x2;
			x = (2*m*yq-xq*(m*m-1)-2*m*c)/(m*m+1);
			y = (2*m*xq+yq*(m*m-1)+2*c)/(m*m+1);
			printf("%.6f %.6f\n", x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 1240
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    int N,i;
    double j;
    cin>>N;
    if(N%2==0)
    {
        i=N/2;
    }
    else if(N%2==1)
    {
        i=N/2+1;
    }
    j=(i*1.0)/(N*1.0);
    cout<<fixed<<setprecision(10)<<j<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//絶対値
long long int change_plus(long long int a) {
	if (a < 0) { return -a; }
	if (a >= 0) { return a; }
}
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

main() {
	long long int n, m, k = 0;
	char str[5];
	scanf("%s", str);

	if (str[0] == str[2]) { printf("Yes"); }
	else { printf("No"); }

}

Measured memory_bytes: 128
s = input()
length=len(s)

count1=0
count2=0

for i in range(0,length):
	if i%2==0:
		if s[i]=='0':
			count1+=1
		else:
			count2+=1
	if i%2==1:
		if s[i]=='0':
			count2+=1
		else:
			count1+=1

if count1>=count2:
	print(count2)
else:
	print(count1)

Measured memory_bytes: 3188
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

const int nmax = 40, abmax = 10;

int a[nmax], b[nmax], c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];

int main(){
    int n, ma, mb;
    cin >> n >> ma >> mb;

    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }

    for(int i = 0; i <= n; i++){
        for(int ca = 0; ca <= nmax*abmax; ca++){
            for(int cb = 0; cb <= nmax*abmax; cb++){
                dp[i][ca][cb] = INF;
            }
        }
    }

    dp[0][0][0] = 0;

    for(int i = 0; i < n; i++){
        for(int ca = 0; ca <= nmax*abmax; ca++){
            for(int cb = 0; cb <= nmax*abmax; cb++){
                if(dp[i][ca][cb] == INF) continue;
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
                dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i]);

            }
        }
    }

    int ans = INF;
    for(int ca = 1; ca <= nmax*abmax; ca++){
        for(int cb = 1; cb <= nmax*abmax; cb++){
            if(ca*mb == cb*ma) ans = min(ans, dp[n][ca][cb]);
        }
    }

    if(ans == INF) ans = -1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 25984
N,W=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N)]
for i in range(N):
  w,v=map(int,input().split())
  for j in range(W+1):
    dp[i][j]=max(dp[i-1][j-w]+v if j>=w else 0,dp[i-1][j])
print(dp[-1][-1])

Measured memory_bytes: 120428
import qualified Data.Vector as V

solve :: Int -> Int -> V.Vector Int -> Int
solve n k xs = (\t -> if null t then 0 else minimum t) $ map (\i -> dist (xs V.! i) (xs V.! (i+k-1))) [0..n-k] where
  dist x y =
    let
      l = max (-x) 0
      r = max y 0
    in
      l + r + min l r

main = do
  [n,k] <- fmap read . words <$> getLine
  xs <- fmap read . words <$> getLine
  print $ solve n k $ V.fromList xs



Measured memory_bytes: 58748
#include <bits/stdc++.h>
using namespace std;

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    string S;cin >> S;
    int N = S.size();
    int ans = 0;
    for(int i = 0;i < N / 2;i++){
        if(S[i] != S[N-i-1]){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    map<string,int> mp;
    cin >>n;
    int mx = 0;
    REP(i,n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    
    for(const auto x:mp){
        mx = max(mx,x.second);
    }
    for(const auto x:mp){
        if (x.second == mx){
            cout << x.first << endl;
        }
    }
    


}

Measured memory_bytes: 23808
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void){
    register int i;
    int n;
    scanf("%d",&n);
    char kind[n][11];
    for(i = 0;i < n;i++)scanf("%s",kind[i]);
    qsort(kind,n,11,strcmp);
    int ans = 1;
    for(i = 1;i < n;i++)if(strcmp(kind[i-1],kind[i]))ans++;
    printf("%d",ans);
}

Measured memory_bytes: 5736
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;
int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> cnt(N, 1);
    vector<bool> check(N, false);
    check[0] = true;

    rep(i, M) {
        int x, y;
        cin >> x >> y;
        x--, y--;

        if (check[x]) {
            if (cnt[x] == 1) check[x] = false;
            check[y] = true;
        }
        cnt[x]--, cnt[y]++;
    }

    int ans = 0;
    rep(i, N) {
        if (check[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import sys

sys.setrecursionlimit(100001)

def dfs(temp):
    global dist, e, count_from, count, parent

    if count[temp] == count_from[temp]:
        for to in e[temp]:
            count[to] += 1
            temp_dist = dist[temp] + 1
            if temp_dist > dist[to]:
                parent[to] = temp
                dist[to] = temp_dist
            dfs(to)

N, M = map(int, input().split())

count_from = [0] * N
count_to = [0] * N
e = [[] for _ in range(N)]

for i in range(N + M - 1):
    a, b = map(int, input().split())
    e[a - 1].append(b - 1)
    count_from[b - 1] += 1
    count_to[a - 1] += 1

start = 0
for i in range(N):
    if count_from[i] == 0:
        start = i
        break

dist = [0] * N
count = [0] * N
parent = [-1] * N

dfs(start)

for i in range(N):
    print(parent[i] + 1)

Measured memory_bytes: 114132
#include <iostream>

/*void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}*/

using namespace std;

void call(int n);

int main(void){
  int num;
  cin >> num;
  call(num);
  return 0;
}

/*void call(int n){
  int i = 1;
  int x = i;
  if(x%3 != 0){
    while(x%10 != 3 && x){
      x /= 10;
    }
  } else {
    cout << " " << i;
  }
  while(++i <= n){
    x = i;
    if(x%3 != 0){
      while(x%10 !=3 && x){
        x /= 10;
      }
    } else {
      cout << " " << i;
    }
  }
  cout << endl;
}*/

void call(int n){
  int i = 1;
  do{
    //hogehoge...
    int x = i;
    if(x%3 == 0){
      cout << " " << i;
    } else {
      do{
        if(x%10 == 3){
          cout << " " << i;
          break;
        } else {
          x /= 10;
        }
      } while(x);
    }
  } while(++i <= n);
  cout << endl;
  return;
}


Measured memory_bytes: 3092
use std::io::{BufRead, Write};
use std::io;
use std::collections::VecDeque;

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut split = s.split_whitespace();
    let h = split.next().unwrap().parse::<usize>().unwrap();
    let w = split.next().unwrap().parse::<usize>().unwrap();
    let k = split.next().unwrap().parse::<usize>().unwrap();
    let mut min = h + w;
    let mut start = (0, 0);
    let ab = (0..h)
        .map(|x| {
            let mut s = String::new();
            input.read_line(&mut s).unwrap();
            s.chars()
                .enumerate()
                .map(|(y, c)| {
                         if c == 'S' {
                             start = (x, y);
                         }
                         c != '#'
                     })
                .collect::<Vec<_>>()
        })
        .collect::<Vec<_>>();
    let mut bfs = VecDeque::<((usize, usize), usize)>::new();
    bfs.push_back((start, 0));
    let mut visited = vec![vec![false;w];h];
    while !bfs.is_empty() {
        let ((x, y), depth) = bfs.pop_front().unwrap();
        if depth == k + 1 {
            break;
        }
        min = *([x, y, h - 1 - x, w - 1 - y, min].iter().min().unwrap());
        let mut action = |x: usize, y: usize| if ab[x][y] && !visited[x][y] {
            visited[x][y] = true;
            bfs.push_back(((x, y), depth + 1));
        };
        if x != 0 {
            action(x - 1, y);
        }
        if x != h - 1 {
            action(x + 1, y);
        }
        if y != 0 {
            action(x, y - 1);
        }
        if y != w - 1 {
            action(x, y + 1);
        }

    }
    writeln!(output, "{}", 1 + (min + k - 1) / k).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v = Vec::<u8>::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }
    #[test]
    fn case1() {
        test("3 3 3
#.#
#S.
###\n",
             "1\n");
    }
    #[test]
    fn case2() {
        test("3 3 3
###
#S#
###\n",
             "2\n");
    }
    #[test]
    fn case3() {
        test("7 7 2
#######
#######
##...##
###S###
##.#.##
###.###
#######\n",
             "2\n");
    }
}



Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

int main(){
	int n, k;
	cin >> n >> k;
	int a[n];
	rep(i,n){
		cin >> a[i];
	}
	n -= k;
	int ans(1);
	while(n >= 1){
		n -= k-1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef pair<int, int> P;

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int a[3]={};
  for(int i=0; i<2; i++){
    int b;
    cin >> b;
    b--;
    a[b]++;
  }
  for(int i=0; i<3; i++){
    if(a[i]==0) cout << i+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3508
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		char[] s = sc.next().toCharArray();
		//a,aa,c,ca,c,a,b,a,ab,a,b,c
		int cnt = 1;
		char tmp = s[0];
		for (int i = 1; i < s.length; i++) {
			if (tmp == s[i]) {
				tmp = 'A';
				i++;
				if(i != s.length) {
					cnt++;
				}
			} else {
				cnt++;
				tmp = s[i];
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 26596
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    sort(all(a));

    int x1 = a[n-1], x2 = a[0];

    vector<P> history;

    rep(i, n) {
        if (a[i] > 0 && i > 0 && i < n-1) {
            int y = a[i];
            history.push_back({x2, y});
            x2 -= y;
        }
    }

    rep(i, n) {
        if (a[i] <= 0 && i > 0 && i < n-1) {
            int y = a[i];
            history.push_back({x1, y});
            x1 += abs(y);
        }
    }

    history.push_back({x1, x2});
    x1 -= x2;

    cout << x1 << endl;
    rep(i, n-1) {
        printf("%d %d\n", history[i].first, history[i].second);
    }

    return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>

using namespace std;

struct LISChain {
    int value;
    int index;
    LISChain *prev;
    
    LISChain(int v, int i, LISChain *p) : value(v), index(i), prev(p) {}
};

stack<LISChain*> chains;

LISChain *newNode(int v, int i, LISChain *p=NULL) {
    LISChain *node = new LISChain(v, i, p);
    chains.push(node);
    return node;
}

void clearObj() {
    while(!chains.empty()) {
        LISChain *ptr = chains.top();
        chains.pop();
        delete ptr;
    }
}

LISChain *lis(vector<int> a) {
    int n = a.size();
    vector<LISChain*> maxchain(n+1);
    maxchain[0] = newNode(-1, -1);
    int maxlen = 0;
    for(int i=0; i<n; i++) {
        // bsearch
        int ok = 0;
        int ng = maxlen+1;
        while(ng-ok>1) {
            int mid = (ok + ng) / 2;
            if(maxchain[mid]->value < a[i]) ok = mid;
            else ng = mid;
        }
        LISChain *r = newNode(a[i], i, maxchain[ok]);
        maxchain[ok+1] = r;
        if(ok+1>maxlen) maxlen = ok+1;
    }
    return maxchain[maxlen];
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    LISChain *p = lis(a);
    int ans = -1;
    while(p!=NULL) {
        //cout << p->value << ", ";
        ans++;
        p = p->prev;
    }
    cout << ans << endl;
    clearObj();
}


Measured memory_bytes: 8332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<(k) ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=(k) ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef jayinnn
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
const ll MAXN = 100005;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    ll d, t, s;
    cin >> d >> t >> s;
    cout << (d <= t * s ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		switch (S) {
		case "Sunny":
			System.out.println("Cloudy");
			break;
		case "Cloudy":
			System.out.println("Rainy");
			break;
		case "Rainy":
			System.out.println("Sunny");
			break;
		}
	}
}

Measured memory_bytes: 21204
n=int(input())
a=b=1
for i in range(n):
  x,y=map(int,input().split())
  m=max((a-1)//x+1,(b-1)//y+1) #天井関数(x以上の最小の整数)<=>床関数（x以下の最大の整数）
  a=m*x
  b=m*y
print(a+b)

Measured memory_bytes: 3060
D = int(input())
cs = list(map(int,input().split()))
ss =[]
for i in range(D):
  ss.append(list(map(int,input().split())))
ts = []
for i in range(D):
  ts.append(int(input()))
last = [0] * 26
total =0
for i in range(len(ts)):
  t = ts[i]
  last[t-1] = i+1
  genten = 0
  for j in range(len(cs)):
    genten += cs[j] *(i+1 - last[j])
  total += ss[i][t-1]-genten
  print(total)
  
 



          

Measured memory_bytes: 9388
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; scanf("%d", &n);
    vector<vector<int>> g(n), d(n, vector<int>(n));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i != j) d[i][j] = n + 1;
        }
    }
    for (int i = 0; i < n - 1; ++i) {
        int u, v; scanf("%d%d", &u, &v);
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
        d[u][v] = d[v][u] = 1;
    }
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }

    vector<int> cnt(n), fa(n);

    function<void(int, int)> DfsFa = [&](int x, int p) {
        fa[x] = p;
        for (int u : g[x]) {
            if (u != p) DfsFa(u, x);
        }
    };

    function<void(int, int, int)> Dfs = [&](int x, int p, int d) {
        int ch = 0;
        for (int u : g[x]) ch += u != p;
        cnt[d] = max(cnt[d], ch);
        for (int u : g[x]) {
            if (u != p) Dfs(u, x, d + 1);
        }
    };

    auto Solve = [&](int x) { 
        fill(cnt.begin(), cnt.end(), 0);
        Dfs(x, -1, 0);
        long long res = 1;
        for (int i = 0; i < n; ++i) {
            if (cnt[i] == 0) break;
            res *= cnt[i];
        }
        return res;
    };

    auto Solve2 = [&](int x, int y) { 
        fill(cnt.begin(), cnt.end(), 0);
        Dfs(x, y, 0);
        Dfs(y, x, 0);
        long long res = 2;
        for (int i = 0; i < n; ++i) {
            if (cnt[i] == 0) break;
            res *= cnt[i];
        }
        return res;
    };

    int color = n + 1;
    long long ans = 1'000'000'000'000'000'000;
    for (int i = 0; i < n; ++i) {
        int pd = 0;
        for (int j = 0; j < n; ++j) pd = max(pd, d[i][j]);
        if (pd > color) continue;
        long long res = Solve(i);
        if (pd < color) color = pd, ans = res;
        else ans = min(ans, res);
    }
    for (int i = 0; i < n; ++i) {
        for (int j : g[i]) {
            int pd = 0;
            for (int k = 0; k < n; ++k) pd = max(pd, min(d[i][k], d[j][k]));
            if (pd > color) continue;
            long long res = Solve2(i, j);
            if (pd < color) color = pd, ans = res;
            else ans = min(ans, res);
        }
    }
    printf("%d %lld\n", color + 1, ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
	
	int n,l[100001],r[100001],i,sum=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d %d",&l[i],&r[i]);
		sum=sum+r[i]-l[i]+1;
	}
	
	printf("%d\n",sum);
	
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
string txt;
  cin >> txt;
if(txt=="SUN")cout << "7"<<endl;
if(txt=="MON")cout << "6"<<endl;
  if(txt=="TUE")cout <<"5"<<endl;
  if(txt=="WED")cout << "4"<<endl;
  if(txt=="THU")cout << "3"<<endl;
  if(txt=="FRI")cout << "2"<<endl;
  if(txt=="SAT")cout << "1"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int A,B,C,D,E;
    cin >> A >> B >> C >> D >> E  ;
    vector<int> time = {A,B,C,D,E};
    int a,b,c,d,e;
    a = A % 10;
    b = B % 10;
    c = C % 10;
    d = D % 10;
    e = E % 10;
    vector<int> add = {a,b,c,d,e};
    sort(add.begin(),add.end());
    int first;
    bool frg= false;
    for(int i=0;i<5;i++){
        if(add[i]!=0){
            first =add[i];
            frg = true;
            break;
        }
    }
    int ans = 0;
    for(int i=0;i<5;i++){
        if(time[i]%10==0){
            ans = ans + time[i];
        }
        else{
            ans = ans + ((time[i]/10)+1)*10 ;
        }
    }
    if(frg){
        ans = ans - 10 + first;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;


//defines...
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define in insert
#define pi 2*acos(0.0)1
#define srt(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()

const ll mod=1e9+7;
const ll MX=2e5+5;

//code goes from here...



int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);

    freopen("output.txt", "w", stdout);
#endif

    boost
    //---------------------------------
    int n;
    cin >> n;
    vector <int> v(n);
    for(auto &i  : v) cin >> i;
    int tmp=v[0],ans=0;
    for(int i=0;i<n;i++)
    {
        if(v[i]<=tmp)
        {
            tmp=v[i];
            ans++;
        }
        
    }
    cout << ans << endl;
    //---------------------------------
    
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define LINF		((ll)1 << 63 -1)
#define INF 		(1<<29)
#define MINF		-2000000007
#define MAX 		200050

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

int R[MAX];
int L[MAX];

//
int main(){
	int N;
	cin >> N;
	V A(N);
	REP(i,N)cin>>A[i];

	R[N] = A[N-1];
	L[1] = A[0];
	REPS(i,1,N){
		L[i+1] = max(A[i],L[i]);
		R[N-i] = max(A[N-i-1],R[N-i+1]);
	}

	REPS(i,1,N+1)cout<< max(L[i-1],R[i+1]) << endl;

	return 0;
}




Measured memory_bytes: 3968