akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#define MAXN 1000000
using namespace std;
int main(){
	int N;
	char a[MAXN];
	cin >> N >> a;
	bool has2 = 0;
	int ans = 0, coeff = 0;
	for(int i=0; i<N; i++){
		a[i] -= '0';
		has2 += (a[i] == 2);
	}
	if(!has2)
		for(int i=0; i<N; i++)
			a[i] /= 2;
	for(int i=1; i<=N; i++){
		ans += coeff? 0:a[i-1];
		coeff += __builtin_ctz(N-i) - __builtin_ctz(i);
	}
	cout << ((ans % 2)? 2-has2:0) << endl;
}
	



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

using namespace std;
const int MAX_N = 100005; 
long long MOD;
int n;
vector <int> adj[MAX_N];
long long in[MAX_N], out[MAX_N]; 

void dfs_out(int u, int father) {
	out[u] = 1;
	for (int i = 0; i < (int) adj[u].size(); i++) {
		int v = adj[u][i];
		if (v == father) {
			continue;
		}
		dfs_out(v, u);
		(out[u] *= (1 + out[v]) % MOD) %= MOD;
	}
}

void dfs_in(int u, int father) {
	vector <int> children;
	for (int i = 0; i < (int) adj[u].size(); i++) {
		int v = adj[u][i];
		if (v != father) {
			children.push_back(v); 
		}
	}
	int sz = (int) children.size();
	vector <long long> F(sz + 5), revF(sz + 5); 
	F[0] = 1LL;
	for (int i = 1; i <= sz; i++) {
		int v = children[i - 1];
		F[i] = (F[i - 1] * ((out[v] + 1) % MOD)) % MOD; 
	}
	revF[sz + 1] = 1LL;
	for (int i = sz; i >= 1; i--) {
		int v = children[i - 1];
		revF[i] = (revF[i + 1] * ((out[v] + 1) % MOD)) % MOD; 
	}
	for (int i = 0; i < sz; i++) {
		int v = children[i]; 
		long long left = F[i]; 
		long long right = revF[i + 2];
		long long val = in[u];
		(val *= left) %= MOD;
		(val *= right) %= MOD; 
		in[v] = val;
		in[v]++;
		in[v] %= MOD;
		dfs_in(v, u);
	}
}

int main () {
	scanf("%d %lld", &n, &MOD);
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%d %d", &u, &v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs_out(1, 0); 
	in[1] = 1;
	dfs_in(1, 0);
	for (int i = 1; i <= n; i++) {
		long long res = in[i];
		(res *= out[i]) %= MOD;
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 28672
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>

int main()
{
    int n, x[200000], y[200000];

    cin >> n;
    rep(i, 0, n) cin >> x[i];
    rep(i, 0, n) y[i] = x[i];
    sort(x, x + n);
    int l = x[n / 2 - 1], r = x[n / 2];
    rep(i, 0, n)
    {
        if (y[i] <= l)
            cout << r << endl;
        else
            cout << l << endl;
    }
}


Measured memory_bytes: 3840
#include<iostream>
#include<cstdio>
#include<cstring>

typedef std::pair<int,int> pii;

const int N=705,M=N*N*2;

int n;

struct gaoxiao
{
	bool f[N*2],g[N*2];

	void reset(){f[0]=1;}
	void insert(int x,int y)
	{
		memset(g,0,sizeof(g));
		for(int i=n;~i;i--)
			if(f[i])g[i+x]=1,g[i+y]=1;
		memcpy(f,g,sizeof(f));
	}
	int ask(int x)
	{
		return x*(x-1)/2;
	}
	int calc()
	{
		int ret=M;
		for(int i=0;i<=n;i++)
			if(f[i])ret=std::min(ret,ask(i)+ask(n-i));
		return ret;
	}
}d;

bool G[N][N],vis[N];

int begin[N],next[M],to[M];

int col[N];

int m,e;

void add(int x,int y,bool k=1)
{
	to[++e]=y;
	next[e]=begin[x];
	begin[x]=e;
	if(k)add(y,x,0);
}

bool predfs(int p,int c=1)
{
	if(col[p])return col[p]==c;

	col[p]=c;

	for(int i=begin[p];i;i=next[i])
		if(!predfs(to[i],3-c))return 0;

	return 1;
}

bool judge()
{
	for(int i=1;i<=n;i++)
		if(!col[i] && !predfs(i))return 0;
	return 1;
}

void dfs(int p,pii &A)
{
	if(vis[p])return ;
	vis[p]=1;

	if(col[p]==1)A.first++;
	else A.second++;

	for(int i=begin[p];i;i=next[i])
		dfs(to[i],A);
}

int main()
{
	scanf("%d%d",&n,&m);

	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			G[i][j]=i!=j;

	for(int i=1,u,v;i<=m;i++)
		scanf("%d%d",&u,&v),G[u][v]=G[v][u]=0;

	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			if(G[i][j])add(i,j);

	if(!judge())return printf("-1\n"),0;

	d.reset();
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			pii A(0,0);
			dfs(i,A);
			d.insert(A.first,A.second);
		}
	printf("%d\n",d.calc());

	return 0;
}


Measured memory_bytes: 8320
N=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print(0)
    exit()
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)


    


            
    


    


    
    














    


    














