akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
typedef priority_queue<string> priquest;
typedef priority_queue<string,vector<string>,greater<string>> rpriquest;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
int exp(int x,int y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x)%big;
    int t=exp(x,y/2);
    return (t*t)%big;
}
void chmin(ll a,ll b){
    if(a>b)a=b;
    return;
}

int main(){
    //1e0=1,1e1=10,1e2=9,1e3=12,1e4=3,1e5=4 以下ループ
    //i桁目までであまりj=:dp[i][j]
    vector<int> en(6);
    en[0]=1;en[1]=10;en[2]=9;en[3]=12;en[4]=3;en[5]=4;
    
    string s;cin >> s;
    int n=s.size();
    reverse(s.begin(),s.end());
    vector<vector<ll>> dp(n+1,vector<ll>(13,0));
    dp[0][0]=1;
    rep(i,n){
        //dp[i+1][]を作る
        rep(j,13){
            if(s[i]!='?'){
                //各々場所がずれるだけ
                //s[i]*en[i%6]だけずれる
                dp[i+1][(j+(s[i]-'0')*en[i%6])%13]=dp[i][j];
            }
            else{
                //s[i][(j-x*en[i%6])%13]を足してく
                rep(x,10){
                    dp[i+1][j]+=dp[i][((j-x*en[i%6])%13+13)%13];
                }
                dp[i+1][j]%=big;
            }
        }
    }
    dp[n][5]=(dp[n][5]%big+big)%big;
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		int count=0;
		boolean sw=false;
		String answer="";
		//List<Integer> h=new ArrayList<Integer>();
		//int t[]=new int[(int)Math.pow(10,5)];
		int max=Integer.MIN_VALUE;
		int min=Integer.MAX_VALUE;
		//int h[]=new int[(int)Math.pow(10,5)];
		long warukazu=(long)Math.pow(10,9)+7;
		String b="";
		//入力
		Scanner sc = new Scanner(System.in);
		//int N=sc.nextInt();
		b=sc.next();
		
		//処理
		if(b.equals("A"))
		{
			answer="T";
		}else if(b.equals("T"))
		{
			answer="A";
		}else if(b.equals("C"))
		{
			answer="G";
		}else if(b.equals("G"))
		{
			answer="C";
		}
		
		// 出力
		System.out.println(answer);
	}
}

