akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.util.Scanner;

class Main {
    static int q, x, p;
    static ArrayList<Integer> list;

    public static void main(String[] args) {
        int query;
        list = new ArrayList<Integer>();
        Scanner sc = new Scanner(System.in);

        q = sc.nextInt();
        for (int i = 1; i <= q; i++) {
			query = sc.nextInt();
            switch (query) {
                case 0:
                    list.add(sc.nextInt());
                    break;
                case 1:
                    System.out.println(list.get(sc.nextInt()));
                    break;
                case 2:
                    list.remove(list.size() -1);
            }
        }
    }
}


Measured memory_bytes: 138156
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    twos = []
    for a in A:
        if a % 4 == 0:
            cnt = 2
        elif a % 2 == 0:
            cnt = 1
        else:
            cnt = 0
        twos.append(cnt)
    if N % 2 == 0:
        minNeed = N
    else:
        minNeed = N - 2
    if sum(twos) < minNeed:
        print('No')
    else:
        print('Yes')
main()



Measured memory_bytes: 16648
n,k = map(int,input().split())

import math
ans = 0
for i in range(n):
  p = i+1
  if p>=k:
    ans = ans + 1/n
  else:
    count = math.ceil(math.log2(k/p))
    ans = ans + 1/n*(1/2)**count

print(ans)

Measured memory_bytes: 3060
import collections, math

local = False
if local:
    file = open("inputt.txt", "r")

def inp():
    if local:
        return file.readline().rstrip()
    else:
        return input().rstrip()

def ints():
    return [int(_) for _ in inp().split()]



K = int(inp())

nex = [[0,1], [0,1,2], [1,2,3], [2,3,4], [3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9],[8,9]]
globcount = 0

def dfs(curdepth, curval):
    if curdepth<0:
        return False
    
    if curdepth==0:
        global globcount
        globcount += 1

        if globcount==K:
            print(curval)
            return True

    nexarr = nex[int(curval[-1])]
    for j in range(len(nexarr)):
        if dfs(curdepth-1, curval+str(nexarr[j])):
            return True
    
    return False


for depth in range(1, 15):
    found = False
    for i in range(1, 10):
        if dfs(depth-1, str(i)):
            found = True
            break
    
    if found:
        break

Measured memory_bytes: 55128
#include<bits/stdc++.h>
using namespace std;
#define ANSWER(x) cout<<x<<endl
#define debug(x) cout<<#x<<": "<<x
int main(){
  int n,num;
  stack<int> array;
  
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> num;
    array.push(num);
  }
  for(int i=0;i<n;i++){
    cout << array.top();
    array.pop();
    if(i == n-1)cout << endl;
    else cout << " ";
  }
}

Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
//		String[] tmpArray = br.readLine().split(" ");
		
		int n = Integer.parseInt(br.readLine());

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		String[] tmpArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			int tmp = Integer.parseInt(tmpArray[i]);
			
			if(!map.containsKey(tmp)){
				map.put(tmp, 1);
			}
			else {
				map.put(tmp, map.get(tmp) + 1);
			}
		}
		
		Set<Integer> set = map.keySet();
		
		Iterator<Integer> it = set.iterator();
		
		int result = 0;
		
		while(it.hasNext()){
			int tmp = it.next();
			
			int count = map.get(tmp);
			
			if(tmp > count){
				result += count;
			}
			else if(tmp < count){
				result += count - tmp;
			}
		}
		
		System.out.println(result);
	}

}


Measured memory_bytes: 47184
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

    #pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    /*#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #pragma GCC target ("avx2")*/

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

ll MAX = 1e15;
double PI = 3.141592653589793238463;
//double PI = acos(-1);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


void solve(){
    ll a,b;
    cin >> a >> b;
    cout << a*b;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif


    ll t=1;
    //cin >> t;
    while(t--){
        solve();
    }


    return 0;
}


Measured memory_bytes: 3608
// Written By NewbieChd
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    int f = 0;
    char c;
    while (!isdigit(c = getChar())) {}
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return f;
}

