akhauriyash/Code-Regression huggingface dataset:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n = int(input())
a = list(myinput())
# print(a)

ls = [ [] for _ in range(n) ]
for i in range(n-1):
    b = a[i] - 1
    ls[b].append(i)
# print(ls)

for i in range(len(ls)):
    print(len(ls[i]))

Measured memory_bytes: 108964
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
using namespace std;
template <typename T = int>
T in() {
    T temp;
    cin >> temp;
    return temp;
}
/*
uint64_t GetXor (uint64_t A, uint64_t B) {
    uint64_t ret;
    for (uint64_t i = A; i <=B; i++) {
        if (i == A) ret = i;
        else ret ^= i;
    }
    return ret;
}
*/
class XorWorld {
    uint64_t A;
    uint64_t B;
    uint64_t diff;

    static uint64_t constexpr period = 4; // = 100b
    static uint64_t constexpr periodicMask = period - 1; // = 011b

public : 
    XorWorld(uint64_t A_p, uint64_t B_p) : A(min(A_p, B_p)), B(max(A_p,B_p)), diff(B - A + 1) {}

    uint64_t GetXor () {
        uint64_t ret;
        for (uint64_t i = A; i <=B; i++) {
            if (i == A) ret = i;
            else ret ^= i;
        }
        return ret;
    }

    uint64_t Calculate() {
        uint64_t ret;

        // When the size is too small, no problem even calculate greedly
        if (diff < (period + 1)) {
            ret = GetXor();

        } else {
            
            // If the A is even number.
            // Shorten A to (B - 1), (B - 2) or (B - 3).
            if ((A & 1) == 0) {
                
                diff = (diff & periodicMask);
                A = B - diff + 1;
                ret = GetXor();

            // Otherwise A is odd number
            } else {

                // Separate numbers to A and then after((A + 1)(must be even number) to B)
                XorWorld child(A + 1, B);

                // Calc them 
                ret = A ^ child.Calculate();
            }
        }
        return ret;   
    }
};
int main() {
    uint64_t A(in<uint64_t>()), B(in<uint64_t>());
    XorWorld world(A, B);
    cout << world.Calculate() << endl;
    return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
//#define int long long
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)

inline int read() 
{
	char cc = getchar(); int cn(0), flus(1);
	while(cc < '0' || cc > '9') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}

const int MAXN = 2e5 + 10;
const int Mod = 998244353, G = 3;

int a[MAXN];

