akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;


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

  cout << "? ";
  rep(i,N) cout << i+1 << " "; cout << endl; 
  
  string tmp;
  bool isr; cin >> tmp; isr = tmp=="Red";
  int l=0, r=N;
  while (l!=r) {
    int m = (l+r)/2;
    cout << "? ";
    rep(i,N) cout << i+m+1 << " "; cout << endl;
    bool tmp_isr; cin >> tmp; tmp_isr = tmp=="Red";
    if (tmp_isr==isr) l = m+1;
    else r = m;
  }

  int pos = l;
  bool result[2*N]={};
  result[pos-1] = isr; result[pos+N-1] = !isr; 
  rep(i,N) {
    int now = (pos+N-1+i)%(N*2);
    cout << "? ";
    rep(j,N-1) cout << j+pos+1 << " ";
    cout << now+1;
    cout << endl;
    cin >> tmp; result[now] = tmp=="Red";
  }
  rep(i,N) {
    int now = pos-1+i;
    cout << "? ";
    rep(j,N-1) cout << (j+pos+N)%(N*2)+1 << " ";
    cout << now+1;
    cout << endl;
    cin >> tmp; result[now] = tmp=="Red";
  }
  
  cout << "! ";
  rep(i,N*2) cout << (result[i] ? "R" : "B");
  cout << endl;
  return 0;
}

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

