akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

namespace FastFourierTransform {
    using Real = double;
    using Complex = complex<Real>;

    vector<Complex> DFT(const vector<Complex> &A) {
        int N = A.size();
        if (N==1) return A;

        vector<Complex> even(N/2), odd(N/2);

        for (int i = 0; i < N/2; ++i) {
            even[i] = A[i<<1|0];
            odd[i] = A[i<<1|1];
        }

        auto inversed_even = DFT(even);
        auto inversed_odd = DFT(odd);

        vector<Complex> ret(N);
        for (int i = 0; i < N; ++i) {
            Complex z = Complex(cos(2*PI*i/N),sin(2*PI*i/N));
            ret[i] = inversed_even[i%(N/2)] + z * inversed_odd[i%(N/2)];
        }

        return ret;
    }

    vector<Complex> IDFT(vector<Complex> &A) {
        int N = A.size();

        auto arranged = DFT(A);

        vector<Complex> ret(N);
        for (int i = 0; i < N; ++i) ret[i] = arranged[(N-i)%N] / Complex(N,0);

        return ret;
    }

    vector<long long> multiply(const vector<int> &A,const vector<int> &B) {
        int sz = (int)A.size() + (int)B.size() - 1;
        int N = 1; while (N < sz) N *= 2;
        vector<Complex> fA(N), fB(N);
        for (int i = 0; i < A.size(); ++i) fA[i] = A[i];
        for (int i = 0; i < B.size(); ++i) fB[i] = B[i];

        fA = DFT(fA);
        fB = DFT(fB);

        vector<Complex> C(N);
        for (int i = 0; i < N; ++i) C[i] = fA[i]*fB[i];
        C = IDFT(C);
        vector<long long> ret(N);
        for (int i = 0; i < N; ++i) ret[i] = (C[i].real()+.1);

        return ret;
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vector<int> A(100001);
    rep(i,N) {
        int a; cin >> a;
        A[a]++;
    }

    auto B = FastFourierTransform::multiply(A,A);
    int K = B.size();
    ll ans = 0;
    for (int i = K-1; i >= 0; --i) {
        if (M <= B[i]) {
            ans += M*i;
            break;
        }
        ans += B[i]*i;
        M -= B[i];
    }

    cout << ans << ln;
}


Measured memory_bytes: 27380
//-fexec-charset=CP932
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using p=pair<int,int>;
#define MAX 100
#define THOU 1000
#define FIVEMAX 100000
#define NINEMAX 1000000000
#define TWEMAX 1000000000000
#define rep(i,n) for (int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define darep(i,a,n) for(int i=n,i>=a;i--)
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;}
const ll INF=1LL<<60;
int main(){
 cin.tie(0);
 ios::sync_with_stdio(false);
 int a;
 cin>>a;
 if(a==1)cout<<0;
 else cout<<1;
 return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;

class BIT2 {
  public:
  int N;
  int M;
  vvi arr;
  BIT2(int n,int m) {
    N = n;
    M = m;
    arr = vvi(N+1,vi(M+1,0));
  }
  int sum(int x,int y) {
    int s = 0;
    for(int i = x+1;i > 0;i -= i&(-i)) {
      for(int j = y+1;j > 0;j -= j&(-j)) {
        s += arr[i][j];
      }
    }
    return s;
  }
  void add(int x,int y,int k) {
    for(int i = x+1;i <= N;i += i&(-i)) {
      for(int j = y+1;j <= M;j += j&(-j)) {
        arr[i][j] += k;
      }
    }
  }
};
  
int main() {
  int H,W,K;
  cin >> H >> W >> K;
  v(string) G(H);
  rep(i,H) {
    cin >> G[i];
  }
  BIT2 bit(H,W);
  rep(i,H) {
    rep(j,W) {
      if(G[i][j]=='1') {
        bit.add(i,j,1);
      }
    }
  }
  int ans = INF;
  rep(i,1<<(H-1)) {
    int sum = __builtin_popcountll(i);
    vi h;
    h.push_back(0);
    rep(j,(H-1)) {
      if((i>>j)&1) h.push_back(j+1);
    }
    h.push_back(H);
    int wl=0;
    int sumw = 0;
    srep(wr,1,W+1) {
      int res = 0;
      rep(j,sz(h)-1) {
        int hl = h[j];
        int hr = h[j+1];
        int s = bit.sum(hr-1,wr-1) - bit.sum(hr-1,wl-1) - bit.sum(hl-1,wr-1) + bit.sum(hl-1,wl-1);
        chmax(res,s);
      }
      if(res > K) {
        if(wr<=wl+1) {
          sumw = INF;
          break;
        }
        wr--;
        wl=wr;
        sumw++;
      }
    }
    sum += sumw;
    chmin(ans,sum);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b = ma()
c=1
while a <= b:
    a*=2
    c+=1
print(c-1)

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
using namespace std;

int main()
{

 //freopen("in.txt","r",stdin);
	long long a;
	float b;
	cin>>a>>b;
    int  c=int( b*100+0.0001);

    cout<<a*c/100;

	return 0;
}

Measured memory_bytes: 3728
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int list[] = new int[N];
		for (int i = 0; i < N; i++) {
			list[i] = sc.nextInt();
		}
		int cntList[] = new int[N];

		//2で割った際に余りが出るか
		//2で割った商に2で割った際に余りが出るか（繰り返し）
		//すべての要素で行った回数の中で最小の数

		for (int i = 0; i < N; i++) {
			int cnt = 0;
			while (list[i] % 2 == 0) {
				list[i] = list[i] / 2;
				cnt++;
			}
			cntList[i] = cnt;
		}

		int ans = cntList[0];
		for (int i = 1; i < N; i++) {
			if (ans > cntList[i]) {
				ans = cntList[i];
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>

using  namespace std;

int main()
{
  string S;
  cin >> S;
  int length = S.size();
   
  
  
  for(int i=0;i<length-1;i++){
    for (int j=i+1;j<length;j++){
      if(int(S[i])==int(S[j])){
        cout<<"no";
        goto Exit;} }
  }
  
  cout << "yes";
  
  Exit: ;
  
}

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

int main() {
  int n, a;
  cin >> n >> a;
  int b=n/500;

  if(n<500){ //500円を出せないとき
    if(n<=a){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else{ //500円を出せるとき
    if((n-500*b)<=a){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

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

int main(){
    vector<string> s[7][7];
    s[0][0] = {""};
    for(int i=0;i<5;i++){
        for(int j=0;j<5;j++){
            for(auto t : s[i][j]){
                s[i+1][j].emplace_back(t+"A");
                s[i][j+1].emplace_back(t+"B");
            }
        }
    }
    for(auto t : s[4][5]){
        s[5][5].emplace_back(t+"A");
        s[4][6].emplace_back(t+"B");
    }
    for(auto t : s[5][4]){
        s[6][4].emplace_back(t+"A");
        s[5][5].emplace_back(t+"B");
    }
    int x, y;
    cin >> x >> y;
    sort(s[x][y].begin(), s[x][y].end());
    for(auto t : s[x][y]){
        cout << t << endl;
    }
    return 0;
}



Measured memory_bytes: 3240
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m,r,i,j,k,d[210][210],dp[300][10],g[20];
  scanf("%d %d %d",&n,&m,&r);
  for(i=0;i<r;i++)scanf("%d",&g[i]);
  for(i=0;i<r;i++)g[i]--;
  for(i=0;i<n*n;i++)d[i/n][i%n]=i%n==i/n?0:1e9;
  while(m--){
    scanf("%d %d %d",&i,&j,&k);
    d[i-1][j-1]=d[j-1][i-1]=k;
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      for(k=0;k<n;k++)d[j][k]=MIN(d[j][k],d[j][i]+d[i][k]);
    }
  }
  /*for(i=0;i<n;i++){
    for(j=0;j<n;j++)printf("%2d ",d[i][j]);printf("\n");
    }//*/
  for(i=0;i<(1<<r);i++){
    for(j=0;j<r;j++)dp[i][j]=1e9;
  }
  for(i=0;i<r;i++)dp[1<<i][i]=0;
  for(i=0;i<(1<<r);i++){
    for(j=0;j<r;j++){
      if(i&(1<<j)==0)continue;
      for(k=0;k<r;k++)dp[i|(1<<k)][k]=MIN(dp[i|(1<<k)][k],dp[i][j]+d[g[j]][g[k]]);
    }
  }
  j=(1<<r)-1;
  for(i=0;i<r;i++)dp[j][0]=MIN(dp[j][i],dp[j][0]);
  printf("%d\n",dp[j][0]);
  return 0;
}


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

int main (void){
	int a, b;
	cin >> a >> b;
	string out;
	
	if(a < b)
	out = "a < b";
	else if(a > b)
	out = "a > b";
	else
	out = "a == b";
	
	cout << out << endl;
	return(0);
}

Measured memory_bytes: 1192
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int a,b;
    char s[10000];
    int flag=1;
    scanf("%d%d",&a,&b);
    getchar();
    for(int i=1;i<=a+b+1;i++)
    {
        scanf("%c",&s[i]);
    }

    if(s[a+1]!='-')
    {
        flag=0;
    }
    if(flag==1)
    {
        for(int i=1;i<=a;i++)
        {
            if(s[i]=='-')
            {
                flag=0;
                break;
            }
        }
        for(int i=a+2;i<=a+b+1;i++)
        {
            if(s[i]=='-')
            {
                flag=0;
                break;
            }
        }
    }
    if(flag==0)
        printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<int>v(N);
	for(auto &i:v)cin >> i;
	if (v[0]) {
		cout << 0 << endl;
		return 0;
	}
	vector<int>num(N);
	for (auto i : v)num[i]++;
	if (num[0] > 1) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 1; i < N; i++) {
		if (num[i] && !num[i - 1]) {
			cout << 0 << endl;
			return 0;
		}
	}
	long long int ans = 1;
	for (int i = 1; i < N; i++) {
		if (!num[i])break;
		for (int j = 0; j < num[i]; j++) {
			ans *= num[i - 1];
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a,b;
    float f;
    a = sc.nextInt();
    b = sc.nextInt();
    System.out.println(a / b + " " + a % b + " " + a / b + "."  + (int)(-100000 * (a / b - (double)a / b)));
    sc.close();
  }
}



Measured memory_bytes: 26192
import java.util.Scanner;

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

			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();
			
			int countT = c / b + (c % b > 0 ? 1 : 0);
			int countA = a / d + (a % d > 0 ? 1 : 0);
			
			System.out.println(countA < countT ? "No" : "Yes"); 

		}
	}

}

Measured memory_bytes: 35704
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
int n=a.length();
int m=b.length();
int dp[n+5][m+5];
memset(dp,0,sizeof(dp));
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{if(a[i-1]==b[j-1])
dp[i][j]=1+dp[i-1][j-1];
dp[i][j]=max(dp[i][j],max(dp[i-1][j],dp[i][j-1]));
}
int x=dp[n][m];
vector<char>v;
int i=n,j=m;
while(i>0&&j>0)
{
     if(a[i-1]==b[j-1])
   { v.push_back(a[i-1]),j--,i--;
     continue;
    }

      if(dp[i-1][j]>dp[i][j-1])
         i--;
  else 
   j--;
}
for(int i=v.size()-1;i>=0;i--)
cout<<v[i];
cout<<endl;
}

Measured memory_bytes: 35584
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	long long int a[100000];
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	sort(a, a + n);
	long long int l = 0, w = 0;
	int i = n - 1;
	while(i > 0){
		if(a[i] == a[i - 1]){
			l = a[i];
			i-=2;
			break;
		}else{
			i--;
		}
	}
	while(i > 0){
		if(a[i] == a[i - 1]){
			w = a[i];
			break;
		}else{
			i--;
		}
	}
	cout << l * w << endl;
}


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

csum = 0
for i in range(1,N+1):
    c = 0
    flag = 1
    while flag:
        if i*2**c >= K:
            csum += 1/2**c
            flag = 0
        else:
            c += 1
print(csum/N)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef vector<int> V;

int n;
string s[12];
map<char, int> id;
bool nonzero[10];
int coef[10];
int stack[10];
V front[1 << 10];
V back[1 << 10];

int get_id(char c){
    if(id.count(c)){
        return id[c];
    }
    return id[c] = id.size() - 1;
}

void build(const string& s, int init = 1){
    int p = init;
    for(int i = s.size() - 1; i >= 0; --i){
        coef[get_id(s[i])] += p;
        p *= 10;
    }

    if(s.size() > 1){
        nonzero[get_id(s[0])] = true;
    }
}

void enumerate(int i, int used, int start, int end, V* p){
    if(i == end){
        int sum = 0;
        for(int j = start; j < end; ++j){
            sum += coef[j] * stack[j];
        }
        p[used].push_back(sum);
        return;
    }

    rep(j, 10){
        if(!(used >> j & 1) && (j != 0 || !nonzero[i])){
            stack[i] = j;
            enumerate(i + 1, used | 1 << j, start, end, p);
        }

    }
}

int solve(){
    rep(i, n - 1){
        build(s[i]);     
    }
    build(s[n - 1], -1);

    int m = id.size();
    int m1 = min(m, 4);
    int m2 = m - m1;
    enumerate(0, 0, 0, m1, front);
    enumerate(m1, 0, m1, m, back);
    rep(i, 1 << 10){
        sort(back[i].begin(), back[i].end());
    }

    int ans = 0;
    rep(i, 1 << 10){
        for(int v: front[i]){
            rep(j, 1 << 10){
                if(!(i & j)){
                    ans += upper_bound(back[j].begin(), back[j].end(), -v) - lower_bound(back[j].begin(), back[j].end(), -v);
                }
            }
        }
    }
    return ans;
}

int main(){
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        rep(i, n){
            cin >> s[i];
        }

        cout << solve() << endl;

        id.clear();
        fill_n(nonzero, 10, false);
        fill_n(coef, 10, 0);
        rep(i, 1 << 10){
            front[i].clear();
            back[i].clear();
        }
    }
    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;


int main(){
  int n;
  int ans = 0;
  cin >> n;
  rep1(i,9){
    ans = 100*i+10*i+i;
    if(ans>=n){
      cout << ans << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if(n>=400&&n<=599) cout << 8 << endl;
	else if(n>=600&&n<=799) cout << 7 << endl; 
	else if(n>=800&&n<=999) cout << 6 << endl;
	else if(n>=1000&&n<=1199) cout << 5 << endl;
	else if(n>=1200&&n<=1399) cout << 4 << endl;
	else if(n>=1400&&n<=1599) cout << 3 << endl;
	else if(n>=1600&&n<=1799) cout << 2 << endl;
	else if(n>=1800&&n<=1999) cout << 1 << endl;
	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;

  int minval = min(A, B);
  int maxval = max(A, B);

  if (maxval <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using namespace std;
typedef pair<long long,long long> ii;
typedef long long lint;

int C[100][100];

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	int n; cin >> n;
	
	vector<ii> v;
	
	for(int i = 0;i < n;i++){
		string s; cin >> s;
		int res = 0;
		int cnt = 9;
		bool reach = false;
		for(char c : s){
			if(c == '.'){
				reach = true;
				continue;
			}
			res *= 10;
			res += (c - '0');
			if(reach) cnt--;
		}
		
		while(cnt--) res *= 10;
		//cout << res << "\n";
		
		int T = 0, F = 0;
		while(res % 2 == 0){
			T++;
			res /= 2;
		}
		while(res % 5 == 0){
			F++;
			res /= 5;
		}
		
		v.push_back(ii(T,F));
		C[T][F]++;
		//cout <<T  << " " << F<< "\n";
	}
	
	int ans = 0;
	for(int t = 0;t < 100;t++){
		for(int f = 0;f < 100;f++){
			for(int T = 0;T < 100;T++){
				for(int F = 0;F < 100;F++){
					
					if(t + T >= 18 && f + F >= 18){
						ans += C[t][f] * C[T][F];
						//if(C[t][f] * C[T][F]) cout << t << " " << f << " "<< T << " " << F<< "\n";
					}
					
				}
			}
		}
	}
	
	//cout << ans;
	for(ii x : v){
		if(x.first >= 9 && x.second >= 9) ans--;
	}
	ans /= 2;
	cout << ans;
}



Measured memory_bytes: 7440
#include <iostream>
#include <cstdio>
using namespace std;
int pos[200005];
int a[2000005];
int fa[200005];
int f[200005];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
        f[i] = 1;
        pos[a[i]] = i;
    }
    for (int i = 1; i <= n - 1; ++i) {
        if (pos[i + 1] > pos[i]) {
            fa[pos[i + 1]] = pos[i];
        }
    }
    int res = 0;
    for (int i = n; i >= 1; --i) {
        f[fa[i]] += f[i];
        res = max(res, f[i]);
    }
    printf("%d", n - res);
    return  0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    string s,st,ss;
    int a=0;
    cin>>s>>st;
    ss=s+st;
    for(int i=0;i<ss.length();i++)a=a*10+ss[i]-'0';
    if(sqrt(a)==float(sqrt(a))) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map(String::toLong)
    val bList = readLine()!!.split(' ').map(String::toLong)
    val cList = readLine()!!.split(' ').map(String::toLong)

    var sum = bList.sum()
    (0 until n - 1).forEach { if (aList[it] + 1 == aList[it + 1]) sum += cList[aList[it].toInt()-1] }
    println(sum)
}

Measured memory_bytes: 38256
import Data.List
import Data.Maybe

main = do
  s <- getLine
  t <- getLine
  let n = (length s) - (length t)
      tList = makeList n t
      result = map (judge s) tList
      ans = elemIndices True result
  if length ans == 0 then putStrLn "UNRESTORABLE"
                     else putStrLn $ solve ans s tList

makeList :: Int -> String -> [String]
makeList n t = [replicate i '!' ++ t ++ replicate (n-i) '!' | i <- [0..n]]

judge :: String -> String -> Bool
judge [] [] = True
judge (a:as) (b:bs)
  | a == '?'  = judge as bs
  | b == '!'  = judge as bs
  | a == b    = judge as bs
  | otherwise = False

zipAns:: String -> String -> String
zipAns [] [] = []
zipAns (a:as) (b:bs)
 | a == '?' && b == '!' = 'a' : zipAns as bs
 | a == '?'             = b : zipAns as bs
 | b == '!'             = a : zipAns as bs
 | otherwise            = a : zipAns as bs

solve :: [Int] -> String -> [String] -> String
solve ans s t = head . sort . map (\x -> zipAns s $ t !! x) $ ans


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

long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a ;
        a = a * a ;
        b >>= 1;
    }
    return res;
}



int lol[10][60][30];
int get(string a)
{
    int n=a.length();
    int pp=1;
    int ans=0;
    for(int i=n-1;i>=0;i--)
    {
        ans+=(a[i]-'0')*pp;
        pp*=10;
    }
    return ans;
}

int two(int n)
{
    int cnt=0;
    while (n%2==0)
    {
        cnt++;
        n/=2;
    }
    return cnt;    
}

int five(int n)
{
    int cnt=0;
    while (n%5==0)
    {
        cnt++;
        n/=5;
    }
    return cnt;    
}

signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      

    int n;
    cin>>n;
    string a[n];

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        bool flag=false;
        int ka=a[i].length();
        for(int j=0;j<ka;j++)
        {
            if(a[i][j]=='.')
            {
                flag=true;
            }
        }
        if(!flag)
        {
            int z=get(a[i]);
            lol[0][two(z)][five(z)]++;
                    continue;
        }

        while (a[i].size()>0)
        {
            if(a[i].back()=='0')
                a[i].pop_back();
            else
                break;
        }

        int len=a[i].length();
        int x1,y1,m;
        for(int j=0;j<len;j++)
        {
            if(a[i][j]=='.')
            {
                x1=get(a[i].substr(0,j));
                m=len-j-1;
                y1=get(a[i].substr(j+1,m));
                x1*=power(10,m);
                x1+=y1;
                break;
            }
        }

        lol[m][two(x1)][five(x1)]++;
    }

    int ans=0;
    for(int i=0;i<10;i++)
        for(int j=0;j<45;j++)
            for(int k=0;k<20;k++)
                for(int i1=0;i1<10;i1++)
                for(int j1=0;j1<45;j1++)
                for(int k1=0;k1<20;k1++)
                {
                    if(i1==i && j1==j && k1==k)
                    {
                        if(i+i1<=min(j1+j,k1+k))
                        {
                            ans+=lol[i][j][k]*(lol[i1][j1][k1]-1);
                        }                        
                    }
                    else
                    {
                        if(i+i1<=min(j1+j,k1+k))
                        {
                            ans+=lol[i][j][k]*lol[i1][j1][k1];
                        }
                    }
                    
                }

    cout<<ans/2;

}

