akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DEL(v) decltype(v)().swap(v)
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

signed main()
{
   string s; cin >> s;
   int X, Y; cin >> X >> Y;

   int N = SZ(s);
   V<int> L;
   int cnt = 0;
   FORE(i, 0, N) {
      if (i != N && s[i] == 'F') {
         cnt++;
      } else {
         L.PB(cnt);
         cnt = 0;
      }
   }

   V<int> RL, UD;
   FOR(i, 1, SZ(L)) {
      if (i % 2 == 0) RL.PB(L[i]);
      else UD.PB(L[i]);
   }

   V<V<bool>> dp0(SZ(RL)+1, V<bool>(2*N+1, 0));
   dp0[0][L[0] +N] = 1;
   FOR(i, 0, SZ(RL))
      FOR(x, 0, 2*N) {
         if (x-RL[i] >=   0) dp0[i+1][x-RL[i]] = dp0[i+1][x-RL[i]] || dp0[i][x];
         if (x+RL[i] <= 2*N) dp0[i+1][x+RL[i]] = dp0[i+1][x+RL[i]] || dp0[i][x];
      }

   V<V<bool>> dp1(SZ(UD)+1, V<bool>(2*N+1, 0));
   dp1[0][N] = 1;
   FOR(i, 0, SZ(UD))
      FOR(y, 0, 2*N) {
         if (y-UD[i] >=   0) dp1[i+1][y-UD[i]] = dp1[i+1][y-UD[i]] || dp1[i][y];
         if (y+UD[i] <= 2*N) dp1[i+1][y+UD[i]] = dp1[i+1][y+UD[i]] || dp1[i][y];
      }

   bool ans = dp0[SZ(RL)][X+N] && dp1[SZ(UD)][Y+N];
   cout << (ans ? "Yes" : "No") << endl;

   return 0;
}


Measured memory_bytes: 16256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  string s;
  cin >> s;
  string l = s.substr(0, n);
  string r = s.substr(n);
  reverse(all(r));
  // cout << "l: " << l << endl;
  // cout << "r: " << r << endl;

  // Here, we want to check all substring of l and r.
  map<pair<string, string>, ll> patterns; // pair of <pattern, count>
  rep(i, 1ll<<n) {
    string red, blue;
    rep(j, n) {
      if (i & 1ll<<j) {
        red += l[j];
      } else {
        blue += l[j];
      }
    }
    reverse(all(blue));

    pair<string, string> pattern = { red, blue };
    ++patterns[pattern];
  }

  ll ans = 0;
  // Here, we want to find the pattern in right.
  rep(i, 1ll<<n) {
    string red, blue;
    rep(j, n) {
      if (i & 1ll<<j) {
        red += r[j];
      } else {
        blue += r[j];
      }
    }
    reverse(all(blue));

    pair<string, string> pattern = { red, blue };
    if (patterns.find(pattern) != patterns.end()) {
      ans += patterns[pattern];
    }
  }

  cout << ans << endl;
}


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

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

    vector<int> a(N);
    for( int i = 0; i < N; ++i )
        cin >> a[i];


    sort(a.begin(), a.end(), std::greater<int>());

    int alice = 0, bob = 0;
    for( int i = 0; i < N; ++i ){
        if( (i&1) == 0 ) alice += a[i];
        else bob += a[i];
    }


    cout << alice-bob << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long
int main(){
    ll n,count=0;
    cin>>n;
    for(ll i=1;i<n;i++){
        if(n%i==0)
        count=count+(n/i)-1;
        else
        count=count+(n/i);
    }
    cout<<count;
}

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

