akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <unordered_set>
#include <queue>
#include <boost/functional/hash.hpp>

int main(){
  int H,W;
  std::cin >> H >> W;

  int gmap[53][53] = {};
  int nw = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      std::cin >> c;
      if(c == '.'){
        gmap[i+1][j+1] = 1;
        nw += 1;
      }else{
        gmap[i+1][j+1] = 0;
      }
    }
  }

  std::unordered_set<std::tuple<int, int>, boost::hash<std::tuple<int, int>>> searched;
  std::queue<std::tuple<int, int, int>> q;
  q.push(std::make_tuple(1,1,1));
  searched.insert(std::make_tuple(1,1));
  int length;
  int xy_diff[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
  while(true){
    if(q.size() == 0){
      length = -1;
      break;
    }
    int x,y;
    std::tie(x,y,length) = q.front();
    q.pop();
    if(x == H && y == W){
      break;
    }
    for(int i = 0; i < 4; i++){
      int xi = x+xy_diff[i][0];
      int yi = y+xy_diff[i][1];
      if(gmap[xi][yi] == 1 && searched.count(std::make_tuple(xi,yi)) == 0){
        q.push(std::make_tuple(xi,yi,length+1));
        searched.insert(std::make_tuple(xi,yi));
      }
    }
  }
  if(length == -1){
    std::cout << -1 << std::endl;
  }else{
    std::cout << nw-length << std::endl;
  }


  return 0;
}



Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {


			//テンプレート
			//// 整数の入力
			//int a = int.Parse(Console.ReadLine());
			//// スペース区切りの整数の入力
			//string[] input = Console.ReadLine().Split(' ');
			//int b = int.Parse(input[0]);
			//int c = int.Parse(input[1]);
			//// 文字列の入力
			//string s = Console.ReadLine();
			////出力
			//Console.WriteLine(a + b + c + " " + s);

			string input = Console.ReadLine();
			char[] input_char = input.ToCharArray();
			var hash = input_char.Distinct().ToArray();

			if (input_char.Length == 4 && hash.Length == 2)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}


        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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; }

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

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


int main() {
    ll N, M;  cin >> N >> M;
    vector<pair<ll, ll>> ab(N);
    rep(i, N) {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(all(ab));
    priority_queue<ll> q;

    auto itr = ab.begin();
    ll sum = 0;
    for (int d=1; d<=M; ++d) {
        while(itr != ab.end() && itr->first <= d) {
            q.push(itr->second);
            ++itr;
        }

        if (!q.empty()) {
            sum += q.top();
            q.pop();
        }
    }

    print(sum);

    return 0;
}



Measured memory_bytes: 2936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];
		for(int i=0; i<N; i++) {
			V[i]= sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			C[i]= sc.nextInt();
		}
		sc.close();
		int s = 0;
		for(int i=0; i<N; i++) {
			int a = V[i] - C[i];
			if(a>0) {
				s+=a;
			}
		}
		System.out.println(s);
	}

}

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

#define int long long

typedef pair <int, int> pii;
typedef pair <pii, int> ppi;

#define F first
#define S second

const int MN = 101234, INF = 1ll << 60, MOD = 1000000007;

int n, m, a, b, ans;
int cntA[MN], cntB[MN], disA[MN], disB[MN], MDis;

pii dis[MN];

vector <pii> adj[MN];

void Input();
void GetDist();
void Count();
void Dij(int);

int32_t main() {
	Input();
	GetDist();
   	Count();
}
void Input() {
	cin >> n >> m;
	cin >> a >> b;
	a--, b--;
	for (int i = 0; i < m; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		adj[--u].push_back({--v, w});
		adj[v].push_back({u, w});
	}
}
void GetDist() {
	Dij(a);
	MDis = dis[b].F;
	for (int i = 0; i < n; i++) {
		disA[i] = dis[i].F;
		cntA[i] = dis[i].S;
	}
	Dij(b);
	for (int i = 0; i < n; i++) {
		disB[i] = dis[i].F;
		cntB[i] = dis[i].S;
	}
}
void Count() {
	ans = cntA[b] * cntA[b] % MOD;
	for (int i = 0; i < n; i++)
		if (disA[i] * 2 == MDis)
			ans = (ans - (cntA[i] * cntB[i] % MOD * cntA[i] % MOD * cntB[i] % MOD) + MOD) % MOD;
	for (int v = 0; v < n; v++) 
		for (auto p: adj[v]) {
			int u = p.F, w = p.S;
			if (disA[v] + w + disB[u] == MDis && disA[v] * 2 < MDis && disB[u] * 2 < MDis)
				ans = (ans - (cntA[v] * cntB[u] % MOD * cntA[v] % MOD * cntB[u] % MOD) + MOD) % MOD;
		}
	cout << ans;
}
void Dij(int v) {
	for (int i = 0; i < n; i++)
		dis[i] = {INF, 0};
	dis[v] = {0, 1};
	set <pii> st = {pii(dis[v].F, v)};
	while (st.size()) {
		int v = st.begin()->S;
		st.erase(st.begin());
		for (auto p: adj[v]) {
			int u = p.F, w = p.S;
			if (dis[v].F + w < dis[u].F) {
				st.erase({dis[u].F, u});
				dis[u] = pii(dis[v].F + w, dis[v].S);
				st.insert({dis[u].F, u});
			} else if (dis[v].F + w == dis[u].F)
				(dis[u].S += dis[v].S) %= MOD;
		}
	}
}




