akhauriyash/Code-Regression huggingface dataset:
// 再帰関数を利用して整数n個の和でsを作れたら１を返す
// 出来ないときは０を返す


#include <iostream>
 
using namespace std;

int rec( int s , int n , int num ){

  if( s < 0 )return 0;                    //整数n個の和でsを作ることは不可能
  if( s == 0 && n == 0 )return 1;         //整数n個の和でsを作ることが出来た
                                          //この問題は数の順番を考慮しなくて
                                          //いいからiに num + 1を入れてよい  
  int ans = 0;
  for( int i = num + 1 ;  i < 10 ; i++ ){ //同じ数字は使えない
    ans += rec( s - i , n - 1 , i );
  }
  return ans;
}


int main(void){

  while(1){

  int n;  int s;
  cin >> n >> s;
  if( n == s && s == 0 )break;

  cout << rec( s, n , -1 ) << endl;

  }
 return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,x,y,z;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	y=a+b+c+d;
	x=a;
	if(b<x){
			x=b;
	}
	if(c<x){
			x=c;
	}
	if(d<x){
			x=d;
	}
	z=y-x;
	if(e<f) printf("%d\n",f+z);
	else 	printf("%d\n",e+z);
	return 0;
}


Measured memory_bytes: 2752
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <cstring>
using namespace std;

typedef long long ll;

int main() {
  int n;
  while (true) {
    scanf("%d", &n);
    if (n == 0) break;
    int tx[n], ty[n], bx[n], by[n];
    set <int> xy;
    for (int i = 0; i < n; i++) {
      scanf("%d %d %d %d", &tx[i], &ty[i], &bx[i], &by[i]);
      xy.insert(tx[i]);
      xy.insert(ty[i]);
      xy.insert(bx[i]);
      xy.insert(by[i]);
    }

    map <int, int> index;
    int cnt = 1;
    for (set <int>::iterator it = xy.begin(); it != xy.end(); it++, cnt++) {
      index[*it] = cnt;
    }
    ll field[cnt][cnt];
    memset(field, 0, sizeof(field));
    ll p = 1;
    for (int i = 0; i < n; i++) {
      for (int y = index[by[i]]; y < index[ty[i]]; y++) {
	for (int x = index[tx[i]]; x < index[bx[i]]; x++) {
	  field[x][y] |= p;
	}
      }
      p <<= 1;
    }

    int ans = 0;
    for (int i = 0; i < cnt; i++) {
      for (int j = 0; j < cnt; j++) {
	if (field[j][i] != -1) {
	  ans++;
	  ll ch = field[j][i];
	  int dx[] = {1, -1, 0, 0};
	  int dy[] = {0, 0, -1, 1};
	  stack <pair<int, int> > st;
	  st.push({j, i});
	  while (!st.empty()) {
	    pair<int, int> pos = st.top(); st.pop();
	    field[pos.first][pos.second] = -1;

	    for (int k = 0; k < 4; k++) {
	      pair<int, int> np = {pos.first+dx[k], pos.second+dy[k]};

	      if (np.first >= 0 && np.second >= 0 && np.first < cnt && np.second < cnt) {
		if (ch == field[np.first][np.second]) {
		  st.push(np);
		}
	      }
	    }
	  }
	}
      }
    }

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

Measured memory_bytes: 1616
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    #n = int(input())
    k = int(input())
    if k == 7:
        print(1)
        continue
    if k % 7 == 0:
        k = k // 7
    cur = 0
    start = 0
    found = False
    for i in range(8*10**6):
        start = (10*start + 1) % k
        if start == 0:
            found = i+1
            break
    print(-1 if not found else found)

Measured memory_bytes: 64452
import java.util.Scanner;
import java.util.Arrays;

public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] line=new String[n];
		char s[][]=new char[n][10];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray();
			Arrays.sort(s[i]);
		}

		for(int i=0;i<n;i++){
			line[i]=String.valueOf(s[i]);
		}

		int count=0;
		long usagi=0;


		Arrays.sort(line);


		for(int i=0;i<n-1;i++){
			if(line[i].equals(line[i+1])){
				count++;
				usagi+=count;
			}else{
				count=0;
			}
		}


		System.out.println(usagi);

	}
}