int main() {
  int n, c = 0;
  string num;

  cin >> num;
  c = num.size();
  for (int i = 0; i < (c / 2); i++) {
    if (num[i] != num[c - 1 - i]) {
      cout << "No" << endl;
      return 0;
    }
    else if (i == (c / 2) - 1) {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1e9
#define MOD 1e9+7
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

void chmin(int &a, int b) { if (a > b) a = b; }

int N,A,B,C;
vector<int> L;
int rec(int i, int a, int b, int c){
    if(i==N){
        if(!a || !b || !c) return INF;
        return abs(a-A)+abs(b-B)+abs(c-C);
    }
    int res = rec(i+1,a,b,c);

    chmin(res, rec(i+1, a+L[i],b,c)+(a?10:0));
    chmin(res, rec(i+1, a,b+L[i],c)+(b?10:0));
    chmin(res, rec(i+1, a,b,c+L[i])+(c?10:0));

    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N>>A>>B>>C;
    L.resize(N);
    for(int i=0;i<N;i++) cin>>L[i];

    cout<<rec(0,0,0,0)<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val N = nl()
    val X = nl()
    val T = nl()
    out.println((N + X - 1) / X * T)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 34692
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int q;
	std::cin >> q;
	rep(qq,q) {
		int a,b;
		std::cin >> a >> b;
		if(a>b) std::swap(a,b);
		if(a==b) print(2*a-2);
		else if(a+1==b) print(2*a-2);
		else {
			int l=-1,r=1e9+1;
			while(r-l>1) {
				int o=(r+l)>>1;
				if(o*o<a*b) l=o;
				else r=o;
			}
			int c=l;
			if(c*(c+1)>=a*b) print(2*c-2);
			else print(2*c-1);
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

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

    vector<vector<int>> D(C,vector<int>(C,0));
    for(int i=0;i<C;i++){
        for(int j=0;j<C;j++){
            cin>>D[i][j];
        }
    }
    vector<vector<int>> samemod(3,vector<int>(C,0));
    int c;
    for(int i=0;i<N;i++){
        for (int j = 0; j < N; ++j) {
            cin>>c; c--;
            samemod[(i+j+2)%3][c]++;
        }
    }
    ll ans=1e18;
    for(int i=0;i<C;i++){ //mod0
        for (int j = 0; j < C; ++j) { //mod1
            if(i==j) continue;
            for (int k = 0; k < C; ++k) { //mod2
                if(k==i||k==j) continue;
                ll tmp=0;
                for (int m = 0; m < 3; ++m) {
                    int cmp=0;
                    if(m==0) cmp=i;
                    else if(m==1) cmp=j;
                    else cmp=k;
                    for(int col=0;col<C;col++){
                        tmp+=(ll)samemod[m][col]*D[col][cmp];
                    }
                }
                ans=min(ans,tmp);
            }
        }
    }

    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
def primes(n):
  ass = []
  is_prime = [True] * (n + 1)
  is_prime[0] = False
  is_prime[1] = False
  for i in range(2, int(n**0.5) + 1):
    if not is_prime[i]:
      continue
    for j in range(i * 2, n + 1, i):
       is_prime[j] = False
  for i in range(len(is_prime)):
    if is_prime[i]:
      ass.append(i)
  return ass
L = primes(N)
factorial_factor = []
for i in range(len(L)):
  k = L[i]
  cnt = 0
  cur = 1
  while N//k > 0:
    cnt += N//k
    cur += 1
    k = L[i]**(cur)
  factorial_factor.append([L[i],cnt])
ans = 0
A,B,C,D,E,F = 0,0,0,0,0,0
for i in range(len(factorial_factor)):
  if factorial_factor[i][1] >= 74:
    ans += 1
for i in range(len(factorial_factor)):
  if factorial_factor[i][1] >= 14:
    A += 1
  elif factorial_factor[i][1] >= 4:
    B += 1
ans += A*(A-1)+A*B
for i in range(len(factorial_factor)):
  if factorial_factor[i][1] >= 24:
    C += 1
  elif factorial_factor[i][1] >= 2:
    D += 1
ans += C*(C-1)+C*D
for i in range(len(factorial_factor)):
  if factorial_factor[i][1] >= 4:
    E += 1
  elif factorial_factor[i][1] >= 2:
    F += 1
ans += E*(E-1)*F//2+E*(E-1)*(E-2)//2
print(ans)

Measured memory_bytes: 3188
N, A, B = map(int, input().split())

if(N <= (A+B)):
    if(N<=A):
        print(N)
    else:
        print(A)
else:
    ans = (N//(A+B)) * A
    amari=(N % (A+B))
    tmp=A
    if(amari <= tmp):
        ans+=amari
    else:
        ans+=tmp

    print(ans)


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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, t; cin >> n >> t;
  vector<pair<int, int>> a(n);
  REP(i, n) {
    cin >> a[i].first >> a[i].second;
  }

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

  REP(i, n) {
    if(a[i].second <= t) {
      cout << a[i].first << endl;
      return 0;
    }
  }

  cout << "TLE" << endl;
  
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(x,y,z);
  x -= z;
  while(x>=y+z){
    x -= y+z;
    c++;
  }
  OUT(c);
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;

const int inf = 1e9;

#define x1 qoiweur
#define y1 waklsdjf
#define x2 asldkfjlsajdfl
#define y2 qqoiuiui


int n, m, k;
int x1,y1,x2,y2;

vector<vector<int>> g;
vector<vector<int>> dist;


struct dat {
    pair<int,int> cost;
    int x, y;
    int dir;
    dat (pair<int,int> a, int b, int c, int d) {
	cost = a;
	x = b;
	y = c;
	dir = d;
    }
    bool operator<(const dat& o) const {
	return make_pair(cost, make_pair(x,make_pair(y,dir))) <
	    make_pair(o.cost, make_pair(o.x, make_pair(o.y, o.dir)));
    }
};

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

    cin>>n>>m>>k;
    cin>>x1>>y1>>x2>>y2;
    x1--;y1--;x2--;y2--;

    
    g.resize(n, vector<int>(m, 0));
    dist.resize(n, vector<int>(m, inf));


    vector<vector<vector<int>>> done(n, vector<vector<int>>(m, vector<int>(4, 0)));

    
    for (int i=0; i<n; i++) {
	for (int j=0; j<m; j++) {
	    char c; cin>>c;
	    if (c=='@') {
		g[i][j]=1;
	    }
	}
    }


    dist[x1][y1]=0;
    set<dat> s;
    s.insert({ {0,0}, x1, y1, 0 });
    s.insert({ {0,0}, x1, y1, 1 });
    s.insert({ {0,0}, x1, y1, 2 });
    s.insert({ {0,0}, x1, y1, 3 });

    while (!s.empty()) {
	auto cur = *s.begin();
	s.erase(s.begin());
	if (g[cur.x][cur.y]==1) {
	    continue;
	}
	if (done[cur.x][cur.y][cur.dir]) continue;
	done[cur.x][cur.y][cur.dir] = 1;
	dist[cur.x][cur.y] = cur.cost.first + (cur.cost.second>00);
	
	for (int dd=0; dd<4; dd++) {
	    int x = cur.x; int y = cur.y;
	    pair<int,int> cost = cur.cost;
	    if (dd == cur.dir) {
		if (dd==0) {
		    x++;
		} else if (dd==1) {
		    x--;
		} else if (dd==2) {
		    y++;
		} else if (dd==3) {
		    y--;
		}
		if (x<0||y<0||x>=n||y>=m) continue;
		cost.second++;
		if (cost.second == k) {
		    cost.first++; cost.second=0;
		}
		s.insert({cost, x, y, dd});
	    } else {
		if (cost.second > 0) {
		    cost.first++;
		}
		cost.second = 0;
		s.insert({cost, x, y, dd});
	    }
	}
    }


    // for (int i=0; i<n; i++) {
    // 	for (int j=0; j<m; j++) {
    // 	    cout<<dist[i][j]<<" ";
    // 	}
    // 	cout<<endl;
    // }
    


    auto res = dist[x2][y2];
    if (res == inf) out(-1);
    out(res);
    
    return 0;
}


Measured memory_bytes: 120480
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
	public static void Main()
	{
		int[] HW = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int H = HW[0], W = HW[1];
		for (int i = 0; i < H; i++)
		{
			var S = Console.ReadLine().Split();
			for (int j = 0; j < W; j++)
			{
				if (S[j] == "snuke")
				{
					Console.WriteLine($"{(char)('A' + j)}{i + 1}");
				}
			}
		}
	}
}

Measured memory_bytes: 3032
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
char a[110],b[110],c[110];
int ans=0;
int s[5];
int main(){
  	int n;
  	char t;
	scanf("%d%c",&n,&t);
  	scanf("%s%c%s%c%s",a,&t,b,&t,c);
  	for(int i=0;i<n;i++){
    	s[1]=a[i];
      	s[2]=b[i];
      	s[3]=c[i];
      	sort(s+1,s+3+1);
      	if(s[3]==s[1])
         	continue;
      	if(s[2]==s[1] || s[2]==s[3]){
        	ans++;
          	continue;
       	}
		ans+=2;
		continue;
   	}
  	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 888
from itertools import product
import bisect
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))


S = input()
ans = 0
for p in product(range(2), repeat=len(S)-1):
    tmp = ''
    for i in range(len(S)-1):
        if p[i] == 1:
            tmp += S[i]+'+'
        else:
            tmp += S[i]
    ans += eval(tmp+S[-1])
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
int main()
{
	string s;
	cin >> s;
	vector<int> v;
	int cnt  = 1 ;
	int ans = 0 ;
	for(int i = 1 ; i < s.size() ; i++)
	{
		if(s[i] != s[i-1])
		{
			ans = max(ans,cnt);
			v.push_back(cnt);
			cnt = 0;
		}
		cnt++;
	}
	int tot = cnt,n = s.size(),ans2 = max(n-tot,tot);
	while(v.size())
	{
		ans2 = min(ans2,max(n-tot,tot));
		tot+=v.back();
		v.pop_back();
		ans2 = min(ans2,max(n-tot,tot));
	}
	cout << max(ans,ans2) << endl;
}


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

int main() {
  vector<int> vec(5);
  int cnt=0;
  rep(i,5){
    cin>>vec[i];
    cnt+=(vec[i]+9)/10*10;
  }
  bool bl=true;
  int ans=1e9,a=0;
  rep(i,5){
    if(vec[i]%10!=0){
      bl=false;
      a=vec[i]%10;
    }
    ans=min(ans,a);
  }
  if(bl)cout<<cnt<<endl;
  else cout<<cnt-10+ans<<endl;
}

Measured memory_bytes: 3592
// A - Connection and Disconnection
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll f(const string &S){//文字列の操作回数を求める
	ll c = 0;
	for(int i=1; i < S.size(); ++i)
		if(S[i-1] == S[i]){ c++; i++; }
	return c;
}

int main(){
	string S; cin>>S;
	ll K; cin>>K;

	ll s1 = f(S);//K=1 のときの操作回数
	ll s2 = f(S+S);//K=2 のときの操作回数
	ll s3 = f(S+S+S);//K=3 のときの操作回数

	ll d1 = s2 - s1;//K=2 と K=1 の操作回数の差分
	ll d2 = s3 - s2;//K=3 と K=2 の操作回数の差分

	ll ans = 0;
	//繰り返し K <= 3 までは計算済み
	if(K < 2) ans = s1;
	else if(K < 3) ans = s2;
	else if(K < 4) ans = s3;
	else{
		//ここからは等差数列の問題
		if(d1 == d2) ans = s1 + d1 * (K-1);
		else
			if(K % 2) ans = s1 + (d1+d2) * ((K+2-1)/2-1);//(k/2):roundup
			else ans = s2 + (d1+d2) * (K/2-1);
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
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 mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=200005;
const int mlog=20;
int n;
vector<int>edge[maxn];
int dep[maxn],par[maxn][mlog];
int sum1[maxn],sum2[maxn],val[maxn],f[maxn];

void prework(int x,int p,int d,int mx){
	dep[x]=d;
	par[x][0]=p;
	REP(j,mlog-1)par[x][j]=par[par[x][j-1]][j-1];
	val[x]=mx;
	mx=max(mx,x);
	rep(i,int(edge[x].size())){
		int y=edge[x][i];
		if(y==p)continue;
		prework(y,x,d+1,mx);
	}
}
void work(int rt,int x,int p,bool en){
	sum1[x]=1;
	if(x!=rt&&x>val[rt])en=true;
	sum2[x]=!en;
	rep(i,int(edge[x].size())){
		int y=edge[x][i];
		if(y==p||y>rt)continue;
		work(rt,y,x,en);
		sum1[x]+=sum1[y];
		sum2[x]+=sum2[y];
	}
}
void calc(int x,int p){
	if(x==1)f[x]=0;
	else{
		int y=val[x],z=x;
		for(int i=mlog-1;i>=0;i--){
			if(par[z][i]&&dep[par[z][i]]>dep[y])z=par[z][i];
		}
		f[x]=f[y];
		if(z<y)f[x]+=sum1[z];
		if(z<val[y])f[x]-=sum2[z];
		if(x>y)f[x]+=sum2[x];
	}
	rep(i,int(edge[x].size()))
		if(edge[x][i]!=p)calc(edge[x][i],x);
}

int main(){
	scanf("%d",&n);
	REP(i,n-1){
		int u,v;
		scanf("%d%d",&u,&v);
		edge[u].pb(v);
		edge[v].pb(u);
	}
	prework(1,0,0,0);
	for(int i=n;i>=1;i--)if(!sum1[i])work(i,i,par[i][0],false);
	calc(1,0);
	for(int i=2;i<=n;i++)printf("%d%c",f[i],i==n?'\n':' ');
	return 0;
}

Measured memory_bytes: 47744
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
typedef long long ll;
#define MAX 100100
using namespace std;

int N, D[20][20], ans = 0;

void f(int x, int cnt, int b) {
	if (x == N + 1) {
		if (ans < cnt) {
			int A[20], t = 0;
			for (int i = 1; i <= N; i++) {
				A[i] = -1;
			}
			for (int i = 1; i <= N; i++) {
				if ((1 << (i - 1)) & b) {
					if (A[i] == 0) return;
					A[i] = 1;
					for (int j = 1; j <= N; j++) {
						if (D[i][j] == -1) continue;
						if (A[j] != -1 && D[i][j] != A[j]) return;
						A[j] = D[i][j];
					}
				}
			}
			for (int i = 1; i <= N; i++) {
				if (A[i] == 1) t |= (1 << (i - 1));
			}
			if(b==t)ans = cnt;
		}
		return;
	}
	f(x + 1, cnt + 1, b | (1<<(x-1)));
	f(x + 1, cnt, b);
}
int main()
{	
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		int n; scanf("%d", &n);
		for (int j = 1; j <= N; j++) {
			D[i][j] = -1;
		}
		for (int j = 0; j < n; j++) {
			int x, y; scanf("%d%d", &x, &y);
			D[i][x] = y;
		}
	}
	f(1, 0, 0);
	printf("%d", ans);
	return 0;
}

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

using namespace std;

int main(){

	int a, b, c;

	cin>>a>>b>>c;

	if(a > b) swap(a, b);

	if(b > c) swap(b, c);

	if(a > b) swap(a, b);

	cout<<a<<" "<<b<<" "<<c<<endl;

	
	return 0;

}



Measured memory_bytes: 3120
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;

int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b);
	return 0;
}

Measured memory_bytes: 256
//33
#include<iostream>

using namespace std;

int main(){
  int m,n;
  cin>>m>>n;
  int ans=0;
  while(m--){
    int c=0;
    for(int i=0;i<n;i++){
      int a;
      cin>>a;
      c+=a;
    }
    if(ans<c){
      ans=c;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1160
import static java.lang.System.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n=sc.nextInt(), x=sc.nextInt();
		int min = Integer.MAX_VALUE;
		for (int i=0; i<n; i++) {
			int temp = sc.nextInt();
			min = Math.min(min,temp);
			x -= temp;
		}
		out.println(n+(x/min));
	}
}

Measured memory_bytes: 22612
using System;

class Program
{
    public static void Main(string[] args)
    {
        var firstInput = Console.ReadLine().Split(' ');
        int num = int.Parse(firstInput[0]);
        int demantion = int.Parse(firstInput[1]);

        int[,] heimen = new int[num, demantion];

        for (int i = 0; i < num; i++)
        {
            var nyuRyoku = Console.ReadLine().Split(' ');
            for (int j = 0; j < demantion; j++)
            {
                heimen[i, j] = int.Parse(nyuRyoku[j]);
            }
        }

        int isSeisu = 0;

        for (int i = num - 1; i > 0; i--)
        {
            for (int j = i - 1; j >= 0; j--)
            {
                if (i == j)
                {
                    continue;
                }
                var sum = 0.0;
                for (int bd = 0; bd < demantion; bd++)
                {
                    var eachSabun = heimen[i, bd] - heimen[j, bd];
                    sum += Math.Pow(eachSabun, 2);
                }
                var result = Math.Sqrt(sum);
                var resultInt = Math.Floor(result);

                isSeisu += result == resultInt ? 1 : 0;
            }
        }
        Console.WriteLine(isSeisu);
    }
}

Measured memory_bytes: 13140
import numpy as np
N,W=map(int,input().split())
dp=np.ones(10**5+1, dtype='int64')
dp[0]=0
dp[1:]=dp[1:]*(10**9+1)
for i in range(N):
    wi,vi=map(int,input().split())
    dp[vi:]=np.minimum(dp[vi:],dp[:-vi]+wi)
print(np.max(np.where(dp <= W)))

Measured memory_bytes: 14812
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

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

int main() {
    int n = gi();
    int x = gi();
    int g = 0;
    for (int i = 0; i < n; i++) {
        int y = gi()-x;
        g = gcd(g, y < 0 ? -y : y);
    }

    printf("%d\n", g);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <fstream>
#include <cassert>
#include <unordered_map>
#include <cstring>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;

int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	int kk;
	cin >> s >> kk;
	ll ans = 0;
	int n = s.size();
	if (kk == 1) {
		for (int i = 0; i < n; i++) {
			for (int j = 1; j <= 9; j++) {
				string cur = "";
				for (int k = 0; k < i; k++) {
					cur += to_string(0);
				}
				cur += to_string(j);
				for (int k = i + 1; k < n; k++) {
					cur += to_string(0);
				}
				if (cur <= s)ans++;
			}
		}
		cout << ans;
	}
	else if (kk == 2) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < i; j++) {
				for (int num1 = 1; num1 <= 9; num1++) {
					for (int num2 = 1; num2 <= 9; num2++) {
						if (j != 0)ans++;
						else {
							string cur = to_string(num2);
							for (int k = 1; k < i; k++) {
								cur += to_string(0);
							}
							cur += to_string(num1);
							for (int k = i + 1; k < n; k++) {
								cur += to_string(0);
							}
							if (cur <= s)ans++;
						}
					}
				}
			}
		}
		cout << ans;
	}
	else if (kk == 3) {
		if(n > 3)ans = max(0, (n - 1) * (n - 2) * (n - 3) / 6) * 9 * 9 * 9;
		if(n > 2)ans += max(0, (s[0] - '0' - 1) * 81 * (n - 1) * (n - 2) / 2);
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < i; j++) {
				for (int num2 = 1; num2 <= 9; num2++) {
					for (int num3 = 1; num3 <= 9; num3++) {
						string cur = to_string(s[0] - '0');
						for (int k = 1; k < j; k++) {
							cur += '0';
						}
						cur += to_string(num2);
						for (int k = j + 1; k < i; k++) {
							cur += '0';
						}
						cur += to_string(num3);
						for (int k = i + 1; k < n; k++) {
							cur += '0';
						}
						//cout << cur << "\n";
						if (cur <= s)ans++;
					}
				}
			}
		}
		cout << ans;
	}
}



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

