akhauriyash/Code-Regression huggingface dataset:
n = (int(input()))
if n ==1:
    print(1)
li = []
for i in range(1,n+1):
    if i%2 == 0:
        li.append(i)

li = [bin(x) for x in li]
li = li[::-1]
for i in range(len(li)):
    
    if li[i].count(str(1)) == 1:
        a=((li[i].count(str(0)) -1))
        print(2**a)
        break


Measured memory_bytes: 3064
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;


int main()
{
    IOS
    ll n;
    cin>>n;
    vector<pll>a;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        a.pb({y,x});
    }
    sort(a.begin(),a.end());
  //  reverse(a.begin(),a.end());
    ll cur=0;
    for(pll p:a)
    {                           
        ll lmt=p.first;
        ll req=p.second;           
        cur+=req;
        if(cur>lmt)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 6512
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <complex>
#include <iomanip>
#include <random>

using namespace std;

typedef long long ll;
#define int ll

const int M = 998244353;
#define msum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define msub(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define mmult(a, b) (((a) * (b)) % M)

typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SZ(a) ((int)(a).size())
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);
const int oo = 1e9 + 100;
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


int d[100][100][100];
bool us[100][100][100];
queue <int> aa, bb, cc;

void push(int a, int b, int c, int dd)
{
	if (!us[a][b][c] && a < 100 && b < 100 && c < 100)
	{
		aa.push(a);
		bb.push(b);
		cc.push(c);
		us[a][b][c] = true;
		d[a][b][c] = dd + 1;
	}
}

void pop()
{
	aa.pop();
	bb.pop();
	cc.pop();
}



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

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



	push(a, b, c, -1);

	while (!aa.empty())
	{
		a = aa.front();
		b = bb.front();
		c = cc.front();
		pop();

		if (a == b && b == c)
		{
			cout << d[a][b][c];
			return 0;
		}
		int dd = d[a][b][c];

		push(a + 1, b + 1, c, dd);
		push(a + 1, b, c + 1, dd);
		push(a, b + 1, c + 1, dd);
		push(a + 2, b, c, dd);
		push(a, b + 2, c, dd);
		push(a, b, c + 2, dd);

	}

}


Measured memory_bytes: 8448
#include<cstdio>
struct edge{
	int to,nx;
}e[5000001];
int n,h[100001],p,d1[100001],d2[100001];
void ae(int fr,int to){e[++p]=(edge){to,h[fr]};h[fr]=p;}
void dfs1(int u,int fa,int d){d1[u]=d;for(int i=h[u];i;i=e[i].nx)if(e[i].to!=fa)dfs1(e[i].to,u,d+1);}
void dfs2(int u,int fa,int d){d2[u]=d;for(int i=h[u];i;i=e[i].nx)if(e[i].to!=fa)dfs2(e[i].to,u,d+1);}
int main(){
	scanf("%d",&n);for(int i=1,a,b;i<n;i++) scanf("%d%d",&a,&b),ae(a,b),ae(b,a);
	dfs1(1,-1,0);dfs2(n,-1,0);
	int s1=0,s2=0;
	for(int i=1;i<=n;i++)if(d1[i]<=d2[i])s1++;else s2++;
	return 0*printf("%s",s1>s2?"Fennec":"Snuke");
}

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


int l[7],h[7] ={};
int N;
struct Condition{
	int finished;
	int unprocessed;
	int lb,ub;
};

bool operator < (const Condition &a,const Condition &b){
	return 	array<int,4>{a.finished,a.unprocessed,a.lb,a.ub} < 
			array<int,4>{b.finished,b.unprocessed,b.lb,b.ub};
}
typedef set<Condition> Conditions;

