akhauriyash/Code-Regression huggingface dataset:
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
 
*/
/* }}} */
 
#include <bits/stdc++.h>
using namespace std;
 
// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
 
/* cpp template {{{ */
 
/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()
 
/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)
 
/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';
 
/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;
 
/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
 
/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T> void print(T x) {std::cout << x << '\n';}
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {
  REP(i, v.size()) {
    if (i != 0) std::cout << s;
    std::cout << v[i];
  }
  std::cout << '\n';
}
 
/* }}} */
 
signed main()
{
  string s;
  int k;
  cin >> s >> k;
 
  REP(i, s.size()) {
    if (s[i] == 'a') continue;
    if (k - (26 - (s[i] - 'a')) >= 0) {
      k -= (26 - (s[i] - 'a'));
      s[i] = 'a';
    }
  }
  REP(i, k % 26) {
    if (s[s.size() - 1] == 'z') {
      s[s.size() - 1] = 'a';
    } else {
      s[s.size() - 1]++;
    }
  }
  print(s);
 
  return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~(i)))
int S,N,W,E,len;
char s[100010];
int main()
{
	scanf("%s",s),len=strlen(s);
	f(i,0,len)
	{
		if(s[i]=='S')++S;
		if(s[i]=='N')++N;
		if(s[i]=='W')++W;
		if(s[i]=='E')++E;
	}
	if(!(S*N)&&S^N)return printf("No\n"),0;
	if(!(W*E)&&W^E)return printf("No\n"),0;
	return printf("Yes\n"),0;
}

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

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

  for (int x = 0; x <= N; x++) {
    for (int y = 0; x + y <= N; y++) {
      int z = N - x - y;
      if (x * 10000 + y * 5000 + z * 1000 == Y) {
        printf("%d %d %d\n", x, y, z);
        return 0;
      }
    }
  }

  printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
//abc176_d.cpp
//Sat Aug 22 20:51:49 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