Measured memory_bytes: 22896
//Using DFS
#include<bits/stdc++.h>
using namespace std;
int dp[100001];
int maxi = INT_MIN;
void dfs_helper(int src, int v,int e,list<int> *l,map<int,bool>&vis)
{
  vis[src]=true;
  list<int>::iterator it;

  for(it=l[src].begin();it!=l[src].end();++it)
  {
    if(!vis[*it])
      dfs_helper(*it,v,e,l,vis);
      
      dp[src] = max(dp[src],dp[*it]+1);
  }
  maxi = max(dp[src],maxi);
}
      
void dfs(int v,int e, list<int>* l)
{
  map<int,bool>vis;
  for(int i=1;i<=v;i++)
  {
    if(!vis[i])
      dfs_helper(i,v,e,l,vis);
  }
  cout<<maxi<<endl;
}
int main()
{
  int v,e;
  cin>>v>>e;
  list<int>l[v+1];
  while(e--)
  {
    int x,y;
    cin>>x>>y;
    l[x].push_back(y);
  }
  dfs(v,e,l);
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define line cout<<"------------------------"<<endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
using namespace std;
int  main()
{
    vector<int> v;
    for(int i=0;i<3;i++)
    {
        int a;
        cin>>a;
        v.pb(a);
    }
    sort(v.begin(),v.end());
    cout<<v[0]+v[1]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	map<ll,ll>q;
	cin>>n;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		q[now]++;
		if(q[now]==2){
			cout <<"NO";
			return 0;
		}
	}
	cout << "YES";
	// your code goes here
	return 0;
}

Measured memory_bytes: 16088
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		long[] pref = new long[N+1];
		long ans = Long.MAX_VALUE;
		for (int i = 1; i <= N; i++) {
			pref[i] = pref[i-1]+input.nextInt();
		}
		long TOTAL_SUM = pref[N];
		for (int L = 1; L < N; L++) {
			long left = pref[L];
			long right = TOTAL_SUM-left;
			ans = Math.min(ans, Math.abs(left-right));
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 64760
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t, u;
  cin >> s >> t >> u;
  int S = (int)s.at(0), T = (int)t.at(0), U = (int)u.at(0);
  cout << (char)(S - 32) << (char)(T - 32) << (char)(U - 32) << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main(){

    string s;
    cin >> s;

    int cnt = 0;
    for(int i=0; i<3; i++){
        if(s.at(i) == 'S') cnt++;
    }

    if(cnt == 0) cout << 3-cnt << endl;
    else if(cnt == 1){
        if(s.at(1) == 'S') cout << 1 << endl;
        else cout << 2 << endl;
    }
    else if(cnt == 2) cout << 3-cnt << endl;
    else cout << 3-cnt << endl;

    return 0;
}

Measured memory_bytes: 3624
import sys
N = int(input())
lsA = list(map(int,input().split()))
for i in range(N):
    if lsA[i] % 2 == 0:
        if lsA[i] % 3 == 0 or lsA[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            sys.exit()
print('APPROVED')

Measured memory_bytes: 61824
#include<bits/stdc++.h>
using namespace std;
    static const double pi = 3.141592653589793;
 
 
int main(){
int a,b;
  cin>>a>>b;
  int dp[b];
  int gh[b];
  for(int i=0;i<b;i++)
  {
  int x,y;
    cin>>x>>y;
    dp[i]=x;
    gh[i]=y;
  }
 
  int z=0;
  for(int i=0;i<b;i++)
  {
  for(int j=0;j<b;j++)
  {
  if(dp[i]==dp[j] & gh[i]!=gh[j]) 
  {
    z=1;
  
  }
  }
  }
  
  if(z==1) cout<<-1;
  else {
  int t=0;
   vector<int>ys(a);
    for(int i=0;i<b;i++)
    {
  ys.at(dp[i]-1)=gh[i];
    }
    int q=0;
    for(int i=0;i<b;i++)
    {
    if(dp[i]==1) q=1;
    }
    if(q==0 & a!=1) ys.at(0)=1;
    if(a==1) t=ys.at(0);
    else if(a==2) t=ys.at(0)*10+ys.at(1);
    else if(a==3) t=ys.at(0)*100+ys.at(1)*10+ys.at(2);
     if(a==1) cout<<t;
    else if(a==2 & t>=10) cout<<t;
    else if(a==3 & t>=100) cout<<t;
    else cout<<-1;
    
  }
  
}
 
 


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))


a = int(input())
s = input()

if (a >= 3200):
    print(s)
else:
    print("red")