int n, p[210], q[210], m[210], a[210];

long long extend_gcd(long long a,long long b,long long &x,long long &y)
{
    if(a == 0 && b == 0)return -1;
    if(b ==0 ){x = 1; y = 0;return a;} long long d = extend_gcd(b,a%b,y,x); y -= a/b*x;
    return d;
}


bool solve(long long &m0, long long &a0, int m, int a)
{
    long long y,x;
    long long g = extend_gcd(m0,m,x,y);
    if( abs(a - a0)%g ) return false;
    x *= (a - a0)/g;
    x %= m/g;
    a0 = (x*m0 + a0); m0 *= m/g;
    a0 %= m0;
    if( a0 < 0 )a0 += m0;
    return true;
}


bool MLES(long long &m0, long long &a0, int n)
{
    bool flag = true; m0 = 1;
    a0 = 0;
    for(int i = 1; i <= n; i++)
        if( !solve(m0, a0, m[i], a[i]))
        {
            flag = false;
            break;
        }
    return flag;
}


int main()
{
    scanf("%d", &n);
    for (int i=1; i<=n; i++) scanf("%d", &p[i]);
    for (int i=1; i<=n; i++) scanf("%d", &q[i]);
    for (int i=1; i<=n; i++)
    {
        int x=p[i], count=0;
        a[i]=-1;
        for (;;)
        {
            if (x==i) a[i]=count;
            x=q[x];
            count++;
            
            if (x==p[i])
            {
                m[i]=count;
                break;
            }
        }
        if (a[i]==-1) { puts("-1"); return 0; }
    }
    long long m0, a0;
    if (!MLES(m0, a0, n)) { puts("-1"); return 0; }
    else
    {
        printf("%lld\n", (a0+m0)%m0);
    }
}



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

