akhauriyash/Code-Regression huggingface dataset:
#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 n;

bool trust(int flag, int index) {
    bool trust = (flag >> index) & 1;
    return trust;
}

int count (int flag) {
    int dst = 0;
    rep(i, n) if (trust(flag, i)) dst++;
    return dst;
}

int main() {
    cin >> n;
    vector<vector<P>> evidence(n);


    rep(i, n) {
        int a;
        cin >> a;
        evidence.at(i).resize(a);
        rep(j, a) {
            cin >> evidence.at(i).at(j).first >> evidence.at(i).at(j).second;
            evidence.at(i).at(j).first--;
        }
    }
    int ans = 0;
    for (int flag = 0; flag < (1<<n); flag++) {
        bool ok = true;
        rep(i, n) {
            if (trust(flag, i)) {
                for (P p : evidence.at(i)) {
                    if (trust(flag, p.first) ^ (p.second == 1)) {
                        ok = false;
                        break;
                    }
                }
            }
        }
        if (ok) ans = max(ans, count(flag));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
/*                  ___
               :                
               ;                
              :                 
              ;                 
             /                  
           o/                   
         ._/\___,                
             \                  
             /                   
             `      
	bug
*/
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;
#define PI 3.14159265359
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,n) FOR(i,0,n)
typedef long long int ll;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

double tick() { 
	static clock_t oldticks;
	clock_t newticks = clock();
	double diff = 1.0 * (newticks - oldticks) / CLOCKS_PER_SEC; 
	oldticks = newticks;
	return diff;
}

inline int toInt(string s){
	return atoi(s.c_str());
}

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

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

inline bool isPrime(int n){
	ll j;
	j=sqrt(n);

	if(n<2)
		return 0;
	for(int i=2;i<=j;i++){
		if(n%i==0)
			return false;
	}
	return true;
}

string s;
ll k;

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	
	
	cin >> s;
	cin >> k;

	char res='1';
	for(int i=0;i<k;i++){
		if(s[i]!='1'){
			res=s[i];
			break;
		}
	}

	cout << res << endl;

    //cerr << tick();

	return 0;
	
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int a, b;
    cin >> a >> b;
    bool f1 = true;
    bool f2 = true;
    bool f3 = true;
    if (a == 1 || b == 1)
        f1 = false;
    if (a == 2 || b == 2)
        f2 = false;
    if (a == 3 || b == 3)
        f3 = false;

    if (f1)
        c("1");
    if (f2)
        c("2");
    if (f3)
        c("3");

    ed;
    return 0;
}

Measured memory_bytes: 256
while True:
	a = ""
	b = ""
	H, W = map(int, input().split())

	if H == 0 and W == 0 : break

	for i in range(W):
		if i % 2 == 0 : a = a + "#"
		else : a = a + "."
	for i in range(W):
		if i % 2 == 0 : b = b + "."
		else : b = b + "#"

	for j in range(H):
		if j % 2 == 0: print(a)
		else : print(b)

	print()

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

using namespace std;

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

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

  const int INF = 1000000009;
  vector<int> dp(n + 2, INF);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
  }
  cout << dp[n - 1] << endl;

  return 0;
}

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