signed main()
{
	int n = read(), k = read();
	rep(i, 1, n) a[i] = read();
	rep(i, 1, n - k) 
	{
//		printf("i = %d \n",i);
		if(a[i] < a[i + k]) printf("Yes\n"); 
		else printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 4372
import java.util.Arrays;
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
      long n = sc.nextLong();
      long k = sc.nextLong();
      int count =0;
      if(n>k){
        n = n%k;
      }
      while(true){
        if(count==0){
          n = Math.abs(n-k);
        }else{
          if(n>Math.abs(n-k)){
            n=Math.abs(n-k);
          }else{
            break;
          }
        }
        count=1;
      }
      System.out.println(n);
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
int R[101010];
int B[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	
	R[1]=1;
	for(i=1;i<=N;i++) B[i]=1;
	FOR(i,M) {
		cin>>x>>y;
		
		if(B[x]==1) {
			if(R[x]) {
				R[y]=1;
				R[x]=0;
			}
		}
		else {
			R[y] |= R[x];
		}
		
		B[x]--;
		B[y]++;
		
	}
	
	cout<<count(R,R+N+2,1)<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

using namespace std;

// when range [l, r), has property notP~P, want first P.
// when return r, means not found.
template <typename T>
T bs_first(T l, T r, function<bool (T)> f) {
    assert(l < r);
    T mid;
    while (l != r) {
        mid = l + (r-l)/2;
        if (f(mid)) {
            r = mid;
        }else {
            l = mid + 1;
        }
    }
    return r;
}

void solve() {
    int n; cin >> n;
    vector<int> down;  down.reserve(n+1);
    down.push_back(1000'000'111);
    for (int _ = 0; _ < n; _++) {
        int x; cin >> x;
        if (x <= down.back()) {
            down.push_back(x);
        }else{
            int sz = down.size();
            int i = bs_first<int>(0, sz, [&](int i){
                    return x > down[i];
                    });
            down[i] = x;
        }
    }
    int res = down.size()-1;
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

int main() {
  ll N, M;
  cin >> N >> M;
  ll A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + sizeof(A) / sizeof(ll));
  pair<ll, ll> v[M];
  ll temp1, temp2;
  for (int i = 0; i < M; i++) {
    cin >> temp1;
    cin >> temp2;
    //cout << "!";
    v[i].first = temp2;
    v[i].second = temp1;
    //cout << "!";
  }
  sort(v, v + sizeof(v) / sizeof(pair<ll, ll>));

  ll anscard = 0, donecard = 0, doneope = 0, ans = 0;
  while (anscard < N && doneope < M) {
    if (A[N - 1 - donecard] >= v[M - 1 - doneope].first) {
      ans += A[N - 1 - donecard];
      donecard++;
      anscard++;
      //cout << ans << " " << anscard << endl;
    } else {
      ans += v[M - 1 - doneope].first * min(v[M - 1 - doneope].second, N - anscard);
      anscard += min(v[M - 1 - doneope].second, N - anscard);
      doneope++;
      //cout << ans << " " << anscard << endl;
    }
  }
  for (; anscard < N; anscard++) {
    ans += A[N - 1 - donecard];
    donecard++;
  }
  cout << ans;
}

Measured memory_bytes: 2560
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
string s,t,ans="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",s2;
int i,j,k,c;
int main(void){
	cin>>s>>t;
  	if(s.size()<t.size()){
      cout<<"UNRESTORABLE"<<endl;
	return 0;
    }
	s2=s;
	int f;
	for(i=0;i<s.size();i++){
		f=1;
		for(j=0;j<t.size();j++){
			if(s[i+j]!=t[j]&&s[i+j]!='?') f=0;
		}
		if(f){
			for(j=0;j<t.size();j++){
				s[i+j]=t[j];
			}
			for(j=0;j<s.size();j++){
				if(s[j]=='?') s[j]='a';
			}
			ans=min(ans,s);
			s=s2;
		}
	}
	if(ans!="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz") cout<<ans<<endl;
	else cout<<"UNRESTORABLE"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion

int n;
int iv[100'001], p[100'001];
void solve()
{
    cin>>n;
    for (int i = 1;i <= n;++i) cin>>p[i];
    for (int i = 1; i<=n;++i) iv[p[i]] = i;
    set<int> idx;
    int ans = 0;
    for (int x = n; x >= 1; --x)
    {
        idx.insert(iv[x]);
        vector<int> lps(2, 0), rps(2, n+1);
        auto it = idx.find(iv[x]);
        for (int j = 0; j < 2 && it!= idx.begin(); ++j)
        {
            --it;
            lps[j] = *it;
        }
        it = ++idx.find(iv[x]);
        for (int j = 0; j < 2 && it != idx.end(); ++j)
        {
            rps[j] = *it;
            ++it;
        }
        ans += x*((rps[1]-rps[0])*(iv[x]-lps[0])+(rps[0]-iv[x])*(lps[0]-lps[1]));
    }
    cout << ans << '\n';
}

signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(22);
    // cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 9876
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
H,W,K=MI()
graph=[input() for _ in range(H)]
ans=0
for gyou in range(1<<H):
  for retsu in range(1<<W):
    cnt=0
    for i in range(H):
      for j in range(W):
        if 1&(gyou>>i) and 1&(retsu>>j):
          if graph[i][j]=='#':
            cnt+=1
    if cnt==K:
      ans+=1
print(ans)

Measured memory_bytes: 9188
fun maxScore(xs: List<IndexedValue<Long>>): Long {
  val vs = xs.map { it.value }
  if (vs.max()!! < 0) {
    return vs.max()!!
  } else {
    return vs.filter { it >= 0 }.sum()
  }
}

fun elementsForMaxScore(xs: List<IndexedValue<Long>>): List<IndexedValue<Long>> {
  if (maxScore(xs) < 0) {
    val max = maxScore(xs)
    return listOf(xs.first { it.value == max })
  } else {
    return xs.filter { it.value >= 0 }
  }
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = readLine()!!.split(" ").map(String::toLong)
  val evens = xs.withIndex().filter { it.index % 2 == 0 }
  val odds = xs.withIndex().filter { it.index % 2 == 1 }
  val seeds = if (maxScore(evens) >= maxScore(odds)) evens else odds
  val indexes = elementsForMaxScore(seeds).map { it.index }
  // println(indexes)
  // 0-index
  val operations = mutableListOf<Int>()
  if (indexes[0] > 0) {
    repeat(indexes[0]) { operations.add(0) }
  }
  for (i in 0 until indexes.size - 1) {
    val gap = indexes[i + 1] - indexes[i]
    assert(gap % 2 == 0)
    if (gap == 2) {
      operations.add(1)
    } else {
      repeat(gap / 2 - 1) { operations.add(2) }
      operations.add(1)
    }
  }
  if (n - indexes[indexes.size - 1] - 1 > 0) {
    val remaining = n - indexes[indexes.size - 1] - 1
    // println("remaining: $remaining")
    // println(operations)
    operations.addAll(remaining downTo 1)
    // println(operations)
  }
  println(maxScore(seeds))
  println(operations.size)
  operations.forEach { println(it + 1) }
}


Measured memory_bytes: 37904
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ull X;
  cin >> X;
  ull c = 100;
  for(ull i=1;;++i) {
    c = c+c/100;
    if(X <= c) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e;
    cin>>a>>b>>c;
    e=c;
    for(int i=2;i<=a;i++)
    {
        cin>>d;
        c=__gcd(c,d);       
        e=max(d,e);
    }
    if(b%c==0&&b<=e)        
        cout<<"POSSIBLE"<<endl;
    else
        cout<<"IMPOSSIBLE"<<endl;
}

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

int main()
{
    int n;
    cin >> n;
    int a;
    int mov = 0;

    for (int i = 0; i < n; i++) {
        cin >> a;
        if (i + 1 != a) mov++;
    }

    if (mov <= 2) puts("YES");
    else puts("NO");
}


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

int main()
{
   

    int n, r;
    cin >> n >> r;
    if(n >= 10)
    {
        cout << r <<"\n";
        return 0;
    }

    cout << r + (100*(10-n)) << "\n";

    return 0;    

}


Measured memory_bytes: 256
import math
A, B = map(int, input().split())


min_x = int(min(A//0.08, B//0.1))
max_x = int(max((A+1)//0.08, (B+1)//0.1))

for x in range(min_x,max_x):
    if math.floor(x*0.08) == A and math.floor(x*0.1) == B:
        print(x)
        exit(0)
print(-1)


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

using ll = long long;
const int INF = 1e9+7;

void solve()
{
	int n;cin >> n;
	cout << n + (n*n) + (n*n*n) << '\n';

}

int main()
{
	int t=1;
	//int t;cin >> t;
	while(t--) solve();
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int h,w; cin>>h>>w;
    vector<string>s(h);rep(i,h)cin>>s[i];
    rep(i,h)cout<<s[i]<<'\n'<<s[i]<<endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused_macros, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap};

// Main
fn main(){
    input!{
        s: String,
    }
    println!("{}", s.rfind('Z').unwrap() - s.find('A').unwrap() + 1);
}



Measured memory_bytes: 4352
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 2 * 1E+05;

int N;

int A[MAX_N + 1];
ll S[MAX_N + 1];

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

    cin >> N;

    ll sum = 0;

    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        sum += A[i];
        S[i] = S[i - 1] + A[i];
    }

    ll ans = INF;

    for (int i = 1; i <= N - 1; i++) {
        ans = min(ans, abs(2 * S[i] - sum));
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 6004
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =999999999;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);

int A,B,C;
  cin>>A>>B>>C;
  if(A+B>=C){
    cout<<"Yes"<<endl;
  }else{cout<<"No"<<endl;
       }
  
  
  
  
  
  
  
  
}


Measured memory_bytes: 768
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
 
n, q = map(int, input().split())
tl = [list() for _ in range(n)]
xl = [0] * n
ans = [0] * n
 
for i in range(n-1):
    a, b = map(int, input().split())
    tl[a-1].append(b-1)
    tl[b-1].append(a-1)
 
for i in range(q):
    p, x = map(int, input().split())
    xl[p-1] += x

def rec(p, parent, x):
    x += xl[p]
    ans[p] = x
    for num in tl[p]:
        if num == parent: continue
        rec(num, p, x)

rec(0, -1, 0)
 
print(*ans)

Measured memory_bytes: 236936
#include<cstdio>

int main(){
  char a[64];
  while(scanf("%s",&a[0])>0){
    for(int i=1;i<8;i++)
      scanf("%s",&a[8*i]);
    for(int i=0;i<64;i++){
      if(a[i]=='1'){
	if(a[i+1]=='1'){
	  if(a[i+2]=='1'){
	    puts("C");
	  }else if(a[i+7]=='1'){
	    puts("G");
	  }else if(a[i+8]=='1'){
	    puts("A");
	  }else{
	    puts("E");
	  }
	}else{
	  if(a[i+7]=='1'){
	    puts("D");
	  }else if(a[i+9]=='1'){
	    puts("F");
	  }else{
	    puts("B");
	  }
	}
	break;
      }
    }
  }
}

Measured memory_bytes: 936
parseInt(x) = parse(Int, x)
parseFloat(x) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n,m=parseMap(split(readline()))
    sc=[parseMap(split(readline())) for i in 1:m]
    ans=-1
    for i in ifelse(n==1,0,10^(n-1)):10^n-1
        t=string(i)
        flg=true
        for (s,c) in sc
            if parseInt(t[s])!=c
                flg=false
            end
        end
        if flg==true
            ans=i
            break
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 168036
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 2;
double eps = 1e-11;

int dp[2][1000010];
int dpodd[2][1000010];

int main() {
    int num[200];
    int oddnum[200];
    int odd = 1;
    int N = 1000000;
    for (int i = 1; i < 200; i++) {
        num[i] = i * (i + 1) * (i + 2) / 6;
        if (num[i] % 2 == 1) {
            oddnum[odd] = num[i];
            odd++;
        }
    }
    for (int i = 0; i < 2; i++) {
        fill(dp[i], dp[i] + N + 10, iinf);
        fill(dpodd[i], dpodd[i] + N + 10, iinf);
    }
    dp[0][0] = 0;
    int last = 0;
    for (int i = 1; i < 200; i++) {
        fill(dp[i % 2], dp[i % 2] + N + 10, iinf);
        if (num[i] > N) {
            last = i - 1;
            break;
        }
        for (int j = 0; j <= N; j++) {
            if (j < num[i]) {
                dp[i % 2][j] = dp[(i + 1) % 2][j];
            } else {
                dp[i % 2][j] = min(dp[(i + 1) % 2][j], dp[i % 2][j - num[i]] + 1);
            }
        }
    }
    dpodd[0][0] = 0;
    int oddlast = 0;
    for (int i = 1; i < odd; i++) {
        fill(dpodd[i % 2], dpodd[i % 2] + N + 10, iinf);
        if (oddnum[i] > N) {
            oddlast = i - 1;
            break;
        }
        for (int j = 0; j <= N; j++) {
            if (j < oddnum[i]) {
                dpodd[i % 2][j] = dpodd[(i + 1) % 2][j];
            } else {
                dpodd[i % 2][j] = min(dpodd[(i + 1) % 2][j], dpodd[i % 2][j - oddnum[i]] + 1);
            }
        }
    }
    while (1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        cout << dp[last % 2][n] << " " << dpodd[oddlast % 2][n] << endl;
    }
}



Measured memory_bytes: 18700
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;
const int lim = 101;
int main(){
    int c[3][3];
    fol(i,3){
        fol(j,3) cin>>c[i][j];
    }
    int b[3]={};
    bool flag = false;
    bool fl1,fl2,fl3;
    fol(i,lim){
        fol(j,lim){
            fol(k,lim){
                fl1=true;
                fol(l,3){
                    if(c[l][0]-i!=c[l][1]-j||c[l][1]-j!=c[l][2]-k) fl1=false;
                }
                if(fl1) {flag=fl1;break;}
            }
        }
    }
    if (flag)cout << "Yes"<<endl;
    else cout << "No"<<endl;
    return 0;
}


Measured memory_bytes: 256
def inpl():
    return list(map(int, input().split()))


MOD = 10**9 + 7

N, M = inpl()
A = [False for i in range(N + 1)]
for i in range(M):
    a = int(input())
    A[a] = True
p = 1
pp = 0
ans = 0

for i in range(1, N + 1):
    if A[i] is True:
        pp = p
        p = 0
    else:
        ans = p + pp
        pp = p
        p = ans
    # print(ans)

print(ans % MOD)


Measured memory_bytes: 3888
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  int flag = 0;
  int index;
  cin >> S;
  bool flag2 = false;
  int size = S.size();
  if(S[0]=='A'){

    for(int i = 2;i<size-1;i++){
      if(S[i]=='C'){
        flag++;
        index = i;
      }
    }

    if(flag == 1){
      for(int i = 0;i<size;i++){
        if((i==0) || (i==index)){
          continue;
        }
        if((S[i]<'a') || (S[i]>'z')){
          flag2 = true;
        }
      }
      if(flag2 == false){
        cout << "AC";
      }else{
        cout << "WA";
      }
    }else{
      cout << "WA";
    }
  }else{
    cout << "WA";
  }

  return 0;

}

Measured memory_bytes: 256
import sys
from string import ascii_lowercase as AL

input = sys.stdin.readline


def main():
    S = input().rstrip()

    counter = {}
    for s in AL:
        counter[s] = 0

    for s in S:
        counter[s] += 1

    ans = ""
    for s in AL:
        if counter[s] == 0:
            ans = s
            break
    if not ans:
        ans = "None"

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 4084
/*--------------------------------
    Anshul Gangwar
  Chandigarh University
--------------------------------*/
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

#define endl  '\n'


int main()
{
  int a,b;
  cin>>a>>b;
  if(a >= 13)
    cout<<b<<endl;
  else if(a <=12 && a>= 6)
    cout<<b/2<<endl;
  else
    cout<<0<<endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    int a = stdin.nextInt();
    String s = stdin.next();
    if(a >= 3200){
      System.out.println(s);
    }
    else{
      System.out.println("red");
    }
  }
}


Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		// 2020/1/30 No.151
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();

		switch (str) {
		case "a":
			System.out.println("b");
			break;
		case "b":
			System.out.println("c");
			break;
		case "c":
			System.out.println("d");
			break;
		case "d":
			System.out.println("e");
			break;
		case "e":
			System.out.println("f");
			break;
		case "f":
			System.out.println("g");
			break;
		case "g":
			System.out.println("h");
			break;
		case "h":
			System.out.println("i");
			break;
		case "i":
			System.out.println("j");
			break;
		case "j":
			System.out.println("k");
			break;
		case "k":
			System.out.println("l");
			break;
		case "l":
			System.out.println("m");
			break;
		case "m":
			System.out.println("n");
			break;
		case "n":
			System.out.println("o");
			break;
		case "o":
			System.out.println("p");
			break;
		case "p":
			System.out.println("q");
			break;
		case "q":
			System.out.println("r");
			break;
		case "r":
			System.out.println("s");
			break;
		case "s":
			System.out.println("t");
			break;
		case "t":
			System.out.println("u");
			break;
		case "u":
			System.out.println("v");
			break;
		case "v":
			System.out.println("w");
			break;
		case "w":
			System.out.println("x");
			break;
		case "x":
			System.out.println("y");
			break;
		case "y":
			System.out.println("z");
			break;
		case "z":
			break;
		}
	}
}

Measured memory_bytes: 21588
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		String w = scan.nextLine();
		int nagasa = w.length();
		int i = 0;
		String no = "No";

		List<String> list = new ArrayList<String>();

		for (i = 0; i < nagasa; i++) {
			list.add(w.charAt(i) + "");
		}

		for (; 0 != list.size();) {

			List<String> set = new ArrayList<>();
			Collections.addAll(set, list.get(0));

			list.removeAll(set);

			int te = nagasa - list.size();

			if (te % 2 != 0) {

				break;


			}

			if(list.size()==0) {
				no="Yes";
			}

		}

		System.out.println(no);


	}

}

