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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean ans = true;
		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if(a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)) {
				ans = false;
			}
		}
		System.out.println(ans ? "APPROVED" : "DENIED");

	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define N	 100
void solve(){
	ll  a, b;
	cin>>a>>b;
	if(a%2==0 || b%2==0) cout<<"Even"<<endl;
	else cout<<"Odd"<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
n = int(input())
b = list(map(int,input().split()))
a =[0]*n
goukei = 0

a[0]=b[0]
a[n-1]=b[-1]

for i in range (n-2):
    if b[i]<=b[i+1]:
        a[i+1]=b[i]
    else:
        a[i+1]=b[i+1]

for k in range (n):
    goukei += a[k]
print(goukei)


Measured memory_bytes: 3064
package main

import (
  "fmt"
)

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

  flag := true
  for flag {
    for i := 0; i < n; i++ {
      if a[i] % 2 == 0 {
        a[i] /= 2
      } else {
        flag = false
      }
    }
    if flag {
      ans++
    }      
  }
  fmt.Println(ans)
}

Measured memory_bytes: 512
import Foundation

let n = Int(readLine()!)!
let s = readLine()!
var ss: [String] = []
var ans = 0
s.forEach { ss.append(String($0)) }
for i in 0..<n-1 {
  let s1 = ss[0...i]
  let s2 = ss[i+1...n-1]
  ans = max(Set(s1).intersection(Set(s2)).count, ans)
}
print(ans)

Measured memory_bytes: 13480
N = int(input())
a_s = list(map(int, input().split()))

count = 0
for a in a_s:
    a_tmp = a
    while True:
        if a_tmp == 0:
            break
        elif a_tmp % 2 == 0:
            count += 1
            a_tmp /= 2
        else:
            break
print(count)