int n, k;
long long int h[220000];


int main(){
  cin >> n >> k;
  rep(i, n) cin >> h[i];
  sort(h, h+n);
  //rep(i, n) cout << h[i] << " ";
  //cout << endl;
  long long int sum = 0;
  rep(i, n-k){
    sum += h[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1792
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>


using namespace std;
#if 0
struct Sq {
    int64_t x; // [0, W-3]
    int64_t y; // [0, H-3]

    bool operator==(const Sq& rhs) const {
        return rhs.x == x && rhs.y == y;
    }
    bool operator!=(const Sq& rhs) const {
        return !operator==(rhs);
    }
};

namespace std {
template <>
struct hash<Sq> {
    std::size_t operator()(const Sq& key) const {
        return std::hash<int64_t>()(key.x + key.y);
    }
};
} // namespace std
#endif


/* ソート済みの配列について、
   オブジェクトとその個数を得る。
 */
template<typename Itr, typename Fn>
void counting(Itr b, Itr e, Fn f) {
    if (b == e) {
        // no element;
        return;
    }
    size_t count = 0;
    auto&& itr = b;
    for (; itr + 1 != e; ++itr) {
        count++;
        if (*itr != *(itr + 1)) {
            f(*itr, count);
            count = 0;
        }
    }

    f(*itr, ++count);
}


int main()
{
    int64_t H, W, N;
    std::cin >> H >> W >> N;

    struct Sq {
        int64_t x; // [0, W-3]
        int64_t y; // [0, H-3]
        bool operator==(const Sq& rhs) const {
            return rhs.x == x && rhs.y == y;
        }
        bool operator!=(const Sq& rhs) const {
            return !operator==(rhs);
        }
    };

    std::vector<Sq> sqs;

    for (int64_t i = 0; i < N; ++i) {
        int64_t x, y;
        std::cin >> y >> x;
        x--; // [0, W-3]
        y--; // [0, H-3]
        for (int64_t xx = x - 2; xx <= x; ++xx) {
            for (int64_t yy = y - 2; yy <= y; ++yy) {
                if (xx >= 0 && yy >= 0 && xx <= W - 3 && yy <= H - 3) {
                    sqs.push_back({xx, yy});
                }
            }
        }
    }

    std::sort(std::begin(sqs), std::end(sqs),
              [](const auto& a, const auto& b) {
                  return a.x !=  b.x ? a.x < b.x : a.y < b.y;
              });

    std::vector<uint64_t> ans(10);
    ans[0] = (H-2) * (W-2);
    counting(sqs.begin(), sqs.end(),
             [&ans](auto, size_t count) -> void {
                 ans[count]++;
                 ans[0]--;
             });

    for (auto&& a: ans) {
        std::cout << a << std::endl;
    }

    return 0;
}


Measured memory_bytes: 18792
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n,m;
char c[101][101]; 
int main(){
	fastio;
	cin>>n>>m;
	rb(i,1,n)
		rb(j,1,m)
			cin>>c[i][j];
	int dp[101][101];
	memset(dp,0x3f,sizeof(dp));
	dp[1][1]=c[1][1]!='.';
	rb(i,1,n)
		rb(j,1,m){
			if(i+j!=2){
				if(i!=1){
					dp[i][j]=min(dp[i][j],dp[i-1][j]+(c[i][j]=='#'&&c[i-1][j]!=c[i][j]));
				}
				if(j!=1){
					dp[i][j]=min(dp[i][j],dp[i][j-1]+(c[i][j]=='#'&&c[i][j-1]!=c[i][j]));
				}
			}
		}
	cout<<dp[n][m]<<endl;
	return 0;
}


Measured memory_bytes: 256
import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for i in range(n):
    for j in range(n):
        if i < j:
            delta = math.sqrt(sum([(x[i][k] - x[j][k]) ** 2 for k in range(d)]))
            if delta == int(delta):
                ans += 1
print(ans)


Measured memory_bytes: 9116
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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

signed main(){
	ll n,k;
	cin >> n >> k;
	if(k != 1)cout << n-k << endl;
	else cout << 0 << endl;
	
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		sum %= MOD;
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		sum = sum + MOD - a[i];
		sum %= MOD;
		ans += a[i] % MOD * sum % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3984
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll N;
    string S;
    cin >> N >> S;
    for (char &c : S) {
        c = (c - 'A' + N) % 26 + 'A';
    }

    cout << S << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N / 2 << endl;
    } else {
        cout << N / 2 + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int main(){
    long long int x,total;
    scanf("%lld",&x);
    if(x%11>6) total=(x/11)*2+2;
    else if(6>=x%11&&x%11>0) total=(x/11)*2+1;
    else total=(x/11)*2;
    printf("%lld",total);
    return 0;
}

Measured memory_bytes: 1704
import java.io.*;

public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            String s = in.readLine();
            if (s == null) {
                break;
            }
            f(s);
        }
        //*/
    }

    public static void f(String s) {
        int week = Integer.parseInt(s);
        double loan = 100000;
        for (int i = 0; i < week; i++) {
            loan = Math.ceil(loan * 1.05 / 1000) * 1000;
        }
        System.out.println((int)loan);
    }
}

Measured memory_bytes: 9584
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.map!(to!int).array; }

