akhauriyash/Code-Regression huggingface dataset:
//============================================================================
// Name        : aoj0067.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
using namespace std;

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

void dfs(string s[],int y,int x){
	s[y][x] = '0';
	for(int i = 0;i < 4;i++){
		if(0 <= y + dy[i] && y + dy[i] < 12 && 0 <= x + dx[i] && x + dx[i] < 12 && s[y + dy[i]][x + dx[i]] == '1'){
			dfs(s,y + dy[i],x + dx[i]);
		}
	}
}

int main() {
	string str[12];
	int ans;
	while(!cin.eof()){
		for(int i = 0;i < 12;i++){
			getline(cin,str[i]);
		}
		ans = 0;
		for(int i = 0;i < 12;i++){
			for(int j = 0;j < 12;j++){
				if(str[i][j] == '1'){
					dfs(str,i,j);
					ans++;
				}
			}
		}
		cout << ans << endl;
		getline(cin,str[0]);
	}
	return 0;
}

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


int main(){
	int D, N;
	cin  >> D >> N;
	int num;
	if(D==0) num = 1;
	else if(D==1) num = 100;
	else num = 10000;
	if(N==100) N++;
	cout << num * N << endl;


}










Measured memory_bytes: 3612
#include <stdio.h>
int main(void){
    int K,N;
    scanf("%d%d",&K,&N);
    int A[N];
    int i;
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    int MAXlength=K-A[N-1]+A[0],W;
    for(i=0;i<N-1;i++){
        W=A[i+1]-A[i];
        if(MAXlength<W){
            MAXlength=W;
        }
    }
    printf("%d\n",K-MAXlength);
}


Measured memory_bytes: 896
N = int(input())
A = [int(n) for n in input().split()]


print(" ".join([str(a) for a in A]))

# insertionSort
for i in range(1,N):
    v = A[i]
    j = i -1

    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1

    A[j+1] = v

    print(" ".join([str(a) for a in A]))



Measured memory_bytes: 5608
V=int(input())
inf=10**9
cost=[[inf]*V for _ in range(V)]
for i in range(V):
    l=list(map(int,input().split()))
    for j in range(l[1]):
        v,c=l[2*j+2],l[2*j+3]
        cost[i][v]=c
d=[inf]*V
d[0]=0
used=[0]*V

while True:
    v=-1
    for u in range(V):
        if (not used[u] and (v==-1 or d[u]<d[v])):
            v=u
    if v==-1:
        break
    used[v]=1
    for u in range(V):
        d[u]=min(d[u],d[v]+cost[v][u])

for i in range(V):
    print(i,d[i])



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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


  ll n;cin>>n;
  cout<<n*(n-1)/2<<endl;
  
  return 0;
}


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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long A, long long B, long long K) {
  if(A>=K){
    A -= K;
  } else {
    B -= K-A;
    B = max(B,0LL);
    A = 0;
  }
  cout << A << " " << B << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long K;
  scanf("%lld", &K);
  solve(A, B, K);
  return 0;
}


Measured memory_bytes: 3720
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]



if __name__ == "__main__":

    # unionfindを試す

    N, M = map(int,input().split())
    uf = UnionFind(N+1)
    for i in range(M):
        X,Y,Z = map(int,input().split())
        if not uf.isSameGroup(X,Y):
            uf.Unite(X,Y)
    print(sum([1 for i in uf.root[1:N+1] if i <0]))


Measured memory_bytes: 8516
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var result = N;
            for (int i = 1; i < N; i++)
            {
                if (S[i] == S[i - 1]) result--;
            }
            Console.WriteLine(result);
        }
    }
}


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

