akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<algorithm>
#include<vector>
#include<string>
using  namespace std;
#define ll      long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define vs      vector<string>
#define vp      vector< pair <string,int> >
#define mpi     map<int,int>
#define mps     map<char,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>
#define forn(i,n)    for (int i = 0; i < n; i++)
#define fork(i,k,n)  for (int i = k; i <= n; i++)
#define forkr(i,k,n) for (int i = k; i >= n; i--)

 int main()
{
 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
 if(n%1000==0){
  cout<<"0"<<endl;
 }
 else{
  ll r=n%1000;

  cout<<1000-r<<endl;
 }

}






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

int main()
{
    int ss;
    cin >> ss;
    int a1 = ss / 100;
    ss = ss % 100;
    int a2 = ss / 10;
    ss = ss % 10;

    // cout << a1 << a2 << endl;
    cout << a1 + a2 + ss << endl;
} //


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 999999999
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

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

    int main()
    {
        int n;
        cin>>n;
        vector<int> a(n,0);
        int cnt1=0;
        int cnt2=0;
        int cnt4=0;
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
               if(a[i]%4==0) ++cnt4;
               else ++cnt2;
            }else ++cnt1;
        }
        if(cnt2==0)
        {
            if(cnt1<=cnt4+1) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
        else
            {
            if(cnt1<=cnt4) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
            }
    }

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>

using namespace std;
int main()
{
	int n;
	cin>>n;
	int num[n];
	long long int sum=0;
	int h[100001];
	for(int i=0;i<100001;i++)
	{
	    h[i]=0;
	}
	for(int i=0;i<n;i++)
	{
	    
		cin>>num[i];
		sum=sum+num[i];
		h[num[i]]++;
		
	}
	long long int q;
	cin>>q;
	//vector<int>arr[q];
	/*for(int i=0;i<q;i++)
	{
		int b;
		int c;
		cin>>b>>c;
		arr[i][0]=b;
		arr[i][1]=c;
	}*/
	
	while(q--)
	{
	    long long int b;
		long long int c;
		cin>>b>>c;
		if(h[b])
		{
		    sum=sum+(c-b)*h[b];
		    h[c]=h[c]+h[b];
		    h[b]=0;
		}
	
		cout<<sum<<endl;
	}
}


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

int main(){

  int n,d;
  scanf("%d\n", &n);
  scanf("%d\n", &d);
  printf("%d", (n+d*2)/ (d*2+1));

}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
using namespace std;
 int main(){
   int d; cin >> d;
   if(d==25) cout << "Christmas" <<endl;
   if(d==24) cout << "Christmas Eve" <<endl;
   if(d==23) cout << "Christmas Eve Eve" <<endl;
   if(d==22) cout << "Christmas Eve Eve Eve" <<endl;
   
 }
     

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <limits>
typedef long long ll;
#define REP(i,n)   for(int i=0; i<(int)(n); ++i)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); ++i)

#define in cin
#define out cout
#define pb push_back
using namespace std;

int main(){
	int a[4], b[2], mi = 999, sum=0;
	REP(i, 4) {
		in >> a[i];
		sum += a[i];
		mi = min(mi, a[i]);
	}
	in >> b[0];
	in >> b[1];
	int bb = max(b[0], b[1]);
	sum -= mi;

	
	out << sum+bb << endl;
	return 0;

}

Measured memory_bytes: 3044
S = input()

N = len(S)

# print(S[:int((N-1)/2)])
# print(S[int((N+2)/2):])

rev_S = S[::-1]
a = S[:int((N-1)/2)]
rev_a = a[::-1]
b = S[int((N+2)/2):]
rev_b = b[::-1]

if S==rev_S and a==rev_a and b==rev_b:
    print("Yes")
else:
    print("No")


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

void solver() {
  int n, r;
  cin >> n >> r;

  if (n >= 10) {
    cout << r << "\n";
  } else {
    cout << r + (100 * (10 - n)) << "\n";
  }
}

int main() {
  solver();
  return 0;
}


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

