akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int N = 1e7 + 10;
bool flag[N];
vector<int> prime;
int phi[N], cnt[N];

void euler_phi_gen(int n) {
  fill(flag, flag + n, false);
  phi[1] = 1;
  for (int i = 2; i < n; ++i)   {
    if (!flag[i]) {
      prime.push_back(i);
      phi[i] = 2;
      cnt[i] = 2;
    }
    for (int j = 0, k; j < prime.size() && (k = prime[j] * i) < n; ++j) {
      flag[k] = true;
      if (i % prime[j]) {
        phi[k] = phi[i] * 2;
        cnt[k] = 2;
      } else {
        phi[k] = phi[i] / cnt[i] * (cnt[i] + 1);
        cnt[k] = cnt[i] + 1;
        break;
      }
    }
  }
}

int main() {
  int n;
  cin >> n;
  euler_phi_gen(n + 1);
  int64 ret = 0;
  for (int i = 1; i <= n; ++i) {
    ret += 1LL * phi[i] * i;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 94888
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char[] S = sc.next().toCharArray();
    boolean isSame = true;
    if(N%2 != 0){
      System.out.print("No");
    }else{
      for(int i=0; i<N/2; i++){
        if(S[i] != S[i+(N/2)]){
          isSame = false;
        }
      }
      if(isSame){
        System.out.print("Yes");
      }else{
        System.out.print("No");
      }
    }
  }
}
    


Measured memory_bytes: 21972
'use strict'

function main(input) {

  const nums = input.split('\n')[1].split(' ').map(n => Number(n));

  const ans = nums.reduce((acc, cur, idx) => acc + (cur - 1), 0);

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  int n,m,a[10],w[10]={0,2,5,5,4,5,6,3,7,6},dp[10010]={};
  cin>>n>>m;
  fr(i,m) cin>>a[i];
  Fr(i,n) dp[i]=-1e9;
  Fr(i,n) fr(j,m) if(i>=w[a[j]]) dp[i]=max(dp[i],1+dp[i-w[a[j]]]);
  sort(a,a+m);reverse(a,a+m);
  int N=n;
  fr(i,dp[n]){
    fr(j,m){
      if((i==dp[n]-1&&N-w[a[j]]==0)||(i<dp[n]-1&&N-w[a[j]]>=0&&dp[N-w[a[j]]]==dp[N]-1)){cout<<a[j];N-=w[a[j]];break;}
    }
  }
  cout<<endl;
}

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

//int eval(int i, int j,int** diff,int* data);

int main()
{
  int n;
  cin>>n;
  long long int *data = new long long int[n];
  for(int i=0;i<n;i++)
  {
    cin>>data[i];
  }

  long long int **diff = new long long int*[n];
  for(int i=0;i<n;i++)
  {
    diff[i] = new long long int[n];
/*    for(int j=0;j<n;j++)
    {
      diff[i][j] = -1;
    }*/
  }
  for(int i=0;i<n;i++)
  {
    diff[i][i] = data[i];
  }
  for(int j=1;j<n;j++)
  {
    for(int i=0;i+j<n;i++)
    {
      diff[i][i+j] = max(data[i] - diff[i+1][i+j], data[i+j] - diff[i][i+j-1]);
    }
  }
  cout<<diff[0][n-1];
  //int ans = eval(0,n-1,diff,data);
  //cout<<ans;
  return 0;
}
/*
int eval(int i, int j,int** diff,int* data)
{
  if(diff[i][j] != -1)return diff[i][j];

  if(i==j){diff[i][j] = data[i]; return diff[i][j];}

  diff[i][j] = max(data[i]-eval(i+1,j,diff,data),data[j]-eval(i,j-1,diff,data));
  return diff[i][j];
}
*/


Measured memory_bytes: 46464
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int a,b,c;cin>>a>>b>>c;
    int res=0;
    chmax(res,a*10+b+c);
    chmax(res,b*10+a+c);
    chmax(res,c*10+a+b);
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<list>
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define ll rt<<1
#define rr rt<<1|1
#define mid int m=(x+((y-x)>>1))
#define lson x,m,rt<<1
#define rson m+1,y,rt<<1|1
#define lowbit(x) (x&-x)
#define PB push_back
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define fi freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;

const int N = 1e5 + 20;
const int inf = 1e9;

int n, m, q;
vector<int>g[N];
int d[N][12];
int col[N], ans[N];
int main()
{
#ifndef ONLINE_JUDGE
  
#endif

    SCC(n, m);
    FF(i, 1, m){
        int x, y; SCC(x, y);
        g[x].PB(y); g[y].PB(x);
    }
    col[0] = 0;
    SC(q);
    int mx = -1;
    FF(i, 1, q){
        int u, dis; SCCC(u, dis, col[i]);
        d[u][dis] = max(d[u][dis], i);
        mx = max(mx, dis);
    }
    ///go dp
    RR(i, mx, 1)
    {
        FF(u, 1, n)
        {
            if(d[u][i] == 0) continue;
            ///
            int sz = g[u].size();
            FF(j, 0, sz-1)
            {
                int v = g[u][j];
                d[v][i-1] = max(d[v][i-1], d[u][i]);
            }
        }
    }
    FF(i, 1, n)
    {
        FF(j, 0, mx)
        {
            ans[i] = max(ans[i], d[i][j]);
        }
    }
    FF(i, 1, n) PR(col[ans[i]]);
    return 0;
}


