akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,m = map(int,input().split())
can_flag = 0 #if 1 possible
from_1 = []
to_n = []
for i in range(m):
    s,d = map(int,input().split())
    if s == 1: from_1.append(d)
    if d == n: to_n.append(s)
from_1.sort()
to_n.sort()
idx_from = 0
idx_to = 0
#print(from_1,to_n)
while idx_from != len(from_1) and idx_to != len(to_n):
    if from_1[idx_from] == to_n[idx_to]:
        can_flag = 1
        break
    elif from_1[idx_from] > to_n[idx_to]:
        idx_to += 1
    else: idx_from += 1
if can_flag: print("POSSIBLE")
else: print("IMPOSSIBLE")

Measured memory_bytes: 11436
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
-----------------------
local a = read.n()
print(a+a*a+a*a*a)

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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  if(n % 2 == 0)
    cout << (n / 2) * (n / 2);
  else
    cout << (n / 2) * (n / 2 + 1);
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
const ll MOD = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll N,M;
    cin >> N >> M;
    UnionFind uni(N);
    vector<int> A(M),B(M);
    vector<ll> ans;
    rep(i,M){
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;
    }
    ll now = (N)*(N-1)/2;
    ans.push_back(now);
    for(int i=M-1;i>=0;i--){
        //i番目の辺から繋げていく
        if(!uni.findSet(A[i],B[i])){
            now -= uni.size(A[i])*uni.size(B[i]);
            uni.unionSet(A[i],B[i]);
            ans.push_back(now);
        }else{
            ans.push_back(ans.back());
        }
    }
    ans.resize(M);
    reverse(ALL(ans));
    for(auto x:ans)cout << x << endl;
}

Measured memory_bytes: 3444
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int H, W;
    scan(H, W);
    auto b = new bool[][](H, W);
    foreach (i ; 0 .. H) {
        b[i] = readln.chomp.map!(c => c == '.').array;
    }

    debug {
        writeln(b);
    }

    auto u = new int[][](H, W);
    auto d = new int[][](H, W);
    auto r = new int[][](H, W);
    auto l = new int[][](H, W);

    foreach (i ; 1 .. H) {
        foreach (j ; 0 .. W) {
            if (b[i - 1][j]) u[i][j] += u[i - 1][j] + 1;
        }
    }

    foreach_reverse (i ; 0 .. H - 1) {
        foreach (j ; 0 .. W) {
            if (b[i + 1][j]) d[i][j] += d[i + 1][j] + 1;
        }
    }

    foreach (j ; 1 .. W) {
        foreach (i ; 0 .. H) {
            if (b[i][j - 1]) l[i][j] += l[i][j - 1] + 1;
        }
    }

    foreach_reverse (j ; 0 .. W - 1) {
        foreach (i ; 0 .. H) {
            if (b[i][j + 1]) r[i][j] += r[i][j + 1] + 1;
        }
    }

    int ans;

    foreach (i ; 0 .. H) {
        foreach (j ; 0 .. W) {
            if (!b[i][j]) continue;
            chmax(ans, u[i][j] + d[i][j] + l[i][j] + r[i][j] + 1);
        }
    }

    writeln(ans);
}














void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

