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

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner stdin = new Scanner(System.in);

		int inN = stdin.nextInt();
		int[] inD = new int[inN];
		for (int i = 0; i < inN; i++) {
			inD[i] = stdin.nextInt();
		}

		Arrays.sort(inD);
		int count = 1;
		int prev = inD[0];
		for (int i = 1; i < inN; i++) {
			int d = inD[i];
			if (d > prev) {
				count++;
				prev = d;
			}
		}

		System.out.println(count);
	}

}


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

int main() {
    int n;
    int64_t k;
    cin >> n >> k;
    vector<pair<int,int>> ab(n);
    rep(i,n){
        int ai, bi;
        cin >> ai >> bi;
        ab[i] = make_pair(ai,bi);
    }
    sort(ab.begin(),ab.end());
    int64_t cnt = 0;
    int ans;
    rep(i,n){
        int64_t bi = ab[i].second;
        cnt += bi;
        if(cnt >= k){
            int ai = ab[i].first;
            ans = ai;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args){
		int i, n, m, a, b;
		TreeSet<Integer> setA = new TreeSet<Integer>();
		TreeSet<Integer> setB = new TreeSet<Integer>();
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			for(i = 0; i < n; i++) {
				a = sc.nextInt();
				setA.add(a);
			}
			m = sc.nextInt();
			for(i = 0; i < m; i++) {
				b = sc.nextInt();
				setB.add(b);
			}
			setA.removeAll(setB);
			for(int output : setA) {
				System.out.println(output);
			}
		}
	}
}



Measured memory_bytes: 190000
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

const int MAX = 100;
int top, S[110];

void causeError() {
	exit(1);
}

void initialize() {
	top = 0;
}

bool isEmpty() {
	return top == 0;
}

bool isFull() {
	return top >= MAX - 1;
}

void push(int x) {
	if (false && isFull()) {
		causeError();
	}
	top++;
	S[top] = x;
}

int pop() {
	if (false && isEmpty()) {
		causeError();
	}
	top--;
	return S[top + 1];
}

int main() {
	char s[100];
	int a, b;
	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s[0] == '-') {
			a = pop();
			b = pop();
			push(b - a);
		}
		else if (s[0] == '*') {
			a = pop();
			b = pop();
			push(a * b);
		}
		else {
			push(atoi(s));
		}
	}
	printf("%d\n", pop());
}



Measured memory_bytes: 2108
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b; cin >> a >> b;
	int ans = min(a, b);
	string fin = "";
	forl(i, 0, max(a, b)) fin += to_string(ans);
	println(fin);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int mod = 924844033, N = 2e3 + 1;
#define For( i, j, k ) for( int i = j; i <= k; ++i )
int n, k, cnt, f[ N * 2 ][ N ][ 2 ], fac[ N ];
bool link[ N * 2 ];
int main( )
{
 std::cin >> n >> k;
 f[ 0 ][ 0 ][ 0 ] = 1;
 fac[ 0 ] = 1;
 For( i, 1, n )
  fac[ i ] = ( long long ) fac[ i - 1 ] * i % mod;
 for( int i = 1; i <= k; ++i ) for( int t = 1; t <= 2; ++t )
 for( int j = i; j <= n; j += k )
 {
  ++cnt;
  if( j != i )
   link[ cnt ] = 1;
 }
 for( int i = 1; i <= cnt; ++i )
 {
  for( int j = 0; j <= n; ++j )
  {
   f[ i ][ j ][ 0 ] = ( f[ i - 1 ][ j ][ 0 ] + f[ i - 1 ][ j ][ 1 ] ) % mod;
   if( link[ i ] && j )
    f[ i ][ j ][ 1 ] = f[ i - 1 ][ j - 1 ][ 0 ];
  }
 }
 int ans = 0;
 for( int i = 0; i <= n; ++i )
 {
  if( i & 1 )
   ans = ( ans - ( long long ) fac[ n - i ] * ( f[ n * 2 ][ i ][ 1 ] + f[ n * 2 ][ i ][ 0 ] ) % mod + mod ) % mod;
  else
   ans = ( ans + ( long long ) fac[ n - i ] * ( f[ n * 2 ][ i ][ 1 ] + f[ n * 2 ][ i ][ 0 ] ) % mod ) % mod;
 }
 std::cout << ans;
 return 0;
}

Measured memory_bytes: 66136
#include <iostream>
#include <vector>
#include <algorithm>
#include <typeinfo>
#include <cmath>
using namespace std;

typedef long long ll;
const int mod = 1000000007;
const int MAX_N = 100005;

ll fact[MAX_N];         // 階乗
ll ifact[MAX_N];        // 階乗の逆元

// x^nを求める繰り返し二乗法(累乗の高速化)
// フェルマーの小定理より、逆元を計算するときに用いる。
ll mod_pow(ll x, int n){
    if(n == 0)      return 1;

    ll res = 1;
    while(n > 0){
        if(n & 1)   res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }

    return res;
}

