akhauriyash/Code-Regression huggingface dataset:
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

 
int main(){
  CIN(a,b,c,x,y);

  ll num = 2 * (max(x,y) + 1);
  ll ans = LINF;
  for(ll i = 0; i <= num; i+=2){
    
    ll adif = x - (i/2);
    ll bdif = y - (i/2);
    ll aval = max(adif * a, 0LL);
    ll bval = max(bdif * b, 0LL);


    ans = min(ans, i * c + aval + bval);
  }
  COUT(ans);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,D,E,F,i,j,k; bool mizu[31]={}, shio[1501]={};
cin >> A >> B >> C >> D >> E >> F; vector<int> W, S;
for(i=0; i<=1500/C; i++){
j=0; while(C*i+D*j<=1500){ k=C*i+D*j; j++; if(!shio[k]){ S.push_back(k); shio[k]=true; } }
}
for(i=0; i<=30/A; i++){
j=0; while(A*i+B*j<=30){ k=A*i+B*j; j++; if(!mizu[k]){ W.push_back(k); mizu[k]=true; } }
}
int w=100*A, s=0; double d=0, e;
for(i=0; i<W.size(); i++){ for(j=0; j<S.size(); j++){
e=(100.0*S[j])/(100.0*W[i]+S[j]);
if(d<e&&S[j]<=W[i]*E&&100*W[i]+S[j]<=F){ w=100*W[i]+S[j]; s=S[j]; d=e; }
} }
cout << w << " " << s << "\n";
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

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

    a--;
    b--;

    cout << (b%a == 0 ? b/a:b/a+1) << endl;
}


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

using namespace std;

