akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    // 5を上にしておいて
    // 6 -> 5 -> 6 -> ...とする
    ll N;
    cin >> N;
    ll ans = 0;
    ll d = N / 11;
    ans += d * 2;
    N %= 11LL;
    if (0 < N && N <= 6) ans += 1;
    else if (6 < N) ans += 2;
    cout << ans << '\n';
}


Measured memory_bytes: 3552
from collections import defaultdict


def gcd(a, b):
    if a > b:
        return gcd(b, a)
    # a <= b
    if a == 0:
        return b
    else:
        r = b % a
        return gcd(r, a)


def prime_factorization(n):
    factors = defaultdict(int)
    i = 1
    n_sub = n
    while True:
        i += 1
        if i * i > n or n_sub == 1:
            break

        while n_sub % i == 0:
            n_sub = n_sub // i
            factors[i] += 1

    if n_sub != 1:
        factors[n_sub] = 1
    return factors


def main():
    a, b = map(int, input().split())
    g = gcd(a, b)
    if g == 1:
        return 1
    primes = prime_factorization(g)
    # add "1"
    return len(primes) + 1
    

print(main())


Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
#define MAX 100000
#define ll long long
#define MOD 1000000007
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()

string s;
unordered_map<int,int>freq;

int main()
{
    cin >> s;
    long long ans = 0, p = 1, sum = 0;
    freq[0] = 1;
    for(int i = s.size() - 1; i >= 0; i--)
    {
        sum = (sum + ((s[i] - '0') * p))% 2019;
        //cout << sum << "\n";
        ans += freq[sum];
        freq[sum]++;
        p = (p * 10) % 2019;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair



bool check(ll num){
	ll sq=sqrt(num);
	for(ll i=2;i<=sq;++i){
		if(num%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll X;
	cin>>X;
	ll i=X;
	while(!check(i)){
		i++;
	}
	cout<<i<<endl;
}

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

int main(void){
    long long int a = 0, b = 0, k = 0; 

    scanf("%lld%lld%lld", &a, &b, &k);

    if(a >= k){
        a -= k;
//        printf("aaa\n");
    }else{
        k -= a;
        a = 0;
//        printf("k=%d\n", k);
        b -= k;
//        printf("%d %d\n", a , b);

        if(b < 0){
            b = 0;
        }
    }
    printf("%lld %lld\n", a , b);

    return 0;

} 


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)

void init() {
    string s; cin >> s;
    int t = 0;
    for (auto x : s) t += x-'0';
    cout << (stoi(s)%t ? "No\n" : "Yes\n");
}

void solve() {
    
}

int main () {
    cin.tie(0); cin.sync_with_stdio(0);
    int T = 1;
    //cin >>T;
    for (int i=1; i<=T; i++) {
        init();
        solve();
    }
}


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

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

	int a,b;
	cin>>a>>b;
	int curr=1,ans=0;
	while(curr<b){
		curr--;
		curr += (a);
		ans++;
	}
	cout<<ans<<endl;

	return 0;
}

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

void a(std::istream& in)
{
    int K;
    in >> K;

    int A, B;
    in >> A >> B;

    for (int i = A; i <= B; ++i)
    {
        if (i % K == 0)
        {
            std::cout << "OK";
            return;
        }
    }

    std::cout << "NG";
}

int main(int, char* [])
{
    a(std::cin);
    return 0;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  set<int> S;
  rep(i,0,3){
    int X; cin>>X;
    S.insert(X);
  }
  string ans="No";
  if(S.size()==2)
    ans="Yes";
  cout<<ans<<endl;
  }



Measured memory_bytes: 256
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 10**9
dp = [INF]*n
dp[0] = 0
for i in range(n-1):
    for j in range(1, k+1):
        if i+j==n:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])