int main() {
    int a,b,m;
    cin >> a >> b >> m;
    vector<int> fridge(a), microwave(b);
    int minf = 1e9, minm = 1e9;
    rep(i, a) {
        cin >> fridge[i];
        minf = min(minf, fridge[i]);
    }
    rep(i, b) {
        cin >> microwave[i];
        minm = min(minm, microwave[i]);
    }
    int ans = minf + minm;

    rep(i,m){
        int x, y, c;
        cin >> x >> y >> c;
        x--;
        y--;
        ans = min(ans, fridge[x] + microwave[y] - c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int A,B,C,D;
    R(A,B,C,D);
    while(1){
        C-=B;
        if(C<=0){
            W("Yes");
            return 0;
        }
        A-=D;
        if(A<=0){
            W("No");
            return 0;
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;

#define pb push_back

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define vin(v, n) for (int i = 0; i < (ll)(n); i++) cin >> (v)[i];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int x,y;
    cin>>x>>y;
    if(y%2==0){
        if(x*2<=y && x*4>=y)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int a, b;
  cin >> a >> b;
  for (int i=1; i<4; ++i) {
    if (a*b*i%2 == 1) {
      cout << "Yes" <<"\n";
      return 0;
    }
  }
  cout << "No" << "\n";
}


Measured memory_bytes: 384
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<long long int> a(N);

	REP(i, N) {
		cin >> a[i];
	}

	long long int x = 0;
	long long int sum_all = 0;
	long long int min_diff = 1e15;

	REP(i, N) {
		sum_all += a[i];
	}

	REP(i, N - 1) {
		x += a[i];
		min_diff = min(min_diff, abs(2 * x - sum_all));
	}

	cout << min_diff << endl;

	return 0;
}


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

typedef long long ll;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0; i < m; ++i) cin >> x[i];
    sort(x.begin(), x.end());

    vector<int> d(m - 1);
    for (int i = 0; i < m - 1; ++i) d[i] = x[i + 1] - x[i];
    sort(d.begin(), d.end());

    int ans = 0;
    for (int i = 0; i < m - n; ++i) ans += d[i];

    cout << ans << endl;
    return 0;
}


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



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }



    static void Solve()
    {
        Scaner Sc = new Scaner();
        write Wr = new write();
        var X = Sc.IntArr;
        Wr.Wri((X[2]/X[0])*X[1]);
    }
}





class Scaner
{
    public string Str => Console.ReadLine();

    public string[] StrArr => Str.Split(' ');

    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public char[] CharArr => Str.ToArray();
    public long Long1 => LongArr[0];
    public int Int1 => IntArr[0];
    
}



class write
{
    public  void Wri<T>(T x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
/*BISMILLAHIR RAHMANIR RAHIM*/
#include <bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define all(x)          x.begin(), x.end()
#define all(y)          y.begin(), y.end()
#define all(z)          z.begin(), z.end()
#define pi              acos(-1.0)

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    vector < int > x(n);
    for(int i = 0; i < n; i++){
        cin >>  x[i];
    }
    sort(all(x));
    int sum = 0;
    for(int i = 0; i < k; i++){
        sum += x[i];
    }
    cout << sum << endl;
}
/*ALHAMDULILLAH*/


Measured memory_bytes: 3696
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
const ll inf = 1e18 + 1;
const ll limit = 1e9;

int main() {
    int n; cin >> n;
    vector<vector<pair<int,int>>> v(n);
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        for (int j = 0; j < a; j++) {
            int x,y; cin >> x >> y; x--;
            v[i].emplace_back(make_pair(x, y));
        }
    }
    int ans = 0;
    for (ll i = 1; i < (1 << n); i++) {
        bool flag = false;
        int res = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                for (auto p : v[j]) {
                    if (((i >> (p.first)) & 1) ^ p.second) flag = true;
                }    
                if (flag) break;
                res++;
            }
        }    
        if (!flag) ans = max(ans,res);
    }
    cout << ans << "\n";
}

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

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int n;
    cin >> n;
    cout << n << ':';
    for(int i = 2; i * i <= n; i++){
        while(n % i == 0){
            cout << ' ' << i;
            n /= i;
        }
    }
    if(n != 1){
        cout << ' ' << n;
    }
    cout << endl;
}


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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	string ans = "";
	rep(ri, tx - sx) ans += 'R';
	rep(ri, ty - sy) ans += 'U';
	rep(ri, tx - sx) ans += 'L';
	rep(ri, ty - sy) ans += 'D';
	ans += 'D';
	rep(ri, tx - sx + 1) ans += 'R';
	rep(ri, ty - sy + 1) ans += 'U';
	ans += 'L';
	ans += 'U';
	rep(ri, tx - sx + 1) ans += 'L';
	rep(ri, ty - sy + 1) ans += 'D';
	ans += 'R';
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define pb			    push_back
#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define has(c,i) 		((c).find(i) != end(c))
#define has_str(s, c)	((s).find(c) != string::npos)
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    if(n % 1000 == 0) {
        cout << 0;
    } else {
        cout << abs((n % 1000) - 1000);
    }
    return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
