akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=2e6+10;
const int M=2e5+10;
const int mod=924844033;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int qpow(int a,int b) {
    int ret=1;
    while(b) {
        if(b&1) ret=1ll*ret*a%mod;
        a=1ll*a*a%mod; b>>=1;
    }
    return ret;
}
namespace NTT {
    int n,m,l,r[N];
    void NTT(int *a,int f) {
        for(int i=0;i<n;i++) if(i<r[i]) swap(a[i],a[r[i]]);
        for(int i=1;i<n;i<<=1) {
            int wn=qpow(5,(mod-1)/(i<<1));
            if(f==-1) wn=qpow(wn,mod-2);
            for(int p=i<<1,j=0;j<n;j+=p) {
                int w=1;
                for(int k=0;k<i;k++,w=1ll*w*wn%mod) {
                    int x=a[j+k],y=1ll*w*a[j+k+i]%mod;
                    a[j+k]=(x+y)%mod;a[j+k+i]=(x-y+mod)%mod;
                }
            }
        }
        if(f==-1) {
            int inv=qpow(n,mod-2);
            for(int i=0;i<n;i++) a[i]=1ll*a[i]*inv%mod;
        }
    }
    void calc(int *a,int *b,int *c,int _n,int _m) {
        n=_n,m=_m,l=0;
        m+=n;for(n=1;n<=m;n<<=1) l++;
        for(int i=0;i<n;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
        NTT(a,1);NTT(b,1);
        for(int i=0;i<n;i++) c[i]=1ll*a[i]*b[i]%mod;
        NTT(c,-1);
        for(int i=m+1;i<n;i++) c[i]=0;
        for(int i=0;i<n;i++) a[i]=b[i]=0;
    }
}
int n,fa[N],siz[N],num[N],fac[N],inv[N],ifac[N],ans[N],f[N],g[N];
vector<int> E[M];
void dfs(int u,int ff) {
    fa[u]=ff;siz[u]=1;
    for(int v:E[u]) if(v!=ff) dfs(v,u),siz[u]+=siz[v];
}
int C(int n,int m) {
    if(n<0||m<0||n<m) return 0;
    return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main() {
    cin>>n;
    for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(v),E[v].pb(u);
    dfs(1,0);
    for(int i=1;i<=n;i++) {
        num[n]++;num[n-siz[i]]--;
        for(int j:E[i]) if(j!=fa[i]) num[siz[j]]--;
    }
    for(int i=0;i<=n;i++) num[i]=(num[i]+mod)%mod;
    fac[0]=1;for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
    inv[1]=1;for(int i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    ifac[0]=1;for(int i=1;i<=n;i++) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
    for(int i=0;i<=n;i++) f[i]=1ll*num[i]*fac[i]%mod,g[i]=ifac[n-i];
    NTT::calc(f,g,ans,n,2*n);
    for(int i=1;i<=n;i++) {
        int Ans=1ll*ifac[i]*ans[i+n]%mod;
        printf("%d\n",Ans);
    }
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 66176
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sumvec(vector<S>&a){return accumulate(all(a),S());}
template<class S>S maxvec(vector<S>&a){return *max_element(all(a));}
template<class S>S minvec(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}


int main(void){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
    
    ll n,x,l;
    cin>>n;
    vector<pll> xl(n);
    rep(i,n){
        cin>>x>>l;
        xl[i]=make_pair(x-l,x+l);
    }
    
    sort(all(xl),
    [](pll a,pll b){
        return a.sc<b.sc;
    });
    
    ll shift=1,count=0;
    range(i,1,n){
        if(xl[i-shift].sc > xl[i].fs){
            count++;
            shift++;
        }else{
            shift=1;
        }
    }
    
    cout<<(n-count)<<endl;
    
}


Measured memory_bytes: 1792
import math
import collections
m=int(input())
a=list(map(int,input().split()))
A=collections.Counter(a)
total=0
for j in A.values():
    total = total + j*(j-1)//2
for k in range(m):
    s=A[a[k]]
    d=total-s+1
    print(d)


Measured memory_bytes: 26780
#include <stdio.h>

int main (void) {
	int i , input , rand , n , j;
	
	scanf("%d",&n);
	
	for ( i = 0; i < n; i++ ) {
		scanf("%d",&rand);
		printf("Case %d:\n",i+1);
				
		for ( j = 0; j < 10; j++ ) {
			rand *= rand;
			rand /= 100;
			rand %= 10000;
			printf("%d\n",rand);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)

using namespace std;
typedef long long ll;

struct dinic{
  const ll inf = 1e18;
  struct edge{int to; ll cap; int rev;};
  int V;
  vector<vector<edge>> G;
  vector<int> itr, level;
  dinic(int V) : V(V) { G.assign(V,vector<edge>()); }

  void add_edge(int from, int to, ll cap) {
    G[from].push_back((edge){to, cap, (int)(G[to].size())});
    G[to].push_back((edge){from, 0, (int)(G[from].size())-1});
  }

  void bfs(int s) {
    level.assign(V,-1);
    queue<int> q;
    level[s] = 0; q.push(s);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      for(auto &e: G[v]) if(e.cap>0 && level[e.to]<0){
        level[e.to] = level[v] + 1;
        q.push(e.to);
      }
    }
  }

  ll dfs(int v, int t, ll f) {
    if(v==t) return f;
    FOR(i, itr[v], (int)(G[v].size())){
      edge& e = G[v][i];
      if(e.cap>0 && level[v]<level[e.to]) {
        ll d = dfs(e.to, t, min(f, e.cap));
        if(d>0) {
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  ll run(int s, int t) {
    ll ret = 0, f;
    while(bfs(s), level[t] >= 0) {
      itr.assign(V, 0);
      while ((f=dfs(s, t, inf)) > 0) ret += f;
    }
    return ret;
  }
};

int n, a;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  dinic d(n+2);
  ll ans = 0;
  FOR(i, 1, n+1){
    cin >> a;
    if(a > 0){
      ans += a;
      d.add_edge(i, n+1, a);
    }
    if(a < 0){
      d.add_edge(0, i, -a);
    }
    for(int j = i*2; j <= n; j += i) d.add_edge(i, j, 1e14);
  }
  cout << ans - d.run(0, n+1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll>P;

int main(){
    
    ll n;
    cin >> n;
    vector<P>v;
    for(int i = 0; i < n; i++){
        ll a;
        cin >> a;
        v.push_back(P(abs(a), a));
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    vll A(n);
    for(int i = 0; i < n; i++)A[i] = v[i].second;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(i+1==n){
            ans += A[i];
            break;
        }
        if(A[i] > 0){
            ans += A[i];
            continue;
        }
        A[i] = -A[i];
        A[i+1] = -A[i+1];
        ans += A[i];
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 2544
#include<iostream>
using namespace std;
int main(){
  int x,y;
  while(1){
    cin >> x >> y;
    if(x==0 && y==0) break;


    if(x<y){
      cout <<x<<" "<<y<<endl;
    }
    else if(y<x){
      cout <<y<<" "<<x<<endl;
    }
    else if(x==y){
      cout <<x<<" "<<y<<endl;
    }
  }
  
}
  



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

using namespace std;

int main()
{
    int  A, B, C;

    cin >> A >> B >> C;

    if((A==5 && B==5 && C==7)|| (A==7 && B==5 && C==5) || (A==5 && B==7 && C==5))
    {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3636
pub mod io {
    use std::io;

    pub fn read_line() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }

    pub trait Read {
        fn read(s: &str) -> Self;
    }

    macro_rules! def_read {
        ($t: ty) => {
            impl Read for $t {
                fn read(s: &str) -> $t {
                    s.parse().unwrap()
                }
            }
        }
    }

    def_read!(i32);
    def_read!(i64);
    def_read!(isize);
    def_read!(usize);
    def_read!(f64);

    impl<T: Read> Read for Vec<T> {
        fn read(s: &str) -> Self { s.split_whitespace().map(|w| T::read(w)).collect() }
    }

    macro_rules! def_read_tuple {
        ($($t: ident),*) => {
            impl<$($t : Read + Default),*> Read for ($($t),*) {
                fn read(s: &str) -> Self {
                    let ws = s.split_whitespace().collect::<Vec<_>>();
                    let mut i = 0;
                    ( $({i += 1; $t::read(ws[i - 1])}),* )
                }
            }
        };
    }

    def_read_tuple!(T0, T1);
    def_read_tuple!(T0, T1, T2);
    def_read_tuple!(T0, T1, T2, T3);
    def_read_tuple!(T0, T1, T2, T3, T4);

    pub fn readln<T: Read>() -> T { T::read(&read_line()) }
}

fn main() {
    let (k, s): (i32, i32) = io::readln();

    let mut ans = 0;
    for x in 0..k+1 {
        for y in 0..k+1 {
            let z = s - x - y;
            if z >= 0 && z <= k {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 380
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

int main()
{
	int a = read(),b = read(),c = read(),d = read(),qwq = read();
	printf("%d\n",c*60+d-a*60-b-qwq);
	return 0;
}

Measured memory_bytes: 3728
#include<stdio.h>
#include<queue>
#include<assert.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 1 << 18;
const int MM = 1000000007;

int N;
char D[MX];
vector<int> T[MX];
int lev[MX], vst[MX], d1[MX], d2[MX];
int cnt[MX], low[MX];

void bfs(int x, int d[MX]){
	queue<int> Q;
	for(int i = 0; i < MX; i++) d[i] = 0;
	Q.push(x); d[x] = 1;
	while(Q.size()){
		int p = Q.front(); Q.pop();
		for(int c : T[p]){
			if( d[c] ) continue;
			d[c] = d[p] + 1;
			Q.push(c);
		}
	}
}

int main()
{
	scanf("%d", &N);
	for(int i = 2; i <= N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		T[a].push_back(b);
		T[b].push_back(a);
	}
	scanf("%s", D+1);
	
	bfs(1, d1);
	int c = 1, d = 1;
	for(int i = 2; i <= N; i++) if( d1[c] < d1[i] ) c = i;
	bfs(c, d1);
	for(int i = 2; i <= N; i++) if( d1[d] < d1[i] ) d = i;
	bfs(d, d2);
	
	for(int i = 1; i <= N; i++) cnt[i] = T[i].size();
	queue<int> Q;
	for(int i = 1; i <= N; i++){
		vst[i] = 0;
		if( T[i].size() == 1 ) Q.push(i), vst[i] = 1;
	}
	while(Q.size()){
		int p = Q.front(); Q.pop();
		for(int c : T[p]){
			if( vst[c] ) continue;
			lev[c] = max(lev[c], lev[p] + 1);
			if( --cnt[c] == 1 ) Q.push(c), vst[c] = 1;
		}
	}

	for(int i = 1; i <= N; i++) low[i] = 1e9;
	priority_queue<pii, vector<pii>, greater<pii>> Qu;
	for(int i = 1; i <= N; i++) if( D[i] == '1' ){
		low[i] = lev[i];
		Qu.emplace(low[i], i);
	}
	while(Qu.size()){
		int c = Qu.top().first, d = Qu.top().second; Qu.pop();
		if( low[d] != c ) continue;
		c = max(c, lev[d]);
		for(int e : T[d]){
			if( D[e] == '1' || low[e] <= c + 1) continue;
			low[e] = c+1;
			Qu.emplace(low[e], e);
		}
	}
	for(int i = 1; i <= N; i++) if( D[i] == '1' )low[i] = 0;

	ll ans = 1;
	for(int i = 1; i <= N; i++){
		int v = min(max(d2[i], d1[i])-2, lev[i]+1);
		if( v >= low[i] ) ans += v - low[i] + 1;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 22644
#include <string>
#include <iostream>
using namespace std;
string s, t; int c;
int main() {
	while(getline(cin, s)) {
		for(int i = 0; i < s.size(); i++) {
			if(s[i] == ' ' || s[i] == ',' || s[i] == '.') {
				if(t.size() >= 3 && t.size() <= 6) {
					if(c++) cout << ' ';
					cout << t;
				}
				t = "";
			}
			else t += s[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
N,X = map(int,input().split())
S = list(map(int,input().split()))
S.sort()
mod = 10**9+7

dp = [[x]+[0]*N for x in range(X+1)]
for n in range(1,N+1):
    for x in range(X+1):
        dp[x][n] = (dp[x%S[n-1]][n-1] + (n-1)*dp[x][n-1])%mod

print(dp[X][N])

Measured memory_bytes: 225672
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n = sc.nextInt();
		long c = sc.nextLong();
		long[] a=new long[n+1];
		long[] aa=new long[n+1];
		long[] b=new long[n+1]; 
		long[] bb = new long[n+1];
		long[] x=new long[n+1];
		long[] v=new long[n+1];
		for(int i = 1; i<=n; i++){
			x[i]= sc.nextLong();
			v[i]= sc.nextLong();
		}
		long asum=0;
		for(int i = 1; i<=n; i++){
			a[i]=Math.max(a[i-1],v[i]-x[i]+asum);
			aa[i]=Math.max(aa[i-1],v[i]-x[i]*2+asum);
			asum+=v[i];
		}
		long bsum=0;
		for(int i = 1; i<=n; i++){
			b[i]=Math.max(b[i-1],v[n+1-i]-c+x[n+1-i]+bsum);
			bb[i]=Math.max(bb[i-1],v[n+1-i]-(c-x[n+1-i])*2+bsum);
			bsum+=v[n+1-i];
		}
		long ans=0;
		for(int i = 0; i<=n; i++){
			ans=Math.max(ans,Math.max(a[i]+bb[n-i],aa[i]+b[n-i]));
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 96244
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#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) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<P> a(n),b(n);
    rep(i,n) cin>>a[i].first>>a[i].second;
    rep(i,n) {
        b[i].second = a[i].first-a[i].second;
        b[i].first = a[i].first+a[i].second;
    }

    sort(b.begin(), b.end());
    ll r = -LINF;
    int ans = 0;
    rep(i,n) {
        P c = b[i];
        if (r<=c.second) {
            r = c.first;
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int main() {
    int X;
    cin >> X;
    int ans = 1;
    for (int i = 2; i <= pow(X, 0.5); i++) {
        int cnt = i;
        while (cnt <= X){
            if (cnt*i <= X) {
                cnt *= i;
            }
            else{
                break;
            }
        }
        ans = max(ans,cnt);
        if (ans == X) {
            break;
        }
    }
    cout << ans << endl;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    map<string, ll> m;
    vector<pair<string, ll>> aaa, bbb;
    cin >> N;
    for(ll i = 0;i < N;i++) {
        string temp;
        cin >> temp;
        m[temp]++;
    }
    aaa = vector<pair<string, ll>>(m.begin(), m.end());
    sort(aaa.begin(), aaa.end(), [](pair<string, ll> a, pair<string, ll> b) { return a.second > b.second; });
    copy_if(aaa.begin(), aaa.end(), back_inserter(bbb), [&](pair<string, ll> a) { return a.second == aaa.front().second; });
    sort(bbb.begin(), bbb.end());
    for(auto &i: bbb) cout << i.first << endl;
    return 0;
}


Measured memory_bytes: 32880
#include <stdio.h>
 
int main(void)
{
    char num;
    int sum;
    while(1) {
        scanf("%c",&num);
        if(num == '0') break;
        sum = num - '0';
        while(1) {
            scanf("%c",&num);
            if(num == '\n') break;
            sum += num - '0';
        }
        printf("%d\n",sum);
    }
    return 0;
}
 

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

// Constant variables
const ld PI = (acos(-1));
const ll MOD = 1000000007;

// I/O Asynchronizing
struct __io_async{
    __io_async(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

int main() {
    str s;
    int q;
    cin >> s >> q;
    bool rev = false;
    vector<char> hd, tl;
    REP(i, q) {
        int t;
        cin >> t;
        if(t == 1) rev = !rev;
        if(t == 2) {
            int f;
            char c;
            cin >> f >> c;
            if(rev) f = 3 - f;
            if(f == 1) hd.push_back(c);
            else tl.push_back(c);
        }
    }
    if(rev) {
        REPR(i, tl.size()) {
            cout << tl[i];
        }
        REPR(i, s.size()) {
            cout << s[i];
        }
        REP(i, hd.size()) {
            cout << hd[i];
        }
        cout << "\n";
    }
    else {
        REPR(i, hd.size()) {
            cout << hd[i];
        }
        cout << s;
        REP(i, tl.size()) {
            cout << tl[i];
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define ll long long int
#define pii pair<int,int>
using namespace std;

int main()
{
    string s;
    cin>>s;
    ll sum=0;
    for(int i=0;i<s.length();i++) sum+=(s[i]-'0')*1LL;
    if(sum%9==0) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 3688
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
#include<math.h>
using namespace std;
int main() {
	int n, x, l, cnt = 0, cc = 0;
	cin >> n >> x;
	for (int i = 0; i < n; ++i) {
		cin >> l;
		cnt = cnt + l;
		if (cnt <= x) {
			cc = cc +1;
		}
	}
	cout << cc + 1 << endl;
}

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

typedef long long ll;

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

	map<ll, ll> idx_map;
	for (ll i = 0; i < n; i ++) {
		ll p;
		cin >> p;
		idx_map[p] = i;
	}

	multiset<ll> shown;
	shown.insert(-1);
	shown.insert(-1);
	shown.insert(n);
	shown.insert(n);
	multiset<ll>::iterator itr, itr2;
	ll l1, l2, u1, u2;
	ll sum = 0;
	for (ll p = n; p >= 1; p --) {
		ll i = idx_map[p];
		itr = shown.upper_bound(i);
		itr2 = itr;
		u1 = *itr;
		++itr;
		u2 = *(itr);
		--itr2;
		l1 = *(itr2);
		--itr2;
		l2 = *(itr2);

		ll cnt = (i - l1) * (u2 - u1) + (u1 - i) * (l1 - l2);
		sum += p * cnt;
		shown.insert(i);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <string.h>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15

 int main(){

  long long left=0,right,top,bottom=0;
  int n;

  cin>>right>>top>>n;

  for(int i=0;i<n;i++){

    long long x,y,a;
    cin>>x>>y>>a;

    if(a == 1)
        left = max(x,left);
    else if(a == 2)
         right = min(right,x);
    else if(a == 3)
        bottom = max(bottom, y);
    else if(a == 4)
        top = min(y,top);

  }


   int area = (right - left) * (top - bottom);

   if(left >= right || top <= bottom)
    cout<<"0"<<endl;
   else
    cout<<area<<endl;


  return 0;
 }


Measured memory_bytes: 3604
from math import sqrt
a, b, c = map(int, input().split())
l = (a ** 2) + (b ** 2) + (c ** 2)
r = 2 * (a * b + b * c + c * a)

if (c-a-b > 0 and l > r): print('Yes')
elif(sqrt(c) == sqrt(a) + sqrt(b)): print('No')
else: print('No')


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

using namespace std;
using LL = long long;
const int Max_Num=1e6+10;

int main(){
	string N;
	cin >> N;
	reverse(N.begin(),N.end());
	N.push_back('0');
	int s=N.size();
	LL dp[Max_Num][2]={0};
	dp[0][0]=1;
	rep(i,s){
		int k=N[i]-'0';
		dp[i+1][1]+=min(dp[i][1]+k,dp[i][0]+k+1);
		dp[i+1][0]+=min(dp[i][1]+10-k,dp[i][0]+9-k);
	}
	cout << min(dp[s][0],dp[s][1]) << endl;

	return 0;
}

Measured memory_bytes: 17028
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
   int n;
   cin >> n;
   
   for(int i=1; i<=9; i++){
      for(int j=1; j<=9; j++){
         if(n == i*j) {
            cout << "Yes\n";
            return 0;
         }
      }
   }
   
   cout << "No\n";
   
   return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

neighbors = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in neighbors.keys():
    neighbors.update({a:set()})
  if b not in neighbors[a]:
    neighbors[a].add(b)
  if b not in neighbors.keys():
    neighbors.update({b:set()})
  if a not in neighbors[b]:
    neighbors[b].add(a)
#print(neighbors)
lst = [0] * (n - 1)
visited = set()
queue = [[0, set([1])]]
while queue:
  #print(queue)
  pre_room, rooms = queue.pop(0)
  #print(pre_room, rooms)
  for room in rooms:
    if room in visited:
      continue
    if lst[room - 2] == 0 and room != 1:
      lst[room - 2] = pre_room
    visited.add(room)
    next_rooms = set()
    for nei in neighbors[room]:
      next_rooms.add(nei)
    next_rooms = [room, next_rooms]
    queue.append(next_rooms)
if 0 in lst:
  print('No')
else:
  print('Yes')
  for i in range(n - 1):
    print(lst[i])

Measured memory_bytes: 108372
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define pa pair<int,int>
#define fs first
#define se second
#define ll long long
#define inf 20021225
#define N 200010
using namespace std;
pa a[N]; int n,tm;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].se,&a[i].fs);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		tm+=a[i].se; if(tm>a[i].fs){printf("No\n");return 0;}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 1664
# 解説AC(できるといいな)
h, n = gets.split.map(&:to_i)
magic = n.times.map{gets.split.map(&:to_i)}
a_max = magic.max{|e1, e2| e1[0] <=> e2[0]}[0]
dp = Array.new(h + a_max * 2, 0)
for dm in 1...(h + a_max) do
  dp[dm + a_max] = magic.map{|mg| dp[dm + a_max - mg[0]] + mg[1]}.min
end
puts dp.slice(h + a_max, a_max).min


Measured memory_bytes: 27900
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    String op = sc.next();
    long b = sc.nextLong();
    if(op.equals("+")){
      System.out.println(a+b);
    }else{
      System.out.println(a-b);
    }
    

  }
  

  
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define MOD 998244353

int main(){
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>> A;
    for(int i=0; i<k; ++i){
        int l,r;
        cin>>l>>r;
        A.push_back({l,r});
    }
    sort(A.begin(),A.end());
    vector<long long> Dp(n+1,0);
    Dp[0]=1;
    Dp[1]=-1;
    for(int i=0; i<n; ++i){
        if(i>0) Dp[i] = (Dp[i] + Dp[i-1])%MOD;
        for(int j=0; j<k; ++j){
            int l= A[j].first, r = A[j].second;
            if(i+l<n) Dp[i+l] = (Dp[i+l] + Dp[i])%MOD;
            if(i+r<n){
                Dp[i+r+1] = (Dp[i+r+1]-Dp[i])%MOD;
                if(Dp[i+r+1]<0) Dp[i+r+1]+=MOD;
            }
        }
    }
    cout<<Dp[n-1]<<"\n";
}

Measured memory_bytes: 4772
S = input()
T = input()
ans = ""
if len(S)>len(T):
  for i in range(len(T)):
    ans += S[i]
    ans += T[i]
  ans += S[-1]
elif len(S)<len(T):
  for i in range(len(S)):
    ans += S[i]
    ans += T[i]
  ans += T[-1]
else:
  for i in range(len(T)):
    ans += S[i]
    ans += T[i]
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
	char o[51],e[51];
	scanf("%s%s",o,e);
	for(int i=0;i<strlen(o);i++){
		printf("%c",o[i]);
		if(i<strlen(e))printf("%c",e[i]);
	}
	return 0;
}

Measured memory_bytes: 128
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

Measured memory_bytes: 10308
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int m1, m2, d1, d2;
	cin >> m1 >> d1 >> m2 >> d2;
	if (m1 != m2 && d2 == 1) {
		cout << 1;
		return 0;
	}
	cout << 0;*/
	

	double n;
	cin >> n;
	int ans, i;
	for (i = 0; i <= n; i++) {
		if (int(i * 1.08) == n) {
			ans = i;
			cout << ans;
			return 0;
		}
	}
	cout << ":(";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;

int main()
{
    int n,k;
    std::cin >> n >> k;
    ll cnt = 0;
    for(int b = k + 1; b <= n; b++){
        int cur = 0;
        cur += (n / b) * (b - k); 
        int now = (n / b) * b;
        int lim = n - now;
        cur += std::max(lim - (k - 1),0);
        cnt += cur;
    }
    if(k == 0)cnt = (ll)n * n;
    std::cout << cnt << std::endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N,X;
  cin >> N >> X;
  
  int cost = 0;
  vector<int>donut(N,0);
  
  for(int i=0;i<N;i++){
    cin >> donut[i];
    cost += donut[i];
  }
  
  int ans = 0;
  X -= cost;
  ans = N;
  
  int min_cost = 9999;
  
  for(int i=0;i<N;i++){
    if (min_cost > donut[i]){
      min_cost = donut[i];
    }
  }
  
  ans += X / min_cost;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }

ll N,M;

int main(){
    cin>>N>>M;
    if(N*2<=M){
        out(N+(M-N*2)/4);
    }
    else out(M/2);
    
    
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rsz resize()
#define lb lower_bound
#define ub upper_bound
#define br cout << endl

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); } 
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bit(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }

template<typename T>
void leftShift(vector<T> &v, ll k) { k %= sz(v); if(k < 0) k += sz(v); rotate(v.begin(), v.begin() + k, v.end()); }
template<typename T>
void rightShift(vector<T> &v, ll k) { leftShift(v, sz(v) - k); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

inline int nxt() {
	int x;
	cin >> x;
	return x;
}

inline int nxtll() {
	ll x;
	cin >> x;
	return x;
}

void pr() {}
void sc() {}

template <typename Head, typename... Tail>
void pr(Head H, Tail... T) { cout << H << " "; pr(T...); }

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#ifndef LOCAL
string to_string(__int128 x) {
	string s = "";
	bool neg = 0;
	if(x < 0) { s += "-"; neg = 1; }
	if(!x) s += '0';
	while(x) {
		int rem = x % 10;
		s += to_string(rem);
		x /= 10;
	}
	reverse(s.begin() + neg, s.end());
	return s;
}
#endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
*/

void solve() {
	int r;
	sc(r);
	cout << setprecision(10);
	cout << 2 * acos(-1) * r;
}

signed main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	// cin >> t;
	t = 1;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3840
a, b = map(int, input().split())

def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs

afacs = factors_count(a)
bfacs = factors_count(b)

facs = set(afacs.keys()) & set(bfacs.keys())
print(len(facs)+1)


Measured memory_bytes: 9360
# coding: utf-8


def factrization(n):
    arr = set()
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.add(i)
    
    if temp != 1:
        arr.add(temp)
    
    if arr == []:
        arr.add(n)
    
    return arr

def solve():
    A, B = map(int, input().split())
    
    a_arr = factrization(A)
    b_arr = factrization(B)
    
    s_ans = a_arr & b_arr
    print(len(s_ans)+1)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();
        long ans = 0;
        char[] input = s.toCharArray();
        
        for (int i=0; i<(1<<n-1); i++){
            StringBuilder sb = new StringBuilder();
            long sum = 0;
            for (int j=0; j<n; j++){
                sb.append(input[j]);
                if ((i & (1<<j)) != 0){
                    sum += Long.parseLong(sb.toString());
                    sb.setLength(0);
                }
            }

            if(sb.length()!=0){
                sum+=Long.parseLong(sb.toString());
            }

            ans += sum;
        }
        
        System.out.println(ans);
    }

}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 200001
int p[MAX], sz[MAX];

void init(int N) {
  for(int i = 1; i <= N; i++) {
    p[i] = i;
    sz[i] = 1;
  }
}

//encuentra al padre que los reprsenta
int Find(int x) {
  if(p[x] == x) return x;
  sz[x] = sz[p[x]];
  return p[x] = Find(p[x]);
}

void Union(int x, int y) {
  int pX = Find(x);
  int pY = Find(y);
  p[pX] = pY;
  if(pX != pY) {
    sz[pY] = sz[pX] + sz[pY];
    sz[pX] = sz[pY];
  }
}

void print(int n) {
  for(int i = 1; i <= n; i++) {
    cout << p[i] << " ";
  }
  cout << endl;
}

void printSize(int n) {
  for(int i = 1; i <= n; i++) {
    cout << sz[i] << " ";
  }
  cout << endl;
}

int nroComponentes(int n) {
  map<int, int> m;
  int c = 0;
  for(int i = 1; i <= n; i++) {
    int parent = Find(i);
    m[parent]++;
    if(m[parent] == 1) {
      c++;
    } 
  }
  return c;
}


int nroDeNodos(int x, int n) {
  int c = 0;
  int pN = Find(x);
  for(int i = 1; i <= n; i++) {
    int parent = Find(i);
    if(parent == pN) {
      c++;
    }
  }
  return c;
}

int main() {
  int n, m;
  cin >> n >> m;
  init(n);
  /*for(int i = 1; i <= n; i++) {
    cout << i << " ";
  }
  cout << endl << endl;
  print(n);*/
  while(m--) {
    int x, y;
    cin >> x >> y;
    Union(x, y);
    //print(n);
  }
  int ans = 0;
  for(int i = 1; i <= n; i++) {
    //ans = max(ans, nroDeNodos(i, n));
    ans =  max(ans, sz[i]);
  }

  //printSize(n);
  cout << ans;
  /*cout << nroComponentes(n) << "\n";
  cout << nroDeNodos(4, n);*/
}

Measured memory_bytes: 5168
#include <algorithm>
#include <cstdio>
using namespace std;
int n;
int d[100000];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)	scanf("%d",d+i);
	sort(d+1,d+1+n);
	printf("%d",d[n/2+1]-d[n/2]);
	return 0;
}
//1 2 3 4 5 6

Measured memory_bytes: 1016
N, M = map(int, input().split())
SC = [tuple(map(int, input().split())) for _ in range(M)]

for num in range(1000):
    if len(str(num)) != N: continue
    for s, c in SC:
        s -= 1
        if str(num)[s] != str(c):
            break
    else:
        print(num)
        exit()
print(-1)

Measured memory_bytes: 9124
#include <stdio.h>

int main (void){
    int N,A,B;
    scanf ("%d %d %d", &N, &A, &B);

    if( 1<=N && N<=20,
        1<=A && A<=50,
        1<=B && B<=50){
    }else{ 
        printf("error");
    }

    int NA = N*A;
    if(NA<B){
        printf( "%d", NA);
    }else if(NA>B){
        printf( "%d", B);
    }else if(NA=B){
        printf( "%d", B);
    }
}


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

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

  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  vector<int> s = d;
  for (int i = 0; i < n - 1; i++) {
    s[i+1] += s[i];
  }
  int tot = 0;
  for (int i = 0; i < n - 1; i++) {
    tot += d[i] * (s[n-1] - s[i]);
  }
  cout << tot << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a;
    int cnt_5=0,cnt_7=0,i;

    for(i=0;i<3;i++)
    {
        if(scanf("%d",&a)<0)
        {
            perror("error");
        }
        if(a==5)
            cnt_5++;
        else if(a==7)
            cnt_7++;
    }
    if((cnt_5==2)&&(cnt_7==1))
    {
        puts("YES");
    }
    else
    {
        puts("NO");
    }
  

}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String aa=sc.next();
	
	char a=(char) (aa.charAt(0)+1);
	String vv=a+"";
	p(vv);
	
 }
}


Measured memory_bytes: 20948
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdlib>

using namespace std;

vector<string> split(const string& s, char delim) {
  vector<string> elems;
  stringstream ss(s);
  string item;
  while(getline(ss, item, delim)) {
    if(!item.empty()) {
      elems.push_back(item);
    }
  }
  return elems;
}

void print(string str, string a, string b) {
  int ai = atoi(a.c_str());
  int bi = atoi(b.c_str());
  for(int i = ai; i <= bi; i++)
    cout << str[i];
  cout << endl;
}

string reverse(string str, string a, string b) {
  int ai = atoi(a.c_str());
  int bi = atoi(b.c_str());
  string result = "";
  int cnt = 0;
  string temp = "";
  for(int i = ai; i <= bi; i++)
    temp += str[i];
  for(int i = 0; i < str.length(); i++) {
    if(i >= ai && i <= bi)
      result += temp[bi - i];
    else
      result += str[i];
  }
  return result;
}

string replace(string str, string a, string b, string item) {
  int ai = atoi(a.c_str());
  int bi = atoi(b.c_str());
  string result = "";
  int cnt = 0;
  for(int i = 0; i < str.length(); i++) {
    if(i >= ai && i <= bi)
      result += item[cnt++];
    else
      result += str[i];
  }
  return result;
}

int main(void) {
  vector<string> elems;
  string str,io;
  int q;
  cin >> str;
  cin >> q;
  cin.ignore();
  for(int i = 0; i < q; i++) {
    getline(cin, io);
    elems = split(io, ' ');
    if(elems[0] == "print")
      print(str, elems[1], elems[2]);
    else if(elems[0] == "reverse")
      str = reverse(str, elems[1], elems[2]);
    else if(elems[0] == "replace")
      str = replace(str, elems[1], elems[2], elems[3]);
  }
  return 0;
}

Measured memory_bytes: 3232
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
using namespace std;
int main(){
	int a,b;
	cin >> a >> b;
	if(a%3==0 || b%3==0 || (a+b)%3==0)cout << "Possible" <<endl;
	else cout << "Impossible" <<endl;
}

Measured memory_bytes: 256
n,x=map(int,input().split())
l=list(map(int,input().split()))

def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

kouho=[abs(l[i]-x) for i in range(n)]

ans=kouho[0]

for i in range(n-1):
  ans = gcd(ans,kouho[i+1])
  
print(ans)

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

  int N, L;
  cin >> N >> L;
  int min_v = 1e9;
  int rsl = 0;
  bool is_pos = true;
  rep(i, 1, N + 1) {
      int v = L + i - 1;
      if (abs(v) < min_v) {
          min_v = min(min_v, abs(v));
          is_pos = v > 0;
      }
      rsl += v;
  }
  if(is_pos) {
      cout << rsl - min_v << endl;
  } else {
      cout << rsl + min_v << endl;
  }
}


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

int main(){
	int n,d;
	int x,tmp,count=0;
	scanf("%d%d",&n,&d);
	x = d*2+1;
	if(n%x!=0){
		printf("%d\n",n/x+1);
	}else{
		printf("%d\n",n/x);
	}
	
}

Measured memory_bytes: 128
k = int(raw_input())
n = 50

ai = k/n + (n-1)
a = [ai] * n
r = k%n
b = n - r + 1
cq = (b * r) / (n-r)
cr = (b * r) % (n-r)
for i in range(n):
  if i < r:
    a[i] += b
  else:
    a[i] -= cq
    if cr > 0:
      a[i] -= 1
      cr -= 1

a = map(str, a)

print n
print " ".join(a)

Measured memory_bytes: 2568
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, d;
    cin >> n >> d;
    int odp = n / (2 * d + 1);
    if (n % (2 * d + 1) != 0)
        ++odp;
    cout << odp;
    return 0;
}


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

//=============warshall_floyd============================
long long  warshall_floyd(long long V, vector<vector<long long>> d)
{
  map<pair<int, int>, int> made;
  long long neg_ans = 0;
  for (long long k = 0; k < V; ++k)
  {
    for (long long i = 0; i < V; ++i)
    {
      for (long long j = 0; j < V; ++j)
      {
        if (d[i][j] > d[i][k] + d[k][j])
        {
          return -1;
        }
        if (i != k && k != j)
        {
          if (d[i][j] == d[i][k] + d[k][j])
          {
            if (made[{i, j}] + made[{j, i}] == 0)
            {
              neg_ans += d[i][j];
              made[{i, j}] = 1;
              made[{j, i}] = 1;
            }
          }
        }
      }
    }
  }
  return neg_ans;
}
//=================================================

int V, E;
int main()
{
  cin >> V;
  E = V * (V - 1);
  vector<vector<long long>> A(V, vector<long long>(V));
  long long cost;
  long long ans = 0;
  for (long long i = 0; i < V; ++i)
  {
    for (long long j = 0; j < V; ++j)
    {
      cin >> cost;
      A.at(i).at(j) = cost;
      ans += cost;
    }
  }
  long long neg_ans = warshall_floyd(V, A);
  if (neg_ans == -1)
  {
    cout << -1 << endl;
  }
  else
  {
    cout << ans / 2 - neg_ans << endl;
  }
}


Measured memory_bytes: 7296
s = input()
len_s = len(s)
list_ans =[]
for i in range(2):
        ans = 0
        if i == 0:
                for j in range(len_s):
                                if j % 2 == 0:
                                        if s[j] == "0":
                                                ans += 1
                                else:
                                        if s[j] == "1":
                                                ans += 1
        else:
                for j in range(len_s):
                        if j % 2 == 0:
                                if s[j] == "1":
                                        ans += 1
                        else:
                                if s[j] == "0":
                                        ans += 1
        list_ans.append(ans)
print(min(list_ans))

Measured memory_bytes: 3188
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD (ll)1000000007

int main(void)
{
	int n;
	scanf("%d", &n);
	while (n--)
		printf("ACL");
	return 0;
}

Measured memory_bytes: 1732
import math
import sys
sys.setrecursionlimit(1000000)

N = int(input())
A = [int(i) for i in input().split()]

memo = {}
def sub_max(n, m):
    if((n, m) in memo):
        return memo[(n, m)]
    
    if(m == 1 and n >= 1):
        memo[(n, m)] = max(A[-n:])
        return memo[(n, m)]

    if(m > math.ceil(n/2)):
        memo[(n, m)] = -float('inf')
        return -float('inf')
    
    res = -float('inf')
    for i in range(3):
        res = max(res, A[-n + i] + sub_max(n - i - 2, m - 1))
    memo[(n, m)] = res
    return res

print(sub_max(N, N//2))
# print(memo)

Measured memory_bytes: 276128
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;

int main() {
    ll n, m;
    cin >> n >> m;

    ll bef = -1;
    vector<ll> lx, ly;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (i != 0) {
            lx.push_back(x - bef);
        } 
        bef = x;
    }
    for (int i = 0; i < m; i++) {
        int y;
        cin >> y;
        if (i != 0) {
            ly.push_back(y - bef);
        } 
        bef = y;
    }

    n--;  m--;
    vector<pair<int, int>> p;
    ll ans = 0, val = 1, inf = 1e9 + 7;
    for (int i = 0; i < n; i++) {
        val = 1;
        val *= lx[i];
        val %= inf;
        ll tmp = (n - i) * (i + 1) % inf;
        val = val * tmp % inf;
        ans = (ans + val) % inf;
    }

    ll ans2 = 0;
    for (int i = 0; i < m; i++) {
        val = ans;
        val *= ly[i];
        val %= inf;
        ll tmp = (m - i) * (i + 1) % inf;
        val = val * tmp % inf;
        ans2 = (ans2 + val) % inf;
    }
    //cout << ans << endl;
    cout << ans2 << endl;

}

Measured memory_bytes: 2548