int main()
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	cout << min({ a * x + b * y, c * 2 * x + b * max(0, y - x), a * max(0, x - y) + c * 2 * y }) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int i,n;
	int A,B;
	int sumA,sumB;

	while(scanf("%d",&n)!=EOF){
		if(n>10000 || n==0) break;
		sumA = 0;
		sumB = 0;
		for(i=0;i<n;i++){

			scanf("%d %d",&A,&B);

			if(A < B){
				sumB += A + B;
			}
			else if(A > B){
				sumA += A + B;
			}
			else {
				sumA += A;
				sumB += B;
			}
		}

		printf("%d %d\n",sumA,sumB);

	}





	return 0;

}

Measured memory_bytes: 600
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val a: MutableList<Int> = mutableListOf()

    for (i in 0..n-1) {
        a.add(cin.nextInt())
    }

    val a_s = a.sorted()
    var now = a_s[0]
    var ok = true
    var count0 = -1
    var val0 = -1
    var count1 = -1
    var val1 = -1
    
    var p = 0

    for (i in a_s) {
        if (i > now) {
            if (count1 >= 0) {
                ok = false
                break
            } else if (count0 >= 0) {
                count1 = p
                val1 = now
            } else {
                count0 = p
                val0 = now
            }
            now = i
        }
        p += 1
    }

    if (0 > count0) {
        count0 = n
    }
    if (0 > count1) {
        count1 = n - count0
    }
    
    if (!ok) {
        println("No")
    } else {
        val k = n / 3
        if (n % 3 == 0) {
            if (count0 % k != 0 || count1 % k != 0) {
                println("No")
            } else {
                if (a_s[k-1] xor a_s[2*k-1] == a_s[3*k-1]) {
                    println("Yes")
                } else {
                    println("No")
                }
            }
        } else if (n % 3 == 1) {
            if (a_s[n-1] == 0) {
                println("Yes")
            } else {
                println("No")
            }
        } else {
            if (a_s[k] == 0 && a_s[k+1] == a_s[n-1]) {
                println("Yes")
            } else {
                println("No")
            }
        }
    }
}

Measured memory_bytes: 59992
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int a, b, c, x, y, m, x1;
    cin >> a >> b >> c >> x >> y;
    if (x > y){
        m = x;
    }else{
        m = y;
    }
    if (m == x) {
        x1 = a;
    }else{
        x1 = b;
    }
    if ((a + b) / 2.0 > c){
        if (x1 > 2 * c){
            cout << 2 * m * c << endl; 
        }else if (m == x){
            cout << (x + y - m) * 2 * c + ((m - (x + y - m)) * a) << endl;
        }else{
            cout << (x + y - m) * 2 * c + ((m - (x + y - m)) * b) << endl;
        }
    }else{
        cout << x * a + y * b << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int MAX=300; //max of width
using BS=bitset<MAX>;
vector<BS> Gauss_Jordan(const vector<BS> &v){
    int n=v.size();
    vector<BS> ret=v;
    int d=0;
    for(int k=0; k<MAX; k++){
        int p=-1;
        for(int i=d; i<n; i++){
            if(ret[i][k]){
                p=i;
                break;
            }
        }
        if(p==-1) continue;
        swap(ret[d], ret[p]);
        for(int i=0; i<n; i++){
            if(i==d) continue;
            if(ret[i][k]) ret[i]^=ret[d];
        }
        d++;
    }
    return ret;
}
int matrix_rank(const vector<BS> &v){
    int n=v.size();
    vector<BS> ret=v;
    int d=0;
    for(int k=0; k<MAX; k++){
        int p=-1;
        for(int i=d; i<n; i++){
            if(ret[i][k]){
                p=i;
                break;
            }
        }
        if(p==-1) continue;
        swap(ret[d], ret[p]);
        for(int i=d+1; i<n; i++){
            if(ret[i][k]) ret[i]^=ret[d];
        }
        d++;
    }
    return d;
}
const ll MOD=998244353;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    vector<BS> v(n, BS(0));
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            int a; scanf("%d", &a);
            v[i][j]=a;
        }
    }
    int r=matrix_rank(v);
    printf("%lld\n", (powmod(2, m+n-1)-powmod(2, m+n-r-1)+MOD)%MOD);
    return 0;
}

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