Measured memory_bytes: 4148
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n, y;
    cin >> n >> y;
    for(int i = 0; i <= n; i++){
        for(int k = 0; k <= (n - i); k++){
            if(y == 10000 * i + 5000 * k + (n - k - i) * 1000){
                cout << i << " " << k << " " << n - k - i << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    
    return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    pair <int, int> works[n];
    for (int tsumugi = 0; tsumugi < n; tsumugi++){
        cin >> works[tsumugi].first >> works[tsumugi].second;
    }

    sort(works, works + n);

    //最終日の前日から考察する
    int reward = 0;
    priority_queue <int> queue;
    int index = 0;
    for (int remainDays = 1; remainDays <= m; remainDays++){
        while (works[index].first == remainDays){
            queue.push(works[index].second);
            index++;
        }
        if(!queue.empty()){
            reward += queue.top();
            // cout << "remain days:" << remainDays << endl;
            // cout << "top:" << queue.top() << endl;
            // cout << "size:" << queue.size() << endl;
            queue.pop();
            // cout << "poped size:" << queue.size() << endl;
        }
    }    

    cout << reward << endl;
    return 0;
}

Measured memory_bytes: 1660
#include "bits/stdc++.h"

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    int ans = int(1e9);
    for (char c = 'a'; c <= 'z'; ++c) {
        string t = s;
        for (int it = 0; ; ++it) {
            if (t.empty()) break;
            if (t == string(t.length(), c)) {
                ans = min(ans, it);
                break;
            }
            string nw = "";
            for (int i = 0; i < t.length() - 1; ++i) {
                if (t[i] == c || t[i + 1] == c) {
                    nw += c;
                } else {
                    nw += t[i];
                }
            }
            t = nw;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
// 連鎖行列積 問題
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100
#define ELE_NUM 2
// 無効な値の定義
const int INV = -1;

const int colNo = 0;
const int rowNo = 1;
const int IntMAX = 	2147483647;

int ChainedMatrixtMultiplication(int n, int m, int matrixData[][ELE_NUM]);

int main(void)
{

    int n, count;
    int matrix_data[MAX_N + 1][ELE_NUM];

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        // 行
        cin >> matrix_data[i][colNo];
        // 列
        cin >> matrix_data[i][rowNo];
    }

    count = ChainedMatrixtMultiplication(n, ELE_NUM, matrix_data);
    printf("%d\n", count);

    return 0;
}

// 連鎖行列積の最小の乗算回数を演算する関数
// n : 積を求める行列の数
// m : 行列の情報 : 0 - 行の情報, 1 - 列の情報
// matrixData[][] : 各行列の行、列情報を保持する配列
int ChainedMatrixtMultiplication(int n, int m, int matrixData[][ELE_NUM])
{

    // 第1要素 : 演算開始のNo., 第2要素 : 演算終了のNo.
    int dp[MAX_N + 1][MAX_N + 1];
    int calcResult = 0;

    // 配列の初期化
    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= n; j++)
        {
            // 無効値の代入
            dp[i][j] = INV;

            if( i == j )
            {
                // 同じ要素同士の積は演算することが不可能
                dp[i][j] = 0;
            }
        }
    }

    // 行列の演算回数の計算
    // i : 演算対象の先頭の要素No.
    // j : 演算対象の最後の要素No.
    // k : i 〜 jまでの範囲を移動する変数
    // l : 演算対象とする行列の数 ( 2 〜 n 個まで )
    for(int l = 2; l <= n; l++)
    {
        for(int i = 1; i <= n - l + 1; i++)
        {
            int j = i + l - 1;
            // 最小値を求めるために, 仮に最大値を入れておく
            dp[i][j] = IntMAX;

            for(int k = i; k <= j - 1; k++)
            {
                // 要素が2つの時は, 式の後半の部分のみで演算する
                calcResult = dp[i][k] + dp[k + 1][j]
                            + ( matrixData[i][colNo] * matrixData[k][rowNo] * matrixData[j][rowNo]);

                dp[i][j] = min( dp[i][j], calcResult );
            }
        }
    }

    return dp[1][n];
}



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

int main(){
  string s;
  cin >> s;
  if(s == "000"){
    cout << 0 << endl;
  }else if(s == "100" || s == "010" || s == "001"){
    cout << 1 << endl;
  }else if(s == "110" || s == "101" || s == "011"){
    cout << 2 << endl;
  }else if(s == "111"){
    cout << 3 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

const int st[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1};

int calc_start(int begin, int end)
{
    if (begin <= 5 && end < begin){
        return ((15 - begin) % 15);
    }
    else {
        return (begin);
    }
}

int main(void)
{
    int n;
	int begin, end;
	int i;
    
    scanf("%d", &n);
    while (n-- > 0){
        scanf("%d %d", &begin, &end);
        for (i = calc_start(begin, end); st[i] != end; i = (i + 1) % 15){
            printf("%d ", st[i]);
        }
        printf("%d\n", end);
    }
    
    return (0);
}

Measured memory_bytes: 600
#include<stdio.h>
int main() {
	int N;
	int a, b, c, d;
    int bresult = 0;
	scanf("%d", &N);
 
	a = N / 1000;
	b = (N - 1000 * a) / 100;
	c = (N - 1000 * a -100*b) / 10;
	d = N - (1000 * a + 100 * b + 10 * c);
 
	if ((b == c) && ((a == b) || (c==d))) {
		bresult = 1;
	}
 
	printf("%s\n", (bresult==1) ? "Yes" : "No");
 
	return 0;
}

Measured memory_bytes: 128
import std.stdio;
import std.conv;
import std.cstream;
import std.string;
import std.algorithm;

int Map[20][20];
int ms,wp;

int[] dx3 = [0,1,2,1,1,0,0,0,0,-1,-2,-1,-1];
int[] dy3 = [0,0,0,-1,1,-1,-2,1,2,0,0,1,-1];

int[] dx2 = [0,-1,-1,0,1,1,1,0,-1];
int[] dy2 = [0,0,-1,-1,-1,0,1,1,1];

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


void main(){
int x,y,size;
for(int i;i<20;i++)for(int j;j<20;j++)Map[i][j]=0;
wp = 100;


while(scanf("%d,%d,%d",&x,&y,&size) != EOF)transaction(x,y,size);
printf("%d\n%d\n",wp,ms);

}

void transaction(int x,int y,int size){
if(size == 3){
  for(int i;i<dx3.length;i++){
    if(0<=y+dy3[i] && y+dy3[i]<10 && 0<=x+dx3[i] && x+dx3[i] < 10){
      if(Map[y+dy3[i]][x+dx3[i]] == 0)wp--;
      Map[y+dy3[i]][x+dx3[i]]+=1;
      if(ms < Map[y+dy3[i]][x+dx3[i]])ms = Map[y+dy3[i]][x+dx3[i]];
    }
  }
}
else if(size == 2){
  for(int i;i<dx2.length;i++){
    if(0<=y+dy2[i] && y+dy2[i]<10 && 0<=x+dx2[i] && x+dx2[i] < 10){
      if(Map[y+dy2[i]][x+dx2[i]] == 0)wp--;
      Map[y+dy2[i]][x+dx2[i]]+=1;
      if(ms < Map[y+dy2[i]][x+dx2[i]])ms = Map[y+dy2[i]][x+dx2[i]];
    }
  }
}else{
  for(int i;i<dx.length;i++){
    if(0<=y+dy[i] && y+dy[i]<10 && 0<=x+dx[i] && x+dx[i] < 10){
      if(Map[y+dy[i]][x+dx[i]] == 0)wp--;
      Map[y+dy[i]][x+dx[i]]+=1;
      if(ms < Map[y+dy[i]][x+dx[i]])ms = Map[y+dy[i]][x+dx[i]];
    }
  }
}
}

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

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

typedef long long LL;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> Rr(n+1,0),Lr(n+1,0);
  for(int i=1;i<=n;i++){
    if(s[i-1]=='>'){
      Rr[i]=Rr[i-1]+1;
      Lr[i]=Lr[i-1];
    }else{
      Rr[i]=Rr[i-1];
      Lr[i]=Lr[i-1]+1;
    }
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(s[i-1]=='>'){
      if(Rr[i]>Lr[n]-Lr[i]){
        ans=max(ans,n-(lower_bound(Rr.begin(),Rr.end(),Rr[i]-(Lr[n]-Lr[i]))-Rr.begin())+1);
        //cout << n-(lower_bound(Rr.begin(),Rr.end(),Rr[i]-(Lr[n]-Lr[i]))-Rr.begin())+1 << endl;
      }else{
        ans=max(ans,lower_bound(Lr.begin(),Lr.end(),Rr[i]+Lr[i])-Lr.begin());
        //cout << lower_bound(Lr.begin(),Lr.end(),Rr[i]+Lr[i])-Lr.begin() << endl;
      }
    }else{
      if(Rr[i-1]>=Lr[n]-Lr[i-1]){
        ans=max(ans,n-(lower_bound(Rr.begin(),Rr.end(),Rr[i-1]-(Lr[n]-Lr[i-1])+1)-Rr.begin()-1));
        //cout << n-(lower_bound(Rr.begin(),Rr.end(),Rr[i-1]-(Lr[n]-Lr[i-1])+1)-Rr.begin()-1) << endl;
      }else{
        ans=max(ans,lower_bound(Lr.begin(),Lr.end(),Rr[i-1]+Lr[i-1]+1)-Lr.begin());
        //cout << lower_bound(Lr.begin(),Lr.end(),Rr[i-1]+Lr[i-1]+1)-Lr.begin() << endl;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3996
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MAX_N 112345
#define MOD 1000000007
#define EPS 1e-9
 
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::queue;
using std::priority_queue;
using std::stack;
using std::map;
using std::pair;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

struct Trie{
    int max_index, n;
    vector< vector<int> > tree;
    vector<int> depth;

    Trie(){
        max_index = 0;
        n = 1;
        tree = vector< vector<int> >(MAX_N, vector<int>(2, -1));
        depth = vector<int>(MAX_N);
        depth[0] = 0;
    }

    int add(string s){
        int parent = 0;
        rep((int)s.length()){
            if(s[i] == '0'){
                if(tree[parent][0] == -1){
                    tree[parent][0] = ++max_index;
                    depth[max_index] = depth[parent] + 1;
                }
                parent = tree[parent][0];
            }else{
                if(tree[parent][1] == -1){
                    tree[parent][1] = ++max_index;
                    depth[max_index] = depth[parent] + 1;
                }
                parent = tree[parent][1];
            }
        }
        n = max_index + 1;
        return parent;
    }
};

ll grundy(ll l, ll d){
    return (l-d) & (d-l);
}

int main(){
    int n;
    ll l;
    string s;
    cin >> n >> l;

    Trie t = Trie();
    rep(n){
        cin >> s;
        t.add(s);
    }

    ll game = 0;
    rep(t.n){
        if((t.tree[i][0] == -1) ^ (t.tree[i][1] == -1)){
            game ^= grundy(l, t.depth[i]);
        }
    }

    if(game){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
    return 0;
}


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

int main(void)
{
  int N;
  cin >> N;
  double T, A;
  cin >> T >> A;
  double min = 20000;
  int t;
  for(int i = 0; i < N; i++){
    double x;
    cin >> x;
    if(abs(A - (T - x * 0.006)) < min){
      t = i+1;
      min = abs(A - (T - x * 0.006));
    }
  //cout << abs(A - (T - x * 0.006)) << endl;
  }
  cout << t << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: i64
    }
    let mut v = pfacnum(n);
    let mut ans = 0i64;
    for mut count in v {
        for i in 1.. {
            count -= i;
            if count < 0 {
                break;
            }
            ans += 1;
        }
    }
    println!("{}", ans);

}

fn pfacnum(mut n: i64) -> Vec<i64> {
    let mut p = 2i64;
    let mut v = Vec::new();
    while p*p <= n {
        let mut count = 0;
        while n%p == 0 {
            count += 1;
            n /= p;
        }
        if count != 0 {
            v.push(count);
        }

        if p == 2 {
            p += 1;
        } else {
            p += 2;
        }
    }
    if n != 1 {
        v.push(1);
    }
    v.sort();
    v
}

Measured memory_bytes: 2200
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
using ll = long long;
const int M = 100010;

int main() {
	string s1,s2;
	int c=0;

	while(1){
		cin>>s1;
		if(s1==".")break;
		cin>>s2;
		bool flag=false;	// " が奇数個目? y:true/n:false;
		c=0;	//" "の中が違う状態の数;
		int tmp1=0;	//s1の検索位置をずらして補正;
		int tmp2=0;	//s2の検索位置をずらして補正;
		for(int i=0;i+tmp1<s1.size()||i+tmp2<s2.size();i++){
			//" "の中以外で異なる文字があった場合;
			if(flag==false&&s1[i+tmp1]!=s2[i+tmp2]){
				cout<<"DIFFERENT"<<endl;
				flag=true;
				break;
			}
			//" "の中でs1とs2の文字が異なる場合;
			//tmp1,tmp2を使って個数を補正する;
			if(flag&&s1[i+tmp1]!=s2[i+tmp2]){
				c++;
				for(int j=0;;j++)
					if(s1[i+tmp1+j]=='"'){
						tmp1+=j;
						break;
					}
				for(int j=0;;j++){
					if(s2[i+tmp2+j]=='"'){
						tmp2+=j;
						break;
					}
				}
				//" "の中をスキップして、次は偶数個目の " の次の文字から探索;
				flag=false;
				continue;
			}
			//奇数個目の " が来た場合,flagを立てる;
			if(!flag&&s1[i+tmp1]=='"'){
				flag=true;
				continue;
			}
			//偶数個目の " が来た場合,flagを立てない;
			if(flag&&s2[i+tmp2]=='"')flag=false;
		}
		if(flag)continue;
		if(c==1)
			cout<<"CLOSE"<<endl;
		else if(c==0)
			cout<<"IDENTICAL"<<endl;
		else 
			cout<<"DIFFERENT"<<endl;
	}
	return 0;
}


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

int main(){
    vi a(3);
    rep(i,3)cin>>a[i];
    rep(i,3){
        if(a[i]%2==0)continue;
        cout << 0 << endl;
        return 0;
    }
    
    sort(a.begin(), a.end());
    
    vi b(2);
    rep(i,2){
        b[i] = a[i+1] - a[i];
    }
    
    sort(b.begin(), b.end());
    
    if(b[1]==0){
        cout << -1 << endl;
        return 0;
    }
    
    int ans = 0;
    
    if(b[0]==0){
        while(b[1]%2==0){
            ans++;
            b[1] /= 2;
        }
    }else{
        
        while(b[1]%b[0]!=0){
            b[1] %= b[0];
            swap(b[1],b[0]);
        }
        while(b[0]%2==0){
            ans++;
            b[0] /= 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
char s[107];
void maxs(int&a,int b){if(a<b)a=b;}
void mins(int&a,int b){if(a>b)a=b;}
int main(){
	scanf("%s",s);
	int l=strlen(s),ans=1000000;
	for(int i='a';i<='z';++i){
		int pv=0,mx=0;
		for(int j=0;j<l;++j)if(s[j]==i){
			maxs(mx,j-pv);
			pv=j+1;
		}
		maxs(mx,l-pv);
		mins(ans,mx);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(N*M - 2)
elif M == 1:
    print(N*M - 2)
else:
    print(N*M - (N*2) - (M*2) + 4)

Measured memory_bytes: 38256
import bisect
from collections import defaultdict
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
C=[]
D=defaultdict(list)
for i in range(m):
  p,y=map(int,input().split())
  C.append([p,y])
  D[p].append(y)
for k in D.keys():
  D[k].sort()
for i in range(m):
  y=bisect.bisect_left(D[C[i][0]],C[i][1])+1
  print(str(C[i][0]).zfill(6)+str(y).zfill(6))

Measured memory_bytes: 38556
#include <iostream>
#include <vector>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

signed main() {
    int N;
    vector<int> A(5);
    cin >> N;
    rep(i, 5) cin >> A[i];
    
    int M = 0;
    rep(i, 5) M = max(M, (N - 1) / A[i]);
    cout << 5 + M << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

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

count = 0
for tuple in itertools.combinations(L, 3):
    a, b, c = list(tuple)
    if tuple[0]!=tuple[1] and tuple[1]!=tuple[2] and tuple[2]!=tuple[0]:
        if a+b>c and b+c>a and c+a>b:
            count += 1 
print(count)


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long ll;

int main(int argc, char* argv[])
{
  int N;
  std::cin >> N;

  std::vector< ll > va(N, 0);
  for (int i = 0; i < N; i++) {
    std::cin >> va[i];
  }

  std::sort(va.begin(), va.end());
  std::cout << va[N-1] - va[0] << std::endl;
  return 0;
}


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

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

    map<char, bool> m;
    m['A'] = true;
    m['T'] = true;
    m['C'] = true;
    m['G'] = true;

    int ans = 0, cnt = 0, maxw = -1;
    for(int i = 0; i < s.size(); i++){
        if(m[s[i]] == true){
            cnt++;
            ans = max(cnt, ans);
        }else{
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    R,G,B,N=map(int,input().split())
    cnt=0
    for r in range(N+1):
        for g in range(N+1):
            val=(N-R*r-G*g)/B
            if val==int(val) and val>=0:
                cnt+=1
    print(cnt)

resolve()

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

int main() {	
	int a, b;
	cin >> a >> b;
	
	int d = a / b;
	int r = a % b;
	double f = (double)a / b;
	
	cout << fixed << setprecision(5);
	cout << d << " " << r << " " << f << endl;
	
	return 0;
}


Measured memory_bytes: 3268
import java.util.*

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    var maxIndex = 0;
    var secondMax = 0;
    var max = 0;
    (1..n).forEach{ i ->
        val v = sc.nextInt();
        if(v > max){ 
          secondMax = max; 
          max = v;
          maxIndex = i;
        }
        else if(v > secondMax){
          secondMax = v;
        }
    }
  
    (1..maxIndex-1).forEach{ i->
        println(max);
    }
    println(secondMax);
    (maxIndex+1..n).forEach{ i->
        println(max);
    }
}


Measured memory_bytes: 80556
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define pb push_back
#define maxn 200005
int n,m,a,b,c,x,y,z,i,j,k;
vector<pair<int,int>> tree[maxn];
int weight[maxn];
void dfs(int vertex , int par){
    for(auto child : tree[vertex]){
        if(child.first == par)
            continue ;
        weight[child.first] = child.second + weight[vertex];
        dfs(child.first,vertex);
    }
}
void solve(){
    cin >> n ;
    int u,v,w ;
    for(int i=0;i<n-1;i++){
        cin >> u >> v >> w ;
        tree[u].pb(make_pair(v,w));
        tree[v].pb(make_pair(u,w));
    }
    dfs(1,0);
    for(int i=1;i<=n;i++){
        if(weight[i]%2==0)
            cout << 0 << endl ;
        else cout << 1 << endl ;
    }
}
signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}



Measured memory_bytes: 12544
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int t1,t2;
	t1=a;
	a=b;
	b=t1;
	t2=a;
	a=c;
	c=t2;
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
	
	
}


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

int main(int argc, char const *argv[])
{
	int d,n;
	cin>>d>>n;
	if (n==100)
	{
		n=101;
	}
	for (int i = 0; i < d; ++i)
	{
		n*=100;
	}
	cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

int main(){
    int N;
    cin >> N;
    int n=0;
    int ans=1;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        if(s=="A"){
            n++;
        }else{
            n--;
        }
        if(n<0){
            ans=0;
        }
    }
    if(n!=0){
        ans=0;
    }
    
    cout << (ans?"YES":"NO")<<endl;
    return 0;
}






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

const int MAX = 3e4;

int N;
vector <int> v;

bool good(int x) {
	return !(x % 2) || !(x % 3);
}

bool check() {
	int g = 0, tot = 0;
	for (auto it : v) {
		g = __gcd(g, it);
		tot += it;
	}
	
	if (g > 1)
		return false;
	
	for (auto it : v)
		if (__gcd(it, tot) == 1)
			return false;
	
	return true;
}

int main() {
	scanf("%d", &N);
	
	if (N == 3) {
		puts("2 5 63");
		return 0;
	}
	
	int i = 1, sum = 0;
	for (; i <= MAX && v.size() < N - 2; i++)
		if (good(i)) {
			v.push_back(i);
			sum += i;
		}
		
	int limit = min(MAX, i + 5);
	for (int a = i; a <= limit; a++)
		for (int b = a + 1; b <= limit; b++)
			if (good(a) && good(b) && !((sum + a + b) % 6)) {
				v.push_back(a);
				v.push_back(b);
				assert(check());
				for (auto it : v)
					printf("%d ", it);
				puts("");
				return 0;
			}
			
	return 0;
}

Measured memory_bytes: 512
n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

x = factorization(n) 

if n ==1:
    print(0)
    exit()

res = 0

for i in x:
    temp = 0
    for j in range(1,100):
        temp += j
        if i[1] < temp:
            res += (j-1)
            break

print(res)

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

x = a[0]
cnt = 0
ans = 0
for i in range(n):
    if x == a[i]:
       cnt += 1
    else:
        if cnt < x:
            ans += cnt
        else:
            ans += cnt - x
        x = a[i]
        cnt = 1

if cnt < x:
    ans += cnt
else:
    ans += cnt - x

print(ans)

Measured memory_bytes: 63984
#include<stdio.h>

int main(void){
  int i,num;
  int score[20];
  int swp,swpflag;
  int wscore,kscore;

  for(i=0;i<20;i++){
    scanf("%d",&score[i]);
  }

  for(;;){
    swpflag=0;
    for(i=0;i<9;i++){
      if(score[i]<score[i+1]){
        swpflag=1;
        swp=score[i];
        score[i]=score[i+1];
        score[i+1]=swp;
      }
    }
    if(swpflag==0)
      break;
  }
  for(;;){
    swpflag=0;
    for(i=10;i<19;i++){
      if(score[i]<score[i+1]){
        swpflag=1;
        swp=score[i];
        score[i]=score[i+1];
        score[i+1]=swp;
      }
    }
    if(swpflag==0)
      break;
  }

  wscore=0;
  for(i=0;i<3;i++){
    wscore+=score[i];
  }
  kscore=0;
  for(i=10;i<13;i++){
    kscore+=score[i];
  }

  printf("%d %d\n",wscore,kscore);

  return 0;
}

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

using namespace std;

int n;
string s, t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s >> t;
  int foo = 0, bar = 0, final = 0;
  queue<int> q;
  for (int i = n - 1, j, k = n - 1; ~i; i = j) {
    j = i;
    while (~j && t[j] == t[i]) {
      --j;
    }
    k = min(k, j + 1);
    while (~k && s[k] != t[i]) {
      --k;
    }
    if (!~k) {
      cout << -1 << '\n';
      exit(0);
    }
    if (j + 1 == k) {
      for (int l = j + 1; l <= i; ++l) {
        if (s[l] != t[l]) {
          final = 1;
        }
      }
      while (q.size()) {
        q.pop();
      }
      bar = 0;
    } else {
      final = 1;
      while (!q.empty() && q.front() >= j + 1 + q.size()) {
        q.pop();
      }
      q.push(k);
      foo = max(foo, bar = q.size());
    }
  }
  cout << foo + final << '\n';
  return 0;
}

Measured memory_bytes: 6300
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int answer = 0;
    if(n%111==0){
      System.out.println(n);
    }else{
    answer = (n/111)+1;
    answer = answer * 111;
    System.out.println(answer);
    }
  }
  

  
}

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

int main()
{
	int a,b;

	for(int i=1;;i++){
		cin >> a >> b;

		if(a==0 && b==0)
			break;

		if(a <= b)
			cout << a << " " << b << endl;

		else if(a > b)
			cout << b << " " << a << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc, out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] a = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		int fill = a[k-1];
		
		int res = 0;
		
		for(int i = k-1; i < n; i+=k-1) {
			for(int j = i-(k-1); j <= i; j++) {
				a[j] = fill;
			}
			res++;
		}
		
		//Arrays.stream(a).forEach(out::println);
		//out.println("res: " + res);
		
		for(int i = 1; i< n; i++) {
			if(a[i] != a[i-1]) {
				res++;
				break;
			}
		}
		
		out.println(res);
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

    public double nextDouble() {
         return Double.parseDouble(next());
     }

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

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

Measured memory_bytes: 32724
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  string s;
  cin>>s;
  int n=s.size();
  int ans=1000;
  int temp;
  int digit;
  REP(i,n-2){
    temp = 0;
    REP(j,3){
      temp *= 10;
      digit = s[i+j]-'0';
      temp += digit;
    }
    ans = min(ans,abs(753-temp));
  }
  cout<<ans<<endl;
  return 0;
}


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

#define MAX_V 10000000
#define MAX_E 10000000
#define INF 1111111111
struct edge{int from,to,cost;};

edge es[MAX_E]; 
int d[MAX_V]; 
int V=202,E;

bool find_negative_loop(){
  memset(d,0,sizeof(d));
  for(int i=0;i<V;i++){
    for(int j=0;j<E;j++){
      edge e=es[j];
      if(d[e.to]>d[e.from]+e.cost){
	d[e.to]=d[e.from]+e.cost;
	if(i==V-1)return true;
      }
    }
  }  
  return false;
}


signed main(){
  cin>>E;
  for(int i=0;i<E;i++){
    int u,d;
    string a;
    cin>>u>>a>>d;
    if(a[0]=='w')es[i]=(edge){u,d+101,-1};
    else es[i]=(edge){d+101,u,-1};
  }
  cout<<find_negative_loop()<<endl;
  return 0;
}



Measured memory_bytes: 42280
#include<iostream>

using namespace std;

int main() {
	int N, M;

	cin >> N;

	M = N % 10;
	if (M == 2 || M == 4 || M == 5 || M == 7 || M == 9) {
		cout << "hon" << endl;
	}
	else if (M == 0 || M == 1 || M == 6 || M == 8) {
		cout << "pon" << endl;
	}
	else if (M == 3) {
		cout << "bon" << endl;
	}

	return 0;
}

Measured memory_bytes: 3636
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  while(q--) {
    ll a, b;
    cin >> a >> b;
    if(a > b) swap(a, b);
    if(a+1 == b or a == b) {
      cout << 2*a-2 << '\n';
      continue;
    }
    ll c = sqrt(ll(a)*b);
    if(c*c == a*b) c--;
    if(c*(c+1) >= ll(a)*b) {
      cout << 2*c-2 << '\n';
    } else {
      cout << 2*c-1 << '\n';
    }
  }
}

Measured memory_bytes: 3684
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//
		int n = sc.nextInt();
		String result = "No";
		loop:
		for(int i=1; i<10; i++){
			for(int j=1; j<10; j++){
				if(i * j == n){
					result = "Yes";
					break loop;
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 35588
#include <bits/stdc++.h>
 
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, a, n) for(int i = a; i < n; i++)
#define PI 3.141592653589793238
#define bc __builtin_popcountll
#define pf push_front
#define pb push_back
#define rf pop_front
#define rb pop_back
#define fs first
#define sc second
#define mp make_pair
#define fi ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
const ll M = 1e9 + 7;
const ll INF = 1e9;
inline ll pwr(ll base, ll n, ll m) {ll ans = 1;while( n > 0 ) {if ( n & 1 ) ans = (ans * base) % m; base = (base * base) % m; n>>=1;}return ans;}
 
const int N = 1001;
 
int main() {
    fi;
    
    // #ifndef ONLINE_JUDGE
    // freopen( "input.txt", "r", stdin );
    // freopen( "output.txt", "w", stdout );
    // #endif
     
    int n;
    cin >> n;
    int a[n][n-1], b[n], c[n];
    
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    
    loop(i, n) {
        loop(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
 
    int day = 0, matches = 0, req = (n*(n-1))/2;
    
    while(true) {
        day++;
        int f = 0;
 
        loop(i, n) {
            if( b[i] == n-1 || c[i] == day) continue;
            
            int choice1 = a[i][b[i]];
            int choice2 = a[choice1][b[choice1]];
 
            if( choice2 == i && c[choice1] != day) {
                f = -1;
                c[choice1] = day;
                c[i] = day;
                b[choice1]++;
                b[i]++;
                // cout << i+1 << " " << choice1 + 1 << ":: ";
                matches++;
            }
        }
        // cout << "\n";
        if( matches == req ) break;
        if( f == 0 ) {
            cout << -1;
            return 0;
        }
    }
 
    cout << day;
 
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

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

const int mod = 1000000007;

int counts[200005];

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

  int n;
  cin >> n;

  rep(i, n) {
    int a;
    cin >> a;
    counts[a]++;
  }

  int amari = 0;
  int shurui = 0;
  sort(counts, counts + 200001, greater<int>());
  
  int i = 0;
  while(counts[i] >= 2) {
    amari+=counts[i]-1;
    i++;
  }
  i = 0;
  while(counts[i] >= 1) {
    shurui++;
    i++;
  }

  cout << shurui - (amari%2?1:0) << endl;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

#define ll long long
#define double long double
#define FOR(i,a,b) for(long i = a; i <= b; i++)
#define FOD(i,b,a) for(long i = b; i >= a; i--)

#define DEBUG(x) cerr << #x << " = " << x << endl

#define mod 1000000007

int main(){
	ios_base::sync_with_stdio(0);
	ll n, cnt = 0, cnt2 = 0;
	string s, rs = "";
	
	cin >> n >> s;
	
	FOD(i,s.size()-1,0){
		if (s[i] == ')') cnt++;
		if (cnt > 0 && s[i] == '(') cnt--;
	}
	while(cnt!=0) s = "("+s, cnt--;
	FOR(i,0,s.size()-1) if (s[i] == '(') cnt2++; else cnt2--;
	while(cnt2!=0) s = s + ")",cnt2--;
	cout << s;
	return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using ll = long long;
using namespace std;
const ll MM = 1000000000;
const ll mod = MM + 7;
int main(){
    string s; cin >> s;
    int ans = 1000;
    int num;
    int diff;
    for(int i = 0; i < s.size() -2; i++){
        num = (s[i] -'0')*100 + (s[i+1] - '0')*10 + (s[i+2] -'0');
        diff = abs(num - 753);
        if(ans > diff){
            ans = diff;
        }
    }
    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);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];
		for (int i = 0; i < values.length; i++) {
			values[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			// a??¨b????????£???values??????????????????
			int c = values[a];
			values[a] = values[b];
			values[b] = c;
		}
		// values?????????
		for (int i = 0; i < values.length; i++) {
			System.out.println(values[i]);
		}
	}
}

Measured memory_bytes: 25836
x,n= map(int,input().split())
p = list(map(int,input().split()))
ans=0
i=0
while True:
    if x-i not in p:
        ans=x-i
        break
    elif x+i not in p:
        ans=x+i
        break
    else:
        i+=1
        continue
print(ans)

Measured memory_bytes: 61808
package main

import (
	"fmt"
)

const mod = 1000000007

var fac, finv, inv []int

func initCmb(x int) {
	fac, finv, inv = make([]int, x+1), make([]int, x+1), make([]int, x+1)
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1
	for i := 2; i <= x; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func cmb(x, y int) int {
	if y > x {
		return 0
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	initCmb(max(n-k+1, k-1))
	for i := 1; i <= k; i++ {
		fmt.Println(cmb(n-k+1, i) * cmb(k-1, i-1) % mod)
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.14159265
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	// ld i,j,k,l,a,b,x;
	// cin>>a>>b>>x;

	// ld h=x/(a*a);
	// cout<<a<<" "<<h<<endl;
	// ld ang=((b-h)/(a/(ld)2.0));
	// cout<<ang<<endl;
	// ld result = atan(ang)*180/PI;
	// cout<<result;

	ll i,j,k,l,n,v;
	cin>>n>>v;
	ll ar[n+1],fr[n+1];
	multiset<ll> st;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		st.insert(ar[i]);
	}
	for(i=1;i<=n;i++){
		cin>>fr[i];
	}

	sort(fr+1,fr+n+1,greater<ll>());
	sort(ar+1,ar+n+1);
	if(n==1){
		ar[1]=max((ll)0,ar[1]-k);
		cout<<ar[1]*fr[1];
		return 0;
	}

	ll a,b,mid,an=-1;
	a=0; b=2e18;
	while(b>=a){
		ll x=2;
		mid=(a+b)/x;

		ll cur=0;
		for(i=1;i<=n;i++){
			if(ar[i]*fr[i]>mid){
				cur+=ar[i]-mid/fr[i];
			}
		}
		if(v>=cur){
			an=mid;
			b=mid-1;
		}
		else a=mid+1;
	}
	cout<<an;
	return 0;
}

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

int NG() {
    cout << -1 << "\n";
    return 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<long long> A(N);
    long long XOR = 0;
    for (auto &x: A) {
        cin >> x; XOR ^= x;
    }
    long long X = A[0], Y = A[1];
    XOR ^= X ^ Y;
    long long AND = X + Y - XOR;
    if (AND % 2) return NG();
    else AND /= 2;
    if ((AND & XOR) || (AND > X)) return NG();
    long long Ans = AND;
    for (int i = 40; i >= 0; i--) {
        if (XOR & (1LL << i)) {
            if (Ans + (1LL << i) <= X) {
                Ans += 1LL << i;
            }
        }
    }
    if (Ans == 0) return NG();
    cout << X - Ans << "\n";
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	cout << fixed << setprecision(10);
	double ans = 0.0;
	for (int i = 0; i < n; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY")ans += x;
		else ans += x * 380000;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int a,b,c,d,x,y,z;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

    if(a*c>a*d){
        x=a*c;
    }
    else{
        x=a*d;
    }
    if(b*c>b*d){
        y=b*c;
    }
    else{
        y=b*d;
    }
    if(x>y){
        z=x;
    }
    else{
        z=y;
    }
    printf("%lld",z);

}


Measured memory_bytes: 1708
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
template <class Q>
void clearQueue(Q & q) {
    q=Q();
}
int dp[670][2005];
int func(int idx,int sum){
	if(idx==0) return 1;
	if(dp[idx][sum]!=-1) return dp[idx][sum];
	int prev=idx-1;
	int minsumleftover=3*prev;
	//can fill the current space with any integer from 3 to sum-minsumleftover
	int ans=0;
	if(idx==1){
		ans=ans+func(idx-1,0);
	}
	else{
		for(int i=3;i<=sum-minsumleftover;i++){
			ans=ans+func(idx-1,sum-i);
		}
	}
	ans%=MOD;
	return dp[idx][sum]=ans;
}
void solve(){
	memset(dp,-1,sizeof dp);
	int s;cin>>s;
	if(s==1||s==2) {cout<<0;return;}
	if(s==3) {cout<<1;return;}
	int maxlength=s/3;
	int ans=0;
	for(int i=1;i<=maxlength;i++){
		ans=(ans+func(i,s))%MOD;
		// cout<<ans<<" ";
	}
	cout<<ans;
}	
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 14108
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


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

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

signed main(){
  int x,y;cin>>x>>y;
  int a = 1, b = 0,c = 1, d = 2;

  if(x > y)b = INF;
  else b += (y-x);
  if(x > -y)c = INF;
  else c += (-y-x);
  x *= -1;
  if(x > -y)d = INF;
  else d += (-y-x);
  if(x > y)a = INF;
  else a += (y-x);

  cout << min(b, min(c,min(d,a))) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




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


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

    return 0;
}


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

int f_state[1000];
vector<int> p[1000];

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


    rep(i, 0, n)
    rep(j, 0, 10)
    {
        int f;
        cin >> f;
        if (f == 1)
            f_state[i] += 1 << j;
    }


    rep(i, 0, n)
    rep(j, 0, 11)
    {
        int pp;
        cin >> pp;
        p[i].push_back(pp);
    }

    ll ans = -1000000000000;
    rep(j_state, 1, 1 << 10)
    {
        ll value = 0;
        rep(i, 0, n)
        {
            int cnt = __builtin_popcount(j_state & f_state[i]);
            value += p[i][cnt];
            // if (j_state == 32)
            //     cout << i << ' ' << cnt << ' ' << cnt << ' ' << p[i][cnt] << ' ' << f_state[i] << endl;
        }

        // if (value == 0)
        //     cout << j_state <<' '<< value << endl;
        ans = max(ans, value);
    }

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


Measured memory_bytes: 256