const int maxN = 3007, mod = 1e9 + 7;
const long long inv2 = 500000004;
int a[maxN], dp[maxN][maxN];
inline void add(int& x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

int main() {
    int n = read(), m = read(), i, j, x, y, ans = 0;
    for (i = 1; i <= n; ++i)
        a[i] = read();
    for (i = 1; i <= n; ++i)
        for (j = 1; j <= n; ++j)
            dp[i][j] = a[i] < a[j];
    
    for (i = 1; i <= m; ++i) {
        x = read(), y = read();
        dp[x][y] = dp[y][x] = inv2 * (dp[x][y] + dp[y][x]) % mod;
        for (j = 1; j <= n; ++j)
            if (j != x && j != y) {
                dp[x][j] = dp[y][j] = inv2 * (dp[x][j] + dp[y][j]) % mod;
                dp[j][x] = dp[j][y] = inv2 * (dp[j][x] + dp[j][y]) % mod;
            }
    }
    
    for (i = 1; i <= n; ++i)
        for (j = 1; j < i; ++j)
            add(ans, dp[i][j]);
    for (i = 1; i <= m; ++i)
        ans = (ans << 1) % mod;
    
    printf("%d\n", ans);
    return 0;
}


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

int main(){
  
  int X;
  int Y;
  int A;
  int B;
  int C;
  cin >> X >> Y >> A >> B >> C;
  vector<long long> Red(A);
  vector<long long> Green(B);
  vector<long long> None(C);
  rep(i,A){
  cin >> Red.at(i);
  }
  rep(i,B){
  cin >> Green.at(i);
  }
  rep(i,C){
  cin >> None.at(i);
  }
  sort(Red.begin(), Red.end());
  reverse(Red.begin(), Red.end());
  rep(i,X){
    None.push_back(Red.at(i));
  }
  
  sort(Green.begin(), Green.end());
  reverse(Green.begin(), Green.end());
  rep(i,Y){
    None.push_back(Green.at(i));
  }
  
  sort(None.begin(), None.end());
  reverse(None.begin(), None.end());
  long long MaxApple = 0;
  rep(i,X+Y){
    MaxApple += None.at(i);
  }
  cout << MaxApple << endl;
}

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

using namespace std;

template<typename K, typename V>
multimap<V,K> invertMap(map<K,V> const &map)
{
	multimap<V,K> multimap;
	for (auto const &pair: map) {
		multimap.insert(std::make_pair(pair.second, pair.first));
	}
	return multimap;
} //exp multimap<int,int> multimap = invertMap(w);
bool sf(string a,string b)
{
	if (b.find(a)!=string::npos)
		return true;
	return false;
}
#define ff first
#define ss second
#define ll long long
#define em emplace_back
#define mk make_pair
#define um unordered_map
#define iox ios::sync_with_stdio(false),cin.tie(0)
#define debug() system("pause");
#define debugv(opx) cout<<endl;for(auto x:opx)cout<<x<<" ";cout<<endl;
#define cox(opx); for(auto& x:opx)


int main()
{
	int x;
	cin>>x;
	ll ans=0;
	vector<int> opx,dfx;
	opx.em(500);
	opx.em(5);
	dfx.em(1000);
	dfx.em(5);
	int i=0;
	while(x>0)
	{
		int c=x/opx[i];
		if(c==0)i++;
		else {
			x-=c*opx[i];
			ans+=c*dfx[i];
		}
		if(x<opx[1])
			break;
	}
	cout<<ans;
}






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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var Instance = new Question();
			Instance.Exec();
		}
	}

	public class Question
	{
		public void Exec()
		{
			string str = Console.ReadLine();
			StringBuilder builder = new StringBuilder();
			foreach (var item in str) {
				if (char.IsLower(item)) {
					builder.Append(char.ToUpper(item));
				} else if (char.IsUpper(item)) {
					builder.Append(char.ToLower(item));
				} else {
					builder.Append(item);
				}
			}

			Console.WriteLine($"{builder.ToString()}");

			Console.ReadKey();
		}
	}
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	string s,t,temp;
	cin>>s>>t;
	int m,n,i,j;
	m=s.size();n=t.size();
	int dp[m+1][n+1];
	for(i=0;i<=m;i++)
	{
		for(j=0;j<=n;j++)
		{
			if(i==0||j==0)dp[i][j]=0;
			else if(s[i-1]==t[j-1])
			{
				dp[i][j]=1+dp[i-1][j-1];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	int lcs=dp[m][n];
	char lc[lcs+1];
	i=m;j=n;
	while(i>0&&j>0)
	{
		if(s[i-1]==t[j-1])
		{
			lc[lcs-1]=s[i-1];
			i--;j--;lcs--;
		}
		else
		{
			if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	lc[dp[m][n]]='\0';
	if(dp[m][n]==0)cout<<"";
	else cout<<lc;
}

Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

#define For(i,a,n)	for(int i = a;i < n;i++)
#define rep(i,n)	For(i,0,n)
#define clr(n)		memset(n,0,sizeof n)
#define all(n)		(n).begin(),(n).end()

int d[21][21];
int w, h;
int sy, sx, gy, gx;
const int INF = 1e9;
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
bool cheak(int x, int y, int mx, int my){
	return x >= 0 && y >= 0 && x < mx &&  y < my;
}

int dfs(int n,int sy,int sx){
	if (n == 11)return INF;
	int ret = INF;

	rep(i, 4){

		for (int k = 1;;k++){
			int tx = sx + dx[i] * k, ty = sy + dy[i] * k;
			if (!cheak(tx, ty, w, h))break;
			if (k == 1 && d[ty][tx] == 1)break;
			if (d[ty][tx] == 3){
				return n;
			}
			if (d[ty][tx] == 1){
				
				d[ty][tx] = 0;
				ret = min(ret,dfs(n + 1, ty - dy[i], tx - dx[i]));
				d[ty][tx] = 1;
				
				break;
			}
		}
		
	}

	return ret;
}

int main()
{

	while (cin >> w >> h && (w || h)){

		rep(y, h)rep(x, w){
			cin >> d[y][x];
			if (d[y][x] == 2)sy = y, sx = x;
			if (d[y][x] == 3)gy = y, gx = x;
		}
		int ans = dfs(1, sy, sx);
		if (ans == INF)ans = -1;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,L;
  cin >> N >> M >> L;
  int A,B,C;
  int E[N][N];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      E[i][j]=-1;
    }
    E[i][i]=0;
  }
  for (int i = 0; i < M; i++){
    cin >> A >> B >> C;
    if (C<=L){
      E[A-1][B-1]=C;
      E[B-1][A-1]=C;
    }
  }
  //Add edges
  bool added = true;
  int iter = 0;
  while (added && iter<N){
    iter++;
    added = false;
    for (int i = 0; i < N; i++){
      for (int j = 0; j < N; j++){
        if (E[i][j]>0){
          for (int k = i+1; k < N; k++){
            if (E[j][k]>0){
              if (E[i][k]==-1 || E[i][k]>E[i][j]+E[j][k]){
                if (E[i][j]+E[j][k]<=L){
                  E[i][k]=E[i][j]+E[j][k];
                  E[k][i]=E[i][k];
                  added = true;
                }
              }
            }
          }
        }
      }
    }
  }
  /*
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cout << E[i][j];
    }
    cout << endl;
  }
  */
  //Cost calc
  int cost[N][N];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cost[i][j]=-1;
    }
    cost[i][i]=0;
  }
  for (int i = 0; i < N; i++){
    bool added = true;
    iter = 0;
    while (added && iter<N){
      iter++;
      added = false;
      for (int j = 0; j < N; j++){
        if (cost[i][j]>-1){
          for (int k = i+1; k < N; k++){
            if (E[j][k]>0){
              if (cost[i][k]==-1 || cost[i][k]>cost[i][j]+1){
                cost[i][k]=cost[i][j]+1;
                cost[k][i]=cost[i][k];
                added = true;
              }
            }
          }
        }
      }
    }
  }
  /*
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cout << cost[i][j];
    }
    cout << endl;
  }
  */
  int Q;
  cin >> Q;
  int s,t;
  for (int i = 0; i < Q; i++){
    cin >> s >> t;
    if (cost[s-1][t-1]==-1){
      cout << -1;
    } else {
      cout << cost[s-1][t-1]-1;
    }
    if (i<Q-1) cout << endl;
  }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

const int mod = 1e9 + 7;

LL RS(LL n, LL p, LL mod) {
  if (p == 0) return 1;
  else if (p % 2 == 0) {
    LL t = RS(n, p / 2, mod);
    return t * t % mod;
  } else {
    return n * RS(n, p - 1, mod) % mod;
  }
}

LL comb(LL x, LL y) {
  LL res = 1;
  for (int i = x; i >= x - y + 1; i --) {
    res *= i;
    res %= mod;
  }
  LL t = 1;
  for (int i = y; i > 0; i --) {
    t *= i;
    t %= mod;
  }
  t = RS(t, mod - 2, mod);

  return (res * t) % mod;
}

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

  map<LL, LL> mp;
  int t = m, i = 2;
  while (t > 1) {
    if (t % i == 0) {
      mp[i] ++;
      t /= i;
    } else {
      i ++;
    }
  }

  LL ans = 1;
  for (auto x : mp) {
    ans *= comb(x.second  + n - 1, x.second);
    ans %= mod;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int A[200010];
    rep(i, N) cin >> A[i];
    rep(i, N) A[i] = (A[i] - 1) % K;

    int sum[200010] = {};
    rep(i, N) sum[i + 1] = (sum[i] + A[i]) % K;
    map<int, int> mp;
    rep(i, min(N, K - 1)) mp[sum[i + 1]]++;
    // rep(i, N + 1) cout << sum[i] << " ";
    // cout << endl;
    int ans = 0;
    int c = 0;
    rep(i, N) {
        
        ans += mp[c];
        if(i + K <= N) mp[sum[i + K]]++;
        mp[sum[i + 1]]--;
        //cout << i << " " << c << " " << ans << endl;
        c = (c + A[i]) % K;
    }
    cout << ans << endl;
    return 0;
}
// 0 3 1 2 4



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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i,K) {
    int d;
    cin >> d;
    rep(i,d) {
      int a;
      cin >> a;
      a--;
      A[a]++;
    }
  }
    int ans = 0;
    rep(i,N) {
      if(A[i]==0) ans++;
    }
    cout << ans << endl;
  }