Conditions trans(Condition c,int d){
	if( c.finished == N ) return {};
	if( c.unprocessed != -1 ){
		if( d < c.lb or d > c.ub ) return {};
		c.unprocessed = -1;
		c.finished++;
		c.lb = l[c.finished];
		c.ub = h[c.finished];
		return {c};
	}else{
		Conditions res;
		if( c.ub >= 10 ){
			if( max(1,c.lb / 10) <= d and d <= c.ub / 10 ){
				auto cpy = c;
				cpy.unprocessed = cpy.finished;
				
				cpy.lb = 0;
				cpy.ub = 9;
				if( c.lb / 10 == d ){
					cpy.lb = c.lb % 10;
				}
				if( c.ub / 10 == d ){
					cpy.ub = c.ub % 10;
				}
				res.insert(cpy);
			}
		}
		
		
		
		if( c.lb <= d and d <= c.ub ){
			auto cpy = c;
			cpy.unprocessed = -1;
			cpy.finished++;
			cpy.lb = l[cpy.finished];
			cpy.ub = h[cpy.finished];
			res.insert(cpy);
		}
		return res;
	}
}
map<Conditions, long long> memo;
long long dfs(Conditions c){	
	if( c.size() == 0 ) return 0;
	if( memo.count(c) ) return memo[c];

	long long ans = 0;
	for( auto e : c ){
		if( N == e.finished ) ans = 1;
	}
	for(int i = 0 ; i <= 9 ; i++){
		Conditions nc;
		for( auto e : c ){
			auto tmp = trans(e,i);
			nc.insert(tmp.begin(),tmp.end());
		}
		ans += dfs(nc);
	}
	return memo[c] = ans;
}
int main(){
	
	while(cin >> N&&N){
		memo.clear();
		for(int i = 0 ; i < N ; i++){
			cin >> l[i] >> h[i];
		}
		cout << dfs({Condition{0,-1,l[0],h[0]}}) << endl;
	}
	
	
	
	
}

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

int main() {
  int A,B;
  cin >> A >>B;
  int N;
  int S=0;
  
  N = A;
  while (N <= B){
  	int a,b,c,d,e;
    a = N % 10;
    b = (N % 100 - N % 10) / 10;
    c = (N % 1000 - N % 100) / 100;
    d = (N % 10000 - N % 1000) / 1000;
    e = (N % 100000 - N % 10000) / 10000;
    
    if (a==e && b==d){
    	S ++;
    }
    
    N +=1;
  }
  
  cout << S;
}






Measured memory_bytes: 3568
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define mem(x,y)		(x*)malloc(sizeof(x)*(y));

typedef struct _star
{
	struct _star* more;
	struct _star* less;
	int x;
	int y;
} star;

int search(int x,int y,star* tree)
{
	fprintf(stderr,"%d %d\n",x,y);
	while(1)
	{
		if(x == tree->x && y == tree->y)
			return 1;
		else if(x > tree->x || (x == tree->x && y > tree->y))
		{
			if(tree->more != NULL)
			{
				tree = tree->more;
				continue;
			}
			else
			{
				fprintf(stderr,"tree:%d %d\n",tree->x,tree->y);
				return 0;
			}
		}
		else
		{
			if(tree->less != NULL)
			{
				tree = tree->less;
				continue;
			}
			else
			{
				fprintf(stderr,"tree:%d %d\n",tree->x,tree->y);
				return 0;
			}
		}
	}
}

int find(int x,int y,star** list,int length)
{
	int i;
	for(i = 0;i < length;i++)
	{
		if(x == list[i]->x && y == list[i]->y)
			return 1;
	}
	return 0;
}