ll MOD = 1e9 + 7;

int main(){
    int n; cin >> n;
    vector<string> w(n),W(n);
    rep(i,n) {
        cin >> w[i];
        W[i] = w[i];
    }
    sort(W.begin(),W.end());
    rep(i,n-1){
        if(W[i+1] == W[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0;i < n - 1;i++){
        string a = w[i],b = w[i+1];
        int as = a.size(), bs = b.size();
        if(a[as - 1] != b[0]) {
            cout << "No" << endl; 
            return 0;
        }
    } 
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    L = list(map(int,input().split()))
    ans = 0
    for i in L:
        for j in L:
            for k in L:
                if i < j and j < k and (i+j) > k and (i+k) > j and (j+k) >i:
                    ans +=1
    print(ans)




    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9124
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long ans = 0;
        long[] num = new long[n + 1];
        for (long i = 2; i <= n; i++) {
            for (int j = 1; i * j <= n; j++) {
                num[(int)i * j]++;
            }
        }
        for (int i = 2; i <= n; i++) {
            ans += (num[i] + 1) * i;
        }
        System.out.println(ans + 1);
    }
}

Measured memory_bytes: 115696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a[35]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin>>k;
    cout<<a[k-1]<<endl;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = [0]
A.extend(list(map(int,input().split())))

town = 1
once = [0]*(n+1)

for i in range(n):
  if once[town]==0:
    once[town] = 1
  else:
    break
  town = A[town]

rt = A[town]
roop = 1
while rt != town:
  rt = A[rt]
  roop += 1

rt = 1
bf = 0
while rt != town:
  rt = A[rt]
  bf += 1  

if bf<k:
  K = (k-bf)%roop + bf
else:
  K = k

town = 1
for _ in range(K):
  town = A[town]

print(town)

Measured memory_bytes: 32248
from bisect import bisect_left,bisect_right
def main():
    n = int(input())
    d = [int(x) for x in input().split()]
    d = sorted(d)
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            flgi,flgj = 0,0
            a = d[i]+d[j]
            b = d[j]-d[i]

            left = bisect_left(d,a)
            right = bisect_right(d,b)
 
            if right<i+1<=left:
                flgi = 1
            if right<j+1<=left:
                flgj = 1
            ans += max((left-right)-(flgi+flgj),0)
    print(ans//3)
if __name__ == "__main__":
    main()


Measured memory_bytes: 47504
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int R;
            cin >> R;
                if(0 <= R && R < 1200){
                    cout << "ABC" << endl;
                }else if(1200 <= R && R < 2800){
                    cout << "ARC" << endl;
                }else{
                    cout << "AGC" << endl;
                }
    return 0;}

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

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int N,num,ans;
	
	ans = 0;
	cin >> N;
	for (int i = 1; i <= N; i += 2){
		num = 0;
		for (int j = 1; j <= N; j++) {
			if (i%j == 0)num++;
		}
		if(num==8)ans++;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    int ans=1;
    int h[20];
    cin >> N;
    for (int i=0;i<N;i++){
        cin >> h[i];
    }
    
    int highest = h[0];
    
    if ( h[1] > h[0] ){
            ans++;
            highest = h[1];
        }else if ( h[0] == h[1] ){
            ans++;
        }
        
        
    for (int i=2;i<N;i++){
        if ( h[i] > highest ){
            ans++;
            highest = h[i];
        }else if ( h[i] == highest ){
            ans++;
        }
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
   string s;
   cin >> s;
   cout << (s <= "2019/04/30" ? "Heisei" : "TBD") << endl;
}

Measured memory_bytes: 256
N=int(input())
T=[0]+[int(i) for i in input().split()]
M=int(input())
P=[]
X=[]
for i in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

T_sum=sum(T)

for i in range(M):
    print(T_sum-T[P[i]]+X[i])

Measured memory_bytes: 3064
using System;
class Program
{
  static void Main(string[] args)
  {
    string[] items = Console.ReadLine().Split(' ');

    int g = int.Parse(items[1]);
    int b = int.Parse(items[2]);

    if ((g * 10 + b) % 4 == 0)
    {
      Console.WriteLine("YES");
    }
    else
    {
      Console.WriteLine("NO");
    }
  }
}

Measured memory_bytes: 13140
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int main() {
	int sum = 0;
	REP(q, 10) {
		int s;
		cin >> s;
		sum += s;
	}
	cout << sum << endl;
}


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

int main() {
  int x, y,z;
  cin >> x >> y >> z;

  if (y * x > z) {
    cout <<  z  << endl;
  }
  if (y * x < z) {
      cout << y * x << endl;
  }
  if (y * x == z) {
      cout << z << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;
 
const int MAX_N=10000;
int x,a,b;

int main(){
	cin >> x >> a >> b;
	
	cout << (abs(x-a)>abs(x-b)?'B':'A') << endl;
	return 0;
}


Measured memory_bytes: 764
using System;
class Program
{
    static int n;
    static int a;
    static int b;
    static long k;
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        n = int.Parse(s[0]);
        a = int.Parse(s[1]);
        b = int.Parse(s[2]);
        int at = a, bt = b;
        a = Math.Max(at, bt);
        b = Math.Min(at, bt);
        k = long.Parse(s[3]);
        int mod = 998244353;
        Comb c = new Comb(n, mod);
        long ans = 0;
        for (long r = 0; r <= Math.Min(k / a, n); r++)
        {
            if ((k - a * r) % b != 0)
                continue;
            long bl = (k - a * r) / b;
            if (bl > n)
                continue;
            ans += (c.comb((int)r) * c.comb((int)bl)) % mod;
            ans = ans % mod;
        }
        Console.WriteLine(ans);
    }
}
class Comb
{
    int n;
    int mod;
    int fac;
    int[] finv;
    int[] inv;
    public Comb(int n, int mod)
    {
        this.n = n;
        this.mod = mod;
        finv = new int[n + 1];
        inv = new int[n + 1];
        fac = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; i++)
        {
            inv[i] = mod - (int)((long)inv[mod % i] * (mod / i) % mod);
            fac = (int)((long)fac * i % mod);
            finv[i] = (int)(((long)finv[i - 1] * inv[i]) % mod);
        }
    }
    public long comb(int i)
    {
        return fac * ((long)finv[i] * finv[n - i] % mod) % mod;
    }
}

Measured memory_bytes: 13280
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;
ll inf = 1000000007;
ll c[55];
int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<ll>>a(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		a[i].resize(m);
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	ll ans = inf;
	for (int bit = 0; bit < (1 << n); bit++) {
		ll sum = 0;
		vector<ll>t(m, 0);
		bool ok = true;
		for (int j = 0; j < n; j++) {
			if (bit & (1 << j)) {
				sum += c[j];
				for (int k = 0; k < m; k++) {
					t[k] += a[j][k];
				}
			}
		}
			for (int i = 0; i < m; i++) {
				if (t[i] < x) {
					ok = false;
				}
			}
		if (ok) {
			ans = min(ans, sum);
		}
	}
	if (ans == inf) {
		cout << "-1" << endl;
	}
	else {
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = InputNum();
            var a = InputNumList();

            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if(Math.Abs(a[j] - a[i]) > ans)
                    {
                        ans = Math.Abs(a[j] - a[i]);
                    }
                }
            }
            WriteLine(ans);
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

Measured memory_bytes: 11348
#include <stdio.h>

int main(void){
    int n,y,i,j,k;
    scanf("%d %d",&n,&y);
    y/=1000;
    for(i=0;i<=n;i++){
        for(j=0;j<=n-i;j++){
            k=n-i-j;
            if(10*i+5*j+k==y){
                printf("%d %d %d\n", i,j,k);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  if (S.at(1) == 'B') {
    cout << "ARC" << endl;
  }
  if (S.at(1) == 'R') {
    cout << "ABC" << endl;
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    int h,n;
    cin >> h >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i,n){
        int in;
        cin >> in;
        sum += in;
    }

    if(sum >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

class Solver {
public:
    void solve();
};

void Solver::solve() {
    int a;
    int b;
    int k;
    std::cin >> a >> b >> k;

    int min;
    std::vector<int> commonDivisors = std::vector<int>();
    if (a > b) min = b;
    else min = a;

    for (int i = 1; i <= min; ++i) {
        if (!(a % i) && !(b % i)) {
            commonDivisors.push_back(i);
        }
    }

    std::size_t index = commonDivisors.size() - k;
    //for (auto e : commonDivisors) {
    //    std::cout << e << std::endl;
    //}
    std::cout << commonDivisors[index] << std::endl;
}


int main() {
    Solver solver = Solver();
    solver.solve();
    return 0;
}

Measured memory_bytes: 256
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
N=int(input())
count=[0]*N
A=list(map(int,input().split()))
for i in range(N):
    count[A[i]-1]+=1
#print(count)
k=max(count)
"""
kari=count.copy()
kari.sort()
tekitou=kari[1]"""
#print(k)
ans=0
for i in range(N):
    if count[i]>=2:
        ans+=cmb(count[i],2)
#print(ans)
pin=cmb(k,2)
pink=cmb(k-1,2)
#print(cmb(0,2))
for i in range(N):
    unti=count[A[i]-1]
    #print(unti,"unti")
    if unti==k:
        print(ans-pin+pink)
    else:
        if unti>2:
            print(ans-cmb(unti,2)+cmb(unti-1,2))
        elif unti==2:
            print(ans-1)
        else:
            print(ans)

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0) break;
		int tx[n], ty[n];
		REP(i, n) cin >> tx[i] >> ty[i];
		int m;
		cin >> m;
		int sx[m], sy[m];
		REP(i, m) cin >> sx[i] >> sy[i];
		ll search[m];
		REP(i, m) search[i] = 10000000LL*sx[i]+sy[i];
		sort(search, search+m);
		int ax = -1, ay = -1;
		REP(i, m){
			int dx = sx[i]-tx[0], dy = sy[i]-ty[0];
			bool c = true;
			REP(j, n){
				int nx = tx[j] + dx, ny = ty[j] + dy;
				ll key = 10000000LL*nx+ny;
				if(!binary_search(search, search+m, key)){
					c = false;
				}
			}
			if(c){
				ax = dx; ay = dy;
			}
		}
		cout << ax << " " << ay << endl;
	}
	return 0;
} 


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

int main(){
  int N;
  cin>>N;
  char c;
  vector<string> st(N);
  rep(i,N){
    cin>>st[i];
    for(int j=0; j<10; j++){
      for(int k=j+1; k<10; k++){
        if(st[i][j]>st[i][k]){
          c=st[i][j];
          st[i][j]=st[i][k];
          st[i][k]=c;
        }
      }
    }
  }
  
  sort(st.begin(), st.end());
  ll ans=0, cnt=0;
  rep(i,N){
    if(i==N-1){
      if(st[i]==st[i-1]){
        cnt++;
        ans+=cnt*(cnt-1)/2;
      }
    }else{
      if(st[i]==st[i+1]){
        cnt++;
      }else{
        cnt++;
        ans+=cnt*(cnt-1)/2;
        cnt=0;
      }
    }
  }
    
  cout<<ans;
  
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;


int main() {

    int a, b;
    cin >> a >> b;
    for (int i = 0; i < 10000; i++) {
        if (floor((double)i * 0.08) == a && floor((double)i * 0.1) == b) { cout << i << endl; break; }
        if (i == 9999)cout << -1 << endl;
    }


}


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

int N,K;
int dp[2][1001][1001];
int dm[2][1001][1001];

int a[1000];

int main(){
  scanf("%d %d",&N,&K);
  for(int i=0;i<N;i++)scanf("%d",&a[i]);
  sort(a,a+N);
  
  fill( (int*)dp[0], (int*)dp[1], 1e9);


  int ans=1e9;
  
  for(int T=1;T<=K;T++){
    int t=T%2;
    int u=1-t;

    fill( (int*)dp[t], (int*)dp[t+1], 1e9);
    for(int i=0;i<N;i++){
      dp[0][i][i+1]=0;
      dp[1][i][i+1]=0;
    }
    
    for(int w=2;w<=N;w++){
      for(int i=0;i+w<=N;i++){
        int j=i+w;
        int si=i+1;
        int ti=j-1;

        if(w>2){
          si=dm[t][i][j-1];
          ti=dm[t][i+1][j];
        }
        
        for(int k=si;k<=ti;k++){
          if(dp[t][i][j] > dp[u][i][k]+dp[u][k][j]+a[j-1]-a[k-1]){
            dp[t][i][j]=dp[u][i][k]+dp[u][k][j]+a[j-1]-a[k-1];
            dm[t][i][j]=k;
          }
        }

        if(i==0&&j==N)ans=min(ans,dp[t][i][j]);
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;

    vector<vector<bool>> dp(2, vector<bool>(16002, 0));
    vector<int> v[2];
    dp[0][8001] = dp[1][8001] = true;

    int tmp = 0, dir = 0;
    for(char x : s){
        if(x == 'F'){
            tmp++;
        }else{
            v[dir].push_back(tmp);
            dir = 1-dir;
            tmp = 0;
        }
    }
    if(tmp) v[dir].push_back(tmp);

    // ロボットは最初x軸正の方向を向いている！
    if(s[0] == 'F'){
        dp[0][8001] = false;
        dp[0][8001+v[0][0]] = true;
        v[0].erase(v[0].begin());
    }
    
    // 最悪4000*16000=6.4e7
    for(int i = 0; i < 2; i++){
        for(int val : v[i]){
            if(val == 0)    continue;
            vector<bool> next(16002, 0);
            for(int j = 0; j < 16002; j++){
                if(dp[i][j])    next[j-val] = next[j+val] = true;
            }
            dp[i] = next;
        }
    }

    cout << ((dp[0][x+8001]&&dp[1][y+8001]) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	int N = S.size();
	int l = 2;
	int res = 0;
	for (int i = 0; i < N; i++) {
		if (l == 2) {
			res++;
			l = 1;
		}
		else {
			if (S[i] == S[i - 1]) {
				if (i == N - 1)break;
				else {
					i++;
					l = 2;
					res++;
				}
			}
			else {
				l = 1;
				res++;
			}
		}

	}
	cout << res << endl;
}

Measured memory_bytes: 720
n = int(input())
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
def dfs(res, i):
    if len(res) >= n:
        print(res)
        return
    for k in range(i):
        dfs(res+l[k], i)
    dfs(res+l[i], i+1)
dfs("", 0)

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    ll N, W;
    cin >> N >> W;
    V<pair<ll, ll>> p(N);
    rep(i, N) cin >> p[i].first >> p[i].second;
    sort(ALL(p), [&](auto a, auto b) {
        return a.first != b.first ? a.first < b.first : a.second > b.second;
    });
    ll w = p[0].first;
    V<ll> v[4];
    for(auto P : p)
        v[P.first - w].push_back(P.second);
    rep(i, 4) rep(j, v[i].size() - 1) v[i][j + 1] += v[i][j];
    ll ans = -1;
    rep(a, v[0].size() + 1) rep(b, v[1].size() + 1) rep(c, v[2].size() + 1) {
        ll x = w * (a + b + c) + b + c * 2;
        if(x > W) continue;
        ll sum = 0;
        if(a) sum += v[0][a - 1];
        if(b) sum += v[1][b - 1];
        if(c) sum += v[2][c - 1];
        x = min<ll>(v[3].size(), (W - x) / (w + 3));
        if(x) sum += v[3][x - 1];
        chmax(ans, sum);
    }
    cout << ans << endl;

    return 0;
}

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

int main(void){
    long long x, y;
    cin >> x >> y;
    
    long long cnt = 0;
    while(x <= y){
        x *= 2;
        cnt++;
    }
    
    cout << cnt << endl;
    
    return 0;
}


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

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

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	bool flag=false;
	while(true){
		int total=read();
		if(total==0) break;
		if(flag) cout << endl;
		int coinNum[4];
		int coin[4]={10,50,100,500};
		REP(i,4){
			coinNum[i]=read();
		}
		int pay;
		int totalCoinNum;
		int ans[5]={1000000,0,0,0,0};
		REP(i,coinNum[0]+1){
			REP(j,coinNum[1]+1){
				REP(k,coinNum[2]+1){
					REP(l,coinNum[3]+1){
						pay = coin[0]*i+coin[1]*j+coin[2]*k+coin[3]*l;
						if(total>pay) continue;
						int oturi = pay-total;
						totalCoinNum=coinNum[0]+coinNum[1]+coinNum[2]+coinNum[3]-(i+j+k+l);
						REP(i,4){
							int cnt = oturi/coin[3-i];
							totalCoinNum+=cnt;
							oturi%=coin[3-i];
						}
						if(totalCoinNum<ans[0]){
							ans[0] = totalCoinNum;
							ans[1] = i;
							ans[2] = j;
							ans[3] = k;
							ans[4] = l;
						}
					}
				}
			}
		}
		if(ans[1]!=0) cout << "10 " << ans[1] << endl;
		if(ans[2]!=0) cout << "50 " << ans[2] << endl;
		if(ans[3]!=0) cout << "100 " << ans[3] << endl;
		if(ans[4]!=0) cout << "500 " << ans[4] << endl;
		flag=true;
	}
}

Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,cnt = 0;
    cin >> x;
    double y = sqrt(x);

if(x == 2){
cout << 2 << endl;
return 0;
}
    while(1){
    bool prime = true;
    for(int i = 2; i < y + 1; i++){
        if(x % i == 0)
        prime = false;
    }
    if(!(prime)){
    x++;
    y = sqrt(x);
    }
    else
    {
        break;
    }
}
    cout << x << endl;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
A = [int(i) for i in input().split()]
e = K - A[N - 1] + A[0] # N番目から1番目の間の距離
R = []
for i in range(N - 1):
    R.append(A[i + 1] - A[i])
R.append(e)
R.sort()
del R[-1]
print(sum(R))


Measured memory_bytes: 26444
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools

for s in sys.stdin:
  lis_weight = [1,2,4,8,16,32,64,128,256,512] 
  lis = []
  d = int(s)
  lis_weight.reverse()
  for e in lis_weight:
    if d >= e:
      lis.append(e)
      d -= e
  lis.reverse()
  for e in lis:
    print e,
  print 

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
   ll N,M;
   cin >> N >> M;
  vector<ll> a(M);
  for(ll i= 0;i<M;i++){
    cin >> a[i];
  }
  
  vector<ll> b(N,0);//a[i]番目が1の配列　壊れている段の番号の要素が1
  for(ll i = 0;i<M;i++){
    b[a[i]] = 1;
  }

  ll ans = 0;
  vector<ll> f(N+1,0);
  f[0] = 1;
  f[1] = 1;
  if(b[1] == 1) f[1] =0;
  ll d = 1000000007;
  
  bool flag = false;//aの隣接二項の差が1なら移動方法なし
  for(ll i = 0;i<M-1;i++){
    if(abs(a[i]- a[i+1]) == 1){
      flag = true;
      break;
    }
  }
  if(flag) cout << 0 << endl;
  else{
  for(ll i = 1;i<N;i++){
   if(b[i] == 0){
     f[i+1] = (f[i]%d + f[i-1]%d)%d;
   }
    if(b[i] == 1){
      f[i] = 0;
      f[i+1] = f[i-1];
    }
   }
    cout << f[N] << endl;
  }
                         
}


Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;
char a[100005];
int main()
{
	long long sum=0;
	for(int i=0;i<100000;i++)
	{
		cin>>a[i];
		if(a[i]!='B'&&a[i]!='W') break;
		if(a[i]>=2)
		{
			if(a[i]=='W'&&a[i-1]=='B') sum++;
			if(a[i]=='B'&&a[i-1]=='W') sum++;
		}
	}
	printf("%lld",sum);
	return 0;
}



Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	s := next()
	if s == "ABC" {
		puts("ARC")
	} else {
		puts("ABC")
	}
}


Measured memory_bytes: 1764
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

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

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 3003;

int n;
double p[N];
double dp[N][N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> p[i];
	int mn = n / 2 + 1;
	for (int i = mn; i <= n; i++)
		dp[n][i] = 1;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j <= i; j++) {
			dp[i][j] = dp[i + 1][j] * (1 - p[i]);
			dp[i][j] += dp[i + 1][j + 1] * p[i];
		}
	}
	cout << fixed << setprecision(10) << dp[0][0] << endl;
	return 0;
}


Measured memory_bytes: 68992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60; 
const double PI=3.14159265358979323846;

int main()
{
  double A, B, H, M;
  cin >> A >> B >> H >> M;
  double angleC = PI/6*H+PI/360*M-PI/30*M;
  //if(angleC > PI) angleC = 2*PI - angleC;
  double c2 = A*A+B*B-2*A*B*cos(angleC);
  cout << setprecision(20) << sqrt(c2) << endl;
}

Measured memory_bytes: 4188
H, W, D = map(int, input().split())

X = [0] * (H*W+1)

for i in range(H):
    j = 0
    for a in input().split():
        X[int(a)] = (i, j)
        j += 1

S = [0] * (H*W+1)

for i in range(1, H*W+1):
    if i+D <= H*W:
        S[i+D] += S[i] + abs(X[i+D][0] - X[i][0]) + abs(X[i+D][1] - X[i][1])


Q = int(input())
for q in range(Q):
    l, r = map(int, input().split())
    print(S[r]-S[l])

Measured memory_bytes: 14340
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    string a, b, c;
    cin >> n >> a >> b >> c;

    ll ans = 0;
    rep(i, n) {
        if(a[i] == b[i] && b[i] == c[i]) {
            ans += 0;
        }
        else if(a[i] != b[i] && b[i] != c[i] && c[i] != a[i]) {
            ans += 2;
        }
        else {
            ans += 1;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static int N;
    static void solve(Scanner scanner) {
        String s = scanner.next();
        int digit = s.length();
        N = Integer.parseInt(s);
        dfs(0, digit, false, false, false);
        System.out.println(ans);
    }

    static int ans = 0;
    private static void dfs(long curr, int digit, boolean b3, boolean b5, boolean b7) {
        if (curr <= N && b3 && b5 && b7) {
            ans++;
        }
        if (digit == 0) {
            return;
        }
        dfs(curr * 10 + 3, digit - 1, true, b5, b7);
        dfs(curr * 10 + 5, digit - 1, b3, true, b7);
        dfs(curr * 10 + 7, digit - 1, b3, b5, true);
    }

}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int L[2002][2002],R[2002][2002],U[2002][2002],D[2002][2002];
char s[2000][2000];

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w; cin>>h>>w;
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			cin>>s[i][j];
		}
	}
	for(int i=1;i<h+1;++i){
		for(int j=1;j<w+1;++j){
			if(s[i-1][j-1]=='.'){
				L[i][j]=L[i][j-1]+1;
				U[i][j]=U[i-1][j]+1;
			}
		}
	}
	for(int i=h;i>=1;--i){
		for(int j=w;j>=1;--j){
			if(s[i-1][j-1]=='.'){
				R[i][j]=R[i][j+1]+1;
				D[i][j]=D[i+1][j]+1;
			}
		}
	}
	int ans=0;
	for(int i=1;i<h+1;++i){
		for(int j=1;j<w+1;++j){
			ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 66816
//author: dazhong_feliks

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,A,B;
  cin >> N >> A >> B;
  
  if ( N <= B / A )
  { cout << A * N << endl; 
  }
  
  else if ( N > B / A )
  { cout << B << endl;
  }
}



Measured memory_bytes: 256
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i, ans,numc(0:100000)
    integer(int32), allocatable:: a(:)

    read*, n
    allocate(a(n))
    read*, a(:)
    numc(:) = 0
    do i=1,n
        numc(a(i)) = numc(a(i)) + 1
    end do
    ans=0

    do i=1,99999
        ans=max(ans,sum(numc(i-1:i+1)))
    end do

    print*, ans
end program name

Measured memory_bytes: 1536
#include<iostream>
#include<map>

using namespace std;

int main(){
    int n, a[100009], cnt1=0, cnt2=0;
    map<int , int> m;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> a[i];
        m[a[i]]++;
        if(m[a[i]]==1)cnt1++;
    }
    int cnt= n-(cnt1);
    if(cnt%2==1){
        cout << cnt1 -1 << endl;
    }
    else{
        cout << cnt1 << endl;
    }
}

Measured memory_bytes: 5376