Measured memory_bytes: 9920
#include <algorithm>
#include <iostream>

using namespace std;

int selectionSort(int A[], int N) {
  int sw = 0;
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (A[i] != A[minj]) {
      swap(A[i], A[minj]);
      sw++;
    }
  }
  return sw;
}

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

  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int sw = selectionSort(A, N);

  for (int i = 0; i < N; i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;

  cout << sw << endl;

  return 0;
}

Measured memory_bytes: 1164
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    h, w = f()
    s = [input() for i in range(h)]
    d = [[0]*w for i in range(h)]

    for i in range(h):
        for j in range(w):
            if s[i][j] == '.':
                cnt = 0
                for x in range(-1,2):
                    for y in range(-1,2):
                        if i+x in range(h) and j+y in range(w):
                            if s[i+x][j+y] == '#':
                                cnt+=1
                d[i][j] = cnt
    
    for i in range(h):
        for j in range(w):
            if s[i][j] == '.':
                print(d[i][j], end = '' if j!=w-1 else '\n')
            else:
                print(s[i][j], end = '' if j!=w-1 else '\n')




solve()


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int N;
	cin >> N;
	int slime=pow(2, N);
	vector<int> S(slime), used(slime, 0), t;
	for(int i=0; i<slime; ++i) cin >> S[i];
	sort(S.begin(), S.end(), greater<int>());
	t.push_back(S[0]);
	used[0]=1;
	for(int i=0; i<N; ++i){
	    int gat=pow(2, i), now=0;
	    for(int p=0; p<slime && now<gat; ++p){
	        if(used[p]==0){
	            if(t[now]>S[p]){
	                t.push_back(S[p]);
	                ++now;
	                used[p]=1;
	            }
	        }
	    }
	    if(now<gat){
	        cout << "No" << endl;
	        return 0;
	    }
	    sort(t.begin(), t.end(), greater<int>());
	}
	cout << "Yes" << endl;
	return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		string s;
		cin >> s;
		cout << s.substr(0, 3) << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<map>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<list>
