akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(),(x).end()
#define lowbit(x) x&-x
#define pb push_back
#define ls (id<<1)
#define rs (id<<1|1)
#define Rint register int
#define UNI(x) sort(ALL(x)),x.resize(unique(ALL(x))-x.begin())
#define GETPOS(c,x) (lower_bound(ALL(c),x)-c.begin())
#define LEN(x) strlen(x)
#define MS0(x) memset((x),0,sizeof((x)))
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<pii> Vpii;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(ull &x) { scanf("%llu", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const ll &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
const int MAXN=2e6+10,MAXM=4e6+10;
const int INF=INT_MAX,SINF=0x3f3f3f3f;
const ll llINF=LLONG_MAX;
const int MOD=1e9+7,mod=998244353;
const int inv2=5e8+4;
const int Lim=1<<20;

void solve()
{
   int k,n,m;
   R(k,n,m);
   n--;
   if(n/k<m/k)W("OK");
   else W("NG");
}

int main()
{
    //freopen("in.txt","r",stdin);
    int t=1;
    //R(t);
    while(t--)solve();
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  string t;
  cin >> t;
  cout << (s == t.substr(0,s.size()) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int candies[2][102];

int calcDP(int n) {
	int dp[2][102];
	REP(i, 2) {
		REP(j, 102) {
			dp[i][j] = 0;
		}
	}

	dp[0][0] = candies[0][0];
	dp[1][0] = dp[0][0] + candies[1][0];
	REP(i, n) {
		if (i == 0) continue;
		dp[0][i] = dp[0][i - 1] + candies[0][i];
	}
	REP(i, n) {
		if (i == 0) continue;
		int left = dp[1][i - 1] + candies[1][i];
		int top = dp[0][i] + candies[1][i];
		dp[1][i] = max(left, top);
	}

	return dp[1][n - 1];
	
}

int main() {
	int N;
	cin >> N;
	
	REP(j, 2) {
		REP(i, N) {
			cin >> candies[j][i];
		}
	}
	
	int ans = calcDP(N);

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	long long n, k;
	cin >> n >> k;

	long long ans1, ans2;
	ans1 = n % k;
	if (k >= ans1) ans2 = abs(k-ans1);

	cout << min(ans1, ans2) << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll oddxor(ll a){
   return ((a+1)/2)%2 ;
}
ll funcxor(ll b){
   if(b%2) return oddxor(b);
   else return oddxor(b+1)^(b+1);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i<n;i++){
   cin >> a[i];
  }
  int ans = 0;
  for(int i = 0;i<n-1;){
   if(a[i]==a[i+1]){
     ans++;
     i += 2;
   }
    else i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    cout << (n - 2) / (k - 1) + 1;
}


Measured memory_bytes: 256
n = gets.to_i

ab = []
f = Array.new(n+1){[]}
(n-1).times do |i|
    a, b = gets.split.map(&:to_i)
    f[a] << i
    f[b] << i
    ab << [a, b]
end

ans = Array.new(n-1)
que = [1]
pc = Array.new(n+1, 0)

while x = que.shift
    c = 1

    f[x].each do |i|
        next if ans[i]
        y = ab[i][0] == x ? ab[i][1] : ab[i][0]
        c += 1 if c == pc[x]

        ans[i] = c
        pc[y] = c
        que << y
        c += 1
    end
end

puts ans.max, ans

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

int main()
{
	string s; cin >> s;
	int cnt = 0;

	if (s.size() == 1)	{}
	else {
		for (int i = 0; i <= s.size() / 2 - 1; i++) {
			if (s.at(i) != s.at(s.size() - 1 - i)) cnt++;
		}
	}

	cout << cnt << endl;	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  
  ll m = 1000;
  ll kabu = 0;


  for (int i = 0; i < n-1; i++){
    if (a[i] < a[i+1]){
      m = m % a[i] + a[i+1] * (m/a[i]);
    }
  }
  cout << m << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    int n;
    cin >> n;
    vector<int> numbers(n);
    rep(i, n) cin >> numbers[i];
    vector<int> mins(n);
    mins[0] = numbers[0];
    rep(i, n - 1) mins[i + 1] = min(mins[i], numbers[i + 1]);

    int ans = 0;
    rep(i, n) {
        if (numbers[i] <= mins[i]) ans++;
    }

    cout << ans << endl;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    set<int> s;
    rep(i,n){
        int d;
        cin>>d;
        s.insert(d);
    }
    cout<<s.size()<<endl;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << a * b / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;


int main(){
    int n;
    cin >> n;
    if (n % 2 == 1){
        cout << (n / 2) * (n / 2 + 1) << endl;
    }else{
        cout << (n / 2) * (n / 2);
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
int N, M;
vector<bool> use;
vector<vector<bool> > G;

int f(int a,int num) {
	int ans = 0;
	use[a] = true;
	++num;
	if (num == N) {
		use[a] = false;
		return 1;
	}

	for (int i = 0; i < N; ++i) {
		if (G[a][i] == false)continue;
		if (use[i])continue;
		ans += f(i,num);
	}

	use[a] = false;
	return ans;
}
void solve() {
	cin >> N >> M;
	G = vector<vector<bool>>(N, vector<bool>(N, false));
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		G[a][b] = true;
		G[b][a] = true;
	}
	use = vector<bool>(N, false);
	int ans = f(0,0);
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
class MainClass
{
	static void Main(string[] args)
	{
		AnswerB();
	}
	public static void AnswerB()
		{
			int A = int.Parse(Console.ReadLine());
			int B = int.Parse(Console.ReadLine());
			int C = int.Parse(Console.ReadLine());
			int X = int.Parse(Console.ReadLine());

			int PatternCnt = 0;

			for (int i50 = 0; i50 <= C; i50++)
				for (int j100 = 0; j100 <= B; j100++)
					for (int k500 = 0; k500 <= A; k500++)
					{
						int mul = (i50*50) + (j100*100) + (k500*500);
						if (X == mul)
						{
							PatternCnt++;
							//Console.WriteLine($"{i50} {j100} {k500}");
						}
					}
			Console.WriteLine(PatternCnt.ToString());
			Console.ReadKey();
		}
}


Measured memory_bytes: 11092
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC_109_C solver = new ABC_109_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC_109_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int X = in.nextInt();
            int ans = Integer.MAX_VALUE;
            int[] dist = new int[n];
            for (int i = 0; i < n; i++) {
                dist[i] = Math.abs(X - in.nextInt());
            }
            int gcd = 0;
            if (dist.length != 1) {
                gcd = gcd(dist[0], dist[1]);
                for (int i = 0; i < n - 1; i++) {
                    gcd = gcd(gcd, dist[i + 1]);
                }

            } else {
                gcd = dist[0];
            }

            out.print(gcd);
        }

        private int gcd(int i, int i1) {
            if (i1 == 0) {
                return i;
            }

            return gcd(i1, i % i1);
        }

    }
}



Measured memory_bytes: 47636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >>N;
  vector<int> H(N);
  for(int i = 0; i < N; i++){
    cin >> H.at(i);
  }
  int cnt = 1;
  int tmp = 0;
  for(int i = 1; i < N; i++){
    for(int j = i - 1; j >=0; j--){
      if(H.at(j) <= H.at(i)) tmp++;
    }
    
    if(tmp == i) cnt++;
    
    tmp = 0;
  }
  
  cout << cnt << endl;
}


Measured memory_bytes: 3640
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        long a = 100;
        int result = 0;
        long x = long.Parse(Console.ReadLine());
        while (a < x)
        {
            a += a / 100;
            result++;
        }
        Console.WriteLine(result);
    }
}

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

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong n, k;
  scanf("%lld %lld", &n, &k);

  if(n == 1){
    printf("0\n");
  }else{
    llong ans = 0;
    REP(i,n-1){
      llong hoge = ans / (k-1);
      ans = (k * hoge + ans % (k - 1)) + 1;
    }
    printf("%lld\n", ans);
  }
  return 0;
}




Measured memory_bytes: 3216
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

while True:
    S = raw_input()
    if S == '0':
        break
    m = {}
    for i in range(11):
        m[i] = []
    m[0].append(11)
    diff = 0
    even = True
    S = reversed(S)
    for c in S:
        num = int(c)
        if even:
            diff += num
        else:
            diff -= num
        diff %= 11
        m[diff].append(num)
        even = (not even)
    ans = 0
    #print m
    for i in range(11):
        lst = m[i]
        for i in range(len(lst)):
            if lst[i] != 0:
                ans += i
    
    print ans


Measured memory_bytes: 8064
A, B, C = list(map(int, input().split()))
K = int(input())
for i in range(K):
    max_val = max(A, B, C)
    if max_val == A:
        A *= 2
    elif max_val == B:
        B *= 2
    elif max_val == C:
        C *= 2
print(sum([A, B, C]))

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

int main()
{
  char in[100];
  char* p[3];
  fgets(in, 100, stdin);
  p[0] = strtok(in, " ");
  p[1] = strtok(NULL, " ");
  p[2] = strtok(NULL, " ");
  printf("%s %s %s", p[2], p[0], p[1]);
}

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

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

int N;
long long ans = 1;
vector <int>sosuu;

int main(){

	cin >> N;
	FOR(i,1,1001){
		int yakusuu=0;
		FOR(j,1,i+1){
			if(i%j==0)yakusuu++;
		}
		if(yakusuu==2)
			sosuu.push_back(i);
	}

	REP(i,sosuu.size()){
		int a=sosuu[i];
		if(a > N)
			break;
		int ans1=0;
		while(a<=N){
			ans1 +=N/a;
			a*=sosuu[i];
		}
		ans1++;
		ans = (ans1) * (ans % 1000000007);
	}

	cout << ans% 1000000007;

}

Measured memory_bytes: 256
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()
A = iInLH()

dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for l in range(1, N+1):
    for i in range(N+1-l):
        j = i + l
        if l % 2 == N % 2:
            dp[i][j] = max(dp[i+1][j] + A[i], dp[i][j-1] + A[j-1])
        else:
            dp[i][j] = min(dp[i+1][j] - A[i], dp[i][j-1] - A[j-1])

ans = dp[0][N]
print(ans)


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

int a,b;

int main(){
	scanf("%d%d",&a,&b);
	if(0>=a && 0<=b){
		printf("Zero\n");
		return 0;
	}
	if(a >= 0){
		printf("Positive\n");
		return 0;
	}
	b = min(b,-1);
	int cnt = -a + b + 1;
	if(cnt&1) printf("Negative\n");
	else printf("Positive\n");
	return 0;
}

Measured memory_bytes: 256
input=__import__('sys').stdin.readline
def getdist(a,b):return abs(a[0]-b[0])+abs(a[1]-b[1])
n=int(input())
s=[]
for _ in range(n):s.append([*map(int,input().split())])
ans=0
sx=sorted(s)
sy=sorted(s,key=lambda x:x[1])
ans=max(ans,getdist(sx[-1],sx[-2]))
ans=max(ans,getdist(sx[0],sx[1]))
ans=max(ans,getdist(sy[-1],sy[-2]))
ans=max(ans,getdist(sy[0],sy[1]))
def ff1(x):return x[0]+x[1]
def ff2(x):return x[0]-x[1]
f1=sorted(s,key=ff1)
f2=sorted(s,key=ff2)
ans=max(ans,getdist(f1[0],f1[-1]))
ans=max(ans,getdist(f1[0],f1[1]))
ans=max(ans,getdist(f1[-1],f1[-2]))
ans=max(ans,getdist(f2[0],f2[-1]))
ans=max(ans,getdist(f2[0],f2[1]))
ans=max(ans,getdist(f2[-1],f2[-2]))
def ff1(x):return abs(x[0]+x[1])
def ff2(x):return abs(x[0]-x[1])
f1=sorted(s,key=ff1)
f2=sorted(s,key=ff2)
ans=max(ans,getdist(f1[0],f1[-1]))
ans=max(ans,getdist(f1[0],f1[1]))
ans=max(ans,getdist(f1[-1],f1[-2]))
ans=max(ans,getdist(f2[0],f2[-1]))
ans=max(ans,getdist(f2[0],f2[1]))
ans=max(ans,getdist(f2[-1],f2[-2]))
print(ans)

Measured memory_bytes: 62856
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> dp(n + 1);
	vector<int> heights(n + 1);
	for (int i = 1; i <= n; i++)
		cin >> heights[i];

	//dp[0] = 0;
	dp[1] = 0;
	dp[2] = abs(heights[1] - heights[2]);
	for (int i = 3; i <= n; i++) {
		// dp[i] = min(abs(heights[i] - heights[i - 1]), abs(heights[i] - heights[i - 2]));
		dp[i] = min((dp[i - 1] + abs(heights[i] - heights[i - 1])), (dp[i - 2] + abs(heights[i] - heights[i - 2])));
	}

	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
char a[30];
int main()
{
  int i,j;
  for(i=0; i<28; i++){
    scanf("%d",&j);
    a[j-1] = 1;
  }
  for(i=0; i<30; i++){
    if(a[i] == 0) printf("%d\n",i+1);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation
#include<complex>
#include<math.h>
#include<sstream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, j, n) for (int i = j; i < (long double)(n); i++)

int main() {
	int x;
	cin >> x;
	int nowx = x;
	bool F = false;
	while (1) {
		F = false;
		rep2(i, 2, sqrt(x) + 0.1) {
			if (nowx % i == 0) {
				F = true;
				break;
			}
		}
		if (!F) {
			cout << nowx << endl;
			break;
		}
		nowx++;
	}
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

int d[1<<15][15][15];
int a[20][20];
int n;

int doit(int bit,int x,int y)
{
  vector<int> a1,a2;
  int i,j,k,bx,by,bit1,bit2;
  int used[20];
  int ans,sum,ma,tmp,tmp1;
  if (x==y) return 0;
  if (d[bit][x][y]!=-1) return d[bit][x][y];
  ans=(1<<30);
  for (k=(1<<n)-1;k>=0;k--)
  {
    k&=bit;
    if (((1<<x)&k)==0) continue;
    if (((1<<y)&k)!=0) continue;
    
    a1.clear();
    a2.clear();
    for (j=0;j<n;j++)
      if (((1<<j)&bit)!=0)
      {
        if (((1<<j)&k)!=0)
          a1.push_back(j);
        else a2.push_back(j);
      }
    
    /*
    memset(used,0,sizeof(used));
    a1.clear();
    a1.push_back(x);
    used[x]=1;
    for (i=0;i<a1.size();i++)
      for (j=0;j<n;j++)
        if (((1<<j)&bit)!=0)
          if ((used[j]==0)&&(((1<<j)&k)!=0)&&(a[a1[i]][j]!=0))
          {
            a1.push_back(j);
            used[j]=1;
          }
    a2.clear();
    a2.push_back(y);
    used[y]=1;
    for (i=0;i<a2.size();i++)
      for (j=0;j<n;j++)
        if (((1<<j)&bit)!=0)
          if ((used[j]==0)&&(((1<<j)&k)==0)&&(a[a2[i]][j]!=0))
          {
            a2.push_back(j);
            used[j]=1;
          }
    */
    ma=0;
    sum=0;
    for (i=0;i<a1.size();i++)
      for (j=0;j<a2.size();j++)
        if (a[a1[i]][a2[j]]!=0)
        {
          sum+=a[a1[i]][a2[j]];
        }
    for (j=0;j<a2.size();j++)
      if (a[x][a2[j]]>ma)
      {
        ma=a[x][a2[j]];
      }
    if (sum==0) continue;
    if (ma==0) continue;
    bit1=0;
    for (i=0;i<a1.size();i++)
      bit1|=(1<<a1[i]);
    bit2=0;
    for (i=0;i<a2.size();i++)
      bit2|=(1<<a2[i]);
    for (j=0;j<a2.size();j++)
      if (a[x][a2[j]]>0)
      {
        bx=x;
        by=a2[j];
        tmp=sum-a[x][a2[j]];
        tmp1=doit(bit2,by,y);
        if (tmp1==(1<<30)) continue;
        tmp+=tmp1;
        if (tmp<ans)
        {
          /*
          if (bit==(1<<n)-1)
          {
            cout<<k<<" "<<tmp<<" "<<bit1<<" "<<bit2<<" "<<sum<<" "<<ma<<endl;
          }
          */
          ans=tmp;
        }
      }
    //cout<<sum<<" "<<ma<<endl;
  }
  d[bit][x][y]=ans;
  return ans;
}

int main()
{
  int i,j,k,x,y,z,m;
  int ans,sum,ma;
  vector<int> b1,b2;
  scanf("%d%d",&n,&m);
  memset(a,0,sizeof(a));
  for (i=0;i<m;i++)
  {
    scanf("%d%d%d",&x,&y,&z);
    x--;y--;
    //if (a[x][y]!=0) printf("wa!!!%d %d\n",x,y);
    a[x][y]=z;
    a[y][x]=z;
  }
  memset(d,-1,sizeof(d));
  ans=doit((1<<n)-1,0,n-1);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 29056
#include <bits/stdc++.h>
using namespace std;
#define NIL -1

class Node{
    public:
        int location;
        int p,l,r;
        Node(){}
};

class Point{
    public:
        int id,x,y;
        Point(){}
        //メンバ変数の初期化
        Point(int id,int x,int y):id(id),x(x),y(y){}
        //比較演算子のオーバーロード
        bool operator<(const Point &p){
            return id<p.id;
        }

        void print(){
            printf("%d\n",id);
        }
};

int N,np;
Point P[500001];
Node T[500001];

bool lessX(const Point &left,const Point &right){
    return left.x<right.x;
}
bool lessY(const Point &left,const Point &right){
    return left.y<right.y;
}

int make2Dtree(int l,int r,int depth){
    if(!(l<r)) return NIL;
    int mid=(l+r)/2;
    int t=np++;
    if(depth%2==0){
        sort(P+l,P+r,lessX);
    }
    else{
        sort(P+l,P+r,lessY);
    }
    T[t].location=mid;
    T[t].l=make2Dtree(l,mid,depth+1);
    T[t].r=make2Dtree(mid+1,r,depth+1);
    return t;
}

void find(int v,int sx,int tx,int sy,int ty,int depth,vector<Point> &ans){
    int x=P[T[v].location].x;
    int y=P[T[v].location].y;
    if(sx<=x&&x<=tx&&sy<=y&&y<=ty){
        ans.push_back(P[T[v].location]);
    }

    if(depth%2==0){
        if(T[v].l!=NIL&&sx<=x){
            find(T[v].l,sx,tx,sy,ty,depth+1,ans);
        }
        if(T[v].r!=NIL&&x<=tx){
            find(T[v].r,sx,tx,sy,ty,depth+1,ans);
        }
    }
    else{
        if(T[v].l!=NIL&&sy<=y){
            find(T[v].l,sx,tx,sy,ty,depth+1,ans);
        }
        if(T[v].r!=NIL&&y<=ty){
            find(T[v].r,sx,tx,sy,ty,depth+1,ans);
        }
    }
}

int main(){
    int x,y;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d%d",&x,&y);
        P[i]=Point(i,x,y);
        T[i].p=T[i].l=T[i].r=NIL;
    }
    
    np=0;
    int root=make2Dtree(0,N,0);

    int q;
    scanf("%d",&q);
    int sx,tx,sy,ty;
    vector<Point> ans;
    for(int i=0;i<q;i++){
        scanf("%d%d%d%d",&sx,&tx,&sy,&ty);
        ans.clear();
        find(root,sx,tx,sy,ty,0,ans);
        sort(ans.begin(),ans.end());
        for(int j=0;j<ans.size();j++){
            ans[j].print();
        }
        printf("\n");
    }
}


Measured memory_bytes: 16412
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REP1(i, n) for(int i = 1; i <= n; ++i)

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;

ll N, K;

int main(){
    cin >> N >> K;
    auto p = read<double>(N);
    
    for(auto& x: p) x = (1.0 + x) / 2.0;
    
    double sum = 0;
    double ans = 0;
    for(int i = 0; i < K; ++i){
        sum += p[i];
    }
    ans = sum;
    for(ll i = K; i < N; ++i){
        sum = sum - p[i - K] + p[i];
        if(ans < sum){
            ans = sum;
        }
    }
    
    write(ans);
}



Measured memory_bytes: 1792
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  ll x;
  cin >> x;
  ll base = 100;
  int n = 0;
  while(base < x){
    base *= 1.01;
    n++;
  }
  printf("%d\n", n);
  return 0;
}


Measured memory_bytes: 3764
#include <cstdio>
#include <algorithm>

const int MAXN = 100000 + 10;

struct Seg{
	int l, r;
	
	bool operator < (const Seg b) const { return r < b.r; }
};
int n;
Seg a[MAXN];
int f[MAXN];

inline int calc(const Seg a, const int p) { return std::max(a.r - std::max(a.l, p) + 1, 0); }
inline int len(const Seg a) { return std::max(a.r - a.l + 1, 0); }

int main() {
	int i, ans = 0;
	Seg x;
	
	scanf("%d", &n);
	for(i=1; i<=n; i++) 
		scanf("%d %d", &a[i].l, &a[i].r);
	std::sort(a+1, a+1+n);

	f[n] = a[n].l;
	for(i=n - 1; i; i--) 
		f[i] = std::max(a[i].l, f[i + 1]);
	
	x.l = a[1].l;
	x.r = a[1].r;
	for(i=2; i<=n; i++) {
		ans = std::max(ans, std::max(calc(x, f[i + 1]) + len(a[i]), calc(a[i], f[i + 1]) + len(x)));
		x.l = std::max(x.l, a[i].l);
		x.r = std::min(x.r, a[i].r);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long M = sc.nextLong();
        long A[] = new long[N];
        long B[] = new long[N];
        List<Store> ls = new ArrayList<>();
        for(int i=0; i<N; i++) {
            A[i] = sc.nextLong();
            B[i] = sc.nextLong();
            Store s = new Store(A[i], B[i]);
            ls.add(s);
        }
        Collections.sort(ls);
        long r=0;
        for(Store s : ls) {
//            System.out.println(String.format("%d:%d", s.price, s.stock));
            if(M>s.stock) {
                r+=s.stock*s.price;
                M-=s.stock;
                continue;
            }
            r+=M*s.price;
            break;
        }
        System.out.println(r);
   }
   static class Store implements Comparable {
        long price;
        long stock;
        Store(long p, long s) {
            this.price = p;
            this.stock = s;
        }

       @Override
       public int compareTo(Object o) {
           Store t = (Store)o;
           if(this.price == t.price) return 0;
           return (this.price>t.price ? 1 : -1);
       }
   }
}

Measured memory_bytes: 93436
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }

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

  map<char,int> cnt;
  rep(i,n) {
    string s;
    cin >> s;
    cnt[s[0]]++;
  }

  ll ans = 0;
  string t = "MARCH";
  int nt = sz(t);
  srep(i,0,nt)srep(j,i+1,nt)srep(k,j+1,nt) {
    char ci = t[i];
    char cj = t[j];
    char ck = t[k];
    ans += (ll)cnt[ci]*cnt[cj]*cnt[ck];
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ld long double
#define ii pair<ll,ll>;
#define vi vector<int>;
#define ll long long int
#define ook order_of_key
#define fbo find_by_order
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = a; i < b; i++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
int main(){
    IOS
    //io_set();
    ll n, i, ans = INT_MIN, x;
    cin >> n;
    ll a[n];
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    sort(a,a+n);
    for(i=0;i<n;i++){
        x = (upper_bound(a,a+n,a[i]+2)-(a+i));
        ans = max(x,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int H1, M1, H2, M2, K, h;

    cin >> H1 >> M1 >> H2 >> M2 >> K;

    h = (H2-H1) * 60 - M1 + M2;

    if(h>K) {
        cout << h-K << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
    
}

Measured memory_bytes: 3636
n = int(input())
arr = list(map(int, input().split()))
count = 0
for i in range(1, n - 1):
    if arr[i - 1] < arr[i] < arr[i + 1] or arr[i - 1] > arr[i] > arr[i + 1]:
        count += 1

print(count)


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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

int main() {
    vector<int> packs(3);
    for(auto &i: packs)
        cin >> i;

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

    if(packs[0] + packs[1] == packs[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

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

    int N = S.size();

    vector<int> cand;
    for (int i = 0; i < N - 1; i++) {
        if (S[i] != S[i + 1]) {
            cand.push_back(max(i + 1, N - i - 1));
        }
    }
    if (cand.size() == 0) {
        cand.push_back(N);
    }

    cout << *min_element(cand.begin(), cand.end()) << endl;
    return 0;
}

Measured memory_bytes: 768
import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(2147483647)
#rstrip().decode('utf-8')
import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#map(int,input().split())


def main():
	X=[]
	Y=[]
	n=int(input())
	ans=0
	for i in range(n):
		x,y=map(int,input().split())
		X.append(x)
		Y.append(y)
	
	for i in range(n-1):
		for j in range(i+1,n):
			ans+=((X[i]-X[j])**2+(Y[i]-Y[j])**2)**0.5
	
	print(ans*2/n)
	
	
	
	
	
if __name__ == '__main__':
	main()

Measured memory_bytes: 3188
# refer to https://qiita.com/k_karen/items/653ba7025a92f5ac1363
 
# ONE = '1'.freeze
MOD = (10**9) + 7
 
# def inv(x)
#   res = 1 # 最終的に x^(MOD-2) になる変数です
#   beki = x # x^2^n を格納する変数です
#   # MOD-2の２進数展開を下位のbitから見ていきます。
#   (MOD - 2).to_s(2).reverse.chars do |digest|
#     # bitが立っている <=> digest == ONE 
#     # なら resにbekiを掛けます。
#     # ここで、掛け算は計算の都度MODを取れます
#     res = (beki * res) % MOD if digest == ONE
#     # 次のループに備えて、自乗を計算します。
#     # 計算の都度MODを取れます(とても大事なので二回言います)
#     beki = (beki * beki) % MOD
#   end
#   res
# end
 
# def fact(s, e)
#   (s..e).reduce(1) { |r, i| (r * i) % MOD }
# end
 
# def nCk(n, k)
#   k = n - k if k > n - k
#   (fact(k + 1, n) * inv(fact(1, n - k) % MOD)) % MOD
# end
 
def cmb(n, r, p):
    if r > n - r:
        r = n - r
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
 
p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
 
def f(t,k,mod):
    res = 1
    for i in range(k):
        res = res * t % mod
        t -= 1
    return res

def nCk(n,r):
    if r > n - r:
        r = n - r
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    res = 1
    for i in range(r):
      res *= n - i
      res /= i + 1
    return int(res)
    
def fact(n,k,mod):
    res = 1
    for i in range(k):
        res = res * (n-i) % mod
    return res % mod

def pow2(x, n):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x
    x = x*x
    n = n >> 1 #ビットシフト
  return ans
# A_inv = pow(A,P-2,P)
 
mod = 10 ** 9 + 7
# n = gets.to_i
# s = gets.chomp
# n,a,b = gets.split.map(&:to_i)
n, a, b = map(int, input().split())
cnt_a = cnt_b = 0

# def xgcd(a, b):
#     x0, y0, x1, y1 = 1, 0, 0, 1
#     while b != 0:
#         q, a, b = a // b, b, a % b
#         x0, x1 = x1, x0 - q * x1
#         y0, y1 = y1, y0 - q * y1
#     return a, x0, y0

# def modinv(a, m):
#     g, x, y = xgcd(a, m)
#     if g != 1:
#         raise Exception('modular inverse does not exist')
#     else:
#         return x % m
 
ans = pow(2,n,mod)
ans -= 1
# p [n,ans]
# print(ans)
# print(f(n,a,mod))
# print(f(n,b,mod))
# print(f(4,1,mod))
# p nCk(a,n)
# p fact(b,n)
ans = (ans - fact(n,a,mod)*pow(fact(a,a,mod),mod-2,mod)) % mod
ans = (ans - fact(n,b,mod)*pow(fact(b,b,mod),mod-2,mod)) % mod
# print(fact(n,a,mod)*pow(fact(a,a,mod),mod-2,mod))
# print(a)
# print(fact(a,a,mod))
# print(pow(n,b,mod))
# print(pow(n,b,mod)*modinv(pow(b,b,mod),mod))
 
print(ans)

Measured memory_bytes: 122040
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC047_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = scan;
            if (t[0] + t[1] == t[2] || t[0] + t[2] == t[1] || t[0] == t[1] + t[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


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

using namespace std;

int main()
{
	string S;
	long long K;
	cin >> S >> K;

	vector<pair<char, long long>> v;

	char prev = '\0';
	for (char ch : S) {
		if (ch == prev) {
			++v.back().second;
		}
		else {
			v.emplace_back(ch, 1);
		}
		prev = ch;
	}

	const int n = v.size();

	long long ans = 0;

	if (n == 1) {
		ans = (v[0].second * K) / 2;
	}
	else {
		if (v[0].first == v[n - 1].first) {
			ans += v[0].second / 2;
			ans += v[n - 1].second / 2;
			for (int i = 1; i < n - 1; ++i) {
				ans += (v[i].second / 2) * K;
			}
			ans += ((v[n - 1].second + v[0].second) / 2) * (K - 1);
		}
		else {
			for (auto &e : v) {
				ans += (e.second / 2) * K;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int[] count = new int[26];
		for (int i=0;i<n;i++) {
			count[s.charAt(i)-'a']++;
		}

		long ans = (long)n*(n-1)/2;
		for (int i=0;i<26;i++) {
			ans -= ((long)count[i]*(count[i]-1)/2);
		}
		System.out.println(ans+1);
	}

}


Measured memory_bytes: 28548
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 1005;
const int MAXX = 5005;
const int INF = (LL)1e9 + 5;

int X[MAXN], minv[MAXN], dp[MAXX], N;
vector<int> ch[MAXN];

void nope() {
	cout << "IMPOSSIBLE\n";
	exit(EXIT_SUCCESS);
}

void dfs(int v) {
	if (ch[v].empty()) {
		minv[v] = 0;
		return;
	}
	
	for (int to : ch[v]) {
		dfs(to);
	}
	
	fill(dp, dp + 5001, INF);
	dp[0] = 0;
	
	for (int to : ch[v]) {
		int c1 = X[to], c2 = minv[to];
		for (int j = 5000; j >= 0; j--) {
			int a = INF, b = INF;
			if (j >= c1) a = dp[j - c1] + c2;
			if (j >= c2) b = dp[j - c2] + c1;
			dp[j] = min(a, b);
		}
	}
	
	minv[v] = *min_element(dp, dp + X[v] + 1);
	if (minv[v] == INF) {
//		cout << v << " NO!!\n";
		nope();
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	for (int i = 2; i <= N; i++) {
		int p;
		cin >> p;
		ch[p].push_back(i);
	}
	
	for (int i = 1; i <= N; i++) cin >> X[i];
	
	dfs(1);
	cout << "POSSIBLE\n";
	
	return 0;
	
	/**** Note MAXN ****/
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  ll N;
  cin >> N;
  vector<ll>a;
  map<ll,ll> cou;

  rep(i,N){
    ll inp; cin >> inp;
    a.pb(inp);
    cou[inp]++;
  }

  rmsame(a);

  ll ans = 0;
  
  rep(i,a.size()){
    if(cou[a[i]] >= a[i]) ans += (cou[a[i]]-a[i]);
    else ans += cou[a[i]];
  }

  cout << ans << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 7028
using System;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');
            string[] bSplit = AB[1].Split('.');
            ulong a = ulong.Parse(AB[0]);
            ushort b = ushort.Parse(bSplit[0] + bSplit[1]);
            ulong answer = (ulong)(a * b / 100);

            Console.WriteLine(answer);
        }
    }
    //2回位使ったら追加する
    class MyLibrary
    {
        public static int[] ToIntArray(string[] stringArray)
        {
            int length = stringArray.Length;
            int[] intArray = new int[length];
            for (int i = 0; i < length; i++)
            {
                intArray[i] = int.Parse(stringArray[i]);
            }
            return intArray;
        }
    }
}

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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
  stack<int> stack;
  string s;
  while (cin >> s) {
    if (s[0] == '+') {
      int a = stack.top();
      stack.pop();
      int b = stack.top();
      stack.pop();
      stack.push(a + b);
    } else if (s[0] == '-') {
      int b = stack.top();
      stack.pop();
      int a = stack.top();
      stack.pop();
      stack.push(a - b);
    } else if (s[0] == '*') {
      int a = stack.top();
      stack.pop();
      int b = stack.top();
      stack.pop();
      stack.push(a * b);
    } else {
      stack.push(atoi(s.c_str()));
    }
  }
  cout << stack.top() << endl;
  return 0;
}



Measured memory_bytes: 3200
from collections import Counter

n = int(input())
nums = sorted(list(map(int, input().split())), reverse=True)

num_map = Counter(nums)

answer = 0
for num in nums:
    pair = (1 << (num.bit_length())) - num

    if num_map[num] > 0 and num_map[pair]:
        if num == pair and num_map[num] > 1:
            answer += 1
            num_map[num] -= 2
        if num > pair:
            answer += 1
            num_map[num] -= 1
            num_map[pair] -= 1

print(answer)

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

int main()
{
    string s;
    string days[] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};

    getline(cin, s);

    if(s == "SUN")
        cout << 7 << endl;
    else
    {
        int daysTillSun = 0;
        int index = 0;

        for(int i = 0; i < 7; i++)
        {
            if(days[i] == s)
            {
                index = i;
                break;
            }
        }
        
        index++;
        daysTillSun = 7 - index;

        cout << daysTillSun << endl;
    }

    return 0;
}

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

int main() {
int a[3],k;
cin>>a[0]>>a[1]>>a[2]>>k;
sort(a,a+3);
for(int i=0;i<k;i++){a[2]*=2;}
cout<<a[0]+a[1]+a[2]<<endl;
}

Measured memory_bytes: 256
//package csesCodes;// template code for cp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws InterruptedException {
        FastScanner fs=new FastScanner();
        int x=fs.nextInt();
        if(x==1)
            System.out.println( 0);
        else if(x==0){
            System.out.println(1);
        }



    }




    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();

        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] readLongArray(int n) {
            long[] a=new long[n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
    }

}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
#define X first
#define Y second

int main(){
	int n;
	cin >> n;
	int res = 0;
	for(int i=0; i<n; i++){
		int x;
		cin >> x;
		res ^= x;
	}
	cout << (res & 1 ? "NO" : "YES") << endl;
}

Measured memory_bytes: 384