akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=2e3+5;
int dp[N][N];
pair<int,int> a[N];
    
int find(int x,int y,int n){
    if(dp[x][y]!=-1) return(dp[x][y]);
    if(x==0&&y==0) return(dp[x][y]=0);
    int X=a[x+y-1].ff;
    int Y=a[x+y-1].ss;
    if(x-1>=0) dp[x][y]=max(dp[x][y],find(x-1,y,n)+X*abs(Y-(x-1)));
    if(y-1>=0) dp[x][y]=max(dp[x][y],find(x,y-1,n)+X*abs(n-(y-1)-1-Y));
    return(dp[x][y]);
}

int32_t main(){
    IOS;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){cin>>a[i].ff;a[i].ss=i;}
    sort(a,a+n,greater<pair<int,int>>());
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            dp[i][j]=-1;
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++){
        ans=max(find(i,n-i,n),ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 35172
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		Long tmp = sc.nextLong();
      System.out.println(tmp * (tmp - 1) / 2);
      
	}
}


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

static const int NMAX=105;
static const int WMAX=10005;
static const int INFTY=(1<<29);
static const int DIAGONAL=1;
static const int TOP=0;
struct Item{
    int value,weight;
};

int N,W;
Item items[NMAX+1];
int C[NMAX+1][WMAX+1];

int main(void){
    int maxValue;
    vector<int> selsection;
    cin>>N>>W;
    for(int i=1;i<=N;i++){
        cin>>items[i].value>>items[i].weight;
    }
    for(int w=0;w<=W;w++){
        C[0][w]=0;
    }
    for(int i=1;i<=N;i++)C[i][0]=0;
    
    for(int i=1;i<=N;i++){
        for(int w=1;w<=W;w++){
            C[i][w]=C[i-1][w];
            if(items[i].weight>w)continue;
            if(items[i].value+C[i-1][w-items[i].weight]>C[i-1][w]){
                C[i][w]=items[i].value+C[i-1][w-items[i].weight];
            }
        }
    }
    maxValue=C[N][W];
    cout<<maxValue<<endl;
    
    return 0;
}



Measured memory_bytes: 7056
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s1 = scan.next();
    String s2 = scan.next();
    scan.close();
    
    if (s1.charAt(0) == s2.charAt(2) && s1.charAt(1) == s2.charAt(1) && s1.charAt(2) == s2.charAt(0)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
}
}


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

int main(){   
    int a,b;
    cin >> a >> b;
    if(a+b>a-b){
        if(a+b>a*b){
            cout << a+b << endl;
        }else{
            cout << a*b << endl;
        }
    }else{
         if(a-b>a*b){
            cout << a-b << endl;
        }else{
            cout << a*b << endl;
        }
    }
}

Measured memory_bytes: 256
n = int(input())
arr = [0]*10100
for i in range(1,110):
    for j in range(1,110):
        for k in range(1,110):
            s = i*i+j*j+k*k+i*j+j*k+k*i;
            if s<10100:
                arr[s]+=1
for i in range(n):
    print(arr[i+1])


Measured memory_bytes: 9288
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s, t;
    cin >> s >> t;

    if(s.size() < t.size()) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    bool res = false;
    string rs = "";
    for(int i=s.size()-t.size(); i>=0; i--) {
        bool temp = true;
        for(int j=i; j<i+t.size(); j++) {
            if(s[j]!=t[j-i] && s[j]!='?') {
                temp = false;
                break;
            }
        }
        if(temp) {
            res = true;
            for(int j=0; j<i; j++) {
                if(s[j]=='?') rs += 'a';
                else rs += s[j];
            }
            for(int j=i; j<i+t.size(); j++) {
                rs += t[j-i];
            }
            for(int j=i+t.size(); j<s.size(); j++) {
                if(s[j]=='?') rs += 'a';
                else rs += s[j];
            }
            break;
        }
    }

    if(res) cout << rs << endl;
    else cout << "UNRESTORABLE" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    string s, t;
    getline(cin, s);
    map<string, int> m;
    istringstream is(s);
    while (is >> t) if (m.find(t) == m.end()) m[t] = 0; else m[t]++;

    vector<pair<int, string> > v1, v2;
    for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
        v1.push_back(make_pair(it->second, it->first));
        v2.push_back(make_pair(it->first.size(), it->first));
    }
    sort(v1.rbegin(), v1.rend());
    sort(v2.rbegin(), v2.rend());
    cout << v1[0].second << " " << v2[0].second << endl;

    return 0;
}

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