Measured memory_bytes: 3624
import java.io.PrintWriter
import kotlin.random.Random

val br = System.`in`.bufferedReader()
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val d = readInteger()
    val cList = readLongList()
    val satisfyTable = Array(d) { readLongList() }
    
    val tmp = IntArray(d)
    for (i in 0 until d) {
        tmp[i] = Random.nextInt(26) + 1
    }
    out.println(tmp.joinToString("\n"))
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 41892
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define poly vector<ll>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
inline ll read(){
	ll x=0;char ch=getchar();bool d=1;
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') d=0;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return d?x:-x;
}
inline void write(ll x){
	if(x<0) x=-x,putchar('-');
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writep(ll x){write(x);putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=20,M=(1<<15)+5;
ll f[M][N],g[M];
vector<pii> v[N];
void upd(ll &x,ll y){
	x=max(x,y);
}
int main(){
	int n=read(),m=read();ll tot=0;
	For(i,1,m){
		int x=read(),y=read(),z=read();tot+=z;
		v[x].pb(mp(y,z));v[y].pb(mp(x,z));
	}
	int st=(1<<n)-1;
	For(s,0,st){
		For(i,1,n) if(!(s>>(i-1)&1)){
			if(!g[s|(1<<(i-1))]){
				g[s|(1<<(i-1))]=g[s];
				for(auto x:v[i]){
					if(s>>(x.fi-1)&1){
						g[s|(1<<(i-1))]+=x.se;
					}
				}
			}
		}
	}
	memset(f,-1,sizeof(f));
	f[1][1]=0;
	For(s,1,st){
		For(i,1,n) if(s>>(i-1)&1){
			if(f[s][i]==-1) continue;
			for(auto x:v[i]){
				if(!(s>>(x.fi-1)&1)){
					upd(f[s|(1<<(x.fi-1))][x.fi],f[s][i]+x.se);
				}
			}
			int ss=(st^s)|(1<<(i-1));
			for(int t=ss;t;t=(t-1)&ss){
				if(t>>(i-1)&1){
					upd(f[s|t][i],f[s][i]+g[t]);
				}
			}
		}
	}
	cout<<tot-f[st][n];
}

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

int main() {
    int a, b;
    cin >> a >> b;
    int d = a / b;
    int r = a % b;
    double f = 1.0 * a / b;
    cout << d << " ";
    cout << r << " ";
    printf("%.5lf\n", f);
    return 0;
}


Measured memory_bytes: 3244
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func isPrime(a int) bool {
	for j := 2; j*j <= a; j++ {
		if a%j == 0 {
			return false
		}
	}
	return true
}

func main() {
	n, d, x := nextInt(), nextInt(), nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	res := x
	for i := 0; i < d; i++ {
		for j := 0; j < n; j++ {
			if i%a[j] == 0 {
				res++
			}
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(){
    int n;
    string s; cin >> n >> s;
    vector<int> cntb(n+1);
    cntb[0] = 0;
    rep(i,n){
        if(s[i] == '#') {
            cntb[i+1] = cntb[i] + 1;
        }
        else{
            cntb[i+1] = cntb[i];
        }
    }    
    int ans = n;
    rep(i,n+1){
        if(ans > cntb[i] + n - i - (cntb[n] - cntb[i])){
            ans = cntb[i] + n - i - (cntb[n] - cntb[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1412
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int i = 0;
            int sum = 0;
            String s = sc.next();
            if(s.equals("0")){
                break;
            }
            
            for(int j=0;j<s.length();j++){
                if(Character.getNumericValue(s.charAt(j))==0){
                }else{
              sum +=  Character.getNumericValue(s.charAt(j));
                
                }
            }
            
                System.out.print(sum);
            System.out.println();
        }
        sc.close();
    }
}


Measured memory_bytes: 26288
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  
  bool easy = true;
  for (int i = 0; i < s.length(); i++) {
   	if (((i&1) && s[i] == 'R') || (!(i&1) && s[i] == 'L')) {
      easy = false;
      break;
    }
  }
  
  cout << (easy ? "Yes" : "No") << "\n";
}


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 x, y, u, v;
    cin >> x >> y >> u >> v;
    for (int i = y; i < v; i++) cout << 'U';
    for (int i = x; i < u; i++) cout << 'R';
    for (int i = y; i < v; i++) cout << 'D';
    for (int i = x; i < u; i++) cout << 'L';
    cout << 'L';
    for (int i = y; i <= v; i++) cout << 'U';
    for (int i = x; i <= u; i++) cout << 'R';
    cout << 'D';
    cout << 'R';
    for (int i = y; i <= v; i++) cout << 'D';
    for (int i = x; i <= u; i++) cout << 'L';
    cout << 'U';
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

class Repeater{
    int st;
    int ed;
    int d;
public:
    class rep_iterator{
        int i; int d;
    public:
        rep_iterator(int x, int pd) :i(x), d(pd) {}

        int& operator*(){ return i; }
        bool operator==(const rep_iterator& k) const { return i == k.i; }
        bool operator!=(const rep_iterator& k) const { return i != k.i; }
        rep_iterator& operator++(){ i+=d; return *this; }
    };

    Repeater(int N) :st(0), ed(N), d(1) {}
    Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }
    Repeater(int b, int e, int dif) :st(b), ed(e), d(dif) {}

    rep_iterator begin() const{ return rep_iterator(st, d); }
    rep_iterator end() const{ return rep_iterator(ed, d); }

};

template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
template<class T> using min_queue = p_queue<T, greater<T>>;
template<class T> using max_queue = p_queue<T, less<T>>;

template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

void sub_main(istream &cin) {
    if(!cin) return;
    char c = 0;
    bool good = true;
    for (int i = 0; i < 4; ++i) {
        char t ;
        cin >> t;
        if(t == c) good = false;
        c = t;
    }// i
    cout << (good ? "Good" : "Bad") << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test_A.txt";
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
def inpl(): return list(map(int,input().split()))

class CountUp:
    def __init__(self, start=0):
        self.index = start-1

    def __call__(self):
        self.index += 1
        return self.index

ui = defaultdict(CountUp())
plist = []
clists = []
Np = 0

N, M = inpl()
P = [0]*M
Y = [0]*M
for i in range(M):
    P[i], Y[i] = inpl()
    p = ui[P[i]]
    if p >= Np:
        plist.append(P[i])
        clists.append([[i,Y[i]]])
        Np += 1
    else:
        clists[p].append([i,Y[i]])

ids = ['']*M
for p in range(Np):
    clists[p].sort(key=lambda x: x[1])
    for c in range(len(clists[p])):
        cid = "{0:06d}".format(plist[p]) + "{0:06d}".format(c+1)
        ids[clists[p][c][0]] = cid

for i in range(M):
    print(ids[i])


Measured memory_bytes: 54068
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

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

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    std::vector<long long> ans(n, 0);

    for (int i = 0; i < n; i++) {
        ans[0] += a[i] * (i % 2 == 0 ? 1 : -1);
    }
    ans[0] /= 2;

    for (int i = 1; i < n; i++) {
        ans[i] += a[i - 1] - ans[i - 1];
    }

    for (int i = 0; i < n; i++) {
        std::cout << ans[i] * 2 << std::endl;
    }
}


Measured memory_bytes: 2432
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <cmath>
using namespace std;

int main(){
    int H,W,i,j;
    while(true){
        cin>> H>> W;
        if(H==0 && W==0){
            break;
        }
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                if((i+j)%2==0){
                    cout<< "#";
                }
                else{
                    cout<< ".";
                }
            }
            cout<< endl;
        }
        cout<< endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


   int n;
   cin >> n;
   int a[n];
   ll sum = 0;
   for (int i = 0; i < n; i++) {
       cin >> a[i];
       sum += a[i];
   }
   ll till = 0;

   ll ans = LONG_LONG_MAX;
   for (int i = 0; i < n - 1; i++) {
       till += a[i];
       ll right = sum - till;
       ans = min(ans, abs(till - right));
   }


   cout << ans;


}




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

int row, col, k;

int arr[18];
vector<int>v;

int solve(int pos, int sum)
{
    if(sum==k) return 1;

    if(pos>=v.size() or sum>k) return 0;

    int ans = 0;

    ans = solve(pos+1, sum+v[pos]) + solve(pos+1, sum);

    return ans;
}

int main()
{
    int H, W;
    cin>>H>>W>>k;

    char ch[10][10];

    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            cin>>ch[i][j];
            if(ch[i][j]=='#'){
                arr[i]++;
                arr[j+6]++;
            }
        }
    }

    int ans = 0, black;

    for(int maskR = 0;maskR<=(1 << H) - 1;maskR++){
        for(int maskC = 0;maskC<=(1 << W) - 1;maskC++){
            black = 0;

            for(int i = 0;i<=H-1;i++){
                for(int j = 0;j<= W-1;j++){
                    if (((maskR >> i) & 1) == 1 and ((maskC >> j) & 1) == 1){
                       // cout<<maskR<<" "<<maskC<<" "<<i<<" "<<j<<endl;
                        //cout<<" ["<<i<<","<<j<<"] ";
                        if(ch[i][j] == '#') black = black + 1;

                    }
                }

                //cout<<endl;
            }

           // cout<<endl;
            if(black == k) ans = ans + 1;
        }
     }

     cout<<ans<<endl;

    //cout<<solve(0,0)<<endl;

    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

int main() {
    ll X,Y,Z,K;
    cin >>X>>Y>>Z>>K;
    vector<ll> A(X);
    vector<ll> B(Y);
    vector<ll> C(Z);

    rep(i,X){
        cin>>A[i];
    }
    rep(i,Y){
        cin>>B[i];
    }
    rep(i,Z){
        cin>>C[i];
    }

    vector<ll> AB;
    rep(i,X){
        rep(j,Y){
            AB.pb(A[i]+B[j]);
        }
    }

    sort(all(AB));
    reverse(all(AB));
    vector<ll> ABC;
    /*rep(i,AB.size()){
        cout<<AB[i]<<endl;
    }*/
    rep(i,min(K,X*Y)){
        rep(j,Z){
            ABC.pb(AB[i]+C[j]);
        }
    }

    sort(all(ABC));
    reverse(all(ABC));

    rep(i,K){
        cout<<ABC[i]<<endl;
    }


    return 0;
    

}

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

int main(int argc, const char * argv[]) {
    int n; cin >> n;
    while(n--){
        set<string> kinds;
        string str; cin >> str;
        
        for(int i = 1; i < str.size(); i++){
            string s1 = str.substr(i), s2 = str.substr(0,i);
            string r1 = s1, r2 = s2;
            reverse(r1.begin(), r1.end());
            reverse(r2.begin(), r2.end());
            
            kinds.insert(s1 + s2);
            kinds.insert(s2 + s1);
            
            kinds.insert(s1 + r2);
            kinds.insert(r2 + s1);
            
            kinds.insert(r1 + s2);
            kinds.insert(s2 + r1);
            
            kinds.insert(r1 + r2);
            kinds.insert(r2 + r1);
        }
        cout << kinds.size() << endl;
    }
}

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

#define ll long long
#define tc                int T;cin>>T;while(T--)
const int INF = 1e9 + 5;
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, W; cin >> n >> W;
	vector<vector<int>> a(n, vector<int>(2));
	vector<vector<ll>> dp(n + 1, vector<ll>(W + 1, 0ll));
	for (auto& e : a)for (auto& d : e)cin >> d;
	for (int i = 0; i < W + 1; ++i) {
		dp[0][i] = 0;
	}
	for (int i = 0; i < n + 1; ++i) {
		dp[i][0] = 0;
	}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= W; ++j) {
			if (j >= a[i - 1][0])
				dp[i][j] = max(dp[i - 1][j], a[i - 1][1] + dp[i - 1][j - (a[i - 1][0])]);
			else dp[i][j] = dp[i - 1][j];
		}
	cout << dp[n][W];
	return 0;
}


Measured memory_bytes: 80256
//abc070_b Two Switches


#include <bits/stdc++.h>
using namespace std;

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

	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;

	if( A < C ) A = C;
	if( B > D ) B = D;
	if( A > B )
		cout << 0 << endl;
	else
		cout << B - A << endl;

	return 0;
}






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

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

    int A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << max(A * B, C * D) << endl;

    return 0;
};

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