int main() {
    int N;
    
    cin>>N;
    
    int h[N+1];
    
    for(int i=1;i<=N;++i){
        cin>>h[i];
    }
    
    
    int d[N+1];
    d[0]=0;
    d[1]=0;
    h[0]=9999999;
    
    for(int i=2;i<=N;++i){
        d[i]=min(d[i-1]+abs(h[i]-h[i-1]),d[i-2]+abs(h[i]-h[i-2]));
    }
    
    cout<<d[N]<<endl;
   
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

struct Node {
    Node *l, *r;
};
Node nodes[100111];
Node* root = &nodes[0];
int nodei = 1;

void push(char *s, Node *x) {
    if (*s == '0') {
	if (x->l == 0) x->l = &nodes[nodei++];
	push(s+1, x->l);
    } else if (*s == '1') {
	if (x->r == 0) x->r = &nodes[nodei++];
	push(s+1, x->r);
    }
}

int game(Node *x, LL h) {
    if (x->l == 0 && x->r == 0) {
	return 0;
    }
    if (x->l && x->r) {
	return game(x->l, h-1) ^ game(x->r, h-1);
    }
    int a = (x->l? game(x->l, h-1): game(x->r, h-1));
    return a ^ (__builtin_ctzll(h)+1);
}

int N;
LL H;
char S[100111];

void MAIN() {
    scanf("%d%lld", &N, &H);
    REP (i, N) {
	scanf("%s", S);
	push(S, root);
    }

    int ans = game(root, H);
//    eprintf("%d\n", ans);
    puts(ans? "Alice": "Bob");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>

typedef long long int ll;

using namespace std;
long double a,b,c,n,m,q,aa[100000],bb[100000];
bool ra,rb,rc;
vector<ll> va(20),vb;

#define CE cout<<endl
#define C cout<<
#define E <<endl

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



    if( (b-1)<=n) c = (b-1)/b;
    else c = n/b;
    

    C (floor(a*c)-a*floor(c)) E;

}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
string a="abcdefghij";
int flag[10]={0};
string s;
int check(){
    int r=0;
    rep(i,s.size()){
        rep(j,10)if(s[i]==a[j]&&flag[j]==0){r++;flag[j]=1;}
    }
    rep(i,10)flag[i]=0;
    return r;
}

void pri(int n,int sum){
    int move = 0;
    if(n!=1){
        rep(i,sum+1){
            s+=a[i];
            pri(n-1,check());
            s=s.substr(0,s.size()-1);
        }
    }else{
        rep(i,sum+1)cout <<s+a[i]<<endl;
        return;
    }
    return;
}

int main(){
    int n;
    cin >>n;
    pri(n,0);
    return 0;
}

Measured memory_bytes: 1536
#ビスケット生産装置を起動すると、起動してから A 秒後、2A 秒後、3A 秒後、... (A の倍数秒後) に B 枚ずつビスケットを生産します。
#ビスケット生産装置を起動してから T+0.5 秒後までに生産されるビスケットの合計枚数を求めてください。

A, B, T = map(int, input().split())
S = int(B*((T+0.5)//A))
print(S)




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

int main() {
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> as;
  int mina = 1000000;
  for (int i = 0; i < a; i++) {
    int tmp;
    cin >> tmp;
    mina = mina > tmp ? tmp : mina;
    as.push_back(tmp);
  }
  int minb = 1000000;
  vector<int> bs;
  for (int i = 0; i < b; i++) {
    int tmp;
    cin >> tmp;
    minb = minb > tmp ? tmp : minb;
    bs.push_back(tmp);
  }
  int min = mina + minb;
  for (int i = 0; i < m; i++) {
    int aa, bb, dis;
    cin >> aa >> bb >> dis;
    aa--;
    bb--;
    int tmp = as[aa] + bs[bb] - dis;
    min = min > tmp ? tmp : min;
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    ll N, H; cin >> N >> H;
    vector<pair<ll, ll>> weapons(N);
    ll maxNormal = 0;
    rep(i, 0, N) {
        cin >> weapons[i].second >> weapons[i].first;
        maxNormal = max(maxNormal, weapons[i].second);
    }
    sort(weapons.begin(), weapons.end());

    ll res = 0;
    for (int i = N-1; H > 0 and i >= 0; --i) {
        if (weapons[i].first > maxNormal) {
            H -= weapons[i].first;
            ++res;
        }
    }
    if (H > 0) {
        res += (H+(maxNormal-1))/maxNormal;
    }

    cout << res << "\n";
}

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

int main() {
  int n, a, pa = 0, pb = 0;
  vector<int> v;
  cin >> n;
  REP(i, n) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  REP(i, v.size()) {
    if (i % 2 == 0) pa += v[i];
    else pb += v[i];
  }

  cout << pa - pb << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long N;cin>>N;
    long long A[N+1];
    long long X=0;
    for(long long i=1;i<=N;i++){
        cin>>A[i];
        if(A[i]==2){
            X++;
        }
    }
    if(X==0){
        cout<<-1<<endl;
        return 0;
    }
    long long count=0;
    long long tmp=1;
    for(long long i=1;i<=N;i++){
        tmp=A[tmp];
        count++;
        if(tmp==2){
            cout<<count<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=205,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<int> A(2*N-1);
    for(int i=0;i<2*N-1;i++) cin>>A[i];
    
    int left=1,right=2*N-1;
    while(right-left>1){
        int mid=(left+right)/2;
        
        vector<int> B(2*N-1);
        for(int i=0;i<2*N-1;i++) if(A[i]>=mid) B[i]=1;
        
        bool ok=false;
        
        int s=N-1,t=N-1;
        
        if(B[s-1]+B[s]==2||B[s]+B[s+1]==2) ok=true;
        else if(B[s]||B[s-1]+B[s+1]==2){
            if(B[s]){
                s-=2;
                t+=2;
            }else{
                s--;
                t++;
            }
            
            while(s>=0){
                if(s==0&&B[s]&&B[t]){
                    ok=true;
                    break;
                }
                
                if(!B[s]||!B[t]) break;
                
                if(B[s-1]||B[t+1]){
                    ok=true;
                    break;
                }
                
                s-=2;
                t+=2;
            }
        }
        
        if(ok) left=mid;
        else right=mid;
    }
    
    cout<<left<<endl;
    
}


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

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(B > A) cout << "Bob" << endl;
	else cout << "Draw" << endl;
}

Measured memory_bytes: 256
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Sat Dec  1 15:43:49 2018
//
package main

import "fmt"

var n int

func max(xs []int, exception int) (int, int) {
	count := 0
	val := 0

	for v, c := range xs {
		if v != exception && count < c {
			val = v
			count = c
		}
	}

	return val, count
}

func main() {
	fmt.Scan(&n)

	count1 := make([]int, 1e5+1)
	count2 := make([]int, 1e5+1)

	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		if i%2 == 0 {
			count1[v]++
		} else {
			count2[v]++
		}
	}

	val1, c1 := max(count1, 0)
	_, c2 := max(count2, val1)

	val3, c3 := max(count2, 0)
	_, c4 := max(count1, val3)

	if c3+c4 < c1+c2 {
		fmt.Println(n - c1 - c2)
	} else {
		fmt.Println(n - c3 - c4)
	}
}


Measured memory_bytes: 6016
function main (s) {
    s=s.split(" ");
	s[0]=parseInt(s[0]);
	s[1]=parseInt(s[1]);
	console.log(((s[0]+s[1])<10)?(s[0]+s[1]):"error\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#define INF (1<<30)
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int D, N; cin >> D >> N;
	vector<int> T(D), A(N), B(N), C(N);
	for (int i = 0; i < D;i++) cin >> T[i];
	for (int i = 0; i < N;i++)cin >> A[i] >> B[i] >> C[i];
	vector<vector<pair<int, int>>> dp(D, vector<pair<int, int>>(N, { 0,-1 }));

	int ans = 0;
	for (int i = 0; i < N;i++) {
		if (T[0] >= A[i] && T[0] <= B[i]) {
			dp[0][i] = { 0,C[i] };
		}
	}

	for (int i = 1; i < D;i++) {
		for (int j = 0; j < N;j++) {
			if (T[i] >= A[j] && T[i] <= B[j]) {
				for (int k = 0; k < N;k++) {
					if (dp[i - 1][k].second != -1) {
						if (dp[i][j].first <= dp[i - 1][k].first + abs(C[j] - dp[i - 1][k].second)) {
							dp[i][j].first = dp[i - 1][k].first + abs(C[j] - dp[i - 1][k].second);
							dp[i][j].second = C[j];
						}
					}
				}

			}
		}
	}
	for (int i = 0; i < N;i++) {
		ans = max(ans, dp[D - 1][i].first);
	}
	cout << ans << endl;
}

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

using namespace std;

int main(){

    long long n,soma=0,num=0,total=0;
    long long i,j,k,l,a,b;

    cin >> n >> a >> b;
    
    for(i=0;i<=9;i++){
        for(j=0;j<=9;j++){
            for(k=0;k<=9;k++){
                for(l=0;l<=9;l++){
                    soma=0;
                    num=0;
                    num=(i*1000)+(j*100)+(k*10)+l;
                    if(num<=n){    
                        soma=i+j+k+l;
                        if((soma>=a)&&(soma<=b)){
                            total+=num;
                        }
                    }
                }
            }
        }
    }
    
    if(n==10000){
        soma=1;
        if((soma>=a)&&(soma<=b)){
            total+=10000;
        }
    }

    cout << total << endl;    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n, T;
	int aux = 1001, temp = 0;
	scanf("%d %d", &n, &T);
	int ci, ti;
	for(int i = 0; i < n; i++){
		scanf("%d %d", &ci, &ti);
		if(ti <= T) {
			temp = ci;
			if(aux > temp) {
				aux = ci;
			}
		}
	}
	if(aux != 1001)
		printf("%d\n", aux);
	else
		printf("TLE\n");



	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

typedef struct {
	int a, b, c;
	int flag;
} INQ;

int main(void)
{
	int a, b, c;
	int parts[301];
	int n;
	bool flag;
	INQ inq[1000];
	
	while (1){
		
		cin >> a >> b >> c;
		if (a == 0 && b == 0 && c == 0)break;
		cin >> n;
		for (int i = 1; i <= a + b + c; i++){
			parts[i] = 2;
		}
		for (int i = 0; i < n; i++){
			cin >> inq[i].a >> inq[i].b >> inq[i].c >> inq[i].flag;
			if (inq[i].flag == 1){
				parts[inq[i].a] = parts[inq[i].b] = parts[inq[i].c] = 1;
			}
		}
		
		
		
		
		for (int i = 0; i < n; i++){
			if (inq[i].flag == 0){
				int count = 0;
				int clash;
				if (parts[inq[i].a] == 1){
					count++;
				}
				else {
					clash = inq[i].a;
				}
				if (parts[inq[i].b] == 1){
					count++;
				}
				else {
					clash = inq[i].b;
				}
				if (parts[inq[i].c] == 1){
					count++;
				}
				else {
					clash = inq[i].c;
				}
				if (count == 2){
					parts[clash] = 0;
				}
			}
		}
		
		for (int i = 1; i <= a + b + c; i++){
			cout << parts[i] << endl;
		}
	}
	
	return (0);
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int main() {
	int N;
	while(scanf("%d", &N), N) {
		int res = 0;
		int maxi = -1, mini = INF;
		int a;
		rep(i, N) {
			scanf("%d", &a);
			res += a;
			maxi = max(maxi, a);
			mini = min(mini, a);
		}
		res = res - (maxi + mini);
		double ans = (double)res / (N - 2) * 10;
		res = (int)(ans / 10);
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 3080
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
  a = list(map(int, input().split()))
  p = C
  for j in range(M):
    p += a[j] * B[j]
  if p > 0:
    ans += 1
print(ans)

Measured memory_bytes: 62296
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXN 50000

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

	int n, i, j, k, ans, ct;
	string s;
	cin >> n >> k >> s;
	ct = 0;
	for (i = 1; i < n; i++) {
		if (s[i] == s[i - 1]) ct++;
	}
	ans = min(n - 1, ct + k * 2);
	cout << ans << "\n";


	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = long long ;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n,m;
    cin >> n >> m;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    vi csum(n+1);
    csum.at(0) = 0;
    for(ll i=1; i<n+1; i++) csum.at(i) = csum.at(i-1) + a.at(i-1);
    for(ll i=1; i<n+1; i++) csum.at(i) %= m;
    map<ll,ll> mp;
    for(ll i=1; i<n+1; i++){
        if(mp.count(csum.at(i))){
            mp.at(csum.at(i))++;
        }else{
            mp[csum.at(i)] = 1;
        }
    }
    ll res = 0;
    for(auto it = mp.begin(); it != mp.end(); it++) {
        cerr << "key:" << it->first << " value:" << it->second << endl;
        ll count = it->second;
        res += (count*(count-1))/2;
    }
    if(mp.count(0)) res += mp.at(0);
    cout << res << endl;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
	if(b%1000 != 0 || b/1000<a)
	{
		cout << "-1 -1 -1";
		return 0;
	}
	b /= 1000;
	if(a == b)
	{
		cout << "0 0 " << a;
		return 0;
	}
	for(int i=0;i<a;i++)
		for(int j=0;j <= a;j++)
			if((b-i-5*j)%10 == 0 && (b-i-5*j)/10+i+j == a && b-i-5*j >= 0)
			{
				cout << (b-i-5*j)/10 << ' ' << j << ' ' << i;
				return 0;
			}
	cout << "-1 -1 -1";
	return 0;
} 

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys,re
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    N = int(lines.pop(0))
    S = lines.pop(0)
    K = int(lines.pop(0))
    c = S[K-1:K]
    print(re.sub(r"[^{}]".format(c),'*',S))

lines = [x.strip() for x in sys.stdin.readlines()]
solve(lines)

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int best[200100][2];

int main()
{
    string S;
    cin >> S;

    int res = 0;
    best[0][0] = 1;
    best[0][1] = 1;

    for(int i = 1; i < S.size(); i++){
        if(S[i] != S[i - 1]){
            best[i][0] = max(best[i][0], best[i - 1][0] + 1);
        }

        if(i < S.size() - 1){
            best[i][1] = max(best[i][1], best[i - 1][0] + 1);
        }

        if(i >= 2){
            best[i][0] = max(best[i][0], best[i - 2][1] + 1);
            if(i < S.size() - 1 && S[i] != S[i - 2] && S[i + 1] != S[i - 1]){
                best[i][1] = max(best[i][1], best[i - 2][1] + 1);
            }
        }

        res = max(res, best[i][0]);
        res = max(res, best[i][1]);
    }

    cout << res << endl;
    return 0;
}


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

using namespace std;

int main()
{
    string S, T;

    getline(cin, S);
    getline(cin, T);

    int count = 0;
    for(int i=0; i<3; i++)
    {
        if(S[i] == T[i])
        {
            count++;
        }
    }
    
    cout << count << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int N;
  int A[200010];
  int i;
  int B[200010];
  scanf("%d",&N);
  for(i=2;i<=N;i++){
    scanf("%d",&A[i]);
  }
  for(i=2;i<=N;i++){
    B[A[i]]++;
  }
  for(i=1;i<=N;i++){
    printf("%d\n",B[i]);
  }
  return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define prints(x, y) cout<<(x)<<" "<<(y)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

const long long INF = 1LL << 60;

int main() {
  int w, a, b;
  cin >> w >> a >> b;
  if (a <= b &&  b - (a+w) <= 0) print(0);
  else if (a > b && a - (b+w) <= 0) print(0);
  else print( min(abs((a+w) - b), abs((b+w) - a)) );

}


Measured memory_bytes: 256
import sys
N = int(sys.stdin.readline())
S = [sys.stdin.readline() for i in range(N)]
M = int(sys.stdin.readline())
T = [sys.stdin.readline() for j in range(M)]
ans = 0
for s in S:
  money = S.count(s) + T.count(s) * -1
  ans = max(ans, money)
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
  ll n;cin>>n;
  ll a[n],b[n],c[n];
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i]>>c[i];
  }
  ll aa[n],bb[n],cc[n];aa[0]=a[0];bb[0]=b[0];cc[0]=c[0];cout<<endl;
  for(int i=1;i<n;i++){
    aa[i]=max(bb[i-1],cc[i-1])+a[i];
    bb[i]=max(aa[i-1],cc[i-1])+b[i];
    cc[i]=max(bb[i-1],aa[i-1])+c[i];//if(i==1)cout<<"*"<<cc[i]<<"*\n";
//cout<<aa[i]<<" "<<bb[i]<<" "<<cc[i]<<endl; 
 }ll s=max(aa[n-1],bb[n-1]);
  cout<<max(s,cc[n-1]);
}

Measured memory_bytes: 4992
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  int cnt=0;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]!=t[i])
      cnt++;
  }
  cout<<cnt;
}


Measured memory_bytes: 3900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		while(true) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			if(a == 0 && b == 0) {
				break;
			}
			
			System.out.printf("%d %d\n", Math.min(a, b), Math.max(a, b));
			
		}
		
	}

}



