akhauriyash/Code-Regression huggingface dataset:
import sys; sys.setrecursionlimit(50000)
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

result = []
for x in range(X):
    for y in range(Y):
        if x * y > K: break
        for z in range(Z):
            if x * y * z > K: break
            result.append(A[x]+B[y]+C[z])
result.sort(reverse=True)
for i in range(K):
    print(result[i])


Measured memory_bytes: 112328
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	string loma;
	while(cin >> loma){
		int arabia = 0;
		vector<int> lom(loma.size()+1);
		for (int i = 0; i < loma.size(); i++) {
			switch (loma.at(i)) {
			case 'I':lom.at(i) = 1; break;
			case 'V':lom.at(i) = 5; break;
			case 'X':lom.at(i) = 10; break;
			case 'L':lom.at(i) = 50; break;
			case 'C':lom.at(i) = 100; break;
			case 'D':lom.at(i) = 500; break;
			case 'M':lom.at(i) = 1000; break;
			}
		}
		for (int i = 0; i < loma.size(); i++) {
			if (lom.at(loma.size() - 1 - i) >= lom.at(loma.size() - i))
				arabia += lom.at(loma.size() - 1 - i);
			else
				arabia -= lom.at(loma.size() - 1 - i);
		}
		cout << arabia << endl;
	}
}


Measured memory_bytes: 3176
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <cctype>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

int main(){
    int a,b;
    char op;
    cin >> a >> op >> b;
    if(op=='+') cout << a+b << endl;
    else cout << a-b << endl;
}


Measured memory_bytes: 256
N, K = map(int,input().split())
s = list(map(int,input().split()))
t = [0] * (N - K + 1)
k = 0
for i in range (K):
    k = k + s[i]
t[0] = k
for i in range(N - K):
    t[i + 1] = t[i] + s[i + K] - s[i]