int main()
{
	int m,n,i,j;
	int** contlist;
	star startree;
	star** starlist;
	while(scanf("%d",&m),m)
	{
		contlist = mem(int*,m);
		for(i = 0;i < m;i++)
		{
			contlist[i] = mem(int,2);
			scanf("%d %d",&contlist[i][0],&contlist[i][1]);
		}
		scanf("%d",&n);
		starlist = mem(star*,n);
		star* pt = &startree;
		starlist[0] = &startree;
		int x,y;
		scanf("%d %d",&x,&y);
		pt->x = x;
		pt->y = y;
		pt->more = NULL;
		pt->less = NULL;
		for(i = 1;i < n;i++)
		{
			int x,y;
			scanf("%d %d",&x,&y);
			while(1)
			{
				if(x > pt->x || (x == pt->x && y > pt->y))
				{
					if(pt->more != NULL)
					{
						pt = pt->more;
						continue;
					}
					else
					{
						starlist[i] = pt->more = mem(star,1);
						pt = pt->more;
						pt->x = x;
						pt->y = y;
						pt->more = NULL;
						pt->less = NULL;
						break;
					}
				}
				else
				{
					if(pt->less != NULL)
					{
						pt = pt->less;
						continue;
					}
					else
					{
						starlist[i] = pt->less = mem(star,1);
						pt = pt->less;
						pt->x = x;
						pt->y = y;
						pt->more = NULL;
						pt->less = NULL;
						break;
					}
				}
			}
		}
		for(i = 0;i < n;i++)
		{
			int disx = starlist[i]->x-contlist[0][0];
			int disy = starlist[i]->y-contlist[0][1];
			for(j = 1;j < m;j++)
			{
				//if(search(contlist[j][0]+disx,contlist[j][1]+disy,&startree) == 0)
				if(find(contlist[j][0]+disx,contlist[j][1]+disy,starlist,n) == 0)
					break;
			}
			if(j != m)
				continue;
			else
			{
				printf("%d %d\n",disx,disy);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n>=400 && n<=599)
  {
    cout<<8;
  }
  if(n>=600 && n<=799)
  {
    cout<<7;
  }
  if(n>=800 && n<=999)
  {
    cout<<6;
  }
  if(n>=1000 && n<=1199)
  {
    cout<<5;
  }
  if(n>=1200 && n<=1399)
  {
    cout<<4;
  }
  if(n>=1400 && n<=1599)
  {
    cout<<3;
  }
  if(n>=1600 && n<=1799)
  {
    cout<<2;
  }
  if(n>=1800 && n<=1999)
  {
    cout<<1;
  }
return 0;
}


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

int main()
{
    string s;
    getline(cin, s);

    int target = 753;
    int ans; 
    for (int i=0; i < s.length()-2; i ++)
    {
        int a = atoi(s.substr(i, 3).c_str());
        int diff = abs(target - a);
        if (i == 0)
            ans = diff;
        else if (diff < ans)
            ans = diff;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
ansall = 0
for i in range(1, N+1):
    for jyou in range(1, 18):
        if i >= K:
            ansall += 1
            break
        if i * (2 **jyou) >= K:
            ans = 1/ 2 ** jyou
            ansall += ans
            break
ANS = ansall / N
print(ANS)


Measured memory_bytes: 2940
S = input()
K = int(input())
count = 0
for i in range(len(S)):
    Snum = int(S[i])
    if Snum == 1:
        count += 1
        if count >= K:
            break
    else:
        wnum = 1
        for _ in range(K):
            if count + wnum >= K:
                break
            else:
                wnum = wnum*Snum
        else:
            continue
        break

print(str(Snum))

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll X;
    cin >> X;

    cout << (1999-X)/200 + 1 << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  string N; cin >> N;
  printYesNo(N.find('7') != N.npos);
  return;
}

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

  gErr = 0;

  solve();

  return gErr;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}
 
int main()
{
    int a,b;
    cin >> a >> b;
    if(a==b){
        printf("a == b\n");
    }else if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }
    return 0;
}


Measured memory_bytes: 3020
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

A, B, M = map(int, input().split())
a = [10 ** 10] + list(map(int, input().split()))
b = [10 ** 10] + list(map(int, input().split()))
ans = 10 ** 10
for _ in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x] + b[y] - c)
ans = min(ans, min(a) + min(b))

print(ans)


Measured memory_bytes: 89380
import java.util.*;

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

    int sum = 0;

    for (int i=0; i<n.length(); i++)
        sum += n.charAt(i) - '0';
    
    if (sum % 9 == 0) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 31100
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i)
#define mod 1e9 + 7
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　　　 　 _... ..._
	　　　　　 , ´⌒ ⌒ヽ
	　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
	　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
	　　　　　　△ﾑ,8ﾑﾌつ
	　　　　　/(ﾝ_/＿ヽ＼
	　　　　 ～～i_ﾌ_ﾌ～´
	*/
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c) {
		cout << "Yes" << endl;
	}
	else if (a + c == b) {
		cout << "Yes" << endl;
	}
	else if (a == c + b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}
 

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
Mod=10**9+7
two_inverse=pow(2,Mod-2,Mod)

X=sum(A)%Mod

Y=0
for a in A:
    Y+=a*a
    Y%=Mod

print(((X*X-Y)*two_inverse)%Mod)
    


Measured memory_bytes: 94064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

const long long INF = (long long) 1e11+1;
const long long mod = (long long) 100000000 ;
const long long hell = (long long) 1000000007;


ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x*res);
    x=(x*x);    
    y=y/2;
  }
  return res;
}