int main(){
	int h,w;
	cin >> h >> w;
	P start,goal;
	cin >> start.first >> start.second;
	start.first--;start.second--;
	cin >> goal.first >> goal.second;
	goal.first--;goal.second--;

	string s[h];
	rep(i,h) cin >> s[i];

	queue<P> q;
	int visited[h][w];
	rep(i,h)rep(j,w)visited[i][j] = 0;

	int movex[4] = {1,0,-1,0};
	int movey[4] = {0,1,0,-1};

	int area = 0;
	rep(i,h){
		rep(j,w){
			if (visited[i][j]==0 && s[i][j]=='.'){
				area++;
				q.push(P(i,j));
				visited[i][j] = area;
				while(!q.empty()){
					P cur = q.front();q.pop();
					rep(k,4){
						P next = P(cur.first+movex[k],cur.second+movey[k]);
						if (next.first<0 || next.second<0 ||
							next.first>h-1 || next.second>w-1 ||
							s[next.first][next.second]=='#' ||
							visited[next.first][next.second]!=0){
							continue;
						}
						visited[next.first][next.second] = visited[i][j];
						q.push(next);
					}
				}
			}
		}
	}

	vector<int> G[area+5];
	//Search connection
	rep(i,h){
		rep(j,w){
			if (s[i][j]=='.'){
				int ca = visited[i][j];
				for (int k=-2;k<=2;k++){
					for(int l=-2;l<=2;l++){
						if ((k==0 && l==0)||
							i+k<0 || j+l<0 ||
							i+k>h-1 || j+l>w-1 ||
							s[i+k][j+l]=='#' ||
							visited[i+k][j+l]==visited[i][j]){
							continue;
						}
						int na = visited[i+k][j+l];
						int flag = 1;
						rep(m,G[ca].size()){
							if (G[ca][m]==na){
								flag = 0;
								break;
							}
						}
						if (flag){
							G[ca].push_back(na);
							G[na].push_back(ca);
						}
					}
				}
			}
		}
	}

	// rep(i,h){
	// 	rep(j,w){
	// 		cout << visited[i][j] << " ";
	// 	}
	// 	printf("\n");
	// }

	// for (int i=1;i<area+1;i++){
	// 	cout << i << "  ";
	// 	rep(j,G[i].size()){
	// 		cout << G[i][j] << " ";
	// 	}
	// 	printf("\n");
	// }

	int sa = visited[start.first][start.second];
	int ga = visited[goal.first][goal.second];
	// cout << sa << " " << ga << endl;
	if (sa == ga){
		cout << 0 << endl;
		return 0;
	}

	queue<int> q2;
	q2.push(sa);
	vector<int> visited2(area+5,-1);
	visited2[sa] = 0;
	while(!q2.empty()){
		int tmp = q2.front();q2.pop();
		// cout << tmp << endl;
		rep(i,G[tmp].size()){
			if (visited2[G[tmp][i]]!=-1)continue;
			visited2[G[tmp][i]]=visited2[tmp]+1;
			q2.push(G[tmp][i]);
			if (G[tmp][i]==ga){
				cout << visited2[G[tmp][i]] << endl;
				return 0;
			}
		}
	}

	cout << -1 << endl;
	return 0;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 18828
//#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
#include <cmath>

using namespace std;

int main(){

	int n,buf,dif;
	double D1 = 0, D2 = 0, D3 = 0, D4 = 0;

	vector <int> x, y;

	cin >> n;

	for(int i=0; i< n; i++){
		cin >> buf;
		x.push_back(buf);
	}
	for (int i = 0; i< n; i++){
		cin >> buf;
		y.push_back(buf);
	}

	for (int i = 0; i < n; i++){
		dif = abs(x[i] - y[i]);
		D1 += dif;
		D2 += pow(dif, 2);
		D3 += pow(dif, 3);
		if (dif > D4) D4 = dif;
	}
	D2 = pow(D2, 1.0 / 2.0);
	D3 = pow(D3, 1.0 / 3.0);

	cout << fixed << setprecision(6);
	cout << D1 << endl;
	cout << D2 << endl;
	cout << D3 << endl;
	cout << D4 << endl;


	return 0;
}

Measured memory_bytes: 1352
import numpy as np
from itertools import combinations
h,w,k = map(int,input().split())
grid = [list(input()) for i in range(h)]
cnt = [[0 for _ in range(w)] for __ in range(h)]
ans = 0
for i in range(w):
    for j in range(h):
        if grid[j][i] == '#':
            cnt[j][i] = 1
cnt = np.array(cnt)

h_ = [i for i in range(h)]
w_ = [i for i in range(w)]
ans = 0
h_combo = []
w_combo = []
for i in range(1,h+1):
    for h_com in combinations(h_,i):
        h_combo.append(h_com)
for i in range(1,w+1):
    for w_com in combinations(w_,i):
        w_combo.append(w_com)

for i in h_combo:
    for j in w_combo:
        cnt2 =cnt.copy()
        for i2 in i:
            cnt2[i2,:] = 0
            for j2 in j:
                cnt2[:,j2] = 0
                
        if sum(sum(cnt2)) == k:
            ans += 1
            
for i in h_combo:
    cnt2 =cnt.copy()
    for i2 in i:
        cnt2[i2,:] = 0
    if sum(sum(cnt2)) == k:
            ans += 1
for j in w_combo:
    cnt2 =cnt.copy()
    for j2 in j:
        cnt2[:,j2] = 0
    if sum(sum(cnt2)) == k:
        ans += 1
        
if sum(sum(cnt)) == k:
    ans += 1

print(ans)

Measured memory_bytes: 27188
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> v(n);int b;
    for(int i=0;i<n;i++) {cin>>v[i];}
    v.erase(unique(v.begin(),v.end()),v.end());
    for(int i=0;i<v.size();i++){
        if(i!=0)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;

}


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

#define      ll     long long int

int main()
{
    int n, y, dosh, pach, ek;
    int s = 0;
    cin >> n >> y;
    int i, j, k;
    for (i = 0; i * 10000 <= y; i++) {
        for (j = 0; j * 5000 <= y; j++) {
            //cout << i << ' ' << j << '\n';
            k = (y - (i * 10000) - (j * 5000)) / 1000;
            if (k >= 0 && i + j + k == n) {
                cout << i << ' ' << j << ' ' << k << '\n';
                return 0;
            }
        }
    }
    //cout << i << ' ' << j << '\n';
    cout << "-1 -1 -1\n";
    return 0;
}

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

int main(){
  
  int X,A,N,L;
  int result=0;
  int flag=1;
  int count = 0;

  cin >> N;
  vector<int> num(N,0);

  for(int i=0; i < N; i++){
    cin >> num[i];
  }
  for(int i=0; i < (N-2); i++){
    int minimum = min(min(num[i],num[i+1]),num[i+2]);
    int maximum = max(max(num[i],num[i+1]),num[i+2]);
    if((num[i+1] != minimum)&&(num[i+1] != maximum)){
      count++;
    }
  }

  cout << count << endl;
  return(0);
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = list(input())
    K = int(input())

    result = 1

    for s in S[:K]:
        if int(s) > result:
            result = int(s)
            break

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import static java.util.Arrays.deepToString;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}
	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int C = sc.nextInt();
			int R = sc.nextInt();
			if (R == 0) break;
			int[][] a = new int[R][C];
			for (int i = 0; i < R; i++) {
				for (int j = 0; j < C; j++) {
					char c = sc.next().charAt(0);
					a[i][j] = "RGB".indexOf(c);
				}
			}
			
			int[][] org = copy(a);
			
			int limit = 0;
			for (;;) {
				boolean change = false;
				loop:
				for (int i = 0; i < R; i++) {
					for (int j = 0; j < C; j++) {
						if (a[0][0] != a[i][j]) {
							fill(a, 0, 0, a[0][0], a[i][j]);
							limit++;
							change = true;
							break loop;
						}
					}
				}
				if (!change) break;
			}
			
			ans = limit;
			vis = new int[R][C];
			viskey = 1;
			int start = count(org, 0, 0, org[0][0]);
			dfs(0, org[0][0], copy(org), start);
			System.out.println(ans);
		}
	}
	
	
	int ans;
	void dfs(int depth, int prev, int[][] a, int cl) {
		if (cl == a.length * a[0].length) {
			ans = depth;
			return;
		}
		if (depth + 1 >= ans) return;
		for (int i = 0; i < 3; i++) {
			if (i != prev) {
				int[][] b = copy(a);
				fill(b, 0, 0, prev, i);
				++viskey;
				int ncl = count(b, 0, 0, b[0][0]);
				dfs(depth + 1, i, b, ncl);
			}
		}
	}
	
	int[][] copy(int[][] a) {
		int[][] res = new int[a.length][];
		for (int i = 0; i < a.length; i++) res[i] = a[i].clone();
		return res;
	}
	
	int viskey;
	int[][] vis;
	int count(int[][] a, int r, int c, int base) {
		if (0 <= r && r < a.length && 0 <= c && c < a[0].length) {
			if (a[r][c] == base && vis[r][c] != viskey) {
				vis[r][c] = viskey;
				int fl = 1;
				fl += count(a, r + 1, c, base);
				fl += count(a, r - 1, c, base);
				fl += count(a, r, c + 1, base);
				fl += count(a, r, c - 1, base);
				return fl;
			}
		}
		return 0;
	}
	
	void fill(int[][] a, int r, int c, int base, int v) {
		if (0 <= r && r < a.length && 0 <= c && c < a[0].length) {
			if (a[r][c] == base) {
				a[r][c] = v;
				fill(a, r + 1, c, base, v);
				fill(a, r - 1, c, base, v);
				fill(a, r, c + 1, base, v);
				fill(a, r, c - 1, base, v);
			}
		}
	}
	
}

