akhauriyash/Code-Regression huggingface dataset:
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
use std::num;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


fn main(){
    let n: u64 = read_as_vec()[0];
    let mut ans = 0;
    if n < 3{
        println!("0");
        return;
    }
    for i in 1.. (n as f64).sqrt().ceil() as u64+1{
        //println!("{}", i);

        if n%i != 0{
            continue;
        }

        let k = n/i;
        if k <= 1{
            continue;
        }
        if n%(k-1) == n/(k-1){
            ans += k-1;
        }
    }


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


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
//#define int long long
#define rep(i,n) for(int i;i<n;i++)
#define fi first
#define se second
#define INF 100000002
#define MAX 1000002
using namespace std;

int main(){
	string s, str, tmp;
	int n;
	cin >> s >> n;
	int m = s.size(), ans = 0;
	while(n--){
		cin >> str;
		str += str;
		for(int i = 0;i < 20;i++){
			tmp = str.substr(i, m);
			if(tmp == s){ans++;break;}
		}
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 3176
#include <stdio.h>
int main (){
    long long int N, sum = 1;
    scanf("%lld",&N);

    long long int A[N];
    for(int i = 0; i < N; i++){
        scanf("%lld", &A[i]);
    }

    for(int i = 0; i < N; i++){
        if(A[i] == 0){
            printf("0");
            return 0;
        }
    }

    for(int i = 0; i < N; i++){
        if(A[i] <= 1000000000000000000 / sum){
            sum *= A[i];
        } else {
            printf("-1");
            return 0;
        }
    }
    printf("%lld", sum);

    return 0;
  }

Measured memory_bytes: 2508
#include <stdio.h>

#define max(a,b) (a < b ? b : a)

int main(){
  int i, sum = 0,a;
  for(i = 0 ; i < 5 ; i++){
    scanf("%d",&a);
    sum += max(a,40);
  }
  printf("%d\n",sum/5);
  return 0;
}

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

typedef long long ll;
vector<pair<ll,ll> > v[19][19];
int n,a[19],sz[19];
bool bo[19][19];
ll ans;

void solve(int l,int r)
{
	if (bo[l][r]) return; bo[l][r]=1;
	if (r-l==1) {v[l][r][0]=make_pair((ll)a[l],(ll)a[r]); return;}
	int tot=0;
	for (int i=l+1; i<r; i++)
	{
		solve(l,i),solve(i,r);
		for (int j=0; j<sz[i-l+1]; j++)
			for (int k=0; k<sz[r-i+1]; k++)
			{
				long long nw=v[l][i][j].second+v[i][r][k].first-a[i];
				v[l][r][tot++]=make_pair(v[l][i][j].first+nw,v[i][r][k].second+nw);
			}
	}
}

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	if (n==2) return printf("%d\n",a[1]+a[2]),0;
	sz[2]=1;
	for (int i=3; i<n; i++)
		for (int j=2; j<i; j++) sz[i]+=sz[j]*sz[i-j+1];
	for (int i=1; i<=n; i++)
		for (int j=i+1; j<=n; j++) v[i][j].resize(sz[j-i+1]);
	ans=1000000000000000000ll;
	for (int i=2,l=1,r=n; i<n; i++)
	{
		solve(l,i),solve(i,r);
		for (int j=0; j<sz[i-l+1]; j++)
			for (int k=0; k<sz[r-i+1]; k++)
			{
				long long nw=v[l][i][j].second+v[i][r][k].first-a[i];
				ans=min(v[l][i][j].first+nw+v[i][r][k].second+nw,ans);
			}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 499712
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int temp;
		int sum[]=new int[2],h[]=new int[2],m[]=new int[2],s[]=new int[2];
		while(sc.hasNext()){
			sum[0]=sum[1]=0;
			for(int i=0;i<2;i++){
				h[i]=sc.nextInt();
				m[i]=sc.nextInt();
				s[i]=sc.nextInt();
				sum[i]=h[i]*3600+m[i]*60+s[i];
			}
			temp=sum[1]-sum[0];
			System.out.print(temp/3600);
			temp%=3600;
			System.out.print(" "+temp/60);
			temp%=60;
			System.out.println(" "+temp);
		}

	}

}

Measured memory_bytes: 12000
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/08/20 03:55:25
// -----------------------------------

#include <bits/stdc++.h>
#include <atcoder/lazysegtree.hpp>

using namespace std;
using ll = long long;

struct Mon {
  int zs, os;
  ll rev;
};
Mon e() {return {0, 0, 0};}
Mon op(Mon a, Mon b) {
  Mon m;
  m.zs = a.zs + b.zs;
  m.os = a.os + b.os;
  m.rev = a.rev + b.rev + (ll) a.os * b.zs;
  return m;
}

using Act = bool;
Act id() {return false;}
Mon act(Act f, Mon a) {
  if (!f) return a;
  Mon b;
  b.zs = a.os;
  b.os = a.zs;
  b.rev = (ll) a.os * a.zs - a.rev;
  return b;
}
Act composit(Act g, Act f) {
  return g^f;
}
using Lst = atcoder::lazy_segtree<Mon, op, e, Act, act, composit, id>;

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

  int n,q; cin>>n>>q;
  vector<Mon> A(n);
  for (int i = 0; i < n; i++) {
    int b; cin>>b;
    A[i] = {!b, b, 0};
  }
  Lst lst(A);

  while (q--) {
    int t,l,r; cin>>t>>l>>r; l--; r--;
    if (t == 1) {
      lst.apply(l, r+1, true);
    } else {
      cout << lst.prod(l, r+1).rev << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 14560
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  	long long X;
  	cin >> X;
  	int root=ceil(sqrt(X));
  	int ans = floor(log10(X))+1;
  	for(int i=1;i<=root;i++){
      	if(X%i==0) ans = min(int(floor(log10(X/i)+1)), ans);
    }
  	cout << ans << endl;
}

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



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

  if(N==1) n = 0;
  if(N==2) n = 1;
  else {
    n = (2 + (N-1)) * (N-2)/2 + 1;
  }

  cout << n << endl;

  return 0;
}

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

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

  
	cin >> A >> B >> C >> K;
  
  int ans = A;
  int d = B;
  int f = C;
  
  if (ans < B) {
    ans = B;
    d = A;
    f = C;
  }
  if (ans < C) {
    ans = C;
    d = A;
    f = B;
  }
  for (int i = 0; i < K; i++) {
    ans *= 2;
  }
  
  cout << ans + d + f << endl;
  
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {
 string S,T;
cin >>S>>T;
bool flag=false;
fx(S.size()){
	int i=0;
	int c=x+i;
	if(c>=S.size()){c-=S.size();}
	while(i<T.size()){
		if(S.at(c)==T.at(i)){
		i++;
		c=x+i;
	if(c>=S.size()){c-=S.size();}
		}else{
			break;
		}
	}
		if(i==S.size()){
			flag=true;
			break;
		}
}
if(flag){
	ce("Yes");
}else{
	ce("No");
}

}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> task(N);
    for (int i = 0; i < N; i++) {
        cin >> task[i].first >> task[i].second;
    }

    sort(ALL(task), [] (const pair<int, int> &a, const pair<int, int> &b) {
        return a.second < b.second;
    });

    ll sum = 0;
    bool flg = true;
    for (int i = 0; i < N; i++) {
        sum += task[i].first;
        if (sum > task[i].second) flg = false;
    }

    if (flg) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
const int inf=(1ll<<31)-1;
int data[maxn*4];
#define lson (rt<<1)
#define rson (rt<<1|1)

/* 
左开右闭
 */
void upd(int rt,int l,int r,int x,int y,int v){
    if(y<=l||x>=r)return;
    if(x<=l&&y>=r)data[rt]=v;
    else{
        if(~data[rt]){
            upd(lson,l,l+r>>1,l,r,data[rt]);
            upd(rson,l+r>>1,r,l,r,data[rt]);
            data[rt]=-1;
        }
        upd(lson,l,l+r>>1,x,y,v);
        upd(rson,l+r>>1,r,x,y,v);
    }
}
int query(int rt,int l,int r,int x,int y){
    if(y<=l||x>=r)return inf;
    if(~data[rt])return data[rt];
    else return min(query(lson,l,l+r>>1,x,y),query(rson,l+r>>1,r,x,y));
}
signed main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,q;
    cin>>n>>q;
    rep(i,1,n)data[i]=inf;
    rep(i,1,q){
        int op,x,y,v;
        cin>>op;
        if(op){
            cin>>x>>y;
            cout<<query(1,1,n+1,x+1,y+2)<<endl;
        }else{
            int v;
            cin>>x>>y>>v;
            upd(1,1,n+1,x+1,y+2,v);
        }
    }
}
/* 
3 5
0 0 1 1
0 1 2 3
0 2 2 2
1 0 2
1 1 2

1≤n≤100000
1≤q≤100000
1≤s≤t≤n
0≤x<1000
 */


Measured memory_bytes: 5228
#include <iostream>
#include <string>
#include <limits.h>
using namespace std;

int main() {
   
    string s;
    cin >> s;
    
    long long start = LLONG_MAX;
    long long end;
    
    for ( long long l = 0; l < s.length(); l++ ) {
        if ( start == LLONG_MAX && s.substr( l, 1 ) == "A" ) { start = l; }
        else if ( s.substr( l, 1 ) == "Z" ) { end = l; }
    }
    
    cout << end - start + 1 << endl;
    
    return 0;
}

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

using namespace std;
typedef long long ll;

struct UnionFind{
    vector<ll> par;
    vector<ll> chs;
    vector<ll> d;
    UnionFind(ll N){
        par.resize(N);
        chs.resize(N);
        d.resize(N);
        for(int i=0;i<N;i++) par[i] = i;
        for(int i=0;i<N;i++) chs[i] = 1;
        for(int i=0;i<N;i++) d[i] = 1;
    }
    ll root(ll n){
        if(par[n] == n) return n;
        return root(par[n]);
    }
    void unite(ll a, ll b){
        ll ra = root(a);
        ll rb = root(b);
        if(ra == rb) return;
        if(d[ra] >= d[rb]){
            par[rb] = ra;
            chs[ra] += chs[rb];
            d[ra] = max(d[ra], d[rb] + 1);
        }else{
            par[ra] = rb;
            chs[rb] += chs[ra];
        }
    }
    bool isSame(ll a,ll b){
        return root(a) == root(b);
    }
    ll nodes(ll n){
        return chs[root(n)];
    }
};

ll N,M,K;
ll f[100000];

int main(){
    cin >> N >> M >> K;
    UnionFind uf(N);
    for(int i=0;i<M;i++){
        ll a,b;
        cin >> a >> b;
        uf.unite(a-1,b-1);
        f[a-1]++;
        f[b-1]++;
    }
    for(int i=0;i<K;i++){
        ll a,b;
        cin >> a >> b;
        if(uf.root(a-1) == uf.root(b-1)){
            f[a-1]++;
            f[b-1]++;
        }
    }
    for(int i=0;i<N;i++){
        cout << uf.chs[uf.root(i)] - f[i] - 1;
        if(i != N-1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {
	
	int N;

	cin >> N;

	int a = (N % 100) % 10;
	int b = ((N % 100) - a)/10;
	int c = (N - (a + b))/100;
	if (a == 7 || b == 7 || c == 7) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
	private	static	BufferedReader br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int		nItems = 0;
		int[]	aLens  = null;

		nItems = parseItems();
		for(int nLoop = 0; nLoop < nItems; nLoop++) {
			aLens = parseLens();
			Arrays.sort(aLens);
			if (aLens != null) {
				if (aLens[0] * aLens[0] + aLens[1] * aLens[1] == aLens[2] * aLens[2]) {
					System.out.println("YES");
				}
				else {
					System.out.println("NO");
				}
			}
			else {
				System.out.println("NO");
			}
		}
	}

	private static int parseItems() {
		int nitems = 0;

		try {
			String line = br.readLine();
			if (line != null) {
				int	n1 = Integer.parseInt(line);
				nitems = n1;
			}
		}
		catch (NumberFormatException e) {}
		catch (IOException e) {}
		

		return nitems;
	}

	private static int[] parseLens() {
		int[] aParams = null;

		try {
			String line = br.readLine();
			if (line != null) {
				aParams = new int[3];

				String[]	as  = line.split(" ");
				int			n1 = Integer.parseInt(as[0]);
				int			n2 = Integer.parseInt(as[1]);
				int			n3 = Integer.parseInt(as[2]);

				aParams[0] = getTrueLen(n1);
				aParams[1] = getTrueLen(n2);
				aParams[2] = getTrueLen(n3);
			}
		}
		catch (NumberFormatException e) {}
		catch (IOException e) {}
		

		return aParams;
	}

	private static int getTrueLen(int nLen) {
		int nTrueLen = -1;

		if (1 <= nLen && nLen <= 1000) {
			nTrueLen = nLen;
		}

		return nTrueLen;
	}
}

Measured memory_bytes: 20200
import sys
input=sys.stdin.readline
K=int(input().rstrip())
S=input().rstrip()
M=len(S)
N=K+M
mod=10**9+7
ans=pow(26,N,mod)
class Data():
    def __init__(self):
        self.power=1
        self.rev=1     
class Combi():
    def __init__(self,N,mod):
        self.lists=[Data() for _ in range(N+1)]
        self.mod=mod  
        for i in range(2,N+1):
            self.lists[i].power=((self.lists[i-1].power)*i)%self.mod
        self.lists[N].rev=pow(self.lists[N].power,self.mod-2,self.mod)
        for j in range(N,0,-1):
            self.lists[j-1].rev=((self.lists[j].rev)*j)%self.mod

    def combi(self,K,R):
        if K<R:
            return 0
        else:
            return ((self.lists[K].power)*(self.lists[K-R].rev)*(self.lists[R].rev))%self.mod
        
c=Combi(2*10**6,mod)
for i in range(M):
    ans-=c.combi(N,i)*pow(25,N-i,mod)
    ans%=mod
print(ans)


Measured memory_bytes: 313136
n=int(input())
ans=0
A=[[] for _ in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    A[i].append(tuple(map(int,input().split())))
for i in range(2**n):
  ii=str(bin(i))[2:].zfill(n)
  chk=True
  cur=0
  for j in range(n):
    if ii[j]=="0":
      continue
    else:
      cur+=1
      for x,y in A[j]:
        if y==1 and ii[x-1]=="0":
          chk=False
        elif y==0 and ii[x-1]=="1":
          chk=False
  if chk:
    ans=max(ans,cur)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct BIT{
	int N;
	vector<int> dat;
	BIT() {}
	BIT(int n) {
		N = n;
		dat.resize(N + 1);
	}
	void add(int k, int x){
		k++;
		while(k <= N){
			dat[k] += x;
			k += k&-k;
		}
	}
	int sum(int k){
		int s = 0;
		while(k > 0){
			s += dat[k];
			k -= k&-k;
		}
		return s;
	}
	int query(int a, int b){
		return sum(b) - sum(a);
	}
};

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<BIT> b(3, BIT(n));
	vector<int> a(n);
	REP(i, n){
		if(s[i] == 'R') b[0].add(i, 1), a[i] = 0;
		if(s[i] == 'G') b[1].add(i, 1), a[i] = 1;
		if(s[i] == 'B') b[2].add(i, 1), a[i] = 2;
	}
	int ans = 0;
	REP(i, n){
		REP(j, i){
			if(a[i] == a[j]) continue;
			REP(k, 3){
				if(a[i] == k || a[j] == k) continue;
				ans += b[k].query(i + 1, n);
				if(2 * i - j < n && a[2 * i - j] == k) ans--;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3724
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=1e6+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
  }
   

int n;
	
void solve() {
  cin>>n;
  vi a(n,0);
  rep(i,0,n) {
	      cin>>a[i];
	  }
  int lt=a[0],sm=0;	  
  rep(i,1,n) {
	    if(a[i]<lt) {
			   sm+=abs(a[i]-lt);
			}
		else 
		   lt=a[i];	
	  }	 
	  
	  cout<<sm<<endl;   
    
                   
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 4704
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define flu(i, a, b) for (ll i = a; i < b; i++)
#define blu(i, a, b) for (ll i = a; i >= b; i--)
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define Unique(X) (X).erase(unique(all(X)), (X).end())
#define all(v) v.begin(), v.end()
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';

ll MOD = 1e9 + 7;

ll i, j, le;

int sv(int x)
{
    int n = 200000;
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));

    for (int p = 2; p * p <= n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    if (prime[x])
        return 1;
    else
        return 0;
}

int main()
{
    IOS;
    int t;
    // cin >> t;
    t=1;
    while (t--)
    {
        ll n, ans=1, f;
        cin>>n;
        vl v(n);
        ml mp;
        flu(i, 0, n)
            cin>>v[i], mp[v[i]]++;
        if (n%2==0)f=1;
        else f=0;
        ll c=0;
        if (mp[0]>1)c=1;
        flu(i, 0, n)
            if (v[i]%2!=f && mp[v[i]]>2)
            {
                c=1;break;
            }
        if (c==1)cout<<0<<endl;
        else {
            n/=2;
            f=1;
            while (n--) {
                f=(f*2)%MOD;

            }
            cout<<f<<endl;
        }
    }
    return 0;
}

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

//成績を評価するプログラム
char grade_calculation(int m, int f, int r);

char grade_calculation(int m, int f, int r)         //成績を評価する関数
    {
        if (m == -1 || f == -1 || m + f < 30) return 'F';
        else {
            if (m + f >= 80) return 'A';
            if (m + f >= 65 && m + f < 80) return 'B';
            if (m + f >= 50 && m + f < 65) return 'C';
            if (m + f >= 30 && m + f < 50){
                if (r >= 50) return 'C';
                else return 'D';
            }
        }
    }
    
int main(){
    int m, f, r;
    char grade;
    
    while(1){
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) break;
        grade = grade_calculation(m, f, r);
        cout << grade << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

l=sorted(p,reverse=True)[:x]+sorted(q,reverse=True)[:y]+r
l.sort(reverse=True)
print(sum(l[:x+y]))

Measured memory_bytes: 23328
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
ll X[200010];
std::vector<P> ps;
std::map<ll, ll> ip;

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

  rep( i, N ) {
    std::cin >> X[i];

    ps.emplace_back( X[i], i );
  }

  std::sort(all(ps));

  rep( i, N )
    ip[ps[i].second] = i;

  rep( i, N ) {
    ll mid = N/2;

    if( ip[i] >= mid )
      --mid;

    std::cout << ps[mid].first << endl;
  }

  return 0;
}

Measured memory_bytes: 20324
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}
const int MAX = (int)1e6;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
     for (int i = 2; i < MAX; i++){
         fac[i] = fac[i - 1] * i % MOD;
         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
         finv[i] = finv[i - 1] * inv[i] % MOD;
     }
 }
 // 二項係数計算
 long long COM(int n, int k){  //nCkの計算をする
     if (n < k) return 0;
     if (n < 0 || k < 0) return 0;
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
 }
 //main関数にCOMinit();を忘れない

int main(){
  COMinit();
  ll n,k;
  cin>>n>>k;
  if (n<=k){
    cout << COM(n+n-1,n) << endl;
  }else{
    ll ans(0);
    for (int i(0);i<=k;i++){
      ll tmp = COM(n,i)*COM(n-1,n-i-1);
      //cout <<n-i << " " << tmp << endl;
      ans += tmp;
      ans %= MOD;
    }
    cout << ans << endl;
  }
  return 0;
}



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

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


Measured memory_bytes: 5292
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, ga, sa, ba, gb, sb, bb;
	in >> N >> ga >> sa >> ba >> gb >> sb >> bb;

	std::vector<LL>dp1(25123456);
	LL M = N;
	dp1[0] = N;
	for (LL i = 0; i <= N; ++i)
	{
		dp1[i + ga] = std::max(dp1[i] - ga + gb, dp1[i + ga]);
		dp1[i + sa] = std::max(dp1[i] - sa + sb, dp1[i + sa]);
		dp1[i + ba] = std::max(dp1[i] - ba + bb, dp1[i + ba]);
		M = std::max(M, dp1[i]);
	}

	std::vector<LL>dp2(25123456);
	LL ans = M;
	dp2[0] = M;
	for (LL i = 0; i <= M; ++i)
	{
		dp2[i + gb] = std::max(dp2[i] - gb + ga, dp2[i + gb]);
		dp2[i + sb] = std::max(dp2[i] - sb + sa, dp2[i + sb]);
		dp2[i + bb] = std::max(dp2[i] - bb + ba, dp2[i + bb]);
		ans = std::max(ans, dp2[i]);
	}

	out << ans << std::endl;
}


Measured memory_bytes: 392832
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {
  int n,k;
  scanf("%d%d",&n,&k );
  if ((n-1)%(k-1)==0) {
    printf("%d\n",(n-1)/(k-1) );
  } else {
    printf("%d\n",(n-1)/(k-1)+1 );
  }
  return 0;
}

Measured memory_bytes: 128
function Main(input){
    input = input.split("\n");
    var q = parseInt(input[0],10);

    var dp = new Array(1001);
    for(var i = 0;i <= 1000;i++)
        dp[i] = new Array(1001);

    for(var k = 1;k <= q;k++){
        var x = "0"  + input[k * 2 - 1];
        var y = "1" + input[k * 2];
        
        for(var i = 0;i < x.length;i++)
            dp[0][i] = 0;

        for(var i = 0;i < y.length;i++)
            dp[i][0] = 0;

        for(var i = 1;i < y.length;i++){
            for(var j = 1;j < x.length;j++){
                if(y[i] != x[j])
                    dp[i][j] = Math.max(dp[i - 1][j],dp[i][j - 1]);
                else
                    dp[i][j] = Math.max(dp[i - 1][j - 1] + 1,dp[i - 1][j],dp[i][j - 1]);
            }
        }
        console.log(dp[y.length - 1][x.length - 1]);
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 29868
#include<iostream>
#include<algorithm>

using namespace std;

void GetCoordinate(int i, int a, int* x, int* y){
  *x = (a-1)/i + 1;
  *y = a%i;
  if(*y == 0) *y = i;
}

int GetDistance(int i, int a, int b){
  int xa, ya, xb, yb;
  GetCoordinate(i, a, &xa, &ya);
  GetCoordinate(i, b, &xb, &yb);
  return abs(xa - xb) + abs(ya - yb);
}

int main(){
  int i, n, a, b, c, d;
  int min, min_;
  cin >> n;
  cin >> a >> b >> c >> d;
  for(int i=1; i<n; ++i){
    min_ = GetDistance(i, a, b) + GetDistance(i, c, d);
    if(i == 1 || min > min_) min = min_;
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 1164
n,q = map(int,input().split())
s = input()
l = [ 0 for i in range(q)]
r = [ 0 for i in range(q)]
for i in range(q):
    _l,_r = map(int,input().split())
    l[i] = _l
    r[i] = _r

counter = 0
lis = [0]*len(s)
for i in range(len(s)-1):
    if s[i:i+2] == 'AC':
        counter+=1
    lis[i+1]=counter
for b,e in zip(l,r):
    print(lis[e-1]-lis[b-1])

Measured memory_bytes: 14260
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
	int K, S;
	cin >> K >> S;

	int cnt = 0;
	for (int x = 0; x <= K; ++x) {
		for (int y = 0; y <= K; ++y) {
			int z = S - x - y;
			if ((z >= 0) && (z <= K)) {
				++cnt;
			}
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, k: usize, s: String);

    let sss: Vec<char> = s.chars().collect();
    for i in 0..s.len() {
        if i == k - 1 {
            print!("{}", sss[i].to_ascii_lowercase());
        } else {
            print!("{}", sss[i]);
        }
    }
}


Measured memory_bytes: 2136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

   }else{
	   System.out.println("No");
   }

  }
}

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

int main(void){
    int k, s, cnt = 0;
    cin >> k >> s;
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k; j++) {
            if (0 <= (s - i - j) && (s - i - j) <= k) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
import scipy.misc

def comb(n, r):
    return scipy.misc.comb(n, r, exact=True)

n, a, b, *v = map(int, sys.stdin.read().split())

def main():
    v.sort()

    ma = v[n-a:n]
    yield sum(ma) / a

    lo = ma[0]
    hi = ma[-1]

    res = 0
    lo_cnt = bi_r(v, lo) - bi_l(v, lo)
    if lo == hi:
        for c in range(a, min(b, lo_cnt) + 1):
            res += comb(lo_cnt, c)
    else:
        allowed_cnt = bi_r(ma, lo)
        res = comb(lo_cnt, allowed_cnt)
    
    yield res

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct SegTree {
  int size;
  vector<ll> pos;
  SegTree(ll N) { size = 1; while(size<N) size<<=1; pos.resize(2*size,0); }
  ll operator[](const ll &x) const { return pos[x+size]; }

  void build() { per(i,size) operate(i); }
  void set(ll x, const ll v) { pos[x+size] = v; }
  void update(ll x, const ll v) { set(x,v); x+=size; while (x>>=1) operate(x); }
  ll query(ll a, ll b) {
    ll L = 0, R = 0;
    for (a+=size, b+=size; a<b; a>>=1, b>>=1) {
      if (a&1) { L = q(L,pos[a]); a++; }
      if (b&1) { b--; R = q(R,pos[b]); }
    }
    return q(L,R);
  }
  void operate(ll i) { pos[i] = pos[i*2] + pos[i*2+1]; }
  ll q(ll x, ll y) { return x + y; }
};

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct card { int i; int v; };

int main() {
  int N; cin >> N;
  int A[N]; rep(i,N) cin >> A[i];
  int B[N]; rep(i,N) cin >> B[i];

  int result = INF;
  rep(itr,1<<N) {
    vector<card> o,e;
    rep(i,N) {
      if (itr&(1<<i)) {
        if (i%2==0) o.push_back({i,B[i]});
        else e.push_back({i,B[i]});
      }
      else {
        if (i%2==0) e.push_back({i,A[i]});
        else o.push_back({i,A[i]});
      }
    }
    if (e.size()!=(N+1)/2) continue;
    sort(all(e),[](const card &x, const card &y){return x.v<y.v||(x.v==y.v&&x.i<y.i);});
    sort(all(o),[](const card &x, const card &y){return x.v<y.v||(x.v==y.v&&x.i<y.i);});
    bool ok = true;
    rep(i,N/2) if (e[i].v>o[i].v) ok = false;
    rep(i,(N-1)/2) if (o[i].v>e[i+1].v) ok = false;
    if (!ok) continue;

    int pos[N]; rep(i,N) pos[i] = i%2 ? o[i/2].i : e[i/2].i;
    // debug(pos,pos+N);
    SegTree tree(N);
    int rtmp = 0;
    rep(i,N) {
      rtmp += tree.query(pos[i],N);
      tree.update(pos[i],1);
    }
    result = min(result, rtmp);
  }
  if (result==INF) result = -1;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
	int h,w;
	int n;
	vector<int> input;
	vector<int> output;
		
	cin>>h;
	cin>>w;
	cin>>n;
	
	int temp=n;


	while(temp--) {
		int x;
		cin >> x;
		input.push_back(x);
	}
	bool first=false;
	bool tmp=false;
	bool back=tmp;
	int r=0,c=0;
	
	
	for(int i=0;i<n;i++){
		for(int j=0;j<input[i];j++){
			output.push_back(i+1);
			c++;
		}
	}
	

	for(int i=0;i<h;i++){
		if(i%2==0){
			for(int j=0;j<w;j++){
				cout<<output[i*w+j]<<" ";		
			}
		}
		else{
			for(int j=0;j<w;j++){
				cout<<output[i*w+w-j-1]<<" ";		
			}
		}
		cout << endl;
	}

	return 0;

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
string s;
int main(){FAST;
cin>>s;
for(int i=0;i<s.length();++i)cout<<'x';
return 0;
} 

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

#define sz(x) int(x.size())
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef long long ll;

const int maxn = 2e3 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int n;
bitset<maxn * maxn> f[2];
int a[maxn];

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);  freopen(Task".out", "w", stdout);
  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; ++i){
    cin >> a[i];
    sum = sum + a[i];
  }
  if (n == 1) return cout << a[1], 0;
  f[0].set(0, 1);
  for (int i = 1; i <= n; ++i){
    int st = i % 2;
    f[st] = (f[st ^ 1] | (f[st ^ 1] << a[i]) );
  }

  for (int i = sum / 2 + (sum % 2); ; ++i){
    if ( (f[n % 2] >> i).test(0)) return cout << i, 0;
  }
}




Measured memory_bytes: 2688
score = []
while True:
    (m,f,r)=map(int, input().split())
    if (m,f,r)==(-1,-1,-1):
        break
    score.append([m, f, r])
    
for i in range(len(score)):
    m=score[i][0]
    f=score[i][1]
    r=score[i][2]
    if m==-1 or f==-1:
        grade = "F"
    elif (m+f)>=80:
        grade = "A"
    elif (m+f)>=65:
        grade = "B"
    elif (m+f)>=50:
        grade = "C"
    elif (m+f)>=30:
        if r>= 50:
            grade = "C"
        else:
            grade = "D"
    else:
        grade = "F"
    print(grade)



Measured memory_bytes: 5596
from collections import deque


def calc(nums):
    ret = 0
    for a, b, c, d in req:
        if nums[b - 1] - nums[a - 1] == c:
            ret += d

    return ret


n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]

ans = 0

que = deque()

# [1]～[m]までキューに追加します。実は[1]だけでもいいです。考えてみてください。
for i in range(1, m + 1):
    que.append([i])

while que:
    seq = que.pop()

    if len(seq) == n:
        score = calc(seq)
        ans = max(ans, score)
    else:
        for i in range(seq[-1], m + 1):
            seq_next = seq + [i]
            que.append(seq_next)

print(ans)


Measured memory_bytes: 9420
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

bool sosuu(int x){
	bool b = 1;
	if(x == 1) b = 0;
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) {
			b = 0;
			break;
		}
	}
	return b;
}