Measured memory_bytes: 12024
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

//#include"atcoder/all"


#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
//using namespace atcoder;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;


void solve() {
	int X, Y, Z, K; cin >> X >> Y >> Z >> K;
	vector<int>A(X), B(Y), C(Z);
	REP(i, X)cin >> A[i];
	REP(i, Y)cin >> B[i];
	REP(i, Z)cin >> C[i];
	VSORT(A); VREVERSE(A);
	VSORT(B); VREVERSE(B);
	VSORT(C); VREVERSE(C);
	vector<int>v;
	REP(i, X) {
		int cb = min(Y, (3000 + i) / (i + 1));
		REP(j, cb) {
			int cc = min(Z, (3000 + (i + 1)*(j + 1) - 1) / ((i + 1)*(j + 1)));
			REP(k, cc) {
				v.push_back(A[i] + B[j] + C[k]);
			}
		}
	}
	VSORT(v); VREVERSE(v);
	REP(i, K)print(v[i]);
}



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

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 4312
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long y = sc.nextLong();
        for(int i = 0; i <= 2000; i++){
            for(int j = 0; j <= 2000; j++){
                if((y - 10000*i - 5000*j)/1000 == n-i-j && n-i-j >= 0){
                    System.out.println(i + " " + j + " " + (n-i-j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    int n; ll x; 
    cin >> n >> x;
    vector<ll> as(n+1, 1), bs(n+1, 1);
    rep(i, n) as[i+1] = 2*as[i] + 3;
    rep(i, n) bs[i+1] = 2*bs[i] + 1;
    ll ans = 0;
    for(int i = n; i > 0; --i) {
        if (x == as[i]) {
            ans += bs[i];
            break;
        } 
        if (x >= 2 + as[i-1]) {
            ans += 1 + bs[i-1];
            x -= 2 + as[i-1];
        } else x -= 1;
        if (x < 2) {
            if (i == 1 && x == 1) ans += 1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define int long long
const int mod = 1e9 + 7;
int gt[200005], cgt[200005];
int pw(int a, int m){
	if(m == 0) return 1;
	int p = pw(a, m / 2);
	if(m % 2 == 0) return p * p % mod;
	else return p * p % mod * a % mod;
}
int nck(int n, int k){
	if(n < k) return 0;
	return gt[n] * cgt[k] % mod * cgt[n- k] % mod;
}
signed main(){
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	gt[0] = 1;
	cgt[0] = 1;
	for(int i = 1; i <= 200000; i++){
		gt[i] = gt[i - 1] * i % mod;
		cgt[i] = cgt[i - 1] * pw(i, mod - 2) % mod;
	}
	int ans = nck(h + w - 2, h - 1);
	for(int i = 0; i < a; i++){
		int t = nck(h - 1 - i + b - 1, b - 1) * nck(w - b + i - 1, w - b - 1) % mod;
		ans = (ans - t + mod) % mod;
	}
	cout << ans;
}

Measured memory_bytes: 3328
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    from collections import deque
    n,m=map(int,input().split())
    ab=[[] for _ in range(n)]
    for i in range(m):
        a,b=map(int,input().split())
        ab[a-1].append(b-1)
        ab[b-1].append(a-1)
    visit=[False]*n
    cnt=0
    while False in visit:
        for i in range(n):
            if visit[i]==True:
                continue
            cnt+=1
            q=deque()
            q.append(i)
            while q:
                x=q.popleft()
                visit[x]=True
                for nx in ab[x]:
                    if visit[nx]==True:
                        continue
                    q.append(nx)
    print(cnt-1)            

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 26788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  map<string, int> ans;
  rep(i, n) {
    string s;
    cin >> s;
    ans[s]++;
  }
  // for (auto el : ans) {
  //   cout << el.first << " x " << el.second << endl;
  // }
  cout << "AC x " << ans["AC"] << endl;
  cout << "WA x " << ans["WA"] << endl;
  cout << "TLE x " << ans["TLE"] << endl;
  cout << "RE x " << ans["RE"] << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

const long long MOD = 1e9 + 7;
const int INF = 1e9;

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> diff(N);
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    diff[i] = abs(x - X);
  }
  int res = 0;
  for (int i = 0; i < N; ++i) {
    res = gcd(res, diff[i]);
  }
  cout << res << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int n;
    char s[110];
    scanf("%d",&n);
    scanf("%s",s);

    for(int i=0;i<n;i++)
    {
        // printf("s[%d]-a=%d\n",i,s[i]-'a');
    }
    int max=0;
    for(int i=1;i<n;i++)
    {
        bool a[100]={};
        bool b[100]={};
        for(int j=0;j<i;j++)
        {
            a[s[j]-'a']=true;
        }
        for(int j=i;j<n;j++)
        {
            b[s[j]-'a']=true;
        }
        int count=0;
        for(int j=0;j<50;j++)
        {
            if(a[j]&&b[j]) count++;
        }
        // printf("count%d=%d\n",i,count);
        if(max<count) max=count;
    }
    printf("%d\n",max);
}

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

int main() {
  int c[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> c[i][j];
    }
  }
  
  for(int i=0; i<2; i++){
    for(int j=1; j<3; j++){
      if(c[i+1][0]-c[i][0] != c[i+1][1]-c[i][1]){
        cout << "No" << endl;
        return 0;
      }
      if(c[i+1][0]-c[i][0] != c[i+1][2]-c[i][2]){
        cout << "No" << endl;
        return 0;
      }
      if(c[i+1][1]-c[i][1] != c[i+1][2]-c[i][2]){
        cout << "No" << endl;
        return 0;
      }
    }
   }

  cout << "Yes" << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
  ll a, b, c, ans;
  cin >> a >> b >> c;
  if ((a & 1) && (b & 1) && (c & 1)) {
    ans = min(min(a * b, b * c), c * a);
  } else {
    ans = 0;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    int N;
    string S;
    cin >> N >> S;
    int ans=0,count=0;
    rep(i,N){
        if(S[i]=='I') count++;
        else count--;
        ans=max(ans,count);
    }
    cout  << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
typedef unsigned long long ull;
const ull B = 1e9+7;
char s[1111111];
int len;
ull a[1111111];
ull h[1111111];
ull Bh[1111111];
int main(void) {
    int res = -1;
     int i,al,bl;
  scanf("%s", s);
  len = strlen(s);
  Bh[0] = 1;
  
   for (i = 0; i < len; i++) {
     h[i+1] = h[i]*B + s[i];
     Bh[i+1] = Bh[i]*B;
   }
  
   for (i = 1; i*3 < len; i++) {
     if ((len - i*3)%2 != 0 || len - i*3 <= 0) continue;
     al = i;
     bl = (len - i*3)/2;
     if (h[al] == h[al+bl + al]-h[al+bl]*Bh[al] &&
         h[al+bl + al]-h[al+bl]*Bh[al] == h[al*2+bl*2+al]-h[al*2+bl*2]*Bh[al] &&
         h[al+bl]-h[al]*Bh[bl] == h[al*2+bl + bl]-h[al*2+bl]*Bh[bl]) {
       if (res == -1 || res > al+bl) {
         res = al+bl;
       }
     }
      }
  
      if (res < 0) {
        puts("mitomerarenaiWA");
      } else {
        printf("Love ");
        for (int i = 0; i < res; i++) {
          printf("%c", s[i]);
        }
        puts("!");
      }
      return 0;
}


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

int main(void){
    int N,A,B,C,X;
    while(cin>>N>>A>>B>>C>>X, N|A|B|C|X){
        vector<int> Y(N);
        rep(i,N)cin>>Y[i];
        int frame=0;
        rep(i,N){
            bool flag=true;
            while(flag){
                if(frame>10000){
                    frame=0;
                    break;
                }
                flag = (Y[i]!=X);
                X=(A*X+B)%C;
                frame++;
            }
            if(frame==0)break;
        }
        cout<<frame-1<<endl;
    }

    return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
long long int n;
int main(){
    cin>>n;
    for(int i=sqrt(n);i>=1;i--)
    {
        if(n%i==0){
            int t=i,l=n/i;
            int s=1;
            while(l>=10){
                s++;
                l/=10;
            }
        cout<<s;
        return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VLL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	string S;
    cin >> S;
    int n = S.size();
    rep(i,n){
        S[i] = 'x';
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
// this line is here for a reason
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
  return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
  template <class C>
  static char test(typename C::const_iterator*);
  template <class C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '{';
  for (auto it = c.begin(); it != c.end();)
    o << *it << (++it != c.end() ? ", " : "}");
  return o;
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
  return o << '(' << p.fi << ", " << p.se << ')';
}


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

    int n, k;
    cin >> n >> k;

    vi h(n, 0);
    F0R(i, n) cin >> h[i];

    vector<ll> dp(n, 1e18);
    dp[0] = 0;
    F0R(i, n - 1)
        FOR(j, 1, k + 1)
            if(i + j < n)
                ckmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));

    cout << dp[n - 1] << endl;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
template< class T >
struct Dinic {
  static const int MAXV = 10000;
  static const T INF = 0x3f3f3f3f;
  struct Edge {
    int v;
    T f;
    int re;
    Edge( int _v, T _f, int _re ): v( _v ), f( _f ), re( _re ) {}
  };
  int n, s, t, level[ MAXV ];
  vector< Edge > E[ MAXV ];
  int now[ MAXV ];
  Dinic( int _n, int _s, int _t ): n( _n ), s( _s ), t( _t ) {}
  void add_edge( int u, int v, T f, bool bidirectional = false ) {
    E[ u ].emplace_back( v, f, E[ v ].size() );
    E[ v ].emplace_back( u, 0, E[ u ].size() - 1 );
    if( bidirectional ) {
      E[ v ].emplace_back( u, f, E[ u ].size() - 1 );
    }
  }
  bool BFS() {
    memset( level, -1, sizeof( level ) );
    queue< int > que;
    que.emplace( s );
    level[ s ] = 0;
    while( not que.empty() ) {
      int u = que.front();
      que.pop();
      for( auto it: E[ u ] ) {
        if( it.f > 0 and level[ it.v ] == -1 ) {
          level[ it.v ] = level[ u ] + 1;
          que.emplace( it.v );
        }
      }
    }
    return level[ t ] != -1;
  }
  T DFS( int u, T nf ) {
    if( u == t ) return nf;
    T res = 0;
    while( now[ u ] < E[ u ].size() ) {
      Edge &it = E[ u ][ now[ u ] ];
      if( it.f > 0 and level[ it.v ] == level[ u ] + 1 ) {
        T tf = DFS( it.v, min( nf, it.f ) );
        res += tf; nf -= tf; it.f -= tf;
        E[ it.v ][ it.re ].f += tf;
        if( nf == 0 ) return res;
      } else ++now[ u ];
    }
    if( not res ) level[ u ] = -1;
    return res;
  }
  T flow( T res = 0 ) {
    while( BFS() ) {
      T temp;
      memset( now, 0, sizeof( now ) );
      while( temp = DFS( s, INF ) ) {
        res += temp;
        res = min( res, INF );
      }
    }
    return res;
  }
};
 
const int MAXH = 100;
const int MAXW = 100;
 
int H, W;
string G[ MAXH ];
 
signed main() {
  ios::sync_with_stdio( 0 );
  cin >> H >> W;
  for( int i = 0; i < H; ++i ) {
    cin >> G[ i ];
  }
  int SOURCE = H + W;
  int SINK = H + W + 1;
  Dinic< int > din( H + W + 2, SOURCE, SINK );
  for( int i = 0; i < H; ++i ) {
    for( int j = 0; j < W; ++j ) {
      if( G[ i ][ j ] == 'S' ) {
        din.add_edge( SOURCE, i, din.INF );
        din.add_edge( SOURCE, H + j, din.INF );
      } else if( G[ i ][ j ] == 'T' ) {
        din.add_edge( i, SINK, din.INF );
        din.add_edge( H + j, SINK, din.INF );
      } else if( G[ i ][ j ] == 'o' ) {
        din.add_edge( i, H + j, 1 );
        din.add_edge( H + j, i, 1 );
      }
    }
  }
  int ans = din.flow();
  if( ans >= din.INF ) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[210000];
int bfs[210000];
int z[210000];
vector<int>t[210000];
int val[210000];
int main(){
	scanf("%s",in);
	int now=0;
	int n=strlen(in);
	for(int i=0;i<n;i++){
		now^=(1<<(in[i]-'a'));
		val[i+1]=now;

	}
	for(int i=0;i<=n;i++)z[i]=val[i];
		std::sort(z,z+n+1);
	for(int i=0;i<=n;i++){
		t[lower_bound(z,z+n+1,val[i])-z].push_back(i);
	}
	for(int i=0;i<=n;i++)bfs[i]=mod;
	bfs[0]=0;
	for(int i=0;i<n;i++){
		int at=val[i];
		for(int j=0;j<27;j++){
			int to=at;
			if(j<26)to^=(1<<j);
			int I=lower_bound(z,z+n+1,to)-z;
			if(z[I]!=to)continue;
			int q=upper_bound(t[I].begin(),t[I].end(),i)-t[I].begin();
			if(q<t[I].size()){
				bfs[t[I][q]]=min(bfs[t[I][q]],bfs[i]+1);
			}
			if(val[n]==to){
				bfs[n]=min(bfs[n],bfs[i]+1);
			}
		}
	}
	printf("%d\n",bfs[n]);
}

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

void trace(vector<int> A, int N){
  for(int i=0; i < N; i++){ 
  if( i > 0 ) cout << ' ';
  cout << A.at(i);
  }
  cout << endl;
}

void insertionSort(vector<int> A, int N){
   for (int i = 1; i < N; i++){
     int v = A.at(i);
     int j = i - 1;
     while (j >= 0 && A.at(j) > v){
       A.at(j+1) = A.at(j);
       j--;
     }
       A.at(j+1) = v;
       trace(A, N);
   }
}

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i < N; i++) cin >> A.at(i);
    trace(A, N);
    insertionSort(A, N);
}


Measured memory_bytes: 3124
N,M=map(int,input().split())

A=[]
for i in range(2**N):
    B=[]
    for j in range(2**M):
        B.append(bin(i&j).count("1")%2)
    A.append(B)

ANS=[[0]*(2**M) for i in range(2**N)]

for i in range(1,2**N):
    for j in range(1,2**M):
        if A[i][j]!=(A[i-1][j]+A[i][j-1]-A[i-1][j-1])%2:
            ANS[i][j]=1

for a in ANS[1:]:
    print("".join(map(str,a[1:])))

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

int main() {
	long long a;
	string b;
	cin >> a >> b;
	long long b100 = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
	long long ans = a * b100 / 100;
	cout << ans << endl;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int A,B;
void input(){
    cin>>A>>B;
    return;
}

void solve(){
    int ans=max(A+B,A-B);
    ans=max(ans,A*B);
    cout<<ans<<endl;
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

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

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

namespace null_null {

void main_() {
  usize N, K, ans = 0;
  std::cin >> N >> K;
  for (usize i = 0; i < N; i++) {
    usize h;
    std::cin >> h;
    if (h >= K) {
      ans++;
    }
  }

  std::cout << ans << std::endl;
}

} // namespace null_null

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  null_null::main_();
  return 0;
}

Measured memory_bytes: 256
a = int(input())
b = True
def hantei(n, x): #素数だとFalseを返す
    for i in range(2, n):
        if n % i == 0:
            x = True
            return x
while b:
    b = hantei(a, b)
    if b is None:
        print(a)
        break
    a += 1


Measured memory_bytes: 3060
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v.size();i++){cout << v[i]<< " ";} cout << endl
    #define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    #define FOR(i,n) for(int i=0;i<n;i++)
    ll a,b,c,d,e,f,g,n,m,k,t,p,x;
 
    ll mod = 998244353;
    
    void solve(){
       cin >> n;
       ll res = n/500 * 1000;
       n %= 500;
       res += n/5 * 5;
       cout << res << endl;
    }
 
    int main(){
        ios_base::sync_with_stdio(false);
      
        int cases = 1; 
        //cin >> cases;
       
        while(cases--){
            solve();
        }
        return 0;
 
    }

Measured memory_bytes: 256
use strict;
use warnings;
package SuffixArray;
#sub sa_is(\@$);
sub sa_is{
	my$upper=shift;
	my@s=@_;
	my$n=@s;
	if($n==0){
		return();
	}
	elsif($n==1){
		return(0);
	}
	elsif($n==2){
		if($s[0]<$s[1]){
			return(0,1);
		}
		else{
			return(1,0);
		}
	}
	my@sa=(0)x$n;
	my@ls;
	$ls[$n-1]=undef;
	for(my$i=$n-2;$i>=0;$i--){
		$ls[$i]=$s[$i]==$s[$i+1]?$ls[$i+1]:$s[$i]<$s[$i+1];
	}
	my@sum_l=(0)x($upper+1);
	my@sum_s=(0)x($upper+1);
	for(0..$n-1){
		if($ls[$_]){
			$sum_l[$s[$_]+1]++;
		}
		else{
			$sum_s[$s[$_]]++;
		}
	}
	for(0..$upper){
		$sum_s[$_]+=$sum_l[$_];
		$sum_l[$_+1]+=$sum_s[$_]if$_<$upper;
	}
	my$induce;
	$induce=sub{
		@sa=(-1)x$n;
		my@buf=@sum_s;
		for(@_){
			next if$_==$n;
			$sa[$buf[$s[$_]]++]=$_;
		}
		@buf=@sum_l;
		$sa[$buf[$s[$n-1]]++]=$n-1;
		for(0..$n-1){
			my$v=$sa[$_];
			$sa[$buf[$s[$v-1]]++]=$v-1if$v>=1&&!$ls[$v-1];
		}
		@buf=@sum_l;
		for(my$i=$n-1;$i>=0;$i--){
			my$v=$sa[$i];
			$sa[--$buf[$s[$v-1]+1]]=$v-1if$v>=1&&$ls[$v-1];
		}
	};
	my@lms_map=(-1)x($n+1);
	my$m=0;
	my@lms=();
	for(1..$n-1){
		if(!$ls[$_-1]&&$ls[$_]){
			$lms_map[$_]=$m++;
			push@lms,$_;
		}
	}
	$induce->(@lms);
	if($m>0){
		my@sorted_lms;
		for(@sa){
			push@sorted_lms,$_ if$lms_map[$_]!=-1;
		}
		my@rec_s=();
		my$rec_upper=0;
		$rec_s[$lms_map[$sorted_lms[0]]]=0;
		for(1..$m-1){
			my$l=$sorted_lms[$_-1];
			my$r=$sorted_lms[$_];
			my$end_l=$lms_map[$l]+1<$m?$lms[$lms_map[$l]+1]:$n;
			my$end_r=$lms_map[$r]+1<$m?$lms[$lms_map[$r]+1]:$n;
			my$same=1;
			if($end_l-$l!=$end_r-$r){
				$same=0;
			}
			else{
				$l++,$r++while$l<$end_l&&$s[$l]==$s[$r];
				$same=0if$l==$n||$r==$n||$s[$l]!=$s[$r];
			}
			$rec_upper++if!$same;
			$rec_s[$lms_map[$sorted_lms[$_]]]=$rec_upper;
		}
		my@rec_sa=sa_is($rec_upper,@rec_s);
		$sorted_lms[$_]=$lms[$rec_sa[$_]]for 0..$m-1;
		$induce->(@sorted_lms);
	}
	return@sa;
}
sub suffix_array(\$){
	my@s=map ord,split"",${$_[0]};
	return sa_is(255,@s);
}
package LcpArray;
sub lcp(\@\@){
	my@s=@{$_[0]};
	my$n=@s;
	my@sa=@{$_[1]};
	my@rnk=(0)x$n;
	$rnk[$sa[$_]]=$_ for 0..$n-1;
	my@lcp=(0)x($n-1);
	my$h=0;
	for(0..$n-1){
		$h--if$h>0;
		next if$rnk[$_]==0;
		my$j=$sa[$rnk[$_]-1];
		$h++while$j+$h<$n&&$_+$h<$n&&$s[$j+$h]==$s[$_+$h];
		$lcp[$rnk[$_]-1]=$h;
	}
	return@lcp;
}
sub lcp_array(\$\@){
	my@s=map ord,split"",${$_[0]};
	return lcp(@s,@{$_[1]});
}
package main;
my$s=<>;
chomp$s;
my@sa=SuffixArray::suffix_array($s);
my@lcp=LcpArray::lcp_array($s,@sa);
my$ans=@sa*(@sa+1)/2;
$ans-=$_ for@lcp;
print$ans,$/;


Measured memory_bytes: 261616
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;
 
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long
 
int main() {
	int N;
	cin >> N;
	
	int l, r;
	int ans = 0;
	REP(i, N) {
		cin >> l >> r;
 
		ans += (r - l + 1);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    cout << min(a*b,c) << endl;
}


Measured memory_bytes: 256
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    a,b = map(int, input().split())
    num = b - a
    if num%2 == 0:
        print(b - (num//2))
    else:
        print("IMPOSSIBLE")

if __name__ == "__main__":
    main()

Measured memory_bytes: 5068
#include<bits/stdc++.h>
#include<climits>
 
using namespace std;
 
#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()
 
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<int,int>> vpi;
typedef long long LL;
 
const long long OO = 2e18;
const double pi=2*acos(0.0);
 
bool isprime(long long int a){
    if(a==1){
        return false;
    }
    for(int i=2;i*i<=a;i++){
        if(a%i==0){
            return false;
        }
    }
    return true;
} 
 
bool iscoprime(int a,int b){
    int i;
    for(i=2;i<=min(a,b);i++){
        if(a%i==0 && b%i==0){
            return false;
        }
    }
    return true;
}
 
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}
 
int maxA(vi a){
    int m=0;
    for(int i=0;i<a.size();i++){
        m=max(m,a[i]);
    }
    return m;
}
 
int minA(vi a){
    int m=100000;
    for(int i=0;i<a.size();i++){
        m=min(m,a[i]);
    }
    return m;
}
 
vi freqN(vi a, int n){
    vi f(n);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]]++;
    }
    return f;
}
 
vi freqA(vi a){
    vi f(26);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]-'0']++;
    }
    return f;
}
 
bool mycomp(const pair<long int,long int>&p1 , const pair<long int,long int>&p2){
    if(p1.second < p2.second) return true;
    else if(p1.second==p2.second) return p1.first<p2.first;
    else return false;
}
 
unsigned int rightmostsetbit(unsigned int n){
    return n & -n;
}
 
bool cmp(pair<lld,lld>&p1 , pair<lld,lld>&p2){
    if((p1.first*p1.second)==(p2.first*p2.second)) return p1.second>p2.second;
    return (p1.first*p1.second)>(p2.first*p2.second);
}
 
int main(){
fast;
cin.tie(0);
string s,t;
cin>>s>>t;
lld a,b;
cin>>a>>b;
string u;
cin>>u;
if(u==s) a--;
else b--;
cout<<a<<" "<<b<<endl;
}

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

#define Bye return 0
#define ll long long
const ll MAX = 1e9+7;

void solve(){
    ll w, a, b; cin>>w>>a>>b;
    ll res = max(max(a, b) - (min(a, b)+w), 0*1ll);
    cout<<res<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 3616
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)

int d[99][99];
int que[1000],quecnt;
int d4[]={0,2,0,-2,0};

int main(){
	ll w,h;
	while(scanf("%lld%lld",&w,&h),w){
		rep(i,0,2*h)rep(j,0,2*w)d[i][j]=0;
		rep(i,0,h){
			rep(j,0,w-1)scanf("%lld",&d[2*i][2*j+1]);
			if(i!=h-1)rep(j,0,w)scanf("%lld",&d[2*i+1][2*j]);
		}
		int flag=0;
		d[0][0]=1;
		que[0]=0;
		quecnt=1;
		rep(i,0,quecnt){
			ll x=que[i]/100;
			ll y=que[i]%100;
			if(x==2*(h-1)&&y==2*(w-1)){
				printf("%lld\n",d[x][y]);
				flag=1;
				break;
			}
			rep(k,0,4){
				ll xx=x+d4[k  ];
				ll yy=y+d4[k+1];
				ll xxt=x+d4[k  ]/2;
				ll yyt=y+d4[k+1]/2;
				if(0<=xx&&xx<2*h&&0<=yy&&yy<2*w&&!d[xx][yy]&&!d[xxt][yyt]){
					d[xx][yy]=d[x][y]+1;
					que[quecnt++]=xx*100+yy;
				}
			}
		}
		if(!flag)puts("0");
	}
}


Measured memory_bytes: 2036
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;

#define pb(x) push_back(x)
#define deb(x) cerr <<#x<<" = "<<x<<"\n"
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////



/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	char ch;
	cin >> ch;
	if(isupper(ch)){
		cout << "A";
	}
	else cout << 'a';
}

int main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	while(t--){
		solve();
	}
	/* #ifndef ONLINE_JUDGE
    printf("\nRun Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif  */
}

Measured memory_bytes: 3580
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    int N; cin >> N;
    if(N < 1000) cout << "ABC";
    else{
        cout << "ABD";
    }
    cout << endl;
    return 0;
}




Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
    
    def isSame(self, x, y):
        return self.find(x) == self.find(y)