Measured memory_bytes: 9140
#include <iostream>
using namespace std;
int main() {
    int n, x; cin >> n >> x;
    int M[110];
    int min_m=1000;
    for (int i=0;i<n;++i) {
        cin >> M[i];
        x -= M[i];
        if (M[i]<min_m) min_m = M[i];
    }
    int ans = x/min_m + n;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint sx, sy, tx, ty;

llint gcd(llint a, llint b)
{
	if(b == 0) return a;
	return gcd(b, a%b);
}
int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> sx >> sy >> tx >> ty;
	llint x = abs(tx-sx), y = abs(ty-sy);
	
	if(x == 0 || y == 0){
		cout << 0 << endl;
		return 0;
	}
	
	llint g = gcd(x, y);
	x /= g, y /= g;
	
	llint ans = (x-1)+(y-1)+1;
	ans *= g;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
L, R = map(int, input().split())

res = 2 * (10 ** 9)
if R - L > 2019:
	print(0)
else:
	for i in range(L, R + 1):
		for j in range(i + 1, R + 1):
			mod = (i * j) % 2019
			if mod < res: res = mod
	print(res)

Measured memory_bytes: 3060
N = int(input())
As = input().split()
for a in As:
  a = int(a)
  if a % 2 == 1: # skip odd
    continue
  if (a % 3 == 0) or (a % 5) == 0: # check even
    continue
  else:
    print('DENIED')
    break
else:
  print('APPROVED')


Measured memory_bytes: 2940
#include<stdio.h>
#include<string.h>

int main(void){
   char S[101];
   int ans;
   scanf("%s", S);
   
   if(!strcmp(S,"SUN")){
      ans = 7;
   } else if(!strcmp(S,"MON")){
      ans = 6;
   } else if(!strcmp(S,"TUE")){
      ans = 5;
   } else if(!strcmp(S,"WED")){
      ans = 4;
   } else if(!strcmp(S,"THU")){
      ans = 3;
   } else if(!strcmp(S,"FRI")){
      ans = 2;
   } else if(!strcmp(S,"SAT")){
      ans = 1;
   }
   if(ans >= 1 && ans <= 7){
      printf("%d\n",ans);
   }
}


Measured memory_bytes: 1728
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a
n,x = map(int,input().split())
values = list(map(int,input().split()))
for i in range(n):
    values[i] = abs(values[i]-x)
ass = values[0]
for i in range(n):
    ass = gcd(ass,values[i])
print(ass)

Measured memory_bytes: 14252
def sub_GCD(x, y):
    if x > y:
        return y, x % y
    else:
        return x, y % x

def GCD(x, y):
    while not (x==0 or y==0):
        x, y = sub_GCD(x, y)
    print(x)

x, y = map(int, input().split())
GCD(x, y)


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

using namespace std ;

string a , b ;

bool hgs_orz() {
	for( int i = 0 ; i < a.size() ; ++i ) 
		if( a[ i ] != b[ i ] ) return false ;
	return true ;
}

signed main() {
	cin >> a >> b ;
	if( hgs_orz() ) printf( "Yes\n" ) ;
	else printf( "No\n" ) ;
	return 0 ;
}

Measured memory_bytes: 3632
#include <algorithm> // std::sort(begin,end), std::min, std::max
#include <iostream>
#include <queue>
#include <sstream>
#include <string>
#include <unordered_map>
#include <utility> // std::swap
#include <vector>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

template <typename T> // 0<1<2<3<4
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
template <typename T> // 0>1>2>3>4
using pq_dsc = priority_queue<T>;

int main(int argc, char const *argv[]) {
  int n;
  stringstream ss;
  deque<int> dq;

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

  sort(a.begin(), a.end());

  for (int i = 0; i < n; i++) {
    dq.push_back(a[i]);
  }

  int small, large;
  while (dq.size() != 1) {
    small = dq.front();
    dq.pop_front();
    large = dq.back();
    dq.pop_back();
    if (!dq.empty() && dq.front() > 0) {
      dq.push_front(small - large);
      ss << small << ' ' << large << endl;
    } else {
      dq.push_back(large - small);
      ss << large << ' ' << small << endl;
    }
  }

  cout << dq.front() << endl;
  cout << ss.str();

  return 0;
}


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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int N, M;
    cin >> N >> M;
    vector<int> AC (N,0);
    int ACnum = 0;
    int WAnum = 0;
    for(int i = 0;i < M;i++){
        int Q;
        string J;
        cin >> Q >> J;
        if(AC[Q-1] >= 0){
            if(J == "AC"){
                WAnum += AC[Q-1];
                AC[Q-1] = -1;
                ACnum++;
            }
            else{
                AC[Q-1]++;
            }
        }
    }
    cout << ACnum << " " << WAnum << endl;
}


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

using namespace std;

int main(){
  long long n,k;
  cin >> n >> k;
  
  long long sum=0;
  for(int i=k;i<n+2;i++)
    sum+=i*(n-(i-1))+1;
  
  cout << sum%1000000007 << endl;
}


Measured memory_bytes: 3632
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k)%2==0:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


Measured memory_bytes: 7000
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int INF = 100000;
const int MAX_N = 1005;


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

int n,m;