// 階乗とその逆元テーブルを(0-n)まで埋める
void table(int n){
    fact[0] = 1;    // i^0 = 1;
    for(int i = 1; i <= n; ++i){
        fact[i] = fact[i - 1] * i % mod;
    }

    // フェルマーの小定理を利用して、右端の逆元を求める
    // 階乗の(mod-2)乗
    ifact[n] = mod_pow(fact[n], mod - 2);

    // 逆元の性質を利用して、テーブルを埋める
    for(int i = n; i >= 1; --i){
        ifact[i - 1] = ifact[i] * i % mod;
    }
}

// nCrを求める
ll combination(int n, int r){
    if(n < 0 || r < 0 || n < r)     return 0;

    return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, id1 = 0, id2 = 0;
    cin >> n;
    vector<int> a(n+1), cnt(n+1, 0);
    for(int i = 0; i < n+1; ++i){
        cin >> a[i];
        ++cnt[a[i]];
        
        if(cnt[a[i]] == 2)      id2 = i;   
    }
    for(int i = 0; i < n+1; ++i){
        if(a[i] == a[id2]){
            id1 = i;
            break;
        }
    }
    
    table(n+2);
    
    // 重複している数字をxとして、xの左にある数字の個数
    // a = [...x.....x...]
    int num1 = id1;
    // xの右側にある数字の個数
    int num2 = n - id2;

    // 重複している数字：x
    for(int i = 1; i <= n+1; ++i){        // 数字をi個取る
        ll res = (combination(n + 1, i) - combination(num1 + num2, i - 1) + mod) % mod;
        
        cout << res << "\n";
    }
}

Measured memory_bytes: 3584
#include <stdio.h>


int main(int argc, char **argv)
{
  int a,b,c,x,y,i;
  int xxx[3];
  scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);
  if(x > y){
    xxx[0] = a * (x - y) + 2 * c * y;
    xxx[1] = a * x + b * y;
    xxx[2] = 2 * c * x;
  }
  else if(x == y){
    xxx[0] = 2 * c * x;
    xxx[1] = (a + b) * x;
    xxx[2] = 2147483647;
  }
  else{
    xxx[0] = b * (y - x) + 2 * c * x;
    xxx[1] = a * x + b * y;
    xxx[2] = 2 * c * y;
  }
  for(i = 0 ; i < 2 ; i++){
    if(xxx[i] < xxx[i + 1])
      xxx[i + 1] = xxx[i];
  }
  printf("%d\n",xxx[2]);

  return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
	"math"
)

func main() {
	var x int
	var factor []int
	var front, back int

	fmt.Scanf("%d", &x)

	factor = makeDivisors(x)
	// fmt.Print(factor)

	for i := 0; i < len(factor); i++ {
		front = factor[i]
		back = x / factor[i]
		// fmt.Println(front, back)
		if check(front, back) == true {
			return
		}
	}

}

func makeDivisors(n int) []int {
	divisors := make([]int, 0)
	for i := 1; i < int(math.Sqrt(float64(n))+1); i++ {
		if n%i == 0 {
			divisors = append(divisors, i)
			if i != n/i {
				divisors = append(divisors, n/i)
			}
		}
	}

	return divisors
}

func check(front int, back int) bool {
	for i := -119; i < 119; i++ {
		a := float64(i)
		b := a - float64(front)
		if float64(back) == (math.Pow(a, 4) + math.Pow(a, 3)*b + math.Pow(a, 2)*math.Pow(b, 2) + a*math.Pow(b, 3) + math.Pow(b, 4)) {
			fmt.Println(int(a), int(b))
			return true
		}
	}
	return false
}

