akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mod 998244353
#define maxn 401000
using namespace std;
int fac[maxn],inv[maxn],n,m,pw[maxn],pw2[maxn],f[maxn],g[maxn],s[maxn],t[maxn];
char A[maxn],B[maxn],C[maxn],D[maxn];
int qpow(int a,int b){
	int ans=1,tmp=a;
	for(;b;b>>=1,tmp=1ll*tmp*tmp%mod)
		if(b&1)ans=1ll*ans*tmp%mod;
	return ans;
}
int gC(int x,int y){
	if(x>y||x<0)return 0;
	return 1ll*fac[y]*inv[x]%mod*inv[y-x]%mod;
}
int sol(int n,int m,char A[],char B[],char C[],char D[]){
	for(int i=1;i<=m;++i)s[i]=(C[i]=='1'&&D[i]=='1')+s[i-1];
	for(int i=1;i<=m;++i)t[i]=(C[i]=='1')+t[i-1]+(D[i]=='1');
	int x=0,y=0,ans=0;
	for(int i=1;i<=n;++i)x+=(A[i]=='1'),y+=(B[i]=='1');
	memset(f,0,sizeof(f)),memset(g,0,sizeof(g));
	for(int i=0;i<=m;++i){
		f[i]=gC(x,t[i]+x);
		if(t[i])f[i]-=gC(x,t[i]+x-1);
		f[i]=1ll*f[i]*pw[s[i]]%mod;
		if(C[i+1]=='0'&&D[i+1]=='0')f[i]=0;
	}
	for(int i=1;i<=m+1;++i){
		g[i]=gC(y,t[m]-t[i-1]+y);
		if(g[i])g[i]-=gC(y,t[m]-t[i-1]+y-1);
		g[i]=1ll*g[i]*pw2[s[i-1]]%mod;
		if(C[i-1]=='0'&&D[i-1]=='0')g[i]=0;
	}
	for(int i=1;i<=m;++i)f[i]=(f[i-1]+f[i])%mod;
	for(int i=1;i<=m;++i)ans=(ans+1ll*f[i-1]*g[i+1])%mod;
	return (ans%mod+mod)%mod;
}
int main(){
	scanf("%d%d",&n,&m);
	fac[0]=inv[0]=1;
	for(int i=1;i<=2*(n+m);++i)fac[i]=1ll*fac[i-1]*i%mod;
	inv[2*(n+m)]=qpow(fac[2*(n+m)],mod-2);
	for(int i=2*(n+m)-1;i>=1;--i)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	pw[0]=pw2[0]=1;
	for(int i=1;i<=max(n,m);++i)pw[i]=1ll*pw[i-1]*(mod+1)/2%mod,pw2[i]=1ll*pw2[i-1]*2%mod;
	scanf("%s%s%s%s",A+1,B+1,C+1,D+1);
	for(int i=1;i<=max(n,m);++i)if(A[i]=='1'||B[i]=='1'||C[i]=='1'||D[i]=='1')goto nxt;
	puts("1");
	return 0;
	nxt:;
	printf("%d",(sol(n,m,A,B,C,D)+sol(m,n,C,D,A,B))%mod);
}

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

int main() {
	vector<int> seg = {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111,0b0000000};
	while(1){
		int n;
		cin >> n;
		if(n==-1) break;
		int d0=10, d1;
		for(int i=0; i<n; i++){
			cin >> d1;
			cout << bitset<7>(seg[d0]^seg[d1]) << endl;
			d0=d1;
		}
	}

}



Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007

ll dp[10005][101][2];
string s;
ll d;

ll solve(int pos, int sum, int tight){
    if(pos==s.length()) return sum==0;

    if(dp[pos][sum][tight] != -1) return dp[pos][sum][tight];

    ll ans=0;
    int end=(tight?(s[pos]-'0'):9);
    for(int i=0; i<=end; i++){
        ans = (ans + solve(pos+1, (sum+i)%d, tight&(i==end)))%mod;
    }

    return dp[pos][sum][tight]=ans;
}

int main(){
    cin>>s;
    cin>>d;
    memset(dp, -1, sizeof(dp));
    cout<<(solve(0, 0, 1)-1+mod)%mod<<endl;
    return 0;
}

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