Measured memory_bytes: 40008
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    Rep(i, 1, 11){
        int ans = (i*1000)-N;
        if(ans>=0&&ans<=1000){
            pr(ans);
            return 0;
        }
    }
}

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

#define ctz __builtin_ctz

const int N = 400005, inf = 0x3f3f3f3f;

void up(int &x, int y) { x = std::max(x, y); }
void down(int &x, int y) { x = std::min(x, y); }

int f[N], g[N], x[N], L[19][N], R[19][N], sum[N];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	int n, v; std::cin >> n >> v;
	int lg = std::__lg(v) + 1, mask = ~(-1 << lg);
	x[0] = -inf, x[n + 1] = inf;
	for (int i = 1; i <= n; ++i) std::cin >> x[i];
	for (int t = 0; t <= lg; ++t) {
		int _v = v >> t;
		for (int i = 1; i <= n; ++i)
			L[t][i] = x[i] - x[i - 1] <= _v ? L[t][i - 1] : i;
		for (int i = n; i >= 1; --i)
			R[t][i] = x[i + 1] - x[i] <= _v ? R[t][i + 1] : i;
	}
	std::fill(g, g + mask + 1, n + 1);
	for (int i = 0; i < mask; ++i) {
		for (int _j = mask ^ i, j = ctz(_j); _j; j = ctz(_j &= _j - 1)) {
			up(f[i | 1 << j], f[i]);
			if (f[i] < n) up(f[i | 1 << j], R[j + 1][f[i] + 1]);
			down(g[i | 1 << j], g[i]);
			if (g[i] > 1) down(g[i | 1 << j], L[j + 1][g[i] - 1]);
		}
	}
	for (int i = 0; i <= mask; ++i)
		if (f[i] + 1 >= g[mask - i]) {
			while (n--) std::cout << "Possible\n"; return 0;
		}
	for (int i = 0; i <= mask; ++i)
		if (R[0][f[i] + 1] + 1 >= g[mask - i])
			++sum[f[i] + 1], --sum[R[0][f[i] + 1] + 1];
	for (int i = 1; i <= n; ++i) sum[i] += sum[i - 1];
	for (int i = 1; i <= n; ++i) std::cout << (sum[i] ? "Possible" : "Impossible") << '\n';
	
	return 0;
}

