akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500001;
// vector<pair<ll, ll> > adj[N];
// bool vis[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;
// vector<pair<int, char> > adj[N];


void solve()
{ 
    
    int n;
    cin>>n;

    if(n%1000 == 0)
    {
        cout<<0<<endl;
        return;
    }
    
    cout<<1000 - n%1000<<endl;
}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

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

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;
  vll a(n);
  rep(i, n) cin >> a[i];

  ll ans = 0;
  ll mx = 0;
  for (auto v : a) {
    ans += max(0ll, mx - v);
    chmax(mx, v);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4728
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
long long p[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	long long S=0;
	for(int i=0;i<a;i++)S^=p[i];
	int now=0;
	for(int i=59;i>=0;i--){
		int at=-1;
		if(S&(1LL<<i))continue;
		for(int j=now;j<a;j++){
			if(p[j]&(1LL<<i)){
				at=j;
				break;
			}
		}
		if(at!=-1){
			swap(p[now],p[at]);
			for(int j=0;j<a;j++){
				if(j==now)continue;
				if(p[j]&(1LL<<i)){
					p[j]^=p[now];
				}
			}
			now++;
		}
	}
	long long ret=0;
	long long T=0;
	for(int i=0;i<now;i++){
		long long ks=p[i];
		int tb=0;
		for(int j=59;j>=0;j--){
			if(ks&(1LL<<j)){tb=j;break;}
		}
		// if(S+T<(S^ks)+(T^ks)){
			S^=ks;
			T^=ks;
	
		// }
		// if((S&(1LL<<tb))==0){
		// 	S^=ks;
		// 	T^=ks;
		// }
	}

	printf("%lld\n",S+T);
}

Measured memory_bytes: 1024
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2019-12-08
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int a, b, c;
    cin >> a >> b >> c;

    if ( (a + b + c) >= 22) cout << "bust\n";
    else cout << "win\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int count = 0;
    for (int i = a; i <= b; i++) {
        int reversed = 0;
        for (int j = i; j > 0; j /= 10) {
            reversed = reversed * 10 + j % 10;
        }
        if (i == reversed) count++;
    }
    
    cout << count << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc050/tasks/abc050_b
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    int sum = accumulate(ALL(v), 0LL);
    cin >> m;
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        cout << sum - v[a] + b << "\n";
    }

    return 0;
}


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

long long k, x;

int main() {
  cin >> k >> x;
  for(int i = max(-1000000LL, x - k + 1);
      i <= min(1000000LL, x + k - 1); ++i) {
    if(i != max(-1000000LL, x - k + 1)) cout << " ";
    cout << i;
  }
  cout << endl;
  return 0;
}

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

