akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

int solve(vector<vector<int>>& dp, vector<int>& divisor, int idx, int pat) {
    if (static_cast<int>(dp.size()) <= idx || static_cast<int>(dp[0].size()) <= pat) {
        return (static_cast<int>(dp[0].size()) == pat ? 1 : 0);
    } else if (dp[idx][pat] > 0) {
        return dp[idx][pat];
    }

    dp[idx][pat] = 0;
    for (int i = 0; i <= divisor[idx]; i++) {
        dp[idx][pat] += solve(dp, divisor, idx + 1, pat * (i + 1));
    }

    return dp[idx][pat];
}

int main() {
    vector<int> pr_n(0), pr_n_dp(101, 1);
    for (int i = 2; i < static_cast<int>(pr_n_dp.size()); i++) {
        if (pr_n_dp[i] == 1) {
            pr_n.push_back(i);
            for (int j = 2 * i; j < static_cast<int>(pr_n_dp.size()); j += i) {
                pr_n_dp[j] = 0;
            }
        }
    }

    int n;
    cin >> n;

    vector<int> divisor(pr_n.size(), 0);
    for (int i = 1; i <= n; i++) {
        for (int j = 0, nn = i; j < static_cast<int>(pr_n.size()); j++) {
            while (nn % pr_n[j] == 0) {
                divisor[j]++;
                nn /= pr_n[j];
            }
        }
    }

    vector<vector<int>> dp(pr_n.size(), vector<int>(75, -1));
    cout << solve(dp, divisor, 0, 1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int add(int a, int b){return  a + b > mod ? a + b - mod : a + b;}
int mul(int a, int b){return a * b > mod ? a * b % mod : a * b;}
vi G[N];
int dp[N];
int f(int u){
    int &ans = dp[u];
    if(ans == -1){
        ans = 1;
        for(int i = 0; i < sz(G[u]); i++){
            int v = G[u][i];
            ans = max(ans, f(v) + 1);
        }
    }
    return ans;
}
int main(){
    //FL;
    FIN;
    int n, m;
    cin >> n >> m;
    w(m){
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        G[u].pb(v);
    }
    cls(dp, -1);
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans = max(ans, f(i));
    cout << ans - 1 << '\n';
    EjecuteTime;
    return 0;
}       


Measured memory_bytes: 11588
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int X,happy=0;
    cin>>X;
    
        if(X>=500)
        {
            happy+=1000*(X/500);
            X=X-500*(X/500);
        }
        if(X>=5)
        {
            
            happy+=5*(X/5);
            X=X-5*(X/5);
        }
              
         cout<<happy;    

	return 0;
}




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

int main() {
    int n, q;
    while (cin >> n >> q, n || q) {
        vector<int> v(111);
        while (n--) {
            int m;
            cin >> m;
            while (m--) {
                int d;
                cin >> d;
                v[d]++;
            }
        }

        int ans, m = 0;
        for (int i = 110; i >= 0; i--) {
            if (m <= v[i]) m = v[i], ans = i;
        }

        if (m < q) cout << 0 << endl;
        else cout << ans << endl;
    }

    return 0;
}



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

using namespace std;

int main(void){

    int n, m;
    cin >> n;
    map<string, int> maps;

    vector<string> s(n);
    for(int i=0; i<n; i++) {
        cin >> s[i];
        auto itr = maps.find(s[i]);
        if(itr == maps.end()) {
            maps.insert(make_pair(s[i], 1));
        }
        else {
//            cout << (*itr).first << endl;
            maps[(*itr).first]++;
        }
    }
    
    cin >> m;
    vector<string> t(m);
    for(int i=0; i<m; i++) {
        cin >> t[i];
        auto itr = maps.find(t[i]);
        if(itr == maps.end()) {
            maps.insert(make_pair(t[i], -1));
        }
        else {
//            cout << (*itr).first << endl;
            maps[(*itr).first]--;
        }
    }
    
    int max = 0;
    for(auto itr = maps.begin(); itr != maps.end(); itr++) {
        if((*itr).second > max) max = (*itr).second;
    }
    
    cout << max << endl;

    return 0;
    
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    cout << s.at(0) << s.size() - 2 << s.at(s.size() - 1) << endl;
}

Measured memory_bytes: 3608
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N,A,B;
  string S;
  cin >> N >> A >> B >> S;

  int sum=0,sum_B=0;
  string ans;
  for(int i=0;i<N;i++){
    if(S.at(i)=='c') ans="No";
    else if(S.at(i)=='a'){
      if(sum<A+B){
	++sum;
	ans="Yes";
      }
      else ans="No";
    }
    else if(S.at(i)=='b'){
      if(sum<A+B && sum_B<B){
	++sum;
	ans="Yes";
      }
      else ans="No";
      ++sum_B;
    }
    cout << ans << endl;
  }
  

  return 0;
}