int main(void)
{
    int n, m; cin >> n >> m;
    bool flag = true;
    int s, c;
    int a[5]; for (int i = 0; i < 5; i++) a[i] = -1;
    for (int i = 0; i < m; i++)
    {
        cin >> s >> c;
        if (n < s)
            flag = false;
        else if (a[s - 1] > -1 && a[s - 1] != c)
            flag = false;
        else
            a[s - 1] = c;
    }
    if (a[0] == 0 && n > 1)
        flag = false;
    int ans;
    if (flag)
    {
        ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (a[i] > -1) ans = ans * 10 + a[i];
            else
            {
                if (i == 0 && n > 1) ans = 1;
                else if (i == 0 && n == 0) ans = 0;
                else ans *= 10;
            }
        }
    }
    else
    {
        ans = -1;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
int main(){
  int mp[2][101];
  for(int i=0;i<2;i++){
    for(int j=0;j<101;j++){
      mp[i][j]=0;
    }
  }
  int n,a;
  cin>>n;
  for(int i=0;i<2;i++){
    for(int j=0;j<n;j++){
      cin>>mp[i][j];
    }
  }
  mp[0][1]+=mp[0][0];
  mp[1][0]+=mp[0][0];
  for(int i=1;i<n;i++){
    if(n==1){
      cout<<mp[0][0]+mp[1][0]<<endl;
      break;
    }
    mp[0][i+1]+=mp[0][i];
    mp[1][i]=max(mp[1][i]+mp[0][i],mp[1][i-1]+mp[1][i]);
  }
  /*for(int i=0;i<2;i++){
    for(int j=0;j<n;j++){
      cout<<mp[i][j]<<" ";
    }
    cout<<endl;
    }*/
  cout<<mp[1][n-1]<<endl;
  return 0;
}

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

using namespace std;

int a[111111];
int main() {
	int n, m = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d", a + i);
	long c = 0;
	for (int i = 0; i < n; i++) {
		int b;
		scanf("%d", &b);
		a[i] = b - a[i];
		if (a[i] > 0) c += a[i], m++;
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++, m++) {
		if (c <= 0) break;
		if (a[i] >= 0) {
			m = -1;
			break;
		}
		c += a[i];
	}
	cout << m << endl;
	return 0;
}


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

const int maxn = 5010;
int n, P, ans, f[maxn];

int main() {
    scanf("%d %d", &n, &P), f[0] = 1;
    for (int i = 1; i < n; i++) {
        int coef = min(i, n - i + 1);
        for (int j = coef; j < n; j++) {
            (f[j] += f[j - coef]) %= P;
        }
    }
    for (int i = 0; i < n; i++) {
        ans = (ans + 1LL * (n - i) * f[i]) % P;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>coins;
  coins.push_back(1);
  int p6 = 6, p9 = 9;
  while(p6<=n){coins.push_back(p6);p6*=6;}
  while(p9<=n){coins.push_back(p9);p9*=9;}
  vector<int>dp(n+1,n);
  dp[0]=0;
  for(int i=1;i<=n;i++){
    for(int coin:coins){
      if(i-coin>=0){dp[i] = min(dp[i],dp[i-coin]+1);}
    }
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
struct node {
	int key;
	struct node *next;
	struct node *prev;
};
typedef struct node *nodepointer;
nodepointer head;
nodepointer tail;
int juage(char *);
void delete(int );
void deleteFirst(void);
void deleteLast(void);
void insert(int );
void init(void);
void print(void);
int main(){
	int i,j,n,data;
	char order[15];
	init();
	scanf("%d",&n);
	for(i=0; i<n; i++){
		scanf("%s",order);
		switch(juage(order)){
			case 1:
	//			printf("1");
				scanf("%d",&data);
				insert(data);
				break;
			case 2:
	//			printf("2");
				scanf("%d",&data);
				delete(data);
				break;
			case 3:
				deleteFirst();
				break;
			case 4:
				deleteLast();
				break;
		}
	}
	print();
	return 0;
}

void deleteLast(){
	nodepointer tmp;
	tmp = tail->prev->prev;
	tmp->next = tail;
	tail->prev = tmp;
}

void deleteFirst(){
	nodepointer tmp;
	tmp = head->next->next;
	tmp->prev = head;
	head->next = tmp;
}

void delete(int key){
	nodepointer i,tmp;
	for(i = head; i != tail; i = i->next){
		if(i->next->key == key){
			tmp = i->next->next;
			tmp->prev = i;
			i->next = tmp;
			break;
		}
	}
}

void insert(int key){
	nodepointer tmp;
	tmp = malloc(sizeof(struct node));
	tmp->key = key;
	head->next->prev = tmp;
	tmp->next = head->next;
	head->next = tmp;
	tmp->prev = head;
}
void print(void){
	nodepointer i;
	//	printf("%d ",head->next->key);
	for(i = head->next; i != tail; i = i->next){
		//printf("a");
		i->next != tail ? printf("%d ",i->key) : printf("%d\n",i->key);
	}
	
}

int juage(char *order){
	char str1[]="insert";
	char str2[]="delete";
	char str3[]="deleteFirst";
	char str4[]="deleteLast";
	if(strcmp(order,str1) == 0)return 1;
	if(strcmp(order,str2) == 0)return 2;
	if(strcmp(order,str3) == 0)return 3;
	if(strcmp(order,str4) == 0)return 4;
}
void init(void){
	head = malloc(sizeof(struct node));
	tail = malloc(sizeof(struct node));
	head->key = -1;
	tail->key = -2;
	head->next = tail;
	tail->prev = head;
}

Measured memory_bytes: 34980
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S; cin>>S;
  int ans=0;
  for(int i=2;i<S.size();i+=2){
    for(int j=0;j<i/2;j++){
      if(S.at(j)!=S.at(i/2+j))break;
      if(j==i/2-1)ans=i;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int pos = S.length();
    String ans = "YES";
    while(pos > 0) {
      String s5 = "";
      String s6 = "";
      String s7 = "";
      int count = 0;
      if(pos - 7 >= 0) {
        s7 = S.substring(pos - 7, pos);
        s6 = S.substring(pos - 6, pos);
        s5 = S.substring(pos - 5, pos);
        if(s7.equals("dreamer")) {
          pos -= 7;
          count++;
        } else if(s6.equals("eraser")) {
          pos -= 6;
          count++;
        } else if(s5.equals("dream") || s5.equals("erase")) {
          pos -= 5;
          count++;
        }
      } else if(pos - 6 >= 0) {
        s6 = S.substring(pos - 6, pos);
        s5 = S.substring(pos - 5, pos);
        if(s6.equals("eraser")) {
          pos -= 6;
          count++;
        } else if(s5.equals("dream") || s5.equals("erase")) {
          pos -= 5;
          count++;
        }
      } else if(pos - 5 >= 0) {
        s5 = S.substring(pos - 5, pos);
        if(s5.equals("dream") || s5.equals("erase")) {
          pos -= 5;
          count++;
        }
      }
      if(count == 0) {
        ans = "NO";
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 28680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define INF 1e+15
#define int long long
using namespace std;

int n,q,s[1000000];
vector<int> vec,lead;

int calc(int r){
	int prev = -1,res = 0;
	for(int v : lead){
		int indr = upper_bound(vec.begin(),vec.end(),v) - vec.begin() - 1;
		int indl = lower_bound(vec.begin(),vec.end(),v - r) - vec.begin();
		res += max(0ll,indl - prev - 1);
		prev = indr;
	}
	return res + n - prev - 1;
}

signed main(){
	cin >> n >> q;
	for(int i = 0;i < n;i++){
		cin >> s[i];
		vec.push_back(s[i]);
	}
	sort(vec.begin(),vec.end());
	for(int i = 0;i < q;i++){
		int a;
		string t;
		cin >> t >> a;
		if(t == "ADD") lead.push_back(s[a - 1]);
		else if(t == "REMOVE"){
			bool flag = false;
			vector<int> nxt;
			for(int v : lead){
				if(v == s[a - 1] && !flag) flag = true;
				else nxt.push_back(v);
			}
			lead = nxt;
		}else{
			sort(lead.begin(),lead.end());
			int low = -1,up = INF;
			while(up - low > 1){
				int mid = (up + low) / 2;
				if(calc(mid) <= a) up = mid;
				else low = mid;
			}
			if(up == INF) cout << "NA" << endl;
			else cout << up << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 18692
#include<iostream>

using namespace std;

int main(void)

{
    int a, b, c, d, flag = 1;
    cin>>a>>b>>c>>d;
    while(1){
        c -= b;
        if(c <= 0){
            flag = 0;
            break;
        }
        a -= d;
        if(a <= 0){
            break;
        }
    }
    if(flag == 0)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3136
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, m, k, a, b, bos[100009], cnt[100009], ans[100009], c[100009], d[100009];
vector<int> vec[2][100009];

int gun(int x)
{
	if (bos[x] != x)
		bos[x] = gun(bos[x]);
	return bos[x];
}

void fun(int x, int y)
{
	x = gun(x);
	y = gun(y);
	if (x > y) swap(x, y);
	bos[y] = bos[x];
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) {
		bos[i] = i;
	}
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		vec[0][a].pb(b);
		vec[0][b].pb(a);
		fun(a, b);
	}
	for (int i = 0; i < k; i++) {
		cin >> c[i] >> d[i];
	}
	for (int i = 1; i <= n; i++) gun(i);
	for (int i = 1; i <= n; i++) cnt[bos[i]]++;
	for (int i = 1; i <= n; i++) {
		int tmp = cnt[bos[i]];
		tmp--;
		tmp -= vec[0][i].size();
		ans[i] = tmp;
	}
	for (int i = 0; i < k; i++) {
		if (bos[c[i]] == bos[d[i]]) {
			ans[c[i]]--;
			ans[d[i]]--;
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << " ";
	}
	cout << E;
	//system("pause");
	return 0;
}

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

typedef long long ll;

int main(){
  ll N; std::cin >> N;
  std::vector<std::vector<ll> > a(N, std::vector<ll>(3));
  for(int i = 0 ; i < N ; i++){
    std::cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  std::vector<std::vector<ll> > dp(N + 1, std::vector<ll>(3, 0));

  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < 3 ; j++){
      for(int k = 0 ; k < 3 ; k++){
	if(j == k) continue;
	dp[i+1][j] = std::max(dp[i+1][j], dp[i][k] + a[i][k]);
      }
    }
  }
  ll resa = 0;
  for(int i = 0 ; i < 3 ; i++){
    resa = std::max(resa, dp[N][i]);
  }
  std::cout << resa << std::endl;
  return 0;
}


Measured memory_bytes: 14024
#define NDEBUG
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cassert>
using namespace std;

typedef long long ll;
const ll MOD = 1000000009;

vector<vector<ll> > mat_mul(const vector<vector<ll> >& m1, const vector<vector<ll> >& m2)
{
  const int N = m1.size(), K = m2.size(), M = m2[0].size();
  assert(int(m1[0].size()) == K);
  vector<vector<ll> > r(N, vector<ll>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      r[i][j] = 0;
      for (int k = 0; k < K; k++) {
        r[i][j] = (r[i][j] + m1[i][k] * m2[k][j]) % MOD;
      }
    }
  }
  return r;
}

vector<ll> mat_mul(const vector<vector<ll> >& m, const vector<ll>& v)
{
  const int N = m.size(), M = m[0].size();
  assert(int(v.size()) == M);
  vector<ll> r(N);
  for (int i = 0; i < N; i++) {
    r[i] = 0;
    for (int j = 0; j < M; j++) {
      r[i] = (r[i] + m[i][j] * v[j]) % MOD;
    }
  }
  return r;
}

vector<vector<ll> > mat_pow(const vector<vector<ll> >& m, ll e)
{
  const int N = m.size();
  assert(int(m[0].size()) == N);
  if (e == 0) {
    vector<vector<ll> > id(N, vector<ll>(N, 0));
    for (int i = 0; i < N; i++) {
      id[i][i] = 1;
    }
    return id;
  } else if (e & 1) {
    return mat_mul(m, mat_pow(m, e-1));
  } else {
    const vector<vector<ll> > mm = mat_pow(m, e>>1);
    return mat_mul(mm, mm);
  }
}

int main()
{
  ll W, H, N;
  for (int Ti = 1; cin >> W >> H >> N && W != 0; Ti++) {
    multimap<ll, int> obstacles;
    vector<ll> hs;
    for (int i = 0; i < N; i++) {
      int w;
      ll h;
      cin >> w >> h;
      --w;
      --h;
      obstacles.insert(make_pair(h, w));
      hs.push_back(h);
    }
    hs.push_back(H-1);
    sort(hs.begin(), hs.end());
    hs.erase(unique(hs.begin(), hs.end()), hs.end());

    vector<ll> row(W, 0);
    row[0] = 1;
    vector<vector<ll> > trans(W, vector<ll>(W, 0));
    for (int i = 0; i < W; i++) {
      for (int k = -1; k <= 1; k++) {
        const int j = i + k;
        if (0 <= j && j < W) {
          trans[i][j] = 1;
        }
      }
    }

    ll h = 0;
    for (vector<ll>::const_iterator it = hs.begin(); it != hs.end(); ++it) {
      const vector<vector<ll> > t = mat_pow(trans, *it - h);
      row = mat_mul(t, row);
      typedef multimap<ll, int>::const_iterator Iterator;
      const pair<Iterator, Iterator> p = obstacles.equal_range(*it);
      for (Iterator jt = p.first; jt != p.second; ++jt) {
        row[jt->second] = 0;
      }
      h = *it;
    }

    cout << "Case " << Ti << ": " << row[W-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1384
function Main(input) {
    let array = input.split("\n");
    let item = parseInt(array[0]);

    let countAC = 0;
    let countWA = 0;
    let countTLE = 0;
    let countRE = 0;
    for (let i =1;i<=item;i++){
        if (array[i] == "AC"){
            countAC++;
        } else if (array[i] == "WA"){
            countWA++;
        } else if (array[i] == "TLE"){
            countTLE++;
        } else if (array[i] == "RE"){
            countRE++;
        }
    }
    console.log("AC x "+countAC);
    console.log("WA x "+countWA);
    console.log("TLE x "+countTLE);
    console.log("RE x "+countRE);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	char a[4];
	cin>>a;
	int p=0;
	int m=0;
	for(int i=0;i<4;i++){
		if(a[i]=='+'){
			p++;
		}
		else{
			m++;
		}
	}
	cout<<(-1*m)+p;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N_MAX 5000000
using namespace std;

struct node
{
  int l, r, id;
} q[N_MAX + 5];

// c:binary indexed tree, f:last ingdex(j) of a[j]
int N, a[N_MAX + 5], m, c[N_MAX + 5], f[N_MAX + 5], ans[N_MAX + 5];

int lowbit(int x) {return x & (-x);}
int cmp(node x, node y) {return x.r < y.r;}
void add(int x, int k){
  for (; x <= N; x += lowbit(x))
    c[x] += k;
}
int sum(int x)
{
  int ans = 0;
  for (; x; x -= lowbit(x))
    ans += c[x];
  return ans;
}

int main()
{
  scanf("%d%d", &N, &m);
  for (int i = 1; i <= N; i++)
    scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++)
    scanf("%d%d", &q[i].l, &q[i].r), q[i].id = i;
  sort(q + 1, q + m + 1, cmp);
  for (int i = 1; i <= m; i++)
  {
    for (int j = q[i - 1].r + 1; j <= q[i].r; j++)
    {
      if (f[a[j]])
        add(f[a[j]], -1);
      f[a[j]] = j;
      add(j, 1);
    }
    ans[q[i].id] = sum(q[i].r) - sum(q[i].l - 1);
  }
  for (int i = 1; i <= m; i++)
    printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 17384
def main():
    from collections import defaultdict

    d = defaultdict(int)

    N = int(input())
    for _ in range(N):
        s = input()
        d[s] += 1

    M = int(input())
    for _ in range(M):
        t = input()
        d[t] -= 1

    ma = max(d.values())
    print(max(0, ma))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,i,j,k;
  cin>>n>>k;
  ll a[n],dp[n];
  for(i=0;i<n;i++)
  	cin>>a[i];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  //dp[2]=min(dp[1]+abs(a[2]-a[1]),abs(a[2]-a[0]));
  for(i=2;i<n;i++)
  {
  	ll s=dp[i-1]+abs(a[i]-a[i-1]);
  	for(j=2;j<=k;j++)
  	{
  	if(i-j>=0)
  	{	
  	s=min(s,dp[i-j]+abs(a[i]-a[i-j]));
  	}
  	else
  		break;
  	}
  	dp[i]=s;
	}
	//cout<<endl;
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
output = 0

s_count, t_count = Counter(s), Counter(t)

for i in s_count:
    tmp_s = s_count[i]
    tmp_t = 0
    if i in t_count:
        tmp_t = t_count[i]

    if output < tmp_s - tmp_t:
        output = tmp_s - tmp_t

print(output)


Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

priority_queue< P, vector<P>, greater<P> > pq;

bool ishaiku(int x, int y, int z){
	return ((x == 5) && (y == 7) && (z == 5));
}

int main(void){
	int a,b,c;
	cin >> a >> b >> c;
	cout << ((ishaiku(a,b,c)||ishaiku(b,c,a)||ishaiku(c,a,b))?"YES":"NO");
	return 0;
}

Measured memory_bytes: 256
n,t = map(int,input().split())
a = [int(i) for i in input().split()]
ans = t
for i in range(n-1):
    if abs(a[i+1] - a[i]) > t:
        ans += t
    else:
        ans += abs(a[i+1] - a[i])

print(ans)

Measured memory_bytes: 25196
import sys
from collections import deque
input = sys.stdin.readline

class Node:
    def __init__(self, id_=0):
        self.id = id_
        self.link = []
        self.edge_ids = []
        self.check = False

def main():
    N = int(input())
    ab = [list(map(int, input().split())) for i in range(N-1)]

    nodes = [Node(i) for i in range(N+1)]
    for i, (a, b) in enumerate(ab):
        nodes[a].link.append(nodes[b])
        nodes[a].edge_ids.append(i)
        nodes[b].link.append(nodes[a])
        nodes[b].edge_ids.append(i)
    
    ans = 0
    edge_colors = [0 for i in range(N-1)]

    q = deque()
    # キューの中身: (node, このノードに来るエッジで使った色ID)
    q.append((nodes[1], 0))
    nodes[1].check = True

    while len(q) > 0:
        node, pre_color = q.popleft()
        # print("at ", node.id)
        next_color = 1
        for next_node, edge_id in zip(node.link, node.edge_ids):
            if not next_node.check:
                # print("next ", next_node.id)
                if next_color == pre_color:
                    next_color += 1
                ans = max(ans, next_color)
                edge_colors[edge_id] = next_color
                q.append((next_node, next_color))
                next_node.check = True
                next_color += 1
    
    print(ans)
    for color in edge_colors:
        print(color)

if __name__ == "__main__":
    main()

Measured memory_bytes: 81180
A = [[int(i) for i in input().split()] for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

data  = [[0]*3 for i in range(3)]

for B in b:
  for i in range(3):
    for j in range(3):
      if A[i][j]==B:
        data[i][j] = 1

answer = "No"
for i in range(3):
  if data[i][0]==data[i][1]==data[i][2]==1:
    answer = "Yes"
    break
  elif data[0][i]==data[1][i]==data[2][i]==1:
    answer = "Yes"
    break
if data[0][0]==data[1][1]==data[2][2]==1:
  answer ="Yes"
elif data[2][0]==data[1][1]==data[0][2]==1:
  answer ="Yes"
print(answer)

Measured memory_bytes: 3064
#include <stdio.h>
#define MAX 1000000
int is_prime[MAX];
int prime[MAX];

int main(){
  int n;
  int i,j;
  int count;
  for(i=1;i<=MAX;i++) is_prime[i]=1;
  
  is_prime[0]=0;
  is_prime[1]=0;
  for(i=2;i<=MAX;i++){
    if(is_prime[i]){
      for(j=2*i;j<=MAX;j+=i)is_prime[j]=0;
    }
  }
  while(scanf("%d",&n)!=EOF){
    count=0;
    for(i=1;i<=n;i++){
      if(is_prime[i]==1)count++;
    }
    printf("%d\n",count);
  }
  return 0;
}

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

int main()
{
	int N; std::cin >> N;
	int x; std::cin >> x;
	std::vector<int> a(N);
	for(auto &z : a) std::cin >> z;

	long long ans = 0;
	for(auto &z : a)
	{
		if(z > x)
		{
			ans += z-x;
			z -= z-x;
		}
	}
	for(int n=0; n<N-1; n++)//n:端の番号
	{
		int sum = a[n] + a[n+1];
		if(sum > x)
		{
			ans += sum-x;
			a[n+1] -= sum-x;
		}
	}
	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int count[100000] = {0};

int main()
{
	// 要素数
	int n;
	cin >> n;

	int a;
	for( int i = 0;i < n;++i )
	{
		cin >> a;
		a;
		++count[a];
		if( a > 0)
			++count[a-1];
		if( a < 100000 )
			++count[a+1];
	}

	int max_index = 0;
	for( int i = 1;i < 100000;++i )
		max_index = count[max_index] < count[i] ? i : max_index;
	cout << count[max_index] << endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return(a/gcd(a,b))*(b/gcd(a,b))*gcd(a,b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
void decimal(int x){cout<<fixed<<setprecision(x);}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
  ll n,x;
  cin>>n>>x;
  vi a(n);
  rep(i,n) cin>>a[i];
  rep(i,n) a[i]=abs(a[i]-x);
  ll ans=a[0];
  rep(i,n-1) ans=gcd(ans,a[i+1]);
  out(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
int n, q, x[100009], y[100009], a[100009], p[100009]; bool ok[100009];
int main() {
	scanf("%d %d", &n, &q);
	for (int i = 0; i < q; i++) {
		scanf("%d %d", &x[i], &y[i]); x[i]--, y[i]--; a[i + 1] = a[i];
		if (a[i] == x[i]) a[i + 1] = y[i];
		if (a[i] == y[i]) a[i + 1] = x[i];
	}
	ok[a[q]] = true;
	for (int i = 0; i < n; i++) p[i] = i;
	for (int i = q; i >= 0; i--) {
		if (i != q) std::swap(p[x[i]], p[y[i]]);
		if (a[i] != 0) ok[p[a[i] - 1]] = true;
		if (a[i] != n - 1) ok[p[a[i] + 1]] = true;
	}
	int ret = 0;
	for (int i = 0; i < n; i++) ret += ok[i];
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;

int main(){
    int N; cin >> N;
    /*vl A(N);
    REP(i, N){
        cin >> A[i];
    }*/
    vl max;
    int A;
    cin >> A;
    max.push_back(-A);
    FOR(i, 1, N){
        int tmp;
        cin >> tmp;
        bool isIn = false;
        int num = max.size();
        if(-max[num-1] >= tmp){
            max.push_back(-tmp);
            continue;
        }
        REP(j, num){
            if(-max[j] < tmp){
                max[j] = -tmp;
                isIn = true;
                break;
            }
        }
        if(!isIn) max.push_back(-tmp);
    }
    cout << max.size() << endl;
    return 0;
}

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

int main(){
  ll l,r; cin >> l >> r;
  ll low=2020;
  if(r-l>=2019){
    cout << "0" << endl;
  }
  else{
  for(ll i=l;i<r;i++){
    for(ll j=i+1;j<=r;j++){
      low=min(low,ll((i*j)%2019));
    }
  }
  cout << low << endl;
  }
}


Measured memory_bytes: 256
N, H = [int(i) for i in input().split()]
L = [[int(i) for i in input().split()] for _ in range(N)]
A = max(a for a, _ in L)
B = sorted(b for a, b in L if b > A)
M = len(B)
while B and H > 0:
    H -= B.pop()
print(M - len(B) + max(-1, H - 1) // A + 1)

Measured memory_bytes: 22376
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
	int n, a, b, c, d[100], i;
	double sm, sv, t, u;
	cin >> n >> a >> b >> c;
	for (i = 0; i < n; i++)
		cin >> d[i];
	sort(d, d+n, greater<int>());
	sm = (double)a, sv = (double)c;
	for (i = 0; i < n; i++)
	{
		t = (sv+d[i])/(sm+b);
		u = sv/sm;
		if (t > u)
			sv+=d[i], sm+=b;
	}
	cout << (int)(sv/sm) << endl;
}

Measured memory_bytes: 0
import scala.io.StdIn.readLine

class Dice(var d:Array[Int]) {
  val s = Array(4,0,2,3,5,1)
  val n = Array(1,5,2,3,0,4)
  val w = Array(2,1,5,0,4,3)
  val e = Array(3,1,0,5,4,2)

  def roll(dir:Char)  =
    d = dir match {
      case 'S' => s.map(d)
      case 'N' => n.map(d)
      case 'W' => w.map(d)
      case 'E' => e.map(d)
    }

  def getTopFace() = d(0)
}

object Main extends App {
  val faces = readLine.split(" ").map(_.toInt)
  val dice = new Dice(faces)

  readLine.foreach { dice.roll _ }
  println(dice.getTopFace)
}

Measured memory_bytes: 44140
#include <iostream>
enum{
	hour = 3600,
	minute = 60,
	second = 1,
};
using namespace std;


int main(void)
{
	int i, s, m, h;
	cin >> i;
	
	h = i / hour;
	i %= hour;
	m = i / minute;
	i %= minute;
	s = i / second;

	cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 1168
/* ex3_4
   moka223711 */

#include <stdio.h>

int main(void){
	int num, dis = 0; // discriminant
	scanf("%d", &num);

	// numを1から9で割って、余りが0かつ商が9以下になっているものを探す
	// 割れるものが見つかったらdisを1に変える
	for(int i = 1; i <= 9; i++){
		if(num % i == 0 && num / i <= 9){
			dis = 1;
			break;
		}
	}
	
	// 上のfor文で1から9で割り切れるものが見つかったときdis==1となっているため
	// if文が実行される、なかったときはelse文の実行
	if(dis){
		printf("Yes");
	}
	else{
		printf("No");
	}
  
	return 0;
}


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

int n, a[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	sort(a + 1, a + 1 + n);

	int pos = 0;
	ll sum = 0;

	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (sum + sum < a[i + 1])
			pos = i;
	}

	cout << n - pos;
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 640
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        // 主処理
        char[] charS = s.toCharArray();
        Arrays.sort(charS);
        char[] charT = t.toCharArray();
        Arrays.sort(charT);

        String s2 = "";
        for (char c : charS) {
            s2 += c;
        }
        String t2 = "";
        for (char c : charT) {
            t2 = c + t2;
        }

        String[] array = new String[] { s2, t2 };
        Arrays.sort(array);

        boolean judge = s2.equals(array[0]);
        String result = judge && !s.equals(t) ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N;
  std::cin >> N;
  std::vector<ll> A(N);
  for(int i=0;i<N;i++) scanf("%lld", &A[i]);
  ll dp[N][N][2];
  for(int i=0;i<N;i++) dp[i][i][0] = A[i], dp[i][i][1] = -A[i];
  for(int w=1;w<N;w++){
    for(int i=0;i+w<N;i++){
      dp[i][i+w][0] = max(dp[i+1][i+w][1]+A[i], dp[i][i+w-1][1]+A[i+w]);
      dp[i][i+w][1] = min(dp[i+1][i+w][0]-A[i], dp[i][i+w-1][0]-A[i+w]);
    }
  }
  std::cout << dp[0][N-1][0] << '\n';
  return 0;
}


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

int main() {
	ll a,b;
	cin>>a>>b;
	if(a>=10||b>=10){
		cout << -1;
		return 0;
	}
	cout << a*b;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
 
mi = lambda: map(int, input().split())
 
W, H, x, y = mi()
 
if x == W/2 and y == H/2:
  print('%f 1' % ((W*H)/2))
else:
  print('%f 0' % ((W*H)/2))

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            Integer[] a = new Integer[n];
            int alice = 0;
            int bob = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a, Collections.reverseOrder());

            for (int i = 0; i < n; i++) {
                if (i % 2 == 0) {
                    alice += a[i];
                } else {
                    bob += a[i];
                }
            }

            out.print(alice - bob);
        }

    }
}



Measured memory_bytes: 23252
N, K = [int(x) for x in input().split()]
A_lst = [int(x) for x in input().split()]
dict = {}
for i in A_lst:
    if not i in dict:
        dict[i] = 1
    else:
        dict[i] += 1

lst = []
for i in dict.keys():
    lst.append(dict[i])
lst.sort()
k = len(lst)
cnt = 0
i = 0

while k > K:
    k -= 1
    cnt += lst[i]
    i += 1

print(cnt)


Measured memory_bytes: 33152
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

xy1 = max(x + y for x, y in xy)
xy2 = max(-x - y for x, y in xy)
xy3 = max(-x + y for x, y in xy)
xy4 = max(x - y for x, y in xy)

print(max(xy1 + xy2, xy3 + xy4))


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

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    for (int i = 0; i < k; i++) {
        vector<int> ruiseki(n + 1, 0);
        for (int j = 0; j < n; j++) {
            ruiseki[(j - a[j] >= 0) ? j - a[j] : 0]++;
            ruiseki[(j + a[j] + 1 <= n) ? j + a[j] + 1 : n]--;
        }

        rep(j, n) ruiseki[j + 1] += ruiseki[j];
        ruiseki.pop_back();

        if (a == ruiseki) break;
        a = ruiseki;
    }

    rep(i, n) {
        cout << a[i] << " ";
    }

    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

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


vector<int>a;

int N;
bool prime[2000];


void mul(int x){
    int up=0;
    for(int i=0;i<a.size()-1;i++){
        a[i]=a[i]*x+up;
        up=a[i]/10;
        a[i]%=10;
    }
}

void add(int x){
    int up=x;
    for(int i=0;i<a.size();i++){
        a[i]+=up;
        up=a[i]/10;
        a[i]%=10;
    }
}

void print(){
    int pos=0;
    for(int i=0;i<a.size();i++)if(a[i])pos=i;
    for(int i=pos;i>=0;i--)cout<<a[i];cout<<endl;
}

int main(){
    scanf("%d",&N);
    a.resize(5000,0);
    a[0]=1;

    fill_n(prime,2000,true);
    prime[0]=prime[1]=false;
    for(int i=2;i<2000;i++){
        if(!prime[i])continue;
        for(int j=i*2;j<2000;j+=i)prime[j]=false;
    }

    for(int i=2;i<2000;i++)if(prime[i])mul(i);

    add(2);
    print();

    for(int i=2;i<N+2;i++){
        for(int j=2;j<=i;j++)if(i%j==0){
            cout<<j<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1232
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N; scanf("%d",&N);
    queue<int> A[N];
    rep(i,N)rep(j,N-1){
        int B; scanf("%d",&B);
        A[i].push(B);
    }
    int ans = 0;
    int used[N];
    memset(used,0,sizeof(used));
    while(true){
        bool ok = false;
        rep(j,N){
            if(A[j].front()-1 >= 0 && A[A[j].front()-1].front() == j+1 && used[j] == 0 && used[A[j].front()-1] == 0){
                used[j] = 1;
                used[A[j].front()-1] = 1;
                A[A[j].front()-1].pop();
                A[j].pop();
                ok = true;
            }
        }
        if(!ok) break;
        rep(i,N) used[i] = 0;
        ans++;
    }
    rep(i,N){
        if(A[i].size() != 0){
            cout << -1 << '\n';
            return 0;
        }
    }
    cout << ans << '\n';
}
   


Measured memory_bytes: 6784
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main() {
  int64_t N, M;
  std::cin >> N >> M;
  std::vector<int64_t> H(N);
  for (int64_t i = 0; i < N; ++i) {
    std::cin >> H.at(i);
  }
  std::vector<bool> isHighest(N, true);
  for (int64_t i = 0; i < M; ++i) {
    int64_t A, B;
    std::cin >> A >> B;
    int64_t A0start = A - 1, B0start = B - 1;
    if (A0start > B0start) {
      std::swap(A0start, B0start);
    }
    if (H.at(A0start) < H.at(B0start)) {
      isHighest.at(A0start) = false;
    } else if (H.at(B0start) < H.at(A0start)) {
      isHighest.at(B0start) = false;
    }
    if (H.at(A0start) == H.at(B0start)) {
      isHighest.at(A0start) = false;
      isHighest.at(B0start) = false;
    }
  }
  /*for (const auto &e : H) {
    std::cout << e << std::endl;
  }*/
  /*for (const auto &e : isHighest) {
    std::cout << e << std::endl;
  }*/
  const int64_t answer = std::count(isHighest.begin(), isHighest.end(), true);
  std::cout << answer << std::endl;
}


Measured memory_bytes: 3976
n = input()

l = list()
num = int(n)
for i in range(9):
    l.append(111*(i+1))

for i in range(9):
    if num == l[i]:
        print(l[i])
        break
    elif num < l[i]:
        print(l[i])
        break
    else:
        continue


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (b==0) return a;
    else{
    	return gcd(b,a%b);
    }
}
 
int main() {
	ll x,a,b;
  	cin >> x >> a >> b;
  	int s = abs(x-a);
  	int y = abs(x-b);
  	
  
  	if(y>s){
      cout << "A" << endl;
    }
  	else{
      cout << "B" << endl;
    }
}


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

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

    string s;
    cin >> s;
    int a, b, c, d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';

    for(int i = 0; i < (1<<3); ++i){
        int op[] = {1, 1, 1};
        for(int j = 0; j < 3; ++j){

            if(i & (1<<j)) op[j] = -1;

            if(a + b*op[0] + c*op[1] + d*op[2] == 7){
                cout << a << ((op[0]>0)? '+': '-') << b << ((op[1]>0)? '+': '-') << c << ((op[2]>0)? '+': '-') << d << "=7" << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;

int main() {
	int N, Y;
	int x=-1,y=-1,z=-1;
	cin >> N >> Y;
	for (int i = 0; i < 1 + Y/9000; i++) {
		for (int j = 0; j < 1 + Y / 4000; j++) {
			if (Y == 9000 * i + 4000 * j + 1000 * N&&N-i-j>=0) {
				x = i;
				y = j;
				z = N - i - j;
			}
			
		}
	}
	cout << x << " " << y << " " << z << endl;
}


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

int main()
{
  string s;
  cin >> s;
  int len = s.size();
  vector<int> child(len, 1);
  for (int i = 0; i < len; i++) {
    if (s[i] == 'R') {
      if (s[i + 1] == 'R') {
        child[i + 2] += child[i];
        child[i] = 0;
      }
    }
    if (s[len - i - 1] == 'L') {
      if (s[len - i - 2] == 'L') {
        child[len - i - 3] += child[len - i - 1];
        child[len - i - 1] = 0;
      }
    }
  }
  for (int i = 0; i < len; i++) {
    if (i == len - 1) {
      cout << child[i] << endl;
    } else {
      cout << child[i] << " ";
    }
  }

  return 0;
}


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

using namespace std;

struct coord
{
    int x,y;
};

vector<coord> v;
int a[1001][1001];
int n,m,nrb;

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

bool inBounds(coord c)
{
    if(c.x < 0 || c.x >= n || c.y < 0 || c.y >= m)
        return 0;
    return 1;
}

queue<coord> q[1000001];


void floodFill()
{
    bool flag = 1;
    while(flag)
    {
        flag = 0;
        for(int j=0; j<nrb; j++)
            if(!q[j].empty())
            {
                flag = 1;
                coord cur = q[j].front();
                q[j].pop();
                for(int i=0; i<4; i++)
                {
                    coord aux;
                    aux.x = cur.x + dx[i];
                    aux.y = cur.y + dy[i];
                    if(inBounds(aux) && a[cur.x][cur.y] + 1 < a[aux.x][aux.y])
                    {
                        q[j].push(aux);
                        a[aux.x][aux.y] = a[cur.x][cur.y] + 1;
                    }
                }
            }
    }
}

int main()
{
    cin>>n>>m;
    bool flag = 0;
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
        {
            char c;
            cin>>c;
            if(c=='#')
            {
                flag = 1;
                a[i][j] = 0;
                coord aux;
                aux.x = i;
                aux.y = j;
                q[nrb++].push(aux);
            }
            else
                a[i][j] = INT_MAX;
        }

    if(!flag)
    {
        cout<<0;
        return 0;
    }
    floodFill();

    int maxi = 0;
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            if(a[i][j]>maxi)
                maxi = a[i][j];

    cout<<maxi;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/****** define constant end ********/
/****** define variable start ******/
ll n, m;
vl a, b;
/******* define variable end *******/
int solve() {
	cin >> n >> m;
	a.resize(m);
	b.resize(m);
	vector<vector<ll>> G(n);
	REP(i, m){
		cin >> a[i] >> b[i];
		G[a[i]-1].push_back(b[i] - 1);
		G[b[i]-1].push_back(a[i] - 1);
	}
	for(auto& g : G[0]){
		for(auto& i : G[g]){
			if(i == n-1){
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;


	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 15848
import java.util.*;

public class Main {
	static final char BIG = (char)('A' - 'a');
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arrA = sc.next().toCharArray();
		char[] arrB = sc.next().toCharArray();
		char[] arrC = sc.next().toCharArray();
		StringBuilder sb = new StringBuilder();
		sb.append((char)(arrA[0] + BIG)).append((char)(arrB[0] + BIG)).append((char)(arrC[0] + BIG));
		System.out.println(sb);
	}
}


Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

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

int main()
{
  int A, B;
  cin >> A >> B;
  int ans = 0, cnt = 1;
  while (cnt < B) {
    ans++;
    cnt = (cnt - 1) + A;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
$h = Hash.new
def parse(s,env)
    if $h.has_key?(s)
        return $h[s]
    end
    case s[0]
    when "T"
        return 1
    when "F"
        return 0
    when "a"
        return env[0]
    when "b"
        return env[1]
    when "c"
        return env[2]
    when "d"
        return env[3]
    when "e"
        return env[4]
    when "f"
        return env[5]
    when "g"
        return env[6]
    when "h"
        return env[7]
    when "i"
        return env[8]
    when "j"
        return env[9]
    when "k"
        return env[10]
    when "-"
        ret = 1 - parse(s[1...s.length],env)
        $h[s] = ret
        return ret
    when "("
        index = 1
        level = 0
        while index < s.length
            if s[index] == "("
                level += 1
            elsif s[index] == ")"
                level -= 1
            elsif s[index] == "*" && level == 0
                a = parse(s[1...index],env)
                b = parse(s[(index+1)...s.length],env)
                if a == 0 || b == 0
                    $h[s] = 0
                    return 0
                else
                    $h[s] = 1
                    return 1
                end
            elsif s[index] == "+" && level == 0
                a = parse(s[1...index],env)
                b = parse(s[(index+1)...s.length],env)
                if a == 0 && b == 0
                    $h[s] = 0
                    return 0
                else
                    $h[s] = 1
                    return 1
                end
            elsif s[index] == "-" && s[index+1] == ">" && level == 0
                a = parse(s[1...index],env)
                b = parse(s[(index+2)...s.length],env)
                if a == 1 && b == 0
                    $h[s] = 0
                    return 0
                else
                    $h[s] = 1
                    return 1
                end
            end
            index += 1
        end
        return -1
    end
end
loop do
    s = gets.chomp.gsub("--","")
    break if s == "\#"
    count = 0
    [0,1].repeated_permutation(11).each do |env|
        $h = Hash.new
        a, b = s.split("=")
        count += 1 if parse(a,env) == parse(b,env)
    end
    puts count == 2**11 ? "YES" : "NO"
end

Measured memory_bytes: 6300