Measured memory_bytes: 23124
fun main(args: Array<String>) {
    val x = readIntList()
    if (x.distinct().size == 2) println("Yes")
    else println("No")
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 35960
#include <iostream>


using namespace std;

void call(int n){
    int x;
    for(int i=1;i<=n;++i){
        x=i;
        if(x%3==0){
            cout<<" "<<i;
        }else{
            while(x){
                if(x%10==3){
                    cout<<" "<<i;
                    break;
                }
                x/=10;
            }
        }
    }
    cout<<'\n';
}


int main(void){
    int n;
    cin>>n;
    
    call(n);
       
        
    
    
    return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int i,j;
char a[10][10];
bool fg=true;
void hh(int x,int y){
	if(x==i-1&&y==j-1&&fg) {
	fg=false;
	for(int ii=0;ii<i;++ii)
		for(int ij=0;ij<j;++ij)
			if(a[ii][ij]!='.'&&(ii!=0||ij!=0)) fg=true;
	}
	if(a[x][y+1]=='#'){
		a[x][y+1]='.';
		hh(x,y+1);
		a[x][y+1]='#';
	}
	if(a[x+1][y]=='#'){
		a[x+1][y]='.';
		hh(x+1,y);
		a[x+1][y]='#';
	}
}
int main(){
	scanf("%d%d",&i,&j);
	for(int ii=0;ii<i;++ii)
		scanf("%s",a[ii]);
	hh(0,0);
//	for(int ii=0;ii<i;++i)
//		for(int ij=0;ij<j;++j)
//			if(a[ii][ij]!='.') fg1=
	if(fg) printf("Impossible");	
	else printf("Possible");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int n;cin>>n;
    co(n*n*n);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

const int MOD = 1000000007;

int main(int argc, const char * argv[]) {
       
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s; cin >> s;
    int n = (int)s.size();
    
    vector<vector<int64_t>> dp(n + 1, vector<int64_t>(13, 0));
    
    //vector<vector<vector<int64_t>>> dp(n + 1, vector<vector<int64_t>>(2, vector<int64_t>(13, 0)));
    dp[0][0] = 1;
    
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') {
            for (int j = 0; j <= 9; j++) {
                for (int k = 0; k < 13; k++) {
                    dp[i + 1][(10 * k + j) % 13] = (dp[i + 1][(10 * k + j) % 13] + dp[i][k]) % MOD;
                }
            }
        } else {
            int j = s[i] - '0';
            for (int k = 0; k < 13; k++) {
                dp[i + 1][(10 * k + j) % 13] = (dp[i + 1][(10 * k + j) % 13] + dp[i][k]) % MOD;
            }
        }
    }
    
    cout << dp[n][5] << endl;
    
    return 0;
}


Measured memory_bytes: 13776
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int k, t;
	cin >> k >> t;
	vi v(t);
	REP(i, t) cin >> v[i];
	sort(ALL(v));
	int s = 0;
	REP(i, t - 1) s += v[i];
	cout << max(0, v.back() - s - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;

int main() {
    int N, A, B, C, D[101];
    while (cin >> N) {
        cin >> A >> B >> C;
        for (int i=0; i<N; ++i) {
            cin >> D[i];
        }
        sort(D, D+N, greater<int>());
        
        int cal = C;
        int price = A;
        for (int i=0; i<N; ++i) {
            if (cal/price < D[i]/B) {
                cal += D[i];
                price += B;
            } else {
                break;
            }
        }
        cout << cal/price << endl;
    }
    return 0;
}


Measured memory_bytes: 3124
def judge_hit(num1, num2):
    cnt = 0
    for a, b in zip(num1, num2):
        if a == b:
            cnt += 1
    return cnt

def judge_blow(num1, num2, hit):
    cnt = 0
    for b in num2:
        cnt += (b in num1)
    return cnt - hit

while True:
    try:
        A_number = map(int, raw_input().split())
        B_number = map(int, raw_input().split())
        hit = judge_hit(A_number, B_number)
        blow = judge_blow(A_number, B_number, hit)
        print hit, blow 
    except:
        break


Measured memory_bytes: 4648
#include<stdio.h>
int main(void)
{
	int h,hi,k,ki,a,b,c,d,g,s;
	scanf("%d %d %d %d %d %d %d %d",&h,&hi,&k,&ki,&a,&b,&c,&d);
    g=h*a+hi*b;
	s=k*a+ki*b;
	if(h>=10){
		g=g+h/10*c;
	}
	if(hi>=20){
		g=g+hi/20*d;
	}
	if(k>=10){
		s=s+k/10*c;
	}
	if(ki>=20){
		s=s+ki/20*d;
	}
	if(g<s){
		printf("kenjiro\n");
	}
	if(g>s){
		printf("hiroshi\n");
	}
	if(g==s){
		printf("even\n");
	}
	return 0;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
int64_t dfs(ll n,ll i=0,bool jud3=false,bool jud5=false,bool jud7=false){
  if(i>n) return 0;
  ll ret=0;
  if(jud3&&jud5&&jud7) ret++;
  ret+=dfs(n,i*10+3,true,jud5,jud7);
  ret+=dfs(n,i*10+5,jud3,true,jud7);
  ret+=dfs(n,i*10+7,jud3,jud5,true);
  return ret;
}

int main()
{
  ll n;
  cin>>n;
  cout<<dfs(n);
}

Measured memory_bytes: 256
x = int(input())
if x >= 400 and x < 600:
    print(8)
elif x >= 600 and x < 800:
    print(7)
elif x >= 800 and x < 1000:
    print(6)
elif x >= 1000 and x < 1200:
    print(5)
elif x >= 1200 and x < 1400:
    print(4)
elif x >= 1400 and x < 1600:
    print(3)
elif x >= 1600 and x < 1800:
    print(2)
else:
    print(1)


Measured memory_bytes: 9204
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		System.out.println((n*800)-(200*(n/15)));
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35568
from itertools import product
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
can_open = []
cost = []
for _ in range(m):
    a, b = map(int, input().split())
    cost.append(a)
    can_open.append(sum(1 << (c-1) for c in map(int, input().split())))

n_bit = 1 << n
INF = 10**18
dp = [INF]*n_bit
dp[0] = 0

for j, (x, y) in product(range(n_bit), zip(can_open, cost)):
    m = j | x
    z = dp[j]+y
    if dp[m] > z:
        dp[m] = z

print(dp[-1] if dp[-1] != INF else -1)


Measured memory_bytes: 3444
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

int main(){
    ll n; cin >> n;
    vl a(n), b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    ll cnt = 0;
    rep(i,n){
        if(a[i] >= b[i]) cnt -= a[i]-b[i];
        else cnt += (b[i]-a[i])/2;
    }
    if(cnt>=0) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 384
def funcD():
    import heapq
    N, M = map(int, input().split())
    A = list(map(lambda x: -1 * int(x), input().split()))
    A.sort(reverse=True)
    heapq.heapify(A)
    for m in range(M):
        a = -(-heapq.heappop(A) // 2)
        heapq.heappush(A, a)
    print(-sum(A))


funcD()

Measured memory_bytes: 14184
#include<iostream>
using namespace std;
int a[10001]={0};
int ans[101][101]={0};
int n,h,w;
int main()
{
	cin>>h>>w>>n;
	for (int i=1;i<=n;++i)
	    cin>>a[i];
	int i=1;
	int j=1;
	int k=1;
	int g=1;
	int o=1;
	while (i<=h)
	{
		ans[i][j]=k;
		g++;
		if (o%2==1) j++;
		    else j--;
		if (g>a[k])
		{
			k++;
			g=1;
		}
		if (j>w)
		{
			i++;
			j=w;
			o++;
		}
		if (j<1)
		{
			i++;
			j=1;
			o++;
		}
	}
	for (int i=1;i<=h;++i)
	{
		for (int j=1;j<=w;++j)
		    cout<<ans[i][j]<<' ';
		cout<<endl;
	}
	return 0;
}

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

int main(){
	int A, B, C, Xa, Yb;
	int nA = 0, nB = 0;
	cin >> A >> B >> C >> Xa >> Yb;
	int custo = 0;
	if (C*2<A+B)
	{
		int amais;
		int amenos;
		amais = (max(Xa, Yb))*2*C;
		if (Xa>Yb)
		{
		amenos = ((min(Xa, Yb))*2*C)+(Xa-Yb)*A;
		} else {
		amenos = ((min(Xa, Yb))*2*C)+(Yb-Xa)*B;
		}
		custo+=min(amais, amenos);
	} else {
		custo+=Xa*A+Yb*B;
	}

	cout << custo;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <typeinfo>
#include <cmath>
#include <numeric>
using namespace std;


int main()
{
    int N;
    std::cin >> N;
    std::vector<int> Height(N);
    for (int i = 0; i < N; ++i)
    {
        std::cin >> Height[i];
    }
    
    std::vector<int> prev_max_Height(N);
    int num = 1;
    prev_max_Height[0] = Height[0];
    
    for (int i = 1; i < N; ++i)
    {
        if(Height[i] >= prev_max_Height[i-1]){
            ++num;
            prev_max_Height[i] = Height[i];
        }else{
            prev_max_Height[i] = prev_max_Height[i-1];
        }
    }
    std::cout << num << "\n";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    while (1)
    {
        int a, b;
        char re;
        cin >> a >> re >> b;
        if (re == '+')  cout << a + b << endl;
        if (re == '-')  cout << a - b << endl;
        if (re == '*')  cout << a * b << endl;
        if (re == '/')  cout << a / b << endl;
        if (re == '?') break;
    }
    return 0;
}

Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;

namespace DPL1_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var L = new Dictionary<int, int>();
            L[0] = int.Parse(Console.ReadLine());
            int length = 1;
            for (int i = 0; i < n-1; i++)
            {
                var t = int.Parse(Console.ReadLine());
                if (L[length - 1] < t)
                {
                    L[length++] = t;
                }
                else
                {
                    L[L.Values.TakeWhile(s => s < t).Count()] = t;
                }

            }
            Console.WriteLine(length);
        }
    }
}

Measured memory_bytes: 15704
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mem(a,x) memset(a,x,sizeof(a))
#define nl "\n"
#define fout(x) fixed<<setprecision(x)
#define one(x) __builtin_popcount(x)
#define F first
#define S second

const int MOD=1e9+7;
const double EPS=1e-9;
const double PI=acos(-1.0);

ll qpow(ll n,ll k){ll ans=1;assert(k>=0);n%=MOD;while(k>0){if(k&1)ans=(ans*n)%MOD;n=(n*n)%MOD;k>>=1;}return ans%MOD;}

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << fout(10)<<x;}
void __print(double x) {cerr << fout(10)<<x;}
void __print(long double x) {cerr << fout(10)<<x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// ****************************************************



int main()
{
    int n;
    cin>>n;
    ll tot=0;
    ll arr[n+3];
    for(int i=0;  i<n; i++)
    {
        cin>>arr[i];
        tot+=arr[i];
    }
    ll ans=0;
    for(int i=0; i<n; i++)
    {
        tot-=arr[i];
        ans+=(arr[i]*tot);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//繰り返し2乗法を用いたべき乗.x^nを返す.
long long int pow(long long int x,long long int n){
	long long int res = 1;
	while (n)
	{
		if (n&1){
			res *= x;
		}
		n >>= 1;
		x = x * x;
	}
	return res;
}


int main(){
	int n;
	cin >> n;
	cout << n + n * n + n * n * n << endl;
	return 0;
}

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

#define int long long



signed main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    if(abs(a-c)<=d || abs(a-b)<=d && abs(b-c)<=d)
        puts("Yes");
    else
        puts("No");
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




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

  ll N; cin >> N ;
  ll odd = 0;
  rep(i,N){
    ll inp; cin >> inp;
    if(inp %2) odd ++;
  }

  if(odd %2 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;

  
  
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
            using namespace std;
        	
            int main() {
                int N;
                cin >> N;
                vector<int> V(N); 
                vector<int> C(N); 
                
                for(int i=0; i<N; i++){
                  cin>> V.at(i); 
                }
                for(int i=0; i<N; i++){
                  cin>> C.at(i); 
                }
               
               int a;
               int S=0; 
               for(int i=0; i<N; i++){
                 a=max(0,V.at(i)-C.at(i)); 
                 S+=a; 
               }
                cout<< S;    
           }

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

const int INF = 2e9;

int main(){
    int x;
    cin >> x;
    if(x == 1)cout << 0 << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m, f[N];
struct edge {
	int u, v, w;
}e[N << 1];
int find(int x) {
	if(f[x] == x) return x;
	return f[x] = find(f[x]);
}
bool cmp(edge a, edge b) {
	return a.w < b.w;
}
int main() {
	scanf("%d%d", &n, &m);
	int cnt = 0;
	for(int i = 1; i <= m; ++i) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		e[++cnt] = (edge) {a, b, 0};
	}
	for(int i = 1; i <= n; ++i) {
		e[++cnt] = (edge) {n + 1, i, 1};
	}
	++n;
	for(int i = 1; i <= n; ++i) f[i] = i;
	int ans = 0;
	sort(e + 1, e + cnt + 1, cmp);
	for(int i = 1; i <= cnt; ++i) {
		int x = find(e[i].u), y = find(e[i].v);
		if(x != y) {
			ans += e[i].w;
			f[y] = x;
		}
	}
	printf("%d", ans);
}

Measured memory_bytes: 4992
#include <stdio.h>
#define N 1000
int main(){
  int n,i,j,temp,flag,count=0;
  int A[N];
  scanf("%ld",&n);
  for(i=0;i<n;i++){
    scanf("%ld",&A[i]);
  }
  flag=1;
  while(flag){
    flag=0;
    for(j=n-1;j>0;j--){
      if(A[j]<A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	count++;
	flag=1;
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
} 

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
int main(){
  int ans=0;
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  if(a[(n-1)/2]==a[(n-1)/2+1]){cout<<ans; return 0;}
  else{ans=a[(n-1)/2+1]-a[(n-1)/2];cout<<ans;}
}

Measured memory_bytes: 640
#include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  int d=0;
  int i=0;
  int sq=0;

  while(scanf("%d", &d)!=EOF)
    {
      sq=0;
      for(i=d;i<600;i+=d)
	sq+=d*i*i;
      cout<<sq<<endl;
    }

}

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

class Main {
    private static int[] calcPrimes(boolean[] table) {
        Arrays.fill(table, true);
        table[0] = table[1] = false;
        for (int i = 2; i <= Math.sqrt(table.length - 1); i++) {
            if (table[i]) {
                for (int j = i + i; j < table.length; j += i) {
                    table[j] = false;
                }
            }
        }
        int counter = 0;
        for (int i = 0; i < table.length; i++) {
            if (table[i]) {
                counter++;
            }
        }
        int[] result = new int[counter];
        int index = 0;
        for (int i = 0; i < table.length; i++) {
            if (table[i]) {
                result[index++] = i;
            }
        }
        return result;
    }

    private static void solve() {
        final Scanner scanner = new Scanner(System.in);
        boolean[] table = new boolean[300000 + 1];
        final int[] primes = calcPrimes(table);
        
        while (true) {
            final int t = scanner.nextInt();
            if (t == 0) {
                break;
            }
            int counter = 0;
            for (int i = 0; i < primes.length; i++) {
                for (int j = i; j < primes.length; j++) {
                    if (t - primes[i] - primes[j] < primes[j]) {
                        break;
                    }
                    if (table[t - primes[i] - primes[j]] &&
                            primes[i] + primes[j] > t - primes[i] - primes[j]) {
                        counter++;
                    }
                }
                if (primes[i] > t) {
                    break;
                }
            }
            System.out.println(counter);
        }

    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 0
#include <stdlib.h>
int main(){
  long long int K,i,N;
  N=7;
  scanf("%lld",&K);
  if(K%2==0 || K%5==0){
    printf("-1");
    return 0;
  }
  while(1){
    if(N%K==0) break;
    N=N%K*10+7;
    i++;
  }
  printf("%lld",i+1);
  return 0;
}


Measured memory_bytes: 1724
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */


int main(){
	int n, x, a[100000];
	ll ans = 0;
	cin >> n >> x;
	REP(i, n)cin >> a[i];
	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}
	FOR(i, 1, n) {
		int u = max(0, a[i - 1] + a[i] - x);
		ans += u;
		a[i] -= u;
	}	
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
int max(int a,int b);
int min(int a,int b);
int main(void){
	int a[200000],m,i,maxv;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&a[i]);
	}
	maxv=-2000000000;
	int minv=a[0];
	for(i=1;i<m;i++){
		maxv=max(maxv,a[i]-minv);
		minv=min(minv,a[i]);
	}
	printf("%d\n",maxv);
	return 0;
}
int max(int a,int b){
	return a>b?a:b;
}

int min(int a,int b){
	return a<b?a:b;
}



Measured memory_bytes: 2528
#include<bits/stdc++.h>
using namespace std;
 
#define IOS 		ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sd(n)       scanf("%d", &n)
#define sdd(a,b)    scanf("%d %d", &a, &b)
#define sddd(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sld(n)      scanf("%lld", &n)
#define slld(a,b)   scanf("%lld %lld", &a, &b)
#define sllld(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define slu(n)      scanf("%llu", &n)
#define sllu(a,b)   scanf("%llu %llu", &a, &b)
#define slllu(a,b,c) scanf("%llu %llu %llu", &a, &b, &c)
#define ss(a)		scanf("%s", a)
#define all(a) 		a.begin(),a.end()
#define unq(x)      x.erase(unique(all(x)), x.end()
#define mp 			make_pair
#define sz(av) 		int((av).size())					//return size of vec
#define CLR(arr)    memset(arr, 0, sizeof(arr))			//assign 0 to whole arr
#define SET(vec)    memset(arr, -1, sizeof(arr))		//assign -1 to whole arr
#define CLRV(vec)	fill(vec.begin(), vec.end(), 0)		//assign 0 to whole vec
#define SETV(vec,n,a) vec.assign(n, a)	
#define vtd(rowsize,colsize,type,name) 		vector < vector <type> > name(rowsize,vector <type> (colsize)); 	//assign to first n elements value a in vec
#define SETB(a)		memset(a, true, sizeof(a))			//boolean array initialize by true value
#define CLRB(a)		memset(a, false, sizeof(a))			//boolean array initialize by false value
#define vintitr 	vector<int>::iterator
#define vlnlnitr 	vector<long long>::iterator
#define sintitr 	set<int>::iterator
#define slnlnitr 	set<long long>::iterator
#define aa			first
#define bb			second
#define mod 		1000000007
#define PI 			acos(-1.00)
#define psb 		push_back
#define ppb			pop_back
#define ppb			pop_back
#define psf			push_front
#define ppf			pop_front
#define in 			inset
#define rep(i, n) 	for(int i=0; i<n; i++)
#define repi(i,j,n) for(int i=j; i<j; i++)
#define rof(i, n)   for(int i=n-1; i>=0; i--)
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))
#define __lcm(a, b)	a*b / __gcd(a, b)
#define __builtin_zerocount(a)	8*sizeof(a)-__builtin_popcount(a)-__builtin_clz(a)-__builtin_ctz(a)
#define D(t)        cerr << #t " = " <<t  << '\n'
#define DBG         cerr << "Hi!" << '\n'
 
 
typedef long long	 		ll;
typedef unsigned long long	llu;
typedef long double			ld;
typedef pair<int, int> 		pii;

int main()
{
//	freopen("t.in","r",stdin);
//	freopen("t.out","w",stdout);
	IOS;
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, b+c-a) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

vector<int> dfs(vector<int> b) {
	if (b.size() == 0)return vector<int>{-1};
	dump(b);
	rep(j, 0, b.size()) {
		if (b[j] > j + 1)return vector<int>();
	}
	rep(j, 0, b.size()) {
		if (b[j] == j + 1) {
			vector<int> c = b;
			c.erase(c.begin() + j);
			auto res = dfs(c);
			if (res.size() == 0)continue;
			res.push_back(j);
			return res;
		}
	}
	return vector<int>();
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> b(N); rep(i, 0, N) {
		cin >> b[i];
	}
	vector<int> a = dfs(b);

	dump(a);

	if (a.size()) {
		rep(i, 1, a.size()) {
			cout << a[i] + 1 << endl;
		}
	}
	else {
		cout << -1 << endl;
	}


	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
          int a,b,c,d=0;
          scanf("%d%d%d",&a,&b,&c);
          for(b;b<=c;b++)
          {
                    if(b%a==0)
                              d++;
          }
                    if(d>0)
                              printf("OK\n");
                    else
                              printf("NG\n");
          return 0;
}


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

//?????°???????????????????????????????????§?????????????????????
//???????????????????????¨?????????????????????????¬????????????¨?????????????¢?????????????
//?????????????????????????????§?????????push???????????¨??????????????¨???????????????
//??????????¶???????????????????????????????????????????????????????????????§??????????????????

struct team{
    long long n,p,time;
};

bool operator<(const team& t1,const team& t2){
    if(t1.p==t2.p){
        return t1.n > t2.n;
    }
    return t1.p < t2.p;
}

priority_queue<team> q;
team tea[100001];

int main() {

    long long n,r,l;

    cin >> n >> r >> l;

    /*for(int i=0;i<r;i++){
        cout << rec[i].d << " " << rec[i].t << " " << rec[i].x << endl;
    }*/

    for(int i=1;i<=n;i++){
        tea[i].n = i;
        tea[i].p = 0;
        tea[i].time = 0;
        q.push(tea[i]);
    }

    int d,t,x,btime=0,bnum=1;
    team tmp;
    for(int i=0;i<r;i++){
        scanf(" %d %d %d",&d,&t,&x);
        tea[bnum].time += t - btime; //?????°???????????????????????????????????§????????????????????????????¢??????????
        tea[d].p += x; //????????????
        q.push(tea[d]); //???????????\
        while(!q.empty()){
            tmp = q.top();
            if(tmp.p == tea[tmp.n].p){ //?????°????????´???????????£????????????
                bnum = tmp.n; //?????§????????????????????????????¨????
                break;
            }
            q.pop(); //??????
        }
        btime = t; //????????????????¨????
    }

    tea[bnum].time += l - btime ; //??????????????£???????????????????????????????¶????


    int ans=1;

    for(int i=1;i<=n;i++){
        ans = tea[i].time > tea[ans].time ? i : ans;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 29896
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
 
#define N  100005

signed main()
{
      int k,n;
      cin>>k>>n;
      int arr[n];
      int i,j;
      int sum=0;
      for(i=0;i<=n-1;i++)
      {
      	cin>>arr[i];
      	sum+=arr[i];
	  }
	  if(sum>=k)
	  {
	  	cout<<"Yes"<<endl;
	  }
	  else
	  {
	  	cout<<"No"<<endl;
	  }
}

Measured memory_bytes: 1024
n = gets.chomp.to_i
arr = []
(n - 1).times do
  arr << gets.chomp.split(' ').map(&:to_i)
end
(0...(n - 1)).each do |i|
  time = 0
  (i...(n - 1)).each do |j|
    c, s, f = arr[j]
    if s - time > 0
      time += s - time
    else
      time += ((f - ((time - s) % f)) % f)
    end
    time += c
  end
  puts time
end
puts 0

Measured memory_bytes: 1788
/* به نام یزدان */
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 100 + 5, MAX_V = 100 * 1000 + 5;
int n, cap, w[MAX_N], v[MAX_N];
long long dp[MAX_N][MAX_V];

void read_input() {
	cin >> n >> cap;
	for (int i = 1; i <= n; i++)
		cin >> w[i] >> v[i];
}

void solve() {
	memset(dp, 63, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < MAX_V; j++) {
			dp[i][j] = dp[i - 1][j];
			if (v[i] <= j)
				dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
		}
}

void print_output() {
	int ans = 0;
	for (int i = 0; i < MAX_V; i++)
		if (dp[n][i] <= cap)
			ans = i;
	cout << ans;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	read_input();
	solve();
	print_output();
}


Measured memory_bytes: 82304
{-# LANGUAGE OverloadedStrings #-}

import qualified Data.ByteString.Char8 as B
import Data.Attoparsec.ByteString.Char8

type Input = (Int, Int, Int)

inputParser :: Parser Input
inputParser = (,,)
  <$> decimal <* space
  <*> decimal <* space
  <*> decimal <* endOfLine

main :: IO ()
main = B.interact
  $ B.pack . show . either (error "parse error") solve . parseOnly inputParser

solve :: Input -> Int
solve (a, b, c) = (b `div` a) `min` c

Measured memory_bytes: 508
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    ans = 0
    for i in range(n-1):
        ans += a[i] // 2
        a[i] %= 2
        ans += min(a[i], a[i+1])
        a[i+1] -= min(a[i], a[i+1])
    ans += a[n-1] // 2
    print(ans)

if __name__ == "__main__":
    main()

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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

class modint {
  private:
  ll m_val;
  ll m_mod;
public:
  constexpr modint() noexcept : m_val(0), m_mod(0) { m_mod = MOD; }
  constexpr modint(const ll x) noexcept : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
  constexpr modint(const ll x, const ll mod) noexcept : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
  constexpr ll val() noexcept { return m_val; }
  constexpr const ll val() const noexcept { return m_val; }
  constexpr modint operator+(const modint rhs) const noexcept { return modint(*this) += rhs; }
  constexpr modint operator-(const modint rhs) const noexcept { return modint(*this) -= rhs; }
  constexpr modint operator*(const modint rhs) const noexcept { return modint(*this) *= rhs; }
  constexpr modint operator/(const modint rhs) const noexcept { return modint(*this) /= rhs; }
  constexpr modint &operator+=(const modint rhs) noexcept {
    m_val += rhs.m_val;
    if (m_val >= m_mod) m_val -= m_mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (m_val < rhs.m_val) m_val += m_mod;
    m_val -= rhs.m_val;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    m_val = m_val * rhs.m_val % m_mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    ll exp = m_mod - 2;
    while (exp) {
      if (exp % 2) *this *= rhs;
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

ll fac(ll a) {
  ll sum = 1;
  for (ll i = 1; i <= a; ++i) {
    sum = sum * i % MOD;
  }
  return sum;
}

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

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

  modint sum = 0;
  modint c = 0;
  for (ll i = 0; i < n-1; ++i) {
      auto d = modint(x[i+1] - x[i]);
      c +=  (modint(1) / (i+1));
      sum += (d * c);
  }

  cout << (sum * fac(n-1)).val() << endl;
  
  return 0;
}

Measured memory_bytes: 1024
def hash(v):
    return v % 100001

def insert(hashTable, value):
    key = hash(value)
    if hashTable[key] == None:
        hashTable[key] = [value]
    else:
        hashTable[key].append(value)

def find(hashTable, value):
    key = hash(value)
    if hashTable[key] == None:
        return False
    else:
        for val in hashTable[key]:
            if val == value:
                return True
    return False

def convert(string):
    res = ''
    for s in string:
        res += str(ord(s))
    return int(res)

n = int(input())
hashTable = [None] * 10**6
for i in range(n):
    com, val = input().split()
    val = convert(val)
    if com == 'insert':
        insert(hashTable, val)
    else:
        print('yes') if find(hashTable, val) else print('no')


Measured memory_bytes: 42480
//nani?
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ )
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
using namespace __gnu_pbds;
const int inf=1e7;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 1e5+5;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------



int main(){
    fastio;
    ll n;
    cin>>n;
  ll aux;
    while(n>0){
        aux = n%10;
        if(aux==7) {cout<<"Yes"<<endl;return 0;}
        n/=10;
    }
    cout<<"No"<<endl;
    
} 

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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 func(long long N, std::vector<std::string> S, std::vector<long long> P){

    vector<pair<string,pair<lli,lli>>> v;

    REP(i,0,N){
        v.push_back({S[i],{-P[i],i+1}});
    }

    SORT(v);

    REP(i,0,N){
        cout<<v[i].second.second<<endl;
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
        scanf("%lld",&P[i]);
    }
    func(N, std::move(S), std::move(P));
    return 0;
}


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

bool test(string a){
  string x,y;
  int l = a.length();
  y = a.substr(0,l/2);
  for(int i = (l+1)/2; i < l; i++){
    y[l-1-i] = a[i];
  }
  x = a.substr(0,l/2);
  //cout << x << endl;
  //cout << y << endl;
  return x == y;
}

int main(){
  string s;
  cin >> s;
  int len = s.length();
  bool b = test(s) && test(s.substr(0,(len-1)/2)) && test(s.substr((len+1)/2,(len-1)/2));
  if(b) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 256
// Submitted by Subhash
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;



import java.util.*;

public class Main {


	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n=sc.nextInt();
		int a []=sc.readArray(n);
		Arrays.sort(a);
		int ans=0;
		for(int i=0;i<n-2;i++) {
			for(int j=i+1;j<n-1;j++)
				for(int k=j+1;k<n;k++)
			
			if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]) {
				ans++;
			}
			
			
		}
System.out.println(ans);
	

		

	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}

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

struct data {
	string str;
	int score;
	int order;
	bool operator<( const data& right ) const {
        return str == right.str ? score > right.score : str < right.str;
    }
};

int main(){
	int n;
	cin >> n;
	vector<data> data_array(n);
	for (int i=0;i<n;i++){
		cin >> data_array[i].str >> data_array[i].score;
		data_array[i].order = i+1;
	}
	sort(data_array.begin(), data_array.end());

	for (int i =0; i<n ; i++)
	{
		cout << data_array[i].order << endl;
	}
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int x[1000][4], t[1000], n, team, maxn, maxp, maxid, loop; vector<int>p[10000];
int main() {
	while (true) {
		cin >> n;
		memset(t, 0, sizeof(t));
		for (int i = 0; i < 10000; i++) { p[i].clear(); }
		if (!n) { break; }
		for (int i = 0; i < n; i++) {
			cin >> x[i][0] >> x[i][1] >> x[i][2] >> x[i][3];
		}
		team = 0; loop = 0;
		while (loop < n) {
			maxn = 0; maxp = 1000000;

			for (int i = 0; i < n; i++) {
				if (t[i] == 0) {
					if (maxn < x[i][2]) {
						maxn = x[i][2]; maxid = i; maxp = x[i][3];
					}
					else if (maxn == x[i][2] && maxp > x[i][3]) {
						maxp = x[i][3]; maxid = i;
					}
				}
			}

			if (p[x[maxid][1]].size() < 3 && team < 10) {
				goto E;
			}
			if (p[x[maxid][1]].size() < 2 && team < 20) {
				goto E;
			}
			if (p[x[maxid][1]].size() < 1 && team < 26) {
				goto E;
			}
			goto F;
		E:;
			cout << x[maxid][0] << endl;
			p[x[maxid][1]].push_back(maxid);
			team++;
		F:;
			t[maxid] = 1;
			loop++;
		}
	}
}

Measured memory_bytes: 1452
#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[i];

    while(A.size()>1){
        for(int i=1;i<A.size();++i){
            A[i] = A[i]%A[0];
        }
        A.erase(remove(A.begin(),A.end(),0),A.end());
        sort(A.begin(),A.end());
    }
    cout << A[0] << endl;
}


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

long long kaisu(long long int n){
  if(n==1)return 1;
  
  return 1+2*kaisu(n/2);

}

int main(){
  long long int h;
  cin >> h;

  cout << kaisu(h);
  return 0;
}


Measured memory_bytes: 256
def bubbleSort(A, N):
    i = 0
    count = 0
    while i<N:
        for j in range(0, N-1-i):
            if A[N-j-2]>A[N-j-1]:    
                (A[N-j-1], A[N-j-2]) = (A[N-j-2], A[N-j-1])
                count += 1
        i += 1
    print(" ".join(map(str, A)))
    print(count)


n = int(input())
a = list(map(int, input().split()))
bubbleSort(a, n)


Measured memory_bytes: 5600