ll modinv(ll x,ll m){
  return power(x,m-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}

int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;

   while(test--)
   solve();
}

void solve(){
   int k;
   cin>>k;
   if(k<=12){
      cout<<k;
      return;
   }
   priority_queue<ll,vector<ll>,greater<ll>> pq;
   for(int i=1;i<=9;i++)
   pq.push(i);
   
   int cnt=0;
   ll ans;
   while(true){
      ll num=pq.top();
      pq.pop();
      cnt++;
      
      if(cnt==k){
         ans=num;
         break;
      }
      
      int ld=num%10;
      ll num1=num*10+ld;
      pq.push(num1);
      
      if(ld!=0){
         num1=num*10+ld-1;
         pq.push(num1);
      }
      if(ld!=9){
         num1=num*10+ld+1;
         pq.push(num1);
      }
   }
   cout<<ans;
}


///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/
// gcd of strings
/*
string getgcd(string s1,string s2){
    
    while(true){
        if(s1.length()<s2.length()){
            swap(s1,s2);
            continue;
        }
        if(s2.empty())
        return s1;
        
        if(s1.substr(0,s2.length())!=s2)
        return "";
        
        s1=s1.substr(s2.length());
    }
}
*/
/*
// for user defined DS hashmap and set
 
struct hash_pair{
      size_t operator()(const pair<int,pair<int,int>>& p) const{
          auto hash1=hash<int>()(p.F) ;
          auto hash2=hash<int>()(p.S.F) ;
          auto hash3=hash<int>()(p.S.S) ;
          return (hash1^hash2)^hash3;
      }  
};
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
*/



Measured memory_bytes: 2420
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define MAX 1000                                      
typedef long long ll;
typedef unsigned long long ull;
extern inline int max( int a, int b ) { return a > b ? a : b ; }
extern inline int min( int a, int b ) { return a > b ? b : a ; }
extern inline ll lmax( ll a, ll b ) { return a > b ? a : b ; }
extern inline ll lmin( ll a, ll b ) { return a > b ? b : a ; }
extern inline ull ulmax( ull a, ull b ) { return a > b ? a : b ; }
extern inline ull ulmin( ull a, ull b ) { return a > b ? b : a ; }

int main()
{
	int arr[5];
	int K;
	
	for( int i=0; i<5; ++i ){
		scanf("%d", arr+i);
	}
	scanf("%d", &K);
	
	for( int i=0; i<4; ++i ){
		for( int j=i+1; j<5; ++j ){
			if( arr[j] - arr[i] > K ){
				printf(":(\n");
				return 0;
			}
		}
	}
	printf("Yay!\n");	
	return 0;
}






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

void solve(){
    ll x; cin >> x;
    ll cnt1 = 0, cnt2 = 0;
    cnt1 = x/500;
    x = x%500;
    cnt2 = x/5;

    cout << cnt1*1000 + cnt2*5 << endl;

}

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int health(int n,int a[],int j)
{
    int c=0;
    for(int i=j+1; i<=n; i++)
    {
        c=c+(a[j]*a[i]);
    }
    return c;
}

int main()
{
    int n,j=0,k=0;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    n=n-1;
    while(j!=n)
    {
        k=k+health(n,a,j);
          j++;
    }
    cout<<k<<endl;


    return 0;
}


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