int main() {
	queue<pair<string, int> > que;
	int n, q;
	cin >> n >> q;
	
	for (int i = 0; i < n; i++) {
		pair<string, int> p;
		cin >> p.first >> p.second;
		que.push(p);
	}

	int sum = 0;
	vector<pair<string, int> > v;
	while (que.size()) {
		pair<string, int> pa = que.front();
		que.pop();

		if (pa.second > q) {
			sum += q;
			pa.second -= q;
			que.push(pa);
		}
		else {
			sum += pa.second;
			pa.second = sum;
			v.push_back(pa);
		}
	}

	for (int i = 0; i < v.size(); i++) {
		cout << v.at(i).first << ' ' << v.at(i).second << endl;
	}
}


Measured memory_bytes: 6904
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K; cin >> K;
  int ans = 0;
  for(int i = 1; i <= K; i++){
    for(int j = 1; j <= K; j++){
      for(int k = 1; k <= K; k++){
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
static const int MAXN = 100000;
static const int MAX = 1000000000;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    rep(i,M){
        cin >> A[i];
        N -= A[i];
    }
    if(N < 0) cout << -1 << endl;
    else cout << N << endl;
    

    return 0;
}

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

class Node:
    def __init__(self, id, k, c):
        self.id = id
        self.k = k
        self.c = c
        self.parent = -1
        self.depth = -1

    def setParent(self, parent):
        self.parent = parent

    def setDepth(self, depth):
        self.depth = depth

    def getId(self):
        return self.id

    def getChildren(self):
        return self.c

    def getParent(self):
        return self.parent

    def getDepth(self):
        return self.depth

    def printInfo(self):
        info = ''
        if self.parent == -1:
            info = 'root'
        elif self.k != 0:
            info = 'internal node'
        else:
            info = 'leaf'
        print("node {}: parent = {}, depth = {}, {}, {}".format(
            self.id, self.parent, self.depth, info, self.c
        ))

nodes = [0] * n

for i in range(n):
    arr = input().split()
    id = int(arr[0])
    k = int(arr[1])
    c = list(map(int, arr[2:]))
    nodes[id] = Node(id, k, c)

for e in nodes:
    for id in e.getChildren():
        nodes[id].setParent(e.getId())

for e in nodes:
    if e.getParent() == -1:
        e.setDepth(0)

for i in range(21):
    for e in nodes:
        if e.getDepth() == i:
            for j in e.getChildren():
                nodes[j].setDepth(i + 1)

for e in nodes:
    e.printInfo()



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

int main() {
	int H,W;
	while(1){
	cin >>H>>W;
	if (H==0 && W==0) break;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout << "#";
		}
		cout << endl;
	
	}
	cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
"""
bitDPというらしい
dp[i][j] = i番目の入力に対して、状態jを実現する最小値
j : 2^12通り。それぞれの宝箱をbitと見立てる
"""

N, M = map(int, input().split())
INF = 10**5+1


dp = [[INF for i in range(2**N+1)] for j in range(1100)]
dp[0][0] = 0

for i in range(M):
    dp[i+1] = [v for v in dp[i]]
    cost,b = map(int, input().split())
    boxes = list(map(int, input().split()))
    status = 0
    for box in boxes:
        status += 2**(box-1)
    for j in range(2**N):
        if dp[i][j] != INF:
            nxt = status | j
            dp[i+1][nxt] = min(dp[i][j] + cost, dp[i][nxt], dp[i+1][nxt])

ans = dp[M][2**N-1]
if ans == INF:
    print(-1)
else:
    print(ans)

# for i in range(M):
#     print(dp[i])

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

int main() {
  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (i == N - 1) {
      cout << "Three";
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
	int n, m;

	while(std::cin >> n >> m, n){
		std::vector<int> v[501], rres, res;

		for(int i=0;i<m;i++){
			int a, b;
			std::cin >> a >> b;
			if(a > b)std::swap(a, b);
			if(a == 1){
				v[1].push_back(b);
				rres.push_back(b);
			}
			else{
				v[a].push_back(b);
				v[b].push_back(a);
			}
		}

		for(int f : v[1]){
			for(int ff : v[f]){
				rres.push_back(ff);
			}
		}

		for(int i : rres){
			if(std::find(res.begin(), res.end(), i) == res.end())
				res.push_back(i);
		}
		std::cout << res.size() << std::endl;
	}
}

Measured memory_bytes: 1372
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  int N;
  cin >> N;
  bool cut[N][N]={};
  int edge=(N*(N-1))/2;
  if(N%2==0) rep(i,N/2) cut[i][N-1-i]=true,edge--;
  else rep(i,N/2) cut[i][N-2-i]=true,edge--;
  cout << edge << endl;
  rep(i,N) rep(j,N) if(cut[i][j]==false && i<j) cout << i+1 << " " << j+1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>>xss(H+2,vector<char>(W+2));
  for(int h=1;h<=H;++h){
    for(int w=1;w<=W;++w){
      cin>>xss[h][w];
    }
  }
  bool failed=false;
  for(int h=1;h<=H;++h){
    for(int w=1;w<=W;++w){
      const vector<pair<int,int>>directions={{0,-1},{0,1},{-1,0},{1,0}};
      if(xss[h][w]=='#'){
        bool found=false;
        for(auto d:directions){
          if(xss[h+d.first][w+d.second]=='#')found=true;
        }
        if(!found)failed=true;
      }
    }
  }
  cout<<(!failed?"Yes":"No")<<endl;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

def gcd(a,b): return a if b==0 else gcd(b,a%b)

L=[0]*(N+1)
R=[0]*(N+1)

for i in range(N-1):
    L[i+1]=gcd(L[i],A[i])
    R[i+1]=gcd(R[i],A[N-i-1])

ans=1
for i in range(1,N+1):
    ans=max(ans,gcd(L[i-1],R[N-i]))
print(ans)


Measured memory_bytes: 14080
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,M,K,res=0;

string S;
int main()
{
    cout << fixed << setprecision(18);
    cin>>S;
    if(S=="ABC"){cout<<"ARC"<<endl;}
    else{cout<<"ABC"<<endl;}
}


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

using namespace std;

#define ll long long

void solve() {
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i += 2) {
		cout << s[i];
	}
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,c,l[8],ans=1e9;
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++)
		cin>>l[i];
	for(int i=0;i<1<<n*2;i++){
		int asum=0,bsum=0,csum=0,anum=0,bnum=0,cnum=0;
		for(int j=0;j<n;j++){
			switch(i>>2*j&3){
			case 1:
				asum+=l[j];
				anum++;
				break;
			case 2:
				bsum+=l[j];
				bnum++;
				break;
			case 3:
				csum+=l[j];
				cnum++;
			}
		}
		if(anum==0||bnum==0||cnum==0)
			continue;
		ans=min(ans,abs(asum-a)+abs(bsum-b)+abs(csum-c)+(anum+bnum+cnum-3)*10);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  int now=x;
  int ans=1;
  while(now%360!=0){
    now+=x;
    ans++;
  }
  cout<<ans<<endl;
  

  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

int N;
int M;
int s[20], c[20];

void solve()
{
	for(int i=0;i<M;++i)for(int j=i;j<M;++j){
		if(s[i] == s[j] && c[i]!=c[j]){
			cout << -1 << '\n';
			return;
		}
	}
	string num(N, '?');
	for(int i=0;i<M;++i) num[s[i]-1] = c[i]+'0';
	if(num[0]=='0'){
		if(N == 1) cout << 0 << '\n';
		else cout << -1 << '\n';
		return;
	}else {
		if(num[0] == '?'){
			if(N==1) num[0] = '0';
			else num[0]='1';
		}
		for(int i=1;i<N;++i)if(num[i]=='?')num[i]='0';
		cout << num << '\n';
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> M;
	for(int i=0;i<M;++i) cin >> s[i] >> c[i];
	solve();
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Alphabetic []string

func (a Alphabetic) Len() int {
	return len(a)
}

func (a Alphabetic) Less(i, j int) bool {
	return a[i] < a[j]
}

func (a Alphabetic) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func main() {
	n := 2 * 100000
	m := make(map[string]int)

	fmt.Scan(&n)

	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		s := scanner.Text()
		if _, ok := m[s]; ok {
			m[s]++
		} else {
			m[s] = 1
		}
	}

	maxCount := 0
	result := []string{}
	for k, v := range m {
		if maxCount > v {
			continue
		}

		if maxCount == v {
			result = append(result, k)
		} else {
			maxCount = v
			result = []string{k}
		}
	}

	sort.Sort(Alphabetic(result))
	for _, s := range result {
		fmt.Println(s)
	}
}


Measured memory_bytes: 30720
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, P[20], ANS = 0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> P[i];
	for (int i = 0; i < N - 2; i++) {
		if ((P[i + 1] - P[i]) * (P[i + 2] - P[i + 1]) > 0) ANS++;
	}
	cout << ANS;
}

Measured memory_bytes: 764
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i,N)cin >> A[i];
  int sum = 0;
  rep(i,N){
    sum += A[i];
  }
  int ans = 0;
  rep(i,N){
    if(A[i]*4*M >= sum)ans++;
  }
  if(ans>=M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}


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

int abs(int x){
  if (x>=0) return x;
  else return -x;
}

int main(void){
  int n,k,i,j,h[100000],dp[100000],min,t;
  cin >> n >> k;
  for (i=0;i<n;i++) cin >> h[i];
  dp[0]=0;
  for (i=1;i<n;i++){
    min=1000000000;
    for (j=i-k;j<i;j++){
      if (j>=0){
        t=dp[j]+abs(h[i]-h[j]);
        if (min>t) min=t;
      }
    }
    dp[i]=min;
  }
  cout << dp[n-1] << '\n';
  return 0;
}

Measured memory_bytes: 1024
<?php
  list($x, $n) = explode(" ", trim(fgets(STDIN)));
  if($n == 0){
    echo $x;
  } else {
    $arr = explode(" ", trim(fgets(STDIN)));
    $tmp = 100;
    $ans = 0;
    for($i = 0; $x + $i <= 101; $i++){
      if(!in_array($x + $i, $arr)){
        $tmp = $i;
        $ans = $x + $i;
        break;
      }
    }
    for($i = 0; $x - $i >= 0; $i++){
      if(!in_array($x - $i, $arr)){
        $ans = $x - $i;
        break;
      } else if($tmp <= $i){
        break;
      }
    }
    echo $ans;
  }
?>

Measured memory_bytes: 16184
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }

// }}}
const int MAX_N = 100005;
int n, m;
LL in[MAX_N], dp[MAX_N];
vector<int> adj[MAX_N];

void input() {
    RI(n, m);
    REP(i, m) {
        int a, b;
        RI(a,b);
        a--; b--;
        adj[a].PB(b);
        in[b]++;
    }
}

LL dfs(int u) {
    if(adj[u].size()==0) return 0;
    if(dp[u]) return dp[u];
    LL cnt = 0;
    for(auto v:adj[u]) {
        cnt = max(cnt, dfs(v));
    }
    dp[u] = cnt + 1;
    return dp[u];
}

void solve() {
    vector<int> root;
    LL ans = 0;
    REP(i, n) if(in[i]==0) root.PB(i);
    for(auto i:root) {
        ans = max(ans, dfs(i));
    }
    printf("%lld\n", ans);
}

int main( int argc, char *argv[] ) {
    input();
    solve();
    return 0;
}


Measured memory_bytes: 11904
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        long mon = 100;
        long year = 1;
        while ((mon += mon * 0.01) < X) {
            year++;
        }
        System.out.println(year);
    }
}

