akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate など
#include <stdexcept>
#include <cassert> // assert
using namespace std;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

constexpr ll MOD = 998244353;
array<array<ll, 3009>, 3009> dp;
int n,s;
array<int, 3009> a;

int main()
{
    cin >> n >> s;
    REP(i, n)
    {
        cin >> a.at(i);
    }

    dp.at(0).at(0) = 1;
    REP(j, s + 1)
    {
        dp.at(0).at(j + 1) = 0;
    }
    REP(i, n + 1)
    {
        REP(j, s + 1)
        {
            dp.at(i + 1).at(j) = (2 * dp.at(i).at(j) %MOD +
                ((j >= a.at(i)) ? dp.at(i).at(j - a.at(i)) : 0)) %MOD;
        }
    }
    cout << dp.at(n).at(s) << endl;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

vector<int>c;
int d;vector<vector<int>>s;
vector<int>last;
int calc(int t,int score,int day){
        score+=s[day][t];
        last[t]=day+1;
        for (int j = 0; j < 26; ++j)score-=c[j]*(day+1-last[j]);
        return score;
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cin >>d;
    c.resize(26);
    for (int i = 0; i <26; ++i) cin >>c[i];
    s.assign(d,vector<int>(26));
    for (int i = 0; i < d; ++i)for (int j = 0; j < 26; ++j) cin >>s[i][j];
    int score=0;
    last.assign(26,0);
    vector<int>t(d);
    for (int day = 0; day < d; ++day) {
        int now=-INF;
        for (int i = 0; i < 26; ++i) {
           if(now<calc(i,score,day)){
               now=calc(i,score,day);
               t[day]=i+1;
           }
        }
    }
    for (int i = 0; i < d; ++i) {
        cout<<t[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3700
l, k = map(int, input().split())
memo = {(l, 0): 1, (l, 1): 0}
def dfs(cur, dark):
    if (cur, dark) in memo:
        return memo[cur, dark]
    res = dfs(cur + 1, dark^1) + (dark^1)
    if dark and cur + k <= l:
            res += dfs(cur + k, dark^1)
    memo[cur, dark] = res
    return res
print(dfs(0, 1))

Measured memory_bytes: 5616
def check(i):
    print(i)
    c[i] = input()
    if c[i] == 'Vacant':
        exit(0)
n = int(input())
c = [-1]*n
l = 0
r = n-1
check(l)
check(r)
while True:
    m = (l+r)//2
    check(m)
    if (c[l] == c[m] and (m-l) % 2 != 0) or (c[l] != c[m] and (m-l) % 2 == 0):
        r = m
    else:
        l = m

Measured memory_bytes: 9652
#include <stdio.h>

int main(){
  int a[10], max, maxidx;
  for(int i=0; i<=9; i++){
    scanf("%d", &a[i]);
  }
  for(int j=0; j<3; j++){
    max = -1;
    for(int i=0; i<=9; i++){
      if(a[i] > max){
	max = a[i];
	maxidx = i;
      }
    }
    printf("%d\n", max);
    a[maxidx] = -1;
  }
}

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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ldb long double 
#define db double
#define int long long

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >

#define mi map<int,int>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const int INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

int power_md(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res=(res%md*a%md)%md;
  a=(a%md*a%md)%md;
  n/=2;
}
res%=md;
return res;
}

int power(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a=a*a;
  n/=2;
}
return res;
}

int abst(int a)
{
 return ((a<0)?(-1*a):(a));
}

class cmp_set{
public:
	bool operator() (int a, int b){
		return a > b;
	}
};

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int32_t main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
     cin>>arr[i];
     sort(arr,arr+n);
     int res=(int)1;
     int z=(int)1000000000000000000;
     for(int i=0;i<n;i++)
     {
         int req=z/res;
         if(arr[i]>req)
         {
             cout<<-1<<"\n";
             return 0;
         }
         else
          res=res*arr[i];
          if(res==0)
          {
              cout<<0<<"\n";
              return 0;
          }
     }
     cout<<res<<"\n";
    return 0;
}


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

#define BeatMeScanf    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define tc(x)          int x; cin >> x; while(x--)
#define ll             long long
#define vi             vector<int>
#define pii            pair<int,int>
#define mii            map<int,int>
#define inf            1<<28
#define mem(x,y)       memset(x, y, sizeof(x))
#define ps(x,y)        fixed<<setprecision(y)<<x
#define show(val)      cout<< #val << " -> " << val << endl
#define Case           cout<< "Case "<< ++cs << ": "
#define all(v)         (v).begin(), (v).end()
#define rall(v)        (v).rbegin(), (v).rend()
#define MOD            1000000007
#define MAX            100005

int main()
{
	BeatMeScanf;

	int r;
	cin >> r;
	double ans = 2.00*3.14159265358979323*r;
	cout<< fixed<<setprecision(10)<<ans <<'\n';
	return 0;
}


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


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

    long long n;
    cin >> n;
    string result;
    int i = 0;
    int res;
    while (n) {
        res = abs(n % -2);
        result = to_string(res) + result;
        if (res) n -= 1;
        n /= -2;
    }
    if (result == "") result = "0";
    
    cout << result << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

int main() {
  string S;
  int Q;
  cin >> S;
  cin >> Q;
  bool t = false;
  string pre = "";
  string app = "";
  rep(i,Q) {
    int T;
    cin >> T;
    if (T == 1) {
      t = !t;
    } else {
      int F;
      char C;
      cin >> F >> C;
      if (F == 1) {
        if (t) app = app + C;
        else pre = C + pre;
      } else {
        if (t) pre = C + pre;
        else app = app + C;
      }
    }
  }
  S = pre + S + app;
  if (t) reverse(S.begin(), S.end());
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 1512
#include <stdio.h>
long long int a[255];
long long int main()
{
	long long int n,fc=1,lc=1,tc=0,len=0,mc=0;
	char s[105];
	scanf("%s",s);
	scanf("%lld",&n);
	for(long long int i=0;s[i]!='\0';i++)
	{
		a[s[i]]++;
		len++;
	}
	if(a[s[0]]==len)
	{
		printf("%lld\n",(n*len)/2);
	}
	else if(s[0] == s[len-1])
	{
		for(long long int i=1;s[i]==s[i-1];i++)
		{
			fc++;
		}
		for(long long int i=len-2;s[i]==s[i+1];i--)
		{
			lc++;
		}
		for(long long int i=fc+1;i<len-lc;i++)
		{
			if(s[i]==s[i-1])
			{
				mc=1;
				long long int k=i;
				for(long long int j=k-1;s[j]==s[j+1];j++)
				{
					mc++;
					i++;
				}
				tc=tc+(mc/2);
			}
		}
		//prlong long intf("%lld %lld %lld\n",fc,tc,lc);
		printf("%lld\n",(fc/2)+(n*tc)+((n-1)*((lc+fc)/2))+(lc/2));
	}
	else
	{
		for(long long int i=0;i<len;i++)
		{
			if(s[i]==s[i-1])
			{
				mc=1;
				long long int k=i;
				for(long long int j=k-1;s[j]==s[j+1];j++)
				{
					mc++;
					i++;
				}
				tc=tc+(mc/2);
			}
		}
		printf("%lld\n",n*tc);
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.math.*;
import java.util.*;

class Main {
    private static final Scanner sc = new Scanner(System.in);

    private static final long MOD = 1000000007;

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();


        long result = 1;
        for (int i = 2; i*i <= m; i++) {
            int c = 0;
            while (m % i == 0) {
                c++;
                m /= i;
            }
            result = result * comb(c + n - 1, n - 1) % MOD;
        }
        if (m != 1) result = result * n % MOD;


        System.out.println(result);

        sc.close();
    }

    private static long modPow(long a, long b) {
        if (b == 0) return 1;
        long c = modPow(a, b/2);
        long ret = (c * c) % MOD;
        if (b % 2 == 1) ret = (ret * a) % MOD;
        return ret;
    }

    private static long comb(int x, int y) {
        if (y > x - y) return comb(x, x-y);
        long num = 1, denom = 1;

        for (int i = 1; i <= y; i++) {
            num = num * (x - i + 1) % MOD;
            denom = denom * i % MOD;
        }

        return num * modPow(denom, MOD-2) % MOD;
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<double,int> P;
typedef pair<P,ll> T;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-15
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
const int SIZE = 1<<18;
struct segtree{
	ll seg[SIZE*2];
	void update(int k,ll x){
		k+=SIZE-1;
		seg[k]=x;
		while(k){
			k = (k-1)/2;
			seg[k]=max(seg[k*2+1],seg[k*2+2]);
		}
	}
	ll query(int a,int b,int k=0,int l=0,int r=SIZE){
		if(r<=a||b<=l)return 0;
		else if(a<=l&&r<=b)return seg[k];
		else{
			ll lch = query(a,b,k*2+1,l,(l+r)/2);
			ll rch = query(a,b,k*2+2,(l+r)/2,r);
			return max(lch,rch);
		}
	}
}seg;
ll n;
vector<int> x;
int main(){
	scanf("%lld",&n);
	x.resize((int)n);
	for(int i=0;i<n;i++)scanf("%d",&x[i]);
	for(int i=0;i<n;i++){
		seg.update(x[i],(ll)x[i]+seg.query(0,x[i]));
	}
	cout << n*(n+1)/2ll-seg.query(0,SIZE) << endl;
	return 0;
}

Measured memory_bytes: 4924
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

template <class I>
void radix_sort(I first, I last) {
    using T = typename iterator_traits<I>::value_type;
    static_assert(is_integral<T>::value, "");
    constexpr int L = 8, M = 1 << L, K = (sizeof(T) * 8 + L - 1) / L;

    size_t n = last - first;
    T *p[2] = { &*first, (T *)malloc(n * sizeof(T)) };
    size_t m[M];

    for (int k = 0; k < K; k++) {
        fill_n(m, M, 0);
        for (size_t i = 0; i < n; i++) {
            m[p[0][i] >> (L * k) & M - 1]++;
        }
        for (int j = M - 1; j > 0; j--) {
            m[j] = m[j - 1];
        }
        m[0] = 0;
        for (int j = 2; j < M; j++) {
            m[j] += m[j - 1];
        }
        for (size_t i = 0; i < n; i++) {
            T t = p[0][i];
            p[1][m[t >> (L * k) & M - 1]++] = t;
        }
        swap(p[0], p[1]);
    }
    if (K % 2 == 1) {
        swap(p[0], p[1]);
        copy_n(p[1], n, p[0]);
    }
    if (is_signed<T>::value) {
        T *q = upper_bound(p[0], p[0] + n, 0, greater<>());
        rotate(p[0], q, p[0] + n);
    }
    free(p[1]);
}

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

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

    radix_sort(a.begin(), a.end());

    int r = 0, b = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b) {
            r--;
            b = 0;
        } else {
            b = a[i];
        }
    }

    cout << r * 2 + n << endl;

    return 0;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func see(heights []int, vp int) bool {
	for _, height := range heights {
		if height > vp {
			return false
		}
	}
	return true
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	cnt := 0
	heights := make([]int, n)
	for i := 0; i < n; i++ {
		vp := nextInt()
		if see(heights, vp) {
			cnt++
		}
		heights[i] = vp
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
const unsigned long long int M= 1000000007;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()	
#define fr(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define int long long 
#define endl "\n"
using namespace std;
int power(int x,int y){int res=1;while(y>0){if(y&1)res=x*res; y=y>>1;x=x*x;}return res;}
int power(int x,int y,int mod){int res=1;while(y>0){if(y&1)res=x*res%mod; y=y>>1;x=x*x%mod;}return res;}

void nik()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

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

 	#define F first 
	#define S second 


signed main()
{	nik();

		int test=1;
		//cin>>test;
		while(test--)
		{
		int n,k;
		cin>>n>>k;
		int l[k],r[k];
		int ans[n+1]={0},presum[n+1]={0};
		ans[1]=1;
		presum[1]=1;
		fr(i,k)
		{
			cin>>l[i]>>r[i];
		}
		int mod=998244353;
		for(int i=2;i<=n;i++)
		{
			fr(j,k)
			{
				int li=i-r[j];
				int ri=i-l[j];
				if(ri<0)continue;
				li=max(li,1ll);
				ans[i]+=(presum[ri]-presum[li-1]+mod)%mod;

			}
			presum[i]=(presum[i-1]+ans[i]+mod)%mod;
		}
		cout<<(ans[n]+mod)%mod;

		}
return 0;
}



Measured memory_bytes: 6776
var
	N,K,i,a,p:Longint;
	D:Array[0..9]of Boolean;
begin
	read(N,K);
	for i:=1 to K do begin
		read(a);
		D[a]:=True;
	end;
	while(N>=1000)and(D[N div 1000 mod 10])do N:=(N div 1000+1)*1000;
	while(N>=100)and(D[N div 100 mod 10])do N:=(N div 100+1)*100;
	while(N>=10)and(D[N div 10 mod 10])do N:=(N div 10+1)*10;
	while(N>=1)and(D[N mod 10])do inc(N);
	while(N>=10000)and(D[N div 10000 mod 10])do N:=(N div 10000+1)*10000;
	while(N>=1000)and(D[N div 1000 mod 10])do N:=(N div 1000+1)*1000;
	while(N>=100)and(D[N div 100 mod 10])do N:=(N div 100+1)*100;
	while(N>=10)and(D[N div 10 mod 10])do N:=(N div 10+1)*10;
	while(N>=1)and(D[N mod 10])do inc(N);
	while(N>=10000)and(D[N div 10000 mod 10])do N:=(N div 10000+1)*10000;
	while(N>=1000)and(D[N div 1000 mod 10])do N:=(N div 1000+1)*1000;
	while(N>=100)and(D[N div 100 mod 10])do N:=(N div 100+1)*100;
	while(N>=10)and(D[N div 10 mod 10])do N:=(N div 10+1)*10;
	while(N>=1)and(D[N mod 10])do inc(N);
	while(N>=10000)and(D[N div 10000 mod 10])do N:=(N div 10000+1)*10000;
	while(N>=1000)and(D[N div 1000 mod 10])do N:=(N div 1000+1)*1000;
	while(N>=100)and(D[N div 100 mod 10])do N:=(N div 100+1)*100;
	while(N>=10)and(D[N div 10 mod 10])do N:=(N div 10+1)*10;
	while(N>=1)and(D[N mod 10])do inc(N);
	while(N>=10000)and(D[N div 10000 mod 10])do N:=(N div 10000+1)*10000;
	while(N>=1000)and(D[N div 1000 mod 10])do N:=(N div 1000+1)*1000;
	while(N>=100)and(D[N div 100 mod 10])do N:=(N div 100+1)*100;
	while(N>=10)and(D[N div 10 mod 10])do N:=(N div 10+1)*10;
	while(N>=1)and(D[N mod 10])do inc(N);
	writeln(N);
end.

Measured memory_bytes: 128
#include <iostream>

using namespace std;

struct Card {
	char suit, value;
};


void Bubble(struct Card* A, int N) {
	for (int i = N - 1; i > -1; i--) {
		bool noSwapDone = true;
		for (int j = 0; j < i; j++) {
			if (A[j].value > A[j + 1].value) {
				swap(A[j], A[j + 1]);
				noSwapDone = false;
			}
		}
		if (noSwapDone) break;
	}

}

void Selection(struct Card* A, int N) {
	for (int i = 0; i < N; i++) {
		int minIndex = i;
		for (int j = i; j < N; j++) {
			if (A[j].value < A[minIndex].value) minIndex = j;
		}
		if (i != minIndex) swap(A[i], A[minIndex]);
	}

}

void ConsolePrinter(struct Card* A, int N) {
	for (int i = 0; i < N; i++)
	{
		if (i) cout << " ";
		cout << A[i].suit << A[i].value;
	}
	cout << endl;
}

bool isSortStable(struct Card* StableCards, struct Card* CheckingCards, int N) {
	for (int i = 0; i < N; i++) {
		if (StableCards[i].suit != CheckingCards[i].suit) return false;
	}
	return true;
}

int main() {
	Card C1[100], C2[100];
	int N;
	char ch;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C1[i].suit >> C1[i].value;
	}

	for (int i = 0; i < N; i++) C2[i] = C1[i];

	Bubble(C1, N);
	Selection(C2, N);

	ConsolePrinter(C1, N);
	cout << "Stable" << endl;

	ConsolePrinter(C2, N);
	if (isSortStable(C1, C2, N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	return 0;

}



Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  
  string s;
  cin>>s;
  if (s[0]<=65+27){
    cout<<"A"<<endl;
  }else{
    cout<<"a"<<endl;
  }
  return 0;
}

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

#define INF 1e9
using namespace std;

int main() {

    string S; cin >> S;

    if ((S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) || (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) || (S[0] == S[3] && S[1] == S[2] && S[0] != S[1])) {
        puts("Yes");
        return 0;
    }

    puts("No");
}

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

int a,b,c;
int main() {
	cin>>a>>b>>c;
	if(a==b){
		cout<<c<<endl;
	}else if(a==c){
		cout<<b<<endl;
	}else if(b==c){
		cout<<a<<endl;
	}
}


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

int main(){

    int a,b;
    cin>>a>>b;
    if((int)(12.5*a+0.5)<10*b+10&&10*b<(int)(12.5*a+12.5+0.5)){
        cout<<max((int)(12.5*a+0.5),10*b)<<endl;
    }
    else cout<<-1<<endl;


    return 0;
}

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


int main()
{
	int a,b,c,k;
	scanf("%d%d%d%d",&a,&b,&c,&k);
	if(k<=a) printf("%d",k);
	else if(k<=a+b) printf("%d",a);
	else printf("%d",a+a+b-k);
}

Measured memory_bytes: 3828
N=input()
S1=raw_input()
S2=raw_input()

l=[]
flag=-1
for i in range(N):
	if S1[i]==S2[i]:
		l.append("X")
		flag=0
	else:
		if i==0:
			l.append("Y")
		elif S1[i-1]!=S1[i]:
			l.append("Y")
		else:
			pass

ans=-1
for ind,i in enumerate(l):
	if ind==0:
		if i=="X":
			ans=3
		else:
			ans=6
	else:
		if i=="Y" and l[ind-1]=="X":
			ans*=2
		elif i=="Y" and l[ind-1]=="Y":
			ans*=3
		elif i=="X" and l[ind-1]=="Y":
			ans*=1
		elif i=="X" and l[ind-1]=="X":
			ans*=2

print ans%1000000007


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

string ob;
bool C;

int main()
{
    cin>>ob;
    int len=ob.length();
    for(int i=0;i<len;i++)
        if(ob[i]=='C') C=1;
        else if(C && ob[i]=='F') cout<<"Yes",exit(0);
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ins insert
#define vi vector<int>
const int mxN=2e5;

int main()
{
    string s;
    cin >> s;
    int n=s.length();
    if(s[n-1]!='s')
        s+="s";
    else
        s+="es";
    cout << s;
}

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

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i){
    char c;
    cin >> c;
    if(c == 'Y'){
      cout << "Four" << endl;
      return 0;
    }
  }

  cout << "Three" << endl;
  return 0;
}

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 100001;
static const ll MOD = 1000000007;
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; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

vector<ll> sieve(long long max){ // 0 <= x <= max までの素数を調べ、返す。
    vector<bool> isPrime;
	vector<ll> ret;
    isPrime.resize(max+1,true); // isPrimeに必要な要素数を確保
    isPrime[0] = false; // 0は素数ではない
    isPrime[1] = false; // 1は素数ではない

    for(int i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(isPrime[i])
            for(int j=2; i*j<=max; ++j)
                isPrime[i*j] = false;

	rep(i, isPrime.size()){
		if(isPrime[i]) ret.push_back(i);
	}
    return ret;
}

ll n;
ll ans = 0;
vector<ll> primes;
vector<int> nums;
vector<ll> tes;
int kinds = 0;
void dfs(ll val, ll dep, int s, ll val2){
	ans += (val2) * val;
	ll tmp = n / val;
	int k = s;
	while(1){
		if(tmp < primes[k]) break;
		val2 /= nums[k];
		nums[k]++;
		val2 *= nums[k];
		dfs(val * primes[k], dep+1, k, val2);
		val2 /= nums[k];
		nums[k]--;
		val2 *= nums[k];
		k++;
	}
}


int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	primes = sieve(MAX * 100);
	// print(primes.size());
	nums.resize(primes.size(), 1);
	cin >> n;
	dfs(1, 0, 0, 1);
	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 12696
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
#include <set>
using namespace std;


void solve()
{
	string s;
	cin >> s;

	if (s == "SUN")
	{
		cout << 7;
	}

	if (s == "MON")
	{
		cout << 6;
	}

	if (s == "TUE")
	{
		cout << 5;
	}

	if (s == "WED")
	{
		cout << 4;
	}

	if (s == "THU")
	{
		cout << 3;
	}

	if (s == "FRI")
	{
		cout << 2;
	}

	if (s == "SAT")
	{
		cout << 1;
	}
	
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

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 pair<int,int> P;
const int MAX_N = 200005;
int P[MAX_N],M[MAX_N];

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		cin >> P[i];
	}
	M[0] = P[0];
	rep(i,N-1)
	{
		M[i+1] = min(M[i],P[i+1]);
	}
	int ans = 0;
	rep(i,N)
	{
		if (P[i] <= M[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << "=" << x << ","
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b-1);i>=a;--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define lowbit(x) x&(-x)
const int N = 20000;
const int M = 1e9+7;

int a[110][200010];
int b[110][200010];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    for (int i=1; i<=n; i++){
    	cin>>a[0][i];
	}
	for (int i=0; i<k; i++){
		for (int j=1; j<=n; j++){
			b[i+1][max(1,j-a[i][j])]++;
			b[i+1][min(n+1,j+a[i][j]+1)]--;
		}
		int t=0,f=1;
		for (int j=1; j<=n; j++){
			t+=b[i+1][j];
			a[i+1][j]=t;
			if (a[i+1][j]!=n) f=0;
		}
		if (f){
			for (int j=1; j<=n; j++)
				cout<<a[i+1][j]<<' ';
			return 0;
		}
	}
	for (int j=1; j<=n; j++)
		cout<<a[k][j]<<' ';
    return 0;
}


Measured memory_bytes: 52140
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();

		sc.close();

		long ans = 0;

		ans += N / (A + B) * A;

		long z = N % (A + B);
		ans += Math.min(z, A);

		out.println(ans);
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 23252
fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map { it.toInt() }
    val fruits = readLine()!!.split(" ").map { it.toInt() }.sorted()

    fun countFruit(fruits: List<Int>, limit: Int, amount: Int = 0): Int {
        return if (limit < 1 || fruits.isEmpty()) amount else countFruit(fruits.takeLast(fruits.size - 1), limit - 1, amount + fruits[0])
    }

    println(countFruit(fruits, K))
}


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

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define w while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

int main()
{
	FASTIO;
	string n;
	int i,flag=0;
	cin>>n;
	for(i=0;i<3;i++){
        if(n[i]=='7')
            flag=1;
	}
    if(flag==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 3648
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  n <- readLn
  lrs <- map (map readInt . BS.words) . BS.lines <$> BS.getContents
  print $ solve n lrs

solve :: Int -> [[Int]] -> Int
solve _ = sum . map (\[l, r] -> r - l + 1)

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll dp[61][2][2][2]; 

const ll M = 1e9+7;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);


  ll L, R;
  cin >> L >> R;

  dp[60][0][0][0] = 1;

  for(int i = 59; i >= 0; --i){
    int lb = L >> i & 1;
    int rb = R >> i & 1;
    for(int j = 0; j < 2; j++){
      for(int k = 0; k < 2; k++){
        for(int s = 0; s < 2; s++){
          ll pre = dp[i+1][j][k][s];
          for(int x = 0; x < 2; x++){
            for(int y = 0; y < 2; y++){
              if(x && !y) continue; // x = 0 かつ y = 1のとき、ダメ
              int nj = j, nk = k, ns = s; // next state
              if(!s && x != y) continue;
              if (x && y) ns = 1;
              if(!j && !x && lb) continue;
              if(x && !lb) nj = 1;

              if(!k && y && !rb) continue;
              if(!y && rb) nk = 1;

              dp[i][nj][nk][ns] = (dp[i][nj][nk][ns] + pre) % M;
            }
          }
        }
      }
    }
  }

  ll ans = 0;
  for(int j = 0; j < 2; j++){
    for(int k = 0; k < 2; k++){
      for(int s = 0; s < 2; s++){
        ans = (ans + dp[0][j][k][s])%M;
      }
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
//
// Created on 2019-02-09.
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }

#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

#define PB push_back
#define INF 1e9
#define MOD 1e9+7
#define EPS 1e-9

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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


    int N, K;

    cin >> N >> K;

    int num = 1+2*(K-1);


    if(num <= N) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX / 2)

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    string s;
    cin>>s;
    map<char,bool>m;
    m['W']=false;
    m['N']=false;
    m['E']=false;
    m['S']=false;
    for(char c:s){
        m[c]=true;
    }
    if(m['W']==m['E']&&m['N']==m['S']){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}
/*

*/


Measured memory_bytes: 3552
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    //高速化用のおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    const string ACCEPTED = "AC";
    const string WRONG = "WA";
    
    int n;//問題数
    int m;//提出数
    
    
    cin >>n>>m;
    vector<int> arr(n,0);
    vector<bool> arr_ok(n,false);
    
    int num_ok=0;

    int tmp = m;
    while(tmp--){
        int num;
        string input;
        cin >>num>> input;
        if(input == WRONG){
            if(!arr_ok[num-1]){
                arr[num-1]++;
            }
        }
        else{
            if(!arr_ok[num-1]){
                num_ok++;
            }
            arr_ok[num-1]=true;
        }
    }
    int num_pen=0;
    for(int i=0;i<n;i++){
        if(arr_ok[i]){
            num_pen += arr[i];
        }    
    }
    cout << num_ok <<" "<< num_pen;
}

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

using namespace std;

#define MAX 1200
#define P 188
#define N 1121
#define K 14

vector<int> vprimes;
bool *isPrime = new bool[MAX];

/* ツ素ツ青板青カツ青ャ O(n^2) */
void MakePrime(){
  isPrime[0]=false;
  isPrime[1]=false;
  isPrime[2]=true;
  for(int i = 2; i < MAX; ++i){
    isPrime[i] = true;
  }
  for(long long int i = 2; i < MAX; ++i){
    if( isPrime[i] ){
      for(long long int j = 2; i * j < MAX; ++j) {
	isPrime[i*j] = false;
      }
    }
  }
  for(int i = 0; i < MAX; ++i){
    if( isPrime[i] ){
      vprimes.push_back( i );
    }
  }
}

int table[P][N][K];
int next_big_prime_index[N];

int solve(int last_prime, int n, int k){
  int &t = table[last_prime][n][k];
  int ret = 0;
  if( k == 1 ){
    if( isPrime[ n ] && n > vprimes[last_prime] ){
      t = 1;
      return 1;
    }else{
      t = 0;
      return 0;
    }
  }else{
    if( t != -1 )return t;
    else{
      for(int i = last_prime+1; vprimes[i] < MAX && n - vprimes[i] > 0; ++i){
	ret += solve( i, n - vprimes[i], k-1);
      }
      table[last_prime][n][k] = ret;
      return ret;
    }
  }
}

int main(){
  MakePrime();
  //cout << vprimes.size()  << endl;
  vprimes.insert( vprimes.begin(), 0 );
  while(true){
    int n,k;
    cin >> n >> k;
    fill(&table[0][0][0],&table[P-1][N-1][K-1],-1);
    if( n == 0 && k == 0 ) break;
    cout << solve( 0, n, k ) << endl;
  }
  return 0;
}

Measured memory_bytes: 12000
def gcd(a,b):
    if b == 0 :
        return a 
    else:
        a_ = b
        b_ = a % b 
        return gcd(a_,b_)

N,X =  map(int,input().split())
para = [i for i in map(int,input().split())] + [X]
para.sort(reverse=True)
dif = []
for i in range(N):
    dif.append(para[i] - para[i+1])
dif.sort()
for i in range(N):
    if i == 0 :
        val = dif[i]
        continue
    val = gcd(max(dif[i],val),min(dif[i],val))

print(val)

Measured memory_bytes: 14252
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double   pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);i++)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
const ll iinf = -1e18 ;
//////////////////////    Hi    ^_^  hack me if you can :P

int main()
{
    speed;
    int a,b;
    a = 0;
    a*=10;
    cin >> b;
    a+=b;
    a*=10;
    cin >> b;
    a+=b;
    a*=10;
    cin >> b;
    a+=b;
    if (a%4==0){
        cout <<"YES";
    }else {
        cout <<"NO";
    }

}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

map<ll, ll> mp;
void prime_factorization(ll x){
    bool flag = true;
    while(flag){
        ll sqx = sqrt(x)+1;
        for(ll j=2;j<sqx+1;j++){
            if(x%j==0){
                mp[j]++;
                x/=j;
                break;
            }
            if(j==sqx) flag = false;
        }
    }
    if(x!=1){
        mp[x]++;
    }
}

int main(){
	ll N, P;
	cin >> N >> P;
	prime_factorization(P);
	ll res = 1;
	for(auto itr=mp.begin();itr!=mp.end();++itr){
		if(itr->second>=N){
			REP(i, itr->second/N){
				res *= (itr-> first);
			}
		}
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[200010];
long long b[200010];

int main(){
	int c;
	cin>>c;
	long long s=0;
	for(int i=0;i<c;i++){
		cin>>a[i];
		if(i==0)
			b[i]=a[i];
		else
			b[i]=b[i-1]+a[i];
		s=s+a[i];
	}
	long long m;
	if(b[0]>s-b[0])
		m=b[0]+b[0]-s;
	else
		m=s-b[0]-b[0];
	for(int i=1;i<(c-1);i++){
		if(m>abs(s-b[i]-b[i]))
		m=abs(s-b[i]-b[i]);
	}
	cout<<m<<endl;
	return 0;
} 

Measured memory_bytes: 3328
x,y = map(int, input().split())
A = set([1,3,5,7,8,10,12])
B = set([4,6,9,11])
C = set([2])

if x in A and y in A:
  print('Yes')
elif x in B and y in B:
  print('Yes')
elif x in C and y in C:
  print('Yes')
else:
  print('No')

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

using namespace std;

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

  string s;
  cin >> s;
  for (size_t i = 0; i < s.size() - 2; ++i) {
    if (s[i] == s[i + 1] && s[i + 1] == s[i + 2]) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<ctype.h>
#include<cstdlib>
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;
}
inline void Yeah(){puts("Yes");exit(0);}//可以得到
int main(){ 
    int n=read(),m=read(),k=read();//读入
    for(int i=1;i<=n;++i){
        int kk=(k-i*m),a=n-i-i;//kk是剩下的要变成黑色的格子,a是每次增加的黑格子
        if(!kk || a && (kk>>31&1)==(a>>31&1) && kk%a==0 && kk/a<=m)Yeah();
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
main = do
  [n,y] <- map read . words <$> getLine :: IO [Int]
  let c = [[k,j,i] | i<-[0..n], j<-[0..(n-i)], let k=n-i-j, (i*1000 + j*5000 + k*10000)==y]
  putStrLn $ unwords $ map show (if not $ null c then head c else [-1,-1,-1])

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

int main() {
  int N;
  string S;
  string A = "Three";
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> S;
    if (S == "Y"){
      A = "Four";
    }
  }
  cout << A <<endl;
}


Measured memory_bytes: 3532
#include<stdio.h>

int med3(int x, int y, int z);
void quickSort(int a[], int left, int right);
void sort(int a[], int size);

int A[4];


int main(){
	A[0]=getchar();
	getchar();
	A[1]=getchar();
	getchar();
	A[2]=getchar();
	getchar();
	A[3]=getchar();
	sort(A, 4);
	if(A[0]=='1' && A[1]=='4' && A[2]=='7' && A[3]=='9'){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}

int med3(int x, int y, int z){
	if(x < y){
		if (y < z){return y;}else if(z < x){return x;}else{return z;}
	} else {
		if (z < y){return y;}else if(x < z){return x;}else{return z;}
	}
}

void quickSort(int a[], int left, int right){
	if(left >= right){return;}
	int pivot = med3(a[left], a[left+(right-left)/2], a[right]);
	int l=left, r=right;
	while(1){
		while (a[l] < pivot){l++;}
		while (pivot < a[r]){r--;}
		if(l>=r){break;}
		int t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int a[], int size){
	quickSort(a, 0, size-1);
}


Measured memory_bytes: 128
n=int(input())
h=[int(i) for i in input().split()]
dp = [10**9 for i in range(n)]
dp[0]=0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))
print(dp[n-1])


Measured memory_bytes: 14052
#include <stdio.h>
int isprime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return 0;
    }
    return 1;
}

int main() {
    int x[100000],i;
    for(i=0;i<10000;i++){
        scanf("%d",&x[i]);
        if(x[i]==0)break;
    }
    int ix=i;
    for(i=0;i<ix;i++){
        for(int t=x[i];t>=0;t--){
            int k=isprime(t);
            int k2=isprime(t-2);
            if(k==1&&k2==1){
                printf("%d %d\n",t-2,t);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    int a, b;
    cin>>a>>b;
    int tmp=1, ans=0;
    while(tmp<b){
        tmp+=a-1;
        ++ans;
    }
    cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 256
d, n = map(int, input().split())

if d == 0:
    if n != 100:
        print(n)
    else:
        print(101)

elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(10100)
else:
    if n != 100:
        print(n * 10000)
    else:
        print(1010000)

Measured memory_bytes: 3060
import sys

X, Y, A, B, C = map(int, sys.stdin.readline().strip().split())

P = list(map(int, sys.stdin.readline().strip().split()))
Q = list(map(int, sys.stdin.readline().strip().split()))
R = list(map(int, sys.stdin.readline().strip().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

ans = P[:X] + Q[:Y] + R
ans.sort(reverse=True)
print(sum(ans[:X+Y]))

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

int main()
{
  int h,k;
  cin >> h >> k;
  
  int sum = 0;
  int a[k];
  for(int i = 0; i < k; i++){
    cin >> a[i];
    sum += a[i];
  }
  
  if(sum >= h){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, k;
    i64 s;
    std::cin >> n >> k >> s;

    for (int i = 0; i < k; i++) {
        std::cout << s << " ";
    }
    for (int i = k; i < n; i++) {
        std::cout << (s == 1000000000 ? 1 : s + 1) << " ";
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const double pi = 3.14159265358979;
using vl = vector<ll>;
# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((ll)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((ll)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()

ll A;
long double B;
ll Main() {
    cin >> A >> B;
    cout << (ll)(A*B) << endl;
    return 0;
}
 
int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3708
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long []a = new long [n];
		
		for(int i = 0 ; i < n ;i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		long inf = 1000000000000000000L;
		Arrays.sort(a);
		long ans = 1L;
		
		for(int i = 0 ; i < n ;i++) {
			if(a[i] == 0) {
				System.out.println(0);
				return;
			}
			if(ans > (inf/a[i])) {
				System.out.println(-1);
				return;
			}
			ans *= a[i];
		}
		System.out.println(ans);
	}

}


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

int main(void){
	int in[3];
	cin >> in[0] >> in[1] >> in[2];
	int count[2]={0};
	for(int e : in){
		if(e==5)count[0]++;
		else if(e==7)count[1]++;
	}
	if(count[0]==2 && count[1]==1)cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define ff first
#define ss second

using namespace std;

void maxes(){
    int sMax = 0;
    int Max = 0;
    int iMax = -1;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        int a;
        cin >> a;
        if (a >= Max){
            sMax = Max;
            Max = a;
            iMax = i;
        }
        else if (a > sMax)
            sMax = a;
    }
    for (int i = 0; i < n; i++){
        cout << (i == iMax ? sMax : Max) << endl;
    }
}

int main() {
    maxes();
}

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

using namespace std;
using ll = long long;

ll gcd(ll a,ll b){while(a&&b){if(a>b) a = a%b;else b = b%a;}return a+b;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main()
{
    ll n, k;
    cin >> n >> k;
    //cerr << (-n % k) + n <<
    cout << min(n % k, (-n % k) + k) << endl;
}

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

int main()
{
    // 入力
    long long N; cin >> N;
    vector<long long> v(N);
    for(int i = 0; i < N; i++) cin >> v[i];
    // 計算
    long long ans = -(1<<30);
    long long minv = v[0];
    for(int i = 1; i < N; i++)
    {
        // 差を計算
        long long tmp = v[i] - minv;
        // 最大値を更新
        ans = max(ans, tmp);
        // 最安値を更新
        minv = min(minv, v[i]);
    }
    // 解を出力
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4404