akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll n, m, q, ans=0;
    cin >> n >> m >> q;
    vector<ll> a(q), b(q), c(q), d(q);
    rep(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }

    rep(i, (1<<(n+m-1))) {
        ll tmp = 0;
        // bitが立っているところまでの0分だけ数列が増える
        rep(j, n+m-1) {
            if(i & (1<<j)) tmp++;
        }
        if(tmp != n) continue;
        
        ll now = 1, index = 0;
        vector<ll> A(n);
        rep(j, n+m-1) {
            if(i & (1<<j)) {
                A[index] = now;
                index++;
            }
            else {
                now++;
            }
        }

        ll tmp_ans = 0;
        rep(j, q) {
            if(A[b[j]]-A[a[j]] == c[j]) tmp_ans += d[j];
        }
        if(tmp_ans > ans) ans = tmp_ans;
    }

    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 3632
use std::io::Read;
use std::str::SplitWhitespace;
use std::str::FromStr;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse<T> {
    fn parse(&mut self) -> T;
}

impl<'a, T> Parse<T> for SplitWhitespace<'a>
where
    T: FromStr,
{
    fn parse(&mut self) -> T {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

type Edge = (usize, usize, u64);
type Adjacency = Vec<Vec<(usize, usize)>>;

fn paint(
    adjacency: &Adjacency,
    edges: &Vec<Edge>,
    parent: usize,
    color: u8,
    out: &mut Vec<Option<u8>>,
) {
    for child in &adjacency[parent] {
        if out[child.0].is_some() {
            continue;
        }
        let c = if edges[child.1].2 % 2 == 0 {
            color
        } else {
            if color == 0 { 1 } else { 0 }
        };
        out[child.0] = Some(c);
        paint(adjacency, edges, child.0, c, out);
    }
}

fn new_adjacency(edges: &Vec<Edge>, n: usize) -> Adjacency {
    let mut list = vec![Vec::new(); n];
    for (i, edge) in edges.into_iter().enumerate() {
        let u = edge.0 - 1;
        let v = edge.1 - 1;
        list[u].push((v, i));
        list[v].push((u, i));
    }
    list
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n = iter.parse();
    let edges = (0..(n - 1))
        .map(|_| (iter.parse(), iter.parse(), iter.parse()))
        .collect::<Vec<_>>();

    let nodes = new_adjacency(&edges, n);
    let mut colors = vec![None; n];
    colors[0] = Some(0);
    paint(&nodes, &edges, 0, 0, &mut colors);

    println!(
        "{}",
        colors
            .into_iter()
            .map(|c| c.unwrap().to_string())
            .collect::<Vec<_>>()
            .join("\n")
    );
}

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

int main(){
	string st;
	cin >> st;
    int f = 0;
    if(st.at(0) != st.at(1)) f = 1;
    if(st.at(2) != st.at(1)) f = 1;
    if(st.at(0) != st.at(2)) f = 1;
    if(f == 1){
	  cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

struct UnionFind{
  vector<int> v;
  UnionFind(int n) : v(n, -1) {}
  void init(){ for(int i = 0;i < (int)v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

typedef long double D;
typedef complex<D> P;

#define X real()
#define Y imag()

D dot(P a,P b){ return (conj(a)*b).X; }

const D eps=1e-9;
const D inf=1e12;
const D PI=acos(-1);
struct L : public vector<P> { // line and segment
  L(const P& a,const P &b){
    push_back(a);
    push_back(b);
  }
};

int N;
int sx,sy,tx,ty;
D R[110];
int sz[110];
D tot[110];
D st[110][21];
vector<P> cents[110];

int main(){
  cin>>N>>sx>>sy>>tx>>ty;
  rep(i,N){
    cin>>R[i];
    cin>>sz[i];
    rep(j,sz[i]){
      int x,y;
      cin>>x>>y;
      cents[i].push_back(P(x,y));
    }
    rep(j,sz[i])tot[i]+=abs(cents[i][j]-cents[i][(j+1)%sz[i]]);

    st[i][0]=0;
    repl(j,1,sz[i]){
      D len=abs(cents[i][j]-cents[i][j-1]);
      st[i][j]=st[i][j-1]+(len/tot[i]);
    }
  }
  sz[N]=1; cents[N].push_back(P(sx,sy));
  sz[N+1]=1; cents[N+1].push_back(P(tx,ty));

  UnionFind uf(N+2);
  rep(i,N+2){
    rep(j,i){
      if(i==N+1&&j==N)continue;
      rep(crti,sz[i]){
        int nxti=(crti+1)%sz[i];
        D ist=st[i][crti],ied=(nxti==0?1.0:st[i][nxti]);
        rep(crtj,sz[j]){
          int nxtj=(crtj+1)%sz[j];
          D jst=st[j][crtj],jed=(nxtj==0?1.0:st[j][nxtj]);

          D l=max(ist,jst),r=min(ied,jed);
          D ub=pow(R[i]+R[j],2);
          if(l>r)continue;

          P inidelta=(cents[i][crti]-(ist/(ied-ist))*(cents[i][nxti]-cents[i][crti]))-(cents[j][crtj]-(jst/(jed-jst))*(cents[j][nxtj]-cents[j][crtj]));
          P vdelta=((cents[i][nxti]-cents[i][crti])/(ied-ist))-((cents[j][nxtj]-cents[j][crtj])/(jed-jst));

          D A=norm(vdelta), B=2.0*dot(inidelta,vdelta), C=norm(inidelta);
          if(abs(A)<eps){
            if(C<=ub)uf.unite(i,j);
            continue;
          }
          if(A*l*l+B*l+C<=ub||A*r*r+B*r+C<=ub)uf.unite(i,j);
          D x=-B/(2.0*A);
          if(l<=x&&x<=r&&A*x*x+B*x+C<=ub)uf.unite(i,j);
        }
      }
    }
  }

  if(uf.same(N,N+1))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3376
import sys
input = sys.stdin.readline


n, m = [ int(v) for v in input().split() ]
n_q = 2**n

dp_list = [0] + [ 10**7 for i in range(n_q-1) ]
for i in range(m):
    a, b = [ int(v) for v in input().split() ]
    c_list = [ int(v)-1 for v in input().split() ]
    d = 0
    for j in c_list:
        d += 2**j
    for k in range(n_q):
        if 0 <= k | d < n_q:
            e = k | d
            if dp_list[e] > dp_list[k] + a:
                dp_list[e] = dp_list[k] + a

ans = dp_list[-1]
if dp_list[-1] == 10**7:
    ans = -1
print(ans)

Measured memory_bytes: 43228
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long  LLINF = 1e18;

using namespace std;


/*==================================================*/

/*==================================================*/

int K, T, a[105];

int main(){

  cin>>K>>T;
  REP(i,0,T) cin>>a[i];

  if(T == 1){
    cout<<a[0]-1<<endl;
    return 0;
  }

  sort(a,a+T);
  int sum = 0;
  REP(i,0,T-1){
    sum += a[i];
  }
  int ans = max(0, (a[T-1]-1) - sum);

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto X = RD;
	auto Y = RD;
	auto A = RD;
	auto B = RD;
	auto C = RD;

	auto arr = new long[][](A+B+C);
	foreach (i; 0..A)
	{
		arr[i] = [RD, 0];
	}
	foreach (i; 0..B)
	{
		arr[A+i] = [RD, 1];
	}
	foreach (i; 0..C)
	{
		arr[A+B+i] = [RD, 2];
	}
	arr.sort!"a[0] > b[0]"();

	long ans;
	long z;
	foreach (e; arr)
	{
		if (e[1] == 0 && X != 0)
		{
			ans += e[0];
			--X;
		}
		else if (e[1] == 1 && Y != 0)
		{
			ans += e[0];
			--Y;
		}
		else if (e[1] == 2)
		{
			ans += e[0];
			++z;
		}
		if (X+Y-z == 0) break;
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 30196
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1000001; //check the limits, dummy
 
 
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}
 
ll inv(ll base) {
	return modExp(base, MOD-2);
}
 
ll mul(ll A, ll B) {
	return (A*B)%MOD;
}
 
ll add(ll A, ll B) {
	return (A+B)%MOD;
}
 
ll dvd(ll A, ll B) {
    return mul(A, inv(B));
}
 
ll sub(ll A, ll B) {
    return (A-B+MOD)%MOD;
}
 
ll* facs = new ll[MX];
ll* facInvs = new ll[MX];
 
ll choose(ll a, ll b) {
	if (b > a) return 0;
	if (a < 0) return 0;
	if (b < 0) return 0;
    ll cur = facs[a];
    cur = mul(cur, facInvs[b]);
    cur = mul(cur, facInvs[a-b]);
    return cur;
}
 
void initFacs() {
	facs[0] = 1;
	facInvs[0] = 1;
	FOR(i, 1, MX) {
		facs[i] = (facs[i-1] * i) % MOD;
		facInvs[i] = inv(facs[i]);
	}
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    initFacs();


    ll X, Y; cin >> X >> Y;
    if ((X+Y)%3 != 0) {
        cout << 0 << endl; return 0;
    }
 
    if (max(X, Y) > 2*min(X, Y)) {
        cout << 0 << endl; return 0;
    }
    int K=(X+Y)/3;
    X -= (X+Y)/3; Y -= K;
    
    cout << choose(K, X) << endl;
	
	return 0;
}
 

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

bool a[100000],s[100000];
int b[100000], c[100000];
signed main() {
	int d, sum = 0;
	cin >> d;
	for (int e = 0; e < d; e++) {
		scanf("%d", &b[e]);
	}
	for (int i = 0; i < d; i++) {
		if (!a[i]) {
			memset(c, 0, sizeof(c));
			int now = i;
			while (1) {
				a[now] = true;
				if (c[now] == 2)break;
				else if (c[now] == 1)s[now] = true;
				c[now]++;
				now += b[now];
				now %= d;
			}
		}
	}
	for (bool u : s)sum += u;
	cout << sum << endl;
}

Measured memory_bytes: 4148
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <cstring>
const int maxn = 1e5+1100;
const int INF = 1e6;

using namespace std;

//生成最大生成树，破开的篱笆才最短 

struct edge{
	int u, v;
	double cost;
};
bool cmp(edge e1, edge e2){
	return e1.cost > e2.cost;
}

int N, M;
edge es[maxn];
double X[maxn], Y[maxn];
int par[maxn], ran[maxn];

//初始
void Init(int n){
	for(int i = 1; i <= n; i++){
		par[i] = i;
		ran[i] = 0;
	}
}
//查询
int Find(int x){
	if(x == par[x])
		return x;
	else
		return par[x] = Find(par[x]);
}
//合并
void Unit(int x, int y){
	x = Find(x);
	y = Find(y);
	if(x == y)return;
	
	if(ran[x] > ran[y])
		par[y] = x;
	else{
		par[x] = y;
		if(ran[x] == ran[y])
			ran[y]++;
	}
}
//判断 
bool Same(int x, int y){
	return Find(x) == Find(y);
}

void Solve(){
	Init(N);
	double ans = 0.0;
	
	//花费降序排序，不产生圈的情况下合并 
	sort(es, es+M, cmp);
	for(int i = 0; i < M; i++){
		edge e = es[i];
		//如果加进并查集产生圈，破开 
		if(Same(e.u, e.v)){
			ans += e.cost;
			continue;
		}
		Unit(e.u, e.v);
	}
	printf("%lf\n", ans);
}

//测试函数 
int main(){
//	freopen("D:\\钢铁程序员\\程序数据\\078拯救猫咪.txt", "r", stdin);
	while(~scanf("%d%d", &N, &M)){
		for(int i = 1; i <= N; i++)
			scanf("%lf%lf", &X[i], &Y[i]);
		//提取图
		for(int i = 0; i < M; i++){
			int a, b;
			scanf("%d%d", &a, &b);
			es[i].u = a;
			es[i].v = b;
			double c = X[a] - X[b];
			double d = Y[a] - Y[b];
			es[i].cost = sqrt(c * c + d * d);
		} 
		
		Solve();
	}
	return 0;
} 


Measured memory_bytes: 3928
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
#define N (1000000000+7)

int main(void) {
	string s;
	char stack = 'a';
	ll ans = 0, ma = 0;
	cin >> s;
	stack = s[s.length() - 1];
	for (ll i = s.length() - 2;i >= 0;i--) {
		if (s[i] != stack) {
			ans++;
			stack = s[i];
		}
	}
	stack = s[0];
	for (ll i = 1;i < s.length();i++) {
		if (s[i] != stack) {
			ma++;
			stack = s[i];
		}
	}
	ans = max(ans, ma);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int a,b,c,num;
int main()
{
	cin>>a>>b;
	c=1;
	while(c<b)
	{
		c+=a-1;
		num++;
	}
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 256
# Factors of Factorial

import math
from collections import defaultdict

def primes(n): # Eratosthenes' sieve
    prime = [True] * (n + 1)
    prime[0] = False
    prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            prime[j] = False
    return [i for i in range(n + 1) if prime[i]]
        
def factorize(n):
    result = defaultdict(int)
    for p in primes(n):
        while n % p == 0:
            n = n // p
            result[p] += 1
    return result

N = int(input())
mod = 10**9 + 7

fact = defaultdict(int)
for i in range(2, N+1):
    for key, value in factorize(i).items():
        fact[key] += value

ans = 1
for i in fact.values():
    ans *= i+1
    ans %= mod
print(ans)

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


int main() {
    cout<<fixed<<setprecision(10);

    char a; cin>>a;
    if(a>='A' and a<= 'Z') puts("A");
    else puts("a");

    return 0;

}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>

using namespace std;

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

long long gcb(long long a,long long b){
  if(a<b) return a? gcb(a,b%a) : b;
  return b? gcb(b,a%b) : a;
}

int main(){
  int n;
  cin>>n;
  vector<long long> t(n);
  long long l;
  for(int i=0;i<n;i++) cin>>t[i];
  if(n==1) l=t[0];
  else{
    l=t[0]/gcb(t[0],t[1])*t[1];
    for(int i=2;i<n;i++){
      l=l/gcb(t[i],l)*t[i];
    }
  }
  cout<<l<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var ac, wa, tle, re int
	for i := 0; i < n; i++ {
		var tmp string
		fmt.Scanf("%s", &tmp)
		switch (tmp) {
		case "AC":
			ac++
		case "WA":
			wa++
		case "TLE":
			tle++
		case "RE":
			re++
		}
	}

	fmt.Printf("AC x %d\n", ac);
	fmt.Printf("WA x %d\n", wa);
	fmt.Printf("TLE x %d\n", tle);
	fmt.Printf("RE x %d\n", re);
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()


int main(){
    int N;
    cin>>N;
    const int T=100003;
    bitset<T*2> is_prime(0);
    REP(i,2,T+1)is_prime.set(i);
    REP(i,2,T+1){
        if(is_prime[i]){
            for(int j=i*2;j<T;j+=i){
                is_prime.reset(j);
            }
        }
    }
    ll M;

    for(int i=T;i>=0;i--){
        if(is_prime[i]&&i>=N){
            M=i;
        }else if(i<N){
            cout<<M<<endl;
            return 0;
        }
    }

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int h,w,k,l,m,a,b,s,t,u,v,i,j,x[999][999];main(){while(1){memset(x,0,1<<21);v=0;cin>>k;if(!k){break;}cin>>w>>h;for(i=0;i<k;i++){cin>>a>>b;x[a][b]=1;}cin>>s>>t;for(i=1;i<=w;i++){for(j=1;j<=h;j++){u=0;for(l=0;l<s;l++){for(m=0;m<t;m++){if(x[i+l][j+m]){u++;}}}v=max(v,u);}}cout<<v<<endl;}}

Measured memory_bytes: 3220
from collections import defaultdict

N, M = map(int, input().split())
d = defaultdict(int)
for _ in range(N):
    for a in list(map(int, input().split()))[1:]:
        d[a] += 1

ans = 0
for _, v in d.items():
    if v == N:
        ans += 1

print(ans)

Measured memory_bytes: 3316
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  n=len(s)

  dp=[[0]*13 for _ in range(n+1)]
  dp[0][0]=1
  for i in range(n):
    if s[i]=='?':
      for j in range(10):
        for k in range(13):
          dp[i+1][(k*10+j)%13]+=dp[i][k]
    
    else:
      a=int(s[i])
      for j in range(13):
        dp[i+1][(j*10+a)%13]+=dp[i][j]

    for j in range(13):
      dp[i+1][j]%=mod

  return dp[n][5]

# main()
print(main())


Measured memory_bytes: 87512
L, R = map(int, input().split())

mod_list = []
min1 = 2019
min2 = 2019

if (R - L) > 2019:
    print(0)

else:
    for i in range(L, R):
        for s in range(i+1, R+1):
            if (i*s)%2019 <= min1:
                min1 = (i*s)%2019
    print(min1)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		int X = 0;
		int diff_min = Math.abs(Integer.parseInt(S.substring(0, 3)) - 753);
		int diff;
		for (int i = 1; i < S.length() - 2; i++) {
			X = Integer.parseInt(S.substring(i, i + 3));
			diff = Math.abs(X - 753);
			if (diff < diff_min) {
				diff_min = diff;
			}
		}
		System.out.println(diff_min);
	}
}


Measured memory_bytes: 23124
import java.util.*;

public class Main {

	public static int[] dp;
	public static ArrayList<Integer>[] win;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		a[0] = 0;
		for(int i=1; i<n; i++){
			a[i] = sc.nextInt();
		}
		sc.close();
		
		win = new ArrayList[n];
		for(int i=0; i<n; i++){
			win[i] = new ArrayList<Integer>();
		}
		
		for(int i=1; i<n; i++){
			win[a[i]-1].add(i);
		}
		dp = new int[n];

		solve(0);
		
		System.out.println(dp[0]-1);
		
	}

	public static void solve(int v){
		int size = win[v].size();
		if(size ==0){
			dp[v] = 1;
			return;
		}
		int[] d = new int[size];
		for(int i=0; i<size; i++){
			int t = win[v].get(i);
			solve(t);
			d[i] = dp[t];
		}
		Arrays.sort(d);
		int depth = 0;
		for(int i=0; i<size; i++){
			if(depth < size - i + d[i]) depth = size - i + d[i];
		}
		dp[v] = depth;
	}
}


Measured memory_bytes: 68280
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
using namespace std;
int main()
{
	int n=700;
	string s;
	cin>>s;
	for(int i=0;i<3;i++) if(s[i]=='o') n+=100;
	cout<<n;
    rt0;
}

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

using namespace std;

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

    for(int i = 0; i < S.size(); i++){
        for(int j = 0; j < N; j++)
        {
            if(S[i] == (char)'Z')
            {
                S[i] = (char)'A';
                continue;
            }
            S[i] = (char)S[i] + 1;
        }
    }

    cout << S << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int p[212345];
bool used[212345];
int q[212345];
int dp[212345];
int n;
int main(){
  cin>>n;
  bool flag=false;
  for(int i=0;i<n;i++){
    cin>>p[i];
    if(p[i]!=i+1)flag=true;
  }

  int cnt=1;
  int ans=0;
  for(int i=0;i<n;i++){
    q[p[i]]=q[p[i]-1]+1;
    ans=max(ans,q[p[i]]);
  }


cout<<n-ans<<endl;


}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int a, b;

    scanf("%d %d", &a, &b);
    if (a < b){
        printf("a < b\n");
    }else if (a > b){
        printf("a > b\n");
    }else if (a == b){
        printf("a == b\n");
    }else{
        printf("ERROR!\n");
    }

    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
vector<set<int> >v(26);
int main()
{
	fastread;
	int n,i,j,k,l,q;
	string s;
	cin>>n;
	cin>>s;
	l=s.length();
	for(i=0;i<l;i++)
	{
		v[s[i]-'a'].insert(i);
	}
	cin>>q;
	while(q--)
	{
		int n1,n2;
		char ch;
		cin>>k;
		if(k==1)
		{
			cin>>n1>>ch;
			n1--;
			///s[n1]=ch;
			v[s[n1]-'a'].erase(n1);
			s[n1]=ch;
			v[ch-'a'].insert(n1);
			
		}
		else
		{
			cin>>n1>>n2;
			--n1,--n2;
			int sum=0;
			for(i=0;i<26;i++)
			{
				///auto pp=v[i].begin();
				///pp=lower_bound(v[i].begin(),v[i].end(),n1)-v[i].begin();
				///qq=lower_bound(v[i].begin(),v[i].end(),n2)-v[i].begin();
			auto pp=v[i].lower_bound(n1);
				if(pp!=v[i].end()&&*pp<=n2)
				///qq=v[i].lower_bound(n1)-v[i].begin();
				sum++;
			}
			cout<<sum<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 25852
#include <stdio.h>
 
int main(void) {
 
int a,b;
 
scanf("%d %d", &a, &b);
 
if(a < b){
printf("a < b\n");
} else if(a > b) {
printf("a > b\n");
} else {
printf("a == b\n");
}
return 0;
}

Measured memory_bytes: 2516
def examA():
    a, b, c = LI()
    da = b-a
    db = c-b
    if da==db:
        ans="YES"
    else:
        ans="NO"
    print(ans)


import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


Measured memory_bytes: 38256
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"

  val input: Array[Array[Int]] = Array.ofDim(6, 6000000)
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val s = sc.next

  lazy val sliced = s.sliding(n / 2, n / 2).toSeq
  val ans =
    if (n % 2 != 0) No
    else if (sliced(0) == sliced(1)) Yes else No

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 167876
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define rep(j,m) for(int j=0;j<m;++j)
#define REP(i,n) for(int i=1;i<=n;++i)
#define aint(v)   ((v).begin()), ((v).end())
#define len(s)   ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef vector<pair<int,int> >vepa;
typedef set<char>se;
typedef map<ll ,ll> mpp;
const int N=1e6+5 ,OO=1e18;
const int di[]={1,-1,0,0};
const int dj[]={0,0,1,-1};
ll TC,n,m,a,b,ans,sum,arr[N];
bool f,vis[N];

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
        cin>>n;
        mpp mp;
        rep(i,n&&cin>>a){
          sum+=a;
          mp[a]++;
        }
         cin>>m;
         rep(i,m)
         {
             cin>>a>>b;
             if(mp[a]==0){
              cout<<sum<<"\n";
              continue;}
              if(a<b)
                {
                     int ss=b-a;
                     mp[b]+=mp[a];
                     sum+=ss*mp[a];
                     cout<<sum <<'\n';
                     mp[a]=0;
                }else{

                     int ss=a-b;
                     mp[b]+=mp[a];
                     sum-=ss*mp[a];
                     cout<<sum <<'\n';
                     mp[a]=0;
                }

         }
go;
}


Measured memory_bytes: 9364
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

int main() {
  ll N;
  cin >> N;
  vector<ll> sticks(N);
  for (ll i = 0; i < N; i++) {
    cin >> sticks[i];
  }

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

  // a, bを固定して考える
  // a <= b <= c
  ll ans = 0;
  for (ll i = 0; i < N - 2; i++) {
    for (ll j = i + 1; j < N - 1; j++) {
      auto target =
          lower_bound(sticks.begin(), sticks.end(), sticks[i] + sticks[j]) -
          sticks.begin();

      // if (target >= N) continue;
      // if (target <= j) continue;

      // cout << sticks[i] << " " << sticks[j] << " " << sticks[target] << "("
      //      << target << ")" << endl;

      ans += target - j - 1;
    }
  }

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


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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

int main() {
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    vector<ll> t(N);
    ll ans = 1;
    for (ll x : divisor(sum)) {
        t = A;
        for (int i = 0; i < N; i++) {
            t[i] %= x;
        }
        sort(t.begin(), t.end());
        vector<ll> lef(N); lef[0] = t[0];
        for (int i = 1; i < N; i++) lef[i] = lef[i-1] + t[i];
        vector<ll> rig(N); rig[N-1] = x - t[N-1];
        for (int i = N-2; 0 <= i; i--) rig[i] = rig[i+1] + (x - t[i]);
        ll k = 10000000000;
        for (int i = 1; i < N; i++) {
            if (lef[i-1] == rig[i]) k = lef[i-1];
        }
        if (k <= K) ans = max(ans, x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import queue
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]

inf=100000000
ma=[]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            x=[[inf for i_sub in range(w)] for j_sub in range(h)]
            q=queue.Queue()
            d=0
            q.put([i,j])
            x[i][j]=0
            while q.qsize()!=0:
                d+=1
                l=q.qsize()
                for t in range(l):
                    I,J=q.get()
                    if I-1>=0 and s[I-1][J]=="." and x[I-1][J]==inf:
                        q.put([I-1,J])
                        x[I-1][J]=d
                    if I+1<=h-1 and s[I+1][J]=="." and x[I+1][J]==inf:
                        q.put([I+1,J])
                        x[I+1][J]=d
                    if J-1>=0 and s[I][J-1]=="." and x[I][J-1]==inf:
                        q.put([I,J-1])
                        x[I][J-1]=d
                    if J+1<=w-1 and s[I][J+1]=="." and x[I][J+1]==inf:
                        q.put([I,J+1])
                        x[I][J+1]=d
            ma_sub=0
            for k in range(h):
                for l in range(w):
                    if x[k][l]!=inf:
                        ma_sub=max(ma_sub,x[k][l])
            ma.append(ma_sub)

print(max(ma))


Measured memory_bytes: 4080
n, k = map(int, input().split())
a = [int(i) - 1 for i in input().split()]
visit = {0}
tmp = 0
a_list = [0]
ans = True
for i in range(k):
    tmp = a[tmp]
    if tmp in visit:
        left = a_list.index(tmp)
        ans = False
        print(a_list[left + (k - left) % (i + 1 - left)] + 1)
        break
    else:
        visit.add(tmp)
        a_list.append(tmp)
if ans:
    print(tmp + 1)

Measured memory_bytes: 32328
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int A, B;
  char op;
  cin >> A >> op >> B;
  cout << (op == '+' ? A + B : A - B) << endl;
}


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

int main(){
  bool cards[4][14];
  int n, rank;
  char suit;
    
  for ( int s = 0; s < 4; s++ )
    for ( int r = 1; r <= 13; r++ )
      cards[s][r] = 0;
      
   cin >> n;
    for ( int i = 0; i < n; i++ ){
      cin >> suit >> rank;
      if ( suit == 'S'  ) cards[0][rank] = 1;
      if ( suit == 'H'  ) cards[1][rank] = 1;
      if ( suit == 'C'  ) cards[2][rank] = 1;
      if ( suit == 'D'  ) cards[3][rank] = 1;
}

for ( int s = 0; s < 4; s++ ) {
    for ( int r = 1; r <= 13; r++ )  {
     if ( cards[s][r] ) continue;
     if ( s == 0 ) suit = 'S';
     if ( s == 1 ) suit = 'H';
     if ( s == 2 ) suit = 'C';
     if ( s == 3 ) suit = 'D';
     cout << suit << " " << r << endl;
    }
}

  return 0;
}    

Measured memory_bytes: 1160
# include <iostream>
using namespace std;
int main(){
int n,k;
string s;
cin>>n>>k>>s;
if (s[k-1]=='A')
    s[k-1]='a';
else if (s[k-1]=='B')
    s[k-1]='b';
else
    s[k-1]='c';
cout<<s;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define maxn 200005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define pb push_back
# define mp make_pair
//# define int ll
using namespace std;

int32_t main(){_
	//freopen("input","r",stdin);
	int x;
	cin >> x;
	if(x < 1200)
		rc("ABC");
	else rc("ARC");
	return 0;
}


Measured memory_bytes: 764
n,k,s=[int(i) for i in input().split()]
ans=""
for i in range(n):
    if i>k-1:
        if(s==10**9):
            ans+=str(10**9-1)
        else:
            ans+=str(10**9)
    else:
        ans+=str(s)
    ans+=" "
print(ans[:-1])

Measured memory_bytes: 7444
a,b = map(int,input().split())
card = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if card.index(a)==card.index(b):
  print('Draw')
elif card.index(a)>card.index(b):
  print('Alice')
else:
  print('Bob')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,ll>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=305,Mod=998244353;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
//inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
char s[MAXN];int n,k,a[MAXN],cnt,f[MAXN][MAXN*2][MAXN];
inline void Add(int&x,int y){x+=y,x>=Mod?x-=Mod:0;}
int tmp1[MAXN*2][MAXN],tmp2[MAXN*2][MAXN];
inline int Get1(int x,int y){return tmp1[x][y];}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	scanf("%s",s+1),n=strlen(s+1),k=read(),s[n+1]='0';
	int num=0,sum=0;
	Rep(i,1,n+1)if(s[i]=='0')a[++cnt]=num,num=0;else num++;
	k=min(k,n);f[cnt+1][0][0]=1;k<<=1;
	Red(i,cnt,1){
		sum+=a[i];
		Rep(j,0,k)Rep(l,0,sum)tmp1[j][l]=((j&&l?tmp1[j-1][l-1]:0)+f[i+1][j][l])%Mod;
		Rep(j,0,k)Rep(l,0,sum){
			Rep(m,0,a[i])if(m<=l&&j>=a[i]-m)Add(f[i][j][l],f[i+1][j-a[i]+m][l-m]);
			if(l>=a[i]+1)Add(f[i][j][l],tmp1[j-1][l-a[i]-1]);
		}
	}int ans=0;Rep(i,0,k)if(~i&1)Add(ans,f[1][i][sum]);cout<<ans<<'\n';
	return 0;
}




Measured memory_bytes: 112592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var ary = new int[] {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		var p = Console.ReadLine().ToInt();
		Console.WriteLine(ary[p-1]);
	}
	

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
ll fac[2003];
ll inv[2003];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n==r||r==0)
    return 1LL;
    
    if(n<r)
    return 0;
    
    ll a=fac[n];
    
    a*=inv[r];
    
    a%=mod;
    
    a*=inv[n-r];
    
    a%=mod;
    
    return a;
}
void solve()
{
  ll n;
  
  cin>>n;
  
  ll ans=0;
  
  for(ll i=1;i<=n;i++){
      ll xx=n-2*i-1;
      
      ll yy=i-1;
      
      if(xx<0||yy>xx)
      continue;
      
      ans+=ncr(xx,yy);
      
      ans%=mod;
  }
  
  cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.
 
 fac[0]=1;
 fac[1]=1;
 
 for(ll i=1;i<=2000;i++)
 fac[i]=(i*fac[i-1])%mod;
 
 for(ll i=0;i<=2000;i++){
     inv[i]=inv_mod(fac[i]);
 }
  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 3584
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

const char S[4] = {'S', 'H', 'C', 'D'};
bool visited[4][14];
int N;

int main(){
  scanf("%d", &N);
  for (int i = 0; i < N; i++){
    char C; int K; cin >> C >> K;

    for (int j = 0; j < 4; j++){
      if (S[j] != C) continue;
      visited[j][K] = true;
    }
  }

  for (int i = 0; i < 4; i++){
    for (int j = 1; j <= 13; j++){
      if (visited[i][j]) continue;
      printf("%c %d\n", S[i], j); 
    }
  }

  return 0;
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  char z;
  cin >> z;
  cout << (char)(z + 1) << endl;
}


Measured memory_bytes: 256
# frozen_string_literal: true

x, y = gets.split.map(&:to_i)
h = Hash.new(0)
h[1] = 300_000
h[2] = 200_000
h[3] = 100_000

if x == 1 && y == 1
  puts 1_000_000
else
  puts h[x] + h[y]
end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String output = "No";

		Integer nInteger = new Integer(scanner.next());

		for(int i= 0,iLen = (nInteger/7+1);i < iLen;i++) {
			for(int j = 0,jLen = ((nInteger-i*7)/4)+1;j<jLen;j++) {
				if(nInteger == (i*7+j*4)) {
					output = "Yes";
					break;
				}
			}
		}
		System.out.println(output);
		scanner.close();
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100001
int R[MAXN], id[MAXN],C[MAXN];
struct info
{
	int c;
	int y;
	int p;
	bool operator<(const info &o)
	{
		return y < o.y;
	}
}info[MAXN];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		cin >> info[i].c >> info[i].y;
		info[i].p = i;
	}
	sort(info, info + M);
	for (int i = 0; i < M; i++)
	{
		id[info[i].p] = ++R[info[i].c];
		C[info[i].p] = info[i].c;
	}
	for (int i = 0; i < M; i++)printf("%06d%06d\n", C[i], id[i]);
	return 0;
}

Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] whxyr = new int[5];
		for(byte i = 0;i < whxyr.length;i++){
			whxyr[i] = sc.nextInt();
		}
		Calc cl = new Calc();
		cl.calc(whxyr);
		int[] renewWh = {whxyr[0] - whxyr[4], whxyr[1] - whxyr[4], whxyr[2] + whxyr[4], whxyr[3] + whxyr[4]};
		if(renewWh[0] >= 0 && renewWh[1] >= 0 && renewWh[2] <= whxyr[0] && renewWh[3] <= whxyr[1]){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}
class Calc{
	public int[] calc(int[] array){
		int tmp;
		for(byte i = 0;i < array.length - 2;i++){
			if(array[i + 2] < 0){
				tmp = array[i];
				array[i] = array[i + 2];
				array[i + 2] = tmp;
			}
		}
		return array;
	}
}


Measured memory_bytes: 26188
N, K, *A = map(int, open(0).read().split())

nxt = [-1] * N
prev = {}
for i, a in enumerate(A + A):
    if a in prev:
        nxt[prev[a]] = i % N
    prev[a] = i % N

cur = 0
k = 0
while k < K - 1:
    if cur >= nxt[cur]:
        k += 1
    cur = (1 + nxt[cur]) % N
    if cur == 0:
        k = K - (K % (k + 1))

ans = []
while cur < N:
    if cur >= nxt[cur]:
        ans.append(A[cur])
        cur += 1
    else:
        cur = 1 + nxt[cur]

print(*ans)

Measured memory_bytes: 46856