akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
char str[200005];
int main() {
	scanf("%s", str);
	int n = strlen(str);
	ll ans = 0;
	int w = 0;
	for (int i = n - 1; i >= 0; --i) {
		w += str[i] == 'W';
		if (str[i] == 'B') ans += w;
	}
	printf("%lld\n", ans);
}


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

#define INF INT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    int n;
    cin >> n;
    int abc[100000][3];
    int dp[100000][3];
    REP(i,n)REP(j,3)cin >> abc[i][j];
    REP(i,3)dp[0][i] = abc[0][i];
    for(int i=1;i < n;i++){
        REP(j,3){
            int max_v = 0;
            REP(k,3){
                if(j==k)continue;
                max_v = max(dp[i-1][k]+abc[i][j],max_v);
            }
            dp[i][j] = max_v;
        }
    }
    int ans = 0;
    REP(i,3)if(ans < dp[n-1][i])ans = dp[n-1][i];
    cout << ans << endl;
    return 0;
}    

Measured memory_bytes: 2560
N=gets.to_i;F,P=2.times.map{(1..N).map{gets.split.map(&:to_i)}};p (1..1023).map{|b|(0...N).map{|k|P[k][10.times.map{|i|b.to_s(2).rjust(10,"0")[i].to_i*F[k][i]}.inject(:+)]}.inject(:+)}.max

Measured memory_bytes: 1916
#include <stdio.h>