Measured memory_bytes: 22996
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double a,b,c,d;
int main(void){
    cin>>a>>b>>c>>d;
    cout<<setprecision(30)<<a/2*b;
    cout<<" ";
    if((a/2==c)&&(b/2==d))cout<<1<<endl;
    else cout<<0<<endl;
}


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

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int m = scanner.nextInt();
    int[] num = new int[n];
    int res = 0;

    for (int i = 0; i < n; i++) {
      num[i] = -1;
    }

    for (int i = 0; i < m; i++) {
      int s = scanner.nextInt();
      int c = scanner.nextInt();

      if (num[s - 1] == -1) {
        num[s - 1] = c;
      } else if (num[s - 1] != c) {
        res = -1;
        break;
      }
    }

    if (res != -1) {
      if (n > 1 && num[0] == 0) {
        res = -1;
      } else {
        if(n > 1 && num[0] == -1) {
          num[0] = 1;
        }
        for (int i = 0; i < n; i++) {
          if (num[i] != -1) {
            res += num[i] * Math.pow(10, n - i -1);
          }
        }
      }
    }
    System.out.println(res);

  }
}



Measured memory_bytes: 21844
n=int(input())
s=input()
afters={'R':0, 'B':0, 'G':0}
for i in range(n):
    afters[s[i]] += 1