int main(void){
	char cap[1001];
	int i, strl;
	
	scanf("%[^\n]",cap);
	
	strl = strlen(cap);
	
	for(i=0;i<=strl;++i){
		if(cap[i]<='z' && cap[i]>='a'){
			cap[i] = cap[i]-0x20;
		}
	}
	
	printf("%s\n",cap);
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long ;
using P = pair<ll, ll>;
const ll INF = 1e16;

void solver(int N, int M, vector<P> const &ab, vector<P> const &cd, vector<int> &ans){

    ll dx{}, dy{}, dist = INF, dist_buf = INF;
    int pos{};
    for(int i = 0; i != N; ++i){
        for(int j = 0; j != M; ++j){
            dx = abs(ab.at(i).first - cd.at(j).first);
            dy = abs(ab.at(i).second - cd.at(j).second);
            dist_buf = dx + dy;
            
            if(dist > dist_buf){
                dist = dist_buf;
                pos = j+1;
            }
            dist_buf = INF; 
        }
        ans.at(i) = pos;
        dist = INF;
        pos = 0;
    }

    return;
}

int main(){

    int N, M;
    cin >> N >> M;
    vector<P> ab(N);
    vector<P> cd(M);
    for(auto iter = ab.begin(); iter != ab.end(); ++iter) cin >> (*iter).first >> (*iter).second;
    for(auto iter = cd.begin(); iter != cd.end(); ++iter) cin >> (*iter).first >> (*iter).second;

    vector<int> ans(N);
    solver(N, M, ab, cd, ans);

    for(auto iter = ans.begin(); iter != ans.end(); ++iter) cout << *iter << endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = 0;
        sc.close();
        for (int i=a; i<=b; i++){
            if(c%i==0)++n;            
        }
        System.out.println(n);
    }
}

Measured memory_bytes: 26316
#include <stdio.h>
int main(){
    int c1,c5,c10,c50,c100,c500;
    int result=0;
    scanf("%d%d%d%d%d%d",&c1,&c5,&c10,&c50,&c100,&c500);
    /*if (5<=c1||2<=c5||5<=c10||2<=c50||5<=c100||2<=c500){
        result = 1;
    }*/
    if(1000<=c500*500+c100*100+c50*50+c10*10+c5*5+c1){
        result = 1;
    }
    printf("%d\n",result);
    return 0;
}

Measured memory_bytes: 1852
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;
int main(){
	int r,c;
	while(cin>>r>>c,!(r==0&&c==0)){
		if(r%2==0||c%2==0) cout<<"yes\n";
		else cout<<"no\n";
	}
	return 0;
}

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