Measured memory_bytes: 35720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,d;
int cnt[1005][1005];
vector<int>forbid[1005];
bool a[1005],b[1005];
int par[1005],ran[1005];
void init(){ for(int i=0;i<1005;i++) par[i] = i, ran[i]  = 0; }
int find(int x){ if(x == par[x]) return x; else return par[x] = find(par[x]); }
void unite(int x,int y){
	x = find(x); y = find(y); if(x==y) return;
	if(ran[x] < ran[y]) par[x] = y;
	else{
		par[y] = x;
		if(ran[x] == ran[y]) ran[x]++;
	}
}
bool same(int x,int y){ return find(x)==find(y); }
int main(){
	scanf("%d%d",&n,&d);
	rep(i,n){
		int x,y; scanf("%d%d",&x,&y);
		cnt[x%d][y%d]++;
	}
	int mx = 0;
	rep(i,d)rep(j,d) mx=max(mx,cnt[i][j]);
	
	ll lb = 0,ub = 1000;
	//(lb,ub]
	while(ub-lb>1){
		ll mid = (lb+ub)/2;
		if(mid*mid >= mx) ub = mid;
		else lb = mid;
	}
	//1辺ub*ubあれば十分
	if(d == 1){
		cout << ub-1 << endl;
		return 0;
	}
	//どこまで減らせるか
	rep(i,d)rep(j,d){
		if(ub*(ub-1) < cnt[i][j]){
			a[i] = 1;
			b[j] = 1;
		}
		else if((ub-1)*(ub-1) < cnt[i][j]){
			forbid[i].pb(j);
		}
	}
	int mxx = 0;
	rep(beg,d){
		//いくついけるか、[lb,ub)
		int lb = 0,ub = d;
		while(ub-lb>1){
			int mid = (lb+ub)/2;
			bool ok[1005]={};
			for(int j=0;j<d;j++) ok[j] = b[j];
			int cnt = mid;
			int nw = beg;
			int fail = 0;
			while(cnt--){
				if(a[nw]){
					fail = 1; break;
				}
				rep(h,forbid[nw].size()) ok[forbid[nw][h]] = 1;
				nw = (nw+1)%d;
			}
			if(fail){
				ub = mid; continue;
			}
			init();
			for(int i=0;i<d;i++){
				int j = (i+1)%d;
				if(!ok[i] && !ok[j]) unite(i,j);
			}
			int sz[1005]={};
			for(int i=0;i<d;i++){
				if(ok[i]) continue;
				sz[find(i)]++;
			}
			int MX = 0;
			rep(i,d) MX = max(MX,sz[i]);
			if(MX >= mid){
				lb = mid;
			}
			else{
				ub = mid;
			}
		}
		mxx = max(mxx,lb);
	}
	cout << ub*d-1-mxx << endl;
}

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

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int a[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
		int b[] = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 };
		int c[] = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 };

		long value[] = new long[5];

		for (int i = 0; i < n; i++) {
			String str[] = br.readLine().split("");

			if (str[0].equals("M")) {
				value[0]++;
			} else if (str[0].equals("A")) {
				value[1]++;
			} else if (str[0].equals("R")) {
				value[2]++;
			} else if (str[0].equals("C")) {
				value[3]++;
			} else if (str[0].equals("H")) {
				value[4]++;
			}
		}

		long ans = 0;
		for (int i = 0; i < 10; i++) {
			ans += value[a[i]] * value[b[i]] * value[c[i]];
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 65132
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	int n, a;
	map<int, int> mem[2];
	cin >> n;

	rep(i, n) {
		cin >> a;
		if (i % 2 == 1) mem[0][a]++;
		else mem[1][a]++;
	}

	vector<pair<int, int>> p[2];
	for (int i = 0; i < 2; ++i) {
		for (auto x : mem[i]) {
			p[i].push_back(make_pair(x.second, x.first));
		}
	}

	sort(p[0].rbegin(), p[0].rend());
	sort(p[1].rbegin(), p[1].rend());

	int o1 = p[0][0].first;
	int o2 = p[0][1].first;
	int e1 = p[1][0].first;
	int e2 = p[1][1].first;

	if (p[1][0].second == p[0][0].second) {
		cout << min(n - e1 - o2, n - e2 - o1) << endl;
	} else {
		cout << n - e1 - o1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int, int> pii;
// #define INF __INT32_MAX__
#define INF 1e9
#define LINF __LONG_LONG_MAX__

int main() {
    int N; cin >> N;
    vi A(N); rep(i, N) cin >> A[i];

    int res = -1;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            res = max(res, abs(A[i] - A[j]));
        }
    }

    cout << res << endl;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    vector<long double> v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    vector<long double> expVal(n);
    for(int i=0; i<n; i++){
        //cout<<v[i]<<" ";
        long double sum = (v[i]*(v[i]+1))/(2.0);
        //cout<<sum<<endl;
        expVal[i] = sum/v[i];
        //cout<<expVal[i]<<endl;
    }

    long double maxi = -1;
    long double currSum = 0;
    for(int i=0; i<k; i++){
        currSum = currSum + expVal[i];
    }

    maxi = currSum;
    //cout<<currSum<<endl;

    int i=0,j=k;
    while(j<n){
        currSum = currSum + expVal[j];
        currSum = currSum - expVal[i];
        j++;
        i++;
        maxi = max(currSum, maxi);
    }

    cout<<std::fixed;
    cout<<std::setprecision(12);

    cout<<maxi<<endl;


}