befores = {'R':0, 'B':0, 'G':0}
befores[s[0]]+=1
afters[s[0]]-=1

ans=0
for i in range(1,n-1):
    head=s[0:i]
    last=s[i+1::]
    afters[s[i]]-=1
    if s[i]=='R':
        ans += befores['G'] * afters['B'] + befores['B'] * afters['G'] 
        bad =[['G','B'],['B','G']]
    elif s[i]=='B':
        ans += befores['G'] * afters['R'] + befores['R'] * afters['G'] 
        bad = [['G','R'],['R','G']]
    else:
        ans += befores['B'] * afters['R'] + befores['R'] * afters['B'] 
        bad = [['B','R'],['R','B']]
    for j in range(min(i-0, n-i-1)):
        if [s[i-j-1], s[i+j+1]] in bad:
            ans -= 1
    befores[s[i]]+=1
    

print(ans)
        

Measured memory_bytes: 81380
import collections
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N = int(input())

B = []
for i in range(N):
    s = input()
    s_sort = sorted(s)
    s_cnt= dict(collections.Counter(s_sort))
    l = ""
    for k,v in s_cnt.items():
        l += str(k)+str(v)
    B.append(l)

#print(B)
B_cnt = dict(collections.Counter(B))
D = [v for v in B_cnt.values() if v != 0]
#print(D)
E = [cmb(d,2) for d in D if d != 1]
#print(E)
print(sum(E))

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