int main()
{
    int x,y;
    cin>>x>>y;
    if(y%2!=0)
    {
        cout<<"No"<<endl;
        
    }
    else if(y/2<x)
    {
        cout<<"No"<<endl;
    }
    else if(2*x<y/2)
    {
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 3644
#include<stdio.h>

int main() {
   int x,tmp;
   scanf("%d",&x);
   int i,max = 0,sum=0;
   for(i=0; i<x; i++){
    scanf("%d",&tmp);
    if(max<=tmp){
        max = tmp;
        sum++;
    }
    
   }
   printf("%d",sum);
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}

const i32 mod = 1000000007;

i32 mod_pow (i32 r, i32 n) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 inv (i32 a) {
  return mod_pow (a, mod - 2);
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

void run (void) {
  i32 b, w;
  scanf ("%" SCNi32 "%" SCNi32, &b, &w);
  init_fact (b + w);
  const i32 q = inv (2);
  i32 pb = 0;
  i32 pw = 0;
  for (i32 i = 1, qq = q; i <= b + w; ++i, qq = (i64) qq * q % mod) {
    i64 prob = (i64) q * (1 + 2 * mod - pb - pw) + pw;
    print_int (prob % mod);
    putchar ('\n');
    if (i >= b) {
      pb = (pb + (i64) comb (i - 1, b - 1) * qq) % mod;
    }
    if (i >= w) {
      pw = (pw + (i64) comb (i - 1, w - 1) * qq) % mod;
    }
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 3712
//abc158_c.cpp
//Sat Mar  7 20:43:18 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

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

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

	double motob = b/0.1;

	while (motob<(b+1)*10){
		if (floor(motob*0.08)==a){
			cout << motob << endl;
			return 0;
		}
		motob++;
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  string s; cin >> s;
  s = string(s.size(), 'x');
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<ll,ll> PII;
typedef vector<ll> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+5;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

void solve(){
	int n,x,y;
	cin>>n>>x>>y;
	VI ans(n,0);
	rep(i,1,n+1)
	rep(j,i+1,n+1)
	ans[min({abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x)})]++;
	rep(i,1,n)cout<<ans[i]<<endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

int main()
{
    const std::string w[] = {"Sunny", "Cloudy", "Rainy"};
    int  N = 0;
    int i = 2;;

    std::cin >> N;
    // Output

    if (N % 2 == 0) {
        printf("0.5\n");
    } else {
        printf("%f\n", (double)(N - N/2 ) / (double)N);
    }
    return 0;
}


Measured memory_bytes: 256
# N M C
# B1 B2 ... BM
# A11 A12 ... A1M
# AN1 AN2 ... ANM
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
cnt = 0
s = 0

for _ in range(N):
    A = list(map(int, input().split()))
    for i in range(M):
        s += B[i] * A[i]
    s += C
    if s > 0:
        cnt += 1
    s = 0
print(cnt)

Measured memory_bytes: 3060
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if ( (a == 7 && b == 5 && c == 5) || (a == 5 && b == 7 && c == 5) || (a == 5 && b == 5 && c == 7) ) 
        printf("YES\n");
    else printf("NO\n");
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int alice=0,bob=0;

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

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

    /*
    for(int i=0;i<n;i++){
        cout << a.at(i) << endl;
    }
    */
   for(int i=0;i<n;i++){
       if(i%2==0){
           alice += a.at(i);
           //cout << "alice" << a.at(i) << " " << alice << endl;
       }else{
           bob += a.at(i);
           //cout << "bob" << a.at(i) << " " << bob << endl;
       }
   }
   cout << alice - bob << endl;    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
	class Program
	{
		static int[] In => Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());
			for (int i = 1; i <= 3500; i++)
			{
				for (int j = 1; j <= 3500; j++)
				{
					double b = 1 / ((4 / (double)N) - (1 / (double)i + 1 / (double)j));
					for (long k = (long)(b - 1); k <= (long)(b + 1); k++)
					{
						if (k <= 0) continue;
						long a = 4 * (long)i * j * k;
						if (a == N * ((long)i * j + (long)j * k + (long)i * k))
						{
							Console.WriteLine(i + " " + j + " " + k);
							//Console.ReadLine();
							return;
						}
					}
				}
			}
		}
	}
}

Measured memory_bytes: 13268
#include<iostream>
#include <algorithm>
using namespace std;
struct node{
	long long num;
	int id;
	int numx;
}a[2000007];
node b[2000007];
long long tree[2000007];
inline int lowbit(int x) {
	return (x & -x);
}
void add(int x, int v) {
	for (int i = x; i <= 200007; i += lowbit(i)) {
		tree[i] += v;
	}
}
long long get(int x) {
	long long sum = 0;
	for (int i = x; i  ; i -= lowbit(i)) {
		sum += tree[i];
	}
	return sum;
}
int cmp(node a,node b){
	return a.num<b.num;
}
int cmp2(node a,node b){
	return a.id<b.id;
}
int main() {
	ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	b[0].num=a[0].num=0;
	for(int i = 1; i <= n; i++) {
		cin >> a[i].num;
		a[i].num-=k;
		a[i].id=i;
		b[i].num=b[i-1].num+a[i].num;
		b[i].id=i;
	}
	b[0].id=0;
	sort(b,b+1+n,cmp);
	int t=1;
	b[0].numx=1;
	for (int i = 1; i <=n ; ++i)
	{	
		b[i].numx=b[i].num==b[i-1].num?t:++t;
	  
	}
	sort(b,b+1+n,cmp2);
	long long sum=0;
	for (int i = 0; i <=n ; ++i)
	{
	//cout<<a[i].num<<" "<<b[i].num<<" "<<b[i].numx<<endl;	
	}

	for(int i=n;i>=0;i--){

		
	//	cout<<i<<" "<<b[i].numx-1<<" "<<get(n+1)<<" "<<get(b[i].numx-1)<<endl;
		sum+=get(n+1)-get(b[i].numx-1);
		add(b[i].numx,1);
	}

	cout << sum << endl;
}

Measured memory_bytes: 14080
#include <iostream>
#include <vector>
using namespace std;
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;

int N;
long long ma, mb;
vector<long long> a, b, c;

long long dp[51][510][510];

int main() {
    cin >> N >> ma >> mb;
    a.resize(N); b.resize(N); c.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i] >> b[i] >> c[i];
    
    for (int i = 0; i < 51; ++i) for (int j = 0; j < 510; ++j) for (int k = 0; k < 510; ++k) dp[i][j][k] = INF;
    dp[0][0][0] = 0;
    for (int i = 0; i < N; ++i) {
        for (int wa = 0; wa < 500; ++wa) {
            for (int wb = 0; wb < 500; ++wb) {
                
                // 使わない
                chmin(dp[i+1][wa][wb], dp[i][wa][wb]);

                // 使う
                chmin(dp[i+1][wa+a[i]][wb+b[i]], dp[i][wa][wb] + c[i]);
            }
        }
    }
    long long res = INF;
    for (int wa = 1; wa < 500; ++wa) {
        for (int wb = 1; wb < 500; ++wb) {
            if (wa * mb != wb * ma) continue;
            chmin(res, dp[N][wa][wb]);
        }
    }
    if (res < INF) cout << res << endl;
    else cout << -1 << endl;
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

vector<ll> fact;
int N;
const int mod = 998244353;

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * x % mod;
            x = x * x % mod;
            n >>= 1;
    }
    return res;
}

ll inv(int k) {
    return mod_pow(k, mod - 2, mod);
}

ll comb(ll n, ll r) {
    return ((fact[n] * inv(fact[r]) % mod) * inv(fact[n - r])) % mod;
}

void init() {
    fact.resize(10000);
    fact[0] = 1;
    for (int i = 1; i < 10000; i++) {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
}

void solve() {
    string s;
    cin >> s;
    N = s.size();
    init();
    vector<vector<int>> dp(N + 1, vector<int>(N + 1));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            if (!dp[i][j]) continue;
            int k = i - j;
            int pj = 0, pk = 0;
            if (s[i] == '0') pj = 2;
            else if (s[i] == '1') {pj = 1; pk = 1;}
            else {pk = 2;}

            if (j - 1 + pj >= 0) {
                dp[i + 1][j - 1 + pj] += dp[i][j];
                dp[i + 1][j - 1 + pj] %= mod;
            } 
            if (k - 1 + pk >= 0) {
                dp[i + 1][j + pj] += dp[i][j];
                dp[i + 1][j + pj] %= mod;
            }
        }
    }

    ll ans = 0;
    for (int j = 0; j <= N; j++) {
        ans += dp[N][j] * comb(N, j);
        ans %= mod;
    }
    cout << ans << endl;
    
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int X; cin >> X;
    int ans = 0;
    ans += X / 500 * 1000;
    X %= 500;
    ans += X / 5 * 5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    char s[100];
    cin >> n;
    cin >> s;
    int c = 0;
    for (int i = 0; i < n-2; i++)
    {
        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
        c ++;
    }
    cout << c << endl;
    return 0;
}

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