Measured memory_bytes: 6528
N = int(input())
T = input().split()
M = int(input())
P = [0] * M
X = [0] * M

for i in range(M):
    p, x = map(int, input().split())
    P[i], X[i] = p, x

solve_without = 0
solve_without = sum(int(T[a]) for a in range(N))

for ii in range(M):
    solve_with = solve_without - int(T[P[ii] - 1]) + X[ii]
    print(solve_with)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <tuple>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.push_back({x, i + 1});
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    cout << a[i].second << ' ';
  }
  cout << '\n';
  return 0;
}



Measured memory_bytes: 1780
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2 vector<vec>
#define vecll2 vector<vecll>
#define vec3 vector<vec2d>
#define vecll3 vector<vecll2d>
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(vector<T> v){for(T e:v)cout<<e<<" ";cout<<endl;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}

const int N=1e5+10;
ll a[N<<4];
int sum[11];
main(){
    ios
    int h,w,n;scanf("%d%d%d",&h,&w,&n);
    h-=2,w-=2;
    int x;int y;
    int cnt=0;
    ll m=(ll)h*w;
    rep(iii,n){
        scanf("%d%d",&x,&y);
        rep(i,3)if( x-i>=1 && x-i<=h){
            rep(j,3)if(y-j>=1 && y-j<=w){
            a[cnt++]=((ll)(x-i)<<32)+(y-j);
            }
        }
    }
    sort(a,a+cnt);
    ll t=1;
    rep(i,cnt){
        if(a[i]==a[i+1])t++;
        else sum[t]++,t=1,m--;
    }
    cout<<m<<" ";
    rep2(i,1,9)cout<<sum[i]<<" ";
}