A = max(t)
B = (A + K)/2
print(B)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main() {
    int n, k; cin >> n >> k;
    int ans = 1;
    while(1) {
        if(pow(k, ans) > n) break;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
def divceil(a, b):
    if a%b == 0:
        return a//b
    else:
        return a//b + 1

num = int(input())
arr = [list(map(int, input().split())) for i in range(num)]
 
t = 1
a = 1
r = 0
for i in range(num):
    r = max(divceil(t, arr[i][0]), divceil(a, arr[i][1]))
    t = arr[i][0] * max(r, 1)
    a = arr[i][1] * max(r, 1)
print(t + a)

Measured memory_bytes: 3188
def main():
    N = int(input())
    a = []
    itoa = 'abcdefghijklmnopqrstuvwxyz'
    while True:
        b = (N-1) % 26
        a.append(itoa[b])
        N = (N-1) // 26
        if N == 0:
            break
    print(''.join(reversed(a)))

if __name__ == '__main__':
    main()

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

using namespace std;
#define ll long long
const int N=2e5+5;
int a[N];
bool ball[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    cout<<a[n/2]-a[n/2-1]<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105;
int n,a[3][N],f[3][N];
int main(){
	//freopen("aa.in","r",stdin);
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=2;++i)for(j=1;j<=n;++j)scanf("%d",&a[i][j]);
	for(i=2;i;--i)for(j=n;j;--j)f[i][j]=max(f[i+1][j],f[i][j+1])+a[i][j];
	printf("%d",f[1][1]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = int(1e4+7);

int main() {
    int n, dp[1005][8]{}, a[1005];
    string s;
    cin >> n >> s;
    for(int i=0;i<n;i++){
        if(s[i]=='J') a[i] = 0;
        if(s[i]=='O') a[i] = 1;
        if(s[i]=='I') a[i] = 2;
    }
    dp[0][1] = 1;
    for(int i=0;i<n;i++){
        for(int j=1;j<8;j++){
            for(int k=1;k<8;k++){
                if(((k>>a[i])&1)==0 || (j&k)==0) continue;
                dp[i+1][k] += dp[i][j];
                dp[i+1][k] %= MOD;
            }
        }
    }
    int ans = 0;
    for(int i=1;i<8;i++) ans += dp[n][i];
    cout << ans%MOD << endl;
    return 0;
}


Measured memory_bytes: 3212
void main(){
	
	auto S = readln().chomp();
	auto T = readln().chomp();
	
	if ( S[] == T[0..$-1] ){
		writeln("Yes");
	} else {
		writeln("No");
	}
	
}



import std;


string readStr(){
	return readln().chomp();
}
T[] readLine( T = long )(){
	return readln().split().to!(T[])();
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;
typedef long long ll;

int main(){

 int n,m,x;
 cin>>n>>m;

  priority_queue<int>Q;
   for(int i=0;i<n;i++){
        cin>>x;
    Q.push(x); }

 long long sum=0;

 while(m--){

    int tops = Q.top();
    Q.pop();
    tops = tops/2;
    Q.push(tops);
 }

 while(!Q.empty()){
   // cout<<Q.top()<<endl;
    sum += Q.top();
    Q.pop();
 }

  cout<<sum<<endl;

 return 0;
}


Measured memory_bytes: 3916
#include<iostream>
#include<cctype>
#include<string>
using namespace std;
typedef string::const_iterator State;

int expression(State &);
int term(State &);
int factor(State &);
int number(State &);

int main(void){
  int N;
  cin >> N;
  cin.ignore();
  
  for(int i=0;i<N;i++){
    string s;
    getline(cin,s);

    State begin=s.begin();
    int ans=expression(begin);
    cout << ans << endl;
  }
  return 0;
}

int expression(State &begin){
  int ret=term(begin);
  
  while(1){
    if(*begin=='+'){
      begin++;
      ret+=term(begin);
    }
    else if(*begin=='-'){
      begin++;
      ret-=term(begin);
    }
    else break;
  }
  return ret;
}

int term(State &begin){
  int ret=factor(begin);
  
  while(1){
    if(*begin=='*'){
      begin++;
      ret*=factor(begin);
    }
    else if(*begin=='/'){
      begin++;
      ret/=factor(begin);
    }
    else break;
  }
  return ret;
}

int factor(State &begin){
  if(*begin=='('){
    begin++;
    int ret=expression(begin);
    begin++;
    return ret;
  }
  if(*begin=='-'){
    begin++;
    return -factor(begin);
  }
  return number(begin);
}

int number(State &begin){
  int ret=0;
  
  while(isdigit(*begin)){
    ret*=10;
    ret+=*begin-'0';
    begin++;
  }
  return ret;
}

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	vector<pair<int, int>> vec = {
		{400, 599},
		{600, 799},
		{800, 999},
		{1000, 1199},
		{1200, 1399},
		{1400, 1599},
		{1600, 1799},
		{1800, 1999}
	};
	int n;
	cin >> n;
	int count = 8;
	for (int i = 0; i < vec.size(); i++, count--) {
		if (vec[i].first <= n && n <= vec[i].second) {
			cout << count << endl;
			return 0;
		}
	}
	return 0;
}

//!

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

int main(){
    int H,W,D; cin >> H >> W >> D;
    vector<pair<int,int> > pos(H*W+1);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int a; cin >> a;
            pos[a] = make_pair(i,j);
        }
    }

    vector<int> dist(H*W+1,0);
    for(int i=0;i<=H*W;i++){
        if(i<=D){
            dist[i] = 0;
            continue;
        }
        int x = pos[i].first;
        int y = pos[i].second;
        int x_prev = pos[i-D].first;
        int y_prev = pos[i-D].second;
        dist[i] = dist[i-D] + abs(x-x_prev) + abs(y-y_prev);
    }
    int Q; cin >> Q;
    for(int i=0;i<Q;i++){
        int L,R; cin >> L >> R;
        cout << dist[R] - dist[L] << endl;
    }
    return 0;
}


Measured memory_bytes: 2176
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int q;
	cin>>q;
	while(q--){
		ll a,b;cin>>a>>b;
		if(a>b)swap(a,b);
		ll l=0,r=1000000010;
		while(r-l>1){
			ll h=(l+r)/2;
			if(h*h<a*b)l=h;
			else r=h;
		}
		ll c=l;
		if(a==b)cout<<2*a-2<<endl;
		else if(a+1==b)cout<<2*a-2<<endl;
		else if(c*(c+1)>=a*b)cout<<2*c-2<<endl;
		else cout<<2*c-1<<endl;
	}
}








Measured memory_bytes: 256
n=int(input())
res=0
a1=int(input())
if a1!=0:
  print(-1)
  exit()
try:a2=int(input())
except:
      print("0")
      exit()
for  i in range(n-2):
  if a2-a1>1:
    print("-1")
    exit()
  if a2<=a1:
    res+=a1
  a1=a2
  a2=int(input()) 
if a2-a1>1:
    print("-1")
    exit()
if a2<=a1:
    res+=a1
res+=a2
print(res)

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

using namespace std;
typedef long long ll;
ll n,h[100000+1];
ll dp[100000+1];
ll mo(ll x){
  if(x>0) return x;
  else return -x;
}
ll cal(int i){
  if(i>=n) return 0;
  if(dp[i]!=-1) return dp[i];
  ll res;
  if(i+2<=n)
  res=min(mo(h[i]-h[i+1])+cal(i+1),mo(h[i]-h[i+2])+cal(i+2));
  else res=mo(h[i]-h[i+1])+cal(i+1);
  return dp[i]=res;
}
int main() {
  memset(dp,-1,sizeof dp);
  cin>>n;
  for(int i=1; i<=n; i++){
    cin>>h[i];
  }
  ll ans = cal(1);
  cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

template<typename T>
T gcd(T a, T b){
    if(b > a) swap(a, b);
    T tmp;
    while(b != 0){
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

template<typename T>
T lcm(T a, T b){
    return a * b / gcd(a, b);
}

ll A, B;

signed main(){
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    s += '0';
    int n = s.size();

    vector<vector<ll>> dp(s.size() + 10, vector<ll>(2, INF));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, 2) {
            int x = s[i] - '0';
            x += j;
            rep(a, 10) {
                int ni = i + 1, nj = 0;
                int b = a - x;
                if (b < 0) {
                    nj = 1;
                    b += 10;
                }
                dp[ni][nj] = min(dp[ni][nj], dp[i][j] + a + b);
            }

        }
    }
    int ans = dp[n][0];
    cout << ans << endl;
}


Measured memory_bytes: 58740
H, W = map(int, raw_input().split())
c = []

for i in range(10):
    ci = map(int, raw_input().split())
    c.append(ci)

A = []

for i in range(H):
    ai = map(int, raw_input().split())
    A.append(ai)


dp = [[0]*10 for _ in range(10)]

for i in range(10):
    for j in range(10):
        dp[i][j] = c[i][j]

for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j])