int main(){

	std::string str;
	while (std::cin >> str){
		if (str == "0")break;

		int sum = 0;
		for (int i = 0; i < str.size(); i++)sum += str[i] - '0';
		std::cout << sum << std::endl;
	}
	return 0;
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

const int MAX = 1e5 + 5;
const int MOD = 1e9 + 7;

#define dbg(a) cout << "-> " << __LINE__ << ": " << #a << " = " << a << endl

int add (int a, int b) {
	return (a + b < MOD) ? (a + b) : (a + b - MOD);
}

int mul (int a, int b) {
	return int((a * 1LL * b) % MOD);
}

struct Mat {
	int n;
	vector <vector <int>> matrix;
	Mat (int nn) {
		n = nn;
		matrix.resize(n, vector <int> (n, 0));
		for (int i = 0; i < n; i++) {
			matrix[i][i] = 1;
		}
	}
	void input() {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> matrix[i][j];
			}
		}
	}
	Mat operator * (const Mat &p) {
		Mat ret(p.n);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				ret.matrix[i][j] = 0;
				for (int k = 0; k < n; k++) {
					ret.matrix[i][j] = add(ret.matrix[i][j], mul(matrix[i][k], p.matrix[k][j]));
				}
			}
		}
		return ret;
	}
	Mat operator ^ (long long b) {
		Mat ret(n), a = *this;
		while (b != 0) {
			if (b & 1) {
				ret = ret * a;
			}
			a = a * a;
			b >>= 1;
		}
		return ret;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	long long k;
	cin >> n >> k;
	Mat mat(n);
	mat.input();
	mat = mat ^ k;
	int ans = 0;
	for (auto v : mat.matrix) {
		for (int x : v) {
			ans = add(ans, x);
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    char c;
    for(int i= 0;i < s.length();i++){
      c = s.charAt(i);
      if(c >= 'A' && c <= 'Z'){
        c += 'a'-'A';
      }else if(c >= 'a' && c <= 'z'){
        c += 'A'-'a';
      }
      System.out.print(c);
    }
    System.out.println("");
    sc.close();
  }
}



Measured memory_bytes: 26936
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main(void){
    ll k;
    ll n;
    vector<ll> a;
    ll ans =0;
    cin >> k;
    cin >> n;
    for(ll i=0; i<n; i++){
        ll tmp=0;
        cin >> tmp;
        a.push_back(tmp);
        if(i == 0){
            CHMAX(ans,a[i]);
        }else if(i==n-1){
            ll tmp2= a[i] -a[i-1];
            CHMAX(ans,tmp2);
            tmp2 = k-a[i] + a[0];
            CHMAX(ans,tmp2);
        }else{
            ll tmp2= a[i] -a[i-1];
            CHMAX(ans,tmp2);
        }
        //cout << ans << endl;
    }
    cout << k-ans << endl;
    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}






ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};