Measured memory_bytes: 8448
a =list(input())


def saisyo1(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != "1":
            count += 1
    for i in guusuu:
        if i != "0":
            count += 1
    return count

def saisyo0(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != "0":
            count += 1
    for i in guusuu:
        if i != "1":
            count += 1
    return count

def main():
    print(min(saisyo0(a),saisyo1(a)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4652
import java.util.Scanner;

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

    //input
    String s = sc.next();
    String t = sc.next();

    //output
    int sum = 0;
    for(int i = 0; i < s.length(); i++){
      if( !(s.charAt(i) == t.charAt(i)) ){
        sum++;
      }
    }
    System.out.println(sum);

  }
}


Measured memory_bytes: 32188
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    vector<size_t> h(n, 0);
    for (size_t i = 0; i < n; ++i)
        cin >> h[i];
    for (size_t i = 1; i + 1< n; ++i) {
        auto& a = h[n - i];
        auto& b = h[n - i - 1];
        if (a < b)
            --b;
        if (a < b) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

int main(void){
	char n[3];
	scanf("%s",n);
	rep(i,3){
		if(n[i]=='1') n[i]='9';
		else if(n[i]=='9') n[i]='1';
	}
	printf("%s",n);
	return 0;

}

Measured memory_bytes: 128
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
ll GetDigit(ll num){ 
    ll digit=0; 
    while(num!=0){num/=10;digit++;} 
    return digit; 
} 


using namespace std;
//-------------------------------------------
int main(void){
    string S;cin>>S;bool f=true;
    REP(i,S.size()){
        if(S[i]=='U'||S[i]=='D')continue;
        if(i%2==0&&S[i]=='R')continue;
        if(i%2==1&&S[i]=='L')continue;
        f=false;break;
    }
    ifYN(f);
}

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

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    int x, a;
    cin >> x >> a;

    printf("%d", x < a ? 0 : 10);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int main(int argc, char const *argv[])
{
	int n,h,w;
	cin>>n>>h>>w;
	cout<<(n - h + 1) * (n - w + 1)<<endl;
	return 0;
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (X, A) = get!(u8, u8);
    if (X < A) {
        println!("0");
    } else {
        println!("10");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<unordered_map>
#include<cstdio>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;

signed main() {
	int a, b; scanf("%d%d", &a, &b);
	cout << (a + b) % 24 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int max(int a,int b){
	return (a>b)?a:b;
}

int pow(int a,int p){
	if(p==1)return a;
	if(p%2)return a*pow(a,p-1);
	else return pow(a*a,p/2);
}

int main(){
	int a,b,c,ans,k,m;
	cin>>a>>b>>c>>k;
	m=max(a,max(b,c));
	if(m==a)ans=pow(2,k)*a+b+c;
	if(m==b)ans=pow(2,k)*b+a+c;
	if(m==c)ans=pow(2,k)*c+a+b;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys

s = input()
text1 = 'R U D'
text2 = 'L U D'

for i, num in enumerate(s):
  if(i % 2 == 0):
    if(num in text1):
      continue
    else:
      print('No')
      sys.exit()
  else:
    if(num in text2):
      continue
    else:
      print('No')
      sys.exit()

print('Yes')


Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, K: int):
    if K <= A:
        print(K)
    elif A < K <= A+B:
        print(A)
    elif A+B < K:
        print(A-(K-A-B))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        s: [String; n],
    }

    let mut a = 0;
    let mut w = 0;
    let mut t = 0;
    let mut r = 0;
    for s in s {
        match &s[..] {
            "AC" => a += 1,
            "WA" => w += 1,
            "TLE" => t += 1,
            "RE" => r += 1,
            _ => {}
        }
    }
    println!("AC x {}", a);
    println!("WA x {}", w);
    println!("TLE x {}", t);
    println!("RE x {}", r);
}


Measured memory_bytes: 7804
cards = {
	'S':[0 for _ in range(13)],
	'H':[0 for _ in range(13)],
	'C':[0 for _ in range(13)],
	'D':[0 for _ in range(13)],
}
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    cards[s][int(r) - 1] = 1

for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print(s, r + 1)

Measured memory_bytes: 6720