akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int H, W;
	int i, j;
	
	while (1){
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0){
			break;
		}
		
		for (i = 1; i <= H; i++){
			for (j = 1; j <= W; j++){
				if (i == 1 || i == H || j == 1 || j == W){
					printf("#");
				}
				else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return (0);
}



Measured memory_bytes: 2040
#include <iostream>
#include <string.h>
using namespace std;

int main(){
    string ss;
    cin>>ss;
    if(ss[0]=='A'&&ss[1]=='A'&&ss[2]=='A') {
        cout<<"No";
        return 0;
    }
    if(ss[0]=='B'&&ss[1]=='B'&&ss[2]=='B') {
        cout<<"No";
        return 0;
    }
    cout<<"Yes";
    return 0;

}

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

int main()
{
    long long result = 0;
    long long N;
    cin >> N;

    if (N==2)
    {
        cout << 0 << endl;
        return 0;
    }
    

    long long sq = sqrt(N);
    //cout << sq << endl;
    int f = 1;
    if (sq * sq == N)
    {
        f = 0;
    }
    for (int i = 1; i < sq + f; i++)
    {
        if (N % i == 0)
        {
            //cout << i << endl;
            if (N / i - 1 > i)
            {
                result += N / i - 1;
            }
        }
    }
    cout << result << endl;
}

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

int main(){
  int n;cin>>n;
  vector<ll> zero(61,0),one(61,0);
  
  REP(i,n){
    ll a;cin>>a;
    REP(j,61){
      (a%2?one:zero).at(j)++;
      a/=2;
    }
  }

  ll ans=0;
  REP(i,61){
    ll tmp=(ll)pow(2,i)%MOD;
    tmp*=zero.at(i);
    tmp%=MOD;
    tmp*=one.at(i);
    tmp%=MOD;
    ans+=tmp;
    ans%=MOD;
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,A,B;cin>>N>>A>>B;
  vector<long>X(N);for(int i=0;i<N;i++)cin>>X[i];
  long ans=0;
  for(int i=0;i<N-1;i++){
    ans+=min(A*(X[i+1]-X[i]),B);
  }
  cout<<ans;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#define ll long long int
using namespace std;
int main(void) {
  int n, m;
  int x[200001]={0};
  int y[200001]={0};
  cin>>n>>m;
  for(int i=0; i<m; i++) {
    int a, b;
    cin>>a>>b;
    if(a==1) {
      x[b]=1;
    } else if(b==n) {
      y[a]=1;
    }
  }
  for(int i=1; i<=n; i++) {
    if(x[i]==1 and y[i]==1) {
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
  return 0;
}


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

int main() {

  int N, M;
  double sum=0;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
      cin >> A.at(i);
      sum += A.at(i);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  if(A.at(M-1) < sum/4/M) {
      cout << "No" << endl;
  }
  else {
      cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
A, B = map(int, input().split())
if A == B:
    print(A)
else:
    if A % 2 == 0:
        if B % 2 == 0:
            num = ((B - A) // 2) % 2
            print(B ^ num)
        else:
            num = ((B - A + 1) // 2) % 2
            print(num)
    else:
        if B % 2 == 0:
            num = ((B - (A + 1)) // 2) % 2
            print(A ^ num ^ B)
        else:
            num = ((B - (A + 1) + 1) // 2) % 2
            print(A ^ num)


Measured memory_bytes: 3064
using System;

public class AtCoder
{
    public static void Main()
    {
        int[] p = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
            31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
        int n;
        n = int.Parse(Console.ReadLine().Trim());
        int[] q = new int[25];
        int d;
        int[] x = new int[5];
        int[] div = { 2, 4, 14, 24, 74 };
        for (int i = 1; i <= n; i++)
        {
            d = i;
            for (int j = 0; j < 25; j++)
            {
                while (d % p[j] == 0)
                {
                    d /= p[j];
                    q[j]++;
                }
            }
        }
        for (int i = 0; i < 25; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                if (q[i] >= div[j]) x[j]++;
            }        
        }

        int ans = 0;
        ans += (x[0]-2) * x[1] * (x[1]-1)/2;
        ans += (x[0]-1) * x[3];
        ans += (x[1]-1) * x[2];
        ans += x[4];
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    int N,A,B;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    }else{
        cin >> A >> B;
        cout << A+B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////

int main(){
    string S;
    getline(cin,S);
    vector<char> ans;
    int N = S.length();
    if (N < 26){
        set<char> C;
        REP(i,N){
            C.insert(S[i]);
            ans.PB(S[i]);
        }
        for(char c = 'a' ; c <= 'z'; ++c){
            if (SIN(c,C)) {
                continue;
            }else{
                ans.push_back(c);
                break;
            }
        }
    }else{
        if (S == "zyxwvutsrqponmlkjihgfedcba"){
            PRINTD(-1);
            return 0;
        }
        int index = -1;
        FORqr(j,1,N-1){
            if (S[j] >= S[j-1]){
                index = j-1;
                break;
            }
        }

        set<char> C;
        REP(i,index){
            ans.PB(S[i]);
            C.insert(S[i]);
        }

        //cout << "index = " << S[index] << "\n";

        for (char c = S[index]+1;c <= 'z';++c){
            if (SIN(c,C)) {
                continue;
            }else{
                ans.push_back(c);
                break;
            }
        }

    }

    REP(i,ans.size()){
        cout << ans[i];
    }
    cout << "\n";

}


Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    N, A, B = MAP()
    if A*N > B:
        print(B)
    else:
        print(A*N)


if __name__ == '__main__':
    main()


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

int main(){
    int A,B,C,K,sum=0;
    cin >> A >> B >> C >> K;
    
    
    if(A > 0){
        if(K > A){
            sum = A;
            K -= A;
        }else{
            sum = K;
            K = 0;
        }
    }

    if(K > 0 && B > 0){
        if(K > B){
            K -= B;
        }else{
            K = 0;
        }
    }    

    if(C > 0 && K > 0){
        sum -= K;
        K = 0; 
        }

    cout << sum << endl;

    }

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

namespace AtCoderBeginnersContest
{
    class ABC100C
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            int count = 0;
            for (int i = 0; i < n; i++)
            {
                while ((a[i] & 1) == 0)
                {
                    a[i] >>= 1;
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 14176
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = myRead.readIntArray();
            int ans = s[0] / s[1] + (s[0] % s[1] != 0 ? 1 : 0);
            ans *= s[2];
            WriteLine(ans);
        }
    }
    public static class myRead
    {
        public static int readInt() { return int.Parse(ReadLine()); }
        public static long readLong() { return long.Parse(ReadLine()); }
        public static string readStr() { return ReadLine(); }
        public static int[] readIntArray() { return ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        public static long[] readLongArray() { return ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        public static string[] readStrArray() { return ReadLine().Split(' '); }
    }


    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return m == 0 ? 1L : m == 1 ? n : n * Pow(n, m - 1); }
    }


}

Measured memory_bytes: 28132
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (a + b < c) {
		cout << "NA" << endl;
		return 0;
	}
	cout << max(0ll, c - a) << endl;
}



Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
#include<ctype.h>
#include<deque>
#include<algorithm>
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
deque<int> q;
int main(){
	int n=read();
	for(int i=1;i<=n;++i) {
		int a=read();
		if(i&1)q.push_back(a);
		else q.push_front(a);
	}
	if(n&1)reverse(q.begin(),q.end());
	for(int i=0;i<q.size();++i)printf("%d ",q[i]);puts("");
	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
int main()
{
	int n;
	int a,b,c;
	scanf("%d",&n);
	a=n/100;
	n=n%100;
	b=n/10;
	c=n%10;
	if(a==7||b==7||c==7){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 1600
#include <stdio.h>
int main(void){
    int n,i,cnt;
    char a[101],b[101],c[101];
    scanf("%d",&n);
    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);
    cnt=0;
    for(i=0;i<=n-1;i++){
        if(a[i]!=b[i]){
            if(a[i]!=c[i]){
                if(b[i]!=c[i]){
                    cnt=cnt+2;
                }
                else{
                    cnt=cnt+1;
                }
            }
            else{
                cnt=cnt+1;
            }
        }
        else{
            if(a[i]!=c[i]){
                cnt=cnt+1;
            }
        }
    }
    printf("%d",cnt);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

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

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T> void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U> void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
   LL n; cin >> n;
   vector<LL> a(5);
   for (int i = 0; i < 5; ++i) {
      cin >> a[i];
   }

   LL mina = *min_element(a.begin(), a.end());

   LL ans = (n-1)/mina + 5;
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int x, y;
	cin >> x >> y;
	cout << x + y / 2 << endl;
}


Measured memory_bytes: 3612
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int r, D, x2000;
    cin >> r >> D >> x2000;

    int xi = x2000;
    for (int i = 0; i < 10; i++) {
        xi = r * xi - D;
        cout << xi << endl;
    }

        return 0;
}


Measured memory_bytes: 504
import java.util.*;

public class Main
{
    public static void main (String[] args)
    {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if (a < b){
            System.out.println("a < b");
        } else if(a > b) {
            System.out.println("a > b");
        } else if(a == b) {
            System.out.println("a == b");
        }
    }
}

Measured memory_bytes: 26092
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(std::string S){
  ll ans=0;
  rep(i,S.size()/2){
    if(S[i]!=S[S.size()-1-i]){
      ans++;
    }
  }
  op(ans)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b

A, B = map(int, input().split())
g = gcd(A, B)

ans = 1

for i in range(2, 2*10**6):
    if g%i == 0:
        ans += 1
        while g%i == 0:
            g //= i

if not g == 1:
    ans += 1

print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
 
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
 
#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)
 
typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)
 
#define S_RTN(S)  s_cout(S);return 0
 
 
#define _itoa(A,N) sprintf(A, "%d", N);
 
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
 
int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
 
 
int s_asorts(const void* a, const void* b);
 
//昇順
int s_asorts(const void* a, const void* b) {
    return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
    return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
    return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
    int i;
    rept(i, 0, n) {
        l_cin2(*(a + i), *(b + i));
    }
    return 0;
}
int i_cins(int n, int* a) {
    int i;
    for (i = 0; i < n; i++) {
        i_cin(*(a + i));
    }
 
    return 0;
}
int _gcd(int a, int b) {
    int r, tmp;
    if (a < b) { tmp = a; a = b; b = tmp; }
    r = a % b;
    while (r) {
        if (!r) break;
        a = b; b = r;
        r = a % b;
    }
    return(b);
}
 
long _max(long a, long b) {
    return a > b ? a : b;
}
long _min(long a, long b) {
    return a < b ? a : b;
}
int _swp(int* a, int* b)
{
    int tmp;
    tmp = *b; *b = *a; *a = tmp;
    return 0;
}

//小さい順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//変換(文字から整数)
int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    return 0;
}


int main(void){
    int N;
    i_cin(N);
    int len[N];
    rept(i,0,N){
        i_cin(len[i]);
    }
    int cpy[N];
    rept(i,0,N){
        cpy[len[i]-1]=i+1;
    }
    rept(j,0,N){
        printf("%d ",cpy[j]);
    }
}

    




Measured memory_bytes: 1536
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<long long> L(N+1);
	L[0] = 2;
	L[1] = 1;
	for (int i = 2; i < N+1; ++i) {
		L[i] = L[i-1] + L[i-2];
	}
	cout << L[N] << endl;
	return 0;
}


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

typedef pair<long long, long long> pairll;

set<pairll> determined; 

long long coins(long long N, int A, int B, int C, int D){
    if(N == 0)return 0;
    if(N == 1)return D;

    auto itr = determined.lower_bound(pairll(N, 0));
    if((*itr).first == N)return (*itr).second;

    long long res;
    if(N % 2 == 0){
        res = A + coins(N/2, A, B, C, D);
    }else{
        res = (long long)D + A + coins((N+1)/2, A, B, C, D);
        res = min(res, (long long)D + A + coins((N-1)/2, A, B, C, D));
    }
    switch(N % 3){
        case 0:
            res = min(res, (long long)B + coins(N/3, A, B, C, D));
            break;
        case 1:
            res = min(res, (long long)D + B + coins((N-1)/3, A, B, C, D));
            break;
        case 2:
            res = min(res, (long long)D + B + coins((N+1)/3, A, B, C, D));
            break;
    }
    switch(N % 5){
        case 0:
            res = min(res, (long long)C + coins(N/5, A, B, C, D));
            break;
        case 1:
            res = min(res, (long long)D + C + coins((N-1)/5, A, B, C, D));
            break;
        case 2:
            res = min(res, 2LL*D + C + coins((N-2)/5, A, B, C, D));
            break;
        case 3:
            res = min(res, 2LL*D + C + coins((N+2)/5, A, B, C, D));
            break;
        case 4:
            res = min(res, (long long)D + C + coins((N+1)/5, A, B, C, D));
            break;
    }
    if(res/D >= N){
        res = N*D;
    }
    determined.insert(pairll(N, res));
    return res;
}

int main(void){
    int T, A, B, C, D;
    long long N;
    cin >> T;
    for(int i=0; i<T; i++){
        cin >> N >> A >> B >> C >> D;
        determined.clear();
        cout << coins(N, A, B, C, D) << endl;
    }
    return 0;
}

Measured memory_bytes: 4344
import collections
import sys
n = int(input())
ls = list(map(int,input().split()))
c =collections.Counter(ls)
d = list(c)
p = []
q = []
mm = 0
mx3 = 0
for i in range(len(d)):
    if c[d[i]] >=4:
        p.append(d[i])
    if c[d[i]] >=2:
        q.append(d[i])
if p == [] and len(q) < 2:
    print(0)
    sys.exit()
if len(q) >= 2:
    mx1 = max(q)
    q.remove(mx1)
    mx2 = max(q)
    mm = mx1 * mx2
if p != []:
    mx3 = max(p)**2
print(max(mm,mx3))
    



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

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

int gcd(int a, int b)
{
    a = abs(a);
    b = abs(b);
    return a == 0 ? b : gcd(b % a, a);
}

int main()
{
    int n;
    scanf("%d", &n);

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

    int suf[n + 1];
    suf[n] = 0;
    for (int i = n - 1; i >= 0; i--)
        suf[i] = gcd(suf[i + 1], inp[i]);

    int g = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int tmp = gcd(g, suf[i + 1]);
        ans = max(ans, tmp);
        g = gcd(g, inp[i]);
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1024
n = int(input())
left = []
right = []
for i in range(n):
    s = input()
    n0 = 0
    n1 = 0
    l = len(s)
    for j in range(l):
        if s[j] == "(":
            n0 += 1
        else:
            if n0 == 0:
                n1 += 1
            else:
                n0 -= 1
    if n0 > 0 or n1 > 0:
        if n0 >= n1:
            left.append([n1, n0])
        else:
            right.append([n0, n1])
 
left.sort()
right.sort()
 
def solve():
    nl0 = 0
    nl1 = 0
    for p in left:
        if p[0] > nl0:
            return False
        nl0 -= p[0]
        nl0 += p[1]
    nr0 = 0
    nr1 = 0
    for p in right:
        if p[0] > nr1:
            return False
        nr1 -= p[0]
        nr1 += p[1]
    if nl0 == nr1:
        return True
    else:
        return False
 
if solve():
    print("Yes")
else:
    print("No")

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

int main(){
    int N;
    cin >> N;
    if (N == 1) {
        cout << "Hello World" << endl;
    }
    else if (N == 2) {
        int A, B;
        cin >> A >> B;
        A += B;
        cout << A << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;

const int mod = 1e9+7;
const int N = 6e5+2;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
set<pii> st;
queue<int> q;
int pre[N], dp[N];
vi ans;
void gao(int x) {
    if(pre[x]==-1) return;
    gao(pre[x]);
    ans.pb(x-pre[x]);
}
int main() {
    int n, m;
    string s;
    cin>>n>>m>>s;
    mt(dp, 0); mt(pre, -1);
    q.push(0); st.insert(mp(0,0));
    rep(i, 1, n + 1) {
        while(sz(q)&&q.front()+m<i) {
            pii tmp = mp(dp[q.front()], q.front()); q.pop();
            st.erase(tmp);
        }
        if(!sz(st)) { return printf("-1\n"),0; }
        if(s[i]=='1') continue;
        auto it = *st.begin();
        dp[i] = it.fi + 1;
        pre[i] = it.se;
        q.push(i);
        st.insert(mp(dp[i],i));
        //dd(i);dd(s[i]);dd(dp[i]);de(pre[i]);
    }
    gao(n);
    rep(i,0,sz(ans)) printf("%d%c",ans[i]," \n"[i+1==sz(ans)]);
    return 0;
}


Measured memory_bytes: 10488
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;

constexpr ll mod=1e9+7;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int d,t,s; cin >> d >> t >> s;
    if(s*t>=d){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int h,w,n; pii p[SZ];
vector<int> sb[SZ];
set<pii> gg;
int main()
{
	scanf("%d%d%d",&h,&w,&n);
	for(int i=1;i<=n;++i)
		scanf("%d%d",&p[i].fi,&p[i].se),
		sb[p[i].fi].pb(p[i].se),
		gg.insert(p[i]);
	if(h==1)
	{
		puts("1");
		return 0;
	}
	int R=1;
	for(int i=2;i<=h;++i)
	{
		int RR=min(R+1,w);
		for(auto t:sb[i])
			if(t<=R)
			{
				printf("%d\n",i-1);
				return 0;
			}
			else RR=min(RR,t-1);
		R=RR;
	}
	printf("%d\n",h);
}


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

int main() {
int64_t n,a,ans;
  ans=0;
  cin>>n;
   vector<int64_t> wa(1000001);
   vector<int64_t> sa(1000001);
  
for(int64_t i=0;i<n;i++){
cin>>a;
if(a<200000){
 wa.at(a+i+500000+1)++; 
   sa.at(i+500000+1-a)++; 
}
}  
for(int i=0;i<1000001;i++){
ans=ans+wa.at(i)*sa.at(i);
}
  cout<<ans<<endl;
}

Measured memory_bytes: 18808
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l, s1, s2;
int ans;

const int N = 200001;
const int M = 400;
int d1[N], d2[N], reach[N];
vector<int> v1[N], v2[N];
vector<int> bad;

void bfs(int start, vector<int>* v, int* d) {
	F1(i, n) d[i] = -1;
	d[start] = 0;

	queue<int> Q;
	Q.push(start);
	while (!Q.empty()) {
		int i = Q.front(); Q.pop();
		for (int j : v[i]) {
			if (d[j] == -1) {
				d[j] = d[i] + 1;
				Q.push(j);
			}
		}
	}
}

set<pii> S, S2;

int good(pii P) {
	if (!reach[P.first]) return 0;

	for (int j : bad) {
		pii P1(P.first, j);
		pii P2(P.second, j);
		if (P1.first > P1.second) swap(P1.first, P1.second);
		if (P2.first > P2.second) swap(P2.first, P2.second);
		if (S2.count(P1) && S2.count(P2)) return 0;
	}
	return 1;
}

void dfs(int i) {
	reach[i] = 1;
	for (int j : v1[i]) if (!reach[j] && d1[j] < d2[j]) dfs(j);
}

int main() {
	//freopen("x.in", "r", stdin);

	cin >> n >> s1 >> s2;


	F0(u, n - 1) {
		scanf("%d%d", &i, &j);
		if (i > j) swap(i, j);
		v1[i].push_back(j);
		v1[j].push_back(i);
		S.insert(pii(i, j));
	}
	F0(u, n - 1) {
		scanf("%d%d", &i, &j);
		if (i > j) swap(i, j);
		v2[i].push_back(j);
		v2[j].push_back(i);
		S2.insert(pii(i, j));
		if (S.count(pii(i, j))) S.erase(S.find(pii(i, j)));
	}

	F1(i, n) if (SZ(v2[i]) <= M) {
		F0(j1, SZ(v2[i]))
		for (int j2 = j1 + 1; j2 < SZ(v2[i]); j2++) {
			int x = v2[i][j1], y = v2[i][j2];
			if (x > y) swap(x, y);
			if (S.count(pii(x, y))) {
				S.erase(S.find(pii(x, y)));
				//cout << x << " " << y << endl;
			}
		}
	}
	else bad.push_back(i);

	bfs(s1, v1, d1);
	bfs(s2, v2, d2);

	dfs(s1);

	// inf case
	for (pii P : S) {
		if (good(P)) {
			cout << "-1" << endl;
			exit(0);
		}
		swap(P.first, P.second);
		if (good(P)) {
			cout << "-1" << endl;
			exit(0);
		}
	}
	
	int ans = 0;
	F1(i, n) if (reach[i]) ans = max(ans, 2 * d2[i]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 45300
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
	return *(int *)b-*(int *)a;
}
int main(void){
	int i,j,h[2],m[2],s[2],ah,am,as;
	for(i=0;i<3;i++){
		for(j=0;j<2;j++){
			scanf("%d %d %d",&h[j],&m[j],&s[j]);
		}
		int ti,to;
		ti=h[0]*3600+m[0]*60+s[0];
		to=h[1]*3600+m[1]*60+s[1];
		int ans=to-ti;
		ah=ans/3600;
		ans%=3600;
		am=ans/60;
		ans%=60;
		as=ans;
		printf("%d %d %d\n",ah,am,as);
	}
    return 0;
}
	

Measured memory_bytes: 600
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      // cout << f[x] << endl;
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }

};


int main() {
  int N;
  Sieve si(1000000);
  cin >> N;
  long long ans = 0;
  for(int c = 1; c < N; c++) {
    int temp = N - c;
    // cout << temp << endl;
    vector<P> v = si.factor(temp);
    long long t = 1;
    // cout << c << endl;
    rep(i, v.size()) {
      t *= (v[i].second + 1);
    }
    ans += t;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define F first
#define S second
#define um map <ll,ll>
#define rep(i,z,n)  for(int i=z;i<n;i++)
#define repi(i,z,n) for(int i=z;i<=n;i++)
#define repn(i,z,n) for(int i=n-1;i>=z;i--)
#define vec vector<ll>
#define vecp vector<pair<ll,ll>>
#define pi (double)3.14159265358979323846
#define ld long double
#define all(z) z.begin(),z.end()

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; if (a == 0) return 0; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }
ll modInverse(ll a, ll m) {return power(a, m - 2, m);}
ll binpow(ll a, ll b) {ll res = 1; while (b > 0) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll binlog2(ll n) {ll logValue = -1; while (n) {logValue++; n >>= 1;} return logValue;}
ll ceil(ll t1, ll t2) {ll ans = (t1 + t2 - 1) / t2; return ans;}
void print(vec a) {rep(i, 0, a.size())cout << a[i] << " "; cout << endl;}
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;
const ll inf = 2e18;


void solve() {
    string s;
    cin >> s;
    if (s.back() == 's') {
        cout << s + "es" << endl;
    }
    else {
        cout << s + "s" << endl;
    }
}


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    speed;
    int test = 1;
    // cin >> test;
    while (test--) {
        // cout << "Case #" << t1 << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

//Yes, I have a number
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			String m = sc.nextLine();
			if(m.equals("END OF INPUT"))break;
			for(String s:m.split(" "))System.out.print(s.length());
			System.out.println();
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

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

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl



int main() {
    IN(string, aja);
    int a = aja[0]-'0';
    int b = aja[1]-'0';
    int c = aja[2]-'0';
    int d = aja[3]-'0';
    REP(i, 2){
        int s = a;
        if (i) {
            s+=b;
        }else{
            s-=b;
        }
        REP(j, 2){
            int t = s;
            if (j) {
                t+=c;
            }else{
                t-=c;
            }
            
            REP(k, 2){
                int u = t;
                if (k) {
                    u+=d;
                }else{
                    u-=d;
                }
                if (u == 7) {
                    cout << a << ( i ? '+' : '-') << b << ( j ? '+' : '-')
                        << c << ( k ? '+' : '-') << d << "=7"<< endl;
                    
                    return 0;
                }
            }
        }
    }
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll x, t;
  cin >> x >> t;

  if(t > x) cout << 0 << endl;
  else cout << x - t << endl;
  return 0;
}


Measured memory_bytes: 256
#D    高橋君と見えざる手 / An Invisible Hand
N,T = [int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]
Max = 0
count = 1
Min = A[0]
for i in range(N):
    if A[i] <= Min :
        Min = A[i]
    else :
        temp = A[i]-Min
        if temp > Max:
            Max = temp 
            count = 1
        elif temp == Max :
            count += 1
print(count)

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

using namespace std;

int solve(string &s, vector<vector<int>> &memo, int offset, bool flag) {
  int d = *(s.begin() + offset) - '0';
  if (offset == 0) {
    return flag ? 11 - d : d;
  }

  if (memo[offset][flag] < 0) {
    int res1 = solve(s, memo, offset - 1, false);
    int res2 = solve(s, memo, offset - 1, true);
    if (flag) {
      memo[offset][flag] = min(res1 + 11 - d, res2 + 9 - d);
    } else {
      memo[offset][flag] = min(res1, res2) + d;
    }
  }

  return memo[offset][flag];
}

int main(int argc, const char *argv[]) {
  string s;
  cin >> s;

  vector<vector<int>> memo(s.size(), vector<int>(2, -1));
  cout << min({solve(s, memo, s.size() - 1, false),
               solve(s, memo, s.size() - 1, true)})
       << '\n';
  return 0;
}

Measured memory_bytes: 134020
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

string s;
int cnt[26];

int main(){
    cin>>s;

    int ans=1001001001;
    rep(i,26){
        char c='a'+i;
        string t=s;
        int cnt=0;
        while(true){
            bool b=true;
            rep(j,t.size()){
                b&=t[j]==c;
            }
            if(b) break;

            string res;
            rep(j,t.size()-1){
                if(t[j]==c || t[j+1]==c){
                    res+=c;
                }else{
                    res+=t[j];
                }
            }
            cnt++;
            t=res;
        }
        ans=min(ans,cnt);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3572
#include<iostream>
#include<list>
#include<vector>
#include<string>
#include<cmath>
#include <algorithm>

using namespace std;

const int MAX = 2000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  	int N, K;
    cin >> N;
    cin >> K;
	vector<long long int> count(K, 0);
  	COMinit();
  
  	for (int j = 0; j < K; j++){
      int i = j + 1;
      if (i == 1){
        count[j] = COM(N-K+1, i);
      }
      else{
        count[j] = COM(N-K+1, i) * COM(K-1, i-1) % MOD;
      }
    }

  	for (int j = 0; j < K; j++){
    	cout << count[j] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long  ll;
typedef unsigned long long int ull;
#define pb push_back
#define For(ii,aa,bb) for(ll ii = aa; ii < bb;ii++)
#define Rof(ii,aa,bb) for(ll ii = aa; ii >= bb;ii--)
#define st first 
#define nd second 
#define MP make_pair
#define MAX 1000000009
#define MOD 1000000007
#define all(v6) v6.begin(),v6.end()
#define IT iterator
#define ln "\n"
#define F(ii) ((abs(ii) + ii)/2)
#define N 500005
using namespace std;
ll n, x;
int main(){
	#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n >> x;	
	if (x < n){
		swap(n, x);
	}
	while (x--){
		cout << n;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <deque>

using namespace std;

#define rep1(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, n, m) for (long long i = (long long)(n); i <= (long long)(m); i++)
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;

int main() {
    string s;
    cin >> s;
    long long count_g = 0;
    long long count_p = 0;
    for (char c : s) {
        if (c == 'g') {
            count_g++;
        } else {
            count_p++;
        }
    }
    cout << (count_g - count_p) / 2 << endl;
}

Measured memory_bytes: 512
def lcs(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)
    for i in range(a):
        e1 = x[i]
        c2 = c1[:]
        for j in range(b):
            if e1 == y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
   
n = int(input().rstrip())
ret = []
for i in range(n):
    s1 = input().rstrip()
    s2 = input().rstrip()
    ret.append(lcs(s1, s2))
print(*ret, sep="\n")

Measured memory_bytes: 7804
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<ll> A(3 * N, 0);
    for (int i = 0; i < 3 * N; i++)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<ll>());
    ll ans = 0;
    for (int i = 1; i < 2 * N; i += 2)
    {
        ans += A[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int modPow(ll a, ll n, ll p) { //繰り返し二乗法 a**n % p
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
int main(){
  int len = 100100;
  vector<ll> fact(len), invfact(len);
  fact[0] = fact[1] = 1;
  for(int i = 2; i < len; i++) fact[i] = (fact[i - 1] * i) % mod;
  invfact[len - 1] = modPow(fact[len - 1], mod - 2, mod);
  for(ll i = len - 2; i >= 0; i--) invfact[i] = (invfact[i + 1] * (i + 1)) % mod;
  int n,m;
  cin >> n >> m;
  vi sosu;
  for(int i = 2; i * i <= m; i++){
    int num = 0;
    while(m % i == 0){
      m /= i;
      num++;
    }
    sosu.push_back(num);
  }
  if(m > 1) sosu.push_back(1);
  ll ans = 1;
  for(int x : sosu){
    ans *= fact[x + n - 1] * (invfact[x] * invfact[n - 1] % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1920
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace CsTest
{
    class Program
    {
        static void Main()
        {
            var X = AtCoder.ReadInt64Array()[0];
            //var W = Wab[0];
            
            Console.WriteLine(Math.Ceiling((-1 + Math.Sqrt(1 + 8 * X)) / 2));
        }
    }

    public class AtCoder
    {
        public static string[] ReadStringArray() => Console.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        public static int[] ReadInt32Array() => ReadStringArray().Select(s => int.Parse(s)).ToArray();
        public static long[] ReadInt64Array() => ReadStringArray().Select(s => long.Parse(s)).ToArray();
    }
}

Measured memory_bytes: 13396
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    string s;
    cin >> n >> s;
    string t = s.substr(0,n/2);
    string k = t + t;
    if(s==k){
        puts("Yes");
    }else{
        puts("No");
    }
}


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

int main()
{
	string s;
	while (cin >> s) {
		if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
			cout << "Bad\n";
		else cout << "Good\n";
	}
}

Measured memory_bytes: 3640