int main(){
    int a,b;
    cin >> n >> m;
    vector<vector<int> > to(10,vector<int>(10,0));
    rep(i,m){
        cin >> a >> b;
        a--; b--;
        to[a][b] = 1;
        to[b][a] = 1;
    }

    vector<int> pr;
    int ans = 0;
    for(int i=0;i<=n-1;i++) pr.push_back(i); 
    do{
        if(pr[0]!=0) break;
        bool flag = true;
        rep(i,n-1){
            if(!to[pr[i]][pr[i+1]]) {
               flag=false;
               break;
            }
        }

       if(flag){
           ans++;
            //cout << "-------" << endl;
            //rep(i,n) cout << pr[i];
            //cout << endl;
           //cout << "ok" << endl; 
       }

    }while(next_permutation(pr.begin(),pr.end()));

    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	long long k;
	cin>>k;
	cout<<50<<endl;
	
	int mod = k%50;
	long long b = 49 + k/50;
	
	rep(i,50){
		if (i < mod){
			cout << b - (mod - 1) + 50<<endl;
		}
		else{
			cout << b - (mod)<<endl;
		}
	}



	return 0;
}

Measured memory_bytes: 256
s_0 = gets.chomp.split('').map do |chr|
  if chr == "a"
    chr = 0
  elsif chr == "b"
    chr = 1
  else
    chr = 2
  end
end
s_1 = gets.chomp.split('').map do |chr|
  if chr == "a"
    chr = 0
  elsif chr == "b"
    chr = 1
  else
    chr = 2
  end
end
s_2 = gets.chomp.split('').map do |chr|
  if chr == "a"
    chr = 0
  elsif chr == "b"
    chr = 1
  else
    chr = 2
  end
end
list = [s_0,s_1,s_2]
current_num = 0
while true
  if list[current_num].size == 0
    break
  end
  next_num = list[current_num][0]#次の番の人を決める。
  list[current_num].delete_at(0)#カードを消費する。
  current_num = next_num
end
if current_num == 0
  puts "A"
elsif current_num == 1
  puts "B"
else
  puts "C"
end


Measured memory_bytes: 14244
from queue import Queue

K = int(input())

q = Queue()
for x in range(1,10):
    q.put(x)

for k in range(K-1):
    x = q.get()
    if x % 10 != 0:
        q.put(10 * x + (x % 10) - 1)
    q.put(10 * x + (x % 10))
    if x % 10 != 9:
        q.put(10 * x + (x % 10) + 1)
print(q.get())


Measured memory_bytes: 79892
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while(true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using pii   = std::pair<int, int>;
using vi    = std::vector<int>;
using vd    = std::vector<double>;
using vc    = std::vector<char>;
using vb    = std::vector<bool>;
using vs    = std::vector<std::string>;
using vpii  = std::vector<pii>;
using vvi   = std::vector<vi>;
using vvb   = std::vector<vb>;
using vvpii = std::vector<vpii>;
template<typename A> using fn = std::function<A>;
constexpr int INF   = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD   = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;
// clang-format on

template<typename T>
struct Monoid {
  T id;
  std::function<T(T, T)> op;
  Monoid(T e, std::function<T(T, T)> f)
    : id(e), op(f) {
  }
};

template<typename T>
class SegTree {
private:
  vector<T> data;
  Monoid<T> monoid;
  int size = 1;

public:
  SegTree(const int &n, const Monoid<T> &m)
    : monoid(m) {
    while (size < n) size *= 2;
    data = vector<T>(2 * size, monoid.id);
  }

  void update(int i, const T &x) {
    i += size;
    data[i]                = x;
    while (i /= 2) data[i] = monoid.op(data[i * 2], data[i * 2 + 1]);
  }

  // fold [a, b) by monoid.op
  T fold(const int &a, const int &b, const int &k = 1, const int &l = 0, int r = -1) {
    if (r == -1) r = size;
    if (r <= a || b <= l) return monoid.id;
    if (a <= l && r <= b) return data[k];
    return monoid.op(fold(a, b, k * 2, l, (l + r) / 2),
                     fold(a, b, k * 2 + 1, (l + r) / 2, r));
  }

  const T &operator[](const int &i) const {
    return data[i + size];
  }
};

Monoid<int> sumMonoid = {0, plus<int>()};

main {
  int n, q;
  cin >> n >> q;
  SegTree<int> t(n, sumMonoid);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    x--;
    if (com) {
      cout << t.fold(x, y) << endl;
    } else {
      t.update(x, t[x] + y);
    }
  }
}

Measured memory_bytes: 4892
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int a=x*y;
		int b=2*x+2*y;
		System.out.println(a+" "+b);
	}

}


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

bool is_it_a_num(char a) {
  if (a == '0') return true;
  if (a == '1') return true;
  if (a == '2') return true;
  if (a == '3') return true;
  if (a == '4') return true;
  if (a == '5') return true;
  if (a == '6') return true;
  if (a == '7') return true;
  if (a == '8') return true;
  if (a == '9') return true;
  else return false;
}