func PrimeFactors(n int) (pfs []int) {
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	for i := 3; i*i <= n; i = i + 2 {
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	if n > 2 {
		pfs = append(pfs, n)
		pfs = append(pfs, 1)
	}

	if n == 1 {
		pfs = append(pfs, 1)
	}

	return
}


Measured memory_bytes: 1824
#include<iostream>
using namespace std;
int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    if( a.back() == b.front() ){
        if( b.back() == c.front() )
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
a, b, c, k = list(map(int, input().split(" ")))

if(k % 2 == 0):
    if(abs(a - b) < 10**18): print(a-b)
    else: print("Unfair")
elif(abs(b - a) < 10**18): print(b-a)
else: print("Unfair")

Measured memory_bytes: 3064
N=input()
if int(N[-1])==2 or int(N[-1])==4 or int(N[-1])==5 or int(N[-1])==7 or int(N[-1])==9:
    print('hon')
if int(N[-1])==0 or int(N[-1])==1 or int(N[-1])==6 or int(N[-1])==8:
    print('pon')
if int(N[-1])==3:
    print('bon')

Measured memory_bytes: 9204
#include<iostream>    
#include<cstdio>  
#include<stdio.h>  
#include<cstring>    
#include<cstdio>    
#include<climits>    
#include<cmath>   
#include<vector>  
#include <bitset>  
#include<algorithm>    
#include <queue>  
#include<map> 
#define inf 9999999; 
using namespace std;


long long int x, y, sum, z, a, b, c;
int i;
int main()
{
	cin >> x >> y >> z;
	sum = 0;
	for (i = 1;; i++)
	{
		a = x, b = y, c = z;
		if (a % 2 != 0 || c % 2 != 0 || b % 2 != 0)
		{
			cout << sum << endl;
			return 0;
		}
		x = (b + c) / 2;
		y = (a + c) / 2;
		z = (a + b) / 2;
		if (x == y&&y == z)
		{
			cout << -1 << endl;
			return 0;
		}
		sum++;
	}
}

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

using namespace std;

#define int long long

const int   N   = 2e5 + 1;
const int   mod = 1e9 + 7;

int qpow(int a,int exp) {
    int ans = 1;
    while(exp)  {
        if(exp & 1) ans = ans * a % mod;
        a = a * a % mod;  exp >>= 1;
    }
    return ans;
}

int F[N], I[N];
int h, w, a, b;

int combi(int n,int k)  {
    if(n < 0 || k < 0 || n < k) return 0;
    int ans = I[k] * I[n - k] % mod;
    return ans * F[n] % mod;
}
signed main()   {
    cin >> h >> w >> a >> b;

    F[0] = I[0] = 1;
    for(int i = 1 ; i <= h + w ; ++i)
        F[i] = F[i - 1] * i % mod;
    I[h + w] = qpow(F[h + w],mod - 2);
    for(int i = h + w - 1 ; i ; --i)
        I[i] = I[i + 1] * (i + 1) % mod;
    int ans = 0;
    for(int i = b + 1 ; i <= w ; ++i)
        ans = (ans + combi(i + h - a - 2,i - 1) * combi(w - i + a - 1,a - 1)) % mod;
    cout << ans << endl;
}


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

int main()
{
	int w, d;
	while (cin >> w >> d, w | d) {
		vector<int> h(d);
		int res = 0;
		map<int, int> cnt;
		for (int i = 0, h1; i < w; i++) {
			cin >> h1;
			res += h1;
			cnt[h1]++;
		}
		for (int i = 0; i < d; i++) {
			cin >> h[i];
		}
		sort(h.begin(), h.end());
		for (int i = d - 1; i >= 0; i--) {
			if (cnt[h[i]]) {
				cnt[h[i]]--;
			}
			else {
				res += h[i];
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
long a[200005];
int main(void){
    long n,ans=0;cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        a[i]+=a[i-1];
    }
    sort(a,a+n+1);
    
    long checker=a[0],cnt=1;
    for(int i=1;i<=n;i++){
        if(a[i]==checker){
            cnt++;
        }else{
            ans+=cnt*(cnt-1)/2;
            checker=a[i];
            cnt=1;
        }
    }
    if(cnt!=0)ans+=cnt*(cnt-1)/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);

		while(true){
			int m = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();


			if(m == -1 && f == -1 && r == -1){
				break;
			}

			int sum = m + f;


			if(m == -1 || f == -1){
				System.out.println('F');
			}
			else if(80 <= sum){
				System.out.println('A');
			}
			else if(65 <= sum && sum < 80){
				System.out.println('B');
			}
			else if(50 <= sum && sum < 65){
				System.out.println('C');
			}
			else if(30 <= sum && sum < 50){

				if(r >= 50){
					System.out.println('C');
				}
				else{
					System.out.println('D');
				}
			}
			if(30 > sum){
				System.out.println('F');


			}



		}

	}

}

Measured memory_bytes: 26396
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
 
ans={}
for i in range(m):
  sta,gol = road[i][0],road[i][1]
  if sta not in ans:
    ans[sta] = []
  ans[sta].append(gol)
  
  if gol not in ans:
    ans[gol] = []
  ans[gol].append(sta)
  
for i in range(1,n+1):
  if i in ans:
  	print(len(ans[i]))
  else:
    print(0)


Measured memory_bytes: 3064
ans=[]
N=int(input())
alf=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

while N>0:
    N,b=divmod(N-1,26)
    b=alf[b]
    ans.insert(0,b)


print(''.join(ans))


Measured memory_bytes: 9188
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int ary[20],te[5],num[10];
int main(){
	while(scanf("%d,%d,%d,%d,%d",&te[0],&te[1],&te[2],&te[3],&te[4])>0){
		fill(ary,ary+20,0);
		fill(num,num+10,0);
		for(int i=0;i<5;i++) ary[te[i]]++;
		for(int i=1;i<=13;i++) num[ary[i]]++;
		bool isstt=false;
		for(int i=1;i<10;i++){
			bool fla=true;
			for(int j=0;j<5;j++){
				if(ary[i+j]!=1){
					fla=false;
					break;
				}
			}
			if(fla) isstt=true;
		}
		if((!isstt)&&ary[1]==1&&ary[10]==1&&ary[11]==1&&ary[12]==1&&ary[13]==1) isstt=true;
		if(num[4]>0) cout<<"four card"<<endl;
		else if(num[3]>0&&num[2]>0) cout<<"full house"<<endl;
		else if(isstt) cout<<"straight"<<endl;
		else if(num[3]>0) cout<<"three card"<<endl;
		else if(num[2]>1) cout<<"two pair"<<endl;
		else if(num[2]>0) cout<<"one pair"<<endl;
		else cout<<"null"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	cin>>n;
	long long height[n];
	for(int i=0;i<n;i++){
		cin>>height[i];
	}
	long long ans[n]={0};
	ans[0]=0;
	ans[1]=abs(height[0]-height[1]);
	for(int i=2;i<n;i++){
		ans[i]=min(abs
		(height[i]-height[i-1])+ans[i-1],abs(height[i]-height[i-2])+ans[i-2]);
	//	cout<<ans[i]<<endl;
	}
	cout<<ans[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt();
                        long[] A = new long[N];
                        long[] B = new long[N];
                        for (int i = 0; i < N; i++) {
                                A[i] = i * 10001L + 1;
                                B[N-i-1] = i * 10001L + 1;
                        }
                        for (int i = 0; i < N; i++) {
                                int p = sc.nextInt();
                                p--;
                                A[p] += i / 2;
                                B[p] += i - i / 2;
                        }
                        for (int i = 0; i < N; i++) {
                                System.out.print(A[i]);
                                if (i == N - 1) {
                                        System.out.print("\n");
                                } else {
                                        System.out.print(" ");
                                }
                        }
                        for (int i = 0; i < N; i++) {
                                System.out.print(B[i]);
                                if (i == N - 1) {
                                        System.out.print("\n");
                                } else {
                                        System.out.print(" ");
                                }
                        }
                }
        }
}

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

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

Measured memory_bytes: 256
#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;
}

vector<int> as;

int main(void) {
    int N, M;
    cin >> N >> M;

    int sum = 0;
    as.resize(M);
    for (int i = 0; i < M; i++) {
        cin >> as[i];
        sum += as[i];
    }

    if (sum > N) {
        cout << "-1" << endl;
    } else {
        cout << N - sum << endl;
    }

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int N, M;
int mod = 1e9 + 7;

int factorial(int N) {
    if (N == 0) {
        return 1;
    } else {
        return 1ll * N * factorial(N - 1) % mod;
    }
}

int main() {
    cin >> N >> M;
    if (abs(N - M) > 1) {
        cout << 0 << endl;
        return 0;
    }
    int dog = factorial(N), monkey = factorial(M);
    cout << (N == M? 1ll * dog * monkey * 2 % mod: 1ll * dog * monkey % mod) << endl;
}

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

const int END = -1;
struct StNod
{
  int m_nKey;
  int m_nParnt;
  int m_nLeft;
  int m_nRigt;

  StNod() :
    m_nKey(END), m_nParnt(END), m_nLeft(END), m_nRigt(END)
  { }
};

void fnInput(vector<StNod>& rvoNod)
{
  StNod oNod;
  int nMaxSiz;

  cin >> nMaxSiz;
  rvoNod.resize(nMaxSiz, oNod);

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nNo, nLeft, nRigt;
    cin >> nNo >> nLeft >> nRigt;

    rvoNod[nNo].m_nKey  = nNo;
    rvoNod[nNo].m_nLeft = nLeft;
    rvoNod[nNo].m_nRigt = nRigt;
    if (nLeft != END)  rvoNod[nLeft].m_nParnt = nNo;
    if (nRigt != END)  rvoNod[nRigt].m_nParnt = nNo;
  }
}

void fnPreOrder(const vector<StNod>& cnrvoNod, int nx)
{
  if (nx == END)  return;

  cout << " " << nx;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnInOrder(const vector<StNod>& cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  cout << " " << nx;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnPostOrder(const vector<StNod>& cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
  cout << " " << nx;
}

void fnTreeWalk(const vector<StNod>& cnrvoNod)
{
  int nx = 0;
  while (cnrvoNod[nx].m_nParnt != END)
    nx = cnrvoNod[nx].m_nParnt;

  cout << "Preorder" << endl;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Inorder" << endl;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Postorder" << endl;
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StNod> voNod;

  fnInput(voNod);
  fnTreeWalk(voNod);
  return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#define ll long long
#define llu unsigned long long
#define pb push_back
#define f(n) for(ll i=0;i<n;i++)
#define ina for(ll i=0;i<n;i++)cin>>a[i];
#define all(v) v.begin(),v.end()
#define YES printf("YES\n")
#define NO printf("NO\n")
#define fastio std::ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//long long bigmod/* (a^p)%m */ ( long long a, long long p, long long m ){long long res = 1;long long x = a;while ( p ){if ( p & 1 ){res = ( res * x ) % m;}x = ( x * x ) % m;p = p >> 1;}return res;}
//ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
//call manipulated_seive(N) and get prime in prime vector
//const long long MAX_SIZE = 1000001; vector<long long >isprime(MAX_SIZE , true); vector<long long >prime; vector<long long >SPF(MAX_SIZE); void manipulated_seive(int N) { isprime[0] = isprime[1] = false ; for (long long int i=2; i<N ; i++) { if (isprime[i]) { prime.push_back(i); SPF[i] = i; } for (long long int j=0; j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { isprime[i*prime[j]]=false; SPF[i*prime[j]] = prime[j] ; } } }
//ll phi[5000001];bool mark[5000001];void sievephi(ll n){ll i,j;for(ll i=1;i<=n;i++) phi[i]=i;mark[1]=true;for(ll i=2;i<=n;i++)if(!mark[i]){for(ll j=i;j<=n;j+=i){mark[j]=true;phi[j]=phi[j]/i*(i-1);}}}

/*speedup
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
// vule geli coilbi na dada cout << fixed << setprecision(6) << pi <<" "<<npi<<endl;
//Pattern? OEIS
// prime factorize?? think about 2





int main()
{
    

        int a,b,c; cin>>a>>b>>c;
        if(a>b*c) cout<<"No "<<endl;
        else cout<<"Yes "<<endl;

    return 0;
}




Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;

int keta(int64_t a)
{
    ostringstream oss;
    oss << a;
    return oss.str().size();
}

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

    int ans = 111;

    for (int64_t i = 1; i * i <= n; i++) {
        if (n % i != 0)
            continue;
        int64_t j = n / i;

        ans = min(ans, max(keta(i), keta(j)));
    }

    cout << ans << endl;

    return 0;
}


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


int main() {
  long a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  if(v<w){
    cout<<"NO"<<endl;
  }
  else if(abs(b-a)<=t*abs(v-w)){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
}



Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int N;
	cin>>N;
	vector<double> R(N),D(N);
	double ans=0;
	for(int i=0;i<N;i++){
		cin>>R[i];
		D[i]=R[i];
		for(int j=0;j<i;j++){
			D[i]=max(D[j]+2*sqrt(R[i]*R[j]),D[i]);
		}
		ans=max(ans,D[i]+R[i]);
	}
	cout<<fixed;
	cout.precision(8);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3228
// B.

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

using namespace std;

typedef long long LL;

int main() {
	LL n, a, ans = 1;
	bool ok = true, z = false;
	cin >> n;
	for (LL i = 0; i < n; ++i) {
		cin >> a;
		for (int i = 0; i < 8; ++i) {
			LL p = a >> i;
			for (int j = 0; j < 8; ++j) {
				LL q = ans >> j;
				if (p * q > 1000000000000000000LL) {
					ok = false;
				}
			}
		}
		ans *= a;
		if (!a) z = true;
	}
	if (z) {
		ok = true;
		ans = 0;
	}
	cout << (ok ? ans : -1) << endl;
	return 0;
}


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

int main() {
  int N,S1=0,S2=0,S3=0,ans=10000;cin>>N;
  vector<int> W(N);
  rep(i,N) cin>>W[i];
  rep(i,N) S3 += W[i];
  for(int T=1;T<N;T++){
    rep(i,T) S1 += W[i];
    S2 = S3-S1;
    if(ans>abs(S1-S2)) ans=abs(S1-S2);
    S1=0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#define Max 2*100002
using namespace std;




priority_queue<pair<int,int> >q;

int main(){
	
	int a,b,val,i;
	scanf("%d%d",&a,&b);
	if(b == 1)
		printf("0\n");
	else{
		for(i=1;i<=100;i++){
			
			val = (a*i)-(i-1);

			if(val >= b){
				printf("%d\n",i);
				break;
			}


		}
	}

	return 0;
}

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;

void solve () {
	int x, y;
	cin >> x >> y;
	cout << x / y + (x % y != 0);	
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

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

using namespace std;
using ll=long long;

void solve() {
    ll T1, T2;
    ll A1, A2;
    ll B1, B2;
    cin >> T1 >> T2;
    cin >> A1 >> A2;
    cin >> B1 >> B2;
    ll SA = A1*T1 + A2*T2;
    ll SB = B1*T1 + B2*T2;
    if (SA == SB) {
        cout << "infinity"; return;
    }
    if (SA > SB) {
        swap(A1, B1);
        swap(A2, B2);
        swap(SA, SB);
    }

    ll res = 0;
    {
        ll D = A1 - B1;
        //cout << A1 << "\n";
        if (D > 0) {
            res += D*T1/(SB-SA);
            res *= 2;
            res++;
            if ((D*T1) % (SB-SA) == 0) res--;
        }
    }
    //{
    //    ll D = A2 - B2;
    //    ll X = T2 * D - (B1*T1 - A1*T1);
    //    //cout << X << "\n";
    //    if (X > 0) {
    //        res += X / (SB-SA);
    //        //cout << res << "\n";
    //    }
    //}
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;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 INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;


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

    int a,b;
    cin >> a>>b ;
    cout << a*b<< endl;
}
 

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <numeric>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
typedef pair<int, int> P;

typedef long long ll;
const int MOD = 1000000007;

int main(){  
    int N,count = 0;
    cin >> N;
    int a[20];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    for(int i=0;i<N-2;i++){
        if(a[i] < a[i+1] && a[i+1] < a[i+2]) count++;
        if(a[i] > a[i+1] && a[i+1] > a[i+2]) count++;
    }
    cout << count;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
template<typename T>
void fin (T a){
    cout<<a<<endl;
    exit(0);
}


int main(){
    ll n;cin>>n;
    ll ans = 0;
    map<ll,ll> mp;
    for (ll i = 2; i * i <= n; i++) {
        while(n%i==0){
            n/=i;
            mp[i]++;
        }
    }
    if(n !=1)mp[n]++;
    for(auto x : mp) {
        ll s = x.second;
        ll now =1;
        while(now<=s){
            s -= now;
            now++;
            ans++;
        }
    }

    fin(ans);
    return 0;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<lint>> v(N, vector<lint>(3, -1));
    rep(i, N) rep(j, 3) cin >> v[i][j];

    lint ma = 0;
    for (int bit = 0; bit < (1 << 3); bit++) {
        vector<lint> A(N, 0);
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                A[i] += ((bit & (1 << j)) ? v[i][j] : -v[i][j]);
            }
        }
        sort(all(A), greater<lint>());
        lint sum = 0;
        for (int i = 0; i < M; i++)
            sum += A[i];

        ma = max(ma, sum);
    }
    cout << ma << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 200000

int main(){
  int minv, maxv, n, i;
  int R[N];

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &R[i]);

  minv = R[0];
  maxv = R[1] - R[0];

  for(i = 1; i < n; i++){
    if(maxv < R[i] - minv)
      maxv = R[i] - minv;
    if(minv > R[i])
      minv = R[i];
  }

  printf("%d\n", maxv);

  return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    int a, b, k;
    cin >> a >> b >> k;

    set<int> nums_set;
    if (k < (b - a)) {
        rep(0, k) {
            nums_set.insert(a + i);
            nums_set.insert(b - i);
        }
    } else {
        rep(a, b+1) nums_set.insert(i);
    }

    for (int n : nums_set) cout << n << endl;
}

int main() {
    solve();

    return 0;
}


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

using namespace std;

double x;



void solve(){
    int n = 0;
    long long ret = 100;
    int ans = 0;
    while(ret < x){
        ret *= 1.01;
        ans++;
    }
    cout << ans << endl;
}



int main(){
    cin >> x;
    solve();
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;


int main(){
	int cnt=1;
	int n;
	while(cin>>n,n){
		double ans=0.0;
		vector<int>x(n+1),y(n+1);
		for(int i=0;i<n;i++)cin>>x[i]>>y[i];
		x[n]=x[0];
		y[n]=y[0];
		for(int i=0;i<n;i++){
			ans+=(x[i]*y[i+1]-y[i]*x[i+1])*0.5;
		}
		
		
		printf("%d %.1f\n",cnt++,fabs(ans));
	}
	return 0;
}


Measured memory_bytes: 1224
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

void solve() {
	int n;
    string s;
    cin >> n >> s;
    int q;
    cin >> q;
    rep(i, q) {
        int k; cin >> k;
        int d = 0, m = 0, dm = 0;
        int ans = 0;
        rep(j, k - 1) {
            if(s[j] == 'D') ++d;
            if(s[j] == 'M') {
                ++m; dm += d;
            }
            if(s[j + 1] == 'C') ans += dm;
        }
        for(int j = k - 1; j < n; ++j) {
            if(s[j] == 'D') ++d;
            if(s[j - k + 1] == 'D') {
                --d;
                dm -= m;
            }
            if(s[j - k + 1] == 'M') {
                --m;
            }
            if(s[j] == 'M') {
                ++m;
                dm += d;
            }
            if(j + 1 < n && s[j + 1] == 'C') {
                ans += dm;
            }
        }
        cout << ans << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 1948
from itertools import accumulate
n, c = list(map(int, input().split()))
xv = [list(map(int, input().split())) for _ in range(n)]

v_cum = [0]*(n+1)
for i in range(n):
    v_cum[i+1] = v_cum[i] + xv[i][1]

for_cal = [0] + [v_cum[i+1] - xv[i][0] for i in range(n)]
fb_cal = [0] + [v_cum[i+1] - 2*xv[i][0] for i in range(n)]

for_cum = [x for x in accumulate(for_cal, max)]
fb_cum = [x for x in accumulate(fb_cal, max)]

ans = 0
for i in range(n+1):
    # OA path
    j = n if i == 0 else i-1

    # OB path
    ob_x = 0 if i == 0 else c - xv[i-1][0]
    ob_v = v_cum[n] - v_cum[i-1]

    # for-back root
    ans = max(ans, fb_cum[j]+ob_v-ob_x)
    # back-for path
    ans = max(ans, for_cum[j]+ob_v-2*ob_x)

print(ans)


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

using namespace std;

int main()
{
   long long int n,k;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)
        cin>>a[i];
    int x=1;
    long long int count1=0;
    map<int,int>mp;
    int p=0;
   while(k--){
        count1++;
     x=a[x-1];
   if(mp.count(x)){
    p=1; break;}
    else mp[x]=count1;
   }
   if(p==1){
   long long int m=(k)%(count1-mp[x]);
   while(m--){
    x=a[x-1];
   }}
   cout<<x;
    return 0;
}


Measured memory_bytes: 11660
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    k+=1
    AB=[tuple(map(int,input().split())) for _ in range(n)]

    dp=[0]*35 # dp[d]: less than が確定するのが d 桁目のときの最大値
    # dp[d] の状態のものが a を買えるのは、d 以上の桁については ad<=kd かつ、
    # d 桁目については ad<kd となるもののみ
    for a,b in AB:
        ndp=dp[:]
        for d in range(34,-1,-1):
            kd=(k>>d)&1
            ad=(a>>d)&1
            if(ad>kd): break
            if(ad<kd):
                ndp[d]=dp[d]+b
        dp=ndp

    print(max(dp))
resolve()

Measured memory_bytes: 55900
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		char[] s1 = sc.next().toCharArray();
		int ans = 0;
		int c1 = 0;
		int c0 = 0;
		for(int i = 0; i < s1.length; i++) {
			if(s1[i] == '1') {
				if(c0 > 0) {
					c0--;
					ans++;
				}else {
					c1++;
				}
			}else {
				if(c1 > 0) {
					c1--;
					ans++;
				}else {
					c0++;
				}
			}
		}
		
		System.out.println(ans * 2);
	}
}

Measured memory_bytes: 28144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T;
  cin >> S >> T;
  
  int s_size = S.length();
  
  for(int i = 0; s_size; i++){
    if(S[i] != T[i]){
      cout << "No";
      break;
    }else if (i == s_size - 1){
	  cout << "Yes";
      break;
    }
  }
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int n,m,d; cin >> n >> m >> d;
    cout << fixed << setprecision(7);
    if(d == 0){
        double ans = (double)(m-1)/n;
        cout << ans << endl;
    }
    else{
        double ans = (double)2*(n-d)*(m-1)/((ll)n*n);
        cout << ans << endl;
    }
}

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


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

struct edge {int to; ll cost; };

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

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

ll LCM(ll a, ll b){
  if(a<b) swap(a,b);
  return a/GCD(a,b)*b;
}
 
int main(){
  int n;
  cin >> n;
  string ans = "APPROVED";
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    if(a%2==0 && a%3 && a%5) ans = "DENIED";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
n, k = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for L in range(k+1):
    for R in range(k-L+1):
        if n < L+R:
            break
        val = 0
        neg = []
        for i in range(L):
            val += V[i]
            if V[i] < 0:
                neg.append(V[i])
        for i in range(n-1, n-1-R, -1):
            val += V[i]
            if V[i] < 0:
                neg.append(V[i])
        neg.sort()
        val -= sum(neg[:k-L-R])
        if ans < val:
            ans = val
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

// Begin Template IO/Utility
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &V){
	os<<'[';
	for(int i=0;i<(int)V.size();i++)
		os<<V[i]<<",]"[i==(int)V.size()-1];
	return os;
}
template<typename T> istream& operator>>(istream &is, vector<T> &V){
	for(T &x:V)
		is>>x;
	return is;
}
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T,U> &p){
	os<<'{'<<p.first<<','<<p.second<<'}';
	return os;
}
template<typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){
	is>>p.first>>p.second;
	return is;
}
template<typename T> void minself(T &a, T &b){
	a=min(a,b);
}
template<typename T> void maxself(T &a, T &b){
	a=max(a,b);
}
// End Template IO/Utility
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	cout<<setprecision(15);
	int r;
	cin>>r;
	cout<<r*2*M_PI;
}


Measured memory_bytes: 3776
fun main() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map { it.toLong() }.toMutableList()
    var sum = 0L
    repeat(n - 1) {
        sum += if(a[it] > a[it + 1]) {
            val tmp = a[it] - a[it + 1]
            a[it + 1] += tmp
            tmp
        } else 0
    }
    print(sum)
}

Measured memory_bytes: 71768
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
 
const lines = input.trim().split('\n');
 
while (line = lines.shift()) {
 
    const numbers = line.split(' ').map(Number);

    if(numbers.length > 1){
        const diffList = [];
 
        numbers.map((num1, ind1) => {
            numbers.map((num2, ind2) => {
                if (ind1 !== ind2) {
                    const diff = Math.abs(num1 - num2);
                    const pair = `${num1} ${num2}`;
                    diffList.push([pair, diff]);
                }
            })
        })
 
        const sorted = diffList.sort((p1, p2) => p1[1] - p2[1])[0];
        console.log(sorted[1]);
    }
}


Measured memory_bytes: 453760
#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <stack>
#include <limits>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <sstream>
#include <random>
#include <functional>
#include<algorithm>
#include <array>
#include<random>
using namespace std;

int main() {
	uint64_t N;
	cin >> N;
	uint64_t res = 0;
	while(N > 0)
	{
		res += N % 10;
		N /= 10;
	}
	if (res == 1)res = 10;
	cout << res;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
long long sum=0;
char ch;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>ch>>b;
    if(ch=='(')sum+=b;
    else sum-=b;
    cout<<(sum==0?"Yes":"No")<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp makepair
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n" 
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
ll n,a,b,c,d;
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  string s;
  cin>>n;
  while(n--)
  {
    cin>>s;
    if(s[0]=='A')
      a++;
    if(s[0]=='W')
      b++;
    if(s[0]=='T')
      c++;
    if(s[0]=='R')
      d++;
  }
  cout<<"AC x "<<a<<"\n";
  cout<<"WA x "<<b<<"\n";
  cout<<"TLE x "<<c<<"\n";
  cout<<"RE x "<<d<<"\n";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Vec = vector<int>;
using Graph = vector<Vec>;
#define INF 1000000007
#define MOD 1000000007
#define SEP " "

int		main(void)
{
	int n;
	cin >> n;
	vector<int> b(n-1);
	for (int i = 0; i < n - 1; i++)
		cin >> b[i];
	vector<int> a(n);
	int sum = 0; 
	sum += b[0];
	for (int i = 1; i < n-1; i++)
	{
		sum += min(b[i], b[i-1]);
	}
	sum += b[n-2];
	cout << sum << endl;
}


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

int main(){
  ll n,m;   cin >> n >> m;
  ll ans=0;
  if(m-2*n>0){
      m=m-2*n;
      ans+=n;
      ans+=m/4;
  }else{
      ans+=m/2;
  }
  cout << ans << endl;
}

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

int main() {
  // N時間駐車した時の最小の駐車料金を出力
  int N, a, b, c, d;
  cin >> N;
  //N = 7777;
  
  a = N / 1000;
  b = (N / 100) - (10 * a);
  c = (N / 10) - (100 * a) - (10 * b);
  d = N - (1000 * a) - (100 * b) - (10 *c);

  	if  (a == b &&  b == c) {
      cout << "Yes" << endl;
  	}
  	else if (b == c && c == d) {
      cout << "Yes" << endl;
    }
  	else {
      cout << "No" << endl;
    }
} 

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int x,y;
	scanf("%d%d",&x,&y);
	cout<<(x+y-1)/y<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split(" ")))
S = [0, ]
now = 0
for n in A:
    now += n
    S.append(now)
Scounter = Counter(S)
ans = 0
for c, n in Scounter.most_common():
    if n >= 2:
        ans += n*(n-1)//2
    else:
        break
print(ans)


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/15  Problem: 063_arc_b / Link: https://abc047.contest.atcoder.jp/tasks/arc063_b?lang=en  ----- */
/* ------問題------

N 個の町が一直線上に並んでいます。行商人の高橋君は町 1 から出発し、リンゴの売買をしながら町 N へと向かいます。
はじめ高橋君は町 1 におり、リンゴを 1 つも持っていません。高橋君は次のいずれかの行動を繰り返し行います。
移動: 町 i (i<N) にいるとき、町 i+1 へ移動する。
リンゴの売買: リンゴを好きな個数だけ売買する。ここで、町 i (1≦i≦N) ではリンゴの買値も売値もともに Ai 円とする。ここで Ai は相異なる整数です。
1 つの町で売買するリンゴの個数に制限はありませんが、旅の中で売買するリンゴの個数は合計で (買う個数と売る個数を合わせて) T 個以下にしなくてはなりません。
高橋君は旅の利益、すなわちリンゴを売った代金から買った代金を引いた値を最大にするように旅をするとします。旅が終わったときに持っていたリンゴの価値は考えず、旅の中で売買した金額だけを考えます。
この旅に先立って、青木君は任意の町 i に対して Ai を好きな非負整数 Ai' に変えるという操作を好きなだけ行うことができます。ただし、この操作は行うごとに |Ai−Ai'| のコストがかかります。操作後には異なる町の間でリンゴの値段が同じになっていても構いません。
青木君の目的はできるだけ少ない合計コストの操作で高橋君の利益を少なくとも 1 円下げることです。合計コストの最小値を求めてください。
ただし、元の状態で高橋君が 1 円以上の利益を上げられることは仮定して構いません。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	LL T;
	cin >> N>>T;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	LL Mn = a[0];
	int scnt = 0;
	LL gmx = -1;
	FOR(i, 0, N) {
		if (Mn > a[i]) {
			Mn = a[i];
		}

		if (gmx == a[i] - Mn)scnt++;
		else if (gmx < a[i] - Mn) {
			gmx = a[i] - Mn;
			scnt = 1;
		}
	}

	ans = scnt;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int co(string s, char c) 
{ 
    // Count variable 
    int res = 0; 
  
    for (int i=0;i<s.length();i++) 
  
        // checking character in string 
        if (s[i] == c) 
            res++; 
  
    return res; 
} 
int main()
 {  ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
	int n;
	cin >> n;
	    string s;
      cin>>s;
      ll count =0,count1=0,count2=0,count3=0,ans=0;
     // cout<<s.size();
      for(int i=0;i<n;i++)
        {for(int j=0;j<n;j++)
       { int t1,t2,t3;
        t1=j;
        t2=j+i;
        t3=j+2*i;
        if(t3<n&&t2<n&&t1<n){
            if(s[t1]!=s[t2]&&s[t2]!=s[t3]&&s[t3]!=s[t1])
            count++;
        }}}
        count1=co(s,'R');
         count2=co(s,'G');
          count3=co(s,'B');
       //cout<<count<<endl;
       if((count1*count2*count3)-count<=0)
       ans=0;
       else 
       ans=(count1*count2*count3)-count;
      cout<<ans<<endl;}

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define tc ll t; cin >> t; while (t--)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define sz(c) (ll) c.size()
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define trav(x,c) for(auto &x : c)
#define _for(i,a,n) for(ll i = a ; i < n ; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a ; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios::sync_with_stdio(0); cin.tie(0);

int main() {
    godspeed;
    set<int> s;
    int x;
    while(cin >> x) {
        s.ins(x);
    }

    if(sz(s) == 2) yes;
    else no;
}

Measured memory_bytes: 3568