akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
#define vi vector<int>
#define vvi vector<vector <int>>
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int h, w;
    cin >> h >> w;
    vvi a(h, vi(w));
    rep(i, h) rep(j, w) cin >> a[i][j];
    vvi ans;
    vi dx{1, 0};
    vi dy{0, 1};
    bool flag;
    rep(i, h){
        rep(j, w){
            if(a[i][j] % 2 == 1){
                flag = true;
                rep(k, 2){
                    int ny, nx;
                    ny = i + dy[k];
                    nx = j + dx[k];
                    if(0 <= ny && ny < h && 0 <= nx && nx < w){
                        if(a[ny][nx] % 2 == 1){
                            a[ny][nx] += 1;
                            a[i][j] -= 1;
                            ans.emplace_back(vi {i+1, j+1, ny+1, nx+1});
                            flag = false;
                            break;
                        }
                    }
                }
                if(flag){
                    if(j + 1 < w){
                        a[i][j+1] += 1;
                        a[i][j] -= 1;
                        ans.emplace_back(vi {i+1, j+1, i+1, j+2});
                    }
                    else if(i + 1 < h){
                        a[i+1][j] += 1;
                        a[i][j] -= 1;
                        ans.emplace_back(vi {i+1, j+1, i+2, j+1});
                    }
                }
            }
        }
    }
    
    int n;
    n = ans.size();
    cout << n << endl;
    rep(i, n){
        cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " " << ans[i][3] << endl;
    }
}


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

int main() {
	string S,r="AC";
	cin >> S;

	if(S.at(0)!='A' || S.at(1)<'a')
		r = "WA";
	else {
		int c=0;
		rep(i,S.size()-2) {
			if(S.at(i+2) == 'C')
				c++;
			else if(S.at(i+2)<'a')
				r = "WA";
		}
		if(c!=1 || S.at(S.size()-1)<'a')
			r = "WA";
	}

	cout << r << endl;
}

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