typedef long long ll;

using namespace std;

int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    int p = 0;
    for(int i = 0; i < s1.size(); i++)
      if(s1[i] != s2[i])
        p++;

    cout << p << endl;
}


Measured memory_bytes: 3920
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include<map>
#include <utility>
#include <math.h>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[100010] = {}, f[100010];
double syo = 0, su = 0;
long long   mur = 0, kmr = 0, yju = 0, counto[5003], counto1[5003];
char fir, sec = 'z', mado[52][52], homu[52][52];
string rik, mrsm[55], tok[25003];
bool mazi[110], gi[110], zi, manji;
pair<int, int>n[110];
vector<int> aa[50] = {}, cc;
vector<char> bb, dd;
map<char, int>zis, uuu;
int gcd(int a, int b) {
	int d;
	if (a > b) {
		int t = b;
		b = a;
		a = t;
	}
	while ((d = b % a) != 0) {
		b = a;
		a = d;
	}
	return a;
}
int main()
{
	cin >> rik;
	a = rik[6];
	b = rik[5];
	//cout << a;
	if (a > 52||b!=48) {
		cout << "TBD" << endl;
		return 0;
	}
	else { cout << "Heisei" << endl; }
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main() {
   int n,i,sum=0,f=0;
   cin>>n;
   f=(n*2);
   int a[f];
   for(i=0;i<f;i++)
   {
       cin>>a[i];
   }
    sort(a,a+f);
    for(i=0;i<f;i+=2)
    {
        sum=sum+a[i];
    }
  cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

const MOD: usize = 1_000_000_007;

enum Shape {
    Single,
    Double,
}

fn main() {
    input! {
        n: usize,
        s: [Chars; 2],
    }

    let mut count = 1;
    let mut prev = None;
    
    let mut index = 0;
    while index < n {
        if s[0][index] == s[1][index] {
            if let Some(prev) = prev {
                match prev {
                    Shape::Single => { 
                        count *= 2; 
                        count %= MOD;
                    },
                    Shape::Double => {
                         count *= 1;
                         count %= MOD;
                    },
                }
            } else {
                count *= 3;
            }
            prev = Some(Shape::Single);
            index += 1;
        } else {
            if let Some(prev) = prev {
                match prev {
                    Shape::Single => {
                        count *= 2;
                        count %= MOD;
                    },
                    Shape::Double => {
                        count *= 3;
                        count %= MOD;
                    },
                }
            } else {
                count *= 6;
            }
            prev = Some(Shape::Double);
            index += 2;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 2164
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
#include<random>
#include<numeric>
//by Skeef79

typedef long long ll;
typedef long double ld;

typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define what_is(x) cout<<#x<<" is "<<x<<en;

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];

}

void solve()
{
	char c;
	cin >> c;
	if (isupper(c))
		cout << "A";
	else
		cout << "a";
}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	//freopen("luigi.in", "r", stdin);
	//freopen("luigi.out", "w", stdout);

	int tst = 1;
	//cin >> tst;

	while (tst--)
		solve();
}


Measured memory_bytes: 3648
n = int(input())
s = input()

ans = s.count('R')*s.count('G')*s.count('B')  # ここはただ簡潔にしただけ

for i in range(0, n - 2):
    for j in range(i + 1,  n - 1):
        k = (j - i) + j
        if k >= n:
            continue
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1
print(ans)

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

int compare_int(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}

int main() {
    int N;
    int v[1000];
    int i;
    double value = 0;

    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &v[i]);
    }
    qsort(v, N, sizeof(int), compare_int);
    value = v[0];
    for (i = 1; i < N; i++) {
        value = (value + v[i])/2;
    }
    printf("%f\n", value);
    return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << "#";
    string A;
    cin >> A;
    for(int o = 0; o < W; o++){
      cout << A.at(o);
    }
    cout << "#" << endl;
  }
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;
}


Measured memory_bytes: 3600
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main(){
ll N,M;
cin>>N>>M;
UnionFind U(N+1);
ll ans[M+1];
memset(ans,0,sizeof(ans));
ans[M]=N*(N-1)/2;

ll num[N+1];
rep3(i,N)num[i]=1;
int A[M+1],B[M+1];
rep3(i,M){
    cin>>A[i]>>B[i];
}
repr3(i,M){
    int rx=U.root(A[i]);
    int ry=U.root(B[i]);
    if(rx==ry)ans[i-1]=ans[i];
    else{
        ans[i-1]=ans[i]-num[rx]*num[ry];
       
        num[ry]+=num[rx];
        U.unite(A[i],B[i]);

    }
}
rep3(i,M){
    cout<<ans[i]<<endl;
}
}