void calc(string s) {
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';

    int reduce(int lhs, int rhs, int op) {
        return op == 0 ? lhs + rhs : lhs - rhs;
    }
    string op(int op) {
        return op == 0 ? "+" : "-";
    }

    for (int i = 0; i < 2; i++) {
        int x = reduce(a, b, i);
        for (int j = 0; j < 2; j++) {
            int y = reduce(x, c, j);
            for (int k = 0; k < 2; k++) {
                int z = reduce(y, d, k);
                if (z == 7) {
                    // writeln(a, op(i), b, op(j), c, op(k), d, "=7");
                    writefln("%s%s%s%s%s%s%s=7", a, op(i), b, op(j), c, op(k), d);
                    return;
                }
            }
        }
    }
}

void main() {
    auto s = readln.chomp;
    calc(s);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a[N];
    REP(i, 0, N) {
        cin >> a[i];
    }
    ll tmp = 1;
    ll ans = 0;
    REP(i, 0, N) {
        if (tmp == a[i]) {
            tmp++;
            ans++;
        }
    }
    if (ans == 0) {
        cout << -1 << endl;
    } else {
        cout << N - ans << endl;
    }
}


Measured memory_bytes: 1792
// G++ MACRO.CPP -STD=C++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<ll,ll>
#define V vector<ll>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define str string