Measured memory_bytes: 21656
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int ret = 0;
  rep(i,5){
    int a;
    cin >> a;
    if(a == 0) ret = i+1;
  }

  cout << ret << endl;
  
  return 0;
}


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

int main(void){
  int A,B;
  cin >> A >> B;
  if( (B-1)%(A-1) == 0){
    cout << (B-1)/(A-1) << endl;
  }else{
    cout << (B-1)/(A-1)+1 << endl;
  }
}


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

int main(){
vector<int> a(5);
cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
// ??????W??????H?????????x?????????y?????????r
if(a[2] + a[4] <= a[0] && a[2] - a[4] >= 0 && a[3] + a[4] <= a[1] && a[3] - a[4] >= 0)
cout << "Yes\n";
else cout << "No\n";
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  vector<int> x(5);
  rep(i, 5) {
    cin >> x[i];
    if(x[i] == 0){
      cout << i+1 << endl;
    }
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int n, c, k;
	cin >> n >> c >> k;
	int t[n];
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	sort(t, t + n);
	int cur = 0, ans = 0;
	while (cur < n) {
		int nex = cur;
		while (nex < n && nex - cur < c && t[nex] - t[cur] <= k) {
			nex++;
		}
		ans++;
		cur = nex;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = [list(map(int, input().split())) for _ in range(M)]

# n番目の要素でソートsort
BC = sorted(BC, reverse=True, key=lambda x: x[1])

m = A[0]
D = []
for b, c in BC:
    if c > m:
        _ = [D.append(c) for i in range(b)]
    else:
        continue
    if len(D) > N:
        break

D.append(0)

for i, d in enumerate(D):
    if i >= N:
        break
    if A[i] < d:
        A[i] = d
    else:
        break

print(sum(A))


Measured memory_bytes: 35040
#include <iostream>
#include <string>

using namespace std;

string s;

int main() {
    cin >> s;
    while(s != "0"){
        int ans = 0;
        for(int i = 0; i < s.size(); i++) {
            ans += s[i] - '0';
        }
        cout << ans <<endl;
        cin >> s;
    }
}


Measured memory_bytes: 3184
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    CSF = [list(map(int, input().split())) for _ in range(n - 1)]

    for i in range(n):
        if i == n - 1:
            print(0)
            break
        c1, s1, _ = CSF[i]
        t = s1 + c1
        for j in range(i + 1, n - 1):
            c2, s2, f2 = CSF[j]
            if t <= s2:
                t = s2 + c2
            else:
                if t % f2 == 0:
                    wait = 0
                else:
                    wait = f2 - (t - s2) % f2
                t += c2 + wait
        print(t)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3188
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<bitset>
#include<climits>
#include<algorithm>
using namespace std;

#define NUM 10

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

	vector<vector<int>> F(N, vector<int>(NUM));
	for(int i=0; i<N; i++)
		for(int j=0; j<NUM; j++)
			cin >> F[i][j];

	vector<vector<int>> P(N, vector<int>(NUM+1));
	for(int i=0; i<N; i++)
		for(int j=0; j<NUM+1; j++)
			cin >> P[i][j];

	int ret = INT_MIN;
	for(int i=(1<<NUM)-1; i>0; i--){
		bitset<NUM> bit(i);

		vector<int> cnt(N, 0);
		for(int j=0; j<N; j++){
			for(int k=0; k<NUM; k++)
				if(F[j][k] & bit[k])
					cnt[j]++;
		}

		if(*max_element(cnt.begin(), cnt.end()) == 0)
			continue;

		int sales = 0;
		for(int j=0; j<N; j++)
			sales += P[j][cnt[j]];
		ret = max(ret, sales);
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double eps=1e-6;
double PI=acos(-1);
 
P getCrossPoint(P a,P b,P c,P d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}
 
bool isParallel(P a,P b,P c,P d){
  return (abs(imag( (b-a)*conj(d-c) ) )<eps);
}
 
int lcm(int a,int b){
  return a/ __gcd(a,b) * b;
}
 
int n;
 
int main(){
  while(1){
    cin>>n;
    if(n==0)break;
     
    double R=1.0/sqrt(3.0);
    P a=P(R,0);
    P b=P(R-0.5*sqrt(3.0),0.5);
     
    double lc=lcm(n,3);
    double ti=2.0*PI/lc;
 
    P c=a,d=b;
 
    if(lc==3){
      printf("0.433013\n");
      continue;
    }
     
    double T=1e9;
    for(int i=0;i<lc/3;i++){
      c*=P(cos(ti),sin(ti));
      d*=P(cos(ti),sin(ti));
      if(!isParallel(a,b,c,d)){
        P target=getCrossPoint(a,b,c,d);
        double k=min(abs(target-a),abs(target-b));
        if(k>eps)T=min(T,k);
      }
    }
    double ans=T*R*0.5;
    printf("%.8f\n",ans*lc);
  }
}

Measured memory_bytes: 1212
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int h_in, m_in, s_in, h_out, m_out, s_out;
	/**
	 * @param args
	 */
	
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		
			read();
			slove();
			read();
			slove();
			read();
			slove();
	}
	static boolean read(){
		h_in = sc.nextInt();
		m_in = sc.nextInt();;
		s_in = sc.nextInt();
		h_out = sc.nextInt();
		m_out = sc.nextInt();
		s_out = sc.nextInt();
		return true;
	}
	static void slove(){
		int sum = 3600*h_out + 60*m_out + s_out 
				-(3600*h_in + 60*m_in + s_in);
		System.out.print(sum/3600);
		sum = sum%3600;
		System.out.print(" "+ sum/60);
		sum = sum%60;
		System.out.println(" "+ sum);
	}

}

Measured memory_bytes: 12000
#include <cstdio>
using namespace std;
int main(){
	register int n, k, b;
	register long long ans;
	ans = 0;
	scanf("%d %d", &n, &k);
	if (k == 0) {
		printf("%lld", 1ll * n * n);
		return 0;
	}
	for (b = k + 1; b <= n; ++b) {
		ans += n / b * (b - k);
		if (n % b >= k) ans += n % b - k + 1;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int N;
bool isOk(long long val) {
    if (val > N) return false;
    bool existThree = false;
    bool existFive  = false;
    bool existSeven = false;
    while(val > 0){
        existThree |= val % 10 == 3;
        existFive  |= val % 10 == 5;
        existSeven |= val % 10 == 7;
        val /= 10;
    }
    return existThree && existFive && existSeven;
}
int main() {
    cin >> N;
    vector<long long> v(0);
    v.push_back(3);
    v.push_back(5);
    v.push_back(7);
    for (int i = 10; i < 1000000000; i *= 10) {
        for (int j = 0; j < v.size(); ++j) {
            long long val = v[j];
            if (i > val && val > i/10) {
                v.push_back(3*i + val);
                v.push_back(5*i + val);
                v.push_back(7*i + val);
            }
        }
    }
    int res = 0;
    for (int i = 0; i < v.size(); ++i) if (isOk(v[i])) ++res; 
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int B = sc.nextInt();

    if(N >= 13){
      System.out.println(B);
    }else if((N <= 12) && (N >= 6)){
      System.out.println(B / 2);
    }else if(N <= 5){
      System.out.println(0);
    }

  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxx =3005;
int a[maxx];
int main()
{
    int n,cnt = 0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        cnt += a[i];
    }
    cout<<cnt - n <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	ll x = c-a-b;
	if(x>=0 && 4*a*b<x*x){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int w = in.nextInt();
		int h = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		solve(w, h, x, y);
		in.close();
	}

	private static void solve(long w, long h, long x, long y) {
		System.out.println(w * h / 2.0);
		if (x * 2 == w && y * 2 == h)
			System.out.println("1");
		else
			System.out.println("0");
	}
}


Measured memory_bytes: 23124
// itne me hi thakk gaye?
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")
#define ll long long 
#define ull unsigned long long
using ld = long double;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll rk = 256;
const ll mod2 = 998244353;
const ld PI = 3.141592653589793;
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define print(a) for(auto j:a) {cout<<j<<",";} cout << "\n";
#define endl '\n'
#define whatis(x) cout << "> "<<#x << " ==> " << x << endl;
#define lwi(x) cout << " your " << #x << " is ---> " << x << " ";
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
// // Printing pair
ostream & operator << (ostream & os, pair <ll, ll> const& x) {
    os << x.first << "," << x.second;
    return os;
}
 
// printing vector
template <class T>
ostream & operator << (ostream & os, vector <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
// printing set
template <class T>
ostream & operator << (ostream & os, set <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
const int mxn = 1e6+5;
int32_t main(){
    FastIO;
    int x;
    cin >> x;
    if (x >= 30) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


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

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

int n;
int a[N];
int sum[N];
int f[N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", a + i);
    }
    f[0] = f[1] = 1;
    sum[a[1]] = 1;

    for (int i = 2; i <= n; i++) {
        if (a[i] == a[i - 1]) f[i] = f[i - 1];
        else f[i] = (f[i - 1] + sum[a[i]]) % MOD;
        if (a[i] != a[i - 1]) sum[a[i]] = (sum[a[i]] + f[i - 1]) % MOD;
    }
    cout << f[n] << endl;
    return 0;
}

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

using namespace std;

int main(){
    int H,W,K,now=1,sub=0;
    cin >> H >> W >> K;
    vector<string> s(H);
    for(int i=0;i<H;i++){
        cin >> s[i];
    }
    int ans[H][W],none[H]={0};

    for(int i=0;i<H;i++){
        bool exist = false;
        for(int j=0;j<W;j++){
            if(s[i][j]=='#'){
                if(exist){
                    now++;
                }
                exist = true;
            }
            ans[i][j] = now;
        }
        now++;

        if(!exist){
            none[i] = 1;
            sub++;
            now--;
        }
    }

    bool first = true;

    for(int i=0;i<H;i++){
        if(none[i]==0){
            if(first){
                for(int j=i-1;0<=j;j--){
                    for(int k=0;k<W;k++){
                        ans[j][k] = ans[i][k];
                    }
                }
                first = false;
            }

            for(int j=i+1;j<H;j++){
                if(none[j]==0){
                    break;
                }
                for(int k=0;k<W;k++){
                    ans[j][k] = ans[i][k];
                }
            }
        }
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

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

int main(){
    bool nonp[100005] = {};
    nonp[0] = nonp[1] = true;
    for(int i = 2; i < 100005; i++){
        if(nonp[i]) continue;
        for(int j = i+i; j < 100005; j += i)    nonp[j] = true;
    }
    int imos[100005] = {};
    for(int i = 1; i < 100005; i+=2){
        imos[i] = (!nonp[i] && !nonp[(i+1)/2]);
    }
    for(int i = 1; i < 100005; i++) imos[i] += imos[i-1];

    int q, l, r;
    scanf("%d", &q);
    while(q-- > 0){
        scanf("%d %d", &l, &r);
        cout << imos[r] - imos[l-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    vector<int> res(11000000,1);
    for(int i = 2;i <= n+100;i++){
        for(int j = i;j <= n+100;j += i){
            res[j]++;
        }
    }
    //rep(i,15)trace(i,res[i]);
    int ans = 0;
    for(int k = 1;k <= n;k++){
        ans += k*res[k];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 89316
// ITP1_2_D Circle in a Rectangle

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  
  // Main loop
  if (x >= r && x <= W - r && y >= r && y <=H - r){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
int main()
{
    int a,b,c,i,j,sum=0,sum1,d;
    scanf("%d %d %d",&a,&b,&c);
    for(i=1;i<=a;i++)
    {
        j=i;
        sum1=0;
        while(j>0)
        {
            d=j%10;
            sum1=sum1+d;
            j=j/10;
        }
        if(sum1>=b&&sum1<=c)
            sum=sum+i;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(2147483647)



n=int(input())

uvw={}
tree=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=list(map(int,input().split()))
    uvw[(u-1,v-1)]=w
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    #u<v

result=[-1]*n
#print(tree)
def DEF(x,dis):
    #print("x",x)
    global tree, uvw,result
    for nextNode in tree[x]:
        if result[nextNode]==-1:
            nextDis=dis+uvw[(min(x,nextNode),max(x,nextNode))]
            if (nextDis)%2==0:
                result[nextNode]=0
                DEF(nextNode,nextDis)
            else:
                result[nextNode]=1
                DEF(nextNode,nextDis)
result[0]=0
DEF(0,0)

for item in result:
    print(item)

Measured memory_bytes: 166816
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		// 文字列の入力
      String buf="";
      if (a > b) {
        for (int i=0; i < a;i++){
			buf+=b;
        }
      } else {
        for (int i=0; i < b;i++){
			buf+=a;
        }
      }
      		System.out.println(buf);


	}
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    int a = 0;
    for (int i = 1; i <= N; i++) {
        int p;
        cin >> p;
        if (p != i) a++;
    }
    cout << ((a <= 2) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int hagu=0;
  char S[101];;
  cin >> S;
 int n=strlen(S);
  for(int i=0;i<n/2;i++) {
    if(S[i]!=S[n-i-1]){
      
      hagu=hagu+1;
     
    }
    
  }
  cout<<hagu<<endl;
}

Measured memory_bytes: 256
program main
  implicit integer(a-z)
  allocatable::a(:)
  allocatable::sort(:)

  read(*,*)n,have
  allocate(a(n))
  allocate(sort(n))
  read(*,*)(a(i),i=1,n)

  do i=1,n
     sort(i)=minval(a(1:n-i+1))
     tmp=minval(a(1:n-i+1))
     do j=1,n-i+1
        if(tmp.eq.a(j)) exit
     end do
     a(j)=a(n-i+1)
     a(n-i+1)=tmp
  end do

  do i=1,n
     if(sum(sort(1:i)).gt.have)then
        exit
     end if
  end do

  if(i-1.eq.n .and. sum(sort).ne.have) i=i-1
  
  write(*,*)i-1

end program main


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

int main(void){
    int n,t,h,l;
    cin>>n>>t>>h>>l;
    vector<pair<int,int> > c(n);
    for (int i = 0; i < n; ++i) {
        int a,b;
        cin>>a>>b;
        c[i]=make_pair(a,b);
    }
    int turn=0;
    int r=0;
    while(true){
        if(c[turn].first==0&&c[turn].second==0)break;
        if(c[turn].first>0){
            --c[turn].first;
            r+=10;
            ++t;
            if(t>l)break;
        }
        else {
            --c[turn].second;
            r+=100;
        }
        if(r>=90){
            c[turn].first+=(r-90)/10;
            t-=(r-90)/10;
            if(t<0)break;
            r=0;
        }
        ++turn;
        if(turn>=n)turn=0;
    }
    cout<<turn+1<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

using Graph = vector<VE>;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	VE ans(n);
	VE a(n); rep(i, n)cin >> a[i];
	rep(i, n) {
		ans[a[i] - 1] = i + 1;
	}
	rep(i, n)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 2432
import sys
def main():
  global ans
  k = int(input())
  a, b = list(map(int,input().split()))
  for i in range(a,b+1):
    if i%k == 0:
      print('OK')
      sys.exit()
    else:
      ans = 'NG'


      
if __name__ == '__main__':
  main()
  print(ans)
  

Measured memory_bytes: 9076
#include <iostream>
#include <cstring>
#include <map>
#define ll long long
using namespace std;

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


char arr[100005];
int main() {
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;

  //f = gcd, g = lcm
  int f = gcd(n, m);
  ll g = (n*m)/f;

  int cntr = 1;
  for (int i = 0; i < s.length(); i+=n/f){
    char d = s[i];
    arr[cntr] = d;
    cntr++;
  }

  ll w = 1;
  for (int i = 0; i < t.length(); i+=m/f, w++){
   if (t[i] != arr[w]){
     cout << "-1" << endl;
     return 0;
   }
  }

  cout << g << endl;
  return 0;
}

Measured memory_bytes: 3760
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include<iomanip>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

int main(){
  string str;
  string str_rev;
  cin >> str;
  str_rev = str;
  reverse(str_rev.begin(), str_rev.end());

  if(str == str_rev){
    string sub1, sub1_rev;
    sub1 = str.substr(0, (str.length() - 1)/2);
    sub1_rev = sub1;
    reverse(sub1_rev.begin(), sub1_rev.end());
    if(sub1 == sub1_rev){
      string sub2, sub2_rev;
      sub2 = str.substr((str.length() + 3)/2 - 1, (str.length() - 1)/2);
      sub2_rev = sub2;
      reverse(sub2_rev.begin(), sub2_rev.end());
      if(sub2 == sub2_rev){
        cout << "Yes" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, c;
  cin >> n >> c;
  vl x(n), y(n), u(n), s(n + 1, 0), t(n + 1, 0);
  rep(i, n) {
    cin >> x[i] >> u[i];
    y[i] = c - x[i];
  }
  vl v = u;
  reverse(all(y));
  reverse(all(v));
  rep(i, n) {
    s[i + 1] = s[i] + u[i];
    t[i + 1] = t[i] + v[i];
  }
  rep(i, n) {
    s[i + 1] -= x[i];
    t[i + 1] -= y[i];
  }
  ll ans = 0;
  rep(_, 2) {
    set<ll, greater<ll>> st;
    for(int i = n; i >= 1; i--) {
      st.insert(t[n - i]);
      ans = max(ans, s[i]);
      ll now = s[i] + *st.begin();
      ans = max(ans, now - x[i - 1]);
    }
    swap(s, t);
    swap(x, y);
  }
  cout << ans << endl;
}

Measured memory_bytes: 12736
#include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;

int n;
char s[500011];

int dp[500011];

int main()
{
    int i,j,k;
    int from,to;
    int u;
    int p1,p2;
    scanf("%d",&n);
    scanf("%s",s);
    
    memset(dp,0,sizeof(dp));
    p1=p2=0;
    for(i=1;i<=n;i++)
    {
        dp[i]=max(dp[i],dp[i-1]);
        
        if(i>=3)
        {
            if(s[i-3]=='1' && s[i-2]=='0' && s[i-1]=='1')
            {
                to=i-3;from=i-3-p1;
                for(u=p1+1,j=from;j<=to;j++,u--)
                {
                    dp[i]=max(dp[i],dp[j]+u);
                }
                
                p2=1;
                p1++;
                continue;
            }
            
            
            
            if(s[i-3]=='1')
            {
                p1++;
            }
            else
            {
                p1=0;
            }
        }
        
        if(p2>0 && s[i-1]=='1')
        {
            p2++;
        }
        else
        {
            p2=0;
        }
        
        if(p2>0)
        {
            dp[i]=max(dp[i],dp[i-2-p2]+p2);
        }
    }
    /*
    for(i=1;i<=n;i++)
    {
        cout<<dp[i]<<' ';
    }
    cout<<endl;
    */
    cout<<dp[n]<<endl;
    
    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

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

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int MP = 1e9;
int N, A, B, C;
int l[8];

void calc(int select[]) {
		int mp = 0;
		int sum_a = 0, sum_b = 0, sum_c = 0;
		for (int i = 0; i < N; i++) {
				switch(select[i]) {
						case 0: if(sum_a)mp += 10; sum_a += l[i]; break;
						case 1: if(sum_b)mp += 10; sum_b += l[i]; break;
						case 2: if(sum_c)mp += 10; sum_c += l[i]; break;
						default: break;
				}
		}

		if (sum_a == 0 || sum_b == 0 || sum_c == 0) return;
		mp += abs(sum_a - A) + abs(sum_b - B) + abs(sum_c - C);
		MP = min(MP, mp);
}

void dfs(int depth, int select[]) {
		if (depth == N) calc(select);
		else {
				// 0:A, 1:B, 2:C, 4:not used
				for (int i = 0; i < 4; i++) {
						select[depth] = i;
						dfs(depth+1, select);
				}
		}
}

int main() {
		cin >> N >> A >> B >> C;
		for (int i = 0; i < N; i++) cin >> l[i];

		int select[N];
		dfs(0, select);

		cout << MP << endl;
		return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

int main(){
	int n,d;
	while(cin>>n>>d,n|d){
		vvi c(n);
		REP(i,n){
			int m;
			cin>>m;
			REP(j,m){
				int cc;
				cin>>cc;
				c[i].push_back(cc);
			}
		}
		bool changed=true;
		vi total(n);
		REP(i,n){
			REP(j,c[i].size()){
				total[i]+=c[i][j];
			}
		}
		while(changed){
			changed=false;
			REP(i,n){
				if(c[i].size()){
					int after_remove=total[i]-c[i][c[i].size()-1];
					bool can_remove=true;
					REP(j,n){
						if(i!=j&&abs(after_remove-total[j])>d){
							can_remove=false;
						}
					}
					if(can_remove){
						total[i]-=*(c[i].end()-1);
						c[i].pop_back();
						changed=true;
					}
				}
			}
		}
		bool ok=count(ALL(total),0)==total.size();
		cout<<(ok?"Yes":"No")<<endl;
	}
}

Measured memory_bytes: 1260
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
#include <list>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    rep(i,n)cin>>l[i];
    sort(l.begin(), l.end(), greater<int>());
    ll sum=0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i] < l[j]+l[k]){ sum++;}
                else{break;}
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {
//    var (r, d, x) = readLine()!!.split(" ").map { it.toInt() }
    var N = readLine()!!.toInt()
//    val S = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
//    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    val list = mutableListOf<Triple<String,Int,Int>>()
    for (i in 1 .. N) {
        var (s, p) = readLine()!!.split(" ")
        var pp = p.toInt()
        list.add(Triple(s,pp,i))
    }
    list.sortByDescending { it.second }
    list.sortBy { it.first }
    for  (l in list)
        println(l.third)
}


Measured memory_bytes: 36020
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+50;
const double eps=1e-8,dt=0.998;
struct node{int x,y;}a[N];
int n,num=0;double now,ans=1e9;
double dis(double x,double y,int id){
    double xx=x-a[id].x,yy=y-a[id].y;
    return sqrt(xx*xx+yy*yy);
}
void SA(){
    double t=1926,x=rand()%1000,y=rand()%1000;now=0;
    for(int i=1;i<=n;i++)now=max(now,dis(x,y,i));
    while(t>eps){
        int op1=rand()&1,op2=rand()&1;double dx=rand()%1000*t,dy=rand()%1000*t;
        double xx=x+(op1?dx:-dx),yy=y+(op2?dy:-dy),dat=0;
        for(int i=1;i<=n;i++)dat=max(dat,dis(xx,yy,i));
        if(dat<now||rand()<exp((now-dat)/t)*RAND_MAX)now=dat,x=xx,y=yy;
        t*=dt;
    }
}
int main(){
    scanf("%d",&n);srand(time(0));
    for(int i=1;i<=n;i++)scanf("%d%d",&a[i].x,&a[i].y);
    for(int i=1;i<=30;i++)SA(),ans=min(ans,now);
    printf("%.8f\n",ans);
}

Measured memory_bytes: 640
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()

    lucas = [2,1]
    for i in range(2,N+1):
        lucas.append(lucas[-1]+lucas[-2])
    print(lucas[-1])
if __name__ == '__main__':
    main()

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

int main()
{
long long int n,i,j,a;

while(1)
{
   cin>>n>>a;
   if(n==0 && a==0)
        break;

for(i=1;i<=n;i++)
{
    for(j=1;j<=a;j++)

    {
          if(i==1 || i==n || j==1 || j==a)
            cout<<"#";
          else
            cout<<".";
    }
cout<<endl;
}
cout<<endl;
}



}



Measured memory_bytes: 3092
#include<cstdio>
#define MAXSIZE 10005

int main(void)
{
    char s[MAXSIZE]={'\0'};
    int n; scanf("%d",&n);
    scanf("%s",s);
    for(int i=0;s[i]!='\0';++i){
        int k = 'Z'-s[i];
        if(k<n) k=n-k,s[i]='A'+k-1;
        else s[i]+=n;
    }
    puts(s);
    return 0;
}

Measured memory_bytes: 128
program sample
    implicit none
    character(19)::s
    integer(8) :: i,j,m,n
    integer(8),allocatable :: x(:),y(:)
  
    read(*,'(a)') s
    
    write(*,'(a,x,a,x,a)') s(1:5),s(7:13),s(15:19)
  
    stop
end program sample
  



Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll R, C, K;
    cin >> R >> C >> K;
    vector<vector<ll>> V(R, vector<ll> (C, 0));
    ll r, c, v;
    for (ll i = 0; i < K; i++) {
        cin >> r >> c >> v; r--; c--;
        V[r][c] = v;
    }

    vector<vector<vector<ll>>> dp(R, vector<vector<ll>> (C, vector<ll> (4, 0)));
    dp[0][0][1] = V[0][0];
    ll tmp;
    for (ll i = 0; i < R; i++) {
        for (ll j = 0; j < C; j++) {
            if( i == 0 && j == 0 ) continue;
            tmp = 0;
            if(i >= 1){
                for (ll l = 0; l < 4; l++) {
                    tmp = max(tmp, dp[i-1][j][l]);
                }
            }
            if(j >= 1){
                tmp = max(tmp, dp[i][j-1][0]);
            }
            dp[i][j][0] = tmp;

            tmp = 0;
            if(i >= 1){
                for (ll l = 0; l < 4; l++) {
                    tmp = max(tmp, dp[i-1][j][l] + V[i][j]);
                }
            }
            if(j >= 1){
                tmp = max(tmp, dp[i][j-1][0] + V[i][j]);
                tmp = max(tmp, dp[i][j-1][1]);
            }
            dp[i][j][1] = tmp;

            tmp = 0;
            if( j >= 1 ){
                tmp = max(tmp, dp[i][j-1][1] + V[i][j]);
                tmp = max(tmp, dp[i][j-1][2]);
            }
            dp[i][j][2] = tmp;

            tmp = 0;
            if( j >= 1 ){
                tmp = max(tmp, dp[i][j-1][2] + V[i][j]);
                tmp = max(tmp, dp[i][j-1][3]);
            }
            dp[i][j][3] = tmp;
        }
    }

    ll ans;
    ans = 0;
    for (ll i = 0; i < 4; i++) {
        ans = max(ans, dp[R-1][C-1][i]);
    }
    printf("%lld\n", ans);

    // for (ll l = 0; l < 4; l++) {
    //     for (ll i = 0; i < R; i++) {
    //         for (ll j = 0; j < C; j++) {
    //             printf("%lld ", dp[i][j][l]);
    //         }
    //         cout << endl;
    //     }
    //     cout << endl;
    // }

    // for (ll i = 0; i < R; i++) {
    //     for (ll j = 0; j < C; j++) {
    //         printf("%lld ", V[i][j]);
    //     }
    //     cout << endl;
    // }

}

Measured memory_bytes: 706576
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
    ll A, B;
    cin >> A >> B;
    rep(i,1,4) {
        if (i != A && i != B) {
            cout << i << endl;
            return 0;
        }
    }
}



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

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

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

    long long int ans = 0;
    for(int ab=1; ab<n; ab++){// A - B
        //cout << ab << " : ";
        long long int score = 0;
        set<int> visited;
        for(int k=0; k<n; k++){
            if((n-1) - k*ab <= ab) break;
            if(visited.find(k * ab) != visited.end()) break;
            visited.insert(k * ab);
            if(visited.find((n-1) - k * ab) != visited.end()) break;
            visited.insert((n-1) - k * ab);

            score += s[k * ab];
            score += s[(n-1) - k * ab];
            ans = max(ans, score);
        }
        //cout << score << endl;
    }
    cout << ans << endl;
    return 0;
}

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

int main(void) {
    int n;
    std::cin >> n;

    std::vector<int> vec{};
    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        vec.push_back(a);
    }

    int q;
    std::cin >> q;

    for (int j = 0; j < q; ++j) {
        int b, m, e;
        std::cin >> b >> m >> e;

        std::rotate(vec.begin() + b, vec.begin() + m, vec.begin() + e);
    }

    for (auto iter = vec.begin(); iter != vec.end(); ++iter) {
        std::cout << *iter;
        if (iter != vec.end() - 1) std::cout << ' ';
    }
    std::cout << std::endl;
}


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

int main(){
  string n;
  cin >> n;
  if(n[0] == n[1] && n[1] == n[2]){
    cout << "Yes" << endl;
  }else if(n[1] == n[2] && n[2] == n[3]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
//#define N 100007
//#define mod 1000000000000000000
//#define pb push_back
// vector<ll> v[N];
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b;
    
}

Measured memory_bytes: 3596
//長方形の中に円が含まれる条件
//左下(円の中心座標位置が原点よりもr＋方向)

#include<iostream>
using namespace std;

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) cout << "Yes" <<endl;
    else cout << "No" << endl;
    
    return 0;
    
}


Measured memory_bytes: 3092
# -*coding: utf8 -*-

n = input()
s = []
for i in range(n):
    s.append(input())

wa = sum(s)

if wa % 10 != 0:
    print wa
else:
    flag = 0
    for i in range(1,max(s)+1):
        if (i in s) and (i%10!=0):
            print wa - i
            flag = 1
            break
    if flag == 0:
        print 0

Measured memory_bytes: 2696
#include<iostream>
#include<cstdio>
#define MN 2000
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,K,head[MN+5],f[MN+5][MN+5],cnt,ans,F[MN+5];
struct edge{int to,next;}e[MN*2+5];
inline void ins(int f,int t)
{
    e[++cnt]=(edge){t,head[f]};head[f]=cnt;
    e[++cnt]=(edge){f,head[t]};head[t]=cnt;
}
void Solve(int x,int fa)
{
    for(int i=0;i<=K;++i) f[x][i]=1;
    for(int i=head[x];i;i=e[i].next)
        if(e[i].to!=fa)
        {
            Solve(e[i].to,x);
            for(int j=1;j<=K;++j)
                F[j]=max(f[e[i].to][j-1]+f[x][min(K-j,j)],f[x][j]+(j<K?f[e[i].to][min(K-j-1,j-1)]:0));
            for(int j=1;j<=K;++j) f[x][j]=max(F[j],f[x][j-1]);
        }
    ans=max(ans,f[x][K]);
    //for(int j=0;j<=K;++j) printf("f[%d][%d]=%d\n",x,j,f[x][j]);
}
int main()
{
    n=read();K=read();
    for(int i=1;i<n;++i) ins(read(),read());
    Solve(1,0);
    printf("%d\n",n-ans);
    return 0;
}


Measured memory_bytes: 16128
#include<stdio.h>

main()
{
    int n;
    scanf("%d",&n);
    int i,s;
    s=0;
    i=1;
    while(i<=n)
    {
        s=s+i;
        i=i+1;

    }
    printf("%d\n",s);
    return 0;
}



Measured memory_bytes: 1672