ans = 0
for i in range(H):
    for j in range(W):
        item = A[i][j]
        if item != -1:
            ans = ans + dp[item][1]

print ans


Measured memory_bytes: 2948
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nc = Input.ar;
        var ds = Enumerable.Repeat(0, nc[1]).Select(v => Input.ar).ToArray();
        var color = Enumerable.Repeat(0, nc[0]).Select(v => Input.ar).ToArray();
        var ct = new int[3, nc[1] + 1];
        for(var i=0;i<nc[0];i++)
            for(var j = 0; j < nc[0]; j++)
            {
                var mod = (i + j) % 3;
                ct[mod, color[i][j]]++;
            }
        var res = int.MaxValue;
        for (var i=0;i<nc[1];i++)
            for(var j=0;j<nc[1];j++)
                for(var h = 0; h < nc[1]; h++)
                {
                    if (i == j || j == h || i == h) continue;
                    var ar = new[] { i, j, h };
                    var sum = 0;
                    for (var k = 0; k < 3; k++)
                        for (var c = 1; c <= nc[1]; c++)
                            sum += ct[k, c] * ds[c - 1][ar[k]];
                    res = Min(res, sum);
                }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  
static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 18756
import sys
n,m = map(int, input().split( ))
a = [] 

mod = 10**9+7
for _ in range(m):
    a.append(int(input()))

dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1
if a:
    if a[0]==1:
        dp[1] = 0

A = set(a)
 
for i in range(2,n+1):
    if i not in A:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[n])




Measured memory_bytes: 56664
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int A1,A2,A3;
   scanf("%d%d%d",&A1,&A2,&A3);
   if ( A1 >=1 && A1<=13 && A2>=1 && A2<=13 && A3>=1 && A3<=13 ){
   if (A1+A2+A3>=22 )
        printf("bust");
   else printf("win");
   }
   else printf("invalid");


    return 0;
}


Measured memory_bytes: 128
// AOJ GRL_2_A Minimum Spanning Tree
// 2018.4.26 bal4u

#include <stdio.h>
#include <string.h>

#define MAX_V 10002

/* UNION-FIND library */
int id[MAX_V], size[MAX_V];
void init(int n) { int i; for (i = 0; i < n; i++) id[i] = i, size[i] = 1; }
int root(int i) { while (i != id[i]) id[i] = id[id[i]], i = id[i]; return i; }
int connected(int p, int q) { return root(p) == root(q); }
void unite(int p, int q)
{
    int i = root(p), j = root(q); if (i == j) return;
    if (size[i] < size[j]) id[i] = j, size[j] += size[i]; else id[j] = i, size[i] += size[j];
}

typedef struct { int s, t, w; } EDGE;
EDGE edge[100002], edge2[100002], *end; int m;

#define VMAX 10000
int f[VMAX+1];

void distsort(int m)
{
	int i, x;
	EDGE *ep;

//	memset(f, 0, sizeof(f));
	end = edge + m;
	for (ep = edge; ep < end; ep++) f[ep->w]++;
	for (i = 0; i <= 10000; i++) f[i] += f[i-1];
	for (i = m-1; i >= 0; i--) {
		x = edge[i].w, edge2[--f[x]] = edge[i];
	}
}