Measured memory_bytes: 67200
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define print(n) std::cout << n << std::endl
#define FOR(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
    int a,b;
    cin >> a >> b;
    if((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0)print("Possible");
    else print("Impossible");
}

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

using namespace std;

int main(){
        int N;
        bool f=false;
        while(cin>>N,N){
                if (f) {
                        cout<<endl;
                }
                f=true;
                int a,b,c,d;
                cin>>a>>b>>c>>d;
                a++;b++;c++;d++;
                int A=0,B=0,C=0,D=0;
                int ans=INT_MAX/6,memo=0;
                vector<int>data;
                for (int i = 0; i < a; i++) {
                        for (int j = 0; j < b; j++) {
                                for (int k = 0; k < c; k++) {
                                        for (int l = 0; l < d; l++) {
                                                D=i*10+j*50+k*100+l*500;
                                                if (D>=N) {
                                                        int X=D-N;
                                                        int Y=X;
                                                        int count=0;
                                                        vector<int>co{i,j,k,l},cu(4);
                                                        count+=X/500+a-i;
                                                        cu[3]=X/500;
                                                        X%=500;
                                                        count+=X/100+b-j;
                                                        cu[2]=X/100;
                                                        X%=100;
                                                        count+=X/50+c-k;
                                                        cu[1]=X/50;
                                                        X%=50;
                                                        count+=X/10+d-l;
                                                        cu[0]=X/10;
                                                        X%=10;
                                                        if (ans>count) {
                                                                if ((i&&cu[0])||(j&&cu[1])||(k&&cu[2])||(l&&cu[3])) {
                                                                        continue;
                                                                }
                                                                memo=Y;
                                                                ans=count;
                                                                data=co;
                                                        }
                                                }
                                        }
                                }
                        }
                }
                if (data[0]) {
                        cout<<10<<" "<<data[0]<<endl;
                }
                if (data[1]) {
                        cout<<50<<" "<<data[1]<<endl;
                }
                if (data[2]) {
                        cout<<100<<" "<<data[2]<<endl;
                }
                if (data[3]) {
                        cout<<500<<" "<<data[3]<<endl;
                }
        }
        return 0;
}