int main(){
	std::string s, t, u;
	int a, b;
	std::cin >> s >> t;
	std::cin >> a >> b;
	std::cin >> u;
	if(s == u)std::cout << a - 1 << " " << b << std::endl;
	else std::cout << a << " " << b - 1 << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#ifdef _DEBUG
#define dd(x) cout << #x << " : " << x << endl
#else
#define dd(x)
#endif
using namespace std;
using ll = int64_t;

int main(){
    ll a, b, k; cin >> a >> b >> k;

    if(k <= a) {
        cout << a-k << ' ' << b << endl;
    } else if(k <= a+b) {
        cout << 0 << ' ' << b-k+a << endl;
    } else {
        cout << 0 << ' ' << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 3536
N = int(input())
a = [int(item) for item in input().split()]

sunuke = sum(a[1:])
raccoon = a[0]
minimum = abs(sunuke - raccoon)
for i in range(1, N):
    if(abs(sunuke - raccoon) < minimum):
        minimum = abs(sunuke - raccoon)
    sunuke -= a[i]
    raccoon += a[i]
       
print(minimum)

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

const int N = 1e6 + 10;

long long n , ans , dp[N][2];
char a[N];

int main(){
	scanf("%s" , a + 1) , n = strlen(a + 1);
	dp[n][0] = a[n] - '0' , dp[n][1] = 10 - a[n] + '0';
	for(int i = n - 1; i >= 1; i--){
		dp[i][0] = min(dp[i + 1][0] + (a[i] - '0') , dp[i + 1][1] + (a[i] - '0') + 1);
		dp[i][1] = min(dp[i + 1][0] + 10 - (a[i] - '0') , dp[i + 1][1] + 10 - (a[i] - '0' + 1));
	}
	printf("%lld" , min(dp[1][0] , dp[1][1] + 1));
	return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;
#define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i)
#define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i)

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}


ll GetSum(int l, int r, vector<ll>&v){
  if(l>r || l >= (int)v.size() || r < 0) return 0;
  ll lval = l == 0 ? 0 : v[l-1];
  return v[r] - lval;
}

int main(){
  int n, k; cin >> n >> k;
  vector<int> v(n);
  cin >> v;
  vector<ll> a(n), b(n);
  ll apre = 0,bpre = 0;
  rep(i,0,n){
    apre = a[i] = apre + v[i];
    bpre = b[i] = bpre + max(0,v[i]);
  }
  ll ans = 0;
  k--;
  rep(i,0,n){
    if(i+k>=n)break;
    debug(GetSum(i,i+k,a));
    ChangeMax(ans, max((ll)0,GetSum(i, i+k, a)) + GetSum(0, i-1, b) + GetSum(i+k+1, n-1, b));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
  double A,B;
  cin >> A >> B;
  int ans=-1;
  for(double i=50000;i>0;i--){
    if(floor(i*0.08)==A&&floor(i*0.1)==B) ans = i;
  }
  cout << ans;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		int result = 0;
		result = (a-1) * (b-1);
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 22356
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	long long n;
	cin >> n;
	string ans;
	while (n){
		n--;
		ans += 'a' + n % 26;
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
import java.util.*;
import java.io.*;
public class Main{
/// functions
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){if(p==1){return a;}long x=Modpow(a,p/2,m);x=(x*x)%m;return (p&1l)!=0? (x*a)%m:x;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
// end
static long[] f;
static long help(long k){
	if(k<=1){return 1;}
	long x=help(k/2);
	return 2*x+1;
}
public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       StringBuilder sb=new StringBuilder();
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int h=s.nextInt(),n=s.nextInt();
        long res=0;
        for(int i=1;i<=n;i++){res+=s.nextInt();}
        if(res>=h){out.write("Yes");}
       else{out.write("No");}
        out.flush();
  }
}


Measured memory_bytes: 46680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll n = len(s) / 2;
    string ls = s.substr(0, n);
    string lsr = ls; reverse(all(lsr));
    string rs = s.substr(n + 1);
    string rsr = rs; reverse(all(rsr));
    if ((ls == rs) && (lsr == ls) && (rsr == rs)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	string s;
	cin >> n >> s;
	ll cnt = 0;
	ll ans = 0;
	REP(i, n){
		if (s.substr(i+1, n-1-i).find(s[i]) != -1){
			cnt++;
		}
		if (s.substr(0, i).find(s[i]) != -1){
			cnt--;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

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


using namespace std;

struct TaskInfo
{
	unsigned TaskTime;
	unsigned TimeLimit;
};

bool canDoAllTasks(vector<TaskInfo> &task)
{
	sort(task.begin(), task.end(),
		[](const TaskInfo &x, const TaskInfo &y)
		{
			return x.TimeLimit < y.TimeLimit;
		}
	);
	unsigned int time = 0;
	for(auto it = task.begin(); it != task.end(); ++it)
	{
		time += it->TaskTime;
		if(time > it->TimeLimit)
		{
			return false;
		}
	}
	return true;
}

int main()
{
	int N;
	vector<TaskInfo> task;
	cin >> N;
	task.resize(N);
	for(int i = 0; i < N; ++i)
	{
		cin >> task[i].TaskTime >> task[i].TimeLimit;
	}
	if(canDoAllTasks(task))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1920
character(10**5) S
integer,dimension(:,:)::DP(0:12,0:1)
integer keta(6)
integer SL
character A
read*,S
SL=len_trim(S)
DP=0
keta=[1,10,9,12,3,4]
DP(0,0)=1

do i=1,SL
  A=S(SL-i+1:SL-i+1)
  if(A=="?")then
  do j=0,9
    do k=0,12
      jj=mod(j*Keta( mod(i-1,6) +1 )+k,13)
      DP(jj,1)=mod(DP(jj,1)+DP(k,0),10**9+7)
    end do
  end do
  else
    jj=(ichar(A)-48)*Keta( mod(i-1,6) +1 )
    do j=0,12
      DP(mod(jj+j,13),1)=DP(j,0)
    end do
  endif
  DP(:,0)=DP(:,1)
  DP(:,1)=0
end do
print"(i0)",DP(5,0)
end

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

struct edge {long long from,to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INf = 9223372000000000000;
static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define int ll

edge es[2018];
int d[1145];
int V,E;
 
bool Bellman_Ford(int s){
    for(int i=0;i<V;i++) d[i] = INF;
    d[s] = 0;
    int counter = 0,mindist;
    while(true){
        if(counter>2*V){
            if(-d[V-1]>mindist) return true;
            else return false;
        }
        bool update = false;
        for(int i=0;i<E;i++){
            edge e = es[i];
            if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if(!update) break;
        counter++;
        if(counter==V-1){
            mindist = -d[V-1];
        }
    }
    return false;
}
 
signed main(){
    scanf("%lld%lld",&V,&E);
    for(int i=0;i<E;i++){
        int tmp1,tmp2,tmp3;
        scanf("%lld%lld%lld",&tmp1,&tmp2,&tmp3);
        tmp1--;tmp2--;
        edge e;
        e.from = tmp1,e.to = tmp2,e.cost = -tmp3;
        es[i] = e;
    }
    if(Bellman_Ford(0)) printf("inf\n");
    else printf("%lld\n",-d[V-1]);
    return 0;
}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            out.println(in.next().replace(',', ' '));
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 21204
// FUCKED UP FUCKED UP FUCKED UP FUCKED UP FUCKED UP _  Who? _
// FUCKED UP FUCKED UP FUCKED UP FUCKED UP FUCKED UP _  You  _
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=5e3+10, maxm=2e4+10, lg=15, mod=1e9+7, inf=1e18;

ll n,dp[maxn]={1},M;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n>>M;
	for(int i=1;i<n;i++){
		ll x=min((ll)i,n-i+1);
		for(int j=x;j<=n;j++) (dp[j]+=dp[j-x])%=M;
	}
	ll ans=0;
	for(int i=0;i<=n;i++) (ans+=(n-i)*dp[i]%M)%=M;
	cout<<ans;
	
	return 0;
}



 


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int l, r, d;
  cin >> l >> r >> d;
  cout << r / d - (l-1) / d;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string ans="Yes";
  vector<pair<int,int>> ba(n);
  for(int i=0;i<n;i++){
    cin>>ba[i].second>>ba[i].first;
  }
  sort(ba.begin(),ba.end());
  long time=0;
  for(int i=0;i<n;i++){
    time+=ba[i].second;
    if(time>ba[i].first){ans="No"; break;}
  }
  cout<<ans;
}


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

#include <cstdio>
#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    ll ans = 0;
    rep(i, N) {
        cin >> A[i];
        ans = ans ^ A[i];
    }
    rep(i, N) {
        ll temp = ans;
        temp = temp ^ A[i];
        printf("%lld%s", temp, i == N - 1 ? "" : " ");
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4016
import bisect


#####segfunc#####
def segfunc(x, y):
    return max(x, y)
#################

#####ide_ele#####
ide_ele = -10000000000
#################


class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res


mod = 998244353
n = int(input())
x = []
xd = []
for _ in range(n):
    _x, _d = map(int, input().split())
    x.append(_x)
    xd.append((_x, _d))
x.sort()
xd.sort()

init_val = [i for i in range(n + 1)]
seg = SegTree(init_val, segfunc, ide_ele)
dp = [1] * (n + 1)
for i in range(n - 1, -1, -1):
    j = bisect.bisect_left(x, xd[i][0] + xd[i][1])
    k = seg.query(i, j)
    seg.update(i, k)
    dp[i] = dp[i + 1] + dp[k + 1]
    dp[i] %= mod

print(dp[0])


Measured memory_bytes: 126164
//g++ -std=c++17 -Wall t.cpp -o test -lm -g -O2
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl '\n'
#define teto(a, b) (a+b-1)/(b)

const int MAX = 400010;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-8;
const ld PI = acosl(-1.0);

// End - Template //

using namespace std;

int main()
{
    int n, m, l, r;

    cin >> n >> m;

    int mini = INF, maxi = 0;

    for(int i=0;i<m;i++)
    {
        cin >> l >> r;

        mini = min(r, mini);
        maxi = max(l, maxi);
    }

    
    cout << max(0, mini-maxi+1) << endl;

    


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
const int mod=1e9+7;
using namespace std;
int binpow(int x,int y){
	int tich=1;
	while(y){
		if(y&1){
			tich*=x;
			tich%=mod;
		}
		x*=x;
		x%=mod;
		y>>=1;
	}
	return tich;
}
int solve(int h,int w){
	if(h==1||w==1){
		return (binpow(2,h)+binpow(2,w)-1)%mod;
	}
	return (binpow(2,h)+binpow(2,w)-1+binpow(2,__gcd(h,w))-2)%mod;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int h,w,i,j,k,l,t;
	cin>>h>>w>>t;
	if(h==1||w==1){
		cout<<solve(h,w);
		return 0;
	}
	k=__gcd(h,t);
	l=__gcd(w,t);
//	cout<<k<<' '<<l<<endl;
	cout<<binpow(solve(h/k,w/l),(k*l)%(mod-1));
}

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

a_100 = N // 100
N = N - 100 * a_100

a_10 = N // 10
N = N - 10 * a_10

a_1 = N

if a_100 == 7 or a_10 == 7 or a_1 == 7:
    print('Yes')

else:
    print('No')


Measured memory_bytes: 9168
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int p[11];
int c[11];
int main() {
	int d,g;
	cin >> d >> g;
	rep(i ,d){
		cin >> p[i] >> c[i];
	}
	int ans = 1 << 30;
	rep(i, (1 << d)){
		int s = 0, t = 0, mx = 0, cm = 100;
		rep(j, d){
			if(i >> j & 1){
				s += p[j];		
				t += (j + 1) * 100 * p[j] + c[j];
			}else{
				mx = j;
			}
		}
		if(g > t){
			int n = g - t;
			if((int)ceil(n*1.0 / ((mx + 1) * 100)) > p[mx]) {
				continue;
			}
			s +=ceil(n*1.0 / ((mx + 1) * 100));
		}
		ans = min(s, ans);
	}
	cout << ans << endl;
}


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

const int dy[4] = {1, 0, -1, 0};
const int dx[4] = {0, 1, 0, -1};
const int INF = 10000000;
int h, w;
int dist[22][22] = {};
char grid[22][22];

int bfs(int y, int x){
  queue<P> que;
  rep(i, h)rep(j, w)dist[i][j] = INF;
  que.push(P(y, x));
  dist[y][x] = 0;
  while(que.size()){
    P p = que.front(); que.pop();
    rep(i, 4){
      int ny = p.first + dy[i], nx = p.second + dx[i];
      if(ny < 0 || nx < 0 || ny >= h || nx >= w || grid[ny][nx] == '#' ||
         dist[ny][nx] != INF)
        continue;
      que.push(P(ny, nx));
      dist[ny][nx] = dist[p.first][p.second] + 1;
    }
  }
  int ret = 0;
  rep(i, h){
    rep(j, w){
      if(dist[i][j] == INF) continue;
      ret = max(dist[i][j], ret);
    }
  }
  return ret;
}

int main(){
  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> grid[i][j];
  int res = 0;
  rep(i, h){
    rep(j, w){
      if(grid[i][j] == '#') continue;
      res = max(bfs(i, j), res);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

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

    sort(all(a));
    i64 ans = a[1] - a[0];
    rep(i,1,n) {
      ans = min(ans, a[i] - a[i - 1]);
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3132
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

use std::env;  

fn main() {
    //let mut buf=read::<String>();
    let mut args: Vec<String> = env::args().collect();
    //println!("{}", args[1]);

    let pass = read::<String>();


    //let mut buf = 

    let mut buf = '\0';
 
    for i in pass.as_str().chars() {
        if i == buf {
            print!("Bad\n");
            return();
        }else{
            buf = i;
        }
    }
    print!("Good\n");
    
}

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

template<typename T>
int lis(const vector<T> &a, bool is_strict = true) {
    T INF = numeric_limits<T>::max();
    vector<T> dp(a.size(), INF);
    for (T ai: a) {
        if (is_strict) *lower_bound(begin(dp), end(dp), ai) = ai;
        else *upper_bound(begin(dp), end(dp), ai) = ai;
    }
    return lower_bound(begin(dp), end(dp), INF) - begin(dp);
}

#include <iomanip>
int main() {
    cout << fixed << setprecision(12);
    const int C = 2e8;
    const double PI = acos(-1.0);
    int sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy;
    int n; cin >> n;
    bool revX = sx > gx, revY = sy > gy;
    if (revX) sx = C - sx, gx = C - gx;
    if (revY) sy = C - sy, gy = C - gy;
    vector<pair<int, int>> v;
    while (n--) {
        int x, y; cin >> x >> y;
        if (revX) x = C - x;
        if (revY) y = C - y;
        if (x < sx || x > gx || y < sy || y > gy) continue;
        v.emplace_back(x, y);
    }
    sort(v.begin(), v.end());
    vector<int> vec;
    for (auto &p: v) vec.emplace_back(p.second);
    int cnt = lis(vec);
    double ans = 100.0 * (gx - sx + gy - sy);
    ans -= (20.0 - 5.0 * PI) * cnt;
    if (min(gx - sx, gy - sy) + 1 == cnt) ans += 5.0 * PI;
    cout << ans << endl;
    return 0;
}

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

int main() {
    long n, ans = 0;
    cin >> n;
    if(n % 2 == 0) {
        n /= 2;
        for(int i = 0; i < 40; i++) {
            n /= 5;
            ans += n;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define rep(i, a, b) for (ll i = a; i < (b); ++i)
#define reb(i, a, b) for (ll i = a; i >= (b); --i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
multiset<ll> ch[200005];
multiset<ll> ans;
int main()
{
   
   ll n,ch=0;
   cin >> n;
   ll a[n];
   rep(i,0,n)
   {
      cin >> a[i];
      ch = ch ^ a[i];
   }
   rep(i,0,n)
   {
      cout << (ch ^ a[i]) << " ";
   }
}


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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


int main(){
    int a,b;
    cin>>a>>b;
    
    for(int i=1;i<=3;i++){
        if(i!=a&&i!=b){
            cout<<i<<endl;
        }
    }
}



Measured memory_bytes: 256
import collections
N=int(input())
D=list(map(int,input().split()))
mod=998244353
if D[0]!=0:
  print(0);exit()

D=collections.Counter(D)
if D[0]!=1:
  print(0);exit()
ans=1
for i in range(1,len(D)): 
  ans*=pow(D[i-1],D[i],mod)
  ans%=mod
print(ans)

Measured memory_bytes: 98920
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    long long int n, k, q;

    cin >> n >> k;

    q = n / k;
    n = n - k*q;

    long long int ans = min(n, abs(n-k));

    cout << ans << "\n";

    return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	int n,t, mn=1<<28, ans= -1;
	cin >>n >>t;
	rep(i, n){
		int c,b;
		cin >>c >>b;
		if(c < mn && b<=t){
			mn = c; ans = c;
		}
	}
	if(ans==-1) cout<<"TLE\n";
	else cout << ans <<"\n";
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)

long long M = 1000000007;

vector<vector<long long>> dp;
vector<long long> a,b;

long long solve(int l, int r){
    if(dp[l][r] != -1)return dp[l][r];
    if(r==l+1)return 0;
    long long res = 1ll<<62;
    for(int i=l+1;i<r;++i)res = min(res, solve(l,i) + solve(i,r));
    res += b[r]-b[l];
    dp[l][r] = res;
    return res;
}

int main(int argc, char const *argv[]) {
    long long n;cin>>n;
    a = vector<long long>(n);
    b = vector<long long>(n+1);
    dp = vector<vector<long long>>(n+1,vector<long long>(n+1,-1));
    for(int i=0;i<n;++i){
        cin>>a[i];
        b[i+1] = b[i] + a[i];
    }
    cout<<solve(0,n)<<endl;
    return 0;
}

Measured memory_bytes: 1536