Measured memory_bytes: 114016
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
using ii = pair<i64, i64>;

bool used[101010];

int main() {
    int n;
    cin >> n;
    vector<ii> vs;
    i64 sum = 0, suma = 0, sumb = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        vs.push_back(ii(a, i));
        suma += a;
        vs.push_back(ii(b, i));
        sumb += b;
    }
    sort(vs.begin(), vs.end());
    int ok = false;
    for (int i = 0; i < n; i++) {
        sum += vs[i].first;
        if (used[vs[i].second]) {
            ok = true;
        }
        used[vs[i].second] = 1;
    }

    if (ok) {
        cout << min({suma, sumb, sum}) << endl;
        return 0;
    }

    if (vs[n - 1].second != vs[n].second) {
        cout << min({sum - vs[n - 1].first + vs[n].first, suma, sumb}) << endl;
        return 0;
    }

    cout << min({sum - vs[n - 1].first + vs[n + 1].first, sum - vs[n - 2].first + vs[n].first, suma, sumb}) << endl;
}

Measured memory_bytes: 6384
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<sstream>
#include<vector>
#include<map>

using namespace std;
string t,num;
int mex;
int cnt;
int int_t;
string ans_s;

void dfs(int p,int total,string s)
{
  //cout << "now s : " <<s << " p = " << p <<" total = " << total << endl; 
  if(p >= num.size())
    {
      if(int_t >= total && total == mex)
	{
	  cnt++;
	}
      else if(int_t >= total && total > mex)
	{
	  cnt = 1;
	  mex = total;
	  ans_s = s;
	}
      return;
    }

  for(int i=p;i<num.size();i++)
    {
      dfs(i+1,total + (atoi)(num.substr(p,i-p+1).c_str()),s+" "+num.substr(p,i-p+1));
    }

    

}