Measured memory_bytes: 1216
from sys import stdin

def main():
    S = input()

    n = [0] * (len(S) + 1)
    for i, s in enumerate(S, start=1):
        if s == 'W':
            n[i] = n[i-1] + 1
        else:
            n[i] = n[i-1]
    ans = 0
    for i, s in enumerate(S, start=1):
        if s == 'B':
            ans += n[-1] - n[i]
    print(ans)

input = lambda: stdin.readline().rstrip()
main()


Measured memory_bytes: 11240
N, M = map(int, input().split())

INF = 10**9
dp = [INF]*(1<<N)
dp[0] = 0

for _ in range(M):
  a, b = map(int, input().split())
  c = sum(map(lambda x: 1 << (int(x)-1), input().split()))
  for j in range(1<<N):
    dp[j|c] = min(dp[j|c], dp[j] + a)

ans = dp[-1]

if ans == INF:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 75624
#include <stdio.h>

int main(){
  int h, n, x, s=0;
  scanf("%d%d", &h,&n);
  for(int i=0;i<n;i++){
    scanf("%d", &x);
    s += x;
  }
  if(s<h){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Solve{
    public int h;
    public int w;
    public bool[][] a;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();        
        for(int i = 0;i < h;i++){
            string s = "";
            for(int j = 0;j < w;j++){
                if(i == 0 || (j%2 == 0 && i != h-1) || a[i][j]){
                    s += "#";
                }
                else{
                    s += ".";
                }
                if(j == w-1){
                    Console.WriteLine(s);
                }
            }
        }
        Console.WriteLine("");
        for(int i = 0;i < h;i++){
            string s = "";
            for(int j = 0;j < w;j++){
                if(i == h-1 || (j%2 == 1 && i != 0) || a[i][j]){
                    s += "#";
                }
                else{
                    s += ".";
                }
                if(j == w-1){
                    Console.WriteLine(s);
                }
            }
        }
    }
    void getinput(){
        string[] str = Console.ReadLine().Split(' ');
        h = int.Parse(str[0]);
        w = int.Parse(str[1]);
        a = new bool[h][];
        for(int i = 0;i < h;i++){
            string s = Console.ReadLine();
            a[i] = new bool[w];
            for(int j = 0;j < w;j++){
                if(s[j] == '#'){
                    a[i][j] = true;
                }
                else{
                    a[i][j] = false;
                }
            }
        }
    }    
}

Measured memory_bytes: 7560
#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)
using namespace std;

long X[200000];
long X_s[200000];
int main(){

        int N; cin>>N;
        rep(i,N) cin>>X[i];
        rep(i,N) X_s[i] = X[i];
        sort(X_s,X_s+N);
        long m1 = X_s[N/2-1];
        long m2 = X_s[N/2];
        rep(i,N){
                if(X[i]<=m1) cout << m2 << endl;
                else cout << m1 << endl;
        }
        return 0;
}


Measured memory_bytes: 5376
import collections
N=int(input())
S=list(input() for i in range(N))
S=collections.Counter(S)
S=S.most_common()
if len(S)==1:
  print(S[0][0])
elif S[0][1]>S[1][1]:
  print(S[0][0])
else:
  s=[i for i in S if i[1]==S[0][1]]
  s=dict(s)
  s=list(s.keys())
  s=sorted(s)
  for i in s:
    print(i)

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

ll n,a,b,c,d;
string s;

int main(){
    cin >> n >> a >> b >> c >> d;
    cin >> s;
    a--;
    b--;
    c--;
    d--;
    bool flags=true;
    for(ll i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#') flags=false;
    }
    bool flagf=true;
    for(ll i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#') flagf=false;
    }
    if(!flags||!flagf){
        cout << "No" << endl;
        return 0;
    }
    bool flag=false;
    if(c<d) flag=true;
    else{
        for(ll i=b;i<=d;i++){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.') flag=true;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}  


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
#define P pair<int,int>

signed main(){
    int D,G;
    int Ans=INF;
    int p[14],c[14];
    bool bo[10];
    cin >> D >> G;
    REP(i,D){
        cin >> p[i] >> c[i];
    }
    int R=1;REP(i,D){R*=2;}
    for(int b=0;b<R;b++){
        int f=1,num=0,nom=0;
        for(int i=0;i<D;i++){
            bo[i]=(b/f)%2;f*=2;
        }
        for(int i=0;i<D;i++){
            if(bo[i]==1){
                num+=(i+1)*100*p[i];
                num+=c[i];
                nom+=p[i];
            }
        }
        for(int i=D-1;i>=0;i--){
            if(bo[i]==1)continue;
            int re=G-num;
            if(re<=0)break;
            if((i+1)*100*p[i]<=re){
                num+=(i+1)*100*p[i];
                nom+=p[i];
            }else{
                while(num<G){
                    num+=(i+1)*100;
                    nom++;
                }
            }
            
        }
        Ans=min(Ans,nom);
        
    }
    cout << Ans << endl;
    
	return 0;
}

Measured memory_bytes: 256
import math
A,B,C,D = map(int,input().split())

def gcd(a,b):
	while b!=0:
		a,b=b,a%b
	return a


lcm_C_D = (C * D) // gcd(C, D)
rem_C = lcm_C_D // C
rem_D = lcm_C_D // D

lcm_count = rem_C + rem_D - 1


rem_A = A % lcm_C_D
if rem_A != 0:
	dif_A = lcm_C_D - rem_A
	count_A_C = dif_A // C
	count_A_D = dif_A // D
	before_count = count_A_C + count_A_D + 1
else:
	before_count = 1
	dif_A = 0



dif_B = B % lcm_C_D
if dif_B != 0:
	count_B_C = dif_B // C
	count_B_D = dif_B // D
	after_count = count_B_C + count_B_D 
else:
	after_count = 0
	


syou_A = (A + dif_A) // lcm_C_D
syou_B = (B - dif_B) // lcm_C_D
between_count = (syou_B - syou_A) * lcm_count


print(B - A + 1 - (after_count + between_count + before_count))





Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    int i,j,sum;
    cin>>x;
    if(x>=0&&x<=1000000000)
    {
        if(x>=0&&x<5)
            cout<<"0"<<endl;
        else
        {
            i=x/500;
            j=(x-(500*i))/5;
            sum=1000*i+5*j;
            cout<<sum<<endl;
        }
    }
    return 0;
}


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

using namespace std;

multiset<int>s;

const long long INF = 1e17;
const int N = 1e5+2;
int n,k;
int tab[N];
long long dp[N];

int main(){
    ios_base::sync_with_stdio(0);

    cin >> n >> k;

    fill(dp,dp+N,INF);
    int a;
    for (int i=0; i<n; i++) cin >> tab[i];

    dp[0]=0;

    for (int i=1; i<n; i++){

        for (int j=i; j>=0 && i-j <= k; j--){

            dp[i] = min(dp[i], ( dp[j] + (abs(tab[i]-tab[j])) ) );
        }
    }

    cout << dp[n-1];

}

Measured memory_bytes: 1408
#include<stdio.h>

int main()
{
  int H,i;
  int tree[250];

  scanf("%d",&H);

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

  for(i=1;i<=H;i++) {
    printf("node %d: key = %d, ",i,tree[i]);
    if(i/2 >= 1)
      printf("parent key = %d, ",tree[i/2]);
    if(i*2 <=H)
      printf("left key = %d, ",tree[i*2]);
    if(i*2+1 <= H)
      printf("right key = %d, ",tree[i*2+1]);
    printf("\n");
  }

  return 0;
}
      



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

int main (void){
	int n,a,b,p[101],i,x=0,y=0,z=0;
	cin >> n >> a >> b;
	for(i=1;i<=n;i++) {
		cin >> p[i];
		if(p[i]<=a) x++;
		if(p[i]>b) z++;
		if(p[i]>a&&p[i]<=b) y++;
	}
	cout << min(x,(min(y,z))) << endl;
	return 0;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    string S; cin >> S;

    S[3] = '8';
    
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);
      
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      
      if((A + B) > C || (A + B) == C){
          System.out.println("Yes");
      } else {
          System.out.println("No");
      }
      sc.close();
    }
}

Measured memory_bytes: 22868
#include<stdio.h>
int min(int a,int b){return a < b ? a : b;}
int main(){
    char s[100005];
    scanf("%s",s);
    int p = 0, q = 0;
    for(int i = 0; s[i]; i++){
        if(s[i] == '0')
            p++;
        else 
            q++;
    }
    printf("%d\n",2 * min(p, q));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        int n;
        cin >> n;
        int a = n / 100;
        n %= 100;
        int b = n / 10;
        n %= 10;
        int c = n;
        if (a == 7 || c == 7 || b == 7) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 3620
/* Dsingh_24 */
 
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
#define N  100005

int main()
{
	ios
	ll n,i,j;
	cin>>n;
	ll a[n+10],mx[n+2]={0},p[n+2]={0};

	for(i=1;i<=n;i++){
		cin>>a[i];
		p[i]=max(p[i-1],a[i]);
	}
	for(i=n;i>0;i--)
		mx[i]=max(mx[i+1],a[i]);
	for(i=1;i<=n;i++){
		cout<<max(p[i-1],mx[i+1])<<"\n";
	}
	return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
//#define int long long //Strong Power
#ifdef LOCAL
#define lout cout
#else
ostream devnull(0);
#define lout devnull
#endif
#define AMULET \
  cin.tie(0);  \
  ios::sync_with_stdio(false);
// https://github.com/kurokoji/.cpp-Template/blob/master/template/template2.cpp
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...)                                 \
  GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1) \
  (__VA_ARGS__)
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, d) for (decltype(n) i = (a); i < (n); i += (d))
#define rrep(...)                                    \
  GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1) \
  (__VA_ARGS__)
