akhauriyash/Code-Regression huggingface dataset:
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=9e15;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(long long i = 0; i < n; i++)
#define rep2(i,k,n) for(long long i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////


//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(a);lin(b);lin(c);lin(K);
  ll cnt = 0;
  cnt += min(a, K);
  K -= a;
  if(K > 0) K -= b;
  if(K > 0) cnt -= min(c, K);

  cout << cnt << endl;
}

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

#define SENTINEL 1000000000

int count=0;

void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
  for(i=0;i<=n1-1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<=n2-1;j++){
    R[j]=A[mid+j];
  }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
   if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){
  int A[500000];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



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

const int INF = 1e9;

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

  int n;
  cin >> n;

  vector<int> dp(3);

  for(int day=0; day<n; day++) {
    vector<int> new_dp(3, 0);
    vector<int> a(3);
    for(int i=0; i<3; i++)
      cin >> a[i];

    for(int i=0; i<3; i++) {
      for(int j=0; j<3; j++) {
        if(i != j) {
          new_dp[j] = max(new_dp[j], dp[i] + a[j]);
        }
      }
    }
    dp = new_dp;
  }

  cout << max({dp[0], dp[1], dp[2]}) << '\n';
  
  return 0;
}

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



int main() {
    int r, d, x;
    cin >> r >> d >> x;
    
    rep(i,10) {
        x = r * x - d;
        cout << x << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3596
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
if min(np.sum(S, axis=0))==0 or min(np.sum(S, axis=1))==0:
    print('Yes')
    exit()
if (S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0) or (S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0):
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 12508
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]

for i in B:
  for j in range(3):
    for k in range(3):
      if A[j][k]==i:
        A[j][k]="X"

if A[0][0]=="X" and A[0][1]=="X" and A[0][2]=="X":
  print("Yes")
elif A[1][0]=="X" and A[1][1]=="X" and A[1][2]=="X":
  print("Yes")
elif A[2][0]=="X" and A[2][1]=="X" and A[2][2]=="X":
  print("Yes")
elif A[0][0]=="X" and A[1][0]=="X" and A[2][0]=="X":
  print("Yes")
elif A[0][1]=="X" and A[1][1]=="X" and A[2][1]=="X":
  print("Yes")
elif A[0][2]=="X" and A[1][2]=="X" and A[2][2]=="X":
  print("Yes")
elif A[0][0]=="X" and A[1][1]=="X" and A[2][2]=="X":
  print("Yes")
elif A[0][2]=="X" and A[1][1]=="X" and A[0][2]=="X":
  print("Yes")
else:(print("No"))

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;


int main(){

  bool num[10];CLR(num,false);

  rep(i,0,4){
    int a;cin>>a;
    // a--;
    num[a]=true;
  }
  ll count=0;
  rep(i,0,10){
    if(num[i]&&(i==1||i==4||i==7||i==9))count++;
  }

  if(count==4)out("YES");
  else out("NO");



  return 0;
}

// #include "bits/stdc++.h"

// using namespace std;
// typedef long long ll;
// #define rep(i,j,n) for (ll i = j; i < (n); i++)
// #define CLR(mat,f) memset(mat, f, sizeof(mat))
// #define IN(a, b, x) (a<=x&&x<b)
// #define out(ans) cout << ans << endl
// typedef pair<ll,ll>P;
// const ll mod=1e9+7;
// const int INF = 1000000;
// const double PI=3.14159265359;

// ll n;
// ll a[10][10];
// ll v[10];
// ll ma=0;
// ll sum=0;

// void dfs(int num){
//   // out(1234);
//   if(num==n){
//     // out(num);
//     // vector<int>aa,b,c;
//     // rep(i,0,n){
//     //   if(v[i]==0){
//     //     aa.push_back(i);
//     //   }else if(v[i]==1){
//     //     b.push_back(i);
//     //   }else if(v[i]==2){
//     //     c.push_back(i);
//     //   }
//     // }
//     // ll sum=0;
//     // rep(i,0,aa.size()-1){
//     //   rep(j,i+1,aa.size()){
//     //     sum+=a[aa[i]][aa[j]];
//     //   }
//     // }
//     // rep(i,0,b.size()-1){
//     //   rep(j,i+1,b.size()){
//     //     sum+=a[b[i]][b[j]];
//     //   }
//     // }
//     // rep(i,0,c.size()-1){
//     //   rep(j,i+1,c.size()){
//     //     sum+=a[c[i]][c[j]];
//     //   }
//     // }

//     ma=max(ma,sum);

//   }else{
//     // rep(i,0,1){
//       v[num]=0;
//       dfs(num+1);
//     // }
//   }

// }

// int main(){

//   // int b=10;
//   int a,b,c;
//   a=b=c=10;

//   rep(i,0,10){
//     cout<<a<<":"<<b<<":"<<c<<endl;
//     // out(b--);

//     // out(--b);
//   }

//   // cin>>n;
//   // rep(i,0,n-1){
//   //   rep(j,i+1,n){
//   //     cin>>a[i][i+j];
//   //     sum+=a[i][i+j];
//   //   }
//   // }
//   // dfs(0);
// //
//   // out(ma);

//   return 0;
// }


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String S=sc.next();
		String[]x=new String[S.length()-2];
		for(int i=0;i<S.length()-2;i++) {
			x[i]=S.substring(i,i+3);//２番目の引数のところの文字は含まれない
		}
		int []x2=new int[S.length()-2];
		for(int j=0;j<S.length()-2;j++) {
			x2[j]=Integer.parseInt(x[j]);
		}
		int answerX=Math.abs(753-x2[0]); 
		for(int k=1;k<S.length()-2;k++) {
			if(Math.abs(753-x2[k])<Math.abs(answerX)) {
				answerX=Math.abs(753-x2[k]);
				
			}
		}
		System.out.print(answerX);
		sc.close();
	}

}