int main()
{
  ll k;
  cin >> k;
  ll a;
  cin >> a;
  ll b;
  cin >> b;
  for (int i=a; i<=b; i++) {
    if (i%k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const int D=30;
const int N=10;

bool path[D][N];
int n,m,g,d;

bool solve(){
    int now=m-1;
    for(int i=0;i<d;++i){
        if(now-1 >= 0 && path[i][now-1]) now=now-1;
        else if(path[i][now]) now=now+1;
    }

    if(now == g-1){
        return true;
    }

    return false;
}

int main(){
    while(cin>>n,n){
        cin>>m>>g>>d;

        for(int i=0;i<D;i++){
            for(int j=0;j<N;j++){
                path[i][j]=false;
            }
        }

        cin.ignore();
        for(int i=0;i<d;i++){
            for(int j=0;j<n-1;j++){
                char ch;
                cin>>ch;
                path[i][j] =(ch=='1');
            }
            cin.ignore();
        }

        if(solve()){
            cout << 0 << endl;
            continue;
        }

        bool flag=false;
        for(int i=0;i<d;i++){
            for(int j=0;j<n-1;j++){
                if(!(j >= 1 && path[i][j-1]) && !(j < n-2 && path[i][j+1]) && !path[i][j]){
                    path[i][j]=true;
                    if(solve()){
                        cout << i+1 << " " << j+1 << endl;
                        flag=true;
                    }
                    path[i][j]=false;
                    if(flag) break;
                }
            }
            if(flag) break;
        }

        if(!flag) cout << 1 << endl;
    }
}

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

int main(){
    int N; cin >> N;
    int A[N];
    for(int i = 0; i < N; i++) cin >> A[i];
    
    int ans = 0;
    for(int i = 0; i < N; i++){
        while(A[i] % 2 == 0){
            ans++;
            A[i] /= 2;
        }
    }

    cout << ans << endl;
    
    
    return 0;
}

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

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

  string s;
  if (a + b < c + d) {
    s = "Right";
  } else if (a + b == c + d) {
    s = "Balanced";
  } else {
    s = "Left";
  }

  cout << s << endl;
}

Measured memory_bytes: 256
<?php
$S=trim(fgets(STDIN));
$Q=trim(fgets(STDIN));
for($I=0;$I<$Q;$I++){
  $C=explode(' ',trim(fgets(STDIN)));

  if($C[0][2]=='i'){
    $p='';
    for($i=$C[1];$i<=$C[2];$i++) $p.=$S[$i];
    echo $p,PHP_EOL;
  }
  elseif($C[0][2]=='v'){
    $l=$C[1]+(($C[2]+1-$C[1])>>1);
    for($i=$C[1];$i<$l;$i++){
      $j=$C[1]+$C[2]-$i;
      $s=$S[$j];
      $S[$j]=$S[$i];
      $S[$i]=$s;
    }
  }
  else for($i=$C[1];$i<=$C[2];$i++) $S[$i]=$C[3][$i-$C[1]];
}

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

#define dcm(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
    //clock_t start = clock();
    ios::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, k; cin >> n >> k;
    int d[10];
    for (int i=0; i<k; ++i) {
        cin >> d[i];
    }
    while (true) {
        vector<int> digits;
        int tmp = n;
        while (tmp/10!=0) {
            digits.push_back(tmp%10);
            tmp /= 10;
        }
        digits.push_back(tmp);
        //for (int i=0; i<digits.size(); ++i) cout << digits[i] << endl;
        int cnt = 0;
        for (int i=0; i<k; ++i) {
            vector<int>::iterator pos = find(digits.begin(), digits.end(), d[i]);
            if (pos!=digits.end()) {
                break;
            } else {
                cnt++;
            }
        }
        if (cnt == k) {
            cout << n << endl;
            return 0;
        } else {
            n++;
        }
    }
    //clock_t stop = clock();
    //cout << (double)(stop-start)/CLOCKS_PER_SEC << " (s)" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long  n,a,b;
    cin>>n>>a>>b;
    if(n==0) { cout<<0; return 0;}
    if(n==1 &&a!=b) {cout<<0;return 0;}
    if(a>b){ cout<<0;return 0;}
    cout <<  (n-1)*b+a - ((n-1)*a+b)+1;
return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	static int a;
	static int b;
	
	public static void main(String[] args) 
	{
		Scanner scanner = new Scanner(System.in);
		List<Sub> subs = new ArrayList<Sub>();
		
		subs.add(new Sub(0));
		subs.add(new Sub(1));
	}

	static class Sub
	{
		int i;
		
		public Sub(int role)
		{
			Scanner scanner2 = new Scanner(System.in);
			
			if(role==0)
			{
				a = scanner2.nextInt();
				b = scanner2.nextInt();
			}
			
			if(role==1)
			{
				System.out.println(a*b + " " + (a+b)*2);
			}
			
		}
	}
}



Measured memory_bytes: 26460
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
map<int, int> mp;
int main()
{
	int n;
	cin >> n;
	vector<int> a;
	for (int i = 0; i < n; i++) {
		int z;
		cin >> z;
		z--;
		a.push_back(z);
	}
	int now = 0;
	int c = 0;
	for (;;) {
		if (now == 1) {
			cout << c;
			break;
		}
		if (c >= n) {
			cout << -1 << endl;
			break;
		}
		c++;
		now = a[now];
	}
	return 0;
}

Measured memory_bytes: 892
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int modpow(int a, int p) {
	if (p == 0)return 1;
	if (p % 2 == 0) {
		int halfP = p / 2;
		int half = modpow(a, halfP);
		return half * half%mod;
	}
	else {
		return a * modpow(a, p - 1) % mod;
	}
}

int calcComb(int a, int b) {
	if (b > a - b)return calcComb(a, a - b);
	int ansMul = 1;
	int ansDiv = 1;
	rep(i, b) {
		ansMul *= (a - i);
		ansDiv *= (i + 1);
		ansMul %= mod;
		ansDiv %= mod;
	}
	int ans = ansMul * modpow(ansDiv, mod - 2) % mod;
	return ans;
}


signed main(void) {
	int x, y;
	cin >> x >> y;
	if ((x + y) % 3 != 0) {
		print(0);
		return 0;
	}
	int a = (-x + 2 * y) / 3;
	int b = (2 * x - y) / 3;
	if (a < 0 || b < 0) {
		print(0);
		return 0;
	}
	int ret = calcComb(a + b, a)%mod;
	print(ret);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ctime>
 using namespace std;
int n,m;
set<int>q;
 int dis(int x1,int y1,int x2,int y2)
 {
     return abs(x1-x2)+abs(y1-y2);
}
int a1[10000],b1[100000],a2[10000],b2[100000];
 int main()
 {
     cin>>n>>m;
     for(int i=1;i<=n;i++)
     {
         cin>>a1[i]>>b1[i];
     }
    for(int i=1;i<=m;i++)
     {
        cin>>a2[i]>>b2[i];
    }
    for(int i=1;i<=n;i++)
    {
         int pos;
       int Max=(1<<31)-1;
         for(int j=1;j<=m;j++)
      {
             int ans=dis(a1[i],b1[i],a2[j],b2[j]);
            //cout<<ans<<endl;
             if(ans<Max)
             {
                 pos=j;
                // cout<<pos<<endl;
                 Max=ans;
             }
         }
        cout<<pos<<endl;
     }
     return 0;
 }

Measured memory_bytes: 3608
#include <stdio.h>

int main() {
	int n, a;
	bool alleven = true;
	scanf("%d", &n);
	while (n--) {
		scanf("%d", &a);
		if (a & 1) {
			alleven = false;
			break;
		}
	}
	if (alleven)
		printf("second\n");
	else
		printf("first\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main()
{
	int w,a,b;
	cin>>w>>a>>b;
	if(a+w<b)
	{
		cout<<b-a-w<<endl;
	}
	else if(b+w<a)
	{
		cout<<a-b-w<<endl;
	}
	else
		cout<<"0\n";

	
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long ;
using P = pair<ll, ll>;
const ll INF = 1e16;

void solver(int N, vector<int> &s, int &ans){

    int sum{};
    for(auto iter = s.begin(); iter != s.end(); ++iter) sum += *iter;

    sort(s.begin(), s.end());

    bool flg_10mul = false;
    for(auto iter = s.begin(); iter != s.end(); ++iter){
        if(sum%10 != 0){
            flg_10mul = true;
            break;
        }
        else if((*iter)%10 != 0){
            sum -= *iter;
            flg_10mul = true;
            break;
        }
    }
    if(flg_10mul) ans = sum;

    return;
}

int main(){

    int N;
    cin >> N;
    vector<int> s(N);
    for(auto iter = s.begin(); iter != s.end(); ++iter) cin >> *iter;

    int ans{};
    solver(N, s, ans);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
A,B = map(int,input().split())
tmp = [A,B]
ans = ["Alice","Bob"]
if tmp[0] == tmp[1]:
    print("Draw")
elif tmp[0] == 1:
    print(ans[0])
elif tmp[1] == 1:
    print(ans[1])
elif tmp[0] > tmp[1]:
    print(ans[0])
else:
    print(ans[1])

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NIL -20000001
#define MAX 20000001

int S[MAX];
int heapsize = 0;

void heapIncreaseKey(int k){
  int i = heapsize;
  int tmp;
  if(k < S[i])
    printf("error\n");
  S[i] = k;
  while(i > 1 && S[i/2] < S[i]){
    tmp = S[i];
    S[i] = S[i/2];
    S[i/2] = tmp;
    i /= 2;
  }
}

void maxHeapInsert(int k){
  heapsize++;
  S[heapsize] = NIL;
  heapIncreaseKey(k);
}
void maxHeapify(int i){
  int l, r, largest, tmp;
  l = 2*i;
  r = 2*i+1;
  if(l <= heapsize && S[l] > S[i])
    largest = l;
  else
    largest = i;
  if(r <= heapsize && S[r] > S[largest])
    largest = r;

  if(largest != i){
    tmp = S[i];
    S[i] = S[largest];
    S[largest] = tmp;
    maxHeapify(largest);
  }
}


void heapExtractMax(void){
  printf("%d\n", S[1]);
  S[1] = S[heapsize];
  heapsize--;
  maxHeapify(1);
}

int main(void){
  int i, k;
  char order[10];
  int largest = 0;


  for(i = 0 ; i < MAX; i++)
    S[i] = NIL;

  while(1){

    scanf("%s", order);
    if(strcmp(order, "end") == 0)break;

    if(strcmp(order, "insert") == 0){
      scanf("%d", &k);
      maxHeapInsert(k);
    }

    if(strcmp(order, "extract") == 0){
      heapExtractMax();
    }
  }

  return 0;
}

Measured memory_bytes: 78728
x,y=map(int,input().split())
mod=pow(10,9)+7
x_=(2*x-y)
y_=(2*y-x)
if x_<0 or y_<0 or x_%3!=0 or y_%3!=0:
  print(0)
  exit()
x_//=3
y_//=3
n=x_+y_
r=min(x_,y_)

a,b=1,1
for i in range(r):
  a*=n-i
  a%=mod
  b*=i+1
  b%=mod
c=(a*pow(b,mod-2,mod))%mod
print(c)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int num = sc.nextInt();
        int count = 0;
        for(int i = 0; i < num; i++){
            int n = sc.nextInt();
            boolean flg = true;
            for(int j = 2; j <= Math.sqrt(n); j++){
                if(n % j == 0){
                    flg = false;
                    break;
                }
            }
            if(flg){
                count++;
            }
        }
        System.out.println(count);
    }
    
}


Measured memory_bytes: 41160
#include<bits/stdc++.h>
#define ll long long int
#define Y printf("YES\n")
#define N printf("NO\n")
#define pb push_back
#define tp make_tuple
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define pr(a) printf("%lld\n",a)
#define r0 return 0
#define pi acos(-1)
using namespace std;

int main()
{
    ll n,m,i,j,k,x,y,z,t;

     //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

     cin>>n;

     k=0;

     ll mn=0;

     for(i=0;i<n;i++)
     {
         cin>>x;

         if(x>mn)mn=x;
         else k+=mn-x;
     }

     cout<<k<<endl;

}


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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

int main() {
  int a,b;
  cin >> a >> b;
  if (a > 0 && a < 10 && b > 0 && b < 10){
    cout << a*b << endl;
  }else{
    cout << -1 << endl;
  }
  return 0;
}


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

int main() {
  string S,T;
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (S[i] == T[i]) ans++;
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    cout << setprecision(6) ;
    double ret = 0;
    rep(i, n){
        double x;
        string u;
        cin >> x >> u;
        if(u == "JPY"){
            ret += x;
        }else{
            ret += 380000.0 * x;
        }
    }
    cout << ret << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    int k;
    cin>>k>>s;
    if(s.size()<=k) cout<<s;
    else {
        for(int i=0;i<k;i++) cout<<s[i];
        cout<<"...";
    }

    return 0;
}

Measured memory_bytes: 3604
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
total = sum(a)

a = Counter(a)
for _ in range(q):
    b, c = map(int, input().split())
    total += a[b] * c
    total -= a[b] * b
    a[c] += a[b]
    del a[b]
    print(total)


Measured memory_bytes: 91248
N, M = map(int, input().split())
H = list(map(int, input().split()))
bad = []
for _ in range(M):
    i, j = map(int, input().split())
    if H[i-1] <= H[j-1]:
        bad.append(i)
    if H[i-1] >= H[j-1]:
        bad.append(j)
print(N-len(set(bad)))


Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int m,s;
    while(~scanf("%d",&n))
    {
        if(n%1000!=0)
        {
            m=n/1000;
            m+=1;
            s=m*1000-n;
            printf("%d\n",s);
        }else
        {
            printf("0\n");
        }
    }
    return 0;
}


Measured memory_bytes: 3824
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
tmp=pow(n,0.5)
tmp=int(tmp)
cnt1=0
cnt2=0
for i in range(tmp):
    if n%(tmp-i)==0:
        cnt1=n//(tmp-i)
        cnt2=tmp-i
        break
print(cnt1+cnt2-2)

Measured memory_bytes: 40044
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repri(i, a, b) for(int i=int(a); i>=int(b); i--)
#define _reps(i,n) repsi(i,1,n)
#define repsi(i,a,b) for(int i=a;i<=int(b);++i)
#define reps(...) _overload3(__VA_ARGS__,repsi,_reps,)(__VA_ARGS__)
#define repr(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define reprs(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;
typedef vector<int> VI;
typedef vector<ll> VL;

ll n;

void Main() {
	cin >> n;
	ll p[n+1];
	reps(i,n) cin >> p[i];

	ll ans=0;
	reps(i,n) {
		if (p[i] == i) {
			ans++;
			if (i!=n) swap(p[i], p[i+1]);
			else swap(p[i], p[i-1]);
		}
	}
	cout << ans << LF;

	return;
}

int main(){
	FAST;
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 1024
#include<cstdio>
using namespace std;
int i,cnt=0,l,a[65],b[65],c[65],z;
void add_edge(int p,int q,int w){a[++cnt]=p;b[cnt]=q;c[cnt]=w;}
void solve(int p,int st,int c)
{
	if(p==0)
	{
		z=st;
		return;
	}
	add_edge(st,st+1,0*c);
	add_edge(st,st+1,1*c);
	if(p%2==0)add_edge(st,0,p*c);
	solve((p-1)/2,st+1,c*2);
}
int main()
{
	scanf("%d",&l);
	l--;
	solve(l,1,1);
	printf("%d %d\n",z,cnt);
	for(i=1;i<=cnt;i++)printf("%d %d %d\n",a[i],b[i]==0?z:b[i],c[i]);
	return 0;
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int h, w, n;
    cin >> h >> w >> n;

    int t = max(w, h);
    int res = n/t;
    if(n-((n/t)*t) > 0) res++;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp makepair
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n" 
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
ll v[200009];
bool a[1000009];
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll n;
  cin>>n;
  ll i=1;
  while(i<=n)
    {
      cin>>v[i];
      i++;
    }
  sort(v+1,v+n+1);
  i=1;
  ll ans=0,j;
  while(i<=n)
  {
    if(v[i]!=v[i-1]&&v[i]!=v[i+1]&&a[v[i]]==0)
    {
      ans++;
    }
      j=2*v[i];
      while(j<=v[n])
      {
        a[j]=1;
        j+=v[i];
      }
    i++;
  }
  deb(ans);
}


Measured memory_bytes: 6080
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    private static int fact(int n) { int ans=1; for(int i=2;i<=n;i++) ans*=i; return ans; }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        int k = in.nextInt();
        int q = in.nextInt();
        int a[] = new int[n];
        for(int i=0;i<q;i++){
            a[in.nextInt()-1]++;
        }
        for(int i:a){
            if(k+i-q>0) out.println("Yes");
            else out.println("No");
        }
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

int main() {
  int x,a;
  cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}


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

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

  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll area = min({a * b, b * c, c * a});
  cout << area << endl;
}

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

int main(){
   ll n;    cin >> n;
   string s;    cin >> s;
   vector<int> wc(n+1), ec(n+1);
   for(int i=0; i<n; i++)
       if(s[i]=='W'){
           wc.at(i+1) = wc.at(i)+1;
           ec.at(i+1) = ec.at(i);
       }else{
          wc.at(i+1) = wc.at(i);
          ec.at(i+1) = ec.at(i)+1; 
       }
    ll ans = 1e+10;
    for(int i=1; i<=n; i++){
        ll tmp = wc.at(i-1) + ec.at(n)-ec.at(i);
        ans = min(tmp, ans);
    }
    cout << ans << endl;
   
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std; 
int N, K; 
vector<int> E[100010]; 
long long int Mul[100010]; // (K-2)Pi mod P
long long int ans = 1; 
long long int P = 1e9 + 7; 
void dfs(int now, int par){
	for(auto i : E[now]){
	    if(i == par) continue; 
	    dfs(i, now); 
	    if(E[i].size() >= K) ans = 0; 
	    else if(i != 0){
		    ans *= Mul[E[i].size() - 1]; 
		    ans %= P; 
	    }
	}
}
int main(){
	cin >> N >> K; 
	for(int i = 1; i < N; i++){
		int a, b; cin >> a >> b; 
		a--; b--; 
		E[a].push_back(b); 
		E[b].push_back(a); 
	}
	Mul[0] = 1; 
	for(int i = 1; i < K-1; i++){
		Mul[i] = (long long) Mul[i-1] * (K-i-1) % P; 
	}
	dfs(0, -1); 
	if(E[0].size() >= K) ans = 0; 
	else{
	    for(int i = K - E[0].size(); i <= K; i++){
	        ans *= (long long) i; ans %= P; 
	    }
	}
	cout << ans << endl; 
}

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

pair<int, int> makePair(int x) {
  int a = 0;
  int b = x % 10;
  while (x) {
    a = x;
    x /= 10;
  }
  return make_pair(a, b);
}

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

  // 1234 の場合、
  // pair(1, 4) にして、
  // map[pair(1,4)]に 1 加える
  map<pair<int,int>, int> mp;
  for (int i = 1; i <= n; i++) {
    pair<int, int> p = makePair(i);
    mp[p]++;
  }

  int answer = 0;

  // 1234の場合、
  // pair(4,1)にして、
  // 答えに map[pair(4,1)] の値を加える
  for (int i = 1; i <= n; i++) {
    pair<int, int> p = makePair(i);
    pair<int, int> q = make_pair(p.second, p.first);
    answer += mp[q];
  }

  cout << answer << endl;

}

Measured memory_bytes: 256
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

d = {}
for y in range(H):
    Ay = A[y]
    for x in range(W):
        d[Ay[x]] = (y, x)

t = [[0] * (H * W // D + 1) for _ in range(D)]
for i in range(D):
    ti = t[i]
    j = 0
    if i == 0:
        j = 1
    while i + (j + 1) * D <= H * W:
        y1, x1 = d[i + j * D]
        y2, x2 = d[i + (j + 1) * D]
        ti[j + 1] = abs(y1 - y2) + abs(x1 - x2)
        j += 1
    for j in range(len(ti) - 1):
        ti[j + 1] += ti[j]

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    i = L % D
    print(t[i][(R - i) // D] - t[i][(L - i) // D])


Measured memory_bytes: 28388
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define Max 			1e6
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define ppb				pop_back
#define pf				push_front
#define ppf				pop_front
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define v 				vector
#define mii             map<ll,ll>
#define pq              priority_queue<ll>
#define pqm             priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define sp 				' '
#define pi 				3.14159265359
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void IO()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
void fastIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
int main()
{
	fastIO();
	IO();
	ll n;
	cin >> n;
	string s;
	v<ll> a(4, 0);
	while (n--)
	{
		cin >> s;
		if (s == "AC")
		{
			a[0]++;
		}
		if (s == "WA")
		{
			a[1]++;
		}
		if (s == "TLE")
		{
			a[2]++;
		}
		if (s == "RE")
		{
			a[3]++;
		}
	}
	cout << "AC x " << a[0] << endl;
	cout << "WA x " << a[1] << endl;
	cout << "TLE x " << a[2] << endl;
	cout << "RE x " << a[3] << endl;
	return 0;
}

Measured memory_bytes: 3660
#!/usr/bin/env python3

def main():
    n, z, w = input().split()
    n = int(n)
    w = int(w)
    a = list(map(int, input().split()))
    a = [w] + a

    sx = s_min = s_max = abs(a[n] - a[n - 1])
    for i in range(n - 1, 0, -1):
        sx = max(s_max, abs(a[n] - a[i - 1]))
        sy = min(s_min, abs(a[n] - a[i - 1]))
        s_max = max(s_max, sy)
        s_min = min(s_min, sx)

    print(sx)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
#include <bits/stdc++.h>
//#define int long long

using namespace std;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    vector <int> cnt(2019, 0);
    ++cnt[0];
    vector <int> pows(200005);
    pows[0] = 1;
    for (int i = 1; i < 200005; ++i) pows[i] = pows[i - 1] * 10 % 2019;
    int suma = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        suma = (suma + pows[n - i - 1] * (s[i] - '0')) % 2019;
        ans += cnt[suma];
        ++cnt[suma];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4332
package main

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

var sc = bufio.NewScanner(os.Stdin)
var rd = bufio.NewReaderSize(os.Stdin, 10000000)

func readLine() string {
  buf := make([]byte, 0, 10000000)
  for {
	l, p, _ := rd.ReadLine()
	buf = append(buf, l...)
	if !p {
	  break
	}
  }
  return string(buf)
}

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

func nextInt() int {
  sc.Scan()
  i, _ := strconv.Atoi(sc.Text())
  return i
}

func main() {
  sc.Split(bufio.ScanWords)
  N, Y := nextInt(), nextInt()
  T := true

  for i := 0; i <= N && T; i++ {
    for j := 0; i + j <= N && T; j++ {
      k := N - (i + j)
      if i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y {
        T = false
        fmt.Println(i, j, k)
	  }
	}
  }

  if T {
    fmt.Println(-1, -1, -1)
  }
}

Measured memory_bytes: 2160
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    L = [int(i) for i in readline().split()]
    #まず三角形ができる組みを考える
    #三重ループでも間に合うので三重ループを回す
    L.sort()
    cnt = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[k] < L[i] + L[j]:
                    if (L[i] != L[j]) & (L[j] != L[k]) & (L[k] != L[i]):
                        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

    string S;
    cin >> S;
    bool isOk = false;
    REP(i, S.length()) {
        if(S[i] == '7') {
            isOk = true;
        }
    }
    printf("%s\n", isOk ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 3616
package main

import "math"
import "strings"
import "fmt"
import "strconv"

func main(){    
    var N int
    fmt.Scanf("%d", &N)

    digit := int(math.Floor(math.Log10(float64(N)))) + 1
    //fmt.Printf("digit -> %d\n", digit)
    numStrs := make([]string, 0)
    for i:=3; i<=digit; i++ {
        nums := gen753NumStrs(i)
        numStrs = append(numStrs, nums...)
    }
    /*
    for _, t := range numStrs{
        fmt.Printf("%s\n", t)
    }
    */
    count :=0 
    for _, str := range numStrs {
        if strings.Contains(str, "3") && strings.Contains(str, "5") && strings.Contains(str, "7") {
            num, _ := strconv.Atoi(str)
            if num <= N {
                //fmt.Printf("num -> %d\n", num)
                count += 1
            }
        }
    }

    fmt.Printf("%d\n", count)
}

var NUMS753 = []string{"3", "5", "7"}

func gen753NumStrs(digit int) []string{
    if digit == 1 {
        return NUMS753
    }

    strs := make([]string, 0)
    preStrs := gen753NumStrs(digit - 1)
    for _, preStr := range preStrs {
        for _, s := range NUMS753 {
            str := s + preStr
            strs = append(strs, str)
        }
        
    }
    return strs
}



Measured memory_bytes: 5120
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			if ((n | m) == 0)
				break;
			List<Point>[] lists = new ArrayList[n + 1];
			for (int i = 0; i <= n; i++)
				lists[i] = new ArrayList<Point>();
			for (int i = 1; i <= n; i++) {
				int k = scanner.nextInt();
				for (int j = 0; j < k; j++) {
					int x = scanner.nextInt();
					int cost = scanner.nextInt();
					lists[i - 1].add(new Point(1, x, cost));
					if (i != 1)
						lists[i - 2].add(new Point(2, x, cost));
					if (i == n - 1)
						lists[i].add(new Point(2, x, 0));
					if (i == n)
						lists[i].add(new Point(1, x, 0));

				}
			}
			PriorityQueue<Point> pq = new PriorityQueue<Main.Point>();
			pq.offer(new Point(0, 0, 0, 0, m));
			int[][][] dp = new int[m + 1][n + 1][1001];
			for (int[][] d : dp)
				for (int[] dd : d)
					Arrays.fill(dd, Integer.MAX_VALUE);
			dp[m][0][0] = 0;
			while (!pq.isEmpty()) {
				Point point = pq.poll();
				int y = point.y;
				int x = point.x;
				int cost = point.cost;
				int total = point.total;
				int mm = point.m;

				if (y >= n) {
					System.out.println(total);
					break;
				}
				if (dp[mm][y][x] < total)
					continue;
				for (Point p : lists[y]) {
					int nc = (cost + p.cost) * Math.abs(x - p.x) + total;
					int ny = Math.min(n, y + p.y);
					if (p.y == 2) {
						if (mm >= 1) {
							if (dp[mm - 1][ny][p.x] > nc) {
								dp[mm - 1][ny][p.x] = nc;
								pq.offer(new Point(ny, p.x, p.cost,
										y == 0 ? 0 : nc, mm - 1));
							}
						}
					} else {
						if (dp[mm][ny][p.x] > nc) {
							dp[mm][ny][p.x] = nc;
							pq.offer(new Point(ny, p.x, p.cost, y == 0 ? 0
									: nc, mm));
						}
					}
				}
			}

		}
	}

	class Point implements Comparable<Point> {
		int y, x, cost, total, m;

		public Point(int y, int x, int cost, int total, int m) {
			super();
			this.y = y;
			this.x = x;
			this.cost = cost;
			this.total = total;
			this.m = m;
		}

		public Point(int y, int x, int cost) {
			super();
			this.y = y;
			this.x = x;
			this.cost = cost;

		}

		@Override
		public String toString() {
			return "Point [y=" + y + ", x=" + x + ", cost=" + cost + ", total="
					+ total + ", m=" + m + "]";
		}

		@Override
		public int compareTo(Point o) {
			if (this.total == o.total)
				return o.y - this.y;
			return this.total - o.total;
		}
	}
}

Measured memory_bytes: 169540
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

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

int main() {
    int n;
    while(cin >> n, n){
        auto v = make_v(10, 10, INF<int>);
        for (int i = 0; i < 10; ++i) {
            v[i][i] = 0;
        }
        int mx = 0;
        for (int i = 0; i < n; ++i) {
            int a, b, c;
            scanf("%d %d %d", &a, &b, &c);
            chmin(v[a][b], c);
            chmin(v[b][a], c);
            chmax(mx, max(a, b)+1);
        }
        for (int k = 0; k < mx; ++k) {
            for (int i = 0; i < mx; ++i) {
                for (int j = 0; j < mx; ++j) {
                    chmin(v[i][j], v[i][k]+v[k][j]);
                }
            }
        }
        vector<int> s(mx, 0);
        for (int i = 0; i < mx; ++i) {
            for (int j = 0; j < mx; ++j) {
                s[i] += v[i][j];
            }
        }
        auto a = min_element(s.begin(),s.end());
        printf("%ld %d\n", a-s.begin(), *a);
    }

    return 0;
}


Measured memory_bytes: 3280
import qualified Data.ByteString.Lazy.Char8 as B                                
import Data.Maybe                                                               
import qualified Data.IntMap as IM                                              
                                                                                
solve :: [Int] -> Int                                                           
solve (n:as) =                                                                  
  foldr (\x a -> a + x*(x-1) `div` 2) 0 $                                       
        foldr (IM.alter upd) IM.empty $                                         
              scanl (+) 0 as                                                    
  where                                                                         
    upd Nothing  = Just 1                                                       
    upd (Just c) = Just (c+1)                                                   
                                                                                
main = putStrLn . show . solve . map (fst . fromJust . B.readInt) . B.words     
         =<< B.getContents                                                      

Measured memory_bytes: 32124
# 2019/04/06
# AtCoder Beginner Contest 123 - C

# Input
n = int(input())
tl = list()
minval = 10 ** 16

for i in range(5):
    tl.append(int(input()))
    if tl[i] < minval:
        minval = tl[i]

ans = int(n / minval) + 4
if n % minval > 0:
    ans += 1

# Output
print(ans)


Measured memory_bytes: 3060