int kruskal(int V, int E)
{
	int ans;
	EDGE *ep;

	distsort(E);
	init(V); 
	ans = 0;
	ep = edge2;	while (E--) {
		if (!connected(ep->s, ep->t)) { 
			unite(ep->s, ep->t);
			ans += ep->w;
		}
		ep++;
	}
	return ans;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int main()
{
	int V, E, i;

	V = in(), E = in();
	for (i = 0; i < E; i++) {
		edge[i].s = in(), edge[i].t = in(), edge[i].w = in();
	}
	printf("%d\n", kruskal(V, E));
	return 0;
}



Measured memory_bytes: 4188
#include <iostream>
#include <array>
#include <iomanip>
#include <utility>
#include <string>
#include <map>
#include <algorithm> //using for swap()
using namespace std;
 
array<pair<char,int>,100001> A;

map<int,pair<string,int>> dat; 

int Partition(int p,int  r){
    int x = A[r].second;
    int i = p-1;
    for(int j=p;j<r;j++){
        if(A[j].second <= x){
            i++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

void quick(int p,int r){
    if(p<r){
        int q = Partition(p,r);
        quick(p,q-1);
        quick(q+1,r);
    }
}
 
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
	    char tmp1;
        int  tmp2;
        cin>>tmp1>>tmp2;
        A[i].first =tmp1;
	    A[i].second=tmp2;
        if(dat.count(tmp2)==0){
            string s="";
            s+=tmp1;
            dat.insert(map<int,pair<string,int>>::value_type
                    (tmp2,pair<string,int>(s,0)));
        }else{
            dat[tmp2].first=dat[tmp2].first+tmp1;
        }
    }
    quick(0,n-1);
    bool isStable=true;
    for(int i=0;i<n;i++){
         if(dat[A[i].second].first[dat[A[i].second].second]!=
             A[i].first){
             isStable=false;
         }
         dat[A[i].second].second++;
    }
    if(isStable){
        cout<<"Stable"<<endl;
    }else{
        cout<<"Not stable"<<endl;
    }
    for(int i=0;i<n;i++){
	   cout<<A[i].first<<" "<<A[i].second<<endl;
    }
    return 0;
}

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

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

const int mod = 10;
int k;
int ans;

void calc(const int idx, vector<int> rests, const int sum) {
	if(idx == k) {
		chmin(ans, sum);
		return;
	}
	if(rests[idx] == 0) {
		calc(idx + 1, rests, sum);
		return;
	}

	const int next_sum = sum + 1;
	if(next_sum >= ans) return;
	const int next_idx = idx + 1;

	calc(next_idx, rests, next_sum);
	for(int i = idx + 1; i < k; ++i) {
		rests[i] = (rests[i] - rests[idx] + mod) % mod;
		calc(next_idx, rests, next_sum);
	}
}

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

	while(cin >> k && k) {
		string initial, unlock;
		cin >> initial >> unlock;

		vector<int> rests(k);
		for(int i = 0; i < k; ++i) {
			rests[i] = (unlock[i] - initial[i] + mod) % mod;
		}

		ans = k;
		calc(0, rests, 0);
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_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); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll a, b;
    cin >> a >> b;
    if(a <= 5) cout << 0 << endl;
    else if(a <= 12) cout << b/2 << endl;
    else cout << b << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
num_bill, y = map(int, input().split())
num_1000, num_5000, num_10000 = 0, 0, 0

for num_10000 in range(y // 10000 + 1):
        
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()
        
        num_1000 = num_bill - num_10000 - num_5000
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int A,B,C;cin >> A >> B >> C;
    cout<<min({A+B,B+C,C+A})<<endl;
}


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

int main(void)
{
  int x, n, over, low;
  char list[100+1] = {};
  cin >> x >> n;
  for (int i = 0; i < n; i++) {
    int in = 0;
    cin >> in;
    list[in] = 1;
  }
  if (list[x] == 0){
    cout << x << endl;
    return 0;
  }

  over = 101;
  for (int i = x+1; i <= 100; i++) {
    if (list[i] == 0){
      over = i;
      break;
    } 
  }
  low = -1;
  for (int i = x-1; i >= 0 ; i--) {
    if (list[i] == 0){
      low = i;
      break;
    } 
  }
  if (over - x < x - low ) cout << over << endl;
  else cout << low << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<ll> c(n);
  vector<vector<ll>> a(n,vector<ll>(m));
  for(int i=0;i<n;i++){
    cin >> c[i];
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }

  ll ans = 10000000000;
  vector<ll> sums(m);
  ll sum;
  bool flag = true;
  for(int b=0;b<(1<<n);b++){
    sum = 0;
    sums.assign(m,0);
    for(int i=0;i<n;i++){
      if(b & (1<<i)){
        sum += c[i];
        for(int j=0;j<m;j++){
          sums[j] += a[i][j];
        }
      }
    }

    for(int i=0;i<m;i++){
      if(sums[i] < x){
        break;
      }
      if(i == m-1){
        ans = min(ans,sum);
        flag = false;
      }
    }
  }

  if(flag){
    ans = -1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>

using namespace std;

struct Node {
    int key;
    Node *parent,*left,*right;
};

Node *root,*NIL;

void insert(int k) {
    Node *y=NIL;
    Node *x=root;
    Node *z;

    z=new Node;
    z->key=k;
    z->left=NIL;
    z->right=NIL;
    while(x!=NIL) {
        y=x;
        if(z->key < x->key) {
            x=x->left;
        }
        else {
            x=x->right;
        }
    }

    z->parent=y;
    if(y==NIL) {
        root=z;
    }
    else {
        if(z->key<y->key) y->left=z;
        else y->right=z;
    }
}

bool find(int k) {
    Node *v=root;
    while(v!=NIL) {
        if(k==v->key) return true;
        if(k<v->key) {
            v=v->left;
        }
        else {
            v=v->right;
        }
    }

    return false;
}

void inorder(Node *u) {
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u==NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n,x;
    string com;

    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>com;
        if(com=="insert") {
            cin>>x;
            insert(x);
        }
        else if(com=="print") {
            inorder(root);
            cout<<endl;
            preorder(root);
            cout<<endl;
        }
        else if(com=="find") {

            cin>>x;
            if(find(x)) cout<<"yes"<<endl;
            else cout<<"no"<<endl;

        }
    }

    return 0;

}

Measured memory_bytes: 19984
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using ll = long long int;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 373;

#define rep(i, n) for (int i = 0; i < (n); ++i)

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> init_vector2(size_t n0, size_t n1, T e = T()) {
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> init_vector3(size_t n0, size_t n1, size_t n2, T e = T()) {
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

/*
1~nまでの数をそれぞれ素因数分解→
指数部を合わせることでn!の素因数分解になる

p^4*q^4*r^2
p^14*q^4
p^24*q^2
となるようなpqrの組を全探査する。

このとき、2^4*3^4*5^2は75数だけど
4^4*3^4*5^2は75数じゃないことを意識すること
ライブラリの素因数分解を改良して複数のやつを
まとめてカウントできるようにする
 */
vector<int> c;
void prime_fact(int n){
    ;int k=n;bool flag;
    while(k>1)
    {
        int s=sqrt(k)+1;
        flag=false;
        int i=2;
        while(k%i!=0){
            if(i>=s){
                flag=1;break;
            }
            i++;
        }
        if(flag)
        {
            c[k]++;
            k=1;
        }
        else{
            k/=i;
            c[i]++;
        }
    }
    return ;
}
int main(){
    int n;cin>>n;
    c.resize(n+1);
    rep(i,n+1)  c[i]=0;
    for(int i=2;i<n+1;i++){
        prime_fact(i);
    }
    int ov75=0,ov25=0,ov15=0,ov5=0,ov3=0;
    for(int i=2;i<n+1;i++){
        if(c[i]>=74) ov75++;
        if(c[i]>=24) ov25++;
        if(c[i]>=14) ov15++;
        if(c[i]>=4)  ov5++;
        if(c[i]>=2)  ov3++;
    }
    cout<<(ov75+ov25*(ov3-1)+ov15*(ov5-1)+(ov5*(ov5-1)*(ov3-2))/2)<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
 * src.cpp
 *
 *  Created on: 2016/07/29
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=30,MAX_X=1e6;

int n,x;
int l[MAX_N];

bool prime[MAX_X+1];

void sieve(){
	memset(prime,1,sizeof(prime));
	prime[0]=false;
	for (int i=2;i*i<=MAX_X;i++){
		if (prime[i]){
			for (int j=2*i;j<=MAX_X;j+=i){
				prime[j]=false;
			}
		}
	}
}

bool dp[MAX_X+1];

int main(){
	sieve();
	do{
		cin>>n>>x;
		if (n || x){
			REP(i,n){
				cin>>l[i];
			}
			memset(dp,0,sizeof(dp));
			dp[0]=true;
			REP(i,n){
				FOR(j,l[i],x+1){
					dp[j]|=dp[j-l[i]];
				}
			}
			int res=-1;
			for(int i=x;i>=1;i--){
				if (dp[i] && prime[i]){
					res=i;
					break;
				}
			}
			if (res==-1){
				cout<<"NA"<<endl;
			}else{
				cout<<res<<endl;
			}
		}
	}while (n || x);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int64_t lucas[87];
  lucas[0] = 2;
  lucas[1] = 1;
  for(int i = 2; i <= n; i++) {
    lucas[i] = lucas[i - 1] + lucas[i - 2];
  }
  cout << lucas[n] << endl;
}


Measured memory_bytes: 256
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

def main():
    s,t = input().split()
    a,b  = map(int, input().split())
    u = input().split('\n')[0]
    
    if s==u:
        print(a-1,b)
    else:
        print(a, b-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 5568
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	ans := 0
	for i := 1; i < n-1; i++ {
		if a[i-1] < a[i] && a[i] < a[i+1] {
			ans++
		} else if a[i-1] > a[i] && a[i] > a[i+1] {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
fn main() {
    let (a, b, c) = input();

    println!("{}", if a < b && b < c { "Yes" } else { "No" });
}

fn input() -> (i32, i32, i32) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut i = s.trim().split_whitespace().map(|q| q.parse::<i32>().unwrap());

    (i.next().unwrap(), i.next().unwrap(), i.next().unwrap())
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c[3];
	cin >> a >> b;
	c[0] = a + b;
	c[1] = a - b;
	c[2] = a * b;
	sort(c, c + 3);
	cout << c[2] << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    A_lsit = list(map(int, input().split()))

    counter = 0
    for i in range(0, N, 2):
        if A_lsit[i]%2 == 1:
            counter += 1
    print(counter)

if __name__ == "__main__":
    main()



Measured memory_bytes: 9112
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
even = Counter(v[::2])
odd = Counter(v[1::2])
em = even.most_common(1)[0]
om = odd.most_common(1)[0]
ans = 0
if em[0] != om[0]:
    ans = n - em[1] - om[1]
else:
    if len(even) == 1 and len(odd) == 1:
        ans = n // 2
    elif len(even) == 1:
        osm = odd.most_common(2)[1]
        ans = n - em[1] - osm[1]
    elif len(odd) == 1:
        esm = even.most_common(2)[1]
        ans = n - om[1] - esm[1]
    else:
        esm = even.most_common(2)[1]
        osm = odd.most_common(2)[1]
        ans = min(n - em[1] - osm[1], n - om[1] - esm[1])
print(ans)

Measured memory_bytes: 62340
h,w=map(int,input().split())
ans=[]
ans.append(['#']*(w+2))
for i in range(h):
  a=list(input().split())
  a.insert(0,'#')
  a.append('#')
  ans.append(a)
ans.append(['#']*(w+2))
for i in ans:
  print(''.join(i))

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

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

    int WA = 0, TLE = 0, AC = 0, RE = 0;
    while (n--)
    {
        string s;
        cin >> s;

        if (s[0] == 'W')
            WA++;
        else if (s[0] == 'T')
            TLE++;
        else if (s[0] == 'A')
            AC++;
        else
            RE++;
    }

    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;

    return 0;
}


Measured memory_bytes: 3596
// ABC054A - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

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

	if (A == 1) {
		A = 14;
	}
	if (B == 1) {
		B = 14;
	}

	if (A > B) {
		cout << "Alice" << endl;
	} else if (A < B) {
		cout << "Bob" << endl;
	} else {
		cout << "Draw" << endl;
	}

	return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  set<int> even;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i % 2 == 0) even.insert(A[i]);
  }
  vector<int> B = A;
  sort(B.begin(), B.end());
  int cnt = 0;
  for (int i = 1; i < N; i += 2) {
    if (even.find(B[i]) != even.end()) cnt++;
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 3456
k = int(input())
A = [1,2,3,4,5,6,7,8,9]
for i in A:
    if len(A) > k:
        break
    x = i%10
    for j in range(max(x-1, 0), min(x+2, 10)):
        A.append(10*i+j)
print(A[k-1])

Measured memory_bytes: 7316
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}




int main(){//
	int k;
	cin >> k;
	vector<int> r(k), c(k);
	vector<vector<char>> chess(8, vector<char>(8, '.'));
	vector<P> Q_place(0);
	vector<bool> is_used_r(8, false), is_used_c(8, false);
	for(int i=0; i<k; i++){
		cin >> r[i] >> c[i];
		chess[r[i]][c[i]] = 'Q';
		Q_place.push_back(P(r[i], c[i]));
		is_used_r[r[i]] = true;
		is_used_c[c[i]] = true;
	}
	
	vector<int> vec_c(0);//vec_r(0), vec_c(0);
	for(int i=0; i<8; i++){
		//if(is_used_r[i] == false) vec_r.push_back(i);
		if(is_used_c[i] == false) vec_c.push_back(i);
	}
	// cout << " vec_c: "; print_vec(vec_c);
	// cout << " is_used_r: "; print_vec(is_used_r);
	// cout << " is_used_c: "; print_vec(is_used_c);
	do{
		vector<vector<char>> board = chess;
		vector<P> Q_p = Q_place;
		int cnt = 0;
		for(int i=0; i<8; i++){
			//cout << " i: " << i << endl;
			if(is_used_r[i] == true) continue;
			board[i][vec_c[cnt]] = 'Q';
			Q_p.push_back(P(i, vec_c[cnt]));
			cnt++;
			
		}

		// cout << "-----------------------------" << endl;
		// for(int i=0; i<8; i++){
		// 	for(int j=0; j<8; j++){
		// 		cout << board[i][j];
		// 	}
		// 	cout << endl;
		// }
		// cout << "-----------------------------" << endl;

		bool is_ok = true;
		for(int i=0; i<8; i++){
			for(int j=i+1; j<8; j++){
				
				int a = Q_p[i].first - Q_p[j].first;
				int b = Q_p[i].second - Q_p[j].second;
				if(a == b || a == -b) is_ok = false;
			}
		}

		if(is_ok == true){
			// for(int i=0; i<8; i++){
			// 	cout << "(" << Q_p[i].first << ", " << Q_p[i].second << ")  " << endl;
			// }

			for(int i=0; i<8; i++){
				for(int j=0; j<8; j++){
					cout << board[i][j];
				}
				cout << endl;
			}
			return 0;
		}
		

	}while(next_permutation(vec_c.begin(), vec_c.end()));


}



Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void)
{
	int N;
	
	cin >> N;
	vector<long long int> A(N);

	for(int i = 0; i < N; i++)
	{
		cin >> A[i];
		if(A[i] == 0)
		{
			cout << 0 << endl;
			return 0;
		}
	}
	
	double log10_total = 0;	
	long long int mult_result = 1;

	for(int i = 0; i < N; i++)
	{
		if( A[i] <= 1000000000000000000 / mult_result)
		{
			mult_result *= A[i];
		}
		else
		{
			cout << -1 << endl;
			return 0;
		}
	}

	cout << mult_result << endl;
	return 0;
}


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

int main() {
  /* code */
  int a,b;

  cin >> a >> b;

  if (a > b) {
    /* code */
    cout << "a > b"<< '\n';
  }else if(a < b){
    cout << "a < b" << '\n';
  }else{
    cout <<"a == b"<<'\n';
  }
  return 0;
}



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

int N;

int main(){

  int N;
  std::set<int> s;

  cin >> N;
  
  int buf;
  int countOver3200 = 0;
  for(int i = 0; i < N; i++){
    cin >> buf;
    if(buf > 3200) buf = 3200;
    buf /= 400;
    s.insert(buf);
    if(buf == 8){
      countOver3200++;
    }
  }

  int min, max;

  //minの計算
  if((s.size() - (countOver3200 > 0)) == 0){
    min = 1;
  }else{
    min = s.size() - (countOver3200 > 0);
  }

  //maxの計算
  /*
  if(s.size() + countOver3200  - (countOver3200 > 0) > 8){
    max = 8;
  }else{
    max = s.size() + countOver3200 - (countOver3200 > 0);
  }
  */
  max = s.size() + countOver3200 - (countOver3200 > 0);

  cout << min << " " << max << endl;
  
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    vector<vector<int>>a(3,vector<int>(3));
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }
    int n;cin>>n;
    vi b(n);
    rep(i,n){
        cin>>b[i];
    }
    rep(i,3){
        rep(j,3){
            rep(k,n){
                if(a[i][j]==b[k]){
                    a[i][j]=0;
                }
            }
        }
    }
    rep(i,3){
        bool b=true;
        rep(j,3){
            if(a[i][j]!=0){
                b=false;break;
            }
        }
        if(b){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    rep(i,3){
        bool b=true;
        rep(j,3){
            if(a[j][i]!=0){
                b=false;break;
            }
        }
        if(b){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    if(a[0][0]==0&&a[1][1]==0&&a[2][2]==0){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(a[0][2]==0&&a[1][1]==0&&a[2][0]==0){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int num, num1, num2, num3;
	
	scanf("%d", &num);
	
	num1 = num / 100;
	num2 = (num % 100) / 10;
	num3 = num % 10;
	
	if (num1 == 7 || num2 == 7 || num3 == 7) {
		puts("Yes");
	}
	else {
		puts("No");
	}
	
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;




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

	vector<int> v(m);
	rep(i, 0, m) {
		cin >> v[i];
	}

	int INF = 101010;
	//i種類目までのコインを使ってj円払う最小枚数
	vector< vector<int> >dp(m+1,vector<int>(n+1,0));


	rep(i, 0, m + 1) {
		rep(j, 0, n + 1) {
			dp[i][j] = INF;
		}
	}

	dp[0][0] = 0;
	rep(i, 0, m) {
		rep(j, 0, n+1) {
			if (j-v[i] >= 0) {
				dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - v[i]] + 1);
			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}

	cout << dp[m][n] << endl;
	
	return 0;

}


Measured memory_bytes: 7036
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC124A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');//キーボードからスペース区切りで数値を入力する
            int A = int.Parse(input[0]);//はじめの数値を整数型の変数Ａに代入します
            int B = int.Parse(input[1]);//二番目の数値を整数型の変数Ｂに代入します

            int ans = 0;//答えを入れる整数型の変数ansを用意します。

            if (A > B) //もしもＡが大きいなら、ansにＡを入れておく。　Ａを1だけ小さくする
            {
                ans = A;
                A = A - 1;
            } //もしもＢが大きいなら、ansにＢを入れておく　Ｂを1だけ小さくする
            else
            {
                ans = B;
                B = B - 1;
            }

            if (A > B)//もう一回　Ａが大きいならansにＡを加える
            {
                ans = ans + A;
            }
            else//Ｂが大きいならansにＢを加える
            {
                ans = ans + B;
            }
            Console.WriteLine(ans);//答えを出力する
        }
    }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> A(Q), B(Q), C(Q), D(Q);
  for (int i = 0; i < Q; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    A[i]--, B[i]--;
  }
  int res = 0;
  vector<int> X(N, 1);
  while (X[0] != M) {
    int sum = 0;
    for (int i = 0; i < Q; i++) {
      if (X[B[i]] - X[A[i]] == C[i]) sum += D[i];
    }
    res = max(res, sum);
    int idx = 0;
    for (int i = N - 1; i > -1; i--) {
      X[i]++;
      if (X[i] > M) continue;
      idx = i;
      break;
    }
    for (int i = idx + 1; i < N; i++) {
      X[i] = X[i - 1];
    }
  }
  int sum = 0;
  for (int i = 0; i < Q; i++) {
    if (X[B[i]] - X[A[i]] == C[i]) sum += D[i];
  }
  res = max(res, sum);
  cout << res << '\n';
  return 0;
}


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

#define ll long long
#define INF 1234567890
#define N (int)(1e5 + 5)
#define pi acos(-1)

ll dp[N], ww[101], vv[101], sum;
bool viz[N];

void solve()
{
   int n, w;
   cin >> n >> w;
   for(int i = 1; i <= n; ++i)
       cin >> ww[i] >> vv[i], sum += vv[i];
    for(int i = 1; i <= sum; ++i) dp[i] = INF;
   for(int i = 1; i <= n; ++i)
   {
       viz[0] = 1;
       for(int j = sum - vv[i]; j >= 0; --j)
        if(viz[j] && dp[j] + ww[i] <= w)
        viz[j + vv[i]] = 1, dp[j + vv[i]] = min(dp[j + vv[i]], dp[j] + ww[i]);
   }
   ll maxim = -INF;
   for(int i = 1; i <= sum; ++i)
    if(viz[i]) maxim = i;
    cout << maxim;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


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

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

void solve(long long N) {
    string ans;
    N--;
    do {
        ans += ('a' + (N % 26));
        N /= 26;
        N--;
    } while(0 <= N);
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[100000];
  rep(i,n) cin>>a[i];
  sort(a,a+n);
  int num=a[n/2]-a[(n/2)-1];
  cout<<num<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>

using LL = long long ;
const int kN = 100000 + 5;
int n;
double a[kN], b[kN], c[kN];
double v[kN];
std::pair<double, double> f[kN];

struct Umr {
    std::vector<double> x;

    Umr() = default;

    Umr(double *begin, double *end) : x(begin, end)
    {
        std::sort(x.begin(), x.end());
        x.erase(std::unique(x.begin(), x.end()), x.end());
    }

    int get(double val) const
    {
        return std::lower_bound(x.begin(), x.end(), val) - x.begin();
    }
} sv;

struct Fenwick {
    int cnt[kN];

    void clear()
    {
        memset(cnt, 0, sizeof(cnt));
    }

    void modify(int p, int dt)
    {
        for (int i = p; i < kN; i += ~i & i + 1) cnt[i] += dt;
    }

    int query(int p)
    {
        int ret = 0;
        for (int i = p; i >= 0; i -= ~i & i + 1) ret += cnt[i];
        return ret;
    }
} bit;

LL calc(double mid)
{
    for (int i = 0; i < n; ++ i) {
        f[i] = std::make_pair(-a[i] / b[i], (c[i] - a[i] * mid) / b[i]);
        v[i] = f[i].second;
    }
    sv = Umr(v, v + n);
    bit.clear();
    std::sort(f, f + n);
    LL ret = 0;
    for (int i = 0; i < n; ++ i) {
        ret += bit.query(sv.get(f[i].second));
        bit.modify(sv.get(f[i].second), 1);
    }
    return ret;
}

double solve()
{
    double l = -1e9, r = 1e9;
    for (int step = 0; step < 120; ++ step) {
        double mid = (l + r) * .5;
        LL cnt = calc(mid);
        if (cnt * 2 < n * 1LL * (n - 1) / 2)
            l = mid;
        else r = mid;
    }

    return r;
}

void work()
{
    double x = solve();
    for (int i = 0; i < n; ++ i)
        std::swap(a[i], b[i]);
    double y = solve();

    printf("%.13f %.13f\n", x, y);
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%lf%lf%lf", a + i, b + i, c + i);
    }
    work();
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__);
 
int main(){
    dcl(n,a);

    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(51,vector<ll>(2501,0)));
    dp[0][0][0]=1;
    
    ll ans=-1;
    
    rep(i,n){
        dcl(x);
        rep(j,51){
            rep(k,2501){
                if(dp[i][j][k]){
                    dp[i+1][j][k]+=dp[i][j][k];
                    dp[i+1][j+1][k+x]+=dp[i][j][k];
                }
            }
        }
    }
    rep(j,51)rep(k,2501){
        if(j*a==k){
            ans+=dp[n][j][k];
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 52224
#include<stdio.h>
	int main(){
		int n,i,g,a,b,c;
		double h,max,e;
		while(scanf("%d",&n),n){
			max=10000000;
			for(i=0;i<n;i++){
				scanf("%d %d %d",&a,&b,&c);
				h=(double)10000*c/b/b;
				if(h<22)
					e=22-h;
				else e=h-22;
				if(e<max){
					g=a;
					max=e;
				}
			}
			printf("%d\n",g);
		}
		return 0;
}

Measured memory_bytes: 0