from collections import defaultdict
def solve():
    N, K, L = map(int, input().split())
    road_uf = UnionFind(N)
    train_uf = UnionFind(N)

    for i in range(K):
        p, q = map(lambda x: int(x)-1, input().split())
        road_uf.unite(p, q)

    for i in range(L):
        r, s = map(lambda x: int(x)-1, input().split())
        train_uf.unite(r, s)

    ma = defaultdict(int)
    for v in range(N):
        root_road = road_uf.find(v)
        root_train = train_uf.find(v)
        ma[str(root_road) + "_" + str(root_train)] += 1
    
    for v in range(N):
        root_road = road_uf.find(v)
        root_train = train_uf.find(v)
        print(ma[str(root_road) + "_" + str(root_train)], end=' ')

if __name__ == '__main__':
    solve()

Measured memory_bytes: 35940
#include <bits/stdc++.h>
using namespace std;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;

int f(vector<int> h,int n){
    if(n==0)return 0;
    else if(n==1)return abs(h[0]-h[1]);
    return min(abs(h[n]-h[n-1])+f(h,n-1),abs(h[n]-h[n-2])+f(h,n-2));
}

int main(){
    FASTER;
    int n;cin>>n;
    vector<int> h(n),F(n,INT_MAX);
    for(int &i:h)cin>>i;

    F[0]=0;
    F[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        for(int j:{i-1,i-2}){
            F[i]=min(abs(h[i]-h[j])+F[j],F[i]);
        }
    }
    cout<<F[n-1];
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n;
	long long a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		long long p, q; cin >> p >> q;
		if (!i) {
			a = p; b = q;
		}
		else {
			if (a%p != 0)a += p - (a%p);
			if (b%q != 0)b += q - (b%q);
			long long k = max(a / p, b / q);
			a = p*k; b = q*k;
		}
	}
	cout << a + b << endl;
	char ch; cin >> ch;
	return 0;
}