Measured memory_bytes: 6056
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>2);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //cout << fixed;
  //cout.precision(40);
  ll h,w,k;
  cin >> h >> w >> k;
  vector<string> vs(h);
  for(ll i = 0; i < h; ++i) cin >> vs[i];
  vector<vector<int>> a(h,vector<int>(w));
  int nb = 1,first = -1;
  for(ll i = 0; i < h; ++i){
    int cnt = 0;
    for(char c : vs[i]){
      if(c == '#') ++cnt;
    }
    if(cnt == 0) continue;
    if(first == -1) first = i;
    for(int j = 0; j < w; ++j){
      if(cnt > 0) a[i][j] = nb;
      else a[i][j] = nb-1;
      if(vs[i][j] == '#'){
        --cnt;
        ++nb;
      }
    }
  }
  for(ll i = first+1; i < h; ++i){
    int cnt = 0;
    for(char c : vs[i]){
      if(c == '#') ++cnt;
    }
    if(cnt == 0){
      for(int j = 0; j < w; ++j) a[i][j] = a[i-1][j];
    }
  }
  for(ll i = 0; i < first; ++i){
    int cnt = 0;
    for(char c : vs[i]){
      if(c == '#') ++cnt;
    }
    if(cnt == 0){
      for(int j = 0; j < w; ++j) a[i][j] = a[first][j];
    }
  }
  for(ll i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j) cout << a[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N, Q;
string s;
char t[200010], d[200010];

// 0残り、1左溢れ、2右溢れ
int check(int pos) {
	for (int i = 0; i < Q; i++) {
		if (pos < 0) return 1;
		if (pos >= N) return 2;
		if (s[pos] == t[i]) {
			if (d[i] == 'L') {
				pos--;
			}
			if (d[i] == 'R') {
				pos++;
			}
		}
	}
	if (pos < 0) return 1;
	if (pos >= N) return 2;
	return 0;
}

void solve() {

	cin >> N >> Q >> s;
	int ans = N;
	for (int i = 0; i < Q; i++) {
		cin >> t[i] >> d[i];
	}

	// 左溢れチェック
	int top = N - 1;
	int bottom = 0;
	int mid;
	int overL = top;
	while (top >= bottom) {
		mid = (top + bottom) / 2;
		int tmp = check(mid);
		int tmp2 = check(mid + 1);
		if (tmp == 1 && tmp2 != 1) {
			overL = mid;
			break;
		}
		if (tmp == 1 && tmp2 == 1) bottom = mid + 1;
		else top = mid - 1;
	}
	top = N - 1;
	bottom = 0;
	int overR = bottom;
	while (top >= bottom) {
		mid = (top + bottom) / 2;
		int tmp = check(mid);
		int tmp2 = check(mid + 1);
		if (tmp != 2 && tmp2 == 2) {
			overR = mid;
			break;
		}
		if (tmp == 2 && tmp2 == 2) top = mid - 1;
		else bottom = mid + 1;
	}

	ans = overR - overL;
	if (ans < 0) ans = 0;

	cout << ans << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
  int x,y;
  cin>>n;
  x=n/100;
  y=n%10;
  if(x==y)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 50010
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n,m = arrIN()
ans = ncr(n,2)+ncr(m,2)
print(ans)

Measured memory_bytes: 7188
#include <stdio.h>

int main()
{
  int n;
  scanf("%d",&n);
  int a[n];
  int b[n+1];
  for(int i=0;i<n+1;i++){
    b[i]=0;
  }
  
  for(int i=0;i<n-1;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n-1;i++){
    b[a[i]]+=1;
  }
  for(int i=1;i<n+1;i++){
    printf("%d\n",b[i]);
  }
  return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
int main(){ 
    ll n,m;
    cin>>n>>m;
    if(2*n>=m){
        cout<<m/2;
    }else{
        cout<<n+(m-2*n)/4;
    }
    return 0;
}


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

#define rep(i,n) for (int i=0;i<(n);i++)

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


int main(void)
{
    int n;

    cin >> n;

    if(n){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int a, b;
  cin >> a >> b;
  cout << max(a+b, max(a-b, a*b)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
 int N,M,X,Y;
 cin>>N>>M>>X>>Y;
 vector<int>x(N);
 vector<int>y(M);
 for(int i=0;i<N;i++){
     cin>>x[i];
 }
 x.push_back(X);
 for(int i=0;i<M;i++){
     cin>>y[i];
 }
 y.push_back(Y);

 for(int i=-100;i<=100;i++){
     int miny=*min_element(y.begin(),y.end());
     int maxx=*max_element(x.begin(),x.end());
    if(miny>=i&&maxx<i){
        cout<<"No War"<<endl;return 0;
    }
 }
 
 cout<<"War"<<endl;
 return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,n) for(ll i=n-1;i>=0;i--)
#define rloop(i,a,b) for(ll i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll n;
  cin>>n;
  ll a[n];ll f=0;
  fo(i,n)
  {
    cin>>a[i];
    if(a[i]==0)
      f=1;
  }
  if(f)
  {
    cout<<0;
    return 0;
  }
  long double s=1;
  double r=1000000000000000000.0;
  fo(i,n)
  {
    s=s*a[i]*1.0;
    if(s>r)
    {
      cout<<-1;
      return 0;
    }
  }
  ll ans=(ll)s;
  cout<<ans;
  return 0;
}

Measured memory_bytes: 4432
require 'set'

def f(s)
	0 while s.gsub!(/\((\d+)\)/o, '\1')
	0 while s.gsub!(/\(\(([^\(\)]+)\)\)/o, '(\1)')
	return if $checked[s]
	$checked[s] = 0

	if s.scan(/\d+/).size == 1
		$set << eval(s)
		return
	end

	op_hash = {}
	num_hash = {}

	s.gsub!(/\((-\d+)\)/o) do
		c = ((?A.ord) + num_hash.size).chr
		num_hash[c] = $1.to_i
		c
	end

	s.gsub!(/\d+/o){|x| ((?A.ord) + num_hash.size).chr.tap{|c| num_hash[c] = x.to_i} }
	s.gsub!(/(?<=[A-Z])[-+*\/](?=[A-Z])/o){|x| ((?a.ord) + op_hash.size).chr.tap{|c| op_hash[c] = x} }
	
	op_hash.each do |c, op|
		d = s.dup
		begin
			d.sub!(/(\w)#{c}(\w)/) do
				x, y = num_hash[$1], num_hash[$2]
				raise if op == ?/ && y == 0

				z = if x * y < 0 && op == ?/
						-(x.abs.send(op, y.abs))
					else
						x.send(op, y)
					end

				z < 0 ? "(#{z})" : z.to_s
			end
			f(d.gsub(/[a-z]/o){|l| op_hash[l]}.gsub(/[A-Z]/o){|l| "(#{num_hash[l]})"})
		rescue
		end
	end
end

loop do
	s = gets.chomp
	break if s == ?#
	$set = Set.new
	$checked = {}
	f(s)
	p $set.size
end

Measured memory_bytes: 10500
n = int(input())
a= list(map(int, input().split()))
s = [0]*n
ans2 = []
for i in range(1, n+1):
  temp = sum(s[n-i::n+1-i])
  if (temp % 2 == 0 and a[-i] == 1) or (temp % 2 == 1 and a[-i] == 0) :
    s[-i] = 1
    ans2.append(str(n+1-i)) 

ans2.reverse()
print(sum(s))
print(" ".join(ans2))

Measured memory_bytes: 17196
#include<cstdio>
using namespace std;
int main(){
    int n,x;
    scanf("%d",&n);
    x=n*(n+1)/2;
    if(n%2==0){
        printf("%d\n",n*(n-2)/2);
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n+1){
                    printf("%d %d\n",i,j);
                }
            }
        }
    }
    else if(n==3){
        printf("2\n");
        printf("1 3\n");
        printf("2 3\n");
    }
    else if(n==5){
        printf("8\n");
        printf("1 5\n");
        printf("2 5\n");
        printf("3 5\n");
        printf("4 5\n");
        printf("1 2\n");
        printf("1 3\n");
        printf("4 3\n");
        printf("4 2\n");
    }
    else{
        printf("%d\n",(n-1+(n-1)*(n-2))/2);
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n){
                    printf("%d %d\n",i,j);
                }
            }
        }
    }
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    int n;
    cin>>n;
    int b[n-1],a[n];
    int i;
    for(i=0;i<n-1;i++) {
        cin>>b[i];
    }
    a[0]=b[0];
    a[1]=b[0];
    for(i=1;i<n-1;i++) {
        if(b[i]>a[i]) {
            a[i]=b[i-1];
            a[i+1]=b[i];
        }
        else {
            a[i]=b[i];
            a[i+1]=b[i];
        }
    }
    ll sum=0;
    for(i=0;i<n;i++) {
        sum+=a[i];
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll MOD=1000000007;
    ll N,M;
    cin >> N >> M;
    ll A[N+1],B[M+1];
    ll i,j,k;
    A[0]=0;
    B[0]=0;
    for(i=1;i<=N;i++){
      cin >> A[i];
    }
    for(j=1;j<=M;j++){
      cin >> B[j];
    }
    sort(A,A+N+1);
    sort(B,B+M+1);
    i=N;
    j=M;
    ll ans=1;
    for(k=N*M;k>0;k--){
      if(A[i]>k)ans=0;
      if(B[j]>k)ans=0;
      if((A[i]==k)&&(B[j]==k)){
        i--;
        j--;
      }else if(A[i]==k){
        ans=ans*(M-j)%MOD;
        i--;
      }else if(B[j]==k){
        ans=ans*(N-i)%MOD;
        j--;
      }else{
        ans=ans*((N-i)*(M-j)-(N*M-k))%MOD;
      }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import sys
N, = map(int, input().split())
X = list(map(int, input().split()))
S = X[0]+X[1]
T = 0
for i in range(2, N):
    T ^= X[i]
if S<T or (S-T)%2:
    print(-1)
    sys.exit()

D = (S-T)//2
if D&T:
    print(-1)
    sys.exit()

Y = D
for i in range(T.bit_length()+1, -1, -1):
    if T & (1<<i) and (1<<i)|Y <= X[0]:
        Y |= 1<<i

if 0<Y<=X[0]:
    print(X[0]-Y)
else:
    print(-1)


Measured memory_bytes: 62080
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    for i in range(1, len(s)):
        if s[i] == "C" and s[i-1] == "A":
            print("Yes")
            exit()
    print("No")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int N, T, E;
  while(cin>>N>>T>>E){
    vector<int> x(N); 
    REP(i, N) cin>>x[i];
    int ans = -2;
    REP(i, N){
      int nx = 0;
      while(nx <= T + E){
        if(abs(T-nx) <= E)ans = i;
        nx += x[i];
      }
    }
    cout<<ans + 1<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S,T;
int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>T;
	A=S.size();
	B=T.size();
	set<string> cand;
	FOR(i,A) if(i+B<=A) {
		string C=S;
		FOR(x,A) {
			if(x>=i && x-i<B) {
				if(C[x]=='?') C[x]=T[x-i];
				if(C[x]!=T[x-i]) break;
			}
			else {
				if(C[x]=='?') C[x]='a';
			}
		}
		if(x==A) cand.insert(C);
		
	}
	if(cand.size()) cout<<*cand.begin()<<endl;
	else cout<<"UNRESTORABLE"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int main() {
    cin >> N;
    vector<int> A(N+1, 0);
    vector<int> B(N+1, 0);
    vector<int> C(N, 0);
    for(int i = 0; i < N; ++i) {
        cin >> A.at(i);
    }

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

    for(int i = 0; i < N-1; ++i) {
        cin >> C.at(i);
    }

    int sum = 0;

    for(int i = 0; i < N; ++i) {
        sum += B.at(A.at(i)-1);
        if(A.at(i) == A.at(i+1)-1) {
            sum += C.at(A.at(i)-1);
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans = 0;
    int divNum = -1;
    for(int i = 0; i < n; i++){
        int target = i + 1;
        int tmpCnt = 0;
        while(target%2==0){
            target/=2;
            tmpCnt++;
            if(target==0)break;
        }
        if(tmpCnt>divNum){
            ans = i + 1;
            divNum = tmpCnt;
        }

    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>
#include <unordered_map>
typedef long long LL;

int main()
{
    std::vector<LL> nums;

    for(int i = 0; i < 5; i++)
    {
        LL temp;
        std::cin >> temp;
        nums.push_back(temp);
    }

    auto found = std::find(nums.begin(), nums.end(), 0);

    std::cout << std::distance(nums.begin(), found) + 1;

    return EXIT_SUCCESS;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define maxn 100009
using namespace std;
long long a[maxn];
int n,k;
int main(){
	for(int i=0;i<7;i++)
		cin>>a[i];
	long long ans = 0;
	ans += a[1];
	int cnt = 0;
	if(a[0] & 1) cnt++;
	if(a[3] & 1) cnt++;
	if(a[4] & 1) cnt++;
	if(cnt <= 1){
		 ans += a[0]/2*2 + a[3]/2*2 + a[4]/2*2;
	}
	else if(cnt == 2){
		if(a[0] % 2 ==0){
			ans += a[3]/2*2 + a[4]/2*2;
			if(a[0] > 0){
				ans += 3;
				ans += (a[0] - 1) /2 *2;
			}
		}
		else if(a[3] % 2 ==0){
			ans += a[0]/2*2 + a[4]/2*2;
			if(a[3] > 0){
				ans += 3;
				ans += (a[3] - 1) / 2 *2;
			}
		}
		else{
			ans += a[0]/2*2 + a[3]/2*2;
			if(a[4] > 0){
				ans += 3;
				ans += (a[4] - 1) / 2 *2;
			}
		}
	}
	else{
		ans += a[0] + a[3] + a[4];
	}

	cout << ans <<endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
int main()
{
	ld d,t,s;
	cin>>d>>t>>s;
	ld x=t*s;
	if(t*s>=d){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,  int>;

const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
	int n,m; cin >>n >> m;
	vector<vector<int> >a(n, vector<int> (m));
	for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> a[i][j]; --a[i][j];
        }
    }
    set<int> se;
    
    // 参加者の最大取りたい
    // 最大m回、スポーツを選んでく
    int ans = 1000;
    for(int i = 0; i < m; ++i){
        vector<int> s(m);
        int M=0, target=-1;
        for(int j = 0; j < n; ++j){
            for(int k = 0; k < m; ++k){
            // 削除されてないスポーツなら選ぶ
                if(se.count(a[j][k])==0){
                    s[a[j][k]]++;
                    if(M<s[a[j][k]]){M=s[a[j][k]];target=a[j][k];}
                    break;
                }
            }
        }
        ans = min(ans, M);
        
        se.insert(target);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include <math.h>
#include <stdlib.h>

int main (){
  int n,t[1000001],x[1000001],y[1000001],a,b,c,i,j,k,tr;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d %d",&t[i],&x[i],&y[i]);
  }
  t[0]=0;
  x[0]=0;
  y[0]=0;
  for(i=1;i<=n;i++){
    if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))<=(t[i]-t[i-1]) && ((abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))-(t[i]-t[i-1]))%2==0){
      a=0;
    } else {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define lli long long int
#define f first
#define s second
#define fw(i, start, end) for (lli i = start; i < end; ++i)
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    lli n, W, V = 0;
    cin >> n >> W;
    lli wi[n + 1], vi[n + 1];
    memset(wi, 0, sizeof wi);
    memset(vi, 0, sizeof vi);

    fw(i, 1, n + 1)
    {
        cin >> wi[i] >> vi[i];
        V += vi[i];
    }
    int k[V + 1];
    memset(k, 0, sizeof k);
    for (int i = 1; i <= V; i++)
        k[i] = INFINITY;
    k[0] = 0;
    fw(j, 1, n + 1)
    {
        lli w = wi[j], v = vi[j];
        for (lli i = V; i >= v; i--)
        {
            k[i] = fmin(k[i], k[i - v] + w);
        }
    }
    lli t, bst = 0;
    for (int i = V; i >= 0; i--)
    {
        if (k[i] <= W)
        {
            cout << i << endl;
            break;
        }
    }

    return 0;
}

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

int main(){
    int s,m,h;
    cin>>s;
    
    m = s / 60;
    h = m / 60;
    m = m % 60;
    s = s % 60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>                                                                              
using namespace std;                                                                                  
using ll = long long;                                                                                 
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }               
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }               
                                                                                                      
int main() {                                                                                          
  ll n, m;                                                                                            
  cin >> n >> m;                                                                                      
  ll yasumi = n;                                                                                      
  ll v;                                                                                               
  for (int i=0; i<m; i++) {                                                                           
    cin >> v;                                                                                         
    yasumi -= v;                                                                                      
  }                                                                                                   
  if (yasumi<0) {                                                                                     
    cout << -1 << endl;                                                                               
  } else {                                                                                            
    cout << yasumi << endl;                                                                           
  }                                                                                                   
  return 0;                                                                                           
}                  

Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline

from collections import defaultdict

H, W, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
SIZE = 10 ** 9 + 1

counter = defaultdict(int)
for a, b in AB:
  for aa in range(a - 1, a + 2):
    for bb in range(b - 1, b + 2):
      if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:
        counter[aa * SIZE + bb] += 1

answer = [0] * (10)
for x, n in list(counter.items()):
  if n:
    answer[n] += 1
answer[0] = (H - 2) * (W - 2)
for i in range(1, 10):
  answer[0] -= answer[i]
  
for a in answer:
  print(a)

Measured memory_bytes: 157052
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return sums.back();
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void build() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};

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

    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    rep(i, n) v[i] -= i;
    sort(v.begin(), v.end());
    CumulativeSum cs(n);
    rep(i, n) cs.set(i, v[i]);
    cs.build();

    ll ans = INF;

    auto get_l = [&](int i) -> ll {
        if (i == 0) return 0;

        ll sum = cs.getSum(i - 1);
        ll rect = i * v[i];

        return rect - sum;
    };

    auto get_r = [&](int i) -> ll {
        if (i == n - 1) return 0;

        ll sum = cs.getSectionSum(i + 1, n);
        ll rect = (n - i - 1) * v[i];

        return sum - rect;
    };

    rep(i, n) {
        ll l = get_l(i);
        ll r = get_r(i);

        ll now = l + r;
        cmin(ans, now);
    }
    cout << ans << endl;
}


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

struct pa{
  char a;
 int b;
};

int main(){
  int n,tmp,mini;
  pa a[101],b[101];
  char tmpc;

 cin>>n;
  for(int i=0;i<n;i++) cin>>a[i].a>>a[i].b;
  for(int i=0;i<n;i++) b[i].a=a[i].a,b[i].b=a[i].b;
  for(int i=0;i<n-1;i++)
    for(int j=n-1;j>i;j--){
      if(a[j].b<a[j-1].b){
	tmpc=a[j].a,tmp=a[j].b;
	a[j].a=a[j-1].a,a[j].b=a[j-1].b;
	a[j-1].a=tmpc,a[j-1].b=tmp;
      }
    }
 for(int i=0;i<n-1;i++){
    mini=i;
    for(int j=i;j<n;j++)if(b[j].b<b[mini].b)mini=j;

    tmp=b[i].b,tmpc=b[i].a;
    b[i].b=b[mini].b,b[i].a=b[mini].a;
    b[mini].b=tmp,b[mini].a=tmpc;
  }

 for(int i=0;i<n-1;i++) cout<<a[i].a<<a[i].b<<" ";
 cout<<a[n-1].a<<a[n-1].b<<endl<<"Stable"<<endl;
 int f=0;
 for(int i=0;i<n;i++)
   if(a[i].a!=b[i].a && a[i].b==b[i].b)f=1;

 for(int i=0;i<n-1;i++) cout<<b[i].a<<b[i].b<<" ";
 cout<<b[n-1].a<<b[n-1].b<<endl;
 if(f==0) cout<<"Stable"<<endl;
 else cout<<"Not stable"<<endl;

  return 0;
}

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

int main() {

	int n;
	string s; cin >> n >> s;
	for (int i = 0; i < s.size(); i++) {
		int tmp = (s[i] - 'A') + n;
		if (26 <= tmp) tmp -= 26;
		char c = tmp + 'A';
		s[i] = c;
	}
    cout << s << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
  vector<int> vec(5);
    for (int i = 0; i < 5; i++) {
    cin >> vec.at(i);
  }
  for(int i=0;i<=4;i++){
  if (vec.at(i)==0)
    cout << i+1 << endl;
  }
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(int n,char**){
    cin>>n;
    switch(n%10){
        case 3:
            cout<<"bon"<<endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout<<"pon"<<endl;
            break;
        default:
            cout<<"hon"<<endl;
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int dp[1<<20][20];
int n,cost[20][20];
string s[20];

int rec(int S,int x){
  if(S==(1<<(n+1))-1)return 0;
  if(dp[S][x]!=-1)return dp[S][x];
  int ans=0;
  for(int i=0;i<n;i++){
    if(S>>i&1)continue;
    int re;
    if(cost[x][i]==s[i].size())re=rec(S+(1<<i),x);
    else re=rec(S+(1<<i),i);
    ans=max(ans,re+cost[x][i]);
  }
  return dp[S][x]=ans;
}


int c(string a,string b){
  for(int i=0;i<a.size();i++){
    int sum=0;
    int f=1;
    for(int j=0;j<b.size();j++){
      int ni=i+j;
      if(ni>=a.size())break;
      if(a[ni]!=b[j]){
	f=0;
	break;
      }
      sum++;
    }
    if(f)return sum;
  }
  return 0; 
}

int main(){
  queue<int> q;
  while(cin>>n,n){
    int sum=0;
    for(int i=0;i<(1<<20);i++)
      for(int j=0;j<20;j++)
	dp[i][j]=-1;
    for(int i=0;i<n;i++){
      cin>>s[i];
      sum+=s[i].size();
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cost[i][j]=c(s[i],s[j]);
      }
    }
    int ans=0;
    for(int i=0;i<n;i++){
      ans=max(ans,rec(1<<i,i));
    }
    q.push(sum-ans);
  }
  while(!q.empty()){
    cout<<q.front()<<endl;
    q.pop();
  }
  return 0;
}



Measured memory_bytes: 84932
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
int main(void)
{
	int n,i,j,u,k,v,c,min,ki;
	int ri[101][101],flg[101];
	int ans[101];
	scanf("%d",&n);
	for(i=0;i<=100;i++) for(j=0;j<=100;j++) ri[i][j]=M;
	for(i=0;i<n;i++){
		scanf("%d %d",&u,&k);
		for(j=0;j<k;j++){
			scanf("%d %d",&v,&c);
			if(ri[i][v]>c){
				ri[i][v]=c;
			}
		}
	}
	for(i=0;i<n;i++) flg[i]=0,ans[i]=M;
	//for(i=0;i<n;i++) for(j=0;j<n;j++) if(ri[i][j]!=M) printf("%d-%d %d\n",i,j,ri[i][j]);
	ans[0]=0;
	for(i=0;i<n;i++){
		min=M;
		for(j=0;j<n;j++){
			if(flg[j]==0&&ans[j]<min){
				min=ans[j];
				ki=j;
			}
		}
		flg[ki]=1;
		for(j=0;j<n;j++){
			if(min+ri[ki][j]<ans[j]){
				ans[j]=min+ri[ki][j];
			}
		}
	}
	//for(i=0;i<n;i++) printf("%d\n",ans[i]);
	for(i=0;i<n;i++) printf("%d %d\n",i,ans[i]);
	return 0;
}


Measured memory_bytes: 3236
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define pi pair<int, int>
#define endl "\n"

#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace __gnu_pbds;
using namespace std;

ll mod = 1e8;

ll add(ll a, ll b) { return (a % mod + b % mod) % mod; }
ll mul(ll a, ll b) { return (a % mod * b % mod) % mod; }
void debug(vector<int> a) {
    for(int i: a) cout << i << " ";
    cout << "\n";
}
// abc abc
double distance(pair<double, double> p, pair<double, double> q) {
    return sqrt((q.first-p.first)*(q.first-p.first) + (q.second-p.second)*(q.second-p.second));
}
int main() {
    fastio
    int n; cin >> n;
    vector<pair<double, double>> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    vector<int> num(n);
    for(int i=0; i<n; i++) num[i] = i;

    double ans = 0;
    int cnt = 0;
    do {
        cnt++;
        for(int i=1; i<n; i++) {
            ans += distance(a[num[i-1]], a[num[i]]);
        }
    } while(next_permutation(num.begin(), num.end()));
    ans = ans / cnt;
    printf("%0.7f", ans);
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;

	if (a + b + c >= 22) cout << "bust" << "\n";
	else cout << "win" << "\n";

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class C
{
	static void Main()
	{
		Console.ReadLine();
		var a = Console.ReadLine().Split().Select(int.Parse).GroupBy(x => x).ToDictionary(g => g.Key, g => g.Count());
		var A = a.Max(p => p.Key);

		var c = new long[A + 1];
		for (var d = 1; d <= A; d++) c[d] = MInv(d);
		for (var d = 1; d <= A / 2; d++)
			for (var m = 2 * d; m <= A; m += d) c[m] = MSub(c[m], c[d]);

		var h = MInv(2);
		long s = 0;
		for (var d = 1; d <= A; d++)
		{
			long si = 0, si2 = 0;
			for (var m = d; m <= A; m += d)
			{
				if (!a.ContainsKey(m)) continue;
				si = MAdd(si, MMul(a[m], m));
				si2 = MAdd(si2, MMul(a[m], MMul(m, m)));
			}
			s = MAdd(s, MMul(MMul(MSub(MMul(si, si), si2), h), c[d]));
		}
		Console.WriteLine(s);
	}

	const int M = 998244353;
	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
	static long MInv(long x) => MPow(x, M - 2);
	static long MInt(long x) => (x %= M) < 0 ? x + M : x;
	static long MAdd(long x, long y) => (x + y) % M;
	static long MSub(long x, long y) => MInt(x - y);
	static long MMul(long x, long y) => x * y % M;
	static long MDiv(long x, long y) => x * MInv(y) % M;
}


Measured memory_bytes: 69368