Measured memory_bytes: 23636
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const int INF = INT_MAX / 2;

vector<int> problems;
vector<int> bonus;

int sum_score = 0;
vector<int> dp;

int solve(const int D, const ll G) {
    for (int i = 1; i <= D; i++) {
        for (int j = G; j >= 0; j--) {
            if (dp[j] != INF) {
                for (int k = 1; k <= problems[i]; k++) {
                    ll score = j + i * k;
                    if (score > G) {
                        score = G;
                    }
                    chmin(dp[score], dp[j] + k);
                    if (k == problems[i]) {
                        chmin(dp[min(G, score + bonus[i])], dp[j] + k);
                    }
                    // printf("i: %d, j: %d, k: %d, score: %lld, dp[%lld]: %d\n", i, j, k, score, score, dp[score]);
                }
            }
        }
    }

    return dp[G];
}

int main(void) {
    int D;
    ll G;
    cin >> D >> G;
    G /= 100;

    problems.resize(D + 1);
    bonus.resize(D + 1);
    for (int i = 0; i < D; i++) {
        int p, c;
        cin >> p >> c;
        c /= 100;
        problems[i + 1] = p;
        bonus[i + 1] = c;
        sum_score += p * (i + 1);
        sum_score += c;
    }

    dp.resize(sum_score + 1, INF);
    dp[0] = 0;
    cout << solve(D, G) << endl;

    // for (int i = 0; i < (int) dp.size(); i++) {
    //     cout << dp[i] << " ";
    // }
    // cout << endl;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

void print(char A[][2], long n) {
	for (long i = 0; i < n; i++) {
		if (i) {
			cout << " ";
		}
		for (long j = 0; j < 2; j++) {
			cout << A[i][j];
		}
	}
	cout << endl;
}

void Swap2(char A[][2], long a, long b) {
	for (long i = 0; i < 2; i++) {
		char v = A[a][i];
		A[a][i] = A[b][i];
		A[b][i] = v;
	}
}

bool bubbleSort(char A[][2], long n) {
	bool stbl = true;
	bool flag = true;
	for (long m = n; flag && m > 0; m--) {
		flag = false;
		for (long i = 1; i < m; i++) {
			if (A[i - 1][1] > A[i][1]) {
				Swap2(A, i, i - 1);
				flag = true;
			}
		}
	}
	return stbl;
}

bool selectionSort(char A[][2], long n) {
	char O[n][2];
	for (long i = 0; i < n; i++) {
		for (long j = 0; j < 2; j++) {
			O[i][j] = A[i][j];
		}
	}
	for (long i = 0; i < n; i++) {
		long mini = i;
		for (long j = i; j < n; j++) {
			if (A[j][1] < A[mini][1]) {
				mini = j;
			}
		}
		if (mini != i) {
			Swap2(A, i, mini);
		}
	}
	
	bool stbl = true;
	for (long i = 0; i < n; i++) {
		long j;
		if (i == 0 || A[i][1] > A[i - 1][1]) {
			j = 0;
		}
		while ((O[j][1] != A[i][1] || O[j][0] != A[i][0]) && j < n) {
			j++;
		}
		if (j >= n) {
			stbl = false;
			break;
		}
		j++;
	}

	return stbl;
}

int main() {
	long n;
	cin >> n;
	char A[n][2], B[n][2];
	for (long i = 0; i < n; i++) {
		for (long j = 0; j < 2; j++) {
			cin >> A[i][j];
			B[i][j] = A[i][j];
		}
	}

	bool stbl;
	for (int i = 0; i < 2; i++) {
		switch (i) {
			case 0: {
				stbl = bubbleSort(A, n);
				print(A, n);
				break;
			}
			case 1: {
				stbl = selectionSort(B, n);
				print(B, n);
				break;
			}
		}
		switch (stbl) {
			case true: {
				cout << "Stable" << endl;
				break;
			}
			default: {
				cout << "Not stable" << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int N,X;
int L[110];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> N >> X;
  REP(i,N) cin >> L[i];
  int D = 0;
  int ans = 1;
  for (int i = 0; i < N; i++) {
    D = D+L[i];
    if (D <= X) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)

#include <algorithm>
using namespace std;
#include <cmath>
#include <string>
#include<vector>
#define elif else if
typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 200005
int N;

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    ll X,Y;
    cin>>X>>Y;
    ll sum =0;
    if(A+B<=2*C) sum = A*X+ B*Y;
    else{
        sum = min(X,Y)*2*C;
        ll tmp = min(X,Y);
        X -=  tmp;
        Y -= tmp;
        
        if(2*C < A )
            sum +=  X*2*C;
        else
        {
            sum+= A*X;
        }
            
        if(2*C < B )
            sum +=  Y*2*C;
        else
        {
            sum+=B*Y;
        }
        
    } 
    cout<<sum;
    return  0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int a;
  a=0;
  for(int i=0;i<s.size();i++){
      if(s[i]=='+'){
          a++;
      }
      if(s[i]=='-'){
          a--;
      }
  }
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<map>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int z = 1000000007;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
int main() {
    string str, str1;
    cin >> str >> str1;
    int ans = 0;
    REP(i, str.size()) {
        if (str[i] != str1[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

bool isdigit(char c){
	if(c >= '0' && c <= '9') return true;
	else return false;
}

int main(){
	int w,h;
	string field[70];
	while(1){
		cin >> w >> h;
		if(!w) break;
		string dp[71][71] = {};
		for(int i = 0;i < h;i++) cin >> field[i];
		string ma = "";
		for(int i = 1;i <= h;i++){
			for(int j = 1;j <= w;j++){
				if(isdigit(field[i - 1][j - 1])){
					string s1 = dp[i - 1][j],s2 = dp[i][j - 1];
					if(s1 == "" && s2 == "" && field[i - 1][j - 1] == '0') continue;
					if(s1.length() > s2.length() || (s1.length() == s2.length() && s1 > s2)){
						dp[i][j] = s1 + to_string(field[i - 1][j - 1] - '0');
					}else{
						dp[i][j] = s2 + to_string(field[i - 1][j - 1] - '0');
					}
					if(dp[i][j].length() > ma.length() || (dp[i][j].length() == ma.length() && dp[i][j] > ma)){
						ma = dp[i][j];
					}
				}
			}
		}
		cout << ma << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3360
// input macro
// ref: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[allow(unused_mut)]
fn main() {
    input!(
        n: usize,
        v: [usize; n],
    );

    let mx = 10_usize.pow(5) + 1;
    let mut odd: Vec<usize> = vec![0; mx];
    let mut even: Vec<usize> = vec![0; mx];

    for (i, &vi) in v.iter().enumerate() {
        if i%2 == 0 {
            odd[vi] += 1;
        }
        else {
            even[vi] += 1;
        }
    }

    let mut oddfirst = (0,0);
    let mut oddsecond = (0,0);
    for (oi, &oddi) in odd.iter().enumerate() {
        if oddi > oddfirst.1 {
            oddsecond = oddfirst.clone();
            oddfirst = (oi, oddi);
        }
        else if oddi > oddsecond.1 {
            oddsecond = (oi, oddi);
        }
    }

    let mut evenfirst = (0,0);
    let mut evensecond = (0,0);
    for (ei, &eveni) in even.iter().enumerate() {
        if eveni > evenfirst.1 {
            evensecond = evenfirst.clone();
            evenfirst = (ei, eveni);
        }
        else if eveni > evensecond.1 {
            evensecond = (ei, eveni);
        }
    }

    if oddfirst.0 == evenfirst.0 {
        if oddsecond.1 > evensecond.1 {
            println!("{}", n - evenfirst.1 - oddsecond.1);
        }
        else {
            println!("{}", n - oddfirst.1 - evensecond.1);
        }
    }
    else {
        println!("{}", n - oddfirst.1 - evenfirst.1);
    }


}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

const long long N = 100100;
long long n, a[N], f[N];
vector <pair<long long, long long>> v;

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> a[i];
		v.push_back({-a[i], i});
	}
	sort(v.begin(), v.end());
	dbg(v);

	long long mn = 1e9;
	long long sum = 0;
	long long cnt = 0;
	for(auto i : v) {
		// dbg(i, sum);
		if(i.nd < mn) {
			if(mn <= n) f[mn] += sum - cnt * (-i.st);
			sum = cnt * (-i.st);
			mn = i.nd;
		}
		sum -= i.st;
		cnt++;
	}
	f[mn] += sum;
	for(long long i = 1; i <= n; i++)
		cout << f[i] << '\n';
	cout << '\n';

}	

	

Measured memory_bytes: 7536
N, K = list(map(int, input().split()))
if N == K:
    print(0)
    exit()
elif N < K:
    ans = min(N, K - N)
    print(ans)
    exit()
elif N > K:
    temp1 = N - N // K * K
    temp2 = abs(temp1 - K)
    ans = min(temp1, temp2)
    print(ans)
    exit()


Measured memory_bytes: 9184
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    int n, m;
    int i, j;
    string judge[200];
    int count[200] = {-1000};
    int total = 0;
    int check = -1000;
    int key;
    int ans;
    
    cin >> n;
    
    vector<string> s(n);
    
    for(i = 0; i < n; i++) {
        cin >> s[i];
        
        key = 0;
        for(j = 0; j < total; j++) {
            if(judge[j] == s[i]) {
                count[j]++;
                key = 1;
            }
        }
        
        if(key == 0) {
            judge[total] = s[i];
            count[total] = 1;
            total++;
        }
    }
    
    cin >> m;
    
    vector<string> t(m);
    
    for(i = 0; i < m; i++) {
        cin >> t[i];
        
        key = 0;
        for(j = 0; j < total; j++) {
            if(judge[j] == t[i]) {
                count[j]--;
                key = 1;
            }
        }
        
        if(key == 0) {
            judge[total] = t[i];
            count[total] = -1;
            total++;
        }
    }
    
    for(i = 0; i < total; i++) {
        if(check < count[i]) {
            check = count[i];
            ans = i;
        }
    }
    
    if(count[ans] > 0) {
        cout << count[ans] << endl;
    } else {
        cout << "0\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())

grid = []
for _ in range(h):
    temp = list(input())
    grid.append(temp)


dp = [[0 for i in range(w)] for j in range(h)]
dp[0][0] = 1
MOD = 10**9 + 7

for i in range(h):
    for j in range(w):
        if grid[i][j] == '.':
            if i > 0:
                dp[i][j] += dp[i-1][j] % MOD
            if j > 0:
                dp[i][j] += dp[i][j-1] % MOD

print(dp[-1][-1] % MOD)

Measured memory_bytes: 91484
#include <queue>
#include <string>
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

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

string mp[maxn];
int dis[maxn][maxn];
queue<pair<int, int> > q;

int main(int argc, char * argv[])
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1;i <= n;++i)
	{
		cin >> mp[i];
	}
	int sx, sy;
	for (int i = 1;i <= n;++i)
	{
		for (int j = 0;j < m;++j)
		{
			if (mp[i][j] == 'S')
			{
				sx = i;
				sy = j;
				break;
			}
		}
	}
	q.push(make_pair(sx, sy));
	memset(dis, -1, sizeof dis);
	dis[sx][sy] = 0;
	while (!q.empty())
	{
		pair<int, int> u = q.front();
		q.pop();
		if (dis[u.first][u.second] == k) break;
		for (int i = 0;i < 4;++i)
		{
			pair<int, int> v;
			v.first = u.first + dx[i];
			v.second = u.second + dy[i];
			if (v.first < 1 || v.first > n) continue;
			if (v.second < 0 || v.second >= m) continue;
			if (dis[v.first][v.second] == -1 && mp[v.first][v.second] == '.')
			{
				q.push(v);
				dis[v.first][v.second] = dis[u.first][u.second] + 1;
			}
		}
	}
	int ansi = 123456789;
	for (int i = 1;i <= n;++i)
	{
		for (int j = 0;j < m;++j)
		{
			if (dis[i][j] == -1) continue;
			int mini = min(min(i - 1, j), min(n - i, m - 1 - j));
			int min_step;
			if (mini % k == 0) min_step = mini / k;
			else min_step = mini / k + 1;
			ansi = min(ansi, min_step + 1);
		}
	}
	printf("%d\n", ansi);
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<queue>
#include<cstring>

using namespace std;

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

int main() {
  while (true) {
    int n, m, c;
    cin >> n >> m >> c;
    if (n == 0 && m == 0 && c == 0) break;
    vector<pair<int, int> > edge[n];
    rep (i, m) {
      int f, t, cc;
      cin >> f >> t >> cc;
      --f, --t;
      edge[f].push_back(make_pair(t, cc));
    }
    priority_queue<pair<int, pair<int, int> >, vector<pair<int, pair<int, int> > >, greater<pair<int, pair<int, int> > > > que;
    que.push(make_pair(0, make_pair(0, 0)));
    int dis[111][111];
    memset(dis, -1, sizeof(dis));
    while (!que.empty()) {
      pair<int, pair<int, int> > now = que.top();
      que.pop();
      int cost = now.first, pos = now.second.first, del = now.second.second;
      if (del > n) continue;
      if (dis[pos][del] != -1 && dis[pos][del] <= cost) continue;
      dis[pos][del] = cost;
      rep (i, edge[pos].size()) {
	que.push(make_pair(cost + edge[pos][i].second, make_pair(edge[pos][i].first, del)));
	que.push(make_pair(cost, make_pair(edge[pos][i].first, del + 1)));
      }
    }
    rep (i, 111) if (dis[n - 1][i] != -1 && dis[n - 1][i] <= c) {
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 3768
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

const int MAX_N = 100000, INF = 1e9;

int N, h[MAX_N];

int dp[MAX_N];

void solve() {
	fill(dp, dp + N, INF);
	dp[0] = 0;

	for (int i = 0; i < N - 1; i++) {
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
		if (i + 2 < N)
			dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
	}

	printf("%d\n", dp[N - 1]);
}

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &h[i]);
	}

	solve();
}

Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std; 
int main()
{
int n,m;
cin>>n;
string s[100],t[100];
for (int i=0;i<n;i++){
cin>>s[i];
}
cin>>m;
for(int i=0;i<m;i++){
cin>>t[i];
}
int u[100]={0};
for(int i =0;i<n;i++){
for(int j =0;j<n;j++){
if(s[i]==s[j]) u[i]++;
}
for(int j=0;j<m;j++){
if(s[i]==t[j])
u[i]--;
}
}
sort(u, u + 100);
reverse(u,u+100);
if (u[0]>0){
cout<<u[0] << endl;
}
else 
{
cout<<0<< endl;
}
system ("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
#define mod 1000000007
int n;
int dp[100005];
int a[100005];
int dfs(int i)
{
	if(dp[i]!=-1)
		return dp[i];
	if(i==n-1)
		return dp[i]=0;
	if(i==n)
		return dp[i]=mod;
	return dp[i]=min(dfs(i+2)+abs(a[i+2]-a[i]),dfs(i+1)+abs(a[i+1]-a[i]));
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	f(i,0,100005)
		dp[i]=-1;
	cin>>n;
	f(i,0,n)
		cin>>a[i];
	cout<<dfs(0)<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const int inf = 1e9;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m; cin >> n >> m;
    int visited[n];
    rep(i,n) visited[i] = 0;
    // pair<int, int> edge[n+m-1];
    vector<int> edge[n];
    rep(i, n+m-1)
    {
        int a, b; cin >> a >> b;
        a--;
        b--;
        // edge[i] = make_pair(a,b);
        edge[a].push_back(b);
        visited[b]++;
    }
    int par = inf;
    rep(i,n)
    {
        if (!visited[i]) par = i;
    }

    // bfs
    int parents[n];
    queue<int> que;
    que.push(par);
    parents[par] = -1;
    while(!que.empty())
    {
        int now_at = que.front();
        que.pop();
        for(auto iter=edge[now_at].begin(); iter!=edge[now_at].end();iter++)
        {
            parents[*iter] = now_at;
            visited[*iter]--;
            if (visited[*iter]==0)
            {
                que.push(*iter);
            }
        }
    }
    rep(i,n)
    {
        cout << parents[i]+1 << endl;
    }
}


Measured memory_bytes: 7040
#include<iostream>
#include<vector>
#include<cassert>
#include<numeric>
#include<algorithm>
// #include<bits/stdc++.h>
using namespace std;

typedef int Bit;
// using Bit = int;

const long long MOD = 100000;
class ModInt {
public:
  ModInt(long long n = 0) : n_(n % MOD) {while(n_ < 0) n_ += MOD;}
  friend const ModInt operator+(const ModInt& lhs, const ModInt& rhs) {return lhs.n_+rhs.n_;}
  friend const ModInt operator-(const ModInt& lhs, const ModInt& rhs) {return lhs.n_-rhs.n_;}
  friend const ModInt operator*(const ModInt& lhs, const ModInt& rhs) {return lhs.n_*rhs.n_;}
  friend ostream& operator<<(ostream& os, const ModInt& m) {return os << m.n_;}
  ModInt& operator+=(const ModInt& rhs) {return *this = *this + rhs;}
private:
  long long n_;
};
const ModInt power(const ModInt& x, int n) {
  if(!n) return 1;
  return n&1 ? x*power(x*x, n>>1) : power(x*x, n>>1);
}

bool test(Bit bit, int i) {assert(0 <= i); return bit & (1 << i);}
Bit set(Bit bit, int i)   {assert(0 <= i); return bit | (1 << i);}
Bit reset(Bit bit, int i) {assert(0 <= i); return bit & ((~0) ^ (1 << i));}

int count(const vector<string>& flag, char c) {
  return accumulate(begin(flag), end(flag), 0, [=](int sum, const string& s){
      return sum + count(begin(s), end(s), c);
    });
}

ModInt solve(const vector<string>& flag) {
  const int H = flag.size(), W = flag.front().size();
  const int BIT_MAX = 1 << W;
  vector<ModInt> cur(BIT_MAX);
  cur[0] = 1;
  for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
    vector<ModInt> nex(BIT_MAX);
    for(Bit bit = 0; bit < BIT_MAX; ++bit) {
      Bit nbit = reset(bit, j);
      if(flag[i][j] == 'J' || flag[i][j] == '?') {
        if(j == W-1 || flag[i][j+1] != 'O' || i == H-1 || flag[i+1][j] != 'I') {
          if(j) nex[set(reset(nbit, j-1), j)] += cur[bit];
          else nex[set(nbit, j)] += cur[bit];
        }
      }
      if(flag[i][j] == 'O' || flag[i][j] == '?') {
        if(!j || i == H-1 || !test(bit, j-1) || flag[i+1][j-1] != 'I') {
          nex[nbit] += cur[bit];
        }
      }
      if(flag[i][j] == 'I' || flag[i][j] == '?') {
        if(!i || j == W-1 || !test(bit, j)) {
          if(j) nex[reset(nbit, j-1)] += cur[bit];
          else nex[nbit] += cur[bit];
        }
      }
    }
    cur = nex;
  }
  auto all = power(3, count(flag, '?'));
  return all - accumulate(begin(cur), end(cur), ModInt(0));
}

int main() {
  int M, N;
  cin >> M >> N;
  vector<string> flag(M);
  for(auto& i: flag) cin >> i;
  cout << solve(flag) << endl;
}

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


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

  vector<int> ball(200002,0);

  int diff = 0;
  rep(i,n){
    int a;
    cin >> a;
    if(ball[a] == 0) {diff++;}
    ball[a]++;
  }

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

  int ans = 0;
  int i = 0;
  while(diff > k){
    if(ball[i] == 0) {i++; continue;}
    ans += ball[i];
    diff--;
    i++;
  }
  cout << ans << endl;
}


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

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

using ll = long long;

int main(){
  int n;
  cin >> n;
  vector<int> p = {0,0,0,0,0,0,1,1,1,2};
  vector<int> q = {1,1,1,2,2,3,2,2,3,3};
  vector<int> r = {2,3,4,3,4,4,3,4,4,4};
  
  vector<ll> D(5);
  rep(i,5)D.at(i)=0;
  
  rep(i,n){
    string tmp;
    cin>>tmp;
    if(tmp.at(0)=='M')D.at(0)++;
    if(tmp.at(0)=='A')D.at(1)++;
    if(tmp.at(0)=='R')D.at(2)++;
    if(tmp.at(0)=='C')D.at(3)++;
    if(tmp.at(0)=='H')D.at(4)++;
  }
  ll ans = 0;
  rep(i,10) ans += D.at(p.at(i))*D.at(q.at(i))*D.at(r.at(i));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
ls=list(map(int,input().split()))
if N==1:
  print(0)
  exit()
a=[]
k=0
for i in range(N-1):
  if ls[i]>=ls[i+1]:
    k+=1
  else:
    a.append(k)
    k=0
a.append(k)
print(max(a))

Measured memory_bytes: 14224
N=io.read("n")
a={}
for i=1,N do
  a[i]=io.read("n")
end
table.sort(a,function (a,b) return a>b end)
local count=1
for i=2,N do
  if a[i]<a[i-1] then
    count=count+1
  end
end
print(count)

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI               \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);                    \
   cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double
#define endl "\n"

#define ordered_set tree<P, null_type, less<P>, rb_tree_tag, tree_order_statistics_node_update>

struct DSU
{
   vi sz, par;
   int n;
   void init(int in)
   {
      n = in;
      sz.resize(n + 1);
      par.resize(n + 1);
      for (int i = 1; i <= n; i++)
         sz[i] = 1, par[i] = i;
   }
   int root(int i)
   {
      if (par[i] != i)
         par[i] = root(par[i]);
      return par[i];
   }
   bool unite(int a, int b)
   {
      int ra = root(a);
      int rb = root(b);
      if (ra == rb)
         return 0;
      if (sz[ra] < sz[rb])
         swap(ra, rb);
      par[rb] = par[ra];
      sz[ra] += sz[rb];
      return 1;
   }
};

int32_t main()
{
   AB_BHI_NI_DEGI
   //freopen("input.txt", "r", stdin);
   //freopen("output.txt", "w", stdout);
   //cout.precision(20);
   //cout << fixed;
   int T = 1;
   //cin >> T;
   int cnt = 1;
   while (T--)
   {
      int n;
      cin >> n;
      int m;
      cin >> m;
      DSU dsu;
      dsu.init(n);
      while (m--)
      {
         int x, y;
         cin >> x >> y;
         dsu.unite(x, y);
      }
      map<int, int> mp;
      for (int i = 1; i <= n; i++)
         mp[dsu.root(i)]++;
      int ans = 0;
      for (auto it : mp)
         ans = max(ans, it.S);
      cout << ans << "\n";
   }
   return 0;
}

Measured memory_bytes: 18684
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}


int main(){
  ll N,X; cin>>N>>X;
  vector<ll> x(N+1);
  rep(i,N) cin>>x[i];
  x[N] = X;

  SORT(x);

  vector<ll> a(N);
  rep(i,N){
    a[i] = x[i+1] - x[i];
  }

  ll ans = INF;
  ll tmp = a[0];
  rep(i,N){
    tmp = gcd(tmp,a[i]);
    ans = min(ans,tmp);
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    int a, b;
    cin >> a >> b;
    int count = 0;
    FOR(i, a, b) {
        string s = to_string(i);
        string s2 = to_string(i);
        reverse(ALL(s2));
        if(s == s2) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())

input2 = list(map(int,input().split()))

all_list = []

for i in range(N):
    all_list.append(0)
    
for i in range(N - 1):
    all_list[input2[i] - 1] += 1
    
for i in range(N):    
    print(all_list[i])



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

al = list(map(int,input().split()))


# a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


ans = al[0]

for a in al:
    ans = gcd(a, ans)

if k % ans == 0 and k <= max(al):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 62576
/*
*
*Problem Link : https://atcoder.jp/contests/dp/tasks/dp_k
*Platform: atcoder
*Status: correct
*Author: Mayukh Chakrabarti
*
*/

#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false)
#define boost cin.tie(NULL)
#define booster cout.tie(NULL)
#define endl "\n"
typedef long long int lld;

#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;

using namespace std;

int main(){
	
	int N,K;
	cin>>N>>K;
	
	bool dp[K+1]={0}; //initializing with false
	int ar[N];
	F(ar,N);
	
	sort(ar,ar+N); //sorting in ascending order to improve the time complexity of the algorithm
	
	for(int i=0; i<=K; i++){
		
		for(int j=0; j<N; j++){
			if(ar[j]>i)
				break;
			else
				dp[i]= max( dp[i], !dp[i-ar[j]] );
		}
		
	}
	
	if(dp[K])
		cout<<"First";
	else
		cout<<"Second";
	
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

template <class T> inline bool chmin(T &a, const T &b) {
  return (a > b) ? a = b, true : false;
}

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &stream, const std::vector<T> &vec) {
  for (auto val : vec) {
    if (std::is_fundamental<T>::value)
      stream << " " << val;
    else
      stream << std::endl << val;
  }
  return stream;
}

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

  int res = 0;
  while (N > 0) {
    N = N / K;
    res += 1;
  }
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#light "off"

open System

let INF64 = 100000000000L

(*
let readInt () =
    let s = stdin.ReadLine() in
    int s
*)
let readInt64 () =
    let s = stdin.ReadLine() in
    int64 s

let readIntArray () =
    stdin.ReadLine().Split(' ') |>
    Array.map int

(*
let readIntList () =
    stdin.ReadLine().Split(' ') |>
    Array.map int |>
    Array.toList
*)
(*
let readIntList () =
    stdin.ReadToEnd()
        .Split('\n')
        .Select(fun s -> s.Replace("\r", ""))
        .Where(fun s -> s.Length > 0)
        .Select(fun e -> int e)
        .ToArray() |>
    Array.toList
*)

let parseProblem () =
    let ar = readIntArray () in
    let A, B, Q = ar.[0], ar.[1], ar.[2] in
    let S = Array.create (A + 2) 0L in
    let T = Array.create (B + 2) 0L in
    let X = Array.create Q 0L in
    S.[0] <- -INF64;
    for i in 1 .. A do
        S.[i] <- readInt64 ()
    done;
    S.[A + 1] <- INF64;
    T.[0] <- -INF64;
    for i in 1 .. B do
        T.[i] <- readInt64 ()
    done;
    T.[B + 1] <- INF64;
    for i in 0 .. Q - 1 do
        X.[i] <- readInt64 ()
    done;
    A, B, Q, S, T, X

let findLeftmostGe (ar: 'a []) x =
    let rec loop b e =
        let m = (b + e) / 2 in
        if b = e then b
        else if ar.[m] < x then loop (m + 1) e
        else loop b m in
    loop 0 (ar.Length - 1)

let main () =
    let A, B, Q, S, T, X = parseProblem () in
    let search x sl_i tl_i =
        List.min [
            for si in [sl_i - 1; sl_i] do
                for ti in [tl_i - 1; tl_i] do
                    let sv = S.[si] in
                    let tv = T.[ti] in
                    let d0 = abs (tv - sv) + abs (sv - x) in
                    let d1 = abs (tv - sv) + abs (tv - x) in
                    for d in [d0; d1] do
                        yield d
                    done
                done
            done
        ] in
    for x in X do
        let sl_i = findLeftmostGe S x in
        let tl_i = findLeftmostGe T x in
        printfn "%d" <| search x sl_i tl_i
    done

let _ = main ()


Measured memory_bytes: 22208
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <utility>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b , x = 0;
    cin >> a >> b;
    for( int i = 1 ; i < b - a ; i++ ) x += i;
    cout << x - a;
}


Measured memory_bytes: 3488
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a==b && a!=c || b==c && b!=a || a==c && a!=b){
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22612
import sys
input = sys.stdin.readline
import math
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

a, b, t = map(int, input().split())
time = float(t) + 0.5
s = math.floor(time / a)
ans = s * b
print(ans)


Measured memory_bytes: 38384
import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 126044
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll pow (ll x, ll n){
    ll ans = 1;
    while(n>0){
        if(n & 1 == 1){
            ans *= x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

int main(){
    string s;
    cin >> s;
    int a[26];
    rep(i,26) a[i] = 0;
    int l = s.length();
    rep(i,l){
        a[s[i]-'a']++;
    }
    rep(i,26){
        if(a[i]==0){
            cout << (char)('a'+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


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

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int N, M, dp[20001][256];
vector< int > c ,x;

int rec(int idx, int prev) {
    if(idx == N) return 0;
    if(~dp[idx][prev]) return dp[idx][prev];
    int ret = INF;
    for(int i = 0; i < M; i++) {
        int y = prev + c[i];
        y = max(y, 0);
        y = min(y, 255);
        ret = min(ret, rec(idx + 1, y) + (int)pow(y - x[idx], 2));
    }
    return dp[idx][prev] = ret;
}

int main() {
    while(cin >> N >> M, N) {
        memset(dp, -1, sizeof(dp));
        c.resize(M);
        x.resize(N);
        for(int i = 0; i < M; i++)
            cin >> c[i];
        for(int i = 0; i < N; i++)
            cin >> x[i];

        cout << rec(0, 128) << endl;
    }
}

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

int main() {
	int i, n, x;
	string s;
    x = 1;
  	
  	cin >> n;
  
  	for (i = 0; i < n; i++){
      cin >> s;
      if (s == "Y"){
        cout << "Four" << endl;
        x = 2;
        break;
      	}
    }
  	if (x == 1){
      cout << "Three" << endl;
    }
  
      
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}

	vector<vector<int> > prime(1e6+1);

	vector<bool> seive(1e6+1,1);

	seive[0]=seive[1]=0;

	prime[1].push_back(1);


	for(int i=2;i<=1e6;i++)
	{
		if(!seive[i])
			continue;
		prime[i].push_back(i);

		for(int j=i+i;j<=1e6;j+=i)
		{
			seive[j]=0;
			prime[j].push_back(i);
		}
	}

	map<int,int> mp;

	for(int i=0;i<n;i++)
	{
		if(a[i]==1)
			continue;
		for(auto j:prime[a[i]])
		{
			mp[j]++;
		}
	}

	bool flag=0;

	for(auto i:mp)
	{
		if(i.second>=2)
		{
			flag=1;
			break;
		}
	}

	if(!flag)
	{
		cout<<"pairwise coprime"<<endl;
		return 0;
	}

	flag=0;

	for(auto i:mp)
	{
		if(i.second==n)
		{
			flag=1;
			break;
		}
	}

	if(!flag)
	{
		cout<<"setwise coprime"<<endl;
		return 0;
	}

	cout<<"not coprime"<<endl;






	return 0;
}

Measured memory_bytes: 66260