#include<string>
#include<climits>
#define ll long long 
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> p;
int main()
{
	int n,m;
	cin>>n>>m;
	if(m<n)
	cout<<"No";
	else
	cout<<"Yes";
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,a,b;
    scanf("%d %d %d",&n,&a,&b);
    if((n*a)<b)
    {
        printf("%d\n",n*a);
    }
    else
    {
        printf("%d\n",b);
    }
    return 0;
}


Measured memory_bytes: 128
import numpy as np

N,K = map(int, input().split())
h = np.array(list(map(int, input().split())))
dp = np.full(N,10**10)
dp[0] = 0
for i in range(1,N):
    start = max(0,i-K)
    dp[i] = np.min(dp[start:i]+np.abs(h[i]-h[start:i]))
print(int(dp[-1]))


Measured memory_bytes: 22824
#include <cstdio>
#include <algorithm>
#include <functional>

const int N = 100000 + 10;

int n, a[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  std::sort(a + 1, a + n + 1, std::greater<int>());
  int x = 1;
  while (x <= n && a[x + 1] >= x + 1) ++x;
  int u = a[x] - x, v = 0;
  for (int i = x + 1; i <= n; ++i) if (a[i] >= x) ++v; else break;
  puts((u & 1) || (v & 1) ? "First" : "Second");
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n, k;
	cin >> n >> k;
	int ans = 0;
	for(int i = k; i <= (n+1); i++){
		int maxi = n * (n + 1) / 2 - (n-i) * (n - i + 1) / 2;
		int mini = (i - 1)* i / 2;		
		ans = (ans + (maxi - mini) + 1) % MOD;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <iomanip>
#include <tuple>
#include <queue>

#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

bool map[52][52] = {};
bool ans[52][52] = {};

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w;
	char tmp;
	cin >> h >> w;
	rep(i,1,h+1){
		rep(j,1,w+1){
			cin >> tmp;
			if(tmp == '#') map[i][j] = true;
		}
	}
	bool out = true;
	rep(i,1,h){
		rep(j,1,w){
			if(!map[i][j]) continue;
			//cout << map[i-1][j] << map[i+1][j] << map[i][j-1] << map[i][j+1] << endl;
			if(map[i-1][j] || map[i+1][j] || map[i][j-1] || map[i][j+1]) continue;
			out = false;
		}
	}
	if(out) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    int x,k;
    cin>>x>>k;
    cout<<x-k+1;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,x,ans=0;
    cin>>N>>x;
    int a[N];
    for(int i=0;i<N;i++){cin>>a[i];}
    sort(a,a+N);
    for(int i=0;i<N;i++){
        if(a[i]<=x){
            x-=a[i];
            ans++;
        }
        if(i==N-1&&x>0&&ans==N) ans--;
    }
    cout<<ans;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input_data[];
        int n, m, l;
        long mx1[][], mx2[][], mx3[][];
        try {
            input_data = br.readLine().split(" ");
            n = Integer.parseInt(input_data[0]);
            m = Integer.parseInt(input_data[1]);
            l = Integer.parseInt(input_data[2]);

            mx1 = new long[n][m];
            mx2 = new long[m][l];
            mx3 = new long[n][l];

            // TODOdata input
            for (int i = 0; i < n; i++) {
                input_data = br.readLine().split(" ");
                for (int j = 0; j < m; j++)
                    mx1[i][j] = Integer.parseInt(input_data[j]);
            }
            for (int i = 0; i < m; i++) {
                input_data = br.readLine().split(" ");
                for (int j = 0; j < l; j++)
                    mx2[i][j] = Integer.parseInt(input_data[j]);
            }

            // calc
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < l; j++) {
                    for (int k = 0; k < m; k++) {
                        mx3[i][j] += mx1[i][k] * mx2[k][j];
                    }
                }
            }

            // print
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < l; j++) {
                    if (j != 0)
                        System.out.print(" ");
                    System.out.printf("%d", mx3[i][j]);
                }
                System.out.print("\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 44672
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, u, v, w, bos[100009];
vector<int> vec[100009];
bool col[100009];

int get_bos(int x)
{
	if (bos[x] != x) {
		bos[x] = get_bos(bos[x]);
	}
	return bos[x];
}

void unite(int x, int y) {
	x = get_bos(x);
	y = get_bos(y);
	if (x > y) swap(x, y);
	bos[y] = x;
}

void dfs(int cur, int from, bool c)
{
	if (get_bos(cur) != get_bos(from)) c = !c;
	col[cur] = c;
	for (int i = 0; i < (int)vec[cur].size(); i++) {
		if (vec[cur][i] != from) {
			dfs(vec[cur][i], cur, c);
		}
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		bos[i] = i;
	}
	for (int i = 0; i < n - 1; i++) {
		cin >> u >> v >> w;
		u; v;
		vec[u].pb(v); vec[v].pb(u);
		if (w % 2 == 0) {
			unite(u, v);
		}
	}
	dfs(1, -1, true);
	for (int i = 1; i <= n; i++) {
		cout << (col[i] ? 0 : 1) << "\n";
	}
	//system("pause");
	return 0;
}

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

//#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    for (int i = 0; i <= 100; i++) {
        for (int j = 0; j <= 100; j++) {
            if (2*i + 4*j == y && i+j == x) {
                cout << "Yes\n";
                exit(0);
            }
        }
    }
    cout << "No\n";
}
/*

 */


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