Measured memory_bytes: 896
def cd(a,b):
  p = min(a,b)
  q = max(a,b)
  lst = []
  for i in range(1, p + 1):
    if (p % i == 0 and q % i == 0):
      lst.append(i)
  return lst
 
A,B,K = map(int, input().split())
lst = cd(A,B)
print(lst[-K])


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main ()
{
    int N ;
    int F [100][14];
    int P [100][15];
    cin >> N;
    for ( int i =0; i < N ; i ++){        
        for ( int j =0; j <10; j ++)
         scanf ("%d" ,&F[ i ][ j ]);
    }
    for ( int i =0; i < N ; i ++){
        for ( int j =0; j <11; j ++) 
        scanf ("%d" ,&P[ i ][ j ]);
    }

    int res = -(1 <<30);

    for ( int b =1; b <(1 <<10); b ++){
        int cc =0;
            for( int i =0; i < N ; i ++){
                int c =0;
                    for ( int j =0; j <10; j ++) 
                    if (( b >> j &1)&& F [ i ][ j ]) 
                        c++;
                    cc += P [ i ][ c ];
            }
            if ( res < cc ) res = cc ;
    }
    cout << res;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int grid[8][8];
int main(){
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin >> grid[i][j];
		}
	}
	for(int i=1;i<=2;i++){
		int ii=grid[i+1][1]-grid[i][1];
		int jj=grid[1][i+1]-grid[1][i];
		for(int j=2;j<=3;j++){
			if(grid[i+1][j]-grid[i][j]!=ii||grid[j][i+1]-grid[j][i]!=jj){
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
	return 0;
}

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

#define MAX 400005
const long long mod = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

void Com_init(){ //##O(MAX)##
    fac[0] = fac[1] = 1; // x!
    finv[0] = finv[1] = 1; // (x!)^-1
    inv[1] = 1; //x^-1
    for(int i=2;i<MAX;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;
    }
}
long long Combination(int n, int k){ //calc nCk, ##O(1)##
    if(n<k || (n<0||k<0))return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}


int main(){
    Com_init();
    ll n,k;
    cin>>n>>k;
    if(n<=k){
        cout<<Combination(2*n-1, n-1)%mod<<endl;
        return 0;
    }
    else{
        ll sum=1;
        for(ll i=1; i<=k;i++){
            //cout<<Combination(n, i) <<" "<<Combination(n-1, i)<<endl;
            sum += Combination(n, i)*Combination(n-1, i)%mod;
            sum%=mod;
        }
        cout<<sum<<endl;
    }
}

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

int main() {

    int N, M;
    cin >> N >> M;

    int cnt = 0;
    
    rep(i, M) {
        int a;
        cin >> a;
        cnt += a;
    }

    if (N >= cnt) cout << N - cnt << endl;
    else cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 3624
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] S = scanner.next().toCharArray();

			Map<Character, Integer> map = new HashMap<>();

			for (char c : S) {
				map.put(c, map.getOrDefault(c, 0) + 1);
			}

			String ans = "No";
			if (map.size() == 2) {

				if (map.get(S[0]) == 2) {
					ans = "Yes";
				}

			}

			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 25300
import sys
lines = sys.stdin.read().splitlines()
description = lines[0].split()
summer_holiday_total = int(description[0])
time_required_for_hw = lines[1].split()
total = 0
for v in time_required_for_hw:
    total += int(v)

if summer_holiday_total - total < 0:
    print("-1")
else:
    print(summer_holiday_total - total)


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

// TYPEDEFS
typedef long long int li;
typedef unsigned long long int uli;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<li, li> ll;
typedef pair<int, char> ic;
typedef pair<char, int> ci;
typedef pair<li, char> lc;
typedef pair<char, li> cl;
typedef vector<ic> vic;
typedef vector<ci> vci;
typedef vector<lc> vlc;
typedef vector<cl> vcl;
typedef map<int, int> mii;
typedef map<li, li> mll;
typedef map<char, int> mci;
typedef map<int, char> mic;
typedef map<li, char> mlc;
typedef map<char, li> mcl;
typedef map<char, bool> mcb;
typedef map<int, bool> mib;
typedef map<li, bool> mlb;
typedef set<int> si;
typedef set<li> sl;
typedef set<char> sc;
typedef priority_queue<int> pqi;
typedef priority_queue<li> pql;

// DEFINITIONS
#define fi(i, a, b, jump) \
    for (int i = int(a); i <= int(b); i += jump)
#define fir(i, a, b, jump) \
    for (int i = int(b); i >= int(a); i -= jump)
#define fl(i, a, b, jump) \
    for (li i = li(a); i <= li(b); i += jump)
#define flr(i, a, b, jump) \
    for (li = li(b); i >= li(a); i -= jump)
#define fv(v) \
    for (int i = 0; i < v.size(); ++i)
#define fvr(v) \
    for (int i = v.size()-1; i >= 0; --i)
#define fm(mp) \
    for (it = mp.begin(); it != mp.end(); ++it)
#define mem(arr, val) \
    memset(arr, val, sizeof(arr))

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    int arr[n][n];
    memset(arr, 0, sizeof(arr));
    int maxi = -1;
    fi(i,0,n-2,1){
        fi(j,i+1, n-1, 1){
            if(s[i] == s[j]){
                arr[i][j] = 1;
            }
            if(i > 0){
                if(s[i-1] == s[j-1]){
                    arr[i][j] += arr[i-1][j-1];
                }
                if(j-arr[i][j] + 1 == i) --arr[i][j];
            }
            if(arr[i][j] > maxi) maxi = arr[i][j];
        }
    }
    cout << maxi;
}

Measured memory_bytes: 97920
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

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

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

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

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

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

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, _ := getInt(), getInt(), getInt()
	k := getInt()

	if k%2 == 1 {
		a, b = b, a
	}

	if abs(a-b) > 1e18 {
		out("Unfair")
		return
	}
	out(a - b)
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k;
    cin>>n;
    vector<int>a(n+1,0);
    
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=n;j+=i)
        {
            a[j]++;
        }
    }
    for(i=1;i<=n;i++)
    {
        p+=(i*a[i]);
    }
    cout<<p;
    return 0;
}