Measured memory_bytes: 57384
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
using namespace std;
static const int64_t INF = 1e18;
int main() {
    int A, B, Q;
    cin >> A >> B >> Q;
    deque<int64_t> s(A), t(B), x(Q);
    for (auto& i : s) cin >> i;
    for (auto& i : t) cin >>i;
    s.push_back(INF);
    s.push_front(-INF);
    t.push_back(INF);
    t.push_front(-INF);
    for (auto& i : x) {
        cin >> i;
        auto b = lower_bound(s.begin(), s.end(), i);
        auto d = lower_bound(t.begin(), t.end(), i);
        auto ans = INF;
        for (auto j : {*(b - 1), *b}) {
            for (auto k : {*(d - 1), *d}) {
                auto m = min(abs(j - i) + abs(k - j), abs(k - i) + abs(j - k));
                if (m < ans) ans = m;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

int main(int argc,char *argv[])
{
	int n,m,c;
	std::cin >> n >> m >> c;

	std::vector<int> b(m,0);
	for(int i = 0;i < m;++i) std::cin >> b[i];

	std::vector<int> a(n*m,0);
	for(int i = 0;i < n*m;++i) std::cin >> a[i];
	
	int ans = 0;
	for(int i = 0;i < n;++i)
	{
		int tmp = c;
		for(int j = 0;j < m;++j) tmp += b[j]*a[i*m+j];
		if(tmp > 0) ++ans;
	}

	std::cout << ans << std::endl;

	return 0;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

/* 
 * * stuff you should look for
 * * int overflow, array bounds
 * * special cases (n=1?), set tle
 * */

const int N = 1e4 + 4;
const int MOD = 1e9 + 7;

ll a[N];
int n;

ll lcm(){
    map<int, int> lcm_pw;
    for(int i = 0; i < n; i++){
        int k = a[i];
        map<int, int> pw;
        for(int j = 2; j * j <= a[i]; j++){
            while(k % j == 0){
                k /= j;
                pw[j]++;
            }
        }
        if(k > 1) pw[k]++;
        for(auto p : pw){
            if(lcm_pw.count(p.fi)) lcm_pw[p.fi] = max(lcm_pw[p.fi], p.se);
            else lcm_pw[p.fi] = p.se;
        }
    }

    ll prod = 1;
    for(auto p : lcm_pw){
        for(int k = 0; k < p.se; k++) prod = ((prod % MOD) * (p.fi % MOD)) % MOD;
    }

    return prod;
}

ll fastp(ll a, ll p){
    if(p == 1) return a % MOD;
    if(p&1) return ((a % MOD) * (fastp(a, p-1) % MOD)) % MOD;
    ll x = p / 2;
    ll t = fastp(a, x);
    return ((t % MOD) * (t % MOD)) % MOD;
}

int main(){
    fcin;

    cin >> n;

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

    ll l = lcm();
    ll ans = 0;

    for(int i = 0; i < n; i++){
        ll inv = fastp(a[i], MOD - 2LL);
        ll p = ((inv % MOD) * (l % MOD));
        p %= MOD;
        ans += p;
        ans %= MOD;
    }

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



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

const int MAX_M = 200000;

struct pair_hash {
	template <typename T1, typename T2>
	std::size_t operator()(const std::pair<T1, T2> &pair) const {
		return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
	}
};

int main() {
	int N, M;
	std::unordered_set<std::pair<int, int>, pair_hash> us;

	std::cin >> N >> M;
	for(int i = 0; i < M; ++i) {
		int a, b;
		std::cin >> a >> b;
		us.insert(std::make_pair(a, b));
	}

	for(int i = 2; i < N; ++i) {
		if(us.count(std::make_pair(1, i)) and us.count(std::make_pair(i, N))) {
			std::cout << "POSSIBLE" << std::endl;
			return 0;
		}
	}
	std::cout << "IMPOSSIBLE" << std::endl;
}


Measured memory_bytes: 8520
#include <iostream>
using namespace std;
int main(void){
    int n, h[100000];
    bool flg = true;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    for(int i=n-2;i>=0;i--){
        if(h[i] > h[i+1]){
            h[i]--;
        }
        if(h[i] > h[i+1]){
            flg = false;
        }
    }
    if(flg)puts("Yes");
    else puts("No");
}


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

signed main () {
    int n, x;
    cin >> n;
    map < int64_t, int > cnt;
    ++cnt[0];
    int64_t ans = 0, p = 0;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        p += x;
        ans += cnt[p];
        ++cnt[p];
    }
    cout << ans << '\n';
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i <= b;i++)
#define fast_io ios_base::sync_with_stdio(false)
#define pb push_back
#define fir first
#define sec second
#define tr(it,x) for(it = x.begin();it != x.end();it++)
#define mp make_pair
#define sz(x) (ll)x.size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define double long double
#define accuracy ll precision = numeric_limits<double>::digits10
#define pll pair<ll,ll>
#define N 3005

ll n,a[N],dp[N][N][2];

int main() {
	// freopen("input.txt", "r", stdin); 
	// freopen("output.txt", "w", stdout);
	fast_io;	 
	accuracy;
	cin >> n;
	fr(i,1,n) cin >> a[i];
	fr(i,1,n) {
		dp[i][i][0] = a[i];
		dp[i][i][1] = -a[i];
	}
	fr(i,2,n) {
		fr(sta,1,n) {
			ll en = sta + i - 1;
			if(en <= n) {
				dp[sta][en][0] = max(a[sta] + dp[sta+1][en][1],a[en] + dp[sta][en-1][1]);
				dp[sta][en][1] = min(-a[sta] + dp[sta+1][en][0],-a[en] + dp[sta][en-1][0]);
			}
		}
	}
	cout << dp[1][n][0] << endl;
}

Measured memory_bytes: 139648
#include <bits/stdc++.h>
    #pragma gcc optimize("ofast")
    using namespace std;

    #define ll long long //data types used often, but you don't want to type them time by time
    #define ull unsigned long long
    #define ui unsigned int
    #define mod 998244353
    #define us unsigned short
    #define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
    #define INF LONG_MAX
    #define PI 3.1415926535897932384626
    #define mp make_pair
    #define fi first
    #define se second
    #define pb push_back
    #define rep(x,j,n)for(int x=j;x<n;x++)
    typedef vector<pair<ll,ll>> vpi;
    typedef vector<ll> vi;
    typedef vector<vi> vvi;

    ll modexp(ll a,ll b,ll m)
    {
        ll r=1;
        a=a%m;
        while(b>0)
        {
            if(b&1)
                r=(r*a)%m;
            b>>1;
            a=(a*a)%m;
        }
        return r%m;
    }


    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);cout.tie(0);
        long double a,b,c; cin>>a>>b>>c;
        long double x = c-a-b;
        x-=(2.0)*sqrt(a*b);
        //cout<<x<<endl;
        if(x<=0)cout<<"No\n";
        else cout<<"Yes\n";
        return 0;
    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
    int a ,b ,c ,k ,t1 ,t2,ans ,i;
    scanf("%d%d%d%d",&a,&b,&c,&k);
    t1 = b+c;
    t2 = a;
    for(i = 0 ; i< k; i++)
        t2 *= 2;
    ans = t1+t2;
    t1 = a+c;
    t2 = b;
    for(i = 0; i < k ;i++)
        t2 *= 2;
    if(ans < t1+t2)
        ans = t1+t2;
    t1 = a+b ;
    t2 = c;
    for(i = 0; i < k ;i++)
        t2 *= 2;
    if(ans < t1+t2)
        ans = t1+t2;
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(int n, vector<long long> a1, vector<long long> a2) {
    long long ret = 0;
    for (int i = 0; i < n; i++) {
        long long s1 = 0;
        for (int j = 0; j < i+1; j++) {
            s1 += a1[j];
        }
        long long s2 = 0;
        for (int j = n-1; j > i-1; j--) {
            s2 += a2[j];
        }
        if (ret < s1+s2) {
            ret = s1+s2;
        }
    }
    std::cout << ret << std::endl;

}

int main() {
    struct timeval start,end;
    long long span;
    int n;

    gettimeofday(&start,NULL);

    std::cin >> n;
    vector<long long> a1(n);
    vector<long long> a2(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a1[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> a2[i];
    }
    solve(n, a1, a2);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int n,maximum,minimum,sum,a,b,c,d,e;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		maximum = -1;
		minimum = 1000000000;

		for(int loop = 0; loop < n; loop++){
			scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
			sum = a + b + c + d + e;
			maximum = max(maximum,sum);
			minimum = min(minimum,sum);
		}

		printf("%d %d\n",maximum,minimum);

	}

	return 0;
}

Measured memory_bytes: 2592
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var cin = ReadLine().Split().Select(x => int.Parse(x)).ToList();
        var a = cin[0];
        var b = cin[1];
        var c = cin[2];
        var k = cin[3];

        var ans = Math.Min(a, k);
        if (k > a + b)
            ans -= k - (a + b);

        WriteLine(ans);
    }
}

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

const int maxn = 1e5+1000;
typedef long long LL;
struct Node
{
    int r,c;
    Node(int r = 0,int c = 0):r(r),c(c) {}
    bool operator < (const Node& rhs) const{
        return r < rhs.r || (r == rhs.r && c < rhs.c);
    }
    bool operator == (const Node& rhs) const{
        return (r == rhs.r) && c == rhs.c;
    }
};


map<Node,int> cnt;
int R,C,n;

vector<Node> V[20];
Node save[maxn];

int main()
{
   // freopen("./test.txt","r",stdin);
    scanf("%d %d %d",&R,&C,&n);


    for(int i = 1;i <= n;++i)
    {
        int r,c;
        scanf("%d %d",&r,&c);
        save[i] = Node(r,c);
        cnt[save[i]]++;
    }

    LL sum = (LL)(R-2)*(C-2);

    for(int i = 1;i <= n;++i)
    {
        int nowr = save[i].r;
        int nowc = save[i].c;
        for(int r1 = nowr-2;r1 <= nowr;++r1)
            for(int c1 = nowc-2;c1 <= nowc;++c1)
                if(r1 >= 1 && r1 <= R && c1 >= 1 && c1 <= C)
                {
                    int r2 = r1+2;
                    int c2 = c1+2;
                    if(r2 >= 1 && r2 <= R && c2 >= 1 && c2 <= C)
                    {
                        int t = 0;
                        for(int i = r1;i <= r2;++i)
                            for(int j = c1;j <= c2;++j)
                                t += cnt[Node(i,j)];
                        if(t >= 1 && t <= 9)
                            V[t].push_back(Node(r1,c1));

                        if(t)
                            V[0].push_back(Node(r1,c1));

                    }
                }
    }

    sort(V[0].begin(),V[0].end());
    LL del = unique(V[0].begin(),V[0].end())-V[0].begin();

    printf("%lld\n",sum-del);

    for(int i = 1;i <= 9;++i)
    {
        sort(V[i].begin(),V[i].end());
        int res = unique(V[i].begin(),V[i].end())-V[i].begin();
        printf("%d\n",res);
    }
    return 0;
}


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

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

  ll n;
  cin >> n;
  vector<ll> v(n);
  ll all_xor = 0;
  for (ll i = 0; i < n; i++)
  {
    cin >> v.at(i);
    all_xor = all_xor xor v.at(i);
  }
  
  vector<ll> v_ans(n);
  for (int i = 0; i < n; i++)
  {
    v_ans.at(i) = all_xor xor v.at(i);
  }
  
  for (int i = 0; i < n; i++)
  {
    if(i) cout << " ";
    cout << v_ans.at(i);
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 6280
S = input()

def d2n(d, n, p):
    x = '' # Output
    while d > 0:
        x = str(d % n) + x
        d = int(d / n)
    return x.zfill(p)

def compute(b):
    s = S[:]
    ptr = 1
    for i in range(len(S)-1):
        if b[i] == "1":
            s = s[:ptr] + "+" + s[ptr:]
            ptr += 1 # "+"を入れた分進める
        ptr += 1
    return eval(s)

ans = 0
# 2進数に変換した時、1になっているところに"+"を入れる
cnt = 0
while cnt < 2 ** (len(S) - 1):
    b = d2n(cnt, 2, len(S)-1)
    ans += compute(b)
    cnt += 1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(a<c)
		a=c;
	if(b>d)
		b=d;
    if(b<a)
        b=a;
	cout << b-a << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int x, y, i = 0;
    while (true) {
        cin >> x >> y;
        if (!x && !y) break;
        if (x > y) {
            x ^= y;
            y ^= x;
            x ^= y;
        }
        cout << x << ' ' << y << endl;
    }
    return 0;
}


Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
main () {
  string S;
  cin >> S;
  int q = S.size();
  string A = "Yes";
  for(int i = 0; i < q; i++) {
    if(i % 2 == 0) {
      if(S.at(i) == 'L') {
        A = "No";
      }
    }
    else{
    if(i % 2 == 1) {
      if(S.at(i) == 'R') {
        A = "No";
      }
    }
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>

using namespace std;
typedef long long ll;


int main(){
        ll H, W;
        cin >> H >> W;
        ll Count = 0;
        vector<vector<ll>> M(H, vector<ll>(W));
        vector<ll> S;
        for(ll i=0; i<H; i++){
                for(ll k=0; k<W; k++){
                        cin >> M[i][k];
                }
        }
        for(ll i=0; i<H; i++){
                for(ll k=0; k<W-1; k++)
                        if(M[i][k]%2==1){
                                Count++;
                                M[i][k+1] += 1;
                                S.push_back(i+1);
                                S.push_back(k+1);
                                S.push_back(i+1);
                                S.push_back(k+2);
                        }
                }

        for(ll i=0; i<H-1; i++){
                if(M[i][W-1]%2==1){
                        Count++;
                        M[i+1][W-1] += 1;
                        S.push_back(i+1);
                        S.push_back(W);
                        S.push_back(i+2);
                        S.push_back(W);
                }
        }
        cout << Count;
        for(ll i=0; i<S.size(); i++){
                if(i%4==0){
                        cout << endl;
                }
                if(i%4!=3)cout << S[i] << " ";
                else cout << S[i];
        }
}


Measured memory_bytes: 8432
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        long n = sc.nextLong() + sc.nextLong();
        if(n % 2 == 1) {
            pw.println("IMPOSSIBLE");
        }
        else pw.println(n / 2);

        pw.close();
    }
}


Measured memory_bytes: 22228
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c, d = rm()
max_ = max(a, c)
min_ = min(b, d)
print(max(0, min_ - max_))








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

int main()
{
    int a,b;
    cin >> a >> b;

    if (a >= 13){
        cout << b << endl;
    } else if(a <= 5){
        cout << "0" << endl;
    } else {
        cout << b / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a_li = list(map(int,input().split()))

if 0 in a_li:
  print(0)
else:
  result = a_li[0]
  for i in range(1,n):
    result = result * a_li[i]
  
    if result > 10 ** 18:
      print(-1)
      break
    
  else:
    print(result)

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

int main(){
  int N;
  cin>>N;
  int d[N];
  for (int i=0;i<N;i++){
    cin>>d[i];
  }
  sort(d,d+N);
  //cout<<d[(N-1)/2+1]<<" "<<d[(N-1)/2]<<endl;
  if (d[(N-1)/2+1]-d[(N-1)/2]>=1){
    cout<<d[(N-1)/2+1]-d[(N-1)/2]<<endl;
    return 0;
  }
  cout<<0<<endl;
  //cout<<"***"<<endl;

  return 0;
}

    
      
  
  

Measured memory_bytes: 640
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
int main()
{
	string s;
	getline(cin,s);
	stack<int>st;
	int num, a, b;
	stringstream ss(s);
	while(true){
		string foo;ss>>foo;
		if(!ss)break;
		if(foo == "+"){
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(a + b);
		}else if(foo == "-"){
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(b - a);
		}else if(foo == "*"){
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(a * b);
		}else{
			istringstream iss(foo);
			iss >> num;
			st.push(num);
		}
	}
	cout<<st.top()<<endl;
	return 0;
}

		
	
	


Measured memory_bytes: 3180
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};
//greater<pair<int,int> , greater<int>>
ll a[M];


int main() {
	fastIO;
	int test = 1;
	//cin >> test;
	while (test--) {
		string s;
		cin >> s;
		ll sum = 0;
		for (int i = 0; i < s.length(); i++) {
			sum += s[i] - 48;
		}
		if (sum % 9 == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}




	return 0;

}


Measured memory_bytes: 3688
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

/*bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}*/
/*ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/
/*ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}*/
/*ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}*/
/*ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}*/
//printf("%.10f\n", n);

ll test[12345678];
signed main() {
	string s, t;
	ll n, m, k, a = 1000, z = 0, cnt = INF, ma = 0;
	cin >> n;
	rep(i, n) {
		cin >> test[i];
		if (i != 0) {
			if (test[i - 1] > test[i]) {
				if (z == 0) { cnt = test[i]; }
				else {
					ll kabu = a / cnt;
					a %= cnt;
					a += kabu * ma;
					cnt = test[i]; ma = 0;
					z = 0;
				}
			}
			else {
				ma = max(ma, test[i]);
				z = 1;
			}
		}
		else { cnt = test[i]; }
		//cout << a << endl;
	}
	if (z == 1) {
		ll kabu = a / cnt;
		a %= cnt;
		a += kabu * ma;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define N 3005
#define ll long long
ll dp[N][N], n, arr[N];

ll cal(int i, int j)
{
    if(j < i) return 0;
    if(dp[i][j] != -1) return -dp[i][j];
    dp[i][j] = max(arr[i] + cal(i + 1, j), arr[j] + cal(i, j - 1));
    return -dp[i][j];
}



int main()
{
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> arr[i];
    cout << -cal(1, n) << endl;
}


Measured memory_bytes: 71040
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//#define int long long  ←保留
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

/*signed*/int main() {
    int n, ans = 0;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p.at(i);
    rep(i, n - 2) ans += int(min(p.at(i), p.at(i + 2)) < p.at(i + 1) and p.at(i + 1) < max(p.at(i), p.at(i + 2)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, K = map(int, input().split())
grid = [[c for c in input()[:-1]] for _ in range(H)]

first_col = -1
for col in range(H):
    if any(v == "#" for v in grid[col]):
        first_col = col
        break

# print(grid)
# print(first_col)
ans = []
seq = 1
for col in reversed(range(first_col+1, H)):
    if "#" in grid[col]:
        ans.extend([[0]*W]*seq)
        seq = 1
    else:
        seq += 1
ans.extend([[0]*W]*(first_col+1+(seq-1)))
ans = list(reversed(ans))
# print(ans)
# print(len(ans))

cnt = 1
for col in range(H):
    for row in range(W):
        if grid[col][row] == "#":
            ans[col][row] = cnt
            cnt += 1

for col in range(H):
    prev = max(ans[col])
    for row in reversed(range(W)):
        if ans[col][row] == 0:
            ans[col][row] = prev
        else:
            prev = min(prev, ans[col][row])
# print(ans)
for a in ans:
    print(" ".join(map(str, a)))


Measured memory_bytes: 48860
m=10**9+7;
p=->a,b{b>0?a**b[0]*p[a*a%m,b>>1]:1};
eval"H,W,A,B="+`tr \\  ,`;
s=0;
f=[1];
200000.times{|i|f<<f[-1]*-~i%m}
(B...W).map{|i|s+=f[H-A-1+i]*f[A+W-i-2]*p[f[H-A-1]*f[i]*f[A-1]*f[W-1-i],m-2]%m}
p s%m


Measured memory_bytes: 5640
n = int(input())
 
b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(0,n-1):
  a.append(b[i])

for i in range(n-1):
  if(a[i] > a[i+1]):
    a[i] = a[i+1]
    
sum = 0
for i in range(n):
  sum += a[i]
  
print(sum)

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

int main() {
    int N, M, X, Y;
    std::cin >> N >> M >> X >> Y;

    std::vector<int> x(N);
    for (int i = 0; i < N; i++) {
        std::cin >> x[i];
    }

    std::vector<int> y(M);
    for (int i = 0; i < M; i++) {
        std::cin >> y[i];
    }

    std::sort(x.begin(), x.end());
    std::sort(y.begin(), y.end());

    if (x[N - 1] >= y[0] or y[0] <= X or Y <= x[N - 1]) {
        std::cout << "War" << std::endl;
    } else {
        std::cout << "No War" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
def max_candy(field,N):
	data = [0]*N
	for i in range(N):
		data[i] = sum(field[0,:i+1]) + sum(field[1,i:])
	return max(data)

import numpy as np
N = int(input())
field = []
for i in range(2):
	array = list(map(int,input().split()))
	field.append(array)
field = np.array(field)

print(max_candy(field,N))

Measured memory_bytes: 12504
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
 
//template functions
/////////////////////////
void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long strtolong(string str){
istringstream ss;
ss=istringstream(str);
long num;
ss>>num;
return num;
}

long chartolong(char ch){
long num;
num=ch-'0';
return num;
}

string longtostr(long N){
    string str;
    str=to_string(N);
    return str;
}









/////////////////////////


//Answer


int main() {
  
typedef pair<long,long> P;
long N;
cin>>N;
vector<long> A(N);
vector<long> R(N,2);
vector<vector<P>> x(N,vector<P>(N));
for(long i=0;i<N;i++){
    cin>>A.at(i);
    for(long j=0;j<A.at(i);j++){
        cin>>x.at(i).at(j).first;
        cin>>x.at(i).at(j).second;
    }
}
long max=0;
for(int tmp=0;tmp<(1<<15);tmp++){
    bitset<15> s(tmp);
    long flag=0,count=0;
    for(long i=0;i<N;i++){ 
        if(s.test(i)){//sが1のとき正直と考える
            for(long j=0;j<A.at(i);j++){
                if(x.at(i).at(j).second==1){
                    if(!s.test(x.at(i).at(j).first-1)){
                        flag=1;
                    }
                }else{
                    if(s.test(x.at(i).at(j).first-1)){
                        flag=1;
                    }
                }
            }
        }
    
    }
  if(flag==0){
	//cout<<s<<endl;
    for(long i=0;i<N;i++){
        if(s.test(i)){
            count++;
        }
    }
    if(max<count){
        max=count;
    }
  }
}

cout<<max<<endl;

}


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

int main(int argc, char const *argv[])
{
	int m1, d1, m2, d2; cin >> m1 >> d1 >> m2 >> d2;
	if (m1 != m2) {
		cout << 1 << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
dict = defaultdict(int)
for i in range(2, N+1):
    for j in range(2, i+1):
        while i > 1:
            if i % j == 0:
                i = i // j
                dict[j] += 1
            else:
                break
count74 = 0
count24 = 0
count14 = 0
count4 = 0
count2 = 0
for k, v in dict.items():
    if v >= 74:
        count74 += 1
        count24 += 1
        count14 += 1
        count4 += 1
        count2 += 1
    elif v >= 24:
        count24 += 1
        count14 += 1
        count4 += 1
        count2 += 1
    elif v >= 14:
        count14 += 1
        count4 += 1
        count2 += 1
    elif v >= 4:
        # print('4',k)
        count4 += 1
        count2 += 1
    elif v >= 2:
        # print('2', k)
        count2 += 1
ans74 = count74
ans242 = count24 * (count2-1)
ans144 = count14 * (count4-1)
ans442 = count4 * (count4-1) // 2 * (count2-2)
print(ans74+ans144+ans242+ans442)


Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

int main(int argc, char **argv) {
    int N, W[200], sum1[200], sum2[200];
    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> W[i];
    }

    sum1[0] = W[0];
    sum2[N - 1] = W[N - 1];
    for(int i = 1; i < N; ++i)
        sum1[i] = sum1[i - 1] + W[i];
    for(int i = N - 2; i >= 0; --i)
        sum2[i] = sum2[i + 1] + W[i];
    
    int res = INF;
    for(int i = 0; i < N - 1; ++i) {
        res = min(res, abs(sum1[i] - sum2[i + 1]));
    }

    cout << res << endl;
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2")

using namespace std;

using ll = long long;
#define all(x) begin(x), end(x)

int main()
{
    ios_base::sync_with_stdio(0);
    string s,t; cin >> s >> t;
    int difmin = INT_MAX;
    int n = s.size();
    int m = t.size();
    for(int i{}; i<n-m+1; i++){
        int a = 0;
        for(int j{}; j<m; j++){
            if(s[i+j]!=t[j]) a++; 
        }
        difmin = min(a, difmin);
    }
    cout << difmin << "\n";
}
   

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,s[100001],MOD=1e9+7,ans=1;
int main(void){
	cin>>n;
	s[0]=3;
	for(int i=0;i<n;i++){
		cin>>a;
		a++;
		ans*=s[a-1]-s[a];
		ans%=MOD;
		s[a]++;
	}
	cout<<ans<<endl;
}

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

vector<long long> trial_division(const long long& num) {
  if (num == 1) {
    return vector<long long>();
  }
  long long result = num;
  for (long long i = 2, m = (long long)sqrt(num); i <= m; ++i) {
    if (num % i == 0) {
      result = i;
      break;
    }
  }
  if (result == num) {
    return {num};
  } else {
    vector<long long> primes_1 = {result};
    vector<long long> primes_2 = trial_division(num / result);
    primes_1.insert(primes_1.end(), primes_2.begin(), primes_2.end());
    return primes_1;
  }
}

// set<long> get_prime_factors(const long num) {
//   set<long> factors;
//   long current = num;
//   for (long i = 2; i <= num; i++) {
//     while (current % i == 0) {
//       factors.insert(i);
//       current /= i;
//     }
//   }
//   return factors;
// }

int main(int argc, char const* argv[]) {
  long long A, B;
  cin >> A >> B;

  vector<long long> factors_A = trial_division(A);
  vector<long long> factors_B = trial_division(B);
  set<long long> result;

  set_intersection(factors_A.begin(), factors_A.end(), factors_B.begin(),
                   factors_B.end(), inserter(result, result.end()));

  cout << result.size() + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int P,Q,R;
  int m;
  
  cin >> P >> Q >> R;
  
  m = P+Q;
  m = min(m, Q+R);
  m = min(m, R+P);
  
  cout << m << endl;
  
  return 0;
}

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

int main(){
    long long N;
    cin >> N;
    string S;
    cin >> S;
    long long X[N];
    long long i;
    long long kosu=0;
    for(i=0; i<N; i++){
        X[i]=(long long)(S[i]-'0');
        if(X[i]>0){
            kosu++;
        }
    }
    if(kosu==0){
        for(i=0; i<N; i++){
            cout << 1 << endl;
        }
        system("pause");
        return 0;
    }
    long long kosumm=kosu-1;
    long long kosupp=kosu+1;
    bool zero=0;
    long long amamm[N];
    long long amapp[N];
    if(kosumm<=0) zero=1;
    long long rec=1;
    rec%=kosupp;
    for(i=N-1; i>=0; i--){
        amapp[i]=rec;
        rec*=2;
        rec%=kosupp;
    }
    if(zero==0){
        rec=1;
        rec%=kosumm;
        for(i=N-1; i>=0; i--){
            amamm[i]=rec;
            rec*=2;
            rec%=kosumm;
        }
    }
    long long fipp=0, fimm=0;
    for(i=0; i<N; i++){
        if(X[i]==1){
            fipp+=amapp[i];
            fipp%=kosupp;
        }
    }
    if(zero==0){
        for(i=0; i<N; i++){
            if(X[i]==1){
                fimm+=amamm[i];
                fimm%=kosumm;
            }
        }
    }
    long long fi=0, fi_sub=0;
    long long counta;
    long long koko;
    long long j;
    for(i=0; i<N; i++){
        if(X[i]==1){
            if(zero==1){
                cout << 0 << endl;
            }else{
                fi = fimm;
                fi += kosumm-amamm[i];
                fi %= kosumm;
                counta=1;
                while(fi>0){
                    counta++;
                    fi_sub=fi;
                    koko=0;
                    while(fi_sub>0){
                        koko += fi_sub%2;
                        fi_sub /=2;
                    }
                    fi %= koko;
                }
                cout << counta << endl;
            }
        }else{
            fi = fipp;
            fi += amapp[i];
            fi %= kosupp;
            counta=1;
            while(fi>0){
                counta++;
                fi_sub=fi;
                koko=0;
                while(fi_sub>0){
                    koko += fi_sub%2;
                    fi_sub /=2;
                }
                fi %= koko;
            }
            cout << counta << endl;
        }
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 8428
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        String ans = "";
        
        if(num < 1200){
            ans = "ABC";
        }else{
            ans = "ARC";
        }
        
        System.out.println(ans);
	}
}

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

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main(void) {
	int n;
	cin >> n;
	vector<int>A(n);
	for (int i = 0; i < n; ++i) cin >> A[i];

	vector<int> L(n + 1), R(n + 1);
	L[0] = 0, R[n] = 0;
	for (int i = 1; i < n + 1; ++i) {
		L[i] = gcd(L[i - 1], A[i - 1]);
	}
	for (int i = n - 1; i >= 0; --i) {
		R[i] = gcd(R[i + 1], A[i]);
	}

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (ans < gcd(L[i], R[i + 1]))
			ans = gcd(L[i], R[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> lookwest(N);
    vector<int> lookeast(N);

    lookwest[0] = 0;
    if(S[0] == 'W') lookwest[0]++;
    for(int i = 1; i < N; i++) {
        lookwest[i] = lookwest[i - 1];
        if(S[i] == 'W') lookwest[i]++;
    }
    lookeast[N - 1] = 0;
    if(S[N - 1] == 'E') lookeast[N - 1]++;
    for(int i = N - 2; i >= 0; i--) {
        lookeast[i] = lookeast[i + 1];
        if(S[i] == 'E') lookeast[i]++;
    }

    int ans = inf;
    for(int i = 0; i < N; i++) ans = min(ans, lookwest[i] + lookeast[i] - 1);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2948
#include <iostream>
#include <bitset>

using namespace std;

bitset<7> segs[10];

void init() {
	segs[0] = bitset<7>(string("0111111"));
	segs[1] = bitset<7>(string("0000110"));
	segs[2] = bitset<7>(string("1011011"));
	segs[3] = bitset<7>(string("1001111"));
	segs[4] = bitset<7>(string("1100110"));
	segs[5] = bitset<7>(string("1101101"));
	segs[6] = bitset<7>(string("1111101"));
	segs[7] = bitset<7>(string("0100111"));
	segs[8] = bitset<7>(string("1111111"));
	segs[9] = bitset<7>(string("1101111"));
}

int main() {
	init();
	int n;
	while (cin >> n) {
		if (n == -1) break;
		bitset<7> cur((string)"0000000");
		for (int i = 0; i < n; i++) {
			int p; cin >> p;
			cout << (cur ^ segs[p]).to_string() << endl;
			cur = segs[p];
		}
	}
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#include<set>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define vpll vector <pll>
#define pb push_back

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



Measured memory_bytes: 3624
#include <iostream>
#include <cassert>
//#define NDEBUG
int main(void){
	using namespace std;
	static const int INPUT_H_MIN = 0;	/* 前提は1以上だが、入力終了時は0 */
	static const int INPUT_H_MAX = 300;
	static const int INPUT_W_MIN = 0;	/* 前提は1以上だが、入力終了時は0 */
	static const int INPUT_W_MAX = 300;
	int input_h = 0;
	int input_w = 0;
	
	do{
		/* 縦Hと横Wを入力 */
		cin >> input_h >> input_w;
		
		/* 入力値が、  両方0(入力終了時) or 前提条件 最大・最小の制限内の入力 */
		assert ((input_h == 0 && input_w == 0 ) || (INPUT_H_MIN <= input_h && input_h <= INPUT_H_MAX));
		assert ((input_h == 0 && input_w == 0 ) || (INPUT_W_MIN <= input_w && input_w <= INPUT_W_MAX));
		
		/* 出力 */
		if(input_h != 0 && input_w != 0){
			for (int i = 0; i < input_h; i++){		/* 縦 */
				for (int j = 0; j < input_w; j++){	/* 横 */
					cout << "#";
				}
				cout << "\n";
			}
			cout << "\n";							/* データセット間の空行 */
		}
		else{
			break;
		}
	}while(input_h != 0 && input_w != 0);
	
	return 0;
}



Measured memory_bytes: 3052
#include<stdio.h>
#define MAX 200000
int min(int a,int b){
    if(a>b)a=b;
    return a;
}
int max(int a,int b){
    if(a<b)a=b;
    return a;
}
int main(void){
    int i,n,R[MAX];
    int maxx=-2000000000;
    scanf("%d\n",&n);
    for(i=0;i<n;i++){
        scanf("%d\n",&R[i]);
    }
int minx=R[0];
    for(i=1;i<n;i++){
        maxx=max(maxx,R[i]-minx);
        minx=min(minx,R[i]);
    }
    // for(i=0;i<n-1;i++){
    //     for(j=i+1;j<n;j++){
    //         if(v<R[j]-R[i]){
    //             v=R[j]-R[i];
    //         }
    //     }
    // }
    printf("%d\n",maxx);
    return 0;
}



Measured memory_bytes: 2624
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int x,y;
  cin >> x >> y;
  if(x+y>=10) pr("error");
  else pr(x+y);
}

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n,a,b,c;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d%d%d",&a,&b,&c);
        if((a*a==b*b+c*c)||(b*b==a*a+c*c)||(c*c==a*a+b*b))
            printf("YES\n");
        else
            printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 580
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
s=[A,B,C,D,E]
min1=10
for i in range (0,5):
    m=s[i]%10
    if(m!=0):
        if(min1>m):
            min1=m
time=(-(-A // 10))*10+(-(-B // 10))*10+(-(-C // 10))*10+(-(-D // 10))*10+(-(-E // 10))*10-10+min1
print(time)

Measured memory_bytes: 3064