int main() {
    int n , ans = 0;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p.at(i);
    int m = p.at(0);
    for (int i = 0; i < n; i++) {
        m = min(m , p.at(i));
        if (m == p.at(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int n, count = 0; cin >> n;

    REPI(i, n){
        int x; cin >> x;
        if(i != x - 1){
            count++;
            if(count > 2) i += n;
        }
    }count <= 2 ? cout << "YES" : cout << "NO";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
typedef long long llong;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  llong x,y;
  llong ans=0;
  cin>>x>>y;
  while(x<=y){
    ans++;
    x*=2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;


public class CodeFile1
{
    public static void Main()
    {
        int A = int.Parse(Console.ReadLine());
        int B = int.Parse(Console.ReadLine());
        int H = int.Parse(Console.ReadLine());
        Console.WriteLine((A + B) * H / 2);

    }
}
 

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

int main() {
  int N,i;
  cin >> N;
  array<int,2> w[N];
  for(i=0;i<N;i++)
    cin >> w[i][0] >> w[i][1];
  sort(&w[0],&w[N], [](auto& x,auto& y){return x[1] < y[1];});
  int s=0;
  for(i=0;i<N;i++){
    s+=w[i][0];
    if(w[i][1]<s){
      cout << "No" << endl;
      break;
    }
    if(i==N-1)
      cout << "Yes" << endl;
  }
}


Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll cnt = 0; ll n; cin >> n; vl an(n); vl bn(n);
  
  rep(i,n){
    cin >> an[i] >> bn[i];
  }
  
  rep(i,n){
    
    if((an[n-1-i] + cnt) % bn[n-1-i] == 0){
      continue;
    }
    else cnt += bn[n-1-i] - ((an[n-1-i] + cnt) % bn[n-1-i]);
  }
  
  cout << cnt << endl;
  
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int l = 0, r = 1e9;
  while (r - l > 1) {
    int x = (l + r) / 2;
    auto f = [&](int x) {
      ll now = 0;
      rep(i, n) now += (a[i] - 1) / x;
      return now <= k;
    };
    if (f(x))
      r = x;
    else
      l = x;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 3952
import java.util.*

fun update(record: Int, challenger: Int): Int {
    if (0 > record || record > challenger) {
        return challenger
    }
    return record
}
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val h = cin.nextInt()
    val w = cin.nextInt()
    val k = cin.nextInt()
    cin.nextLine()

    val a = Array<Array<Int>>(h, {Array<Int>(w, {0})})
    var start: Array<Int> = arrayOf()
    for (i in 0..h-1) {
        val s = cin.nextLine()
        for (j in 0..w-1) {
            val c = s[j]
            if (c == '.') {
                a[i][j] = 0
            } else if (c == '#') {
                a[i][j] = -1
            }  else {
                a[i][j] = 1
                start = arrayOf(i, j)
            }
        }
    }

    val distance = Array<Array<Int>>(h, {Array<Int>(w, {-1})})
    distance[start[0]][start[1]] = 0
    val queue: MutableList<Array<Int>> = mutableListOf(start)

    while (queue.size != 0) {
        val now = queue.removeAt(0)
        val now_d = distance[now[0]][now[1]]
        if (k > now_d) {
            if (now[1] > 0 && a[now[0]][now[1]-1] == 0 && distance[now[0]][now[1]-1] == -1) {
                distance[now[0]][now[1]-1] = now_d + 1
                queue.add(arrayOf(now[0], now[1]-1))
            }
            if (now[0] > 0 && a[now[0]-1][now[1]] == 0 && distance[now[0]-1][now[1]] == -1) {
                distance[now[0]-1][now[1]] = now_d + 1
                queue.add(arrayOf(now[0]-1, now[1]))
            }
            if (w-1 > now[1] && a[now[0]][now[1]+1] == 0 && distance[now[0]][now[1]+1] == -1) {
                distance[now[0]][now[1]+1] = now_d + 1
                queue.add(arrayOf(now[0], now[1]+1))
            }
            if (h-1 > now[0] && a[now[0]+1][now[1]] == 0 && distance[now[0]+1][now[1]] == -1) {
                distance[now[0]+1][now[1]] = now_d + 1
                queue.add(arrayOf(now[0]+1, now[1]))
            }
        }
    }

    var record = -1
    for (i in 0..h-1) {
        for (j in 0..w-1) {
            if (distance[i][j] >= 0) {
                record = update(record, i)
                record = update(record, j)
                record = update(record, h-1-i)
                record = update(record, w-1-j)
            }
        }
    }

    println((record+k-1)/k + 1)
}

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

int main()
{
    int n;
    cin >> n;
    
    int arrSize = n * 3;
    unsigned long long* arr = new unsigned long long[arrSize];
    
    for(int i = 0; i < arrSize; i++)
    {
        cin >> arr[i];
    }
    
    sort(arr, arr + arrSize);
    
    unsigned long long sum = 0;
    
    for(int i = 0; i < n; i++)
    {
        int index = 3 * n - 1 - 2 * i - 1;
        sum += arr[index];
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 * 2;

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


Measured memory_bytes: 3636
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <tuple>
#include <set>
#include <map>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<int> a(N);
  for (auto& ai: a) scanf("%d", &ai);
  a.insert(a.begin(), 0);

  std::vector<int> b(N+1);
  std::vector<int> res;
  for (size_t i = N; i > 0; --i) {
    int sum = 0;
    for (size_t j = i+i; j <= N; j += i)
      sum ^= b[j];

    if (a[i] != sum) {
      b[i] = 1;
      res.push_back(i);
    }
  }

  for (size_t i = 1; i <= N; ++i) {
    int sum = 0;
    for (size_t j = i; j <= N; j += i)
      sum ^= b[j];

    if (a[i] != sum) return puts("-1"), 0;
  }

  printf("%zu\n", res.size());
  for (size_t i = 0; i < res.size(); ++i)
    printf("%d%c", res[i], i+1<res.size()? ' ': '\n');
}


Measured memory_bytes: 3516
n, k = map(int, input().split())
x = list(map(int, input().split()))

ans = float('inf')
for left in range(n-k+1):
    right = left + k - 1
    if x[right] <= 0:
        ans = min(ans, abs(x[left]))
    elif x[left] >= 0:
        ans = min(ans, x[right])
    else:
        ans = min(ans, abs(x[left]) * 2 + x[right])
        ans = min(ans, abs(x[left]) + x[right] * 2)

print(ans)

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
	for(int i=0; i*4 <= N; i++){
		for(int j=0; j*7 <= N; j++){
			if(N == i*4 + j*7){
				cout << "Yes" << endl;
				return;
			}
		}
	}

	cout << "No" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include<stdio.h>

int main(){
  int w, h, x, y, r;

  scanf("%d %d %d %d %d",&w, &h, &x, &y, &r);

  if((x-r>=0 && y-r>=0) && (x+r<=w && y+r<=h)){
    printf("Yes\n");
  }
  else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 2108
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        Rectangle base = new Rectangle(0, 0, 0, 0);
        for (int i = 0; ; i++) {
            if (base.contains(x, y)) {
                System.out.println(i % 3 + 1);
                return;
            }
            if (i % 4 == 0) {
                base.endX = base.endX + base.endY - base.startY + 1;
            } else if (i % 4 == 1) {
                base.endY = base.endY + base.endX - base.startX + 1;
            } else if (i % 4 == 2) {
                base.startX = base.startX - (base.endY - base.startY + 1);
            } else {
                base.startY = base.startY - (base.endX - base.startX + 1);
            }
        }
    }
    
    static class Rectangle {
        int startX;
        int startY;
        int endX;
        int endY;
        
        public Rectangle(int startX, int startY, int endX, int endY) {
            this.startX = startX;
            this.startY = startY;
            this.endX = endX;
            this.endY = endY;
        }
        
        public boolean contains(int x, int y) {
            return x >= startX && x <= endX && y >= startY && y <= endY;
        }
    }
}


Measured memory_bytes: 26400
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#define pb push_back
#define ll typedef long long
#define for(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int n,r;
    cin >> n >> r;
    if(!(n >= 10)) cout << r+(100*(10-n)) << endl;
    else cout << r << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
using namespace std;
int main() {
	int n, m,x,y,ans = 0;
	cin >> n >> m;
	vector<int> ball(n,1);
	vector <bool> red(n,false);
	red[0] = true;
	for (int i = 0; i < m;i++) {
		cin >> x >> y;
		ball[x-1]--;
		ball[y-1]++;
		if (red[x-1] == true) {
			red[y-1] = true;
		}
		if (ball[x-1] == 0) {
			red[x-1] = false;
		}
	}
	for (int i = 0; i < n;i++) {
		if (red[i]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}



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

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> n;
	if (n % 2 == 0) {
		cout << n;
	}
	else {
		cout << n * 2;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010
bool vis[M];
void seive(){
	vis[0]=vis[1]=1;
	rep(i,2,M)if(!vis[i])for(ll j=2*i;j<M;j+=i)vis[j]=1;
}
int main(){
	IOS;
	seive();
	ll x;cin>>x;
	rep(i,x,M)if(!vis[i]){cout<<i;break;}
	return 0;
}



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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    
    vector<int> yakusuu(c);
    
    int num = 0;
    for(int i = 1; i <= c; i++) { //約数の探索
        if (c % i == 0) {
            yakusuu.at(num) = i;
            num++;
        }
    }
    
    int count = 0;
    //a~bの数字と約数を全探索
    for (int i = a; i <= b; i++) {
        for(int j = 0; j < yakusuu.size(); j++) {
            if (i == yakusuu.at(j)) count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		if (a + b >= c)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 21716