struct UnionFind {
    vector<int>d;
    UnionFind(int n=0):d(n,-1){}
    int find(int x){
        if((d[x])<0)return x;
        return d[x]=find(d[x]);
    }
    bool unite(int x,int y){
        x =find(x);y=find(y);
        if(x==y)return false;
        if(d[x]>d[y])swap(x,y);
        d[x]+=d[y];
        d[y]=x;
        return true;
    }
    bool same(int x,int y){return find(x)==find(y);};
    int size(int x){return -d[find(x)];};
};




// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint f(int n) {
    if(n==0)return 1;
    mint x=f(2/n);
    x*=x;
    if(n%2==1)x*=2;
    return x;
}

mint choose(int n,int a){
    mint x =1,y=1;
    rep(i,a){
      x*=n-i;
      y*=a+i;
    }
    return x/y;
}

vector<ll>to[1000000];
const ll inf=10000000007;


mint f(ll n){
 if(n==0)return 1;
 mint x =f(n/2);
 x*=x;
 if(n%2==1)x*=2;
 return x;
}

mint choose(ll n,ll a){
    mint x=1;mint y=1;
    rep(i,a){
        x*=n-i;
    }
    Rep(i,a+1){
        y*=i;
    }
    return x/y;
}


ll m=1000000007;