int main(){ 
  int A, B, C, D, l, r;
  
  cin >> A >> B >> C >> D;
  l = A + B;
  r = C + D;
  
  if (l > r) cout << "Left" << endl;
  if (l == r) cout << "Balanced" << endl;
  if (l < r) cout << "Right" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<iterator>
#include<string>
#include<sstream>
#include <unordered_map>
#include<cmath>
using namespace std;
#define ll long long

const int maxn=2e5+100;
const int N=1e6+100;
int a[maxn],ex[N];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    int t; t=1;
    while(t--){
       int n; cin>>n; 
       int ans=0;
       for(int i=1;i<=n;++i) {cin>>a[i]; ex[a[i]]++;}
       for(int i=1;i<=n;++i){
           if(a[i]==1){
               if(ex[1]==1) ans++;
               continue;
           }
           if(ex[1]||ex[a[i]]>1) continue;
           int s=sqrt(a[i]);
           bool ok=true;
           for(int j=2;j<=s;++j){
               if(a[i]%j==0&&(ex[j]||ex[a[i]/j])){
                   ok=false;
                   break;
               }
           }
           if(ok) ans++;
       }
       cout<<ans<<"\n";
    }    
}


Measured memory_bytes: 8272
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    s = sum(A)
    ans  = max(-1, n -s)
    print(ans)

if __name__ == '__main__':
    main()

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

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

    int n;
    cin >> n;
    int max_val = -1;
    int res = 0;

    rep(i, n){
        int p;
        cin >> p;

        max_val = max(max_val, p);
        res += p;
    }
    cout << res - max_val/2 << endl;
}

Measured memory_bytes: 256
from math import floor
import sys
from copy import copy

from collections import deque
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353




S = input().strip()
D = deque(S)


n = int(input())
reverse = False
for operation in range(n):
    data = input().strip()
    if data[0] == "1":
        if reverse is False:
            reverse = True
        else:
            reverse = False
    else:
        f = data[2]
        ele = data[4]
        if (f == "1" and reverse is False) or (f == "2" and reverse == True):
            D.appendleft(ele)
        else:
            D.append(ele)
#    print(S)
# print(reverse)
if reverse is True:
    D.reverse()
for d in D:
    print(d,end="")

Measured memory_bytes: 90588
x1, y1, x2, y2 = map(int, raw_input().split())

x3 = x2+(y1-y2)
y3 = y2-(x1-x2)
x4 = x1+(y1-y2)
y4 = y1-(x1-x2)

print('{0} {1} {2} {3}'. format(x3, y3, x4, y4)) 

Measured memory_bytes: 2568
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

inline int read () {
	int ret = 0, t = 1;
	char c = getchar();
	while ((c < '0' || c > '9') && c != '-') c = getchar();
	if (c == '-') t = -1, c = getchar();
	while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
	return ret * t;
}

int main () {
	int t = read(), n = read();
	int s = 0; while (n--) s += read();
	if (s >= t) puts("Yes"); else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
	bool operator<(const Edge &e)const { return w < e.w; }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int s, int d, Weight w = 1) { g[s].emplace_back(s, d, w); }

//?????????????????£?????°??????
Graph reverse(const Graph &g) {
	Graph rg(g.size());
	for (auto &es : g)
		for (auto &e : es)
			rg[e.d].emplace_back(e.d, e.s, e.w);
	return rg;
}

//?????£?????????????§£ O(|V|+|E|)
//ret[u] = u ????±??????????????????£???????????????????°???????????????????????????????
vector<int> kosaraju(const Graph &g) {
	int n = g.size();
	Graph rg = reverse(g);
	vector<int> cc(n, -1);
	vector<int> post;
	function<void(int, int)> dfs_cc = [&](int u, int cc_id) {
		if (cc[u] != -1)return;
		cc[u] = cc_id;
		for (auto &e : g[u])
			dfs_cc(e.d, cc_id);
		post.emplace_back(u);
	};
	for (int u = 0; u < n; u++)
		if (cc[u] == -1)
			dfs_cc(u, u);
	vector<int> scc(n, -1);
	function<void(int, int, int)> dfs_scc = [&](int u, int scc_id, int cc_id) {
		if (scc[u] != -1)return;
		if (cc[u] != cc_id)return;
		scc[u] = scc_id;
		for (auto &e : rg[u])
			dfs_scc(e.d, scc_id, cc_id);
	};
	reverse(post.begin(), post.end());
	for (auto &u : post)
		if (scc[u] == -1)
			dfs_scc(u, u, cc[u]);
	return scc;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	Graph g(N);
	rep(i, 0, M) {
		int s, t; cin >> s >> t;
		add_arc(g, s, t);
	}
	vector<int> scc = kosaraju(g);
	dump(scc);
	int Q; cin >> Q;
	rep(i, 0, Q) {
		int u, v; cin >> u >> v;
		dump(u, v);
		cout << (scc[u] == scc[v]) << endl;
	}
	return 0;
}