int main()
{
 
  while(cin >> t >> num,((atoi)(t.c_str()) || (atoi)(num.c_str())))
    {
      int pre = 0;
      for(int i=0;i<num.size();i++)
	{
	  pre += num[i]-'0';
	}      
    

      bool F = false;
      int_t = (atoi)(t.c_str());
      if(t == num)
	{
	  cout << t << " " << num << endl;
	  F = true;
	}

      if(!F)
	{
	  mex = -1,cnt = 0;
	  dfs(0,0,"");  
	 
	  if(cnt > 1)
	    cout << "rejected" << endl;
	  else if(mex != -1)
	    cout << mex << ans_s << endl;
	  else 
	    cout << "error" << endl;
	}
      
     


    }
  return 0;
}

Measured memory_bytes: 1208
#!/usr/bin/env python
# -*- coding:utf-8 -*-
w = int(input())
n = int(input())
v_lines = [i for i in range(1,w+1)]
for i in range(n):
    a,b = list(map(int, input().split(',')))
    t = v_lines[a-1]
    v_lines[a-1] = v_lines[b-1]
    v_lines[b-1] = t
for i in range(len(v_lines)):
    print(v_lines[i])

Measured memory_bytes: 7664
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const uint64_t R = 1'000'000'007L;

uint64_t dpow(uint64_t x, uint64_t y)
{
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return dpow(x * x % R, y / 2);
    } else {
        return x * dpow(x, y - 1) % R;
    }
}

uint64_t inv(uint64_t x)
{
    return dpow(x, R - 2);
}

uint64_t comb(uint64_t n, uint64_t k)
{
    uint64_t a = 1, b = 1;
    for (uint64_t i = 0; i < k; i++) {
        a *= (n - i);
        a %= R;
        b *= i + 1;
        b %= R;
    }
    return a * inv(b) % R;
}

uint64_t perm(uint64_t n, uint64_t k)
{
    uint64_t r = 1;
    for (uint64_t i = 0; i < k; i++) {
        r *= (n - i);
        r %= R;
    }
    return r;
}

string grid[300];