int main(){
    
    string s;
    cin >> s;
    int count0=0, count1=0;

    for(int i=0; i<s.size(); i++){
        if(s.at(i)=='0') count0++;
        if(s.at(i)=='1') count1++;
    }
    cout << 2*min(count0,count1) << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n;cin>>n;
  multiset<ll> a;
  rep(i, n){
    ll t; cin>>t;
    a.insert(t);
  }

  int result=0;
  while(a.size()){
    auto cit = a.end();
    cit--;
    ll c = *cit;
    a.erase(cit);
    rrep1(i, 31){
      ll t = pow(2LL, i)-c;
      if(t<=0)break;
      if(t>c)continue;

      auto it = a.find(t);
      if(it==a.end())continue;

      result++;
      a.erase(it);
      break;
    }
  }
  
  cout<<result<<endl;

  return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<cstdlib>
#include<ctime>*/
#include<utility>
/*#include<functional>
#include<cmath>*/
#include<vector>
#define pii pair<int,int>
#define ll long long
#define lowbit(x) x&-x
using namespace std;
/*using std::min;
using std::max;
using std::swap;
using std::sort;
using std::reverse;
using std::random_shuffle;*/
using std::lower_bound;
using std::upper_bound;
using std::unique;
using std::vector;
const int N=100000+7;
const ll mod=1000000000+7;
int n,m,rb[N],ho[N];
ll c[N];
pair<int,int> p[N];
int tmp[N],t1,t2;
void read(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		scanf("%d",&rb[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&ho[i]);
}
bool rule(pii a,pii b){
	if(a.first!=b.first)return a.first<b.first;
	else return a.second>b.second;
}
ll add(ll a,ll b){
	a+=b;
	return a>=mod?a-mod:a;
}	
void add(int x,ll v){
	for(int i=x;i<=t2;i+=i&-i)
		c[i]=add(c[i],v);
}
ll query(int x){
	ll sum=0;
	for(int i=x;i;i-=i&-i)
		sum=add(sum,c[i]);
	return sum;
}
void init(){
	int lst,nxt=ho[1],top=1;
	for(int i=1;i<=n;i++){
		if(rb[i]>ho[1]&&rb[i]<ho[m]){
			while(rb[i]>nxt){
				lst=nxt;
				nxt=ho[++top];
			}
			if(rb[i]==lst||rb[i]==nxt)continue;
			int ld=rb[i]-lst,rd=nxt-rb[i];
			p[++t1]=make_pair(ld,rd);
			tmp[++t2]=rd;
		}
	}
	
	/*for(int i=1;i<=t1;i++)
		printf("%d %d\n",p[i].first,p[i].second);
	printf("\n");*/
		
	sort(tmp+1,tmp+1+t2);
	t2=unique(tmp+1,tmp+1+t2)-(tmp+1);
	for(int i=1;i<=t1;i++)
		p[i].second=lower_bound(tmp+1,tmp+1+t2,p[i].second)-tmp;
	sort(p+1,p+1+t1,rule);
	t1=unique(p+1,p+1+t1)-(p+1);
	
	/*for(int i=1;i<=t1;i++)
		printf("%d %d\n",p[i].first,p[i].second);*/
		
}
void work(){
	ll ans=1;
	for(int i=1;i<=t1;i++){
		ll s=query(p[i].second-1)+1;
		ans=(ans+s)%mod;
		add(p[i].second,s);
	}
	printf("%lld\n",ans);
}
int main(){
	//freopen("1.txt","r",stdin);
	read();
	init();
	work();
	return 0;
}
/*
4 1
1 2 4 5
3

*/
/*
4 5
2 5 7 11
1 3 6 9 13

*/
/*
3 4
2 5 10
1 3 7 13

*/

Measured memory_bytes: 2560
_, _, m = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
cost = a.min + b.min
m.times do |_|
  x, y, c = gets.chomp.split.map(&:to_i)
  v = a[x - 1] + b[y - 1] - c
  cost = v if v < cost
end
puts cost

Measured memory_bytes: 19996
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int h,w,n;
	cin>>h>>w>>n;
	if(h>=w){
		int cnt=0,sum=0;
		while(sum<n){
			sum+=h;
			cnt++;
		}
		cout<<cnt<<endl;
	}else{
		int cnt=0,sum=0;
		while(sum<n){
			sum+=w;
			cnt++;
		}
		cout<<cnt<<endl;		
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
A=[int(i) for i in input().split()]
mod=10**9+7

ans=0
cnt=[0 for i in range(61)]

for i in range(n):
    now=A[i]
    bek=1
    for q in range(61):
        if now&1==0:
            ans+=cnt[q]*bek
        else:
            ans+=(i-cnt[q])*bek
        bek=bek*2%mod
        cnt[q]+=now&1
        now>>=1
    ans=ans%mod
    #print(ans)
print(ans)

Measured memory_bytes: 124628
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    int n,ans=0;
    cin>>n;
    vll v(n),c(n);
    rep(i,n)cin>>v.at(i);
    rep(i,n)cin>>c.at(i);
    
    rep(i,n){
        if(v.at(i)>c.at(i))ans+=v.at(i)-c.at(i);
    }
    cout<<ans<<endl;
}
   



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

int main() {
  int n, a;
  cin >> n >> a;
  n %= 500;
  if(n <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
    
  
  return 0;
}


Measured memory_bytes: 256
import sys

import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
from operator import attrgetter, itemgetter

# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    k = int(input())
    l = len(s)

    strs = set()

    for i in range(l):
        for j in range(k):
            if (i + j) < l:
                strs.add(s[i:i + j + 1])

    strl = list(strs)
    strl.sort()

    print(strl[k - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 40304
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if(a > 8 || b > 8) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 256
# -*-coding:utf-8-*-
x1, y1, x2, y2 = map(int, input().split(" "))

xdiff = x2-x1
ydiff = y2-y1

x3 = x2 - ydiff
y3 = y2 + xdiff
x4 = x3 - xdiff
y4 = y3 - ydiff

ans = str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4) 
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

int32_t main() 
{
    fastio
    ll n, k;
    cin>>n>>k;
    vector<ll> vec(n);
    for(auto& it : vec) cin>>it;
    sort(all(vec));
    
    ll product = 1;
    if(vec[n-1]==0 && (k%2)) {
        cout<<0<<endl;
        return 0;
    }

    ll prd = 1;
    if(vec[n-1]<=0 && (k%2)) {
        for(int i = n-1; i>=n-k; --i) {
            prd = ((((prd%mod) * (vec[i]%mod))%mod))%mod;
        }
        cout<<(prd+mod)%mod<<endl;
        return 0;
    }

    int i = 0;
    int j = n-1;
    if(k%2) {
        product = ((((product%mod) * (vec[j]%mod))%mod))%mod;
        j--;
        k--;
    }

    k/=2;
    for(int itr = 0; itr<k; ++itr) {
        ll l = vec[i]*vec[i+1];
        ll r = vec[j]*vec[j-1]; 
        if(l>r) {
             product = ((((product%mod) * (l%mod))%mod))%mod;
             i+=2;
        }
        else {
             product = ((((product%mod) * (r%mod))%mod))%mod;
             j-=2;
        }
    }

    cout<<(product+mod)%mod<<endl;
}

Measured memory_bytes: 4784
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, m, x = rm()
a = rl()
li = [0] * (n+1)
for i in a:
    li[i] += 1
print(min(sum(li[:x]), sum(li[x:])))









Measured memory_bytes: 27108
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int[] h = new int[3];

		h[0] = a;
		h[1] = b;
		h[2] = c;

		Arrays.sort(h);

		System.out.println(h[0] + h[1]);
	}
}


Measured memory_bytes: 23764
from collections import defaultdict, Counter
from bisect import bisect_right, bisect_left

N, K = map(int, input().split())
*A, = map(int, input().split())

c = Counter(A)
target = []
d = defaultdict(list)

dd = defaultdict(list)
for i, j in enumerate(A):
    dd[j].append(i)

pos = 0
loop = 1
l = []

while pos < N:
    num = A[pos]
    
    pp = bisect_right(dd[num], pos)
    if pp < len(dd[num]):
        pos = dd[num][pp]+1
    else:
        pos = dd[num][0]+1            
        loop += 1
    l.append((num, pos, loop))

for v, pos, p in l:
    if (K-p)%loop==0:
        break

pos = pos if pos<N else 0
ans = []
while pos < N:
    num = A[pos]
    pp = bisect_right(dd[num], pos)
    if pp < len(dd[num]):
        pos = dd[num][pp]+1
    else:
        ans.append(num)
        pos += 1
print(*ans)


Measured memory_bytes: 171456
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 500000
set<int> s[26];
signed main(){
	int n;
	cin>>n;
	for(int i=0;i<26;i++) s[i].insert(n);
	string str;
	cin >> str;
	for(int i=0;i<str.size();i++) s[str[i]-'a'].insert(i);
	int m;
	cin >> m;
	for(int i=0;i<m;i++) {
		int op;
		cin>>op;
		if(op == 1) {
			int pos;
			char ch;
			cin >> pos >> ch;
			pos--;
			if(ch == str[pos]) continue;
			s[str[pos] - 'a'].erase(pos);
			str[pos]=ch;
			s[ch - 'a'].insert(pos);
		} else {
			int l, r;
			cin >> l>> r;
			int ans=0;
			l--;
			r--;
			for(int j=0;j<26;j++){
				int pos=*s[j].lower_bound(l);
				if(pos <= r) ans++;
			} 
			cout<<ans<<'\n';
		}
	}
	return 0;
}

Measured memory_bytes: 26244
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
    string s;
    cin >> s;
    int cnt = 0, prev = 0, ans = 0;
    for (char c : s) {
        if (c == 'R') {
            ++cnt;
        } else {
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000000
void chmax(ll &x,ll y){x = x>y ? x:y;}
void chmin(ll &x,ll y){x = x<y ? x:y;}
ll dp[110][100100];
ll w[110],v[110];

int main()
{
  ll N,W;cin>>N>>W;
  for(ll i=0;i<N;i++)cin>>w[i]>>v[i];
  for(ll i=0;i<101;i++)for(ll j=0;j<10001;j++)dp[i][j]=-INF;
  for(ll sum_w=0;sum_w<=W;sum_w++)dp[0][sum_w]=0;
  for(ll i=0;i<N;i++){
    for(ll sum_w=0;sum_w<=W;sum_w++){
      if(sum_w-w[i]>=0)chmax(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);//選ぶ
      chmax(dp[i+1][sum_w],dp[i][sum_w]);//選ばない
    }
  }
  cout<<dp[N][W]<<endl;
  return 0;
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

ll n,ans=0;

void bfs(ll x){
  if(x>n){
    return;
  }
  vl a(10,0);
  ll t=x;
  while(t!=0){
    a[t%10]++;
    t /=10;
  }
  if(a[3]*a[5]*a[7]!=0){
    ans++;
  }
  bfs(10*x+3);
  bfs(10*x+5);
  bfs(10*x+7);
}

int main() {
  cin >> n;
  bfs(0);
  cout << ans << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
x = [list(map(int,input().split())) for _ in range(N)]

for i in range(N):
  x[i].pop(0)

t = set(x[0])
for i in range(1,N):
  t &=set(x[i])
print(len(list(t)))

Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int main(void) {
  int a = 0,n,m,i,j,Rm;
  scanf(" %d",&n);
  for(i = 0; i < n; i++){
    scanf(" %d",&m);
    Rm = pow(m,0.5);
    //printf("i = %2d,Rm = %d\n",i,Rm);
    for(j = 2; j < Rm + 1; j++){
      if(m % j == 0)break;
    }
    if(j == Rm + 1)a++;
  }
  printf("%d\n",a);
}


Measured memory_bytes: 2100
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;
LL cnt;
LL MOD = 1000000007;
int a[100];

void bktk(int at, int n) {
	if (at == 0) {
//		for (int i = 1; i <= n; i++) printf("%d ", a[i]);
//		printf("\n");
		cnt = (cnt + 1) % MOD;
		return;
	}
	for (int i = 1; i <= n; i++) {
		a[at] = i;
		int flag = 1;
		for (int j = 2; j <= a[at] && j + at <= n; j++) {
			if (a[at + 1] != a[at + j])
				flag = 0;
		}
		if (!flag) return;
		bktk(at - 1, n);
	}
}

LL solve(int n) {
	cnt = 0;
	bktk(n, n);
	return cnt;
}

LL dp[1000006];
LL sdp[1000006];

void solve2(int n) {
	for (int i = n; i >= 1; i--) {
		if (i == n) {
			sdp[i] = n;
			dp[i] = n;
			continue;
		}

		dp[i] = dp[i + 1];
		if (i + 3 <= n) dp[i] += sdp[i + 3];
		dp[i] += (n - 1) * (n - 1LL);

		int fak = n - i - 1;
		int base = MAX(fak + 1, 2);
		base = MIN(base, n);
		dp[i] += MAX(n - base + 1, 0);

		dp[i] %= MOD;

		sdp[i] = (dp[i] + sdp[i + 1]) % MOD;
	}
}

int main()
{
/*	for (int i = 1; i <= 10; i++) {
		printf("---------%d: %lld\n", i, solve(i));
	}*/
	int n;
	scanf("%d", &n);
	solve2(n);
//	for (int n = 1; n <= 10; n++) {
//		solve2(n);
		printf("%lld\n", dp[1]);
//	}

	return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7, N = 1e5 + 5;

set<int> S;
map<int, int> cnt;

int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int p;
    string s;
    cin >> p >> s;
    if (s == "AC") S.insert(p);
    if (!S.count(p)) cnt[p]++;
  }
  for (auto it : cnt) {
    if (!S.count(it.first)) continue;
    ans += it.second;
  }
  cout << S.size() << " " << ans << "\n";
}

Measured memory_bytes: 4992
import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


a = I()
ans = ''

for _ in range(a):
    ans += 'ACL'

print(ans)

Measured memory_bytes: 9140
#include <algorithm>
#include <iostream>
#include <cstdio>

using namespace std;

const int Maxn = 2010;
const int Inf = 0x7fffffff;

int n , k , q , ans = Inf;
int a[Maxn];
int tmp[Maxn] , Q[Maxn];

int main() {
	
	scanf("%d%d%d",&n,&k,&q);
	for(register int i=1; i<=n; i++)
		scanf("%d",&a[i]);
	
	for(register int i=1; i<=n; i++) {
		Q[0] = 0;
		for(register int j=1; j<=n+1; j++) {
			if(a[j] < a[i]) {
				sort(tmp+1,tmp+tmp[0]+1);
				for(register int x=1; x<=tmp[0]-k+1; x++)
					Q[++Q[0]] = tmp[x];
				tmp[0] = 0;
			}
			else	tmp[++tmp[0]] = a[j];
		}
		sort(tmp+1,tmp+tmp[0]+1);
		for(register int x=1; x<=tmp[0]-k+1; x++)
			Q[++Q[0]] = tmp[x];
		tmp[0] = 0;
		if(Q[0] < q)	continue;
		sort(Q+1,Q+Q[0]+1);
		ans = min(ans,Q[q]-a[i]);
	}
	
	printf("%d\n",ans);
	
	return 0;
	
}

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

string s;

int dp[10009][100][2],p,d;


int dfs(int idx,int z,bool tight){
  if(idx==s.size())return !z;
  int &res=dp[idx][z][tight];
  if(~res)return res;
  res=0;
  int x=s[idx]-'0';
  int r=(tight?9:x);
  for(int i=0;i<=r;i++){
    res+=dfs(idx+1,(z+i)%d,tight||i<r);
    res%=1000000007;
  }
  return res;
}

int main(){
  memset(dp,-1,sizeof(dp));
  cin>>s>>d;
  cout<<(dfs(0,0,0)-1+1000000007)%1000000007<<endl;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

int N,M;
vector<int> vec[100], p;

void compute() {

}

bool check(int state) {
  rep(i,M) {
    int cnt = 0;
    rep(j,(int)vec[i].size()) if( (state>>vec[i][j]) & 1 ) ++cnt;
    if( cnt % 2 != p[i] ) return false;
  }
  return true;
}

int main() {
  cin >> N >> M;
  rep(i,M) {
    int k;
    cin >> k;
    vec[i].resize(k);
    rep(j,k) {
      cin >> vec[i][j];
      --vec[i][j];
    }
  }
  p.resize(M);
  rep(i,M) cin >> p[i];
  int ans = 0;
  rep(i,(1<<N)) {
    if( check(i) ) ++ans;
  }
  cout << ans << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
//AnkitCode99 here....
//every ups and downs matter!

#include<bits/stdc++.h>
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back

using namespace std;

const ll sz=1e5+5;
const ll szz=1e6+6;
const ll mod=1e9+7;

int main()
{
    IOS;

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("op.txt","w",stdout);
    #endif

    clock_t startTime=clock();

    ll n;
    cin>>n;

    rep(i,0,n)
    {
        cout<<"ACL";
    }

    cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;

}//Goodbye...

Measured memory_bytes: 3644
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]

ans=0
for i in range(N-1,-1,-1):
    a,b=A[i]
    a+=ans
    #print(a,-(-a//b)*A[i][1],-(-a//b)*A[i][1]-a)
    ans+=-(-a//b)*A[i][1]-a
print(ans)

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  int ans = 0;
  rep(i, s.size()) if (s[i] == t[i]) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 764
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

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

void solve() {
	int K, N;
	cin >> K >> N;
	vector<int>A(N);
	REP(i, N)cin >> A[i];
	int mx = 0;
	REP(i, N - 1) {
		mx = max(mx, A[i + 1] - A[i]);
	}
	mx = max(mx,A[0] + K - A[N - 1]);
	print(K - mx);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



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

int main(){
  int n;
  cin >> n;
  int ans =0;
  for(int i=1; i<=n; ++i){
    int x;
    cin >> x;
    if(x != i) ++ans;
  }
  if(ans <=2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import collections
N = int(input())
S = []
for i in range(N):
    s = input()
    s = sorted(s)
    s = "".join(s)
    S.append(s)

S_c = collections.Counter(S)
S_cl = list(S_c.values())

ans = 0
for c in S_cl:
    ans += c*(c-1)//2

print(ans)

Measured memory_bytes: 19764
n = input()
m = str(int(n[0]) + 1)

if int(n[0]) > int(n[1]):
    print(n[0] + n[0] + n[0])
elif int(n[0]) < int(n[1]):
    print(m + m + m)
else:
    if int(n[1]) >= int(n[2]):
        print(n[0] + n[0] + n[0])
    else:
        print(m + m + m)

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
	int a[4][3][10]={0};
	int i, j, k;
	int n, b, f, r, v;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d %d %d %d", &b, &f, &r, &v);
		a[b-1][f-1][r-1]+=v;
	}
	for(i=0; i<4; i++){
		for(j=0; j<3; j++){
			for(k=0; k<10; k++){
				printf(" %d", a[i][j][k]);
			}
			printf("\n");
		}
		if(i!=3){
		printf("####################\n");
		}
	}
	return 0;
}

Measured memory_bytes: 612
import statistics
n=int(input())
a=list(map(int,input().split()))
aa=[]
for i in range(n):
    t=a[i]-i-1
    aa.append(t)
aa.sort()
b=statistics.median_high(aa)
ans=0
for i in range(n):
    ans+=abs(aa[i]-b)
print(ans)

Measured memory_bytes: 33992
import sys
# import pdb
input = sys.stdin.readline

N = int(input())
hs = list(map(int, input().split()))

cost1 = 0
cost2 = abs(hs[1] - hs[0])

if N == 2:
  print(cost2)
  exit()
# pdb.set_trace()
for i in range(2, N):
  cost3 = min(cost2 + abs(hs[i] - hs[i-1]), cost1 + abs(hs[i] - hs[i-2]))
  cost1 = cost2
  cost2 = cost3

print(cost3)


Measured memory_bytes: 50288
n = int(input())
G = [[] for _ in range(n)]
mod = 10**9 + 7

for _ in range(n-1):
    a, b = map(lambda x: int(x)-1, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

stack = [0]
depth = [-1] * n
depth[0] = 0
while stack:
    v = stack.pop()
    d = depth[v]
    for nv in G[v]:
        if depth[nv] >= 0:continue
        depth[nv] = depth[v] + 1
        stack.append(nv)

d_to_i = [[] for _ in range(n)]

for i in range(n):
    d_to_i[depth[i]].append(i)

data = [[] for _ in range(n)]

for d in range(n-1, -1, -1):
    for v in d_to_i[d]:
        for nv in G[v]:
            if depth[nv] < depth[v]:
                continue
            if data[nv]:
                data[v].append(n-data[nv][-1])
        if data[v]:
            data[v].append(n - 1- sum(data[v]))
        else:
            data[v].append(n - 1)

ans = 0
two = [1]
for i in range(n):
    two.append(two[-1] * 2 % mod)
for i in range(n):
    now = two[n-1]-1
    for x in data[i]:
        now -= two[x]-1
        now %= mod
    ans += now


ans *= pow(two[n], mod-2, mod)
ans %= mod
print(ans)


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

typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;

int main(){
    int h, w, k;    cin >> h >> w >> k;
    vector<vector<char>> g(h, vector<char>(w));
    vector<vector<int>> field(h, vector<int>(w, -1));

    int cnt=1;
    for(int i=0; i<h; i++)
        for(int j=0; j<w; j++){
            cin >> g.at(i).at(j);
            if(g[i][j]=='#') field[i][j]=cnt++;
        }
    for(int i=0; i<h; i++){
        for(int j=0; j<w-1; j++)
            if(field[i][j] && field[i][j+1]<0) field[i][j+1] = field[i][j];
        for(int j=w-1; 0<j; j--)
            if(field[i][j] && field[i][j-1]<0) field[i][j-1] = field[i][j];
    }
    for(int j=0; j<w; j++){
        for(int i=0; i<h-1; i++)
            if(field[i][j] && field[i+1][j]<0) field[i+1][j]=field[i][j];
        for(int i=h-1; 0<i; i--)
            if(field[i][j] && field[i-1][j]<0) field[i-1][j] = field[i][j];
    }
    
    
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++)  cout << field[i][j] << ' ';
        cout << endl;
    }

}

Measured memory_bytes: 4080
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)

//変数
ll N,K;

ll i1 = 0;

//解法
void solve() {

	ll ans = 1+ (N - K) / (K - 1);
	if ((N - K) % (K - 1) != 0) {
		ans++;
	}

	cout << ans;

	return;
}

int main() {
	//入力
	cin >> N >> K;
	solve();
	cout << endl;
	return 0;
}


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

typedef struct node{
  double x,y;
} POINT;

void kock( int, POINT ,POINT );

int main(){

  int n;
  POINT p1={0,0},p2={100,0};
  scanf("%d",&n);
  
  printf("%.8f %.8f\n", p1.x, p1.y );
  kock(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y );
  printf("\n");
  return 0;
}
void kock(int n, POINT p1, POINT p2){

  POINT s,t,u;
  if(n == 0) return;

  double th = 60 * M_PI / 180; 
  
  //p1,p2からs,t,u を計算する
  s.x = (2*p1.x + 1*p2.x)/3;
  s.y = (2*p1.y + 1*p2.y)/3;
  t.x = (1*p1.x + 2*p2.x)/3;
  t.y = (1*p1.y + 2*p2.y)/3;
  u.x = (t.x-s.x)*cos(th) - (t.y-s.y)*sin(th) + s.x;
  u.y = (t.x-s.x)*sin(th) + (t.y-s.y)*cos(th) + s.y;
  
  kock(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y );//s
  
  kock(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y );//u
  
  kock(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);//t
  
  kock(n-1, t, p2);
}



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  string s;
  cin>>s;
  bool ok=true;
  for(int i=0;i<s.size();i++){
    if(i%2==1&&s[i]!='i')ok=false;
    if(i%2==0&&s[i]!='h')ok=false;
  }
  if(s.size()%2)ok=false;
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll N,u,v,ans=-1;
vector<vector<ll>> tree(200010);
vector<ll> distv(200010,-1);
vector<ll> distu(200010,-1);
void bfs(ll t,vector<ll> &dist){
    queue<ll> q;
    dist.at(t)=0;
    q.push(t);
    while(!q.empty()){
        ll i=q.front();
        q.pop();
        for(auto j:tree.at(i)){
            if(dist.at(j)<0){
                q.push(j);
                dist.at(j)=dist.at(i)+1;
            }
        }
    }
    return;
}
void Main(){
    cin>>N>>u>>v;u--;v--;
    For(i,0,N-1){
        ll a,b;cin>>a>>b;a--;b--;
        tree.at(a).push_back(b);
        tree.at(b).push_back(a);
    }
    bfs(v,distv);
    bfs(u,distu);
    For(i,0,N) if(distv.at(i)>distu.at(i)) ans=max(distv.at(i),ans);
    cout<<ans-1<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 11904
N=int(input())
l=[]
for _ in range(N):
  l.append(list(map(int,input().split())))
for i in range(N-2):
  if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________

int main()
{
       int n,x,t;
       cin>>n>>x>>t;
       int xx = (n+x-1)/x;
       xx *= t;
       cout<<xx<<endl; 
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>

int main(void){
    char s[200+5];
    scanf("%s", s);
    int n=strlen(s);
    
    if(n%2==1)n--;
    else n-=2;
    
    for(int i=n/2; i>0; i--){
        for(int j=0; j<i; j++){
            if(s[j] != s[i+j])break;
            if(j==i-1){
                printf("%d\n", i*2);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 1732
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int a,b;cin>>a>>b;
  if(a <= 5)cout << 0 << endl;
  else if(a <= 12)cout << b/2 << endl;
  else cout << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  string s,t,u;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  cin>>u;
  if(s==u){
    cout<<a-1<<" "<<b;
  }
  else cout<<a<<" "<<b-1;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define PRIME_NUM 30000
using namespace std;

bool isPrime[PRIME_NUM];
vector<int> prime;

void calcPrime() {
  prime.clear();
  for(int i = 0; i < PRIME_NUM; i++) isPrime[i] = true;
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i < PRIME_NUM; i++) {
    if(isPrime[i]) {
      prime.push_back(i);
      for(int j = i*2; j < PRIME_NUM; j += i) {
	isPrime[j] = false;
      }
    }
  }
}

main() {
  calcPrime();
  while(1) {
    int T;
    cin >> T;
    if(T == 0) break;
    int num = 0;
    for(int i = 0; prime[i] < T; i++) {
      for(int j = i; prime[i]+prime[j] < T; j++) {
	int tmp = T-prime[i]-prime[j];
	if(tmp < prime[j]) break;
	if(isPrime[tmp] && prime[i]+prime[j] > tmp) num++;
      }
    }
    cout << num << endl;
  }
}

Measured memory_bytes: 968
n=int(input())
a=list(map(int,input().split()))

ans=0
import collections
c=collections.Counter(a)
c=c.most_common()
for i in range(len(c)):
    x=c[i][0]
    y=c[i][1]
    if x<=y:
        ans += y-x
    else:
        ans += y
print(ans)

Measured memory_bytes: 21616
#include <stdio.h>

int main()
{
        // 入力用変数
        int N, D;

        // 出力用変数
        int out;

        // 入力
        scanf("%d %d", &N, &D);

        // 計算
        out = N / ((D * 2) + 1);
        if ((N % ((D * 2) + 1)) != 0) {
                out++;          // 小数点繰り上げ
        }

        // 出力
        printf("%d\n", out);

        return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

N = int(input())
xN, yN, hN = [0] * N, [0] * N, [0] * N
for i in range(N):
    xN[i], yN[i], hN[i] = map(int, input().split())

# 頂上としてありうる座標101*101を全検索
for y in range(101):
    for x in range(101):
        # 仮の頂上の高さを保持する
        tmpH = 0
        # 実施回数と一致回数の比較用
        cnt1, cnt2 = 0, 0
        # 任意の座標について、N個の情報との矛盾がないかを確認していく
        for i in range(N):
            # 高さ0の座標は高さの比較対象として相応しくないのでいったん無視
            if hN[i] == 0:
                continue
            cnt1 += 1
            # 頂上座標を仮固定しているので、仮の頂上の高さが定まる
            h = hN[i] + abs(x - xN[i]) + abs(y - yN[i])
            # 初回は値を保持
            if tmpH == 0:
                tmpH = h
                cnt2 += 1
            # 2回目以降は保持した初回の値と今回を比較
            else:
                # 一致しなければ矛盾しているので、その座標は終了
                if tmpH != h:
                    break
                else:
                    cnt2 += 1
        # 高さ0の場所について、矛盾がないか確認
        # (tmpHの確定後に全ての場所を試したいので別ループにする)
        for i in range(N):
            if hN[i] == 0:
                cnt1 += 1
                # 仮の高さがマンハッタン距離より大きいのはおかしい
                # (距離のが大きいのは問題ない。本来マイナスなくらい遠くても高さは0スタートだから)
                if tmpH > abs(x - xN[i]) + abs(y - yN[i]):
                    break
                else:
                    cnt2 += 1
        # 実施回数と一致回数が一致していれば正しい情報として出力
        if cnt1 == cnt2:
            print(str(x) + ' ' + str(y) + ' ' + str(tmpH))
            exit()

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	int n;
	long int sum=0;
	
	scanf("%d",&n);
	
	for(int i=0;i<=n;i++){
		if(i%3 != 0 && i%5 !=0){
//			printf("%d ",i);
			sum = sum + i;
		}
	}
	
	printf("%ld",sum);
	
	return 0;
}


Measured memory_bytes: 1736
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <climits>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

const double EPS = 1.0e-10;

double p, e, t;
double solve(int k, double r, double l)
{
	if(abs(r - t) <= e + EPS && abs(l - t) <= e + EPS)
		return 1.0;
	if(t - r > e + EPS && t - l > e + EPS)
		return 0.0;
	if(r - t > e + EPS && l - t > e + EPS)
		return 0.0;

	double h = (r + l) / 2;
	if(k == 0){
		if(abs(h - t) <= e + EPS)
			return 1.0;
		else
			return 0.0;
	}

	if(h >= t - EPS){
		return solve(k-1, r, h) * (1-p) + solve(k-1, h, l) * p;
	}else{
		return solve(k-1, h, l) * (1-p) + solve(k-1, r, h) * p;
	}
}

int main()
{
	int k, r, l;
	cin >> k >> r >> l;
	cin >> p >> e >> t;

	printf("%.10f\n", (double)solve(k, r, l));

	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);

		int x = in.nextInt();
		int y = in.nextInt();

		if(y%2 == 0 && (2*x <= y && 4*x >= y)){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35736
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
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; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n;
    cin >> n;
    n%=10;
    if(n==2 or n==4 or n==5 or n==7 or n==9) cout<<"hon"<<endl;
    if(n==0 or n==1 or n==6 or n==8) cout<<"pon"<<endl;
    if(n==3) cout<<"bon"<<endl;
    
    return 0;
}

Measured memory_bytes: 3660
$\=8e18;<>=~$";@x=sort{$a-$b}<>;until(@x<($k=$')){for($k..@x){@p=sort{$a-$b}map/ /*$',@x[0..--$_];$\-=$-=$\-($p[$k-1]-shift@p)*($x[$_]-"@x")until@p<$k}shift@x}print

Measured memory_bytes: 512
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
const int N=1e5+5;
int x,y,dis[N];
int fun(int i,int j)
{
	return min(j-i,abs(x-i)+abs(y-j)+1);
}

int main()
{
	fast();
	int j,n,i;
	cin>>n>>x>>y;
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			int temp=fun(i,j);
			dis[temp]++;
		}
	}
	for(i=1;i<n;i++)
		cout<<dis[i]<<endl;
}

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

void print(vector<int> A) {
    for (int i = 0; i < (int)A.size(); i++) {
        cout << A[i] << ((i+1==(int)A.size())?"\n":" ");
    }
}

int selectingsort(vector<int> &A, int N) {
    int ret = 0;
    for (int i = 0; i < N; i++) {
        int mn = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[mn]) mn = j;
        }
        swap(A[i], A[mn]);
        if (A[i] != A[mn]) ret++;
    }
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int ans = selectingsort(A, N);
    print(A);
    cout << ans << endl;
    return 0;
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int s  = a + b + c;
    if (s < 22) cout << "win" << endl;
    else cout << "bust" << endl;


	return 0;
}


Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



class BIT {//binary indexed tree, Fenwick treeとも
	int lg;
	std::vector<long long> bit;
public:
	BIT(int size) :bit(size + 1, 0) {
		lg = size;
		while (lg&lg - 1)lg &= lg - 1;
	}
	void insert(int i, long long x) {//i番目にx加える
		i++;//BIT添え字は1～ｎだから
		while (i < (int)bit.size()) {
			bit[i] = std::max(bit[i], x);
			i += i & -i;
		}
	}
	long long max(int a)const {
		a++;
		long long res = 0;
		while (0 < a) {
			res = std::max(res, bit[a]);
			a -= a & -a;
		}
		return res;
	}
};


int n;
int h[200000];
int a[200000];




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

	cin >> n;
	rep(i, n)cin >> h[i];
	rep(i, n)cin >> a[i];

	BIT bit(n + 1);

	rep(i,n) {
		auto ma = bit.max(h[i] - 1);
		bit.insert(h[i], ma + a[i]);
	}
	cout << bit.max(n) << endl;

	return 0;
}


Measured memory_bytes: 3328
N = int(input())
score = list(map(int, input().split()))
score.sort()
score.reverse()
a = []
b = []
for i in range(N):
  if(i % 2 == 1):
    a.append(score[i])
  else:
    b.append(score[i])
             
print(sum(b) - sum(a))
  

Measured memory_bytes: 3060