Measured memory_bytes: 81308
#include <bits/stdc++.h>
#define rep(i,j,k) for(register int i=j;i<=k;i++) 
#define dow(i,j,k) for(register int i=j;i>=k;i--) 
#define bug //printf("%d\n",__LINE__);
using namespace std;
vector<int>hl[200005];
int hr[200006];
int vis[200005];
priority_queue<int,vector<int>, greater<int> >q;
int n,m;
int ans;
int main(){
	scanf("%d%d",&n,&m) ;
	rep(i,1,n) {
		bug
		int l,r;
		scanf("%d%d",&l,&r);hl[l].push_back(r);
	}
	int L=0;
	bug
	rep(i,1,m) {
		bug
	//	cout<<"i "<<i<<" "<<hl[i].size()<<endl;
		rep(j,0,(int)hl[i].size()-1) {
	//	cout<<"j "<<j<<" "<<hl[i].size()-1<<endl;
	//	cout<<hl[i][j]<<" "<<L<<endl;
			//:w
		// :!g++ % -o %< -g -Wall
		// cout<<hl[i][j]<<endl;
		bug
			if(L<i) L++,q.push(hl[i][j]);bug
			else {
				bug
				if(!q.empty()&&hl[i][j]>q.top()) {
					hr[q.top()]++;
					bug
					q.pop(),q.push(hl[i][j]);
				}
				else hr[hl[i][j]]++;
			}
		}
	//	L++;
	//	cout<<i<<ans<<endl;
	}
//	cout<<"finish"<<endl;
//	cout<<L<<endl;
	bug
	int R=m+1;
	rep(i,0,(int)hl[0].size()-1) hr[hl[0][i]]++;
	ans=hr[m+1];
	//cout<<hr[m+1]<<endl;
	dow(i,m,1){
	//	cout<<i<<" "<<hr[i]<<endl;
		bug
   		while(hr[i]) {if(i<R&&L<R-1) hr[i]--,R--;else hr[i]--,ans++;}
	//	cout<<i<<" "<<hr[i]<<" "<<ans<<endl;
	//	L++;
	}
	cout<<ans<<endl;
	return 0;
}	




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

