akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

LL l, r;

int main() {
	cin >> l >> r;
	
	LL ans = l * r;
	if(r - l + 1 >= 2019) { ans = 0; } else {
		incII(i, l, r) {
		incII(j, l, r) {
			if(i == j) { continue; }
			setmin(ans, i * j % 2019);
		}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

class RangeMin {
public:
	int size_ = 1;
	vector<int> dat;

	void init(int sz) {
		while (size_ <= sz) size_ *= 2;
		dat.resize(size_ * 2, 1 << 30);
	}
	void update(int pos, int x) {
		pos += size_; dat[pos] = x;
		while (pos >= 2) {
			pos >>= 1;
			dat[pos] = min(dat[pos * 2], dat[pos * 2 + 1]);
		}
	}
	int query_(int l, int r, int a, int b, int u) {
		if (l <= a && b <= r) return dat[u];
		if (r <= a || b <= l) return (1 << 30);
		int v1 = query_(l, r, a, (a + b) >> 1, u * 2);
		int v2 = query_(l, r, (a + b) >> 1, b, u * 2 + 1);
		return min(v1, v2);
	}
	int query(int l, int r) {
		return query_(l, r, 0, size_, 1);
	}
};

int N, K, A[1 << 18], C[1 << 18]; bool used[1 << 18];
RangeMin Z1, Z2;

int main() {
	cin >> N >> K;
	
	// RMQ 等を用いて差分を求める
	Z1.init(N + 1); Z2.init(N + 1);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		Z1.update(i, A[i]);
		Z2.update(i, -A[i]);
	}
	for (int i = 1; i < N; i++) {
		if (A[i - 1] < A[i]) C[i] = 1;
	}
	for (int i = 1; i < N; i++) C[i] += C[i - 1];

	for (int i = 0; i < N - K; i++) {
		int cl = i, cr = i + K;
		int v1 = A[cl], v4 = A[cr];
		int v2 = Z1.query(cl + 1, cr), v3 = -Z2.query(cl + 1, cr);

		if (v1 <= v2 && v2 <= v3 && v3 <= v4) used[i + 1] = true;
	}

	int ans = N - K + 1, cnt = 0;
	for (int i = 0; i < N - K + 1; i++) {
		if (used[i] == true) continue;
		int P = C[i + K - 1] - C[i];
		if (P == K - 1) cnt++;
	}
	if (cnt >= 2) ans -= (cnt - 1);
	for (int i = 0; i < N - K + 1; i++) {
		if (used[i] == true) ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6144
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#include <cmath>

using namespace std;

double x[2000], y[2000], r[2000];
double G[2000][2000]; // v_n means target
double d[2000];
char visited[2000];

int main(void) {
    int n;
    double xs,ys,xt,yt;

    scanf("%lf%lf%lf%lf", &xs, &ys, &xt, &yt);
    scanf("%d",&n);

    for(int i=0; i<n; i++) {
        scanf("%lf%lf%lf", &x[i], &y[i], &r[i]);
    }
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++) {
            double dis = sqrt( (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) );
            G[i][j] = G[j][i] = dis > (r[i] + r[j]) ? dis - (r[i] + r[j]) : 0.0;
        }
    for(int i=0; i<n; i++) {
        double dis = sqrt( (x[i] - xt) * (x[i] - xt) + (y[i] - yt) * (y[i] - yt) );
        G[i][n] = G[n][i] = dis > r[i] ? dis - r[i] : 0.0;
        double dis2 = sqrt( (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) );
        d[i] = dis2 > r[i] ? dis2 - r[i] : 0.0;
    }
   d[n] = sqrt( (xt - xs) * (xt - xs) + (yt - ys) * (yt -ys) );

    for(;;) {
        int u = n;
        for(int i=0; i<=n; i++) {
            if(!visited[i] && d[i] < d[u]) u=i;
        }
        visited[u] = 1;
        if(u == n) break;

        for(int i=0; i<=n; i++) {
            if(d[i] > d[u] + G[u][i])
                d[i] = d[u] + G[u][i];
        }
    }
    printf("%.32f\n", d[n]);
    return 0;
}

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

int main(){
    using namespace std;
    unsigned long N, M, Q;
    cin >> N >> M >> Q;
    vector<tuple<unsigned long, unsigned long, unsigned long, unsigned long>> q(Q);
    for(auto&& [A, B, C, D] : q)cin >> A >> B >> C >> D;
    vector<unsigned long> now(N + 1, 1);
    cout << [dfs_impl = [&N, &M, &q, &now](auto f, unsigned long d) -> unsigned long {
        unsigned long ret{0};
        if(d == N + 1){
            for(const auto& [A, B, C, D] : q)if(now[B] - now[A] == C)ret += D;
            return ret;
        }
        for(now[d] = now[d - 1]; now[d] <= M; ++now[d])ret = max(ret, f(f, d + 1));
        return ret;
    }]{return dfs_impl(dfs_impl, 1);}() << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int K;
  cin >> K;
  int result = 0;
  for(int a = 1;a <= K;a++){
    for(int b = 1;b < a;b++){
      for(int c = 1;c < b;c++){
        for(int d = a;d >= 1;d -= 1){
          if(a%d==0&&b%d==0&&c%d==0){
            result += 6 * d;
            break;
          }
        }
      }
    }
  }
  
  for(int a = 1;a <= K;a++){
    for(int b = 1;b < a;b++){
      for(int c = a;c >= 1;c -= 1){
      if(a%c==0&&b%c==0){
            result += 6 * c;
            break;
          }
      }
    }
  }
  for(int a = 1;a <= K;a++){
            result += a;
  }
 
cout<<result<<endl;
}

Measured memory_bytes: 3636
from itertools import accumulate
from operator import add
N = int(input())
LR = [tuple(map(int, input().split())) for _ in range(N)]
LR.sort()
f = lambda lr1, lr2: (max(lr1[0], lr2[0]), min(lr1[1], lr2[1]))
g = lambda lr: max(0, lr[1]-lr[0]+1)
A = list(map(g, accumulate(LR, f)))
B = list(map(g, accumulate(LR[::-1], f)))[-2::-1]
res = max(max(map(g, LR)) + A[-1], max(map(add, A, B)))
print(res)

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

  using namespace std;
  using namespace std::chrono; 

  typedef long long int ll;

  #define MOD (ll)(1e9+7)
  #define endl "\n"
  #define pb push_back
  #define TEST_CASES  ll t;cin>>t;while(t--)
  #define forn(i,a,n) for (int i = a; i < n; ++i)
  #define f first
  #define s second
  #define all(x) x.begin(), x.end()

  void __print(int x) {cerr << x;}
  void __print(long x) {cerr << x;}
  void __print(long long x) {cerr << x;}
  void __print(unsigned x) {cerr << x;}
  void __print(unsigned long x) {cerr << x;}
  void __print(unsigned long long x) {cerr << x;}
  void __print(float x) {cerr << x;}
  void __print(double x) {cerr << x;}
  void __print(long double x) {cerr << x;}
  void __print(char x) {cerr << '\'' << x << '\'';}
  void __print(const char *x) {cerr << '\"' << x << '\"';}
  void __print(const string &x) {cerr << '\"' << x << '\"';}
  void __print(bool x) {cerr << (x ? "true" : "false");}

  template<typename T, typename V>
  void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  template<typename T>
  void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  void _print() {cerr << "]\n";}
  template <typename T, typename... V>
  void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  #ifndef ONLINE_JUDGE
  #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
  #else
  #define debug(x...)
  #endif
  
  ll powD(ll x,ll y){
    ll res = 1;
    while(y > 0){
      if(y & 1)
        res = (res*x)%MOD;
      x = (x*x)%MOD;
      y = y>>1;
    }
    return res;
  }


  /*CHECK FOR CORNER CASES FOR GOD'S SAKE*/
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin>>x;
    if(x>=30)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
   
  


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

int main()
{
    ll N; cin >> N;
    vector<ll> a(N, 0);
    rep(i,N) {
        cin >> a[i];
    }
    ll ans = 0;
    rep(i,N) {

        if (i+1 == a[a[i]-1]) {
            ans++;
        }

    }
    cout << ans / 2 << endl;


}


Measured memory_bytes: 4032
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

//最大公約数
	long long GCD(long long a, long long b) {
		if (a < b)
			swap(a, b);
		if (b == 0) return a;
		else return GCD(b, a % b);
	}
	//素数判定
	bool sosuu_check(int num) {
		int i;
		for (i = 2; i <= sqrt(num); ++i) {
			if (num%i == 0)
				return false;
		}
		return (num < 2) ? false : true;
	}
	
	int check(int N, int a, int b) {
		int A,B,i;
		if (a > b) {
			A = a;
			B = b;
		}
		else {
			A = b;
			B = a;
		}
		for (i = N / b; i > 0; i--) {
			if ((N - b * i) % a == 0) {
				return i;
			}
		}
		return 0;
	}


int main() {
	int zero=0, one=0,i;
	string S;
	cin >> S;
	REP(i, (int)S.size()) {
		if (S[i] == '1')
			zero++;
		else
			one++;
	}
	cout << min(zero, one) * 2 << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  sort(P.begin(),P.end());
  int sum=0;
  for(int i=0;i<N-1;i++){
    sum+=P.at(i);
  }
  sum+=P.at(N-1)/2;
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int a[200000];
long long left1[200001][2];
long long left2[200001][2];
long long right1[200001][2];
long long right2[200001][2];

int main() {
    int l, i, j;
    long long ans = 1e18;
    
    scanf("%d", &l);
    
    for (i = 0; i < l; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < l; i++) {
        left1[i + 1][0] = left1[i][0] + a[i];
        left1[i + 1][1] = min(left1[i][0], min(left1[i][1], left2[i][1])) + 1 - a[i] % 2;
        left2[i + 1][0] = left2[i][0] + a[i];
        left2[i + 1][1] = min(left2[i][0], left2[i][1]) + a[i] % 2;
        if (a[i] == 0) left2[i + 1][1] += 2;
    }
    
    for (i = l - 1; i >= 0; i--) {
        right1[i][0] = right1[i + 1][0] + a[i];
        right1[i][1] = min(right1[i + 1][0], min(right1[i + 1][1], right2[i + 1][1])) + 1 - a[i] % 2;
        right2[i][0] = right2[i + 1][0] + a[i];
        right2[i][1] = min(right2[i + 1][0], right2[i + 1][1]) + a[i] % 2;
        if (a[i] == 0) right2[i][1] += 2;
    }
    
    for (i = 0; i <= l; i++) {
        ans = min(ans, min(left1[i][0], left1[i][1]) + min(right2[i][0], right2[i][1]));
        ans = min(ans, min(left2[i][0], left2[i][1]) + min(right1[i][0], right1[i][1]));
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 13440
h, w = map(int, input().split())


def calc(a, b):
    ret = a * b
    for i in range(1, a):
        area1 = b // 2 * i
        area2 = -(-b // 2) * i
        area3 = a * b - (area1 + area2)
        #print(area1, area2, area3)
        ret = min(ret, max(area1, area2, area3) - min(area1, area2, area3))
    return ret

if h % 3 == 0 or w % 3 == 0:
    print(0)
else:
    ans = h * w
    for i in range(1, max(h, w) - 1):
        area1 = min(h, w) * i
        area2 = min(h, w) * ((max(h, w) - i) // 2)
        area3 = min(h, w) * (-(-(max(h, w) - i) // 2))
        #print(area1, area2, area3)
        ans = min(ans, max(area1, area2, area3) - min(area1, area2, area3))
    print(min(calc(h, w), calc(w, h), ans))


Measured memory_bytes: 3064
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long

#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

int main() {
	int n;
	cin >> n;
	vector<long long>l = vector<long long>(n, 0);
	vector<long long>r = vector<long long>(n, 0);
	rup(i, 0, n) {
		cin >> l[i] >> r[i];
	}
	vector<long long> sum = vector<long long>(n, 0);
	rup(i, 0, n) {
		sum[i] = r[i] - l[i] + 1;
	}
	long long s = 0;
	rup(i, 0, n) {
		s += sum[i];
	}
	cout << s;

	return 0;
}





Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;

#define EPS 1e-10

int main() {
	double ax, ay, bx, by, cx, cy, dx, dy;
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy,&dx,&dy) != EOF) {
		if (fabs((ax - bx)*(cx - dx) + (ay - by)*(cy - dy)) < EPS) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
	return 0;
}

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

#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;

using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  vector<int> vc(n);
  for(int& c:vc) cin>>c;
  sort(ALL(vc));
  if (vc.back() - vc.front() > 1) {
    cout << "No" << endl;
    
  } else if (vc.back() == vc.front()) {
    if (vc.front() <= n/2 || vc.front() == n-1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    int low = count(ALL(vc), vc.front());
    int high = n-low;
    if (low < vc.back() && vc.back() <= low + high/2) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(ll i=0;i<n;++i)
#define FOR(i,j,n) for(ll i=j;i<n;++i)
#define MOD (1e9 + 7)

int main(void){
    ll N, K;
    cin >> N >> K;
    ll have[N];
    REP(i,N) have[i] = 1;
    ll d, buf;
    REP(i,K){
        cin >> d;
        REP(j,d){
            cin >> buf;
            have[buf-1] = 0;
        }
    }
    ll res = 0;
    REP(i,N) res += have[i];
    cout << res << endl;
}

Measured memory_bytes: 3632
/*
 * 2320.cc: Infinity Maze
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 100;
const int MAX_W = 100;

const int dxs[] = {1, 0, -1, 0}, dys[] = {0, -1, 0, 1};
const char dcs[] = {'E', 'N', 'W', 'S'};

typedef long long ll;

/* typedef */

struct Robot {
  int x, y, di;
  Robot() {}
  Robot(int _x, int _y, int _di): x(_x), y(_y), di(_di) {}
};

/* global variables */

bool flds[MAX_H][MAX_W];
int cache[MAX_H][MAX_W][4];
Robot rs[MAX_H * MAX_W * 4];

/* subroutines */

/* main */

int main() {
  for (;;) {
    int h, w;
    ll l;
    cin >> h >> w >> l;
    if (h == 0) break;

    memset(flds, true, sizeof(flds));
    memset(cache, -1, sizeof(cache));

    int rx, ry, rd;
    
    for (int y = 0; y < h; y++) {
      string s;
      cin >> s;
      for (int x = 0; x < w; x++)
	switch (s[x]) {
	case 'E': rx = x; ry = y; rd = 0; break;
	case 'N': rx = x; ry = y; rd = 1; break;
	case 'W': rx = x; ry = y; rd = 2; break;
	case 'S': rx = x; ry = y; rd = 3; break;
	case '#': flds[y][x] = false; break;
	}
    }

    int d = 0;
    while (cache[ry][rx][rd] < 0) {
      rs[d] = Robot(rx, ry, rd);
      cache[ry][rx][rd] = d++;
      for (;;) {
	int x = rx + dxs[rd], y = ry + dys[rd];
	if (x >= 0 && x < w && y >= 0 && y < h && flds[y][x]) {
	  rx = x; ry = y;
	  break;
	}
	rd = (rd + 3) % 4;
      }
    }

    int c = cache[ry][rx][rd];
    if (l <= c) {
      Robot &rl = rs[l];
      printf("%d %d %c\n", rl.y + 1, rl.x + 1, dcs[rl.di]);
    }
    else {
      Robot &rl = rs[(l - c) % (d - c) + c];
      printf("%d %d %c\n", rl.y + 1, rl.x + 1, dcs[rl.di]);
    }
  }
  return 0;
}

Measured memory_bytes: 1448
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main() {
    int n;
    while(scanf("%d",&n),n) {
        int ans = 1;
        bool flg = true;
        for(int i = 0; i < n; i++) {
            int k;
            scanf("%d",&k);
            if(k >= 1) ans++;
            if(k >= 2) flg = false;
        }
        if(flg) puts("NA");
        else printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1040
#include <stdio.h>
#include <math.h>
int main(void){
    int i,n,ans;
    double xa,ya,ra,xb,yb,rb,AB,R;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
        AB=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
        R=(ra>rb) ? ra-rb : rb-ra;
        
        if(AB>ra+rb) ans=0;
        if(R<=AB && AB<=ra+rb) ans=1;
        if(AB<R && ra>rb) ans=2;
        if(AB<R && ra<rb) ans=-2;
        
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int n;
string s;

int main(){
	cin >> n >> s;
	
	int ans = 0;
	for(int i = 0; i < n-2; i++){
		if(s[i] == 'A' && s[i+1] == 'B' &&  s[i+2] == 'C'){
			ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
using namespace std;

int main()
{
  int n,m;
  int x,y;
  int pos;
  int sum;
  
  cin>>n>>m;
  
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(m);
  vector<int> d(m);
  
  for(int i=0;i<n;i++)
  {
    cin>>a[i]>>b[i];
  }
  
  for(int j=0;j<m;j++)
  {
    cin>>c[j]>>d[j];
  }
  int min=1000000000;
  for(int k=0;k<n;k++)
  {
    min=1000000000;
   	for(int l=0;l<m;l++)
    {
   		x=a[k]-c[l];
    	y=b[k]-d[l];
    
    	sum=abs(x)+abs(y);
    
    	if(sum<min)
    	{
      	min=sum;
      	pos=l+1;
    	}
    }
    cout<<pos<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
def main():

    s = str( input() )
    s_l = len(s)
    ans = 0
    for i in range( 2 ** (s_l - 1) ):
        x_i = [ 0 for i in range( s_l - 1 ) ]
        x_i_ = list( format( i , 'b' ) )
        x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_

        start = 0
        goal = 0
        for j in range( len(x_i) ):
            if x_i[j] == '1':
                goal = j + 1
                ans += int( s[start:goal] )

                #print(start,goal,int( s[start:goal] )  )

                start = goal
        goal = s_l
        ans += int( s[ start:goal ] )

        #print(start , goal,int( s[start:goal] )  )
    
    print( ans )

main()

Measured memory_bytes: 9184
package main

import "fmt"

func main() {
	var W, H, x, y, r int
	fmt.Scanf("%d %d %d %d %d", &W, &H, &x, &y, &r)
	if x-r < 0 || x+r > W || y-r < 0 || y+r > H {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
	return
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
    int x;
    cin >> x;
    if (!(x ^ 7) || !(x ^ 5) || !(x ^ 3))
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int a;
char c;

int main() {
    cin >> a;
    int res = a;
    
    while (cin >> c) {
        if (c == '=') break;
        cin >> a;
        if (c == '+') res += a;
        if (c == '-') res -= a;
        if (c == '*') res *= a;
        if (c == '/') res /= a;
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 1160
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
    int n,i,a[101],e[201],c,x,y,flg;
	while(1){
	    scanf("%d",&n);
		if(n==0) break;
		for(i=1;i<=n*2;i++) e[i]=0;
		for(i=0;i<n;i++){
		    scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++){
		    e[a[i]]=1;
		}
		x=n; y=n; flg=0;
		while(1){
			for(i=1;i<=n*2;i++){
			    if(flg==0&&e[i]==1){
				    x--;
					e[i]=2;
					flg=1;
				}
				else if(flg==1&&e[i]==0){
				    y--;
					e[i]=2;
					flg=0;
				}
				if(x==0||y==0) break;
			}
			if(flg==0) flg=1;
			else flg=0;
			if(x==0||y==0) break;
		}
		printf("%d\n",y);
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 2608
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int mygcd(int x,int y){
    if(x <= y){
        if(x == 0)
            return y;
        else
            return mygcd(y%x,x);      
    }else{
        if(y == 0)
            return x;
        else
        {
            return mygcd(y,x%y);
        }
        
    }
}


int main(){
    int A,B,C,K;
    cin >> K;
    ll goukei = 0,ABgcd=0;

    for(int i = 1;i <= K;i++)
        for(int j = 1;j <= K;j++){
            ABgcd = mygcd(i,j);
            for(int k = 1;k <= K;k++){
                goukei += mygcd(k,ABgcd);
            }
        }

    cout << goukei << endl;
    

}

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

using namespace std;
#define rep(i,n) for(int i = 0;i < (int)n;i++)
int main() {
  int N,i,D;
  int count = 1;
  cin >> N;
  vector<int> test(N);
  
  rep(i,N){
    cin >> test.at(i);
  }
 sort(test.begin(),test.end());
  
   D = test.at(0);
  rep(i,N){
    if(D < test.at(i)){
      count ++;
      D = test.at(i);
    }
  }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n+2],i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a, a+n);
    int mn = a[0], mx = a[n-1]; //cout<<mn<<" "<<mx<<endl;
    int ans = INT_MAX, sum, sun;

    for(i=mn; i<=mx; i++)
    {
        sum = 0;
        for(int j=0; j<n; j++)
        {
            sum+=pow(abs(i-a[j]) ,2);

        }//cout<<sum<<endl;
        ans = min(ans, sum);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
while True:
    a = input()
    if a == '0':
        break
    A = a[1:].count('A')
    B = a[1:].count('B')
    if  A<B:
        c = 0
        e = 1
    else:
        c = 1
        e = 0
    print(A+c,B+e)


Measured memory_bytes: 5556
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int h,a;
    cin >> h >> a;
    cout << ( h + a - 1 )/ a << endl;
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) {
 if (a < b) { a = b; return true; } return false; 
 }
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,k;
  cin>>n>>k;
  ll s=n-k;
  if(k==1){
    COUT(0);
    return 0;
  }
  
  COUT(s);
}

Measured memory_bytes: 256
mo = input().split()
shi = int(mo[1][0]) 
mo1 = [int(i) for i in mo]
if mo1[1] < 22:
    print (0)
else:
    cao = 0
    for i in range(2, mo1[0] + 1):
        for j in range(2, shi + 1):
            if i % j == 0:
                if i // j in range(2, 10) and ((j * 10 + i // j) <= mo1[1]):
                    cao += 1    
    print (cao)

Measured memory_bytes: 38256
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
from collections import deque
friends = [deque() for _ in range(N)]
ans = 0

for a,b in AB:
  a -= 1
  b -= 1
  friends[a].append(b)
  friends[b].append(a)
  
flag = [False] * N
for i in range(N):
  if flag[i]:
    continue
  else:
    x = friends[i]
    tmp = 1
    flag[i] = True
    while len(x)!=0:
      y = x.pop()
      if flag[y]:
        continue
      else:
        tmp += 1
        for j in friends[y]:
          x.append(j)
        flag[y] = True
    ans = max(tmp,ans)
    
print(ans)

Measured memory_bytes: 238120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    c = -c;
    vector<int> b(m);
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    vector<vector<int>> a(n,vector<int>(m));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    int ans = 0;

    for(int i=0;i<n;i++){
        int sum = 0;
        for(int j=0;j<m;j++){
            sum += a[i][j]*b[j];
        }
        if(sum > c) ans++;
    }
    cout << ans << endl;
}

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

int main() {
	string number;
	cin >> number;

	for (int i = 0; i < 3; i++) {

		if (int(number.at(i)) - 48 == 7) {
			cout << "Yes" << endl;
			break;
		}

		else if (i == 2 && int(number.at(i)) - 48 != 7) {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define maxn 202333
#define mod 1000000007ll
using namespace std;
typedef long long ll;
ll a[maxn], s[maxn];
int main() {
	int n;
	scanf("%d", &n);
	for(int i = 1, x; i <= n; ++i) scanf("%d", &x), a[i] = x;
	for(int i = n; i >= 1; --i) s[i] = (s[i + 1] + a[i]) % mod;
	ll ans = 0;
	for(int i = 1; i <= n; ++i) {
		ans = (ans + a[i] * s[i + 1]) % mod;
	}
	printf("%d", (int) ans);
	return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int MAX_L = 1000000;

// Supports two operations.
// - Updates a single element.
// - Returns a sum of a range.
// Verified: CF573Div1D
class BinaryIndexedTree {
 private:
  int n;
  vector<int> xs;
 public:
  BinaryIndexedTree(int n) : n(n), xs(n) {}

  // Adds x to the i-th element.
  void Add(int i, int x) {
    int cur = i;
    while (cur < n) {
      xs[cur] += x;
      cur = cur | (cur + 1);
    }
  }

  // Returns a sum of a range [l r).
  int SumOfRange(int l, int r) {
    if (l >= r) return 0;
    if (l > 0) {
      return SumOfRange(0, r) - SumOfRange(0, l);
    }
    int s = 0;
    int i = r - 1;
    while (i >= 0) {
      s += xs[i];
      i = (i & (i + 1)) - 1;
    }
    return s;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  vector<string> ss(n);
  for (int i = 0; i < n; i++) {
    cin >> ss[i];
    reverse(ss[i].begin(), ss[i].end());
  }
  sort(ss.begin(), ss.end());
  for (const string& s : ss) {
    if (DEBUG) cout << s << endl;
  }

  vector<vector<int>> l_to_is(MAX_L + 1);  // Length to indexes
  for (int i = 0; i < n; i++) {
    l_to_is[ss[i].length()].push_back(i);
  }

  vector<vector<int>> c_count_table(n, vector<int>(26));
  for (int i = 0; i < n; i++) {
    for (char c : ss[i]) {
      c_count_table[i][c - 'a']++;
    }
  }

  vector<BinaryIndexedTree> trees(26, BinaryIndexedTree(n));
  for (int i = 0; i < n; i++) {
    for (int c = 0; c < 26; c++) {
      if (c_count_table[i][c] > 0) {
        trees[c].Add(i, 1);
      }
    }
  }

  deque<int> q;
  for (int l = 1; l <= MAX_L; l++) {
    for (int i : l_to_is[l]) {
      q.push_back(i);
    }
  }

  int64 ans = 0;
  for (int l = 1; l <= MAX_L; l++) {
    for (int string_index : l_to_is[l]) {
      if (DEBUG) cout << "string_index: " << string_index << endl;
      if (l >= 2) {
        string key_1 = ss[string_index].substr(0, ss[string_index].length() - 1);
        string key_2 = key_1;
        key_2[key_2.length() - 1]++;

        int i_1 = distance(ss.begin(), lower_bound(ss.begin(), ss.end(), key_1));
        int i_2 = distance(ss.begin(), lower_bound(ss.begin(), ss.end(), key_2));
        // [i_1, i_2)
        if (DEBUG) cout << "i_1: " << i_1 << " i_2: " << i_2 << endl;
        ans += trees[ss[string_index].back() - 'a'].SumOfRange(i_1, i_2);
      } else {
        ans += trees[ss[string_index].back() - 'a'].SumOfRange(0, n);
      }
    }

    for (int i : q) {
      c_count_table[i][ss[i][l - 1] - 'a']--;
      if (c_count_table[i][ss[i][l - 1] - 'a'] == 0) {
        trees[ss[i][l - 1] - 'a'].Add(i, -1);
      }
    }
    while (!q.empty() && ss[q.front()].length() == l) {
      q.pop_front();
    }
  }
  ans -= n;

  cout << ans << endl;
}

Measured memory_bytes: 81524
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();

        if (n % 1000 == 0) {
            System.out.println(0);
        } else {
            System.out.println(1000 - n % 1000);
        }
        

    }
}

Measured memory_bytes: 35728
s=input()
X,Y=map(int,input().split())
from collections import defaultdict
def solve(a,dp,G):
    for i in range(len(a)):
        tmp=set()
        for j in dp:
            tmp.add(j-a[i])
            tmp.add(j+a[i])
        dp=tmp
    if G in dp:
        return True
    else:
        return False

d=[len(x) for x in s.split("T")]
#print(d)
x=d[2::2]
dpx={d[0]}
y=d[1::2]
dpy={0}
if solve(x,dpx,X) and solve(y,dpy,Y):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 45916
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*(n)
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    
N, M = map(int, input().split())
E = [list(map(int, input().split())) for i in range(M)]
ans = 0
for i in range(M):
    u = UnionFind(N)
    for j in range(M):
        if i != j:
            u.union(E[j][0]-1, E[j][1]-1)
    f = True
    g = u.find(0)
    for j in range(N):
        if g != u.find(j):
            f = False
            break
    if not f:
        ans += 1
print(ans)

Measured memory_bytes: 41456
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, n, now, tmp;
  scanf("%lld", &n);
  ll cnt[n], a;
  vector<ll> vec;
  for(i = 0; i < n; ++i) cnt[i] = 0;
  for(i = 0; i < n; ++i) scanf("%lld", &a), cnt[--a]++;
  for(i = 0; i < n; ++i) if(cnt[i]) vec.push_back(cnt[i]);
  sort(vec.begin(), vec.end());
  ll sum[vec.size() + 1];
  sum[0] = 0;
  for(i = 0; i < vec.size(); ++i) sum[i + 1] = sum[i] + vec[i];
  for(i = 1; i <= n; ++i) {
    for(j = 1; ; ++j) {
      tmp = upper_bound(vec.begin(), vec.end(), j) - vec.begin();
      now = sum[tmp];
      now += (vec.size() - tmp) * j;
      if(i * j > now) break;
    }
    printf("%lld\n", j - 1);
  }
  return 0;
}

Measured memory_bytes: 9324
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ h, a ] <- readInts
	print $ ( h + a - 1 ) `div` a

Measured memory_bytes: 380
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC115A2
{
    class Program
    {
        static void Main(string[] args)
        {
            String D;
            
            D = Console.ReadLine();

            if (D == "22")
                Console.WriteLine("Christmas Eve Eve Eve");

            else if (D == "23")
                Console.WriteLine("Christmas Eve Eve");

            else if (D == "24")
                Console.WriteLine("Christmas Eve");

            else if (D == "25")
                Console.WriteLine("Christmas");

            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) (a).begin(),(a).end()
#define ub(s,x) upper_bound(all(s),x)-s.begin()

vector<int> v;

void make_753(int i, string s, bool in7, bool in5, bool in3){
    if(i==0){
        if(in7 && in5 && in3) v.push_back(stoi(s));
        return;
    }
    make_753(i-1, s+"7", true, in5, in3);
    make_753(i-1, s+"5", in7, true, in3);
    make_753(i-1, s+"3", in7, in5, true);
}

int main(void){
    rep1(i,9){
        make_753(i,"",0,0,0);
    }
    sort(all(v));
    int n;
    cin>>n;
    cout << ub(v,n) << endl;
    return 0;
}


Measured memory_bytes: 512
package main

import "fmt"

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func main() {
	var K, sum int
	fmt.Scan(&K)
	for i := 1; i <= K; i++ {
		for j := 1; j <= K; j++ {
			for k := 1; k <= K; k++ {
				sum += gcd(gcd(i, j), k)
			}
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e5 + 5;


int32_t main()
{
   IOS;
   char ch;
   cin >> ch;

   if(islower(ch))
   {
   		cout << 'a' << endl;
   }

   else if(isupper(ch))
   {
   		cout << 'A' << endl;
   }


   return 0;
}
 

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

int b[21][200010];
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    
    
    memset(b, 0, sizeof(b));
    REP(i, n){
        int now = a[i];
        REP(j, 20){
            b[j][i+1] = now%2;
            now /= 2;
        }
    }
    FOR(i, 1, n+1){
        REP(j, 20){
            b[j][i+1] += b[j][i];
        }
    }
    REP(j, 20) b[j][n+1] = INF;
    // REP(j, 20){
    //     REP(i, n+2){
    //          cout << b[j][i];
    //     }
    //     cout << "\n";
    // }
    
    int ans = 0;
    REP(i, n){
        int tmp = INF;
        REP(j, 20){
            int ok = i+1;
            int ng = n+1;
            while(abs(ok-ng) > 1){
                int mid = (ok+ng)/2;
                //cout << mid << " " << b[j][mid] << "\n";
                if(b[j][mid]-b[j][i] <= 1){
                    ok = mid;
                }else{
                    ng = mid;
                }
            }
            //cout << ok-i;
            chmin(tmp, ok-i);
        }
        //cout << "\n";
        ans += tmp;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 34688
N = int(input())
C = [0 for _ in range(N-1)]
S = [0 for _ in range(N-1)]
F = [0 for _ in range(N-1)]
for i in range(N-1):
	C[i],S[i],F[i] = map(int,input().split())

def f(i):
	s = 0
	while i < N-1:
		# find the fastest train at time s from i stattion.
		if s <= S[i]:
			s = S[i]+C[i]
		else:
			m = (s-S[i]) % F[i]
			if m == 0:
				s = s + C[i]
			else:
				s = s + (F[i]-m) + C[i]
			# we use the fact that F[i] | S[i]
		i += 1
	return s

for i in range(N):
	print(f(i))


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

bool cond(int x){
    if(x<=1)return false;
    for(int i=2;i*i<x;i++){
        if(x%i == 0){
            return false;
        }
    }
    return true;
}

 int main(){
    int n;
    cin>>n;
    
    while(!cond(n))n++;
   
  cout<<n;

 }

Measured memory_bytes: 256
a,b,c=[int(i) for i in input().split()]
one=abs((a//2)*b*c-(a-a//2)*b*c)
two=abs(a*(b//2)*c-a*(b-b//2)*c)
thr=abs(a*b*(c//2)-a*b*(c-c//2))
print(min(one,two,thr))

Measured memory_bytes: 3060
from collections import deque

# 入力
n, m = map(int, input().split())
to = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
# 処理
q = deque([0])
dist = [1000000000] * n
pre = [-1] * n
dist[0] = 0 # 始点
q.append(0)
while q:
    v = q.popleft()
    for i in to[v]:
        if dist[i] != 1000000000:
            continue
        dist[i] = dist[v] + 1
        pre[i] = v
        q.append(i)
print("Yes")
for i in range(n):
    if i == 0:
        continue
    ans = pre[i]
    ans += 1
    print(ans)

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

map<string,int> mp; 
int main(){
  int maxcnt=0;
  string str,maxs="";
    //入力
  while(cin>>str){
    //文字数が一番多い文字判定
    if(maxs.size()<=str.size())maxs=str;
    //大文字を小文字に変換
    for(int i=0;i<str.size();i++){
      if(str[i]>='A' && str[i]<='Z'){
	str[i]+='a'-'A';
      }
    }
    mp[str]++;
    //頻繁判定
    if(maxcnt<mp[str])maxcnt=mp[str];
  }
    //出力
  for(map<string,int>::iterator it=mp.begin() ;it!=mp.end();++it){
    if((*it).second==maxcnt){
      cout<<(*it).first<<" "<<maxs<<endl;
      break;
    }
  }
  return 0;
}
  
  

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

int main()
{
    int count = 0;
    int val = 5;
    while(val--)
    {
        int num;
        cin >> num;
        if(num == 0)
        {
            cout << count+1;
            break;
        }
        count++;
    }
}


Measured memory_bytes: 3588
n = int(input())

s = []
for i in range(2, int(n**0.5)+1):
  t = 0
  while n%i == 0:
    n //= i
    t += 1
  s.append(t)
  if n == 1: break

if n > 1: s.append(1)

ans = 0
for i in s:
  for j in range(1, i+1):
    if i >= j:
      ans += 1
      i -= j
    else:
      break
print(ans)

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

using namespace std;

int main()
{
        ios::sync_with_stdio(false);

        int a, b, x;

        cin >> a >> b >> x;

        if(x > a+b || x < a)
                cout << "NO" << endl;
        else
                cout << "YES" << endl;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 302;
const ll MOD = 1000000007;

int dis[MAXN][MAXN];
/*********************GoodLuck***********************/
int main () {
    IOS();

    int n;
    cin >> n;
    REP (i, n) {
        REP (j, n) {
            cin >> dis[i][j];
        }
    }

    bool no_ans = false;
    ll ans = 0;
    REP (i, n) {
        REP (j, i) {
            int mn = 0x3f3f3f3f;
            for (int k=0; k<n; k++) {
                if (k != i && k != j) {
                    mn = min(mn, dis[i][k]+dis[k][j]);
                }
            }
            if (mn < dis[i][j]) {
                no_ans = true;
            } else if (mn > dis[i][j]) {
                ans += dis[i][j];
            }
        }
    }

    cout << (no_ans ? -1 : ans) << endl;

}


Measured memory_bytes: 640
/*
[abc168] B - ... (Triple Dots)
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

int K;
string S;

string solve() {
    if ((int)S.length() <= K) {
        return S;
    }
    return S.substr(0, K) + "...";
}

int main() {
    cin >> K;
    cin >> S;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 3632
# D - いろはちゃんとマス目
def cmb1(n,r,mod):
    if (r<0 or r>n):
        return 0
    r = min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

h,w,a,b=map(int,input().split())

# 前処理
mod=10**9+7 #出力の制限
n=10**6
g1=[1,1] # 元テーブル
g2=[1,1] # 逆元テーブル
inverse=[0,1] #逆元テーブル計算用テーブル

for i in range(2,n+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

ans = 0
for i in range(b, w):
    ans+=cmb1(i+h-1-a,i,mod)*cmb1(w-1-i+a-1,a-1,mod)
    ans%=mod
print(ans)


Measured memory_bytes: 122048
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;
 
int main() {
  	int A,B;
	cin >> A >> B;
    cout << A*B - A - B + 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n-1], num[n];
  for (int i = 0; i < n; i++)
  {
    num[i] = 0;
  }
  
  for (int i = 0; i < n-1; i++)
  {
    cin >> a[i];
    num[a[i]-1]++;
  }
  for (int i = 0; i < n; i++)
  {
    cout << num[i] << endl;
  }
  
}

Measured memory_bytes: 4728
n=input()
deg=len(n)
if n.count('9')==len(n):
    print(deg*9)
elif deg==1:
    print(n)
else:
    if n[1:].count('9')==len(n)-1:
        print(int(n[0])+(deg-1)*9)
    else:
        print(int(n[0])-1+(deg-1)*9)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(void) {
  char s[3];
  char *a = "AAA";
  char *b = "BBB";
  scanf("%s", s);
  if (strcmp(s, a) == 0 || strcmp(s, b) == 0)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128