int main(){
int n,m,c;
cin >> n >> m >> c;
vector<int> b(m);
vector<vector<int>> a(n,vector<int>(m));
for (int i = 0;i < m;i++){
  cin >> b[i];
}
for (int i = 0;i < n;i++){
  for(int j = 0;j < m;j++){
    cin >> a[i][j];
  }
}
int count = 0;
for(int i = 0;i < n;i++){
  int sum = 0;
  for(int j = 0;j < m;j++){
    sum += b[j]*a[i][j];
  }
  sum += c;
  if (sum > 0){
    count += 1;
  }
}
cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define foreach(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define all(c) begin(c),end(c)
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	const int h=1010,w=1010;
	vvi grid(h,vi(w));
	for(int n=1,m=1,i=505,j=505;n<=1000000;m+=2){
		for(int k=0;k<m;k++)  grid[i][j]=n++,j++;
		for(int k=0;k<m;k++)  grid[i][j]=n++,i--;
		for(int k=0;k<=m;k++) grid[i][j]=n++,j--;
		for(int k=0;k<=m;k++) grid[i][j]=n++,i++;
	}
	
	vi isp(1100000,1); isp[0]=isp[1]=0;
	for(int i=2;i*i<isp.size();i++)
		if(isp[i])
			for(int j=i*i;j<isp.size();j+=i)
				isp[j]=0;
	
	for(int m,n;cin>>m>>n,m|n;){
		int i0=-1,j0=-1;
		rep(i,h) rep(j,w) if(grid[i][j]==n)
			i0=i,j0=j;
		
		int btm=0;
		rep(i,h) rep(j,w) if(grid[i][j]>0 && grid[i][j]<=m)
			btm=max(btm,i);
		
		vvi dp(h,vi(w)),prev(h,vi(w,-1));
		prev[i0][j0]=0;
		
		repi(i,i0,h) rep(j,w){
			if(prev[i][j]==-1) continue;
			if(grid[i][j]<=m && isp[grid[i][j]])
				dp[i][j]++,prev[i][j]=grid[i][j];
			rep(k,3){
				int nj=j+"\xff\0\x1"[k];
				if(i<h-1 && 0<=nj && nj<w && (dp[i+1][nj]!=dp[i][j]?dp[i+1][nj]<dp[i][j]:prev[i+1][nj]<prev[i][j]))
					dp[i+1][nj]=dp[i][j],prev[i+1][nj]=prev[i][j];
			}
		}
		
		int res=*max_element(all(dp[h-1])),last=0;
		rep(i,w) if(dp[h-1][i]==res) last=max(last,prev[h-1][i]);
		cout<<res<<' '<<last<<endl;
	}
}

Measured memory_bytes: 17308
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int X;
  cin >> X;
  int U = 1e6;
  vector<bool> isPrime(U, 0);
  isPrime[2] = 1;
  for (int i = 3; i < U; i=i+2) {
    isPrime[i] = 1;
  }
  for (int p = 3; p * p <= U; p=p+2) {
    if (isPrime[p]) {
      for (int i = p*p; i < U; i=i+2*p) {
        isPrime[i] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = X; i < U; i++) {
    if (isPrime[i]) {
      ans = i; break;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

int main() {
	int N,T;
	vector<array<int,2>> c;

	cin >> N >> T;
	for (int i=0; i<N; i++) {
		array<int,2> tmp;
		cin >> tmp[0] >> tmp[1];
		c.push_back(tmp);
	}
	int cmin = 1001;
	for (int i=0; i<N; i++) {
		if (c[i][1]<=T) {
			if (cmin>=c[i][0]) cmin=c[i][0];
		}
	}
	if (cmin==1001) cout << "TLE" << endl;
	else cout << cmin << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define endl "\n"
#define int long long
#define debug(x) cout << #x << " is " << x << endl;
using namespace std;
const int nmax = 1e5 + 7;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(2);
    int n; cin >> n;
    cout << (1000 - n % 1000) % 1000;


}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int K,X; cin >> K >> X;
    if(K*500>=X) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(a - x) <= abs(b - x))
		cout << "A" << "\n";
	else
		cout << "B" << "\n";
}

Measured memory_bytes: 3556
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

struct s_t{
  ll a,b;
};

bool asc(s_t left,s_t right) {
  return left.a == right.a ? left.b > right.b : left.a < right.a;
}

int main(){
  ll n,t,ans=0;
  cin>>n>>t;
  vector<s_t>v;
  s_t z;
  for(ll i=0;i<n;i++){
    cin>>z.a>>z.b;
    v.push_back(z);
  }
  sort(v.begin(),v.end(),asc);
  vector<vector<ll> >dp(n+1,vector<ll>(t+1,0));
  for(ll i=0;i<n;i++){
    for(ll j=0;j<t+1;j++){
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
    for(ll j=0;j<t;j++){
      ll x=min(j+v[i].a,t);
      dp[i+1][x]=max(dp[i][j]+v[i].b,dp[i+1][x]);
    }
  }
  for(ll i=0;i<=n;i++){
    for(ll j=0;j<=t;j++){
      ans=max(ans,dp[i][j]);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 70784
N, K = map(int, input().split())

res = 0

if K == 0:
    print(N ** 2)
else:
    for b in range(K + 1, N + 1):
        res += N//b * (b - K)
        if N % b >= K:
            res += N % b - K + 1
    
    print(res)


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(){
    int n,m,c; cin >> n >> m >> c;
    vector<int> b(m); 
    int A[n][m];
    rep(i,m) cin >> b[i];

    rep(i,n){
        rep(j,m){
            int a; cin >> a;
            A[i][j] = a;
        }
    }

    int cnt = 0,check;
    rep(i,n){
        check = 0;
        rep(j,m){
            check += A[i][j] * b[j];
        }
        if(check + c> 0) cnt++;
    }
    cout << cnt << endl;
}

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

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

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

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


    const long long INF = 1LL << 60;
    long long dp[100010];
    REP(i,100010) dp[i] = INF;
    dp[0] = 0;

    int N;
    cin >> N;

    vi h(N);
    REP(i,N) cin >> h[i];

    REP(i,N){
        chmin(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
        if (i>0) chmin(dp[i+1],dp[i-1]+abs(h[i+1]-h[i-1]));
    }


    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args) {
		int a,b;
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
		if(a <= 5){
			out.println(0);
		}
		else if(a >= 13){
			out.println(b);
		}
		else{
			out.println(b / 2);
		}
	}
}


Measured memory_bytes: 21972
#include <iostream> 
#include <cstdio> 
#include <fstream> 
#include <algorithm> 
#include <cmath> 
#include <deque> 
#include <vector> 
#include <queue> 
#include <string> 
#include <cstring> 
#include <map> 
#include <stack> 
#include <set> 
#include<list>
using namespace std;
typedef long long ll;
stack <int>b;
list <int >a;
list<int>::iterator it;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int t;
		scanf("%d", &t);
		a.push_back(t);
	}
	for (int i = 0; i < n; i++)
	{
		list<int>::iterator itt=a.end();
		int j;
		for (it = a.begin(),j=1; it!=a.end(); it++,j++)
		{
			if (*it == j)itt = it;
		}
		if (itt == a.end())
		{
			printf("-1");
			return 0;
		}
		else
		{
			b.push(*itt);
			a.erase(itt);
		}
	}
	while (b.size())
	{
		printf("%d\n", b.top());
		b.pop();
	}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100001];
int b[100001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        a[i] = 1;

    b[1] = 1;
    for (int i = 0; i < m; ++i)
    {
        int x, y;
        cin >> x >> y;
        if (b[x])
            b[y] = 1;
        a[x]--;
        a[y]++;
        if (!a[x])
            b[x] = 0;
    }
    int sol = 0;
    for (int i = 1; i <= n; ++i)
        sol += b[i];
    cout << sol;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

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

    int x, y, a, b, c;
    cin>>x>>y>>a>>b>>c;
    vector<ll> A(a), B(b), C(c);
    for (int i = 0; i<a; i++) cin>>A[i];
    for (int i = 0; i<b; i++) cin>>B[i];
    for (int i = 0; i<c; i++) cin>>C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    reverse(C.begin(), C.end());

    ll total = 0;
    for (int i = 0; i<x; i++) total+=A[i];
    for (int i = 0; i<y; i++) total+=B[i];

    vector<ll> D;
    for (int i = 0; i<x; i++) D.push_back(A[i]);
    for (int i = 0; i<y; i++) D.push_back(B[i]);
    sort(D.begin(), D.end());
    for (int i = 0; i<min(C.size(), D.size()); i++) if (D[i]<C[i]) total+=(C[i]-D[i]);
    cout<<total;
}



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

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 100010;
const int Mod = 1e9 + 7;

int n;
int to[N], deg[N], pre[N];
int cnt[N], f[N];
bool vis[N];

int main(){

	scanf("%d", &n);
	For(i, 1, n) scanf("%d", &to[i]), deg[to[i]]++;
	For(i, 1, n) if(deg[i] > 2){
		puts("0");
		return 0;
	} 

	For(i, 1, n) if(deg[i] == 2 && !vis[i]){
		int o = i;
		do{
			pre[to[o]] = o;
			if(vis[o]){
				puts("0");
				return 0;
			}
			vis[o] = true;
			o = to[o];
		}while(o != i);
	}

	int ans = 1;

	For(i, 1, n) if(!deg[i]){
		int o = i, len = 0;
		while(!vis[o]) vis[o] = true, o = to[o], ++len;
		
		int len2 = 0;
		do{
			o = pre[o];
			++len2;
		}while(deg[o] == 1);

		if(len < len2) ans = ans * 2 % Mod;
		else if(len > len2){
			puts("0");
			return 0;
		}
	}

	For(i, 1, n) if(!vis[i]){
		int o = i, len = 0;
		do{
			vis[o] = true;
			o = to[o];
			++len;
		}while(o != i);
		cnt[len]++;
	}

	For(i, 1, n) if(cnt[i]){
		int x = i > 1 && i % 2 == 1 ? 2 : 1;
		f[0] = 1, f[1] = x;
		For(j, 2, cnt[i]) f[j] = (1ll * (j - 1) * i * f[j - 2] + f[j - 1] * x) % Mod;
		ans = 1ll * ans * f[cnt[i]] % Mod;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1536
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        d: usize,
        xy: [(f64, f64); n],
    }
    let mut cnt = 0;
    for (x, y) in xy.iter() {
        if (x.powf(2.0) + y.powf(2.0)).powf(0.5) <= d as f64 {
            cnt += 1
        }
    }
    println!("{}", cnt);
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

int main()
{
  int x;
  cin >> x;
  if(x == 5 or x == 7 or x == 3) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cmath> 
#include <vector> 
#include <queue>
using ll = long long;
using namespace std;
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
int main() {
    int N;cin>>N;
    int ans;ans=0;
    int first;
    int second;
    int third;
    cin>>first;
    cin>>second;
    for(int i=2;i<N;i++){
        cin>>third;
        if((third>second&&second>first)||(third<second&&second<first)){
            ans++;
        }
        first=second;
        second=third;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;
using System.Numerics;

public class Program
{
    public void Solve()
    {
        int N = Reader.Int(), X = Reader.Int();
        if (X == 1 || X == N * 2 - 1) { Console.WriteLine("No"); return; }

        var ans = Enu.Range(1, N * 2 - 1).ToArray();
        if (X < N)
        {
            ans[N - 1] = X;
            for (int i = 0; i < N - 1; i++) ans[i] = 0;
            for (int num = N, at = N - 3; num > X; num--, at--) ans[at] = num;
            int d = 1;
            for (int i = 0; i < N - 1; i++)
                if (ans[i] == 0)
                    ans[i] = d++;
        }
        if (X > N)
        {
            ans[N - 1] = X;
            for (int i = N; i < ans.Length; i++) ans[i] = 0;
            for (int num = N, at = N + 1; num < X; num++, at++) ans[at] = num;
            int d = X + 1;
            for (int i = N; i < ans.Length; i++)
                if (ans[i] == 0)
                    ans[i] = d++;
        }
        Console.WriteLine("Yes");
        Console.WriteLine(string.Join("\n", ans));
        Console.ReadLine();
    }

}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 18392
#include <iostream>

using namespace std;

int main() {
  int K, S;
  cin >> K >> S;
  int z = 0;
  int count_xy = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      z = S - (x + y);
      if (z >= 0 && z <= K) {
        count_xy++;
      }
    }
  }
  cout << count_xy << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<ll,ll>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}

int main() {
  int x,n; cin>>x>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int an=-101, mn=1e9;
  for(int i=x-100;i<=x+100;i++) {
    if (mn <= abs(i-x)) continue;
    bool ok=true;
    for(int j=0;j<n;j++) {
      if (a[j]==i) ok=false;
    }
    if (ok) an=i, mn=abs(i-x);
  }
  cout<<an<<endl;
}

Measured memory_bytes: 3632
import java.util.*;
import java.math.*;
import java.util.Scanner;
import java.math.BigInteger;
   
public class Main {
	static final long mod = (int)(1e9+7);
	static final int inf=(int)(1e9);
	static final int maxn=(int)(1e5+10);
	static long ksm(long a,long b) {
		long ret=1;
		while(b!=0) {
			if(b%2==1) {
				ret=ret*a%mod;
			}
			b>>=1;
			a=a*a%mod;
		}
		return ret;
	}
	public static void main(String[] args) {
    	Scanner cin=new Scanner(System.in);
    	String s=cin.next();
    	int len=s.length();
    	int cnt=0,ans=0;
    	for(int i=0;i<len;i++) {
    		if(s.charAt(i)=='A'||s.charAt(i)=='C'||s.charAt(i)=='G'||s.charAt(i)=='T') {
    			cnt++;
    		}else {
    			cnt=0;
    		}
    		ans=Math.max(ans, cnt);
    	}
    	System.out.println(ans);
    }
}

Measured memory_bytes: 22608
#include<bits/stdc++.h>
#define ll long long

using namespace std;



	

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

	int a,b,c;cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll A, B; cin >> A >> B;
    char C; cin >> C;
    int D; cin >> D;
    B *= 100; B += D;
    ll X = A*B; X /= 100;
    cout << X;
	
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  cout << b*a /2 << endl;
  return 0;
}


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

int main() {
	int n; cin >> n;
	if (n<1) n=1;
	else if (n>20) n=20;
	long long ans=1;
	for (int i=n; i>0; i--) ans *= i;
	cout << ans << endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int c=0;
  vector<int> p(n);
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  for(int i=0; i<n; i++){
    if(p[i] != i+1){
      c++;
    }
  }
  if(c <= 2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from collections import deque

N,M=map(int,input().split())
graph=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)

def dfs(start):
    d=[float("inf")]*N
    d[start]=0

    queue=deque([start])
    while queue:
        x=queue.popleft()
        for y in graph[x]:
            if d[y]!=float("inf"):
                continue
            d[y]=d[x]+1
            queue.append(y)
    
    return d

d=dfs(0)
if d[-1]==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 40472
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b;
    cin >> a >> b;
    if (a>b) swap(a,b);
    for (int i=1; i<=a; i++){
        if ((b*i)%a==0){
            cout << b*i;
            return 0;
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    int a;
    cin>>a;
    double ans=0, arr[a+1], dp[a+1][a+1];
    for (int i=0; i<=a; i++){
        for (int j=0; j<=a; j++){
            dp[i][j]=0.0;
        }
    }
    for (int i=1; i<=a; i++) cin>>arr[i];
    dp[1][0]=1.0-arr[1], dp[1][1]=arr[1];
    for (int i=1; i<=a-1; i++){
        for (int j=0; j<=a; j++){
            if (dp[i][j]==0.0) continue;
            dp[i+1][j]+=dp[i][j]*(1.0-arr[i+1]);
            dp[i+1][j+1]+=dp[i][j]*arr[i+1];
        }
    }
    for (int i=a/2+a%2; i<=a; i++) ans+=dp[a][i];
    cout<<fixed;
    cout<<setprecision(11)<<ans+1e-10<<endl;
}

Measured memory_bytes: 70528
n = int(input()) - 1

al = 'abcdefghijklmnopqrstuvwxyz'

def c_a(d, cs):
  nd = d // 26
  cd = d % 26
  if nd >= 26:
    cs = c_a(nd - 1, cs) + al[cd]
  elif nd == 0:
    cs = al[cd]
  else:
    cs = al[nd - 1] + al[cd]
  return cs

print(c_a(n, ''))

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int N; cin >> N;
	vector<int>vec(N);
	for (int i = 0;i < N;i++) {
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end());
	double ans = vec[0];
	for (int i = 0;i < N;i++) {
		if (i == 0)continue;
		ans = (ans + vec[i]) / 2;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

// GCD : greatest common divisor (GCD) via Euclidean algorithm
func GCD(a, b int) int {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

// LCM : find Least Common Multiple (LCM) via GCD
func LCM(a, b int, integers ...int) int {
	result := a / GCD(a, b) * b

	for i := 0; i < len(integers); i++ {
		result = LCM(result, integers[i])
	}

	return result
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	N, M := getInt(), getInt()
	S := getString()
	T := getString()

	L := LCM(N, M)
	ss := L / N
	st := L / M
	m := make(map[int]byte)
	for i := 0; i < N; i++ {
		m[i*ss] = S[i]
	}
	for i := 0; i < M; i++ {
		idx := i * st
		v, ok := m[idx]
		if ok && v != T[i] {
			out(-1)
			return
		}
	}

	out(L)

}


Measured memory_bytes: 4608
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const long long mod=1e9+7;
long long fac[N],inv[N];
long long qpow(long long a,long long b){
    long long ans=1;
    while(b){
        if(b&1)
            ans=a*ans%mod;
        b>>=1;
        a=a*a%mod;
    }
    return ans;
}
void P(){
    fac[0]=1;
    for(int i=1;i<N;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[N-1]=qpow(fac[N-1],mod-2);
    for(int i=N-2;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
}
long long C(int a,int b){
    return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
int n,k;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    P();
    cin>>n>>k;
    if(k>=n)//如果k>=n的话，所有1都可以移动，相当于n个相同球放到n个相同盒中，盒子可以空。
        cout<<C(n+n-1,n-1);//n个球和n个盒子总共有2n-1个空隙，把n个盒子插到空隙里，即为C(2n-1,n)=C(2n-1,n-1)
    else{
        long long tot=C(2*n-1,n-1);
        for(int i=1;i<n-k;i++){//n-k个位置至少为1，容斥减去不足n-k个位置至少为1的情况
            tot-=1ll*C(n,i)*C(n-1,i-1)%mod;//n个球放到i个盒子里，每个盒子都不为空
            //先从n个盒子里选出i个盒子，然后n个球之间存在n-1个空隙，把i-1块挡板插到n-1个空隙里，就可以把n个球分为i份且每一份都不为空
            tot+=mod;
            tot%=mod;
        }
        cout<<tot<<'\n';
    }
    return 0;
}


Measured memory_bytes: 8192
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll P[15];
ll C[15];
int main() {
	ll D, G, i, j;
	scanf("%lld %lld", &D, &G);
	G /= 100;
	for (i = 1; i <= D; i++) {
		scanf("%lld %lld", &P[i], &C[i]);
		C[i] /= 100;
	}

	ll mn = LL_INF;
	for (i = 0; i < (1 << D); i++) {
		ll ans = 0, s = G;
		for (j = 0; j < D; j++) {
			if (i & (1 << j)) {
				ans += P[j+1];
				s -= P[j + 1] * (j + 1);
				s -= C[j + 1];
			}
		}
		for (j = D - 1; j >= 0; j--) {
			if (s <= 0) break;
			if (i & (1 << j)) continue;

			if (s > P[j + 1] * (j + 1)) {
				s -= P[j + 1] * (j + 1);
				ans += P[j + 1];
				continue;
			}

			ans += (s + j) / (j + 1);
			s = 0;
			break;
		}
		if (s <= 0) mn = min(mn, ans);
	}
	return !printf("%lld\n", mn);
}

Measured memory_bytes: 256
X,Y,A,B,C = map(int,input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
l = p[:X] + q[:Y]
l.sort()
for i in range(min(C,X+Y)):
    if r[i] > l[i]:
        l[i] = r[i]
print(sum(l))

Measured memory_bytes: 23328
a, b = map(int, input().split())
import fractions
g = fractions.gcd(a, b)

if g == 1:
    print(1)
    exit()

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

d = factorize(g)
print(len(d)+1)


Measured memory_bytes: 64364
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18;
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	ll n,i;
    	cin>>n;
    	ll a[n+1];
    	for(i=0;i<n+1;i++)
    	{
    		cin>>a[i];
		}
		ll b[n+1];
		b[n]=a[n];
		for(i=n-1;i>=0;i--)
		{
			b[i]=b[i+1]+a[i];
		}
		ll c[n+1];
		c[0]=1;
		for(i=1;i<n+1;i++)
		{
			c[i]=min(b[i],2*(c[i-1]-a[i-1]));
		}
		int x=1;
		ll ans=0;
		for(i=0;i<n+1;i++)
		{
			if(c[i]<a[i])
			{
				x=0;
				
			}
			ans+=c[i];
		}
		if(x==0)
		{
			cout<<-1<<"\n";
		}
		else
		{
			cout<<ans;
		}

    }

}

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

using namespace std;

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

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;

int n, m;

ll f[MAXN];

void prework(){
	f[0] = 1;
	for(int i = 1; i <= 300000; i++)
		f[i] = f[i-1] * i % MM;
}

void read(){

}

vector<int> E[MAXN];

ll fact(int n){
	return f[n];
}

ll pw(ll p, ll q){
	ll ret = 1;
	for(; q; q >>= 1){
		if (q & 1) ret = ret * p % MM;
		p = p * p % MM;
	}
	return ret;
}

int g[MAXN];

void solve(int casi){
	int X, Y;
//	cout << "Case #" << casi << ": ";
	scanf("%d%d%d", &n, &X, &Y);
	int nico = 1e9 + 8;
	vector<int> maki;
	for(int i = 1; i <= n; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		E[x].push_back(y);
		nico = min(nico, y);
	}
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < E[i].size(); j++)
			if (E[i][j] == nico){
				maki.push_back(i);
			}
	}
	int umi = 0;
	if (maki.size() == 1)
		umi = maki[0];
	int nn = 1e9 + 8;
	for(int i = 1; i <= n; i++)
		if (i != umi){
			for(int j = 0; j < E[i].size(); j++)
				nn = min(nn, E[i][j]);
		}
	for(int i = 1; i <= n; i++)
		if (i != umi)
			g[i] = nico;
		else
			g[i] = nn;
	vector<PII> F;
	for(int i = 1; i <= n; i++){
		if (E[i].size()){
			sort(E[i].begin(), E[i].end());
			int cnt = 0;
			for(int j = 0; j < E[i].size(); j++)
				if (E[i][j] + E[i][0] <= X || E[i][j] + g[i] <= Y)
					cnt++;
			if (cnt)
				F.push_back(PII(E[i][0], cnt));
			//cout<<cnt<<"\t";
			//for(int j = 0; j < E[i].size(); j++)
			//	cout<<E[i][j]<<' '; cout<<endl;
		}
	}
	sort(F.begin(), F.end());
	ll ans = 0;
	int cnt = 0;
	for(int i = 0; i < F.size(); i++)
		if (F[i].first + F[0].first <= Y)
			cnt += F[i].second;
	ans = fact(cnt);
	for(int i = 0; i < F.size(); i++){
		if (F[i].first + F[0].first <= Y)
			ans = ans * pw(fact(F[i].second), MM - 2) % MM;
	}
	cout<<ans<<endl;
}

void printans(){

}


int main(){
//	std::ios::sync_with_stdio(false);
	prework();
	int T = 1;
//	cin>>T;
	for(int i = 1; i <= T; i++){
		read();
		solve(i);
		printans();
	}
	return 0;
}



Measured memory_bytes: 57724
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
        }
        for (int i = 0; i < n; i++) {
            if (s[i].equals("Y")) {
                System.out.println("Four");
                System.exit(0);
            }
        }
        System.out.println("Three");
    }
}

Measured memory_bytes: 25172
s=input()
t=input()
n=len(s)
m=len(t)

dp=[[0]*(m+1) for _ in range(n+1)]

for i in range(1,n+1):
    for j in range(1,m+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i][j-1],dp[i-1][j])
sna=[]
while n!=0 and m!=0:
    if dp[n][m]==dp[n-1][m]:
        n-=1
    elif dp[n][m]==dp[n][m-1]:
        m-=1
    else:
        n-=1
        m-=1
        sna.append(s[n])
ans=list(reversed(sna))
print("".join(ans))

Measured memory_bytes: 144460
n, m = map(int, input().split())

A = list(map(int, input().split()))
A.sort()
bc = []
for i in range(m):
    b, c = map(int, input().split())
    bc.append([b, c])
bc.sort(key=lambda x:x[1], reverse=True)

X = []
for b, c in bc:
    X += [c]*b
    if len(X) >= len(A):
        break

ans = sum(A)
for i in range(min(len(A), len(X))):
    if A[i] >= X[i]:
        break
    ans += X[i] - A[i]

print(ans)

Measured memory_bytes: 26700
#include<iostream>

int a[1000];
unsigned long long dp[1000][21];
int n, s;

int main()
{
	std::cin >> n;
	
	n--;
	
	for( int i = 0; i < n; i++ ) std::cin >> a[i];
		
	dp[0][a[0]] = 1;
		
	for( int i = 0; i < n; i++ ){	
		for( int j = 0; j <= 20; j++ ){
			if( j - a[i+1] >= 0 ) dp[i+1][j] += dp[i][j-a[i+1]];
			if( j + a[i+1] <= 20 ) dp[i+1][j] += dp[i][j+a[i+1]];
		}
	}
	
	std::cin >> s;
	
	std::cout << dp[n-1][s] << std::endl;
	
 	return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  
  int A, B;
  
  for (int i; i<b; i++) {
    int x = pow(10,i);
    A += a*x;
  }
  for (int i; i<a; i++) {
    int y = pow(10,i);
    B += b*y;
  }
  
  if (a > b) cout << B << endl;
  else cout << A << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n;cin >> n;
	std::map<string, ll> mp;
	REP(i, n){
		string str;cin >> str;
		sort(ALL(str));
		mp[str]++;
	}

	ll ans = 0;
	for(auto it: mp){
		ans += it.SE * (it.SE - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;

ll dp[100];

int main()
{
    fastInp;

    ll n;
    cin >> n;
    vector<ll> vec(n);
    for (int i = 0; i < n; i++) cin >> vec[i];

    dp[0] = 1000;
    dp[1] = 1000;
    for (int i = 0; i < n; i++) {
        ll vl = 1000;
        set<ll> bst;
        for (int j = i - 1; j >= 0; j--) {
            bst.insert(vec[j]);
            ll cur = dp[j + 1], stks = 0;
            for (auto c : bst) {
                if (c < vec[i]) {
                    ll q = cur / c;
                    stks += q;
                    cur = cur % c;
                }
            }
            vl = max(vl, stks * vec[i] + cur);
        }
        dp[i + 1] = vl;
    }

    cout << dp[n];
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int f(int n){
    int ret = 0;
    while(n){
        ret++;
        n/=10;
    }
    return ret;
}

signed main(void) {
    int i,j;
    int n;
    cin >> n;
    int ans = INF;
    loop(i,1,sqrt(n)+1) if(n%i == 0){
        ans = min(ans,max(f(i),f(n/i)));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=5e5+7;
typedef long long ll;
const int mod=1e9+7;
int read(){int c = getchar(),Nig = 1,x = 0;while(!isdigit(c))c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()

int a[maxn],vis[maxn];
int main()
{
    int n;
    n=read;
    for(int i=1;i<=n;i++) a[i]=read;
    
    sort(a+1,a+1+n);
    int ans=0;
    for(ll i=1LL<<32;i>=2;i>>=1)
        for(int l=1,r=n;l<r;)
            if(vis[l] || a[l]+a[r]<i) l++;
            else if(vis[r] || a[l]+a[r]>i) r--;
            else {
                ans++;
                vis[l]=1;
                vis[r]=1;
            }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ch[100010];
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		now--;
		ch[now]=i;
	}
	set<ll>st;
	set<ll>se;
	ll ans=0;
	for(ll i=n-1;i>=0;i--){
		ll now=ch[i];
		auto itr=st.lower_bound(now+1);
		ll dai1=*itr;
	//	cout << "da"<<dai1;
		if(itr==st.end()){
			dai1=n;
		}
		ll dai2;
		if(itr==st.end()){
			dai2=n;
		}
		else{
			itr++;
			dai2=*itr;
			if(itr==st.end()){
				dai2=n;
			}
		}
		now*=-1;
		itr=se.lower_bound(now+1);
		ll dai3=abs(*itr);
		if(itr==se.end()){
			dai3=-1;
		}
		ll dai4;
		if(itr==se.end()){
			dai4=-1;
		}
		else{
			itr++;
			dai4=abs(*itr);
			if(itr==se.end()){
				dai4=-1;
			}
		}
		ll cnt=(dai2-dai1)*(-1*now-dai3)+(dai4-dai3)*(-1*now-dai1);
		ans+=cnt*(i+1);
	//	cout <<ans<<"  dai1 "<<dai1<<" dai2 "<< dai2<<" dai3 "<<dai3<<" dai4 "<<dai4<<endl;
		st.insert(-1*now);
		se.insert(now);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 13724
n, d = gets.split(" ").map(&:to_i)
lines = []
while line = gets
  lines << line.chomp.split(' ').map(&:to_i)
end
count = 0
lines.each do |point|
  if d >= Math.sqrt(point[0] ** 2 + point[1] ** 2)
    count += 1
  end
end
puts count

Measured memory_bytes: 28776
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,k;
	std::cin >> n >> k;
	int x = 0;
	while(n) {
		x++;
		n/=k;
	}
	print(x);
	return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    string[] input = readln.split;
    int N = input[0].to!int;
    int Q = input[1].to!int;
    string ans = "kogakubu10gokan";
    foreach(i; 0..N) {
        input = readln.split;
        if (input[0].to!int <= Q) ans = input[1];
    }
    ans.writeln;
}

Measured memory_bytes: 2488
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int n,d;
	cin>>n>>d;
	d*=d;
	int ans=0;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		int a=x*x+y*y;
		if(a<=d) ans++;
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 3692
n = int(input())
s = list(input())
validation = [False for _ in range(n)]

r = 0
l = 0
for i in range(n):
    if "(" == s[i]:
        r += 1
    else:
        if r > 0:
            r -= 1
        else:
            l += 1
print("(" * l + "".join(s) + ")" * r)


Measured memory_bytes: 3060