Measured memory_bytes: 632
#include<iostream>
#include<cstdlib>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define fir first
#define sec second

typedef long long ll;
const ll inf = (1LL)<<50;
const int N = 1001;

ll dp[N];
ll cost[N][N];

void pre(int n,ll *in){
  rep(i,n){
    cost[i][i]=in[i];
    REP(j,i+1,n){
      cost[i][j]=cost[i][j-1]+in[j];
    }
  }
}

ll solve(int n,ll w){
  rep(i,n+1)dp[i]=inf;
  dp[0]=0;
  REP(i,1,n+1){
    rep(j,i){
      if(i==n){
	dp[i]=min(dp[i],dp[j]+max(0LL,cost[j][i-1]-w));
      }else dp[i]=min(dp[i],dp[j]+llabs(w-cost[j][i-1]));
    }
  }
  return dp[n];
}

main(){
  int n;ll w;
  int tc=1;
  ll in[N];
  while(cin>>n>>w && n){
    rep(i,n)cin>>in[i];
    pre(n,in);
    printf("Case %d: %lld\n",tc++,solve(n,w));
  }
}

Measured memory_bytes: 7776
#include<iostream>
#define INF -999999
typedef long long ll;
using namespace std;
int main(){
	
	int n,t,s,a[3000],b[3000],dp[2][3001];
	cin>>n>>t>>s;
	
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	
	for(int i=0;i<2;i++)for(int j=0;j<3001;j++)dp[i][j]=0;

	for(int i=0;i<=t-b[0];i++){
		if(b[0]<=i)dp[0][i]=a[0];
		else dp[0][i]=0;
	}

	for(int i=1;i<n;i++){
		for(int j=0;j<=t;j++){	
			
			if(0<=j-b[i]){				
				//dp[i%2][j] = max ( dp[!(i%2)][j] , dp[!(i%2)][j-b[i]] + a[i] );
				if(dp[!(i%2)][j] < dp[!(i%2)][j-b[i]] + a[i] && !(j-b[i]<s&&s<j)){
					dp[i%2][j]=dp[!(i%2)][j-b[i]] + a[i];
				}else{
					dp[i%2][j]=max(dp[(i%2)][j-1],dp[(i%2)*(-1)+1][j]);
				}
			}else if(j>0){
				dp[i%2][j]=max(dp[(i%2)][j-1],dp[(i%2)*(-1)+1][j]);
			}else{
				dp[i%2][j]=0;
				
			}
			//cout<<dp[i%2][j]<<" ";
		}
	//	cout<<endl;
	}
	
	cout<<dp[(n-1)%2][t]<<endl;
	
	return 0;
}