int main() {
    int n;
    std::cin >> n;

    auto ps = std::vector<int>();
    ps.reserve(n);

    for(int i = 0; i < n; ++i) {
        int p;
        std::cin >> p;
        ps.push_back(p);
    }

    int m = n;
    int answer = 0;

    for(const auto p: ps) {
        if(m >= p) {
            ++answer;
            m = p;
        }
    }

    std::cout << answer << std::endl;

    return 0;
}


Measured memory_bytes: 1024
// AOJ 3028 Ball
// 2018.3.28 bal4u

#include <stdio.h>
#include <stdlib.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

typedef struct { int c, w; } T;
T ball[100002];
int l[100002];

int cmp(T *a, T *b) { return b->w - a->w; }

int main()
{
	int N, M, C, i, j, c, ans;

	N = in(), M = in(), C = in();
	for (i = 0; i < C; i++) l[i] = in();
	for (i = 0; i < N; i++) ball[i].c = in()-1, ball[i].w = in();

	qsort(ball, N, sizeof(T), cmp);

	ans = 0;
	j = 0; for (i = 0; i < N && j < M; i++) {
		c = ball[i].c;
		if (l[c]-- <= 0) continue;
		ans += ball[i].w, j++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3280
#include<bits/stdc++.h>
using namespace std;
int rec(string a,string b)
{
    int m=a.length();
    int n=b.length();
    int lcs[4000][4000]={0};
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(a[i-1]==b[j-1])
            {
                lcs[i][j]=1+lcs[i-1][j-1];
            }
            else
            lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
        }
    }
    int i=m,j=n,idx=lcs[m][n];
    //char *lcsans=new char[idx];
    //lcsans[idx]='\0';
    string lcsans="";
    while(i>0 and j>0)
    {
        if(a[i-1]==b[j-1])
        {
            //lcsans[idx-1]=a[i-1];
            lcsans=a[i-1]+lcsans;
            idx--;
            i--;
            j--;
        }
        else if(lcs[i-1][j]>lcs[i][j-1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    
    cout<<lcsans<<endl;;
    return lcs[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    rec(a,b);
    return 0;
}


Measured memory_bytes: 66144
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    
    int x2 = 0;
    int x4 = 0;
    vec<int> a(N);
    rep(i, N){
        int a;
        cin >> a;
        if(a%4 ==0){
            ++x4;
            continue;
        } else if(a%2 == 0){
            ++x2;
            continue;
        }
    } 
    if(N%2 == 1) --N;
    bool c = N-(x4*2) -x2 <= 0;
    cout << (c?"Yes": "No") << endl;
}


Measured memory_bytes: 3784
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}
const ll m =1000000007;


int main()
{
    ll n;
    cin>>n;
    if(n<=1)cout<<0;
    else{
            ll q= ((mod(10,n,m)%m-mod(9,n,m)%m)%m+m)%m;
      ll p =((mod(8,n,m)%m-mod(9,n,m)%m)%m+m)%m;
    cout<<((p%m+q%m)%m+m)%m;

    }

    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ASCII_SIZE 256
#define ll long long int
int main()
{
    ll n,a,b,c,k,flag=0,ans;
    cin>>a>>b>>c>>k;
    if(k==0) ans=a-b;
    else if(k%2!=0){
        ans=b-a;
    }
    else if(k%2==0){
        ans=a-b;
    }
    if(abs(ans)>1000000000000000000) cout<<"Unfair\n";
    else cout<<ans;
    return 0;
}


Measured memory_bytes: 256
def main():
    n,k = map(int,input().split())
    a = []
    for _ in range(n):
        a.append(int(input()))
    DP = [[] for _ in range(n)]
    DP[1].append(0)
    M = 1
    for i in range(1,n):
        m = M
        flg = 0
        while m>0:
            for p in DP[m]:
                if abs(a[i]-a[p])<=k:
                    DP[m+1].append(i)
                    flg = 1
                    if m+1>M:
                        M=m+1
                    break
            if flg==1:
                break
            m -= 1
        if flg==0:
            DP[1].append(i)
    print(M)

if __name__ == "__main__":
    main()


Measured memory_bytes: 123056
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>
using namespace std;
 
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define reps(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
 
string n, a, b, c;
int i, j, k;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b >> c;

    cout << 'A' << b[0] << 'C' << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
int par[100010]; // 親
int rankk[100010]; // 木の深さ

// n要素で初期化
void init(int n){
  rep(i,n){
    par[i]=i;
    rankk[i]=0;
  }
}

//木の根を求める
int find(int x){
  if(par[x]==x){
    return x;
  }else{
    par[x]=find(par[x]);
    return par[x];
  }
}

//xとyの属する集合を併合
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;

  if(rankk[x]<rankk[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(rankk[x]==rankk[y])rankk[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

    int main(){
      int n,m;
      cin >> n >>m;
      int p[n];
      rep(i,n){
        cin>>p[i];
        p[i]--;
      }
      int x[m],y[m];
      rep(i,m){
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
      }
      int ans=0;
      init(n);
      rep(i,m){
        unite(x[i],y[i]);
      }
      rep(i,n){
        if(same(i,p[i]))ans++;
      }
      cout << ans << endl;
      return 0;}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
long long t1,t2,a1,a2,b1,b2,a,b,s,ret;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>t1>>t2;
	cin>>a1>>a2;
	cin>>b1>>b2;
	a=a1-b1;
	b=a2-b2;
	if(a<0){
		a=-a;
		b=-b;
	}
	s=a*t1+b*t2;
	if(s==0){
		cout<<"infinity"<<endl;
		return 0;
	}
	if(s>0){
		cout<<"0"<<endl;
		return 0;
	}
	if(s<0){
		ret=a*t1/(-s)+(-b)*t2/(-s);
		if((-b)*t2%(-s)==0LL)
			ret-=1LL;
		cout<<ret<<endl;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N,D;

    scanf("%d %d",&N,&D);
    D = D*2+1;

    if(N%D == 0){
        printf("%d\n",N/D);
    } else {
        printf("%d\n",N/D+1);
    }


    return 0;
}

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

int main(){
    unordered_map<int, int> S;
    int N;

    cin >> N;
    for (int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        S[tmp] += 1;
    }

    if (S.size()==N){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 8520
#pragma warning (disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char buf[256];
	int n, x;

	while (1) {
		fgets(buf, 256, stdin);
		sscanf(buf, "%d %d", &n, &x);

		//printf("n : %d\n", n);
		//printf("x : %d\n", x);

		if (n == 0 && x == 0) break;

		int ans = 0;
		for (int i = n; i > 2; i--) {
			for (int j = i - 1; j > 1; j--) {
				for (int k = j - 1; k > 0; k--) {
					if (i + j + k == x) {
						ans++;
						//printf("i:%d j:%d k:%d\n", i, j, k);
					}
				}
			}
		}

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

	return 0;
}

Measured memory_bytes: 2756
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n], b = new long[n];
		long sum = 0;
		for (int i = 0 ; i < n; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		for (int i = 0 ; i < n; i++) {
			b[i] = sc.nextLong();
			sum -= b[i];
		}
		if (sum < 0) {
			System.out.println("-1");
			return;
		}
		sum = 0;
		int res = 0;
		List<Long> remains = new ArrayList<>();
		for (int i = 0 ; i < n; i++) {
			long d = a[i] - b[i];
			if (d < 0) {
				sum += d;
				res++;
			}
			else if (d > 0) remains.add(d);
		}
		Collections.sort(remains, Comparator.reverseOrder());
		for (long remain : remains) {
			if (sum >= 0) break;
			sum += remain;
			res++;
		}
		System.out.println(res);
	}
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for(int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;



int main() {
  string c;
  cin >> c;
  if(c == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}

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

int main()
{
  int a;
  int b;
  cin>>a;
  cin>>b;
  if(a>b){
      cout<<"a > b"<<endl;}else
  if(a==b){
      cout<<"a == b"<<endl;}
      else{
          cout<<"a < b"<<endl;}
}

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

int main()
{
    int n;
    scanf("%d",&n);
    map<string,long long int>mp;
    map<string,long long int>:: iterator it;
    for(int i=0; i<n ;i++)
    {
        int p;
        scanf("%d",&p);
        getchar();
        string q;
        cin>>q;
        if(p==0)
        {
            long long int x;
            scanf("%lld", &x);
            if(mp.count(q))
            {
               mp.erase(q);
            }
            mp.insert(pair<string,long long int>(q,x));
        }
        else if(p==1)
        {
            if(mp.count(q))
            {
                cout<<mp.find(q)->second<<endl;
            }
            else
            {
                cout<<0<<endl;
            }
        }
        else
        {
            if(mp.count(q))
            {
               mp.erase(q);
            }
        }
    }
}



Measured memory_bytes: 27908
import itertools
n,m,q=map(int,input().split())
data=[]
for i in range(q):
    data.append(list(map(int,input().split())))
ans=0

for pair in itertools.combinations_with_replacement(list(range(1,m+1)),n):
    res=0
    for i in range(q):
        if(pair[data[i][1]-1]-pair[data[i][0]-1]==data[i][2]):
            res+=data[i][3]
    ans=max(ans,res)

print(ans)

Measured memory_bytes: 9208
s=input()
c1=c2=0
f1='0'
f2='1'
for x in s:
  if f1==x:
    pass
  else:
    c1+=1
  if f1=='0':
    f1='1'
  else:
    f1='0'
for x in s:
  if f2==x:
    pass
  else:
    c2+=1
  if f2=='0':
    f2='1'
  else:
    f2='0'
print(min(c1,c2))

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

#define NL '\n'
#define C char
#define D double
#define F float
#define S string
#define sz(x) x.size()
#define INF LONG_LONG_MAX
#define PI (2.0*acos(0.0))
#define sfi(x) scanf("%d",&x)
#define sfi2(x,y) scanf("%d %d",&x,&y)
#define sfi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sfl(x) scanf("%lld",&x)
#define sfl2(x,y) scanf("%lld %lld",&x,&y)
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sfd(x) scanf("%lf",&x);
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min3(b,c,d))
#define pb push_back
#define all(x) x.begin(),x.end()
#define asort(x) sort(all(x));
#define dsort(x) sort(all(x), greater<int>())
#define unq(x) x.erase(unique(x.begin(),x.end()),x.end())
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

LL gcd(LL a,LL b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
    return a/gcd(a,b)*b;
}

LL bigmod(LL base, LL power, LL mod)
{
    if(power==0) return 1;
    else if(power%2==1)
    {
        LL value1 = base % mod; LL value2 = (bigmod(base,power-1,mod))%mod;
        return (value1*value2)%mod;
    }
    else
    {
        LL value1 = (bigmod(base,power/2,mod))%mod;
        return (value1*value1)%mod;
    }
}



int main()
{
    LL n;
    sfl(n);
    LL arr[n];
    LL brr[n+1];
    mem(brr,0);

    for(LL i=1; i<n; i++)
    {
        sfl(arr[i]);
        brr[arr[i]]++;
    }

    for(LL i=1; i<=n; i++)
        cout<<brr[i]<<NL;
}


Measured memory_bytes: 6844
a, b, c = map(int, input().split())
if a == b == c and a % 2 == 0:
    print(-1)
else:
    cnt = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        _a = (b+c)//2
        _b = (c+a)//2
        _c = (a+b)//2
        a = _a
        b = _b
        c = _c
        cnt += 1
    print(cnt)

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

int main(){
	int m,f,r;
	while(true){
		cin >> m >> f >> r;
		if(m == -1&&f == -1&&r == -1)break;
		if(m == -1||f == -1)cout << "F" << endl;
		else if(m + f >= 80)cout << "A" << endl;
		else if(65 <= m + f && m + f < 80)cout << "B" << endl;
		else if(50 <= m + f && m + f < 65)cout << "C" << endl;
		else if(30 <= m + f && m + f < 50){
			if(r >= 50)cout << "C" << endl;
			else if(r <= 50)cout << "D" << endl;}
		else if(m + f < 30)cout << "F" << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 100005
using namespace std;
using namespace __gnu_pbds;  

ll x,y,a,b,c,p;
ll v1[MAXN],v2[MAXN];
vector<ll> v;

void solve()
{
	cin>>x>>y>>a>>b>>c;
	for(ll i=0;i<a;i++) cin>>v1[i];
	for(ll i=0;i<b;i++) cin>>v2[i];
	for(ll i=0;i<c;i++)
	{
		cin>>p;
		v.pb(p);
	}
	sort(v1, v1+a,greater<ll>());
	sort(v2, v2+b,greater<ll>());
	for(ll i=0;i<x;i++) v.pb(v1[i]);
	for(ll i=0;i<y;i++) v.pb(v2[i]);
	sort(v.begin(), v.end(),greater<ll>());
	ll sum=0;
	for(ll i=0;i<x+y;i++) sum+=v[i];
	cout<<sum<<endl;
}

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


Measured memory_bytes: 8048
/*
"اله السماء يعطينا النجاح ونحن عبيده نقوم ونبني"
"تكفيك نعمتي لان قوتي في الضعف تكمل"
created by shady rafet
my face book : https://www.facebook.com/profile.php?id=100019579575853
never give up
one day i will do it ':(

*/
#include <bits/stdc++.h>
using namespace std;
#define io                        \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
const ll oo = 1e18;
const ll N = 1e6;
const ll mod = 1e9 + 7;
#define point complex<double>
const double pi = acos(-1);
double dot(point a, point b)
{
    return (conj(a) * b).real();
}
double cross(point a, point b)
{
    return (conj(a) * b).imag();
}
ll inv[N],fact[N];
ll fb(ll x, ll y)
{
    if(y == 0)
    return 1;
   ll ans = fb(x,y/2);
   ans = (ans * ans)%mod;
   if(y % 2 !=0)
   {
       ans = (ans*(x%mod))%mod;
   }
   return ans ;
}
void pre(ll n)
{
    fact[0] = 1;
    inv[0] = 1;
    for ( int i = 1;i<=n;i++)
    {
        fact[i] = (i * fact[i-1])% mod;
        inv[i] = fb(fact[i], mod-2);
    }
}
ll ncr (ll n , ll r)
{
      return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}
ll npr (ll n,ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}

int main()
{
     io ;
 map<int,int> me;
 for(int i = 1;i<=100;i++)
 {
     for(int  j = 1;j<=100;j++)
     {
         for (int k = 1 ;k<=100;k++)
         {
             int x = (i*i) + (j*j) + (k*k) + (i*j) + (i*k) + (k *j);
             me[x]++;
         }
     }
 }
 int n;
 cin>>n;
 for(int i = 1;i<=n;i++)
    cout<<me[i]<<endl;

    return 0;
}


Measured memory_bytes: 5400