#define pb(a) push_back(a)
#define mp make_pair


int main(){
  CIN(n);VC1(n,a);
  ll cost=LINF;
  FOR(i,-101,101){
    ll num=0;
    REP(j,n){
      if(i != a[j])
        num += 1LL*(i-a[j])*(i-a[j]);
    }
    cost=min(cost,num);
  }
  COUT(cost);

  return 0;
}


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

using namespace std;

int main(){
  string s;
  cin>>s;

  int L=0, R=s.size()-1, ans=0;
  
  while(L<R){
    if(s[L]==s[R]){
      L++;
      R--;
    }else  if(s[L]=='x'){
      ans++;
      L++;
    }else if(s[R]=='x'){
      ans++;
      R--;
    }else{
      cout<<-1<<endl;
      return 0;
    }
      
  }

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
static auto re = regex("^A[a-z]+C[a-z]+$");
int main(void) {
    string s;
    cin >> s;
    if (regex_search(s, re)) {
        cout << "AC\n";
    } else {
        cout << "WA\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if((a*b*1)%2==1 || (a*b*2)%2==1 || (a*b*3)%2==1 ){
        cout<<"Yes"<<endl;
    }

    else{
        cout<<"No"<<endl;
    }


    return 0;
}



Measured memory_bytes: 256