int main()
{ 
  ll n,a,b;
  cin>>n>>a>>b;
  mint ans=f(n);
  ans-=1;
  ans-=choose(n,a);
  ans-=choose(n,b);
  cout<<ans<<endl;
}
 
 




Measured memory_bytes: 27032
def main():
    X, Y = map(int, input().split())

    grp1 = [1, 3, 5, 7, 8, 10, 12]
    grp2 = [4, 6, 9, 11]

    if X in grp1 and Y in grp1:
        ans = 'Yes'
    elif X in grp2 and Y in grp2:
        ans = 'Yes'
    else:
        ans = 'No'

    print(ans)

main()


Measured memory_bytes: 3060
def main(input = STDIN)
  a = input.gets.to_i
  b = input.gets.to_i
  c = input.gets.to_i
  d = input.gets.to_i
  e = input.gets.to_i
  x = lambda{|l|return l * a}
  y = lambda{|l|
    if l > c
      return b + d * (l - c)
    else
      return b
    end
  }
  puts (x.call(e) > y.call(e)) ? y.call(e):x.call(e)
end
main

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




int main(){
  int n; cin>>n;
  vector<int>a(n);
  int ans = 0;
  rep(i,n){
    cin>>a[i];
    if(a[i]%2==0){
      if(a[i]%3!=0 && a[i]%5!=0){
        ans++;
      }
    }
  }

  if(ans==0){
    cout<<"APPROVED"<<endl;
  }else{
    cout<<"DENIED"<<endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int h, w;
int cost[10][10];

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

  cin >> h >> w;

  REP(i, 10) REP(j, 10) cin >> cost[i][j];
  REP(k, 10) REP(i, 10) REP(j, 10) cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);

  int ans = 0;
  REP(i, h) REP(j, w) {
    int a;
    cin >> a;
    if(a != -1 && a != 1) {
      ans += cost[a][1];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#coding:utf-8
import sys
import bisect
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]


    n = II()
    a = 1

    for  i in range(2, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            a = i

    print(a + n//a - 2)




if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
 
static const double EPS = 1e-8;

static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

class Domino {
private:
  int _head;
  int _tail;
public:
  Domino(int head, int tail) {
    _head = head;
    _tail = tail;
  }

  int detect_connect_pattern(Domino d) {
    int res = 0;
    if(d.get_head() == _head){
      return (res | (1<<0));
    }
    if(d.get_head() == _tail){
      return (res | (1<<1));
    }
    if(d.get_tail() == _head){
      return (res | (1<<2));
    }
    if(d.get_tail() == _tail){
      return (res | (1<<3));
    }
    return res;
  }

  Domino connect(Domino d,int pattern){
    if(pattern == (1<<0)){
      return Domino(d.get_tail(),_tail);
    }
    if(pattern == (1<<1)){
      return Domino(d.get_tail(),_head);
    }
    if(pattern == (1<<2)){
      return Domino(d.get_head(),_tail);
    }
    if(pattern == (1<<3)){
      return Domino(d.get_head(),_head);
    }
    return *this;
  }

  int get_head() const{
    return _head;
  }

  int get_tail() const{
    return _tail;
  }
};

bool dp[1<<22];

bool dfs(Domino& current_state,int visited, const vector<Domino>& dominos){
  if(dp[visited]) return false;
  if(visited == (1<<dominos.size()) - 1){
    return true;
  }

  int res = false;
  for(int i = 0; i < dominos.size(); i++){

    if(visited & (1<<i)) continue;
    int pattern;
    if((pattern = current_state.detect_connect_pattern(dominos[i])) == 0) continue;
    Domino next = current_state.connect(dominos[i],pattern);
    res |= dfs(next,visited | (1<<i),dominos);
    dp[visited | (1<<i)] = true;
  }
  return res;
}

int main(){
  int n;
  while(~scanf("%d",&n)){
    vector<Domino> dominos;
    memset(dp,false,sizeof(dp));

    int same_head_tail = 0;
    for(int i = 0; i < n; i++){
      char domino[8];
      scanf("%s",domino);
      if(domino[0] - '0' == domino[1] - '0'){
        same_head_tail |= (1 << (domino[1] - '0'));
        continue;
      }
      dominos.push_back(Domino(domino[0] - '0',domino[1] - '0'));
    }

    bool same_check = true;
    for(int num = 0; num <= 6; num++){
      if(same_head_tail & (1 << num)){
        bool isok = false;
        for(int i = 0; i < dominos.size(); i++){
          if(dominos[i].get_tail() == num
             || dominos[i].get_head() == num){
            isok = true;
          }
        }
        if(!isok){
          same_check = false;
          break;
        }
      }
    }

    bool travel_check = false;
    travel_check = dfs(dominos[0],(1<<0),dominos);
    printf("%s\n",((same_check && travel_check) || (n == 1)) ? "Yes" : "No");
  }
}

Measured memory_bytes: 5272
#include<stdio.h>
int main(void)
{
    int s1,s2,s3;
  
    scanf("%d%d%d",&s1,&s2,&s3);
  
    if((s1==s2)&&(s2==s3)) printf("No\n");
    else if((s1!=s2)&&(s2!=s3)&&(s1!=s3)) 
      printf("No\n");
    else printf("Yes\n");
  
    return 0;
}

Measured memory_bytes: 1660