int main(){
    int n, x;
    cin >> n >> x;
    if(x == 1 || x == 2*n-1){
        cout << "No" << endl;
        return 0;
    }
    vector<bool> used(2*n,false);
    vector<int> ans(2*n,-1);
    ans[n] = x; ans[n+1] = x-1; ans[n-1] = x+1;
    used[x] = true; used[x-1] = true; used[x+1] = true;
    if(x+2 <= n) {
        ans[n+2] = x+2; used[x+2] = true;
    }
    if(x-2 >= 1) {
        ans[n-2] = x-2; used[x-2] = true;
    }
    int c = 1;
    for(int i = 1; i <= 2*n-1; i++){
        if(ans[i] == -1){
            while(used[c]){c++;}
            ans[i] = c;
            c++;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i <= 2*n-1; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 2304
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


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


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return

# B


def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return

# C


def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return

# D


def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    # go = g
    # myset = set([1])
    sq = int(sqrt(g)) + 2
    ans = 1

    for i in range(2, sq):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g /= i

            # myset.add(i)
        if g == 1:
            break
        if i == sq - 1:
            # myset.add(go)
            ans += 1

    print(ans)

    return

# E


def E():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

# F


def F():
    return


# Solve
if __name__ == '__main__':
    E()


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

using ll = long long;
#define ff first
#define ss second

void solve()
{
	int v[3];
	for (int i = 0; i < 3; i++)
		cin>>v[i];
	sort(v, v + 3);
	cout<<v[0] + v[1]<<endl;
}

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


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;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, f[100][10], p[100][11];
 
int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) REP(j, 10) cin >> f[i][j];
	REP(i, n) REP(j, 11) cin >> p[i][j];
	ll res = -10000000000;
	FOR(i, 1, 1024) {
		ll s = 0;
		REP(j, n) {
			ll c = 0;
			REP(k, 10) if ((i & (1 << k)) != 0 && f[j][k]) ++c;
			s += p[j][c];
		}
		res = max(res, s);
	}
	cout << res << endl;
	return 0;
}
 

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

int main() {
	int height;
	int width;
	cin >> height >> width;


	
	//first
	for (int i; i < width + 2; i++) {
		cout << "#";
	}
	cout << endl;


	
	for (int i; i < height; i++) {
		cout << "#";

		//vector<int> vec(width);
		//for (int j; j < width; j++) {
		//	cin >> vec.at(j);
		//	cout << vec.at(j);
		//}
		string str;
		cin >> str;

		cout << str;

		cout << "#";
		cout << endl;
	}

	//final
	for (int i; i < width + 2; i++) {
		cout << "#";
	}
	cout << endl;
}

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

int main()
{
    int n;
    cin >> n;
    
    if(n<30)
    {
        cout << "No" << endl;
    }
    else if(n>=30)
    {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main() {
    int all_day_num = 196471;
    int no_bid_days_in_year = 20 * 10;
    int normal_day_in_year = 20 * 5 + 19 * 5;

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int Y, M, D;
        cin >> Y >> M >> D;
        int days = 0;
        int y = Y - 1;
        int big_y = y / 3;
        int small_y =  y - big_y;
        days += normal_day_in_year * small_y + no_bid_days_in_year * big_y;
        int m = M - 1;
        if (Y % 3 == 0) {
            days += 20 * m;
        } else {
            int small_m = m / 2;
            int big_m = m - small_m;
            days += 20 * big_m + 19 * small_m;
        }
        days += D;
        cout << (all_day_num - days) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
typedef pair<int, int> P;
const int MAX_N = 10000;
const int MAX_L = 100000000;
const int MAX_SQRT_B = 10000;
const int INF = 1000000000;
typedef int64_t ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
	vector<int> a(3);
	cin >> a.at(0) >> a.at(1) >> a.at(2);
	sort(a.begin(), a.end());
	int sum = a.at(0) + a.at(1) + a.at(2);
	if (sum % 2 != a.at(2)%2) {
		a.at(2)++;
	}

	cout << (3 * a.at(2) - sum) / 2 << endl;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;
ll dp[100100];

int main(int argc, char const *argv[]) {
    ll x;
    cin >> x;
    ll gohyaku = x/500;
    ll go = (ll)(x-gohyaku*500)/5;
    cout << gohyaku*1000 + go*5 << endl;
}

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

ans = 0
for i in range(1000):
    pin = str(i).zfill(3)
    p = s.find(pin[0])
    if p == -1 or p >= n - 1:
        continue
    q = s.find(pin[1], p+1)
    if q == -1 or q == n - 1:
        continue
    r = s.find(pin[2], q+1)
    if r == -1:
        continue
    ans += 1

print(ans)


Measured memory_bytes: 38384
n=int(input())
A=list(map(int,input().split()))
D = dict()
for i in range(n):
  if A[i] not in D:
    D[A[i]] = 1
  else:
    D[A[i]] += 1
ans = 0
for i in D:
  if D[i]>=i:
    ans += D[i]-i
  else:
    ans += D[i]
print(ans)

Measured memory_bytes: 90876
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int X,sum,i;
    while(scanf("%d",&X)!=EOF)
    {
        sum=0;
        for (i=1;;i++)
        {
            sum=sum+i;
            if (sum>=X)
                break;
        }
        printf("%d\n",i);
    }
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ori = []
for i in range(n):
    a, b = map(int, input().split())
    ori.append((a, b))
ori.sort()
ans = 0
amount = m
for a, b in ori:
    if b <= amount:
        ans += a*b
        amount -= b
    else:
        ans += a*amount
        break
print(ans)

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

using namespace std;

int main() {
  string N; cin >> N;
  
  int sum = 0;
  for (int i = 0; i < N.length(); i++) {
    int tmp = N[i] - 48;
    sum += tmp;
  }
  
  if (sum % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3700
//H
#include<cstdio>
#include<iostream>
using namespace std;
long long f[110][55][55];
long long a[55];
int main()
{
	int min=-1000000010;
	long long res=min;
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	
	for(int i=0;i<=k;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<=n;k++)
				f[i][j][k]=min;
	
	f[0][1][n]=0;
	for(int i=1;i<=k;i++)//区间[l,r]含l与r 
	{
		for(int l=1;l<=n;l++)
		{
			for(int r=n;r>=l-1;r--)
			{
				if(i>=2&&l-1>=1&&f[i-2][l-1][r]>f[i][l][r])
					f[i][l][r]=f[i-2][l-1][r];
					
				if(i>=2&&r+1<=n&&f[i-2][l][r+1]>f[i][l][r])
					f[i][l][r]=f[i-2][l][r+1];
					
				if(f[i-1][l-1][r]!=min&&l-1>=1&&f[i-1][l-1][r]+a[l-1]>f[i][l][r])
					f[i][l][r]=f[i-1][l-1][r]+a[l-1];
					
				if(f[i-1][l][r+1]!=min&&r+1<=n&&f[i-1][l][r+1]+a[r+1]>f[i][l][r])
					f[i][l][r]=f[i-1][l][r+1]+a[r+1];
				//f[i-1][l][r+1]!=min 保证不是直接到达此区间，而是从大区间合法到小区间 
				res=max(res,f[i][l][r]);
			}
		}
	}
	if(res>=0)
		cout<<res<<endl;
	else
		cout<<0<<endl;
}

Measured memory_bytes: 2688
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define inf 0x3f3f3f3f

struct node{
    ll fi;
    ll x;
    ll y;
    ll d;
};

node a[55];


int main()
{

    ll n,m;
    ll t,k;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i].x>>a[i].y;
        a[i].d=inf;
    }
    for(int i=0;i<m;i++){
        cin>>t>>k;
        for(int j=0;j<n;j++){
            if(abs(a[j].x-t)+abs(a[j].y-k)<a[j].d){
                a[j].d=abs(a[j].x-t)+abs(a[j].y-k);
                a[j].fi=i;
            }
        }
    }

    for(int i=0;i<n;i++){
        cout<<a[i].fi+1<<endl;
    }



return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int N;
	bool flag = false;
	ll pir = 1;
	vector<ll>list;

	cin >> N;
	
	rep(i, 0, N) {
		ll num;
		cin >> num;
		list.pb(num);
		if (num == 0)flag = true;
	}

	if (flag == true) {
		cout << 0 << endl;
		return 0;
	}

	rep(i, 0, N) {
		ll num = list[i];

		if (num <= INF / pir) {
			pir *= num;
		}
		else {
			cout << -1 << endl;
			return 0;
		}

	}

	cout << pir << endl;


	return 0;
}

Measured memory_bytes: 4328
import scala.io.StdIn.readLine

object Main extends App {
  val Array(n, m) = readLine().split(' ').map(_.toInt)
  val favorites: List[Set[Int]] = (1 to n).map { i =>
    readLine().split(' ').map(_.toInt).toSeq.tail.toSet
  }.toList
  val result = favorites match {
    case (head: Set[Int]) :: tail =>
      tail.foldLeft(head) { case (product, set) =>
        product & set
      }
    case Nil => Nil
  }
  println(result.size)
}

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  int n, ans = 0;
  cin >> n;
  vector<ll> a;
	map<ll, ll> m;
  REP(i, n){
    ll b;
    cin >> b;
    a.pb(b);
		m[b]++;
  }
  sort(ALL(a));
	REP(i, n){
		ll x = a[n-1-i];
		ll y = 1LL<<33;
		while(x*2<y) y >>= 1;
		if(y-x == x){
			if(m[x]>=2){
				ans++;
				m[x] -= 2;
			}
		}
		else if(m[y-x] != 0 && m[x]!=0){
			ans++;
			m[x]--;
			m[y-x]--;
		}
	}
  cout << ans << endl;
}


Measured memory_bytes: 27372
#include<stdio.h>

int main(void){
    long n;
    scanf("%ld", &n);
    long a[n+1], b[n+1], sum=0, amari=0;
    for(int i=0; i<n+1; i++) scanf("%ld", &a[i]);
    for(int i=0; i<n; i++) scanf("%ld", &b[i]);
    b[n] = 0;

    for(int i=0; i<n+1; i++){
        if(amari >= a[i]){
            sum += a[i];
            amari = b[i];
        }else {
            if(b[i] >= (a[i] - amari)){
                sum += a[i];
                amari = b[i] - (a[i] - amari);
            }else {
                sum += b[i] + amari;
                amari = 0;
            }
        }
    }
    printf("%ld\n", sum);

    return 0;
}


Measured memory_bytes: 1664
from collections import deque
n,m=map(int,input().split())
e=[[] for _ in range(n+1)]
d=[-1]*(n+1)
for i in range(m):
  a,b=map(int,input().split())
  e[a]+=[b]
  e[b]+=[a]
q=deque([(1,0)])
d[1]=0
a,b=0,0
while q:
  now,par=q.popleft()
  for to in e[now]:
    if to==par:continue
    if d[to]==-1:
      d[to]=(d[now]+1)%2
      a+=1
      q.append((to,now))
    elif d[to]!=d[now]%2:b+=1
    else:
      print(n*(n-1)//2-m)
      exit()
p=sum(d)+1
print(p*(n-p)-a-b//2)

Measured memory_bytes: 89084
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
set<string>s;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        string t;
        cin>>t;
        s.insert(t);
    }
    cout<<s.size()<<endl;
    return 0;
}

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

public class Main {

    long MOD = (long)1e9 + 7;

    // (0, 0), (1, 0), (0, 1)
    // (0, 0), (1, 0), (0, 1)
    // (0, 0)
    //

    // 110110

    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n  = s.length();

        long[] dp1 = new long[n];
        long[] dp2 = new long[n];

        dp1[0] = 1;
        dp2[0] = 2;
        for (int i = 1; i < n; i++) {
            if (s.charAt(i) == '1') {
                dp1[i] = (3 * dp1[i - 1] + dp2[i - 1]) % MOD;
                dp2[i] = 2 * dp2[i - 1] % MOD;
            } else {
                dp1[i] = 3 * dp1[i - 1] % MOD;
                dp2[i] = dp2[i - 1];
            }
        }

        System.out.println((dp1[n - 1] + dp2[n - 1]) % MOD);
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 26128
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int A,B,K;
	cin>>A>>B>>K;
	int i=A,k=B-K+1,count=0;
	while(i<=B&&count++<K){
		ce(i++)
	}
	count=0;
	while(k<=B&&count<K){
		if(k>=i){
                     ce(k)
count++;
                  }
k++;
	}
}

Measured memory_bytes: 256
(defmacro while (test &body body)
  `(do ()
       ((not ,test))
     ,@body))

(defun find-sum-of-digits (n)
  (let ((sum 0))
    (while (> n 0)
      (setf sum (+ sum (rem n 10)))
      (setf n (floor n 10)))
    sum))

(defun some-sums (n a b)
  (let ((total 0)
        (sum 0))
    (dotimes (i (+ n 1))
      (setf sum (find-sum-of-digits i))
      (if (and (>= sum a) (<= sum b))
          (setf total (+ total i))))
    total))

(format t "~A~%" (some-sums (read) (read) (read)))

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

const int N = 1E6 + 50;

int n, rt = -1, f[N], d[N];
vector<int> g[N];

void dfs(int u, int fa) {
    int cnt = 0;
    for(auto v : g[u]) {
        if(v == fa) continue;
        dfs(v, u);
        f[u] += f[v], cnt += !f[v];
    }
    if(cnt) f[u] += cnt - 1;
}
int main() {
    scanf("%d", &n);
    if(n == 1) return 0 * printf("0\n");
    for(int i = 1, u, v; i < n; i++) {
        scanf("%d%d", &u, &v);
        ++ d[u], ++ d[v];
        g[u].push_back(v), g[v].push_back(u);
        if(d[u] > 2) rt = u;
        if(d[v] > 2) rt = v;
    }
    if(rt < 0) return 0 * printf("1\n");
    dfs(rt, rt);
    printf("%d\n", f[rt]);
    return 0;
}

Measured memory_bytes: 33536
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

ll mul(ll x, ll y) {
    if (1.0*x*y >= 1e15)return (ll)1e12;
    return x*y;
}

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

    ll N, A;
    cin >> N >> A;
    ll ng = 0, ok = N;
    while (ok - ng > 1) {
        ll T = (ok + ng) / 2;
        bool x = false;
        for (int i = 0; i <= 40; ++i) {
            if (T <= A*i)continue;

            ll y = (T - A*i) / (i + 1);
            ll r = (T - A*i) % (i + 1);
            ll z = 1;
            rep(j, r)z = mul(z, y + 1);
            rep(j, (i + 1) - r) z = mul(z, y);
            if (z >= N) {
                x = true;
                break;
            }
        }
        (x ? ok : ng) = T;
    }
    cout << ok << endl;
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


int main(){
  string s, t;
  cin >> s;
  cin >> t;
  const int len=(int)s.size();
  int count = 0;
  rep(i,len){
    if (s[i] != t[i]) {
      count++;
    }
  }

  cout << (count) << endl;
  return 0;
}


Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
	int q=0;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
	return q;
}
typedef long long LL;
const int N=132000;
int n;
int s[N][2];LL v[N][2];
typedef pair<LL,LL> PR;
vector<PR> q[N];
bool cmpx(PR a,PR b) {return a.first<b.first;}
bool cmpy(PR a,PR b) {return a.second<b.second;}

void dfs(int x,int lim) {
	if(!s[x][0]) {q[x].push_back((PR){0,0});return;}
	dfs(s[x][0],lim),dfs(s[x][1],lim);
	int s0=s[x][0],s1=s[x][1],v0=v[x][0],v1=v[x][1];
	int sz0=q[s0].size(),sz1=q[s1].size();
	if(sz0>sz1) swap(s0,s1),swap(v0,v1),swap(sz0,sz1);
	LL mi=1e9;
	sort(q[s0].begin(),q[s0].end(),cmpy);
	sort(q[s1].begin(),q[s1].end(),cmpx);
	for(RI i=sz0-1,j=0;i>=0;--i) {
		while(j<sz1&&q[s1][j].first+q[s0][i].second+v1+v0<=lim)
			mi=min(mi,q[s1][j].second),++j;
		if(j) q[x].push_back((PR){q[s0][i].first+v0,mi+v1});
	}
	sort(q[s0].begin(),q[s0].end(),cmpx);
	sort(q[s1].begin(),q[s1].end(),cmpy);
	mi=1e9;
	for(RI i=sz0-1,j=0;i>=0;--i) {
		while(j<sz1&&q[s1][j].second+q[s0][i].first+v1+v0<=lim)
			mi=min(mi,q[s1][j].first),++j;
		if(j) q[x].push_back((PR){mi+v1,q[s0][i].second+v0});
	}
	q[s0].clear(),q[s1].clear();
}
int main()
{
	int x,y;
	n=read();
	for(RI i=2;i<=n;++i) {
		x=read(),y=read();
		if(s[x][0]) s[x][1]=i,v[x][1]=y;
		else s[x][0]=i,v[x][0]=y;
	}
	LL l=0,r=1e9,res=1e9;
	while(l<=r) {
		LL mid=(l+r)>>1;q[1].clear(),dfs(1,mid);
		if(q[1].empty()) l=mid+1;
		else res=mid,r=mid-1;
	}
	printf("%lld\n",res);
	return 0;
}

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

int main() {
    string s;
    int x = 0;
    
    cin >> s;
    x = s.length();
    
    rep(i, x){
        cout << "x";
    }
    
    return 0;
}




Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a,b,c,d,e,k;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
    if(e-a<=k) printf("Yay!\n");
    else printf(":(\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

//__builtin_popcount ();

int main() {

int n,k;
cin>>n>>k;
if(n*500>=k)
	cout<<"Yes"<<endl;
else
	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

struct mint {
  ll x;
  mint(ll x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  //
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  if (a[0] > 0) {
    cout << 0 << endl;
    return 0;
  }

  vl cnt(3, 0);
  mint ans(1);
  rep(i, n) {
    ll c = a[i];
    mint coef(0);
    ll mink = -1;
    rep(k, 3) {
      if (cnt[k] == c) {
        mink = k;
        coef += 1;
      }
    }
    if (mink == -1) {
      cout << 0 << endl;
      return 0;
    }
    cnt[mink]++;
    ans *= coef;
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 1152
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


int main(){
    int N,a[110];
    int sum=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
        sum+=a[i];
    }

    P b[110];
    for(int i=0;i<N;i++){
        b[i].first=abs(a[i]*N-sum);
        b[i].second=i;
    }
    sort(b,b+N);
    cout<<b[0].second<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=2e5+7;
int pp[N];
int p[N];
int find(int u){
	if(pp[u]==u) {
		return u;
	}
	return pp[u]=find(pp[u]);
}
bool is(int u,int v){
	return find(u)==find(v);
}
void join(int u,int v){
	int a=find(u);
	int b=find(v);
	if(a==b) {
		return;
	}
	else{
		pp[a]=b;
	}
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	int m; cin>>m;
	for(int i=1; i<=n; i++) {
		int a; cin>>a;
		p[a]=i;
	}
	for(int i=1; i<=n; i++) {
		pp[i]=i;
	}
	for(int i=1; i<=m; i++) {
		int u,v; cin>>u>>v;
		join(u,v);
	}
	int cnt=0;
	for(int i=1; i<=n; i++) {
		cnt+=(is(i,p[i]));
	}
	cout<<cnt<<endl;

	return 0;
}


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define all(a) begin(a),end(a)
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define sz(x) ((int)x.size())
#define ins insert
#define rep(i,l,u) for(int i=l;i<=u;++i)
#define reb(i,l,u) for(int i=l;i>=u;--i)
using namespace std;
const int maxn=2e5+10;
const int mod=1e9+7;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
main(){
    int n;
    cin>>n;
    int ans=1;
    int tmp=7;
    int f=0;
    while(true){
        if(tmp%n==0){
            f=1;
            break;
        }
        tmp%=n;
        tmp*=10;
        tmp+=7;
        ans++;
        if(ans>=1e6)break;
    }
    if(f)cout<<ans<<endl;
    else cout<<(-1)<<endl;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int i, j, n;
	char a[2][3];
	while(scanf("%d", &n) != EOF)
	{	
		for(i = 1; i <= 2; i++)
	    {
	    	for(j = 1; j <= 3; j++)
	    	{
	    		scanf(" %c", &a[i][j]);
		    }
	    }
	    if( a[1][1]==a[2][3] && a[1][3]==a[2][1] && a[1][2]==a[2][2])
	    	printf("YES\n");
	    else
	 	    printf("NO\n");
	}
	return 0;
}



Measured memory_bytes: 256
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

r = int(arr_data[0][0])
g = int(arr_data[1][0])


print(g*2-r)


Measured memory_bytes: 3064
import collections

n = int(input())
s = []
for _ in range(n):
    ch = input()
    s.append([int(c) for c in ch])


def graph(i, n, s):
    flag = [-2 for _ in range(n)]
    flag[i] = 1
    que = collections.deque([i])
    while que:
        target = que.popleft()
        for j in range(n):
            if s[target][j] == 1:
                if flag[j] == -2:
                    flag[j] = flag[target] + 1
                    que.append(j)
                elif flag[j] != flag[target] + 1 and flag[j] != flag[target] - 1:
                    return [-1, -1]
    mf = max(flag)
    return [flag.index(mf), mf]


r1 = graph(0, n, s)
if r1[0] == -1:
    print(-1)
else:
    res = r1[1]
    for i in range(1, n):
        r = graph(i, n, s)
        res = max(res, r[1])
    print(res)


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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) cin >> a.at(i);
	sort(a.begin(), a.end(), greater<int>());
  
	int ret = 1;
	for (int i = 1; i < N; i++) {
      (a.at(i - 1) > a.at(i) ? ret++ : 0);
    }
  
	cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L


int main() {
  int x;
  cin>>x;
  
  if(x>=30){
  	cout<<"Yes"<<endl;
  }
  
  else{
   	cout<<"No"<<endl; 	
  }

    }



Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(){
	int W, H, N;
	int count = 0;
	int S[100][100] = { 0 }; int x[100]; int y[100]; int a[100];
	cin >> W >> H >> N;
	for (int i = 0;i < N;i++) cin >> x[i] >> y[i] >> a[i];
	for (int i = 0;i < N;i++) {
		if (a[i] == 1) {
			for (int k = 0;k < H;k++) {
				for (int j = 0;j < x[i];j++)
					S[k][j] = 1;
			}
		}
		if (a[i] == 2) {
			for (int k = 0;k < H;k++) {
				for (int j = x[i];j < W;j++)
					S[k][j] = 1;
			}
		}
		if (a[i] == 3) {
			for (int k = 0;k < y[i];k++) {
				for (int j = 0;j < W;j++)
					S[k][j] = 1;
			}
		}
		if (a[i] == 4) {
			for (int k = y[i];k < H;k++) {
				for (int j = 0;j < W;j++)
					S[k][j] = 1;
			}
		}
	}
		for(int k=0;k<H;k++){
			for (int j = 0;j < W;j++)
				if (S[k][j] == 0) count++;
	}
		cout << count;
}

Measured memory_bytes: 3684