vector<int> A;
int n;

int canFill(int k,int aim){
    int i=0,j=0;
    for(j=0;j<k;j++){
        long int s=0;
        while(s+A[i]<=aim){
            s+=A[i];
            //cout<<"s= "<<s<<"i= "<<i<<endl;
            i++;
            if(i==n) return n;
        }
    }
    return i;
}

int binerySearch(int k,long int left,long int right){
    int mid=0;
    //cout<<left<<"  "<<right<<endl;
    while(right-left>1){
        mid=left+(right-left)/2;
        //cout<<"??? "<<canFill(k,mid)<<endl;
        if(canFill(k,mid)>=n){
            right=mid;
        }else left=mid;
    }
    return right;
}

int main(){
    int k;
    int temp;
    long int sum=0,maxn=-1;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>temp;
        sum+=temp;
        maxn=temp>maxn? temp:maxn;
        A.push_back(temp);
    }
    temp=binerySearch(k,maxn-2,sum);
    cout<<temp<<endl;
    return 0;
}



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

using namespace std;

long long gcd(long long a, long long b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int ttt;
	cin >> ttt;
	while (ttt--) {
		long long a, b, c, d;
		cin >> a >> b >> c >> d;
		if (a < b || d < b) {
			cout << "No" << endl;
			continue;
		}
		long long g = gcd(b, d);
		g = g - a % g;
		if (b - g > c) {
			cout << "No" << endl;
		} else {
			cout << "Yes" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt();
        int G = sc.nextInt();
        int B = sc.nextInt();
        int N = sc.nextInt();

        int count = 0;

        int Rmax = N / R;
        for (int i = 0; i <= Rmax; i++) {

            int remR = N - (R * i);
            int Gmax = remR / G;

            for (int j = 0; j <= Gmax; j++) {
                int remG = remR - (G * j);
                if (remG % B == 0){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23892
-- -- Getting Started - Prime Numbers

import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  n  <- readLn
  xs <- map read <$> replicateM n getLine
  print $ length $ filter isPrime xs

isPrime :: Integral a => a -> Bool
isPrime n = n > 1 && foldr f True divs
  where
    divs = 2 : 3 : concat [[x - 1, x + 1] | x <- [6, 12 ..]]
    f p b = (p * p > n) || (rem n p /= 0 && b)



Measured memory_bytes: 9124
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	c := make([][]int, 3)
	for i := range c {
		c[i] = make([]int, 3)
		for j := range c[i] {
			c[i][j] = getInt()
		}
	}

	a := make([]int, 3)
	b := make([]int, 3)

	a[0] = 0

	for i := range b {
		b[i] = c[0][i] - a[0]
	}
	for i := range a {
		a[i] = c[i][0] - b[0]
	}

	ans := "Yes"
	for i := range a {
		for j := range b {
			if ng := (a[i] + b[j]) != c[i][j]; ng {
				ans = "No"
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

int main(){
	int a,b,c;
	cin>>a>>b;
	c=(2*b+a-1)*a/2;
	if(b>0)c-=b;
	if(a+b<=0)c-=a+b-1;
	cout<<c<<endl;
}


Measured memory_bytes: 256
def main():
  s = input().strip()
  ss = set(s)
  if len(ss) == 2:
    if s.count(s[0]) == 2 and s.count(s[1]) == 2 and s.count(s[2]) == 2 and s.count(s[3]) == 2:
      print('Yes')
    else:
      print('No')
  else:
    print('No')


if __name__ == '__main__':
  main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define sws ios_base::sync_with_stdio(false)
#define MOD 1000000007
#define ll long long
#define sd(a) scanf("%d", &a)
#define sd2(a,b) scanf("%d%d", &a, &b)
#define sd3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sld(a) scanf("%lld", &a)
#define sld2(a,b) scanf("%lld%lld", &a, &b)
#define sld3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define pd(a) printf("%d", a)
#define pld(a) printf("%lld", a)
#define sp printf(" ")
#define nl printf("\n")
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define clr(a, val) memset((a), (val), sizeof(a))
#define pb push_back
#define endl "\n"
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<long long,long long>
#define xx first
#define yy second
#define mx 1000001
bitset<4*mx> dp;
int a[mx];
int main()
{
	sws;
	int n;cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++)
		cin>>a[i],sum+=a[i];
	dp.set(0);
	sum=sum%2==0?sum/2:sum/2+1;
	for(int i=1;i<=n;i++)
		dp|=dp<<a[i];
	for(int i=sum;i<4*mx;i++)
		if(dp[i]){
			cout<<i<<"\n";return 0;
		}
}


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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int count = 0;
    int ans = 0;
    while (count < 2) {
        if (a >= b) {
            ans += a;
            --a;
        } else {
            ans += b;
            --b;
        }
        ++count;
    }
    cout << ans << endl;
    return 0;
}

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

int main(void){
  long A,V,B,W,T;
  cin >> A >> V;
  cin >> B >> W;
  cin >> T;
  long A_after = A;
  long B_after = B;
  long distance = B_after-A_after;
  int flag = -1;
  if(W>=V){
    printf("NO\n");
    return 0;
  }
  for(int i=0;i<T;i++){
    if(distance>0){
      distance = distance + (W-V);
      if(distance<=0) flag = 1;
    } else if(distance<0){
      distance = distance - (W-V);
      if(distance>=0) flag = 1;
    }
  }

  if(flag==1) printf("YES\n");
  else     printf("NO\n");
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B) {
    cout << C << endl;
  } else if (A == C) {
    cout << B << endl;
  } else {
    cout << A << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = ni();
        }
        int ans = 0;
        int count = 0;
        int current = H[0];
        for (int i = 1; i < N; i++) {
            if(H[i] <= current){
                count++;
                ans = Math.max(ans, count);
            }else{
                ans = Math.max(ans, count);
                count = 0;
            }
            current = H[i];
        }
        
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    int last=0,first=1e9;
    for(int i=0;i<n;i++){
        cin >> a[i];
        last = max(last,a[i]);
        first = min(first,a[i]);
    }
    int ans =1e9;
    for(int i=first;i<=last;i++){
        int count =0;
        for(int j=0;j<n;j++){
            count +=(a[j]-i)*(a[j]-i);
        }
        //cout << count << endl;
        ans = min(count,ans);
    }
    cout << ans << endl;
}

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

class Main {
    public static long mod = (long)1e9+7;
    public static void main(String[] args) throws IOException {
     BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
     String[] hw = reader.readLine().split(" ");
     int H = Integer.parseInt(hw[0]);
     int W = Integer.parseInt(hw[1]);
     char[][] list = new char[H][W];
     for (int i = 0; i <H ; i++) {
         char[] oi =reader.readLine().toCharArray();
         list[i] = oi;
     }
     long[][] dp = new long[H][W];
        for (int i = 0; i <H ; i++) {
            if(list[i][0]=='.') dp[i][0] = 1;
            else break;
        }
        for (int i = 0; i <W ; i++) {
            if(list[0][i]=='.') dp[0][i] = 1;
            else break;
        }
        for (int i = 1; i < H; i++) {
            for (int j = 1; j <W ; j++) {
                if(list[i][j]=='.') dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
                else dp[i][j]=0;
            }
        }
        System.out.println(dp[H-1][W-1]);
    }
}


Measured memory_bytes: 41220
#include<stdio.h>
#define N 100
int main(){
  int i,A[N],n,flag=1,temp,cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&A[i]);
  }
  
  while(flag){

    flag = 0;
    for(i=n-1;i>0;i--){
      if(A[i]<A[i-1]){
	temp=A[i];
	A[i]=A[i-1];
	A[i-1]=temp;
	flag=1;
	cnt++;
      }
    }
  }
  
  for(i=0;i<n-1;i++){
  printf("%d ",A[i]);
  }
  printf("%d\n%d\n",A[n-1],cnt);
  return 0;
}



Measured memory_bytes: 2140
import java.util.*;

class Main {

	static int count = 0;

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] A = new int[n];
		for (int i=0; i<n; i++) {
			A[i] = stdIn.nextInt();
		}

		shellSort(A,n);

		System.out.println(count);	
		for (int i=0; i<n; i++) {
			System.out.println(A[i]);
		}
	}

	static void insettionSort(int[] A,int n,int g) {
		for (int i=g; i<n; i++) {
			int temp = A[i];
			int j = i-g;
			while (j>=0 && A[j]>temp) {
				A[j+g] = A[j];
				j = j-g;
				count++;
			}
			A[j+g] = temp;
		}
	}

	static void shellSort(int[] A,int n) {
		int h = 0;		
		int m;
		int[] G;

		for (m=1; m<n/3; m=m*3+1)
			h++;
		h++;
		System.out.println(h);
		G = new int[h];
		for (int i=0; i<h && m>0; i++,m/=3)
			G[i] = m;

		for (int i=0; i<h-1; i++) {
			System.out.print(G[i]+" ");
		}
		System.out.println(G[h-1]);

		for (int i=0; i<h; i++) {
			insettionSort(A,n,G[i]);
		}
		
	}

	static void swap(String[] ary,int x,int y){
		String temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	}
}

Measured memory_bytes: 296764
n = int(input())
s = []
while n!=0:
    if n<=26:
        s.append(n)
        n = 0
    else:
        x = n % 26
        #余りが0の場合には26にする
        if not x:
            x = 26
        s.append(x)
        n = (n - 1) // 26
t = []
#求めた順番とは逆に並べる
for i in range(len(s)-1,-1,-1):
    t.append(chr(s[i]+96))
print(''.join(t))


Measured memory_bytes: 9092
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int Q = sc.nextInt();
        int[] a = new int[Q];
        int[] b = new int[Q];
        int[] c = new int[Q];
        int[] d = new int[Q];
        for (int i=0; i<Q; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
        }

        System.out.println(solve(N, M, Q, a, b, c, d));
    }

    private static int solve(int N, int M, int Q, int[] a, int[] b, int[] c, int[] d) {
        //
        return dfs(N, M, Q, a, b, c, d, 0, 1, new int[N]);
    }

    private static int dfs(int N, int M, int Q, int[] a, int[] b, int[] c, int[] d, int idx, int last, int[] A) {
        if (idx == N) {
            int total = 0;
            for (int i=0; i<Q; i++) {
                if (A[b[i]-1] - A[a[i]-1] == c[i]) {
                    total += d[i];
                }
            }

            return total;
        }

        int ans = 0;
        for (int i=last; i<M+1; i++) {
            A[idx] = i;
            ans = Math.max(ans, dfs(N, M, Q, a, b, c, d, idx+1, i, A));
        }

        return ans;
    }
}