int main()
{
    int n;
    cin >> n;
    rep(i, n)
    {
        cin >> grid[i];
    }

    int64_t result = 0;
    rep(a, n)
    {
        bool symmetric = true;
        rep(i, n) rep(j, n)
        {
            symmetric = symmetric && grid[(i + a) % n][j] == grid[(j + a) % n][i];
        }
        if (symmetric) {
            result += n;
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int answer=45;
int point;
int data1[16];

int nannyakonokannsuu(){
	int Ret=0;
	for(int i=0;i<16;i++){
		if(data1[i]!=15)Ret+=abs(i/4-data1[i]/4)+abs(i%4-data1[i]%4);
	}
	return Ret;
}

int swap(int i,int j){
	int t=data1[i];

	data1[i]=data1[j];
	data1[j]=t;
}

void find(int yokuwakarannatai,int move){
	int d=nannyakonokannsuu();
	if(move+d>answer)return;
	if(d==0){
		answer=move;
		return;
	}
	if(yokuwakarannatai!=1&&point>3  )swap(point,point-4),point-=4,find(0,move+1),point+=4,swap(point,point-4);
	if(yokuwakarannatai!=0&&point<12 )swap(point,point+4),point+=4,find(1,move+1),point-=4,swap(point,point+4);
	if(yokuwakarannatai!=3&&point%4>0)swap(point,point-1),point-=1,find(2,move+1),point+=1,swap(point,point-1);
	if(yokuwakarannatai!=2&&point%4<3)swap(point,point+1),point+=1,find(3,move+1),point-=1,swap(point,point+1);
}

int main(){
	for(int i=0;i<16;i++){
		int t;
		scanf("%d",&t);
		if(t)data1[i]=t-1;
		else{
			data1[i]=15;
			point=i;
		}
	}
	find(-1,0);
	printf("%d\n",answer);
}



Measured memory_bytes: 2132
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

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

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


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


Measured memory_bytes: 15288
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		int max=10000000;
		int p=0;
		int[] prime=new int[max];
		boolean[] isPrime=new boolean[max+1];
		Arrays.fill(isPrime, true);
		isPrime[0]=isPrime[1]=false;
		for(int i=2; i<=max; i++){
			if(isPrime[i]){
				prime[p++]=i;
				for(int j=2*i; j<=max; j+=i){
					isPrime[j]=false;
				}
			}
		}

		for(;;){
			int n=sc.nextInt();
			if(n==0){
				break;
			}
			for(;; n--){
				if(isPrime[n-8]&&isPrime[n-6]&&isPrime[n-2]&&isPrime[n]){
					println(""+n);
					break;
				}
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 61000
from sys import stdin
f_i = stdin

D, G = map(int, f_i.readline().split())

score_data = []
for i in range(1, D + 1):
    p, c = map(int, f_i.readline().split())
    score = i * 100
    score_data.append((score, p, c))
score_data.sort(reverse=True)

count_rec = []
def dfs(i, score, count, unsolved):
    if score >= G:
        count_rec.append(count)
    elif i == D:
        if unsolved:
            s, p, c = score_data[unsolved[0]]
            remain = G - score
            if s * p >= remain:
                if remain % s == 0:
                    count_rec.append(count + remain // s)
                else:
                    count_rec.append(count + remain // s + 1)
    else:
        s, p, c = score_data[i]
        dfs(i + 1, score + s * p + c, count + p, unsolved)
        dfs(i + 1, score, count, unsolved + [i])

dfs(0, 0, 0, [])
print(min(count_rec))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#define COUT(x) cout<<(x)<<endl
template<class T> inline void chmax(T& a, T b) {
  if (a < b) a = b;
}

template<class T> inline void chmin(T& a, T b) {
  if (a > b) a = b;
}

const long long INF = 1LL << 60;

int main() {
  int N;
  cin >> N;
  int a[N][3];
  for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];
  long long dp[N + 10][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;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }  
    }
  }
  long long ans = 0;
  for (int i = 0; i < 3; ++i) chmax(ans, dp[N][i]);
  COUT(ans);
}

Measured memory_bytes: 3712
# -*- coding:utf8 -*-
import math

n, d = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        t = math.sqrt(sum([(l[i][k] - l[j][k]) * (l[i][k] - l[j][k]) for k in range(d)]))
        if t == math.ceil(t):
            ans += 1
print(ans)



Measured memory_bytes: 3064
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}
use input::*;
use std::cmp;
use std::collections::BTreeMap;
fn main() {
    let n: usize;
    input!(n);
    let mut map = BTreeMap::new();
    let mut first_flag = true;
    for _ in 0..n {
        let s = str2vec(&input_line_str());
        if first_flag {
            first_flag = false;
            for c in &s {
                let po = map.entry(*c).or_insert(0);
                *po += 1;
            }
        }
        let mut map_buf = BTreeMap::new();
        for c in s {
            let po = map_buf.entry(c).or_insert(0);
            *po += 1;
        }
        for (i, x) in map_buf.iter_mut() {
            map.entry(*i).or_insert(0);
            *x = cmp::min(*x, map[i]);
        }
        map = map_buf;
    }
    for (i, x) in &map{
        for _ in 0..*x {
            print!("{}", i);
        }
    }
    println!("");
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n;
  cin>>n;
  double ans;
  if(n%2==0){
    ans=1.0/2.0;
//    cout<<ans<<endl;
  }
  else{
    ans=(n+1)/2;
    ans=ans/n;
  }
  printf("%12lf\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

void slove(void){
	set<string> S;
	string s, revs;
	cin >> s;
	int size = s.size();
	for (int i = size - 1; i >= 0; --i) revs += s[i];

	reps(i, 1, size){//??????????????????????????§?????????
		string s1, s2, revs1, revs2;
		s1 = s.substr(0, i);//????????¨???
		s2 = s.substr(i);//????????¨???
		revs2 = revs.substr(0, size - i);//?????????ver
		revs1 = revs.substr(size - i);//?????????ver
		//cout << i << s1 << endl << s2 << endl << revs1 << endl << revs2 << endl;
		//?????????????????????????????????
		S.insert(s1 + s2);
		S.insert(s2 + s1);
		S.insert(s1 + revs2);
		S.insert(revs2 + s1);
		S.insert(revs1 + s2);
		S.insert(s2 + revs1);
		S.insert(revs1 + revs2);
		S.insert(revs2 + revs1);
	}
	cout << S.size() << endl;
	return;
}

int main(void){
	int n;
	cin >> n;
	rep(i, n) slove();

	return 0;
}

Measured memory_bytes: 3248
package main

import (
	"fmt"
)

func main() {
	var H, W int
	for {
		fmt.Scan(&H)
		fmt.Scan(&W)

		if H == 0 && W == 0 {
			break
		}

		m := mark{flg: 1}
		for h := 0; h < H; h++ {
			if h%2 == 0 {
				m.flg = 1
			} else {
				m.flg = -1
			}
			for w := 0; w < W; w++ {
				m.draw()
			}
			fmt.Println()
		}
		fmt.Println()
	}
}

type mark struct {
	flg int
}

func (m *mark) draw() {
	if m.flg == 1 {
		fmt.Print("#")
	} else {
		fmt.Print(".")
	}
	m.flg *= -1
}



Measured memory_bytes: 1128
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  int s = in();
  vector<ll> line(n);
  foreach(i,line)i=in();
  vector<ll> dp(3001,0);
  dp[0] = 1;
  ll ans = 0;
  foreach(i,line){
    vector<ll> ndp(3001,0);
    per(j,3001-i){
      ndp[j+i] = (ndp[j+i]+dp[j]) % MOD;
    }
    rep(i,3001){
      ndp[i] = (ndp[i] + dp[i]*2) % MOD;
    }
    dp = ndp;
  }
  ans += dp[s];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3764
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define VAR(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int N;

inline i64 findLCA(int a, int b) {
    if (N == 1) return min(a, b);

    while (a != b) {
        if (a > b)
            a = (a - 1) / N;
        else
            b = (b - 1) / N;
    }
    return a;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int Q;
    read(N, Q);

    while (Q--) {
        VAR(int, a, b);
        --a, --b;
        print(findLCA(a, b) + 1);
    }

    return 0;
}


Measured memory_bytes: 1280
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 750;

pii dfs(int u, int c);
inline int choose2(int x);

bool mat[N][N], have[2 * N], nxt[2 * N];
int color[N];
vector<int> g[N];

int main() {
	fast_cin();
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		mat[u][v] = mat[v][u] = 1;
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (!mat[i][j] and i != j) {
				g[i].pb(j);
			}
		}
	}
	vector<pii> sums;
	for (int i = 1; i <= n; ++i) {
		if (!color[i]) {
			pii temp = dfs(i, 1);
			if (temp.first == -1) {
				cout << -1;
				return 0;
			}
			sums.pb(temp);
		}
	}
	have[0] = 1;
	for (auto &p : sums) {
		memset(nxt, 0, sizeof(nxt));
		for (int i = n; i >= 0; --i) {
			if (have[i]) {
				nxt[i + p.first] = true;
				nxt[i + p.second] = true;
			}
		}
		for (int i = 0; i <= n; ++i) {
			have[i] = nxt[i];
		}
	}
	int best = choose2(n);
	for (int i = 0; i <= n; ++i) {
		if (have[i]) {
			best = min(best, choose2(i) + choose2(n - i));
		}
	}
	cout << best << endl;
}

pii dfs(int u, int c) {
	pii ans = {0, 0};
	color[u] = c;
	if (c == 1) {
		++ans.first;
	} else {
		++ans.second;
	}
	for (auto &v : g[u]) {
		if (color[v] == color[u]) {
			return {-1, -1};
		} else if (color[v] == 0) {
			pii temp = dfs(v, 3 - c);
			if (temp.first == -1) {
				return temp;
			} else {
				ans.first += temp.first;
				ans.second += temp.second;
			}
		}
	}
	return ans;
}

inline int choose2(int x) {
	return (x * (x - 1)) / 2;
}

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

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;
const int maxn = 2E5 + 5;

int val[maxn], lis[maxn], ans[maxn];
vector<int> adj[maxn];

void dfs(int now, int lst, int sz) {
    int change_place, original_value;
    
    if (val[now] > lis[sz]) {
        change_place = ++sz;
        original_value = 0;
        lis[sz] = val[now];
    }
    else {
        int pl = lower_bound(lis+1, lis+sz, val[now]) - lis;
        change_place = pl;
        original_value = lis[pl];
        lis[pl] = val[now];
    }
    
    ans[now] = sz;
    
    for (auto x : adj[now]) {
        if (x != lst) dfs(x, now, sz);
    }
    
    lis[change_place] = original_value;
}

int32_t main() {
    fastIO();
    
    int n, u, v;
    cin >> n;
    
    for (int i = 1; i <= n; ++i) cin >> val[i];
    
    for (int i = 0; i < n-1; ++i) {
        cin >> u >> v, adj[u].eb(v), adj[v].eb(u);
    }
    
    dfs(1, -1, 0);
    
    for (int i = 1; i <= n; ++i) cout << ans[i] << "\n";
    
    return 0;
}

Measured memory_bytes: 34924
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    string s;
    int p;
    vector<pair<pair<string,int>,int>> pair(n);
    rep(i, n){
        cin >> s >> p;
        pair[i] = make_pair(make_pair(s,-p), i);
    }
    sort(pair.begin(), pair.end());
    rep(i,n){
        cout << pair[i].second+1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3612
import sys
from math import ceil

def input():
    return sys.stdin.readline().strip()

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def nok(a, b):
    m = a * b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a + b)    


def main():
    a = list(input())
    if a[0] == a[1] or a[1] == a[2] or a[3] == a[2]:
        print("Bad")
        return 0
    print("Good")
    
    
    
    
main() 

Measured memory_bytes: 3064