#define rrep1(a) rrep2(_, a)
#define rrep2(i, a) rrep3(i, a, 0)
#define rrep3(i, a, n) rrep4(i, a, n, 1)
#define rrep4(i, a, n, d) for (decltype(a) i = (a); i >= (n); i -= (d))
// -----
typedef long long ll;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class C>
inline void vcin(C &c);
template <class C, class D>
inline void vcin(C &c, D &d);
template <class C>
inline void vcout(const C &c, const string separate = "\n");
template <class T = int>
inline T in();

lint pow2(lint a)
{
  return a * a;
}

void solve()
{
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  rep(i, n) rep(j, d) cin >> x[i][j];

  // auto distance_unroot = [&](int i, int j) {
  //   lint sum = 0;
  //   rep(k, d)
  //       sum += pow2(x[i][k] - x[j][k]);
  //   return sum;
  // };

  lint ans = 0;
  rep(i, n) rep(j, i)
  {
    lout << "i,j:" << i << "," << j << endl;

    //lint norm = distance_unroot(i, j);
    lint norm = 0;
    rep(k, d)
    {
      int diff = abs(x[i][k] - x[j][k]);
      norm += diff * diff;
    }

    lout << norm << endl;

    if (norm == (int)sqrt(norm) * sqrt(norm))
      ans++;
  }

  cout << ans << endl;
}