int main(void)
{
  int n, v, index, max = -1, maxi = 0;

  scanf("%d", &n);

  while(n){
    scanf("%d %d", &index, &v); 
    if(v > max || (v == max && index < maxi)){
      max = v;
      maxi = index;
    }
    n--;
  }
  printf("%d %d\n", maxi, max);
  return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;



int main() {

    ll N, K;
    cin >> N >> K;

    N = N % K;

    cout << min(N, abs(N-K)) << endl;
  
 

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
using namespace std;
int mypow(int fa, int fb, int fc) {
	if (fb == 0)return 1;
	if (fb % 2)return mypow(fa, fb - 1, fc)*fa%fc;
	int z = mypow(fa, fb / 2, fc);
	return z * z%fc;
}
int k(int fa) {
	int x = 0;
	while (fa) {
		x++;
		fa /= 10;
	}
	return x;
}
int gcd(int fa, int fb) {
	if (fb == 0)return fa;
	return gcd(fb, fa%fb);
}
signed main() {
	int a, z = 100, ans = 0;
	cin >> a;
	while (z < a) {
		z += z / 100;
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define int long long
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define endl "\n"
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<vi>
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=(1ll<<62)-1;
signed main(){
  string S; cin>>S;
  ll ans=0;
  rep(i,0,S.size()) ans+=S[i]-'0';
  ll sum=0;
  rep(i,1,S.size()) sum+=9;
  sum+=S[0]-'1';
  cout<<max(ans,sum)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

bool isPalindrome(string s) {
  string t = s;
  reverse(all(t));
  return s == t;
}

int main() {
  string s;
  cin >> s;
  bool ans = true;
  if (!isPalindrome(s)) ans = false;
  if (!isPalindrome(s.substr(0, s.size()/2))) ans = false;
  cout << (ans ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())
# Cが、A,Bの最大公約数Dの倍数になっていることが条件
D = 1
for i in [2, 3, 5, 7]:
    while A % i == 0 and B % i == 0:
        A = A // i
        B = B // i
        D = D * i
print('YES') if C % D == 0 else print('NO')


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

using namespace std;

const int N=1010;

int dp[N][N];

int main()
{
    int n;

    char s1[N],s2[N];

    cin>>n;

    while(n--)
    {
        cin>>(s1+1)>>(s2+1);

        int len1=strlen(s1+1),len2=strlen(s2+1);
        for(int i=1;i<=len1;i++)
        {
            for(int j=1;j<=len2;j++)
            {
                if(s1[i]==s2[j])
                {
                    dp[i][j]=dp[i-1][j-1]+1;
                }else
                {
                    dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }

        cout<<dp[len1][len2]<<endl;
    }

    return 0;
}



Measured memory_bytes: 7060
#include <cassert>
#include <vector>
#include <iostream>
using namespace std;

void ext(vector<int> &result, int len, int m, vector<int> &v) {
    vector<bool> used(m+1, false);
    for (int i = 0; i < len; i++) {
        int a = result[i];
        assert(!used[a]);
        v.push_back(a);
        used[a] = true;
    }
    for (int i = 1; i <= m; i++) if (!used[i]) v.push_back(i);
}

int main() {
    int n, m, q; cin >> n >> m >> q;
    int a[q];
    for (int i = 0; i < q; i++) cin >> a[i];
    vector<int> cnt(m+1, 0), len(n, 0), idx(m+1), result;
    for (int i = q-1; i >= 0; i--) {
        if (0 < cnt[a[i]]) {
            if (cnt[a[i]] < n && len[cnt[a[i]]] == idx[a[i]]) {
                len[cnt[a[i]]]++;
                cnt[a[i]]++;
            }
        } else {
            cnt[a[i]]++;
            len[0]++;
            idx[a[i]] = result.size();
            result.push_back(a[i]);
        }
        // cerr << "result = "; for (int x : result) cerr << x << " "; cerr << endl;
        // cerr << "length = "; for (int x : len) cerr << x << ' '; cerr << endl;
        // cerr << "idx = "; for (int x : idx) cerr << x << ' '; cerr << endl;
        // cerr << "cnt = "; for (int x : cnt) cerr << x << ' '; cerr << endl;
    }
    vector<int> v1, v2;
    ext(result, len[0], m, v1);
    ext(result, len[n-1], m, v2);
    for (int i = 0; i < m; i++) {
        // cerr << v1[i] << " " << v2[i] << endl;
        if (v1[i] != v2[i]) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}


Measured memory_bytes: 6208
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n, K;
int a[200000];

signed main() {
	int i, j, k;
	
	cin >> n >> K;
	rep(i, n) cin >> a[i];
	K = min(K, 100LL);
	
	rep(i, K) {
		static int imos[200001];
		rep(j, n) imos[j] = 0;
		
		rep(j, n) {
			//区間[j - a[j], j + a[j]]に1を足す
			int l = max(0LL, j - a[j]);
			int r = min(n - 1, j + a[j]);
			imos[l]++;
			imos[r + 1]--;
		}
		rep(j, n) imos[j + 1] += imos[j];
		rep(j, n) a[j] = imos[j];
	}
	
	rep(j, n) {
		cout << a[j];
		if (j + 1 < n) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 6720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<int,int>mp;
int main()
{
	int n,flag=0,a[100],i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]!=i)
			flag++;
	}
	if(flag==2||flag==0)
		puts("YES");
	else
		puts("NO");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 10010
typedef long long ll;
typedef long double ld;
const int MINI INT_MIN;
const ll MINL LLONG_MIN;

int main(){
    ios_base::sync_with_stdio(0);
    string s,t;
    cin>>s>>t;
    bool ck=true;
    for (int i=0;i<s.length();i++){
        if (s[i]!=t[i]){
            ck=false;
            break;
        }
    }
    if (ck) cout <<"Yes"<< endl;
    else cout <<"No"<< endl;
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>=b){
        for(int i=0;i<a;++i){
            cout<<b;
        }
        cout<<endl;
    }
    else{
        for(int i=0;i<b;++i){
            cout<<a;
        }
        cout<<endl;

    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const int maxn = 1000000 + 10;
const ll mod = 1000000000 + 7;

map<int, int> mp;
int main() {
    int n, x;
    cin >> n;
    bool flag = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        if (mp[x] != 0) flag = 1;
        mp[x]++;
    }
    if (flag) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 9600
#include<stdio.h>

int main()
{
    int a,b,c,d,e,k;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
    if(e-d<=k&&e-c<=k&&e-b<=k&&e-a<=k&&d-c<=k&&d-b<=k&&d-a<=k&&c-b<=k&&c-a<=k&&b-a<=k){
    printf("Yay!");
    }
    else{
    printf(":(");
    }



return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define int ll
int n, a[500010], x[500010], dp[500010];
int am[(1 << 20) + 10], lastam[(1 << 20) + 10], add[(1 << 20) + 10];
int mult[500010];
int pow2(int n, int k)
{
	if (!k) return 1;
	int ans = pow2(n, k/2);
	ans *= ans;
	ans %= mod;
	if (k%2) 
	{
		ans *= n;
		ans %= mod;
	}
	return ans;
}
#undef int
int main()
{
	#define int ll
	scanf("%lld", &n);
	fill_n(lastam, (1 << 20)+10, n-1);
	for (int i = 0; i < n; i++)
	{
		scanf("%lld", &a[i]);
		x[i] = a[i];
		if (i) x[i] ^= x[i-1];
	}
	if (x[n-1] != 0)
	{
		int zerosafter = 0, onesafter = 1;
		for (int i = n-1; i >= 0; i--)
		{
			if (x[i] == x[n-1])
			{
				int am = zerosafter;
				onesafter += am;
				onesafter %= mod;
			}
			else if (!x[i])
			{
				int am = onesafter;
				zerosafter += am;
				zerosafter %= mod;
			}
		}
		int ans = onesafter;
		printf("%lld\n", ans);
	}
	else
	{
		for (int i = n-1; i >= 0; i--)
		{
			mult[i]+=mult[i+1];
			if (!x[i])
			{
				mult[i]++;
				mult[i]%=mod;
			}
			else
			{
				int val = 1;

				am[x[i]] += ((add[x[i]]*(mult[i]-mult[lastam[x[i]]]))%mod);
				am[x[i]]%=mod;
				val += am[x[i]];
				val %= mod;

				add[x[i]] += val;
				add[x[i]]%=mod;
				lastam[x[i]] = i;
			}
		}
		int ans = accumulate(add, add+(1 << 20)+5, 0ll);
		int am = -1;
		for (int i = 0; i < n; i++)
		{
			if (!x[i])
			{
				am++;
			}
		}
		ans += pow2(2, am);
		ans %= mod;
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 38400
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [10**9 for _ in range(n)]
dp[0] = 0
for i in range(n):
  for j in range(1, k+1):
    if i + j >= n:
      break
    dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]))
ans = dp[n-1]
print(ans)
    


Measured memory_bytes: 56544
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll S;
    cin >> S;
    int digit = GetDigit(S);
    int min = 1000;
    for(int i = 0; i <=digit; i++){
        if(S >= 100){
            int last3 = S% 1000;
            int diff = last3 - 753;
            if(diff < 0){
                diff = - diff;
            }
            if(diff < min){
                min = diff;
            }
            S /= 10;
        }
    }
    cout << min << endl;
    return 0;
}

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

namespace abc060_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            string A = input[0];
            string B = input[1];
            string C = input[2];

            if(A[A.Length -1] == B[0] && B[B.Length - 1] == C[0])
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}


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

#define ll long long
#define ld long louble
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (ll i = 0; i< s.size(); i++){
        if (i % 2 == 0){
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 592
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 
#define MO 
int n,w,h;
inline void _Sol_()
{
	read(h),read(w),read(n);
	if(h<w)swap(h,w);
	cout<<(n+h-1)/h;
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 256
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lis = [a, b, c, d, e]
l = list(itertools.permutations(lis))
count = 10 ** 9
for ll in l:
    ans = 0
    c = 0
    for seq in ll:
        c += 1
        ans += seq
        mod = seq % 10
        if mod != 0 and c != 5:
            ans += 10 - mod
    count = min(count, ans)
print(count)



Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;


int h, w, k;

int get_num(int i, int suf) {
    vi amida = {1, 1, 2, 3, 5, 8, 13, 21, 34};
    i++;
    int under, upper;
    if (suf == 0) {
        under = i - 1;
        upper = w - i;
    } else if (suf > 0) {
        under = i - 1;
        upper = w - i - 1;
    } else {
        under = i - 1 - 1;
        upper = w - i;
    }
    return amida[under] * amida[upper];
}

int main() {
    cin >> h >> w >> k;

    vvl numss;
    for (int i = 0; i < h + 1; i++) {
        vl nums;
        if (i == 0) {
            rep(j, w) {
                if (j == 0) nums.pb(1);
                else nums.pb(0);
            }
        }
        else {
            vl prev = numss[i - 1];
            for (int j = 0; j < w; j++) {
                if (j == 0) nums.pb(prev[j] * get_num(j, 0)  + prev[j + 1] * get_num(j, 1));
                else if (j == w - 1) nums.pb(prev[j] * get_num(j, 0) + prev[j - 1] * get_num(j, -1));
                else nums.pb(prev[j - 1] * get_num(j, -1) + prev[j] * get_num(j, 0) + prev[j + 1] * get_num(j, 1));
            }
            rep(j, w) nums[j] %= DIV;
        }
        numss.pb(nums);
    }
    /*
    drep(j, w) {
        rep(i, h + 1) {
            cout << numss[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << numss[h][k - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int mod = 1e9 + 7;

void udd(int &a, int b) {
    a += b;
    if (a >= mod)
        a -= mod;
}

int mul(ll a, ll b) {
    return (a * b) % mod;
}

int mul(int a, int b, int c) {
    return mul(mul(a, b), c);
}

int bin(int a, int d) {
    int b = 1;
    while (d) {
        if (d & 1)
            b = mul(b, a);
        d >>= 1;
        a = mul(a, a);
    }
    return b;
}

int rev(int a) {
    return bin(a, mod - 2);
}

const int maxn = 100100;
int fact[maxn];
int ifact[maxn];

int binom(int a, int b) {
    if (b < 0 || b > a)
        return 0;
    return mul(fact[a], ifact[b], ifact[a - b]);
}

int split(int n, int k) {
    if (n == 0)
        return 1;
    return binom(n + k - 1, n);
}

int main() {
    #ifdef LOCAL
    assert(freopen("j.in", "r", stdin));
    #else
    #endif
    fact[0] = ifact[0] = 1;
    forn (i, maxn) {
        if (i) {
            fact[i] = mul(fact[i - 1], i);
            ifact[i] = mul(ifact[i - 1], rev(i));
        }
    }
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    assert(n == a + b + c);
    if (b % 2) {
        cout << 0 << '\n';
        return 0;
    }
    b /= 2;
    int res = 0;
    int t = binom(a + b, a);
    for (int i = 0; i <= c; i += 3) {
        for (int j = 0; j <= a; ++j) {
            int k = c - i - j;
            if (k < 0 || (k > 0 && b == 0))
                continue;
            int cur = t;
            cur = mul(cur, split(i / 3, a + b + 1));
            cur = mul(cur, binom(a, j));
            cur = mul(cur, split(k, b));
            udd(res, cur);
        }
    }
    cout << res << '\n';
}


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

int main() {
    int N; cin >> N;
    vector<int> cnt(9);
    rep(i, N) {
        int a; cin >> a;
        a /= 400;
        if(a > 8) a = 8;
        cnt[a]++;
    }
    int mn = 0;
    rep(i, 8) if(cnt[i]) mn++;
    if(mn) cout << mn << " " << mn + cnt[8] << '\n';
    else cout << 1 << " " << cnt[8] << '\n';
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(100000000)

def main():
    n,m,q=map(int,input().split())
    cum=[[0]*n for _ in range(n)]

    for _ in range(m):
        l,r=map(int,input().split())
        l-=1
        r-=1
        cum[0][r]+=1
        if l!=n-1:
            cum[l+1][r]-=1
       
    for i in range(n):
        for j in range(1,n):
            cum[i][j]+=cum[i][j-1]
    
    for i in range(1,n):
        for j in range(n):
            cum[i][j]+=cum[i-1][j]

    for _ in range(q):
        p,q=map(int,input().split())
        p-=1
        q-=1
        print(cum[p][q])

if __name__=='__main__':
    main()

Measured memory_bytes: 9916
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll mod) {
	if (a > 0) return a % mod;
	if (a % mod == 0) return 0;
	ll x = -a / mod + 1;
	a += x * mod;
	return a % mod;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}
// 本体

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<ll> a(n);
	ll sum = 0;
	map<ll, ll> mp;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
		mp[a[i]]++;
	}
	ll q;
	cin >> q;
	for (int i = 0; i < q;i++) {
		ll b, c;
		cin >> b >> c;
		ll cnt = mp[b];
		mp[b] = 0;
		mp[c] += cnt;
		sum += cnt * (c - b);
		dump(sum);
	}
}

Measured memory_bytes: 9892
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>

using namespace std;

int main() {
 int n,k;
  cin >> n >> k;
  if(n%2==1){
    if(k<=n/2+1){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  }
  else{
    if(k<=n/2){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
}


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

using namespace std;
typedef map<int, int> iimap;

int main() {
    int n, k;
    cin >> n >> k;
    iimap counts;
    for(int i=0; i<n; i++) {
        int a;
        cin >> a;
        counts[a]++;
    }
    vector<int> cts;
    for(iimap::iterator itr=counts.begin(); itr!=counts.end(); itr++) {
        cts.push_back(itr->second);
    }
    sort(cts.begin(), cts.end(), greater<int>());
    int len = cts.size();
    int res = 0;
    for(int i=k; i<len; i++) {
        res += cts[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 10748
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String l1 = scan.nextLine();
		String l2 = scan.nextLine();
		scan.close();

		int h = Integer.valueOf(l1.split(" ")[0]);
		int n = Integer.valueOf(l1.split(" ")[1]);
		String strA = l2;
		List<Integer> a = new ArrayList<Integer>();
		for (String element : strA.split(" ")) {
			a.add(Integer.valueOf(element));
		}

		for (Integer element : a) {
			h = h - element;

			if (h <= 0) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");
	}
}


Measured memory_bytes: 50796
#include <iostream>
using namespace std;

int p[11], c[11];

int main(){
    int d, g;
    cin >> d >> g;
    for(int i=0; i<d; i++) cin >> p[i] >> c[i];
    
    int ans = 1e9;
    for(int bit=0; bit<(1<<d); bit++){
    	int sum = 0, num = 0;
    	for(int i=0; i<d; i++){
    		//bitが立っている問題をコンプリートする。
    		if(bit & (1<<i)) sum += 100*(i+1)*p[i] + c[i], num += p[i];
    	}
    	if(sum >= g) ans = min(ans, num);
    	else if(sum < g){
    		for(int i=d-1; i>=0; i--){
    			//bitが立っていない問題を使用する。
    			if(bit & (1 << i)) continue;
    			for(int j=0; j<p[i]; j++){
    				if(sum >= g) break;
    				sum += 100*(i+1);
    				num++;
    			}
    		}
    		ans = min(ans, num);
    	}
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
int dp[10][10][10][10];

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    long long ans = 0;
    REP(i, N + 1) {
        int c = 0;
        int t = i;
        REP(j, 5) {
            c += t % 10;
            t /= 10;
        }
        if(A <= c and c <= B) {
            ans += i;
        }
    }
    cout << ans << endl;
}

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

int main() {
  double a, b, n;
  cin >> a >> b >> n;
  double e, f;
  e = min(b-1, n);
  f = floor((a * e) / b) - a * floor(e / b);
  cout << f << endl;
}

Measured memory_bytes: 3788
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

int main(void) {
    // int n;
    // cin >> n;
    vector<vector<int>> c(3, vector<int>(3));
    for (int i = 0; i < 3; ++i) {
        cin >> c[i][0] >> c[i][1] >> c[i][2];
    }

    vector<int> candidates(6);
    bool ok = false;
    for (candidates[0] = 0; candidates[0] < 100; candidates[0]++) {

        // prepare

        // b1,b2,b3
        candidates[3] = c[0][0] - candidates[0];
        candidates[4] = c[0][1] - candidates[0];
        candidates[5] = c[0][2] - candidates[0];

        // a2,a3
        candidates[1] = c[1][1] - candidates[4];
        candidates[2] = c[2][2] - candidates[5];
        // candidates[1] = candidates[0] - c[0][0] + c[1][0];
        // candidates[2] = candidates[0] - c[0][0] + c[2][0];

        // check
        bool check = true;
        for (int i = 0; i < 3; ++i) {
            for (int j = 3; j < 6; ++j) {
                // cout << "checking: a:" << i << ", b:" << j-3<< endl;
                // cout << "c[" << i << "]["<< j-3 << "]=" << c[i][j-3]<< endl;
                // cout << "a[" << i << "]="<< candidates[i] << endl;
                // cout << "b[" << j-3 << "]="<< candidates[j] << endl;
                // ["<< j-3 << "]=" << c[i][j]<< endl;
                if (c[i][j-3] != candidates[i] + candidates[j]) {
                    check = false;
                    break;
                }
            }
        }

        if (check == true) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	while(true){
		int n,r;	cin>>n>>r;
		if(n==0)	return 0;
		vector<int> a;
		for(int i=n;i>0;i--)	a.push_back(i);
		while(r--){
			int p,c;	cin>>p>>c;
			vector<int> b(n);
			for(int i=0;i<p-1;i++)	b[c+i]=a[i];
			for(int i=0;i<c;i++)	b[i]=a[p-1+i];
			for(int i=p+c-1;i<n;i++)	b[i]=a[i];
			a=b;
		}
		cout<<a[0]<<endl;
	}
}

Measured memory_bytes: 1220
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> List.rev (s :: acc)
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  doit str []

let gcd m n =
  let rec doit x y =
    if y <= 0 then x else doit y (x mod y)
  in
  if m > n then doit m n else doit n m

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [] | [_] -> exit 1
  | a :: b :: _ -> Printf.printf "%d\n" (gcd a b)

Measured memory_bytes: 2308
x, y, z, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
c = gets.chomp.split(" ").map(&:to_i)

ab = []
a.each do |x|
  b.each do |y|
    ab << x + y
  end
end
ab.sort!.reverse!

ab = ab[0...k]

abc = []
ab.each do |x|
  c.each do |y|
    abc << x + y
  end
end
abc.sort!.reverse!
abc[0...k].each do |x|
  puts x
end

Measured memory_bytes: 70132
#include<iostream>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++ )
#define NMAX 20001
#define MMAX 16
#define INFTY (1<<30)
int N, M, C[MMAX], X[NMAX];
unsigned long  T[256][NMAX];

unsigned long  compute(){
    rep(i, 256) rep(j, N+1) T[i][j] = INFTY;
    T[128][0] = 0;
    rep(j, N){
	rep(i,256){
	    if ( T[i][j] == INFTY ) continue;
	    rep(k, M){
		int p = i + C[k];
		if ( p > 255 ) p = 255;
		if ( p < 0 ) p = 0;
		T[p][j+1] = min(T[p][j+1], T[i][j] + (X[j+1]-p)*(X[j+1]-p));
	    }
	}
    }
    unsigned long minv = INFTY;
    rep(i, 256) minv = min(minv, T[i][N]);
    return minv;
}

main(){
    while(cin >> N >> M && N ){
	rep(i, M) cin >> C[i];
	rep(i, N) cin >> X[i+1];
	cout << compute() << endl;
    }
}

Measured memory_bytes: 20000
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <bitset>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/floyd_warshall_shortest.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/bipartite.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
using ll = long long;
namespace bst = boost;
template<class T> void fill(T& v) { for (auto&& i : v) cin >> i; }
using Graph = typename boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, 
                         boost::no_property, boost::property<boost::edge_weight_t, int>>;

int main() {
  int N;

  cin >> N;

  vector<string> S(N);
  fill(S);
  vector<pair<int,int>> edges;

  REP(i, N)
    for(auto j : bst::irange(i+1, N))
      if (S[i][j] == '1') {
        edges.emplace_back(i, j);
  }
  const std::vector<int> weights(edges.size(), 1);
  Graph g(edges.begin(), edges.end(), weights.begin(), N);

  if (!is_bipartite(g))
    cout << -1 << endl;
  else {
    bst::multi_array<int, 2> r(bst::extents[N][N]);
    floyd_warshall_all_pairs_shortest_paths(g, r);
    cout << *max_element(r.origin(), r.origin() + r.num_elements()) + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3328
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 200009
#define M6 2000009
#define M 1000000007
#define inf LLONG_MAX
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
ll fac[M6],not_prime[M6];
ll power(ll x,ll n){
    if(x==0) return 0;
    if(n==0) return 1;
    /*while(n){
        if(n%2) x=(((x*x)%M)*x)%M; 
        else x=(x*x)%M;
        n/=2;
    }*/
    if(n%2 == 0) return power((x*x),n/2);
    else return (x*power((x*x),(n-1)/2));
}
void fact(){
    fac[0]=1;
    for(ll i=1;i<M6;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<M6;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=M6;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll a, ll m){
    ll m0 = m, t, q; ll x0 = 0, x1 = 1;
    if (m == 1) return 0;
    while (a > 1){  q = a / m; t = m; m = a % m, a = t;t = x0;x0 = x1 - q * x0; x1 = t;}
    if (x1 < 0) x1 += m0;return x1;
}
ll n,m,ar[M6];
int main(){
    buf; 
    //sieve(); 
    //fact();
    ll i,j,k,test,flag,t1,t2,ans; string s;
    //cin>>test;
    test=1;
    while(test--){
    	ar[0]=2,ar[1]=1;
    	for(i=2;i<=100;i++) ar[i]=ar[i-1]+ar[i-2];
    	cin>>n;
    	cout<<ar[n];
    }
    return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


#define ABYSS -1
#define TO_BE_FILLED 0

vi solve(int N, int A, int B) {
    vi ans;
    if (A+B > N+1) return ans;
    if ((ll)A*B < (ll)N) return ans;
    if (A < B) {
        vi rev = solve(N, B, A);
        rep(i,N) rev[i] = (N+1)-rev[i];
        return rev;
    }
    // A >= B
    // A+B <= N+1
    // A*B >= N
    ans.assign(N, -1);
    if (B == 1) {
        rep(i,N) ans[i] = 1+i;
        return ans;
    }

    int rest = N-A, q = rest/(B-1), r = rest%(B-1), _r = (B-1)-r;
    int label=0;
    // for (int i=0;i<A;++i) {
#ifdef DEBUG
    fprintf(stderr, "N=%d,A=%d,B=%d; q=%d,r=%d|%d\n", N,A,B,q,r,_r);
#endif
    for (int i=0; i<A+B; ++i) {
        int bmax = min(i, B-1);
        // if (i > B+q-1) bmax = 0;
        for (int b=bmax;b>=0;--b) {
            int a = i-b;
            if (q+1 <= a) { b=0; a=i; } // jump
            if (A-1 < a) continue;
            int _b = (B-1)-b; //0...B-1

            int fill_index = -1;
            if (_b < _r) {
                if (q <= a) continue;
                fill_index = _b*q + a;
            } else if (r != 0 && _b < B-1) {
                if (q+1 <= a) continue;
                fill_index = _r*q + (_b-_r)*(q+1) + a;
            } else {
                fill_index = rest + a;
            }
#ifdef DEBUG
            fprintf(stderr, "%d | (%d,%d|%d) -> %d\n", i, a,b,_b, fill_index);
#endif
            if (fill_index >= 0) {
                ans[fill_index] = ++label;
                if (label == N) goto done;
            }
        }
    }
 done:
    return ans;
}

int main() {
    int N,A,B; cin >> N >> A>> B;
    vi ans = solve(N,A,B);
    if (ans.size() != N) {
        cout << -1 << endl;
    } else {
        rep(i,N) {
            if (i != 0) cout << " ";
            cout << ans[i];
        }
        cout << endl;
    }
    return 0;
}


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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    int c = n/x;
    int r = n%x;
    if (r == 0) cout << c*t << endl;
    else cout << (c+1)*t << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a;
	cin >> a;
	if (a < 1200){
		cout << "ABC" << endl;
	}
	else if (a < 2800){
		cout << "ARC" << endl;
	}
	else{
		cout << "AGC" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

int main(){
fastio();



      char ch;
      cin>>ch;
      if(isupper(ch))
      {
          cout<<"A"<<endl;
      }
      else cout<<"a"<<endl;









return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		long n = scan.nextInt();
		long a = scan.nextInt();
		long b = scan.nextInt();
		for (int i = 0; i < n - 1; i++) {
			long ai = scan.nextInt();
			long bi = scan.nextInt();
			if (ai > a) {
				a = ai;
				b = bi;
			}
		}
		System.out.println(a + b);
	}
	public static void main(String[] args) {
		new Main().run();
	}

}


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

#define vint vector<int> 
#define vbool vector<bool>
#define vvint vector<vector<int>>

#define rep(a, b, c) for(int (a)=(b); (a)<(c); (a)++)
#define all(a) (a).begin(), (a).end()

int main(){
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int n, m;
    cin >>n>>m;

    vint a(m);
    rep(i, 0, m)cin>>a[i];

    int sum =0;
    rep(i, 0, m){
        sum+=a[i];
    }
    if(n-sum<0) cout<<-1;
    else cout<< n-sum;


}

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

int X[100010], Y[100010];

int main () {
	int n, a[3]; scanf("%d%d%d%d", &n, &a[0], &a[1], &a[2]);
	vector <char> ans;
	for (int i = 0; i < n; i++) {
		char buf[5]; scanf("%s", buf);
		int x = buf[0] - 'A', y = buf[1] - 'A';
		X[i] = x, Y[i] = y;
	}
	for (int i = 0; i < n; i++) {
		int x = X[i], y = Y[i];
		if (a[x] > a[y] || a[x] == a[y] && (X[i + 1] == y || Y[i + 1] == y)) ans.push_back(y + 'A'), a[x]--, a[y]++;
		else ans.push_back(x + 'A'), a[x]++, a[y]--;
		if (a[x] < 0 || a[y] < 0) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	for (int i = 0; i < n; i++) {
		printf("%c\n", ans[i]);
	}
	return 0;
}


Measured memory_bytes: 4660
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
int must(int X){
  return X>=0?X:-X;
}
signed main(){
  int N,X,sum=MOD;
  cin>>N>>X;
  vi A(N);
  rep(i,0,N){
    int Y;
    cin>>Y;
    A[i]=must(X-Y);
    sum=min(sum,A[i]);
  }
  for(int i=sum;1<=i;i--){
    bool flag=1;
    rep(j,0,N){
      if(A[j]%i!=0){
        flag=0;
        break;
      }
    }
    if(flag){
      cout<<i<<endl;
      break;
    }
  }
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> datas;
  
  for(int i = 0; i < N; i++)
  {
    int num;
    cin >> num;
    datas.push_back(num);
  }
  sort(datas.begin(), datas.end());
  
  int sum = 0;
  for(int i = 0; i < N - 1; i++)
  {
	sum += datas[i];
    if(sum > datas[N-1])
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3096
#include <stdio.h>

int main(void){

    int x[5],ans;

    scanf("%d",&x[0]);
    scanf("%d",&x[1]);
    scanf("%d",&x[2]);
    scanf("%d",&x[3]);
    scanf("%d",&x[4]);

    for(int i=0;i<5;i++){
        if(x[i]==0){
            ans=i+1;
        }
    }

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

    return 0;
}

Measured memory_bytes: 2132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a<=8&&b<=8)System.out.println("Yay!");
		else System.out.println(":(");
		sc.close();
	}
}

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

using namespace std;
typedef long long ll;
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define mod 1000000007
ll n,m,k,x,y,z,t,a,b,s=0;

int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
map<string,int> v;
cin>>n;int p=1;
string st1,st2;
cin>>st1;v[st1]++;
n--;
while(n--)
{st2=st1;
cin>>st1;
if(st1[0]!=st2[st2.length()-1])p=0;
v[st1]++;
if(v[st1]>1)p=0;}
if(p)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
def main():
    n, m = list(map(int, input().split()))

    # print("n: ", n)
    # print("m: ", m)


    scs = {}
    answer = ["1" if i == 0 and n != 1 else "0" for i in range(n)]

    for i in range(m):
        s, c = list(map(int, input().split()))
        # print("s: ", s)
        # print("c: ", c)
        if ((s in scs) and scs[s] != c) or (c == 0 and s != len(answer)):
            return "-1"
        else:
            scs[s] = c
    # print(scs)
    for k in scs:
        answer[k-1] = str(scs[k])
        # print(answer)
    po = int("".join(answer))
    return po

print(main())

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

int main(){
    int n,k;
    long long t;
    cin>>n>>k;
    if(k%2==1){
        t=n/k;
        cout<<t*t*t<<endl;
    }else{
        t=2*n/k;
        if(t%2==0){
            t/=2;
            cout<<2*t*t*t<<endl;
        }else{
            t=(t+1)/2;
            cout<<t*t*t+(t-1)*(t-1)*(t-1)<<endl;
        }
    }
}


Measured memory_bytes: 256
N = int(input())

c = 0
ANS = []

for i in range(N):
    for j in range(i+1, N):
        if i+j+2 != (N if N % 2 else N+1):
            c += 1
            ANS.append((i+1, j+1))

print(c)
for ans in ANS:
    print(*ans)

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

int main() {
  int x;
  cin >> x;
  vector<int> d(x, 0);

  for (int i = 0; i < x; i++) {
    cin >> d[i];
  }

  sort(d.rbegin(), d.rend());

  int num = 0;
  int current = 101;
  for (int i = 0; i < x; i++) {
    if (d[i] < current) {
      current = d[i];
      num++;
    }
  }
  cout << num << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <unordered_map>

using namespace std;

typedef long long LL;

LL a, b, c;

string get_result(LL a, LL b, LL c) {
    if (a + b >= c) return "No";
    c = c - a - b;
    if (4 * a * b < c * c) return "Yes";
    return "No";
}

int main() {
    cin >> a >> b >> c;
    cout << get_result(a,b,c) << endl;
    return 0;
}

Measured memory_bytes: 256