Measured memory_bytes: 52448
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	double dis = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
	
	printf("%lf\n", dis);

	return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    rep(i,n){
        if(a[i] == 0){
            cout << '0' << endl;
            return 0;
        }
    }
    ll ans = 1;
    ll mx = 1000000000000000000;
    rep(i,n){
        if(mx/ans < a[i]){
            cout << "-1" << endl;
            return 0;
        }
        ans *= a[i];
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4048
import sys

MAX = 1000000
prime = [-1] * MAX
i = 2
while MAX > i:
	if prime[i - 1] == -1:
		prime[i - 1] = 0
		temp = i * 2
		while temp < MAX:
			prime[temp - 1] = 1
			temp += i
	if i == 2:
		i += 1
	else:
		i += 2

while True:
    a, d, n = map(int, sys.stdin.readline().split())
    
    if a == d == n == 0:
        break

    count = 0
    while True:
        if prime[a - 1] == 0:
            count += 1
        if count < n:
            a = a + d
        else:
            break
    print a

Measured memory_bytes: 12056
N, M = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
X = sorted(X)

D = [0] * (M-1)
for i in range(len(X)-1):
    D[i] = X[i+1] - X[i]

D = sorted(D, reverse=True)
print(sum(D[N-1:]))


Measured memory_bytes: 54440
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l;
    cin>>n>>l;
    int a[n];
    int m=0,last;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i){
            if(a[i]+a[i-1]>m){
                m=a[i]+a[i-1];
                last=i;
            }
        }
    }
    
    if(m<l)cout<<"Impossible"<<endl;
    else{
        cout<<"Possible"<<endl;
        for(int i=1;i<last;i++)cout<<i<<endl;
        for(int i=n-1;i>=last;i--)cout<<i<<endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;


int main(){

int n,count=0; cin>>n;
ll a[n+1];
FOR(i,1,n+1)cin>>a[i];
int b[n+1];


for(int i=n;i>0;i--){
   int mul=0;
   b[i]=0;
    for(int j=2*i;j<=n;j+=i){//自分の倍数を
            mul+=b[j];
         }
     if(mul%2!=a[i]){
              b[i]=1; count++; 
             }
    }


cout<<count<<endl;
for(int i=1;i<=n;i++)if(b[i]==1)cout<<i<<" ";
cout<<endl;

}

Measured memory_bytes: 3200
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

int main()
{
	string str;
	int n;
	cin>>str;
	n = str.size() - 2;
	cout<<str[0]<<n<<str[n+1]<<endl;
	return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s, t;
	cin >> s >> t;
	int flag = 1;
	//0 s > t,1 s = t,2 s < t
	if(s.size() == t.size())
	{
		for(int i = 0; i < s.size(); i++)
		{
			if(s[i] > t[i])
			{
				flag = 0;
				break;
			}
			else if(s[i] < t[i])
			{
				flag = 2;
				break;
			}
		}
	}
	else if(s.size() > t.size())
	{
		flag = 0;
	}
	else
	{
		flag = 2;
	}
	if(flag == 0)
		cout << "GREATER" << endl;
	else if(flag == 1)
		cout << "EQUAL" << endl;
	else
		cout << "LESS" << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    exp = [i for i in input().split()]
    stack = []

    for elem in exp:
        if elem.isdigit():
            stack.append(int(elem))
        else:
            n2, n1 = str(stack.pop()), str(stack.pop())
            stack.append(int(eval(n1 + elem + n2)))

    print(stack[0])

main()



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

int main(){
  long int n,t,s[210000];
  cin>>n>>t;
  for(int i=0;i<n;i++) cin>>s[i];
  long int sum=t+s[n-1];
  for(int i=1;i<n;i++){
    long int d=s[i]-s[i-1];
    if(d>t) sum+=t-d;
  }
  cout<<sum;
}


Measured memory_bytes: 1792
use std::collections::BTreeMap;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

struct Restaurant {
    n: u32,
    score: u32,
}

fn main() {
    let n = read::<u32>();
    let regions = {
        let mut rows = BTreeMap::<String, Vec<Restaurant>>::new();
        for i in 1..n + 1 {
            rows.entry(read::<String>())
                .or_insert(vec![])
                .push(Restaurant {
                    n: i,
                    score: read::<u32>(),
                });
        }
        for row in rows.values_mut() {
            row.sort_by(|a, b| a.score.cmp(&b.score));
            row.reverse();
        }
        rows
    };

    for region in regions.values() {
        for restaurant in region {
            println!("{}", restaurant.n);
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

void dfs(vector<vector<int>> &g, vector<bool> &color, int v, int p) {
    for (int u: g[v]) {
        if (u == p) continue;
        color[u] = !color[v];
        dfs(g, color, u, v);
    }
}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    for (int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<bool> color(n);
    color[0] = false;
    dfs(g, color, 0, -1);

    int cnt[2] = {};
    for (auto e: color) cnt[e]++;

    if (cnt[1] < cnt[0]) {
        swap(cnt[0], cnt[1]);
        for (int i = 0; i < n; ++i) color[i] = !color[i];
    }

    int cap[3] = {};
    for (int i = 1; i <= n; ++i) cap[i%3]++;

    if (cnt[0] < cap[2]) {
        for (int i = 0; i < n; ++i) {
            int m;
            if (color[i]) {
                if (cap[1]) m = 1;
                else if (cap[2]) m = 2;
                else m = 0;
            } else {
                m = 0;
            }

            if (m == 0) cout << cap[m]*3 << " ";
            else cout << (cap[m]-1)*3+m << " ";

            cap[m]--;
        }

    } else {
        for (int i = 0; i < n; ++i) {
            int m;
            if (color[i]) {
                if (cap[1]) m = 1;
                else m = 0;
            } else {
                if (cap[2]) m = 2;
                else m = 0;
            }

            if (m == 0) cout << cap[m]*3 << " ";
            else cout << (cap[m]-1)*3+m << " ";

            cap[m]--;
        }
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 21504
#include <iostream>
using namespace std;
typedef long long int ll;
int main(){
 ll a,b,c;
 cin >>a>>b>>c;
 ll k=a+b;
 if(k<c){
   cout <<k+b+1<<endl;
   return 0;
 }
 else {
   cout<< b+c<<endl;
   return 0;
 }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, sum = 0;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		ll up = n / i;
		sum += (i * up * (up + 1))/2;
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N;
    cin >> N;
    
    ll ans = 0;
    for(int i=1;i<=N;i++){
        if(i%3 != 0 && i%5 != 0)
            ans += i;
    }
    
    cout << ans << endl;    

}

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


int main() {
    int a[5];
    int kk;
    for(int i = 0; i < 5; i++) {
        cin>>a[i];
    }
    cin>>kk;
    for(int i = 0; i < 4; i++) {
        for( int k = i + 1; k < 5; k++) {
            if(a[k] - a[i] > kk) {
                cout<<":("<<endl;
                return 0;
            }

        }
    }
    cout<<"Yay!"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
char a[15];
int main(){
    scanf("%s", a);
    int lsum = 0, sum = 0;
    for(int i = 0; i < strlen(a); i++){
        lsum += a[i] - '0';
        sum   = sum * 10 + a[i] - '0';
    }
    if(sum % lsum == 0) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	vector<int> sell;
	int num1,num2;
	while(1){
		cin>>num1>>num2;
		if(num1==0 && num2==0)break;
		sell.push_back(num1+num2);
		rep(i,4){
			cin>>num1>>num2;
			sell.push_back(num1+num2);
		}
		int ansnum=0,anssum=0;
		for(int i=0;i<sell.size();i++){
			if(sell[i]>anssum){
				anssum=sell[i];
				ansnum=i;
			}
		}
		cout<<(char)(ansnum+'A')<<" "<<anssum<<endl;
		while(!sell.empty()){
			sell.pop_back();
		}
	}
	return 0;
}

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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define pil pair<int,long long>
#define ll long long
#define el '\n'

using namespace std;

const int N = 3e2 + 10;

int n;
ll ar[N];
ll cur;

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

    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> ar[i];
        cur ^= ar[i];
    }
    if (cur == 0){
        cout << 0 << el;
        return 0;
    }
    cur = ((cur ^ ar[1]) ^ ar[2]);
    ll ans = 0;
    // cout << cur << el;
    for (ll i=0;i<50;i++){
        ll bit = (1LL << i);
        if ((cur & bit) != ((ar[1] & bit) ^ (ar[2] & bit))){
            ll j;
            ll temp = (1LL << (i + 1)) - 1LL;
            ll res = (cur & temp);
            ll a = ar[1], b = ar[2];
            for (j=0;j<50;j++){
                ll bit2 = (1LL << j);
                if (a < bit2){
                    j = 50;
                    break;
                }
                if (res == (((a - bit2) ^ (b + bit2)) & temp)) break;
            }
            if (j >= 50){
                cout << -1 << el;
                return 0;
            }
            ll tambah = (1LL << j);
            ans += tambah;
            ar[1] -= tambah;
            ar[2] += tambah;
        }
        for (ll i=50;i>=0;i--){
            ll bit2 = (1LL << i);
            if (bit2 > ans) continue;
            if (cur == ((ar[1] + bit2) ^ (ar[2] - bit2))){
                ans -= bit2;
                ar[1] += bit2;
                ar[2] -= bit2;
            }
        }
    }
    if (ar[1] == 0){
        cout << -1 << el;
        return 0;
    }
    cout << ans << el;

    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,H;cin>>N>>H;
    int a[100010],b[100010];
    priority_queue<int> pq_a,pq_b;
    pq_b.push(0);
    for(int i=0;i<N;i++){
        cin>>a[i]>>b[i];
        pq_a.push(a[i]);
        pq_b.push(b[i]);
    }

    int A=pq_a.top();
    int count=0;
    
    int B=pq_b.top();pq_b.pop();
    while(B>A){
        H-=B;
        count++;
        if(H<=0)goto lol;

        B=pq_b.top();pq_b.pop();
    }
    count+=H/A;
    if(H%A!=0)count++;

    lol:
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 2036
#include "stdio.h"

char s[1111111];
int w[1111111];
int h[1000000];

int main()
{
	int noww = 0;
	while(1)
	{
		int n;
		int m;

		{
			scanf("%d",&n);
			if(n == 0)
			{
				break;
			}
			scanf("%d",&m);
			scanf("%s",s + 1);
		}

		{
			s[0] = s[1];
			w[0] = 0;
			for(int i = 1; i <= m; i++)
			{
				if(s[i - 1] != s[i])
				{
					w[i] = w[i - 1] + 1;
				}
				else
				{
					w[i] = 1;
				}
			}
		}

		{
			h[noww] = 0;
			for(int i = 1; i <= m; i++)
			{
				if(w[i] > n * 2 && s[i] == 'I')
				{
					h[noww]++;
				}
			}
			noww++;
		}
	}

	for(int i = 0; i < noww; i++)
	{
		printf("%d\n",h[i]);
	}

	return 0;
}

Measured memory_bytes: 8156
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        Set<Integer> s = new HashSet<Integer>();
        for (int i = 0; i < k; i++) {
            int d = Integer.parseInt(sc.next());
            for (int j = 0; j < d; j++) {
                int a = Integer.parseInt(sc.next());
                s.add(a);
            }
        }
        int c = n - s.size();
        System.out.println(c);
    }
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int N=1e6+100;

int dp[N][2];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s;
    cin>>s;
    s="0"+s;
    int n=s.size();
    s="_"+s;
    for(int i=1;i<=n;i++)
    {
        int d=s[i]-'0';
        dp[i][0]=min(dp[i-1][0]+d,dp[i-1][1]+10-d);
        d++;
        dp[i][1]=min(dp[i-1][0]+d,dp[i-1][1]+10-d);
    }
    cout<<dp[n][0];
}


Measured memory_bytes: 16884
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def main():
    n =ni()
    s = na()
    s.sort()
    l = pow(10,18)
    ans = 1
    for i in s:
        ans *= i
        if ans > l:
            print(-1)
            return
    print(ans)
    return


if __name__ == '__main__':
    main()

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

#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define i64 long long int
#define MEM(a,x) memset(a,x,sizeof(x))
#define INF 1000000000
#define mod 998244353

using namespace std ;

typedef pair<int,int> pi ;

#define maxn 1000005

int a[maxn] ;

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

bool f(int n)
{
    int even = 0 , odd = 0 , idx = -1 ;

    for(int i=1 ; i<=n ; i++)
    {
        if( (a[i]&1) )
        {
            odd++ ;
            idx = i ;
        }
        else even++ ;
    }

    if( even%2==1 ) return true ;
    if( odd > 1 || a[idx] == 1 ) return false ;

    a[idx]-- ;

    int g = a[1] ;

    for(int i=2 ; i<=n ; i++)
    {
        if( a[i]%g !=0 ) g = gcd( g , a[i] ) ;
    }
    for(int i=1 ; i<=n ; i++) a[i] /= g ;

    return !f(n) ;
}

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;

    for(i=1 ; i<=n ; i++) scanf("%d",&a[i]) ;

    if( f(n) ) printf("First\n") ;
    else printf("Second\n") ;

    return 0 ;
}


Measured memory_bytes: 640
def main():
    H, W, K = map(int, input().split())
    S = [input() for _ in range(H)]
    piyo = []
    result = [[0]*W for _ in range(H)]
    hoge = 0
    pesi = 0
    for i in range(H):
        temp = S[i].count("#")
        if temp > 0:
            for j in range(W):
                if S[i][j] == "#":
                    hoge += 1
                for k in range(pesi+1):
                    result[i-k][j] = hoge
            temp = S[i].find("#")
            guhu = result[i][temp]
            for j in range(temp):
                for k in range(pesi+1):
                    result[i-k][j] = guhu
            pesi = 0
        else:
            pesi += 1
    for j in range(W):
        for k in range(1, pesi+1):
            result[-k][j] = result[-pesi-1][j]
    for r in result:
        r = map(str, r)
        print(" ".join(r))
main()

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

const int N = 1e5 + 8;

int score[N];

int32_t main(){
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);  

    int n , k , q;
    cin >> n >> k >> q;
    int u = 0;
    for(int i = 1 ; i <= q ; i++){
        int x; cin >> x;
        score[x]++;
        u++;
    }

    for(int i = 1 ; i <= n ; i++){
        cout << (k +  score[i] - u > 0 ? "Yes\n" : "No\n");
    }

  return 0;
}




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

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

  while(1)
  {
    //Takahashi turn
    C -= B;
    if(C<1)
    {
      cout<<"Yes";
       return 0;
    }

    //Aoki turn
    A -= D;
    if(A<1)
    {
      cout<<"No";
      return 0;
    }
    
  }
  
 return 0; 
}

Measured memory_bytes: 3624
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n, k;
  cin >> n >> k;
  int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  long long ans = 0;
  for (int i = 0; i <= min(n, k); i++) {
    for (int j = min(n, k) - i; j >= 0; j--) {
      long long value = 0;
      vector<long long> husai;
      for (int t = 0; t < i; t++) {
        value += v[t];
        if (v[t] < 0) husai.push_back(v[t]);
      }
      for (int t = n - 1; t > n - 1 - j; t--) {
        value += v[t];
        if (v[t] < 0) husai.push_back(v[t]);
      }
      sort(husai.begin(), husai.end());
      for (int t = 0; t < min((int)husai.size(), k - i - j); t++) {
        value -= husai[t];
      }
      ans = max(ans, value);
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc154/tasks/abc154_a
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	string t;
	cin>>t;
	ll a;
	cin>>a;
	ll b;
	cin>>b;
	ll aa;
	ll bb;
	string u;
	cin>>u;
	ll ls;
	ls=s.length();
	ll lu;
	lu=u.length();
	ll i;
	for(i=0;i<lu;i++)
	{
		if(s[i]==u[i])
		{
			aa=a-1;
			bb=b;
		}
		else
		{
			aa=a;
			bb=b-1;
		}
	}
	cout<<aa<<"\n";
	cout<<bb<<"\n";
	return 0;
}

Measured memory_bytes: 3580
from queue import deque
S=deque(input())
Q=int(input())
s=0
for i in range(Q):
    q=list(input().split())
    if int(q[0])==1:
        if s==0:
            s=1
        else:
            s=0
    else:
        T=int(q[1])
        if s==0:
            if T==2:
                S.append(q[2])
            else:
                S.appendleft(q[2])
        else:
            if T==1:
                S.append(q[2])
            else:
                S.appendleft(q[2])
if s==1:
    S.reverse()
S="".join(S)
print(S)

Measured memory_bytes: 9072
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
#define MAX 110
    int n, y; //銀行の数、預ける年数
    int b[MAX], r[MAX], t[MAX]; //銀行番号、年利率、金利の種類（単利：１、複利：２）

    while(true){
        cin >> n;
        if(n == 0) break;
        cin >> y;

        for(int i = 0; i < n; i++){
            cin >> b[i] >> r[i] >> t[i];
        }

        double ganri[MAX]; //元利
        double ganri_max = 10000; //元利の最大値
        int number; //元利が最大になる銀行の番号

        for(int i = 0; i < n; i++){
            if(t[i] == 1){//単利の場合
                ganri[i] = 10000 * (1 + y * (double)r[i] / 100);
            }
            else{//複利の場合
                ganri[i] = 10000 * pow(1 + (double)r[i] / 100, y);
            }
            if(ganri[i] > ganri_max){
                ganri_max = ganri[i];
                number = b[i];
            }
        }
        cout << number << endl;
    }
}


Measured memory_bytes: 3380
#include<iostream>
using namespace std;
int main(){
int n,y;
cin >> n >> y;
for(int i=0;i<=n;i++)
{
for(int j=0;j<=n-i;j++)
{
for(int q=0;q<=n-i-j;q++)
{
if(10000*i+5000*j+1000*q==y and i+j+q==n)
{
cout << i << " " << j << " " << q;
return 0;
}}}}
cout << "-1 -1 -1";
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;
const lint INF = 1LL << 60;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

int main() {
    int N;
    cin >> N;
    cout << fixed << setprecision(10);

    int c = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 1) c++;
    }

    double cd = c;
    double ans = cd / N;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/*
 * Author - Abhas Jain
 * Code is inside the solve function
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
const int d = 63;

vector<ll> basis(d);

void insertVector(ll mask) {
	for (int i = 0; i < d; i++) {
		if ((mask & (1ll << i)) == 0) continue;
		if (!basis[i]) { 
			basis[i] = mask;
			return;
		}
		mask ^= basis[i];
	}
}

bool check(ll val) {
	for (int i = 0; i < d; ++i) {
		if ((val & (1ll << i)) == 0) continue;
		if (!basis[i]) return false;
		val ^= basis[i];
	}
	return true;
}

void solve() 
{
	int t;
	cin >> t;
	while (t--) {
		for (int i = 0; i < d; ++i) {
			basis[i] = 0;
		}
		int n;
		cin >> n;
		vector<ll> a(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
		}
		string s;
		cin >> s;
		int f = 1;
		for (int i = n - 1; i >= 0; --i) {
			if (s[i] == '1') {
				if (!check(a[i])) f = 0;
			} else {
				insertVector(a[i]);
			}
		}
		cout << (f ^ 1) << endl;
	}
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

Measured memory_bytes: 3616
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        final String S[] = new String[N];
        final int T[] = new int[N];
        for (int i=0; i<N; i++) {
            S[i] = sc.next();
            T[i] =  Integer.parseInt(sc.next());
        }
        final String X = sc.next();
        sc.close();

        int total = 0;
        boolean b = false;
        for (int i=0; i<N; i++) {
            if (b)
                total += T[i];
            if (X.equals(S[i]))
                b = true;
        }

        System.out.println(total);
    }
}

Measured memory_bytes: 22228
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<cmath>
#include <bits/stdc++.h>
using namespace std;
int n,k;
int cnt=0;
void culc(int a,int b){
	if(a!=0){
		cnt++;
		culc(a/b,b);
	}
}


int main(){
    cin>>n>>k;
    culc(n,k);
    cout<<cnt<<endl;
  	return 0;
}

Measured memory_bytes: 256
s=int(input())
k=int(input())

st=str(s)
l=len(st)
i=0
a=0
n=0
m=0

while n<1:
    if int(st[m])==1:
        m+=1
        a+=1
    else:
        n=1
    if a==l:
        n=1

if a>=k:
    print(1)

else:
    while i<=l:
        if int(st[i])!=1:
            print(int(st[i]))
            i=l+1
        else:
            i+=1

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0;i < n;++i) {
        cin >> v[i];
    }
    vector<int> p(v), nx(v);
    prev_permutation(p.begin(), p.end());
    next_permutation(nx.begin(), nx.end());
    if (p < v){
        for(int i = 0;i < n;++i){
            if(i){
                cout << " ";
            }
            cout << p[i];
        }
        cout << endl;
    }
    for(int i = 0;i < n;++i){
        if(i){
            cout << " ";
        }
        cout << v[i];
    }
    cout << endl;
    if (nx > v){
        for(int i = 0;i < n;++i){
            if(i){
                cout << " ";
            }
            cout << nx[i];
        }
        cout << endl;
    }
}


Measured memory_bytes: 3168
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;


fn main() {
    input!{s:chars};
    let t:Vec<char> = "CODEFESTIVAL2016".to_string().chars().collect();
    println!("{}", s.iter().enumerate().filter(|&(i,x)| *x != t[i]).count());
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

int main(){
	int n;
	cin>>n;
	rep(i,n){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		int ans1=0,ans2=0;
		ans1=a*c+b*d;
		if(c<5) c=5;
		if(d<2) d=2;
		ans2=a*c+b*d;
		ans2=ans2*4/5;
		cout<<min(ans1,ans2)<<endl;
	}
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){
    int n,hoge,i,j,MAX=0,wa;
    int a[10000];
    while(scanf("%d",&n),n){
        //MAX = -100000
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        MAX=a[0];
        for(i=0;i<n;i++){
            wa=a[i];
            if(MAX<wa){
                MAX=wa;
            }
            for(j=i+1;j<n;j++){
                wa+=a[j];
                if(MAX<wa){
                MAX=wa;
                }
            }
        }
        printf("%d\n",MAX);
    }
    return 0;
}

Measured memory_bytes: 620
#include<stdio.h>

int main(void){
	int N[5],i,c1=0,c9=0,c7=0,c4=0;
	scanf("%d %d %d %d",&N[1],&N[2],&N[3],&N[4]);
	
	for(i=1;i<=4;i++){
		if(N[i]==1) c1++;
		if(N[i]==9) c9++;
		if(N[i]==7) c7++;
		if(N[i]==4) c4++;
	}
	
	if(c1==1&&c9==1&&c7==1&&c4==1) printf("YES");
	else printf("NO");
}
	

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    char col[n+1];
    scanf("%s",col+1);
    int l=1,r=n,cnt=0;
    while(true)
	{
        while(col[l]=='R')
			++l;
        while(col[r]=='W')
			--r;
        if(l<r)
			++cnt,++l,--r;
        else
			break;
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < s.size(); i ++) {
    if (s[i] == 'o') cnt ++;
  }
  if (cnt + (15 - (int)s.size()) >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    ll Q,H,S,D,N;
    cin >> Q >> H >> S >> D >> N;
    
    if( Q*8 <= D && Q*8 <= H*4 && Q*8 <= S*2 )
    {
        cout << N*4*Q << endl;
    }
    else if( H*4 <= D && H*4 <= S*2 && H*4 <= Q*8 )
    {
        cout << N*2*H << endl;
    }
    else if( S*2 <= D )
    {
        cout << N*S << endl;
    }
    else
    {
        if( N%2 == 0 ) cout << N*D/2 << endl;
        else
        {
            if( Q*8 <= H*4 && Q*8 <= S*2 ) cout << (N-1)*D/2 + Q*4 << endl;
            else if( H*4 <= S*2 ) cout << (N-1)*D/2 + H*2 << endl;
            else cout << (N-1)*D/2 + S << endl;
        }
    }
}


Measured memory_bytes: 256
import math
N = int(input())

if N < 357:
    print(0)
else:
    dig = int(math.log10(N)) + 1
    number = [[0] * dig for i in range(3**dig)]
    num = ['3','5','7']
    ans = 0

    for i in range(dig):
        for j in range(3**dig):
            number[j][-i-1] = num[int((j/(3**i))%3)]
    
    i = 0
    while i < len(number):
        if '3' not in number[i] or '5' not in number[i] or '7' not in number[i]: 
            number.pop(i)
        else:
            number[i] = int(''.join(number[i]))
            if N < number[i]:
                break
            i += 1

    for j in range(3,dig):
        ans += 3**j - 3 * (2**j) + 3
    print(ans+i)
    


Measured memory_bytes: 5876
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

int main()
{
    ll D, T, S;

    cin >> D >> T >> S;

    if( D <= S*T)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " "; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

inline int waste(int a, int b, int m) { return (((a % m) + (b % m)) % m); }
inline int worse(int a, int b, int m) { return (((a % m) * (b % m)) % m); }
inline int worst(int a, int b, int m) { return (((a % m) - (b % m) + m) % m);}

using namespace std;

int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif

   char a;
   cin >> a;
   if(a>='A' && a<='Z'){
    cout << "A";
   }
   else{
    cout << "a";
   }
   
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void)
{
    int x, n, y;
    cin >> x >> n;
 
    set<int> p;
    for (int i = 0; i < n; ++i)
    {
        cin >> y;
        p.insert(y);
    }
 
    for (int i = 0; i < x + 1; ++i)
    {
        for (auto dir : {-1, +1})
        {
            y = x + dir * i;
            if (p.find(y) == p.end())
            {
                cout << y << endl;
                return 0;
            }
        }
    }
 
    return 0;
}

Measured memory_bytes: 3624
<?php
$nl=(int)trim(fgets(STDIN));

$node=array($nl);

for($i=0;$i<$nl;$i++){
	$node[$i]=array('ch'=>array(),'pa'=>-1);
}

for($i=0;$i<$nl;$i++){
	$ls=explode(' ',trim(fgets(STDIN)));#lines

	$id=(int)array_shift($ls);
	$cl=(int)array_shift($ls);

	if($cl==0){continue;}

	$node[$id]['ch']=$ls;#child

	for($j=0;$j<$cl;$j++){$node[$ls[$j]]['pa']=$id;}#parent
}

for($i=0;$i<$nl;$i++){
	$ni=$node[$i];

	$de=0;#depth
	for($j=$ni['pa'];$j!=-1;$j=$node[$j]['pa']){++$de;}

	$ty=($ni['pa']==-1)? 'root':(count($ni['ch'])? 'internal node':'leaf');#type

	printf("node %d: parent = %d, depth = %d, %s, [%s]\n"
		,$i
		,$ni['pa']
		,$de
		,$ty
		,implode(', ',$ni['ch'])
	);
}

Measured memory_bytes: 100988
#include <iostream>

using namespace std;

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


	if (0 >= (B - A)) {
		cout << "delicious" << endl;
	}
	else if (X >= (B - A)) {
		cout << "safe" << endl;
	}
	else if ((B - A) > X) {
		cout << "dangerous" << endl;
	}
   

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define push_back pb

const int mod = 1000000007;
const int inf = 1e9;

int main(){
    string s;
    cin >> s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7'){cout << "Yes";}else{cout << "No";}
}

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

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

    int a, b;
    cin >> a >> b;

    int ans = a % b == 0 ? a / b : a / b + 1;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		int min = Integer.MAX_VALUE;
		int[] h = new int[N];
		for(int i = 0; i < N; i++) h[i] = sc.nextInt();
		Arrays.sort(h);
		for(int i = 0; i < N-K+1; i++){
			//System.out.println(i + " " + (i + K - 1));
			min = Math.min(min, h[i+K-1]-h[i]);
		}
		System.out.println(min);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23464
# -*- coding: utf-8 -*-
import collections

N = int(input())
string_list = [input() for i in range(N)]
L = []

for i in range(N):
  L.append("".join(sorted(string_list[i])))
  
count = collections.Counter(L)
answer = 0  

for key in count:
  if count[key] > 1:
    var_a = range(1, int(count[key]))
    var_b = sum(var_a)
    answer += var_b

print(answer)

Measured memory_bytes: 26864
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int a, p;
	std::cin >> a >> p;
	
	std::cout << (a*3 + p) / 2 << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <numeric>
using namespace std;
 
//グラフを隣接行列で管理する
bool G[10][10];
 
int main(){
    int n,m; cin >> n >> m;
    for(int i=0; i<m; i++){
        int a,b; cin >> a >> b; a--; b--;
        G[a][b] = G[b][a] = true;
    }
 
    //順列
    vector<int> ord(n);
    for(int i=0; i<n; i++) ord[i] = i;
    //n=5ならord={0,1,2,3,4} 
 
    //順列を全部試す
    //next_permutation
    int ans = 0;
    do{
        //スタート地点が0ではない場合break
        if(ord[0] != 0) break;
 
        //全列挙した並び順に道があるか確認
        bool ok = true;
        //最後の要素は確認しなくていいから、i<n-1
        for(int i=0; i<n-1; i++){
            int from = ord[i];
            int to = ord[i+1];
            if(!G[from][to]) ok = false;
        }
        if(ok) ans++;
    }while(next_permutation(ord.begin(),ord.end()));
        
    cout << ans << endl;
}

Measured memory_bytes: 3588
import sys
import collections

def input():
    return sys.stdin.readline().strip()

def LIST():
    return list(map(int, input().split()))

N,K,Q=LIST()
A = [int(input())-1 for _ in range(Q)]

arr = [K] * N

c = collections.Counter(A)
for i in range(N):
    if i in c.keys():
        arr[i] -= Q - c[i]
    else:
        arr[i] -= Q

for val in arr:
    if 0 < val:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 15052
import java.util.*;

public class Main {
    public static int N;
    public static int M;
    public static List<Integer> k;
    public static List<List<Integer>> s;
    public static List<Integer> p;
    public static void main (String args[]){
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        M = scanner.nextInt();
        k = new ArrayList();
        s = new ArrayList();
        p = new ArrayList();
        for(int i=0; i<M; i++){
            int ki = scanner.nextInt();
            k.add(ki);
            List<Integer> si = new ArrayList();
            for(int j=0; j<ki; j++){
                si.add(scanner.nextInt());
            }
            s.add(si);
        }
        for(int i=0; i<M; i++){
            p.add(scanner.nextInt());
        }
        int numOK = 0;
        List<Integer> switches = new ArrayList();
        Queue<List<Integer>> queue = new ArrayDeque();
        List<Integer> states = new ArrayList(Arrays.asList(0,1));
        queue.add(switches);
        while( queue.size()>0 ){
            List<Integer> now = queue.poll();

            if(now.size() == N){
                int numOnBulb = 0;
                for(int i=0; i<M; i++){
                    int numOnSwitch = 0;
                    for(Integer sij:s.get(i)){
                        numOnSwitch = numOnSwitch + now.get(sij-1);
                    }
                    if(numOnSwitch%2 == p.get(i)){
                        numOnBulb++;
                    }
                }
                if(numOnBulb==M){
                    numOK++;
                }
            }
            else{
                for(Integer nextState:states){
                    List<Integer> next = new ArrayList(now);
                    next.add(nextState);
                    if(isOK(next)){
                        queue.offer(next);
                    }
                }
            }
        }
        System.out.println(numOK);
    }

    public static boolean isOK(List<Integer> next){
        // for(int i=0; i<M; i++){
        //     int maxS = Math.max(s.get(i));
        //     if(maxS <= next.size()){
        //         int sum = 0;
        //         for(int state:next){
        //             sum = sum + state;
        //         }
        //         if()
        //         return false;
        //     }
        // }
        return true;
    }
}

Measured memory_bytes: 23508