signed main()
{
  AMULET
  solve();
  return 0;
}

template <class C>
inline void vcin(C &c)
{
  for (auto &a : c)
  {
    cin >> a;
  }
}
template <class C, class D>
inline void vcin(C &c, D &d)
{
  for (auto it1 = c.begin(), it2 = d.begin(); it1 != c.end() && it2 != d.end(); it1++, it2++)
  {
    cin >> *it1 >> *it2;
  }
}
template <class C>
inline void vcout(const C &c, const string separate)
{
  for (auto it = c.begin(); it != c.end(); it++)
  {
    if (it != c.begin())
      cout << separate;
    cout << *it;
  }
}
template <class T = int>
inline T in()
{
  T x;
  cin >> x;
  return (x);
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll a[4];
  for(int i=0;i<4;i++) cin >> a[i];
  ll sz[4] = {1,2,4,8};
  ll N;
  cin >> N;
  N *= 4;
  ll ans[4];
  fill(ans,ans+4,0LL);

  for(int i=3;i>=0;i--){
    ans[i] = N / sz[i];
    N %= sz[i];
  }

  /*for(int i=0;i<4;i++){
    cout << ans[i] << endl;
  }*/

  ll sum = 0LL;
  ll tmp;
  sum += ans[0] * a[0];
  sum += min(ans[1] * 2 * a[0] , ans[1] * a[1]);
  tmp = min(ans[2] * a[2] , ans[2] * 2 * a[1]);
  tmp = min(tmp, ans[2] * 4 * a[0]);
  sum += tmp;
  tmp = min(ans[3]*a[3] , ans[3]*2*a[2]);
  tmp = min(tmp, ans[3]*4*a[1]);
  tmp = min(tmp, ans[3]*8*a[0]);
  sum += tmp;

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		int D = C-(A-B);
		System.out.println(D>0?D:0);
	}

}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