Measured memory_bytes: 37236
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

char c;
cin>>c;
c++;
cout<<c;
}   aryanc403();
    return 0;
}


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

int main(){
    map <int,int> times;
    times[1]=0;times[2]=0;times[3]=0;times[4]=0;
    for (int i=0; i<3; i++){
        int a,b; cin>>a>>b;
        times[a]+=1;
        times[b]+=1;
    }
    for(auto set:times){
        int time = set.second;
        if(time!=1 && time!=2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

#define clr(a) (a.clear())
#define sz(x) (int)x.size()
#define mem(a,b) memset(a, b, sizeof(a))
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define pb push_back
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);

#define X first
#define Y second

using pii = pair <int, int>;
using pll = pair <ll, ll>;

const ll inf = 1;
const ll mod = 1E9;


#define SZ 100010



int main() {
#if defined JESI
//        freopen("1.txt", "r", stdin);
//        freopen("2.txt", "w", stdout);
#endif

    ios::sync_with_stdio(false);

    ll Q, H, S, D, n;
    cin >> Q >> H >> S >> D >> n;

    Q *= 8;
    H *= 4;
    S *= 2;

    ll mn = min(min(Q, H), min(S, D));
    ll ans = 0;

    if (Q == mn) {
//        cout << "Q" << endl;
        ans = Q * (n / 2) + (Q / 2) * (n & 1);
    } else if (H == mn) {
//        cout << "H" << endl;
        ans = H * (n / 2) + (H / 2) * (n & 1);
    } else if (S == mn) {
//        cout << "S" << endl;
        ans = S * (n / 2) + (S / 2) * (n & 1);
    } else {
//        cout << "D" << endl;
        ans = D * (n / 2);
        if (n & 1) {
            mn = min(Q, min(H, S));
            ans += mn / 2;
        }
    }

    cout << ans << endl;

    return 0;
}






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

int main(){
    using namespace std;
    for(unsigned long n; cin >> n && n; cout << endl){
        map<pair<unsigned long, unsigned long>, unsigned long> rlc;
        set<unsigned long> del;
        rlc.emplace(pair<unsigned long, unsigned long>(0, 100000000000), ~0);
        del.insert(~0);
        for(unsigned long iter = 0, A, B; iter < n; ++iter){
            char c;
            cin >> c >> A;
            if(c == 'W'){
                cin >> B;
                for(auto it = rlc.begin(), en = rlc.end(); it != en; ++it)if(del.count(it -> second))if(B + it -> first.first < it -> first.second){
                    auto i = *it;
                    rlc.erase(it);
                    rlc.emplace(pair<unsigned long, unsigned long>(i.first.first, i.first.first + B), A);
                    rlc.emplace(pair<unsigned long, unsigned long>(i.first.first + B, i.first.second), i.second);
                    break;
                }else{
                    it -> second = A;
                    B -= it -> first.second - it -> first.first;
                }
            }else if(c == 'D') del.insert(A);
            else for(const auto& i : rlc)if(i.first.first <= A && A < i.first.second)cout << static_cast<long>(del.count(i.second) ? -1 : i.second) << endl;
        }
    }
}


Measured memory_bytes: 3500
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#define ll long long 
#define PI 3.14159265358979323846
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(x,n) for(ll x=1;x<(ll)n+1;x++)
using namespace std;
const ll INF = 100000;
int main() {
	ll a, ans;
	cin >> a;
	ans = a + pow(a, 2) + pow(a, 3);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4060
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int N=256;
const int maxn=2e5+5;
int a[maxn];
int main()
{
    int ans=0;
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i++)
    {
        ans+=(s[i]-'0');
    }
    if(ans%9==0)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 3688
n,m=map(int,input().split())
#a=[0]*m
a=set()
for i in range(m):
#    a[i]=int(input())
    a.add(int(input()))

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
    dp[1]=0
else:
    dp[1]=1
for nn in range(2,n+1):
    if nn in a:
        dp[nn]=0
    else:
        dp[nn]=(dp[nn-1]+dp[nn-2])%mod

#print(dp)
print(dp[n])


Measured memory_bytes: 11884
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if(s.size() <= k) cout << s << endl;
  else{
    rep(i,k)cout << s.at(i);
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3648
s=input()
k=len(s)
flag=True
for i in range((k-1)//2):
    if s[i]!=s[k-1-i]:
        flag=False
        break
    else:
        continue
if flag==True:
    for j in range((k-1)//2//2+1):
        if s[j]!=s[(k-1)//2-j-1]:
            flag=False
            break
        else:
            continue
if flag==True:
    for a in range((k-1)//2//2+1):
        if s[a+(k+3)//2-1]!=s[k-a-1]:
            flag=False
            break
        else:
            continue
if flag==True:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 38384
# coding: utf-8

# https://atcoder.jp/contests/abc104
# 16:23-


def main():
    S = input()
    N = len(S)

    head = S[0]
    
    if head == "A":
        c_cnt = 0
        c_i = None
        for i in range(2, N-1):
            if S[i] == "C":
                c_cnt += 1
                c_i = i
        if c_cnt != 1:
            return "WA"
        for i in range(N):
            if i in [0, c_i]:
                continue
            if 65 <= ord(S[i]) <= 90:
                return "WA"
        return "AC"
    else:
        return "WA"


print(main())


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

int main() {
	long n;
	cin >> n;
	long ans,cnt=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i*j<n){
				cnt++;
			}else{
				break;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>

int main()
{
  int n, a[100], i, j, sorted[100];
  int max, alice = 0, bob = 0;
  std::cin >> n;
  for (i = 0; i < n; i++)
  {
    std::cin >> a[i];
  }

  std::sort(a, a + n, std::greater<int>());

  for (i = 0; i < n; i++)
  {
    if (i % 2 == 0)
    {
      alice += a[i];
    }
    else
    {
      bob += a[i];
    }
  }
  std::cout << alice - bob << std::endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define endl '\n'

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

ll ar[200005];

int main()
{
    ll n,a[101],b[101],i,cnt=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    for(i=0;i<n;i++)
    {
        while(a[i]==b[i] && i<n)
        {
            cnt++;
            i++;
        }
        if(cnt<3) cnt=0;
    }
    if(cnt>=3)
    {
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636