int main() {
  
  int H, N;
  cin >> H >> N;
  
  int A = 0;
  rep(i,N){
    int buf;
    cin >> buf;
    A += buf;
  }
  if(H <= A){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int N,A,B,cnt=0,CNT=0;
  string S;
  cin>>N>>A>>B>>S;
  
  for(int i=0;i<N;i++){
    if(S[i]=='a'){
      if(cnt<A+B){
        cout<<"Yes"<<endl;
        cnt++;
      }
      else cout<<"No"<<endl;
    }
    else if(S[i]=='b'){
      if(cnt<A+B&&CNT<B){
        cout<<"Yes"<<endl;
        cnt++;
        CNT++;
      }
      else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
  }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 3e5 + 48, mod = 1e9 + 7;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;
 

int n, p[63], cnt[63], ans, a[N];

main () {
	forn (i, 0, 60)
		p[i] = (1ll << i) % mod;

	cin >> n;

	forn (i, 1, n) {
		cin >> a[i];
		forn (j, 0, 60)
			if (a[i] & (1ll << j)) {
				ans = (ans + (i - 1 - cnt[j]) * p[j]) % mod;				
				++cnt[j];
			} else 
				ans = (ans + p[j] * cnt[j]) % mod;
	}	

	cout << ans << endl;
} 

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import static java.lang.Integer.parseInt;

/**
 * ICPC Calculator
 */
public class Main {

	static final char NOOP = ' ';
	static final char PLUS = '+';
	static final char MULTI = '*';

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		Main main = new Main();

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			Exp exp = main.new Exp(null, -1, PLUS);
			Exp parent = exp;

			for (int i = 0; i < n; i++) {
				line = br.readLine();

				int lv = 0;
				for (char c : line.toCharArray()) {
					if (c == '.') {
						lv++;
					} else {
						while (parent.lv >= lv) {
							parent = parent.parent;
						}
						Exp sub = main.new Exp(parent, lv, c);
						parent.exps.add(sub);
						if (c != NOOP) parent = sub;
					}
				}
			}
			System.out.println(exp.value());
		} //end while
	} //end main

	class Exp {
		int lv;
		char op;
		int value;
		//
		Exp parent;
		List<Exp> exps;

		Exp(Exp parent, int lv, char c) {
			this.parent = parent;
			this.lv = lv;
			if (c != PLUS && c != MULTI) {
				this.op = NOOP;
				this.value = c - '0';
			} else {
				this.op = c;
				exps = new ArrayList<Exp>();
			}
		}

		int value() {
			if (op != NOOP) {
				if (op == PLUS) {
					value = 0;
					for (Exp exp : exps) value += exp.value();
				} else {
					value = 1;
					for (Exp exp : exps) value *= exp.value();
				}
			}
			return value;
		}
	}
}

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

ll g(ll n, ll p)
{
	if (n == 1 || n == 0)
		return 0;
	return n / p + g(n / p, p); 
}	

ll g2(ll n, ll p)
{
	ll res = g(n / 2, p);
	if (p == 2)
		res += n / 2;
	return res;
}

signed main()
{
  ll n, ans;

  cin >> n;
  if (n % 2 == 0)
	  ans = min(g2(n, 2), g2(n, 5));
  else
	  ans = 0;
  cout << ans << endl;
}


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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D ;
  if (A + B > C + D){
    cout << "Left" << endl;
  }
  else if(A + B == C + D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    
    if (s == "abc") cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
int main()
{
  int N,x;
  vector<int> A(9,0);
  rep(i,9){cin>>A.at(i);}
  cin>>N;
  rep(i,N){cin>>x;rep(j,9){if(A.at(j)==x)A.at(j)=-1;}}
  if(A.at(0)+A.at(1)+A.at(2)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(3)+A.at(4)+A.at(5)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(6)+A.at(7)+A.at(8)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(0)+A.at(3)+A.at(6)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(1)+A.at(4)+A.at(7)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(2)+A.at(5)+A.at(8)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(0)+A.at(4)+A.at(8)==-3){cout<<"Yes"<<endl;return 0;}
  if(A.at(2)+A.at(4)+A.at(6)==-3){cout<<"Yes"<<endl;return 0;}
  cout<<"No"<<endl;
}

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

using namespace std;

typedef unsigned long long ll;

const int MOD = 1000000007;


int main() {
	int N;
	int count = 0;

	cin >> N;

	for (int i = 0; i < N; ++i){
		int t;
		cin >> t;
		if (t == (i+1)) {
			count++;
			cin >> t;
			i++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {
  int q, n;
  cin >> q;
  for(int i=0; i<q; i++){
    cin >> n;
    int cnt = 0;
    while( n >= 10 ){
      int tmp = -1;
      string ns = to_string(n);
      for(int i=0; i<ns.size()-1; i++){
        // cerr << ns.substr(0, i+1) << " " << ns.substr(i+1) << endl;
        tmp = max(tmp, stoi(ns.substr(0, i+1)) * stoi(ns.substr(i+1)) );
      }
      // cerr << tmp << endl;
      n = tmp;
      cnt++;
    }
    cout << cnt << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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


	int A, B, C;
	cin >> A >> B >> C;

	co(min(B / A, C));

	Would you please return 0;
}

Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = [int(x) for x in input().split()]
H_optim = (T-A)/0.006
_min = 1145141919
H_result = 1
for i,x in enumerate(H):
    if abs(x-H_optim) < _min:
        _min = abs(x-H_optim)
        H_result = i+1
print(H_result)

Measured memory_bytes: 3064
import collections

N = int(input())
A = [int(x) for x in input().split()]

ruiseki = [0]

for a in A:
    ruiseki.append(ruiseki[-1] + a)

c = collections.Counter(ruiseki)

ans = 0
for k in c.keys():
    if c[k] >= 2:
        ans += c[k] * (c[k] - 1) // 2

print(ans)


Measured memory_bytes: 44184
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>
#include <boost/dynamic_bitset.hpp>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

constexpr ll LL_MOD = 1000000009;
constexpr int I_MOD = 1000000007;
constexpr double EPS = numeric_limits<double>::epsilon();
constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> void scan(vector<T> &v);
void scan(vector<string> &v, bool isWord = true);
boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	int a, b;
	cin >> a >> b;

	if (a == 1) {
		a = 14;
	}

	if (b == 1) {
		b = 14;
	}

	if (a > b) {
		cout << "Alice";
	} else if (a < b) {
		cout << "Bob";
	} else {
		cout << "Draw";
	}
	cout << endl;
  return 0;
}

template <class T> void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

boost::dynamic_bitset<> scan(char trueValue) {
	string s;
	getline(cin, s);

	if (s.size() == 0) {
		getline(cin, s);
	}

	for_each(begin(s), end(s), [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n, r;

        n = cin.nextInt();
        r = cin.nextInt();

        if (n >= 10) {
            System.out.println(r);
        } else {
            System.out.println(r + 100 * (10 - n));
        }
    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    int h,w,ans=0;
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
    else cout<<"No";
    return 0;
}



Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as V
main = do
    (a1:b1:_)<-map read.words<$>getLine::IO [Int]
    (a2:b2:_)<-map read.words<$>getLine::IO [Int]
    (a3:b3:_)<-map read.words<$>getLine::IO [Int]
    putStrLn $ if f [(a1,b1), (a2,b2), (a3,b3)] then "YES" else "NO"

f :: [(Int,Int)] -> Bool
f abs = (\n->n==2 || n== 0) $ V.length $ V.filter odd va
    where
        va = V.accum (+) (V.replicate 4 (0::Int)) $ concatMap (\(a,b)->[(a-1,1),(b-1,1)]) abs


Measured memory_bytes: 508
# カンニングして修正
N = int(input())
#各頂点が繋がってる辺リスト
E = [ [] for _ in range(N)]
for i in range(N-1):
    a,b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

# #入力1
# N= 3
# E= [[1], [0, 2], [1]]

# #　入力2
# N= 6
# E= [[1], [0, 2, 3], [1], [1, 5], [5], [3, 4]]

# #　入力3
# N= 7
# E= [[6, 1], [0], [3, 5], [6, 2], [6], [2], [0, 3, 4]]


    
def farthest(s):
    visited = [False]*N
    stack = [[s,0]]
    best = [s,0]
    while len(stack)>0:
#         print("visited:",visited)
#         print("stack:",stack)
        current = stack.pop()#pop(-1)と同じ
        currentPosition = current[0] 
        currentLength = current[1]
        visited[currentPosition] = True
        # bestの更新
        if currentLength > best[1]:
            best = [currentPosition, currentLength]
        visited.append(currentPosition)
        # 繋がっているノードのうち未探索の場所を追加
        for position in E[currentPosition]:
            if not visited[position]:
                stack.append([position, currentLength+1])
    return best

# print("u,length:",farthest(0))
u = farthest(0)[0]
best = farthest(u)
# print(best)
# v = best[0]
diameter = best[1]
# print(diameter)
ans = "First"
if diameter % 3 == 1:
    ans = "Second"
print(ans)

Measured memory_bytes: 64476
#include <iostream>
#include<math.h>

using std::cin;
using std::cout;
int main()
{
	long long int i, n,fact=1,c;
	c=pow(10,9)+7;
	scanf("%lld",&n);
	for(i=1;i<=n;i++)
	{
		fact=(fact*i)%c;
	}
	printf("%lld",fact);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a,b,c,x,count=0;
        scanf("%d %d %d",&a,&b,&c);
    for (x=a; x<=b; x++) {
        if(c%x==0){
            count++;
    }
    }
     printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int MAX=1e3+5;
int main(int argc, char *argv[])
{
	double N,T,A,H[MAX];
	cin>>N;
	cin>>T>>A;
	int ans=0;
	H[0]=1e9;
	for(int i=1;i<=N;i++)
	{
		cin>>H[i];
		H[i]=abs(T-0.006*H[i]-A);
		if(H[i]<H[ans])
			ans=i;
	}
	cout<<ans<<endl;
	return 0;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int N,A,B,C,D;
string S;

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

  cin>>N>>A>>B>>C>>D;
  A--;B--;C--;D--;
  cin>>S;
  bool ok=true;
  repl(i,B,D){
    if(S[i]=='#'&&S[i+1]=='#')ok=false;
  }
  repl(i,A,C){
    if(S[i]=='#'&&S[i+1]=='#')ok=false;
  }

  if(C>D){
    bool aru=false;
    repl(i,max(0,B-1),D){
      if(S[i]=='.'&&S[i+1]=='.'&&S[i+2]=='.')aru=true;
    }
    if(!aru)ok=false;
  }

  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 592
#include<iostream>
using namespace std;
int a[100007];
int l[100007];
int n;
int lis()
{
	l[0]=a[0];
	int len=1;
	for(int i=1;i<n;i++)
	{
		if(l[len-1]<a[i])
			l[len++]=a[i];
		else *lower_bound(l, l+len, a[i])=a[i];
	}
	return len;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	cout<<lis()<<endl;
	return 0;
}


Measured memory_bytes: 3812
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
import itertools

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

m = 55555
r = 5
N = INT()
# 素数列挙 O(NloglogN)
def primes_for(n):
  is_prime = [True] * (n + 1)
  is_prime[0] = False
  is_prime[1] = False
  for i in range(2, n + 1):
      for j in range(i * 2, n + 1, i):
          is_prime[j] = False
  return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes_for(m)
# prime_list = prime_list[:55]
# print(prime_list)
last_is_one = []
for prime in prime_list:
    if prime % 10 == 1:
        last_is_one.append(prime)
# print(len(last_is_one))
last_is_one.sort()
# print(last_is_one[:N])
p_s = []
for p in last_is_one[:N]:
    p_s.append(str(p))

ans = " ".join(p_s)
print(ans)

# ans = " ".join(last_is_one[:N])
# print(ans)



# print(last_is)
        # print(prime)


# len(list(itertools.combinations(prime_list, r))



Measured memory_bytes: 5716
H,W = map(int,input().split())
S = [input() for _ in range(H)]
ans = 'Yes'
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            a = S[max(0,i-1)][j] == '#'
            b = S[i][max(0,j-1)] == '#'
            c = S[i][min(W-1,j+1)] == '#'
            d = S[min(H-1,i+1)][j] == '#'
            if any([a,b,c,d]):
                continue
            else:
                ans = 'No'
                break
print(ans)

Measured memory_bytes: 40048
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬╬╬██╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓▓█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef pair<int,int> P;
typedef vector<vector<P>> Graph;

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

  int H,W,h,w;
  cin >> H >> W >> h >> w;
  
  if(H % h == 0 && W % w == 0) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;

  vector<int> ans[H];
  REP(i,H) ans[i].assign(W,0);

  int pos = 1e3, neg = -((h*w-1)*pos+1);
  REP(i,H){
    REP(j,W){
      if(i%h == h-1 && j%w == w-1) ans[i][j] = neg;
      else ans[i][j] = pos;
    }
  }

  REP(i,H){
    REP(j,W){
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3584
import math
from decimal import Decimal

A,B,H,M = map(int, input().split())

HD = (1/2) - ((H+(M/60))/6)
MD = (1/2) - (M/30)

Ax = A*math.cos(HD*math.pi)
Ay = A*math.sin(HD*math.pi)
Bx = B*math.cos(MD*math.pi)
By = B*math.sin(MD*math.pi)

ans = math.sqrt(((Bx - Ax)**2)+((By - Ay)**2))

print(ans)

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

int main(void){
    int A,B;
    cin>>A>>B;
    if(A%3==0||B%3==0||(A+B)%3==0)
        cout<<"Possible"<<endl;
    else
        cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	//mahakal();fast;

	ll n , k ;
	cin>>n>>k ;
	ll cnt=0;
	while(n>0){
		cnt++;
		n=n/k;
	}
	cout<<cnt<<endl;

	return 0;
}

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

int n, m, q;
int a[50], b[50], c[50], d[50];
int max_score = 0;

int score(vector<int> v) {
    int score = 0;
    for (int i = 0; i < q; i++) {
        if (v[b[i] - 1] - v[a[i] - 1] == c[i]) score += d[i];
    }
    return score;
}

void dfs(int x, vector<int> v) {
    if (v.size() >= n) {
        max_score = max(max_score, score(v));
        return;
    }
    for (int i = x; i < m; i++) {
        vector<int> vv = v;
        vv.push_back(i + 1);
        dfs(i, vv);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;

    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    #endif // _DEBUG

    cin >> n >> m >> q;
    for (int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
    for (int i = 0; i < m; i++) {
        vector<int> v;
        v.push_back(i + 1);
        dfs(i, v);
    }
    cout << max_score;

    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  ll w,h,x,y,ans=0;
  cin>>w>>h>>x>>y;
  if(2*x==w && 2*y==h){
    ans=1;
  }
  cout<<(long double)w*h/2<<" "<<ans;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"     
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

const int N=1e5+5;
int n,h[N],cache[N];

int dp(int pos)
{
     if(pos==n)
          return 0;
     if(pos==n-1)
          return abs(h[pos]-h[n]);
     int &ans=cache[pos];
     if(ans!=-1)
          return ans;
     return ans=min(dp(pos+1)+abs(h[pos]-h[pos+1]),dp(pos+2)+abs(h[pos]-h[pos+2]));     
}

int32_t main()
{
	IOS;

     memset(cache,-1,sizeof cache);
	cin>>n;
	
	for(int i=1;i<=n;i++)
	     cin>>h[i];
	
	cout<<dp(1);
	     
	return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll H, W;
  while (cin >> H >> W) {
    if (H == 1 || W == 1) {
      cout << 1 << endl;
      continue;
    }
    ll y = (H + 1) / 2;
    ll x = (W + 1) / 2;
    ll res = y * x + (H - y) * (W - x);
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N, C, K = map(int, input().split())
Ts = []

for _ in range(N):
  Ts.append(int(input()))
  
Ts.sort()

cnt = 0
i = 0

while i < N:
  j = i
  while j < N and Ts[j] <= Ts[i] + K and j - i + 1 <= C:
    j += 1
  cnt += 1
  i = j
  
print(cnt)

Measured memory_bytes: 81016
ans [a,b] =
    let c = b - a
        x = div c 1000
        y = div (mod c 1000) 500 
        z = div (mod c  500) 100
    in
        unwords $ map show $ [z,y,x]

main = do
    c <- getContents
    let i = takeWhile (/= [0,0]) $ map (map read) $ map words $ lines c :: [[Int]]
        o = map ans i
    mapM_ putStrLn o


Measured memory_bytes: 4520
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

int main() {
	int X;
	cin >> X;
	cout << X / 500 * 1000 + (X % 500) / 5 * 5 << endl;
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int P,Q,R; cin >> P>>Q>>R;
    cout << min({P+Q,Q+R,R+P}) << endl; 
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();

		int L = A + B;
		int R = C + D;

		String result;
		if(L > R){
			result = "Left";
		}
		else if(L < R){
			result = "Right";
		}
		else{
			result = "Balanced";
		}

		System.out.println(result);
	}
}

Measured memory_bytes: 21972
n,t = map(int,input().split())
tt = [int(i) for i in input().split()]
ans = t
time = t

for i in range(1,n):
    if tt[i] >= time:
        ans += t
    else:
        ans += tt[i]-tt[i-1]
    time = tt[i]+t

print(ans)






Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
#define md 1000000007
#define ll long long 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fastmap mp.reserve(1024);mp.max_load_factor(0.25);
#define fastset st.reserve(1024);st.max_load_factor(0.25);
ll int mpw(ll int a,ll int b,ll int m)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans=(ans*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return ans;
}
 
ll int pw(ll int a,ll int b)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans*=a;
		}
		a*=a;
		b>>=1;
	}
	return ans;
}
 
ll int mn(ll int a,ll int b)
{
	if(a<=b)
	{
		return a;
	}
	return b;
}
 
ll int mx(ll int a,ll int b)
{
	if(a>=b)
	{
		return a;
	}
	return b;
}
vector<vector<ll int>>mul(vector<vector<ll int>> &A,vector<vector<ll int>> &B)
{
	int n=A.size();
	vector<vector<ll int>>tmp(n,vector<ll int>(n,0));
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			ll int tmp1=0;
			for(int x=0;x<n;++x)
			{
				tmp1=(tmp1+(A[i][x]*B[x][j])%md)%md;
			}
			tmp[i][j]=tmp1;
		}
	}
	return tmp;
}
int main()
{
	fio
	ll int n,k;
	cin>>n>>k;
	vector<vector<ll int>>M(n,vector<ll int>(n,0));
	vector<vector<ll int>>ans(n,vector<ll int>(n,0));
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			cin>>M[i][j];
		}
		ans[i][i]=1;
	}
	while(k)
	{
		if(k&1)
		{
			ans=mul(ans,M);
		}
		M=mul(M,M);
		k>>=1;
	}
	ll int cnt=0;
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			cnt=(cnt+ans[i][j])%md;
		}
	}
	cout<<cnt<<"\n";
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    vector<string> v;
    v = {"Sunny","Cloudy","Rainy"};
    for(int i = 0 ; i < 3 ; i += 1){
        if(s == v[i]){
            cout << v[(i+1)%3];
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
using namespace std;
struct node {
  int key, pri;
  node *left, *right;
};
typedef struct node* Node;
Node NIL,root;
Node _deletekey(Node, int);
Node rightRotate(Node t) {
  Node s = t->left;
  t->left = s->right;
  s->right = t;
  if (root == t) root = s;
  return s;
}
Node leftRotate(Node t) {
  Node s = t->right;
  t->right = s->left;
  s->left = t;
  if (root == t) root = s;
  return s;
}
Node newnode(int key, int pri) {
  Node newNode = (Node)malloc(sizeof(struct node));
  newNode->key = key;
  newNode->pri = pri;
  newNode->right = newNode->left = NIL;
  if (root == NIL) root = newNode;
  return newNode;
}
Node insert(Node t, int key, int pri) {
  if (t == NIL) return newnode(key,pri);
  if (key == t->key) return t;
  if (key < t->key) {
    t->left = insert(t->left, key, pri);
    if (t->pri < t->left->pri) t = rightRotate(t);
  }
  else {
    t->right = insert(t->right, key, pri);
    if (t->pri < t->right->pri) t = leftRotate(t);
  }
  return t;
}
Node deletekey(Node t,int key) {
  if (t == NIL) return NIL;
  if (key < t->key) t->left = deletekey(t->left, key);
  else if (key > t->key) t->right = deletekey(t->right, key);
  else return _deletekey(t, key);
  return t;
}
Node _deletekey(Node t, int key) {
  if (t->left == NIL && t->right == NIL) return NIL;
  if (t->left == NIL) t = leftRotate(t);
  else if (t->right == NIL) t = rightRotate(t);
  else {
    if (t->left->pri > t->right->pri) t = rightRotate(t);
    else t = leftRotate(t);
  }
  return deletekey(t,key);
}
void inorder(Node p) {
  if (p != NIL) {
    inorder(p->left);
    cout << " " << p->key;
    inorder(p->right);
  }
}
void preorder(Node p) {
  if (p != NIL) {
    cout << " " << p->key;
    preorder(p->left);
    preorder(p->right);
  }
}
Node find(int x) {
  Node r = root;
  while (r != NIL) {
    if (r->key == x) return r;
    if (r->key<x) r = r->right;
    else r = r->left;
  }
  return r;
}
int main() {
  int n, x,y;
  char s[7]; cin >> n;
  for (int i = 0; i<n; ++i) {
    cin >> s;
    if (s[0] == 'i') {
      cin >> x >> y;
      insert(root,x,y);
    }
    else if (s[0] == 'p') {
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
    else if (s[0] == 'f') {
      cin >> x;
      if (find(x) != NIL) cout << "yes" << endl;
      else cout << "no" << endl;
    }
    else {
      cin >> x;
      deletekey(root,x);
    }
  }
  return 0;
}



Measured memory_bytes: 9364
#include <bits//stdc++.h>
using namespace std;
#define rep(i,k) for(int i=0;i<k;i++)
#define int long long
signed main(void){
    int n,k;
    cin>>n>>k;
    int frog[n];
    int high[n];
    rep(i,n) cin>>high[i];
    frog[0]=0;
    rep(i,n-1){
        int t=min(k,i+1);
        int h=LLONG_MAX;
        rep(j,t){
            int s=max(high[i+1]-high[i-j],high[i-j]-high[i+1])+frog[i-j];
            if(h>s)
            h=s;
        }
        frog[i+1]=h;
    }
    cout<<frog[n-1]<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>

using namespace std;

const ll N = 3e5+100;
const ll MOD = 1e9+7;
bool poss[100010];
int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n;
	cin >> n;
	poss[0] = true;

	for(int i = 1;i<=n;i++)
	{
		for(auto x:{100,101,102,103,104,105})
		{
			if(i >= x)
			{
				if(poss[i-x]==true) poss[i] = true;
			}
		}
	}
	if(poss[n]) cout <<1  <<endl;else cout << 0 << endl;return 0;
	

}

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

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;int c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<1)+(x<<3)+c-48;c-getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;

string s;

int main(void)
{

//	freopen("testdata.in","r",stdin);
//	freopen("testdata.out","w",stdout);

	cin>>s;
	
	int l=s.length();
	
	bool flag=false;
	bool vis=false;
	
	for(int i=0;i<l;i++)
	{
		if(s[i]=='C') flag=true;
		if(s[i]=='F'&&flag) vis=true;
	}
	
	if(vis) puts("Yes");
	else puts("No");

	return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N, K;

ll fac[110000], finv[110000], inv[110000];

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

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

vector<ll> v;

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

  rep(i, N) {
    ll tmp;
    cin >> tmp;
    v.push_back(tmp);
  }

  sort(All(v));

  if (v[0] < 0) {
    ll add = -v[0];
    Rep(i, N) {
      v[i] += add;
    }
  }

//  Rep(i, N) {
//    cout << v[i] << "\n";
//  }

  ll big = 0;
  ll small = 0;

  for (ll i=N-1;i>=K-1;--i) {
    big += v[i] * COM(i, K-1);
    big %= MOD;
    small += v[N-1-i] * COM(i, K-1);
    small %= MOD;
  }

//  cout << big << " " << small << "\n";

  ll ans = (big + MOD) - small;
  ans %= MOD;
  cout << ans << "\n";
  
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==b[i]&&a[i]==c[i])
         continue;
        else if(a[i]-b[i]==0||a[i]-c[i]==0||b[i]-c[i]==0)
         ans++;
        else
         ans+=2;
    }
cout<<ans<<endl;
}


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

int main() {
    int N;
    int sum =0;
    cin>>N;
    vector<int>A(N);
    vector<int>B(N);
    vector<int>C(N-1);
    for(int i=0;i<N;i++) cin>>A[i];
    for(int i=0;i<N;i++) cin>>B[i];
    for(int i=0;i<N-1;i++) cin>>C[i];

    for(int i=0;i<N;i++){
        sum +=B.at(A.at(i)-1);
        if(i!=N-1&&A.at(i)+1==A.at(i+1))sum+=C.at(A.at(i)-1);
    }
    cout <<sum<<endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextLong()
    val b = sc.nextLong()
    val k = sc.nextLong()
    println("${Math.max(0, a - k)} ${Math.max(0, b - Math.max(0, (k - a)))}")
}

Measured memory_bytes: 31660
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>
#include<math.h>

int sprInput(char *retstr, char *str, int strnum)
{
	char buf[256]={};
	int h, i, j;

	i = 0;
	for(h=0;h<strnum;h++){
		memset(buf, '\0', sizeof(buf));
		j = 0;
		if (str[i] == '\0') break;
		while(str[i] != ' ' && str[i] != '\n' && str[i] != '\0')
		{
			buf[j] = str[i];
			i++;
			j++;
		}
		i++;
	}
	memcpy(retstr, buf, sizeof(buf));

	return (retstr[0] == '\0' ? 0 : 1);
}

int main(int argc, char *argv[])
{
	char str[256]={};
	char inbuf[5][256];
	int W, H, x, y, r;
	int i = 0;

	fgets(str, 256, stdin);

	for (i = 0; i < 5; i++){
		sprInput(inbuf[i], str, i+1);
	}
	W = atoi(inbuf[0]);
	H = atoi(inbuf[1]);
	x = atoi(inbuf[2]);
	y = atoi(inbuf[3]);
	r = atoi(inbuf[4]);

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

	return 0;
}

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

typedef long long ll;
typedef double keytype;

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int main(){
    char s[11];

    scanf("%s", s);

    int max = 0;
    for(int i = 0; i < strlen(s); ++i){
        int cnt = 0;
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
            for(int j = i + 1; j < strlen(s); ++j){
                if(s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T'){
                    cnt++;
                }else{
                    break;
                }
            }
        }
        if(max < cnt) max = cnt;
    }

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

    return 0;
}


Measured memory_bytes: 1728
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	ans := int(1e+5)
	var dfs func(rest, count int)
	dfs = func(rest, count int) {
		if rest < 6 {
			if rest+count < ans {
				ans = rest + count
			}
			return
		}
		dfs(f(rest, 6), count+1)
		if rest >= 9 {
			dfs(f(rest, 9), count+1)
		}
	}
	dfs(N, 0)

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}

func f(rest, num int) int {
	total := 1
	for rest > total {
		total *= num
	}
	if rest == total {
		return 0
	} else {
		return rest - total/num
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

using lli = long long int;

template<typename WeightT>
struct edge {
  int from, to;
  WeightT weight;
  edge(int s, int d, WeightT w): from(s), to(d), weight(w) {}
};

template<typename WeightT>
using edges = std::vector<edge<WeightT> >;

template<typename WeightT>
using adjacency_list = std::vector<edges<WeightT> >;

template<typename WeightT>
void
add_undir_edge(adjacency_list<WeightT> &G, int u, int v, WeightT w) {
  G[u].emplace_back(u, v, w);
  G[v].emplace_back(v, u, w);
}

struct rooted_tree {
  size_t size;
  std::vector<size_t> topo;
  std::vector<size_t> par;
  std::vector<std::vector<size_t>> children;
};

template <typename WeightT>
rooted_tree make_rooted_tree(adjacency_list<WeightT> const &G, size_t root) {
  size_t N = G.size();
  std::vector<size_t> topo, par(N);
  par[root] = N + 1;
  std::vector<std::vector<size_t>> ch(N);

  std::vector<bool> used(N, false);
  std::stack<size_t> stk;
  stk.push(root); used[root] = true;
  while (!stk.empty()) {
    size_t const u = stk.top(); stk.pop();
    topo.push_back(u);
    for (auto &&e : G[u]) {
      if (used[e.to]) { continue; }
      stk.push(e.to); used[e.to] = true;
      par[e.to] = u;
      ch[u].push_back(e.to);
    }
  }
  return { N, topo, par, ch };
}

template <typename T, typename FnT>
struct product {
  explicit product(FnT const &app, T un, std::vector<T> const &seq):
    fn(app), prefix(seq.size()+1, un), suffix(seq.size()+1, un)
  {
    for (size_t i = 0; i < seq.size(); ++i) {
      prefix[i+1] = fn(prefix[i], seq[i]);
    }
    for (size_t i = seq.size(); i > 0; --i) {
      suffix[i-1] = fn(seq[i-1], suffix[i]);
    }
  }
  T value() const {
    return suffix[0];
  }
  T cut(size_t i) const {
    return fn(prefix[i], suffix[i+1]);
  }
  FnT fn;
  std::vector<T> prefix;
  std::vector<T> suffix;
};

using namespace std;

using Graph = adjacency_list<nullptr_t>;

lli M;
lli mult_modm(lli a, lli b) {
  return (a * b) % M;
}
using Product = product<lli, decltype(&mult_modm)>;

void solve(int N, Graph const &G) {
  auto const tree = make_rooted_tree(G, 0);
  vector<Product> dr(N, Product(mult_modm, 1, {}));
  RREP(i, tree.size) {
    size_t u = tree.topo[i];
    std::vector<lli> ch;
    for (auto &&v : tree.children[u]) {
      ch.push_back(dr[v].value() + 1);
    }
    dr[u] = Product(mult_modm, 1, ch);
  }

  vector<lli> dpar(N);
  dpar[0] = 0;
  for (auto &&u : tree.topo) {
    REP(j, tree.children[u].size()) {
      size_t v = tree.children[u][j];
      dpar[v] = mult_modm(dpar[u]+1, dr[u].cut(j));
    }
  }
  REP(u, N) {
    cout << mult_modm(dr[u].value(), dpar[u]+1) << endl;
  }
}

int main() {
  int N; cin >> N >> M;
  Graph G(N);
  REP(i, N-1) {
    int X, Y; cin >> X >> Y;
    add_undir_edge(G, --X, --Y, nullptr);
  }
  solve(N, G);
  return 0;
}


Measured memory_bytes: 27948