Measured memory_bytes: 1208
#!/usr/bin/env python3

def main():
    s = input()
    K = int(input())

    ss = set()
    for i in range(K):
        for j in range(len(s) - i):
            ss.add(s[j:j+i+1])

    print(sorted(ss)[K - 1])


if __name__ == '__main__':
    main()



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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

ll ab(ll a){return a*(a>0?1:(-1));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int a, b, q;cin>>a>>b>>q;
    vll s(a+2), t(b+2), x(q);
    s[0] = -100000000000;rep(i, a){cin>>s[i+1];}
    s[a+1] = 100000000000;
    t[0] = -100000000000;rep(i, b){cin>>t[i+1];}
    t[b+1] = 100000000000;
    rep(i, q)cin>>x[i];
    sort(all(s));
    sort(all(t));
    rep(i, a+2){
        debug("%ld ", s[i]);
    }
    debug("\n");
    rep(i, b+2){
        debug("%ld ", t[i]);
    }
    debug("\n");
    rep(i, q){
        auto si = lower_bound(all(s), x[i]);
        auto ti = lower_bound(all(t), x[i]);
        ll smi, sma, tmi, tma;
        debug("si %ld\n", *si);
        ll sindex = (ll)distance(s.begin(), si);
        ll tindex = (ll)distance(t.begin(), ti);
        debug("sindex %d\n", sindex);
        debug("tindex %d\n", tindex);
        sma = s[sindex];smi = s[sindex-1];
        tma = t[tindex];tmi = t[tindex-1];

        /*if(x[i] <= s[0]){smi = s[0];sma = x[1];}
        else if(x[i] > s[a-1]){smi = s[a-2];sma = s[a-1];}
        else {sma = *si;si--;smi = *si;}
        
        if(x[i] <= t[0]){tmi = x[0];tma = x[1];}
        else if(x[i] > t[b-1]){tmi = t[b-2];tma = t[b-1];}
        else {tma = *ti;ti--;tmi = *ti;}*/
        ll ans = 100000000000;
        debug("%ld %ld %ld %ld\n", smi, sma, tmi, tma);
        chmin(ans, ab(x[i]-smi)+ab(smi-tmi));debug("%ld\n",ab(x[i]-smi)+ab(smi-tmi));
        chmin(ans, ab(x[i]-smi)+ab(smi-tma));debug("%ld\n",ab(x[i]-smi)+ab(smi-tma));
        chmin(ans, ab(x[i]-sma)+ab(sma-tmi));debug("%ld\n",ab(x[i]-sma)+ab(sma-tmi));
        chmin(ans, ab(x[i]-sma)+ab(sma-tma));debug("%ld\n",ab(x[i]-sma)+ab(sma-tma));
        chmin(ans, ab(x[i]-tmi)+ab(tmi-smi));debug("%ld\n",ab(x[i]-tmi)+ab(tmi-smi));
        chmin(ans, ab(x[i]-tmi)+ab(tmi-sma));debug("%ld\n",ab(x[i]-tmi)+ab(tmi-sma));
        chmin(ans, ab(x[i]-tma)+ab(tma-smi));debug("%ld\n",ab(x[i]-tma)+ab(tma-smi));
        chmin(ans, ab(x[i]-tma)+ab(tma-sma));debug("%ld\n",ab(x[i]-tma)+ab(tma-sma));
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3712