string s;
int ans;
int check(string l){
	int fl=0;
	for(int i=0;i<s.size()-2;i++){
		if(s[i]!=s[i+2]) fl=1;
	}
	return fl;
}
int main(){
	cin >> s;
	if(check(s)==0||(s.size()%2==0&&s[0]!=s[s.size()-1])||(s.size()%2==1&&s[0]==s[s.size()-1])){
		cout << "Second" << endl;
	}else{
		cout << "First" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
main(){
  int N,M;
  cin>>N>>M;
  M/=2;
  int n_pairs0=min(N,M);
  M-=n_pairs0;
  int n_pairs1=M/2;
  cout<<n_pairs0+n_pairs1<<endl;
}


Measured memory_bytes: 256
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]

N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort(reverse=True)

CB = []
for i in range(M):
    b, c = [int(x) for x in input().split()]
    CB.append((c, b))
CB.sort(reverse=True)


L = []
for cb in CB:
    if len(L) >= N:
        break
    L.extend([cb[0]] * cb[1])

newA = A + L
newA.sort(reverse=True)

newA = newA[0:N]
ans = sum(newA)

print(ans)


Measured memory_bytes: 24924
#include <iostream>

using namespace std;

int main() {
	while (1) {
		string s;
		cin >> s;
		int num = s[0] - '0';
		if (num == 0)
			break;
		int sum = 0;
		for (int i = 0; i < s.size(); i++) {
			num = s[i] - '0';
			sum += num;
		}
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1188
# -*- coding: utf-8 -*-
S = str(input())
Q = int(input())

rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
    query = input() # contains spaces
    if query[0] == "1":
        rev_flag *= -1
    else:
        h_or_t_flag = 1 if query[2] == "1" else -1
        h_or_t_flag *= rev_flag
        
        if h_or_t_flag == 1:
            head_str += query[4]
        else:
            tail_str += query[4]

ans = head_str[::-1] + S + tail_str
print(ans if rev_flag == 1 else ans[::-1])

Measured memory_bytes: 4596
from bisect import bisect_left
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            n = bisect_left(L, L[i] + L[j])
            ans += n - (j + 1)
    print(ans)


main()


Measured memory_bytes: 3188