Measured memory_bytes: 5224
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int gcd(ll x, ll y){
  return y ? gcd(y, x%y) : x;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll Q,H,S,D,N;
    cin>>Q>>H>>S>>D>>N;

    cout<<(N/2)*min({8*Q,4*H,2*S,D})+(N%2)*min({4*Q,2*H,S})<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 200000

int main(){
    int t,i,j;
    int data[N],max,min;

    scanf("%d",&t);
    for(i=0;i<t;i++){
        scanf("%d",&data[i]);
        if(data[i] < 1 || data[i] > 1000000000) return 0;
    }

    max = data[1] -data[0];

    min = data[0];
    
    for(j=1;j<t;j++){
        if(max < data[j] - min) max = data[j] - min;
        if(min > data[j] ) min = data[j];
    }
    
    
    
    

    
    printf("%d\n",max);
    return 0;
}



Measured memory_bytes: 2564
# Edit: 2014/09/28
# Lang: Python3
# Time: 0.xxs
#

if __name__ == "__main__":
    while True:
        try:
            st0 = input()
            # print(st0)
            st0 = st0.strip("\n").replace("+", ",").replace("=", ",")
            # print(st0)
            #strA, strB, strC = str.split(",")
            #print(strA, strB, strC)

            for i in range(10):
                #print(i,str(i))
                a, b, c = st0.replace("X", str(i)).split(",")
                if a[0] == "0" and len(a) > 1:
                    continue
                if b[0] == "0" and len(b) > 1:
                    continue
                if c[0] == "0" and len(c) > 1:
                    continue
                #print(strI)
                #pass
                if int(a) + int(b) == int(c):
                    print(i)
                    break
            else:
                print("NA")
        except:
            break

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

using namespace std;

typedef long long ll;

const ll mod=1e9+7;

const int N=6666;

ll n,k;

ll c[N][N];

ll dp[N];

ll C(ll n,ll m)

{

    if(c[n][m]) return c[n][m];

    if(m==0||n==m) return 1;

    if(m==1) return n;

    return c[n][m]=(C(n-1,m-1)+C(n-1,m))%mod;

}

int main()

{

    scanf("%lld%lld",&n,&k);

    int s=n-k;

    for(int i=1;i<=s;i++)

        dp[i]=C(s-1,i-1);

    for(int i=1;i<=k;i++)

    {

        if(i>n-k+1)

        {

            printf("0\n");

            continue;

        }

        ll ans=0;
		if(n==k&&i==1) ans=1;
        ans=(ans+C(k-1,i-1)*dp[i-1])%mod;

        ans=(ans+C(k-1,i-1)*dp[i]%mod*2%mod)%mod;

        ans=(ans+C(k-1,i-1)*dp[i+1]%mod)%mod;

        printf("%lld\n",(ans%mod+mod)%mod);

    }

}

Measured memory_bytes: 102912
#if 0
2019.12.17

O(n^2m) 可过，我惊了。。。

朴素的想法是枚举每个 (i, j) 然后倒推判断是否可行。
具体的，记录 f[i] 表示当前 i 是否必须活着，
然后倒着考虑每个 (a, b) ，如果 f[a] & f[b] ，就不可行，因为 (a, b) 后两个至少得死一个，
否则如果 f[a] = 1 ，说明 (a, b) 后 a 必须活着，
那么此前如果 b 死了 a 就成了 (a, b) 的唯一目标，
因而需要满足 f[b] = 1 ，同理只要 f[b] = 1 也要满足 f[a] = 1 。
如果过程中不存在 f[a] & f[b] ，那么 (i, j) 就是可行的，复杂度 O(n^2m) ，可以 AC 。

但事实上每次倒推是毫无必要的，
记 f[i][k] 表示满足最后 i 活着的前提下 j 是否必须活着，
通过上述的倒推可以 O(nm) 求出 f ，
那么事实上对于 (i, j) ，如果存在 k 满足 f[i][k] & f[j][k] ，就是不可行的，
因为事实上 f[i][k] = 1 实际上是说明 i 活着需要 k 为 i 挡枪，
而 k 是无法同时为 i, j 挡枪的，如果 k 先为 i 挡了枪，那么之后就无法保证 j 的安全，反之亦然。
故据此复杂度可以做到 O(nm + n^3) 。
#endif
#include <cstdio>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 404, maxm = 100005;
int a[maxm], b[maxm];
bool f[maxn][maxn], g[maxn];

int main() {
	int n = read, m = read;

	for(int i = 1; i <= m; i ++)
		read(a[i], b[i]);

	for(int i = 1; i <= n; i ++) {
		f[i][i] = 1;
		for(int j = m; j; j --) {
			if(f[i][a[j]] and f[i][b[j]]) {
				g[i] = 1;
				break;
			}
			if(f[i][a[j]] or f[i][b[j]])
				f[i][a[j]] = f[i][b[j]] = 1;
		}
	}

	int ans = 0;
	for(int i = 1; i < n; i ++)
		if(!g[i])
			for(int j = i + 1; j <= n; j ++)
				if(!g[j]) {
					for(int k = 1; k <= n; k ++)
						if(f[i][k] and f[j][k])
							goto FAIL;
					++ ans;
FAIL:;
				}

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


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  ll n;
  cin >> n;
  ll ans=0;
  for (ll i=1; i<=n; i++){
    if (i%3==0 || i%5==0){
      continue;
    }else{
      ans += i;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    string s,t;
    vector<string> kouhos;
    cin >> s >> t;
    bool flag2 = false;
    for(int i = s.size(); i >= 0; i--){
        if(i + t.size() > s.size()) continue;
        bool flag = true;
        REP(j,0,t.size()){
            if(!(s[i+j] == '?' || s[i+j] == t[j])) flag = false;
        }
        if(flag){
            string kouho = s;
            REP(j,0,t.size()){
                kouho[i+j] = t[j];
            }
            REP(j,0,kouho.size()){
                if(kouho[j] == '?'){
                    kouho[j] = 'a';
                }
            }
            kouhos.push_back(kouho);
            flag2 = true;
//            break;
        }
    }

    if(!flag2){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

//    REP(i,0,s.size()){
//        if(s[i] == '?') s[i] = 'a';
//    }
    sort(all(kouhos));
    cout << kouhos[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n, p;
    cin >> n >> p;

    int b0, b1;
    b0 = b1 = 0;
    rep(i, n){
        int a;
        cin >> a;
        if(a % 2 == 0){
            b0++;
        }else{
            b1++;
        }
    }

    if(b0 == n && p == 0){
        cout << (1LL << n) << endl;
        return 0;
    }
    if(b0 == n && p == 1){
        cout << 0 << endl;
        return 0;
    }

    cout << (1LL << (n - 1)) << endl;

    return 0;
}


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

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

  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef int32_t i32;

#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>=b;i--)
#define FILL(a,b,c) for(ll i=0;i<c;i++) a[i]=b;

#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

#define endl "\n"
#define setpri(x) setprecision(x)
#define vp(x) cout<<#x<<" : "<< (x)<<" | "
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define forf(i,a,b) for(int i=a;i<b;i++)

#define INF 1e17+4
#define MINF 
#define MAX_INT 100000
#define MOD 1000000007
ll mod(ll n) { n %= MOD; if (n < 0) return n + MOD; else return n;}
// vector<int> adj[1000002];
// int vis[1000002],dep[1000002],siz[1000002];

// void dfs(ll cur,ll par)
// {
//     vis[cur]=1;siz[cur]=1;
//     for(auto x:adj[cur])
//     {
//         if(vis[x]!=1)
//         {
//             dep[x]=dep[cur]+1;
//             dfs(x,cur);
//             siz[cur]+=siz[x];
//         }    
//     }
// }

// bool sortfunc(const pair<int,int> &a, const pair<int,int> &b) 
// { 
//     return ;
// }

void solve()
{
    string s;
    cin>>s;
    if(s=="ARC")    
        cout<<"ABC";
    else
        cout<<"ARC" ;
    
}




signed main()
{
    FAST;
    
    // ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 25, M = 1e6 + 25, oo = 1e9+7, mxmsk = 1 << 16;
const long long OO = 1e18+25;
    
#define f first
#define s second

int n, m;
int main() {
    scanf("%d%d",&n,&m);
    printf("%d\n",((n<10&&m<10)?n*m:-1));
    return 0;
}

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

using namespace std;

int n, MAX;
vector<double> v;
double dp[3005][3005];


double prob(int numero_coroa, int pos)
{
	if(dp[numero_coroa][pos] >= 0)
		return dp[numero_coroa][pos];

	if(pos >= n)
		return 1;

	if(numero_coroa == MAX)
	{
		return dp[numero_coroa][pos] = v[pos] * prob(numero_coroa, pos + 1);
	}

	double soma = 0.00;

	soma += v[pos] * prob(numero_coroa, pos + 1);

	soma += (1.00 - v[pos]) * prob(numero_coroa + 1, pos + 1);


	return dp[numero_coroa][pos] = soma;
}





int main()
{

	cin >> n;


 	memset(dp, -1, sizeof(dp));
 
 	double num1;
 	for (int i = 0; i < n; ++i)
 	{
 		cin >> num1;
 		v.push_back(num1);
 	}
 	
 	MAX = n/2;

 	cout << fixed << setprecision(10) << prob(0, 0) << endl;


 
    return 0;
}

Measured memory_bytes: 74604
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int i, isCorrect;
  string str, _str;

  while(1){
    getline(cin, str);
    if(str == ".") break;

    for(i=0, isCorrect=1; i<str.size(); ++i){
      if(str[i] == '(' || str[i] == '['){
	_str.push_back(str[i]);
      }else if(str[i] == ')'){
	if(_str.size() == 0 || _str[_str.size()-1] != '(')
	  isCorrect = 0;
	else
	  _str.erase(_str.end()-1);
      }else if(str[i] == ']'){
	if(_str.size() == 0 || _str[_str.size()-1] != '[')
	  isCorrect = 0;
	else
	  _str.erase(_str.end()-1);
      }

      if(isCorrect == 0) break;
    }

    if(isCorrect == 1 && _str.size() == 0)
      cout << "yes" << endl;
    else
      cout << "no" << endl;

    str.clear();
    _str.clear();
  }

  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  int n,i,j,k,p[20],x[20][20],y[20][20],r[20],a,c,m=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&r[i]);
    for(j=0;j<r[i];j++)scanf("%d %d",&x[i][j],&y[i][j]);
  }
  for(i=0;i<(1<<n);i++){
    a=i;
    c=0;
    for(j=0;j<n;j++){
      c+=a%2;
      p[j]=a%2;
      a/=2;
    }
    for(j=0;j<n;j++){
      if(p[j]==0)continue;
      for(k=0;k<r[j];k++){
	if(p[x[j][k]-1]!=y[j][k])goto NEXT;
      }
    }
    if(m<c)m=c;
  NEXT:;
  }
  printf("%d\n",m);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
std::vector<bool> v(100001,1);
std::vector<int> ans(100001);
std::vector<int> counter(100001);
void sieve()
{
	int p;
	v[1]=0;
	for (int p=2; p*p<=100001; p++)
    {
        if (v[p])
        {
            for (int i=p*2; i<=100001; i += p)
                v[i] = false;
        }
    }
}
int main()
{
	int q,i,j;
	cin>>q;
	sieve();
	counter[0]=0;
	for(i=1;i<=100000;i++){
		counter[i]=counter[i-1];
		if(v[i]==1 && v[(i+1)/2]==1)
			counter[i]++;
	}
	int l,r;
	for (int i = 0; i < q; i++)
	{
		cin>>l>>r;
		cout<<counter[r]-counter[l-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var a = IntStream.range(0, n).map(i -> sc.nextInt()).toArray();
		sc.close();

		var sum = 0;
		var sub = a[0];
		var mod = new Main().new ModCalc(MOD);
		for (var i = 1; i < n; i++) {
			sum = mod.add(sum, mod.multiply(a[i], sub));
			sub = mod.add(sub, a[i]);
		}
		System.out.println(sum);
	}

	public class ModCalc {
		int mod;

		public ModCalc(int mod) {
			this.mod = mod;
		}

		public int add(int a, int b) {
			return (int) (((long) a + b) % mod);
		}

		public int subtract(int a, int b) {
			return (int) (((long) a - b + mod) % mod);
		}

		public int multiply(int a, int b) {
			return (int) (((long) a * b) % mod);
		}

		public int divide(int a, int b) {
			return multiply(a, pow(b, mod - 2));
		}

		public int pow(int n, int k) {
			if (k == 0) {
				return 1;
			} else if (k % 2 == 0) {
				int p = pow(n, k / 2);
				return multiply(p, p);
			} else {
				int p = pow(n, (k - 1) / 2);
				return multiply(multiply(p, p), n);
			}
		}

		public int combine(int n, int k) {
			int sum1 = 1;
			int sum2 = 1;
			for (int i = 0; i < k; i++) {
				sum1 = multiply(sum1, n - i);
				sum2 = multiply(sum2, i + 1);
			}
			return divide(sum1, sum2);
		}
	}
}


Measured memory_bytes: 60368
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){

    double x;
    cin >> x;

    double ans = 0,temp;
    for(double i = 2;i<=x;i++){
        double j = 2;
        while(true){
            
            if(pow(i,j) <= x){
                temp = pow(i,j);
                ans = max(ans,temp);
            }
            else break;
            j += 1;
        }
    }
    if(x == 1) cout << x << endl;
    else cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const ll MOD = 998244353;
const ll INF = 2e9 + 10;
const ll MAX = 1e14 + 10;
const ld EPS = 1e-9;
const int N = 110;
const int M = 1e5 + 10;

ll d[N][M];
ll w[N], c[N];

void solve() {
    int n, k;
    cin >> n >> k;
    fr(i, n)
        cin >> w[i] >> c[i];
//    fr(i, n + 1)
//        fill(d[i], d[i] + k + 1, INF);
//    d[0][0] = 0;
    fr(i, n)
        fr(j, k + 1) {
            d[i + 1][j] = max(d[i + 1][j], d[i][j]);
            if (j + w[i] <= k)
                d[i + 1][j + w[i]] = max(d[i + 1][j + w[i]], d[i][j] + c[i]);
        }
    cout << d[n][k];
}



int main() {
    //freopen("a.in", "r", stdin);
    ios_base::sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 79360
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005



int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int n,k;
        cin >> n >> k;
        int i,j;
        int f[n+1];
        mem(f,0);
        for(i=0; i<k; i++){
            int d;
            cin >> d;
            for(j=0; j<d; j++){
                int x;
                cin >> x;
                f[x]++;
            }
        }
        int ans=0;
        for(i=1; i<=n; i++){
            if(f[i]==0)ans++;
        }
        cout << ans;
        

}

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

int main(){
  int n, r;
  cin >> n >> r;
  if(n<10){
    r+=100*(10-n);
    cout << r << endl;
  }
  else{
    cout << r << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main()
{
	int i=0,n,pt=0,ph=0,cmp;
	char taro[100];
	char hana[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",taro,hana);
		cmp=strcmp(taro,hana);
		if(cmp==0)
		{
			pt++;
			ph++;
		}
		else if(cmp>0)
		{
			pt+=3;
		}
		else if(cmp<0)
		{
			ph+=3;
		}

	}
	printf("%d %d\n",pt,ph);
	return 0;
}

Measured memory_bytes: 604