Int n, x[100002], y[100002], t[100002];

int main(){
	cin >> n;
	t[0] = 0; x[0] = 0; y[0] = 0;
	bool b = 1;
	for(int i = 1; i <= n; i++){
		cin >> t[i] >> x[i] >> y[i];
		if(abs(t[i] - t[i-1]) >= abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])){
			if((abs(t[i] - t[i-1]) - abs(x[i]-x[i-1]) - abs(y[i]-y[i-1])) % 2 == 0){
				continue;
			}
		}
		b = 0;
	}
	
	if(b)
		cout << "Yes" << endl;
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define int long long 
long long x[100010],y[100010],z[100010];
signed main(){

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

  long long a,b,c,cnt=0,ans=0,n,ccnt=0,wa=0;
  string s,v;
  char k[100010];

  cin>>a>>b>>c;
  cout<<(a-b+1)*(a-c+1)<<'\n';
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;

namespace JKTX_AOJ2015
{
    public class Data
    {
        public int A { get; set; }
        public int B { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var dataList = new List<Data>();

            while (true)
            {
                string[] str = Console.ReadLine().Split(' ');
                Data data = new Data();
                data.A = int.Parse(str[0]);
                data.B = int.Parse(str[1]);

                if (data.A == 0 && data.B == 0)
                {
                    break;
                }

                dataList.Add(data);
            }

            foreach (var item in dataList)
            {
                for (int i = 0; i < item.A; i++)
                {
                    for (int j = 0; j < item.B; j++)
                    {
                        Console.Write("#");
                    }
                    Console.Write("\n");
                }
                Console.Write("\n");
            }
        }
    }
}

Measured memory_bytes: 5392
#include <bits/stdc++.h>
using namespace std;
int n,m;
const int maxn = 1e5+5;
int a[maxn];
int main(){
	cin >> n >> m;
	for (int i=1;i<=m;i++){
		cin >> a[i];
		n -= a[i];
	}
	cout << max(n,-1);
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const int INF = 1001001001;
const int MAXV = 1000010;

int main() {
  int x, n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> nums(MAXV);
  for (int x : a) {
    if (nums[x] >= 1) {
      nums[x] = 2;
      continue;
    }
    for(int j = x; j < MAXV; j += x) {
      nums[j]++;
    }
  }

  int ans = 0;
  rep(i, n) {
    if (nums[a[i]] == 1) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7888
k = int(input())

def func(a):
    s = 0
    for i in str(a):
        s += int(i)
    return a/s

candidate_lst = []
for i in range(18):
    for j in range(1, 150):
         candidate_lst.append(int(str(j) + '9' * i))
candidate_lst = sorted(list(set(candidate_lst)))

count = 0
index = -1
snuke = 1
while count < k:
    min_snuke = 10**100
    for m, i in enumerate(candidate_lst[index+1:]):
        if i > 100*snuke:
            break
        po_snuke = func(i)
        if min_snuke > po_snuke:
            min_snuke = po_snuke
            next_snuke = i
            next_index = m
    print(next_snuke)
    snuke = next_snuke
    index = index + next_index + 1
    count += 1          

Measured memory_bytes: 3312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

double dp[310][310][310];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int a=0,b=0,c=0;
	rep(i,n){
		int x;
		cin>>x;
		if(x==1) a++;
		else if(x==2) b++;
		else c++;
	}
	rep(i,310)rep(j,310)rep(k,310) dp[i][j][k]=-1;
	dp[0][0][0]=0;
	function<double(int,int,int)> dfs=[&](int i,int j,int k){
		if(dp[i][j][k]!=-1) return dp[i][j][k];
		double ret=n;
		if(i-1>=0) ret+=i*dfs(i-1,j,k);
		if(j-1>=0) ret+=j*dfs(i+1,j-1,k);
		if(k-1>=0) ret+=k*dfs(i,j+1,k-1);
		ret/=(double)(i+j+k);
		return dp[i][j][k]=ret;
	};
	cout<<setprecision(10)<<dfs(a,b,c)<<endl;
}

Measured memory_bytes: 233088
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	listS := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&listS[i])
	}
	var m int
	fmt.Scan(&m)
	listT := make([]string, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&listT[i])
	}

	countMap := map[string]int{}
	for i := 0; i < n; i++ {
		countMap[listS[i]]++
	}
	for i := 0; i < m; i++ {
		countMap[listT[i]]--
	}
	max := 0
	for _, v := range countMap {
		if max < v {
			max = v
		}
	}
	if max >= 0 {
		fmt.Println(max)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
 
using namespace std;

int main() {
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    vector<int> v[n];
    for (int i = 0; i < m; i++) {
        int l, r;
        scanf("%d %d", &l, &r);
        --l, --r;
        v[r].pb(l);
    }
    for (int i = 0; i < n; i++) sort(v[i].begin(), v[i].end());
    while (q--) {
        int l, r;
        scanf("%d %d", &l, &r);
        --l, --r;
        int ans = 0;
        for (int i = l; i <= r; i++) {
            int e1 = lower_bound(v[i].begin(), v[i].end(), l) - v[i].begin();
            ans += (v[i].size() - e1);
        }
        printf("%d\n", ans);
    }
   	return 0;
}  

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 300002;
int n,a[N];
ll l[N],r[N];

int main(){
    readi(n);
    lp(i,1,3*n) readi(a[i]);

    ll sum = 0;
    multiset<int> curr;
    lp(i,1,3*n){
        curr.insert(a[i]);
        sum += a[i];
        if(sz(curr) > n) sum -= *curr.begin(), curr.erase(curr.begin());
        if(sz(curr) == n) l[i] = sum;
    }

    sum = 0;
    curr.clear();
    lpd(i,3*n,1){
        curr.insert(a[i]);
        sum += a[i];
        if(sz(curr) > n) sum -= *curr.rbegin(), curr.erase(--curr.end());
        if(sz(curr) == n) r[i] = sum;
    }

    ll ans = -infll;
    lp(i,n,2*n) ans = max(ans, l[i] - r[i+1]);
    cout <<ans;
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 10368
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<pair<long double, long double>> xy(n);
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> xy[i].first >> xy[i].second;
  }
  long double div = 1;
  for (i = 1; i <= n; i++) {
    div *= i;
  }
  long double sigma = n * (n - 1) / 2;
  long double sum = 0;
  // for (int test = 0; test < div; test++) {
  // }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i != j) {
        sum += sqrt(pow(xy[i].first - xy[j].first, 2) + pow(xy[i].second - xy[j].second, 2)) * div / sigma * (n - 1) / 2;//* (n - 1);
        // cout << sqrt(pow(xy[i].first - xy[j].first, 2) + pow(xy[i].second - xy[j].second, 2)) * sigma << endl; //* (n - 1) << endl;
      }
    }
  }
  // cout << div << endl;
  // cout << test << ' ';
  // cout << div << ' ' << sigma  << endl;
  cout << setprecision(20) << sum / div << endl;
  return 0;
}


Measured memory_bytes: 256