akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
int main(void){
    int n;
    cin >> n;
    
    vector<int> d(n); 
    for (int i = 0; i < n; i++) cin >> d[i];
    
    sort(d.begin(), d.end());
    
    int ans;
    
    int mid = n / 2;
    
    ans = d[mid] - d[mid-1];
    
    cout << ans << endl;
    
}


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

int main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int a[3][3];
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++)
			cin >> a[i][j];
	}

	bool mark[3][3]; memset(mark, 0, sizeof mark);
	int n; cin >> n;
	while(n--) {
		int x; cin >> x;
		bool ok = 0;
		for(int i = 0; i < 3 && !ok; i++) {
			for(int j = 0; j < 3 && !ok; j++) {
				if(a[i][j] == x) {
					mark[i][j] = 1;
					ok = 1;
				}
			}
		}
	}

	bool ok = 0;
	for(int i = 0; i < 3 && !ok; i++) {
		if(mark[i][0] && mark[i][1] && mark[i][2])
			ok = 1;
	}

	for(int i = 0; i < 3 && !ok; i++) {
		if(mark[0][i] && mark[1][i] && mark[2][i])
			ok = 1;
	}
	if(mark[0][0] && mark[1][1] && mark[2][2])
		ok = 1;
	if(mark[2][0] && mark[1][1] && mark[0][2])
		ok = 1;

	if(ok)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';

	return 0;
}

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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        int n;
        cin >> n;
        int odd = n/2 + n%2;
        cout << setprecision(10) << fixed << 1.0*odd/n << endl;
        return 0;
}











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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int N; cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());

    ll sum = 0;
    if(N % 2 == 1){
        rep(i,N/2) sum += A[N-1-i];
        rep(i,N/2) sum += A[N-2-i];
    }else{
        rep(i,N/2-1) sum += A[N-1-i];
        rep(i,N/2-1) sum += A[N-2-i];
        sum += A[N-N/2];
    }
    cout << sum << endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(a)  (a).begin(),(a).end()

int main(){
  int n,count=0;
  cin >> n;
  vector<int> p(n),q(n);
  for(int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    p.at(i) = tmp;
    q.at(i) = tmp;
  }
  sort(all(q));
  for(int i=0;i<n;i++){
    if(p.at(i) != q.at(i)){
      count++;
    }
  }
  if(count <= 2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
primes = 2 : filter isPrime [3,5..]
  where
    isPrime n = all ((>0) . (rem n)) $ takeWhile (\x -> x ^ 2 <= n) primes

primefct n = unwords $ map show (fct n primes)
  where
    fct n xs'@(x:xs)
      | x ^ 2 > n    = [n]
      | rem n x == 0 = x : fct (div n x) xs'
      | otherwise    = fct n xs

main = do
  s <- readLn
  putStrLn $ show s ++ ": " ++ primefct s

Measured memory_bytes: 4048
using System;
class Program
{
	static void Main(string[] args)
	{
        		string input = Console.ReadLine();
        		int num = int.Parse(input);
		if (num == 25) {
			Console.WriteLine("Christmas");
		} else if (num == 24){
			Console.WriteLine("Christmas Eve");
		} else if (num == 23) {
			Console.WriteLine("Christmas Eve Eve");
		} else if (num == 22) {
			Console.WriteLine("Christmas Eve Eve Eve");
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  VEC(int, A, N - 1);
  vi v(N);
  rep(i, 0, N - 1) {
    v[A[i] - 1]++;
  }
  rep(i, 0, N) {
    print(v[i]);
  }
}


Measured memory_bytes: 4784
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long l = -1000000000000000001L;
        long r = 1000000000000000001L;

        while (r - l > 1) {
            long mid = (l + r) / 2;
            if (ok(a, n, k, mid)) {
                r = mid;
            } else {
                l = mid;
            }
        }

        System.out.println(r);
    }

    static boolean ok(long[] a, int n, long k, long b) {
        long num = 0;
        for (int i=0; i<n; i++) {
            int c = 0;
            if(a[i] >= 0) {
                if(a[i] * a[0] > b) {
                    c = 0;
                } else if( a[i] * a[n-1] <=b ) {
                    c = n;
                } else {
                    int l = 0;
                    int r = n - 1;
                    while (r - l > 1) {
                        int mid = (r + l) / 2;
                        if (a[i] * a[mid] <= b) {
                            l = mid;
                        } else {
                            r = mid;
                        }
                    }
                    c = l + 1;
                }
                num += Math.max(0, c - (i+1));
            } else {
                if(a[i] * a[n-1] > b) {
                    c = 0;
                } else if ( a[i] * a[0] <= b) {
                    num += n - 1 - i;
                } else {
                    int l = 0;
                    int r = n - 1;
                    while (r - l > 1) {
                        int mid = (r+l)/ 2;
                        if(a[i] * a[mid] <= b) {
                            r = mid;
                        } else {
                            l = mid;
                        }
                    }
                    num += Math.min(n - r, n - 1 - i);
                }
            }
        }
        return num >= k;
    }

}


Measured memory_bytes: 85912
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    ll n; cin >> n;
    ll m = (int)pow(n, 0.5);
    ll ans = 1e13;
    for(ll a = 1; a <= m; ++a){
        ll b;
        if(n % a == 0) b = n / a; 
//        cout << a << " " << b << endl;
        if(a + b - 2 < ans) ans = a + b - 2;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            配るDP();
        }

        static void 配るDP()
        {
            var N = ReadInt();
            var h = ReadSplitInt();
            var dp = new int[N + 1];

            for (int i = 0; i < N + 1; i++)
            {
                dp[i] = int.MaxValue;
            }

            dp[0] = 0;

            for (int i = 0; i < N-1; i++)
            {
                if (i == N-2)
                {
                    dp[i + 1] = Min(Abs(h[i] - h[i + 1]) + dp[i], dp[i + 1]);
                    continue;
                }

                dp[i + 1] = Min(Abs(h[i] - h[i + 1]) + dp[i], dp[i + 1]);
                dp[i + 2] = Min(Abs(h[i] - h[i + 2]) + dp[i], dp[i + 2]);
            }
            Println(dp[N - 1]);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 35792
A, B = map(int, input().split())
N = list(input())
num = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

for i in range(len(N)+1):
    if i == len(N):
        print('Yes')
    elif i == A:
        if N[i] == '-':
            continue
        else:
            print('No')
            break
    else:
        if N[i] in num:
            continue
        else:
            print('No')
            break
        

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*f;
}
const ll N=2e3+10,mod=1e9+7;
ll n,a[N*100],b[N*100],fac[N*100],inv[N*100],f[N<<1|1][N<<1|1],ans;
inline void Add(ll &x)
{
	x=(x>=mod)?x-mod:x;
}
inline ll Calc(ll x,ll y)
{
	return (fac[x]*inv[y]%mod)*inv[x-y]%mod;
}
inline ll ksm(ll x,ll y)
{
	ll res=1ll;
	for(;y;y>>=1,x=x*x%mod)if(y&1)res=res*x%mod;
	return res;
}
int main()
{
	n=read();
	for(ll i=1;i<=n;i++)
	{
		a[i]=read();
		b[i]=read();
		f[N-a[i]][N-b[i]]++;
	}
	for(ll i=1;i<=(N<<1);i++)for(ll j=1;j<=(N<<1);j++)
	{
		Add(f[i][j]+=f[i-1][j]);
		Add(f[i][j]+=f[i][j-1]);
	}
	fac[0]=fac[1]=1ll;
	for(ll i=2;i<=(N<<2);i++)fac[i]=fac[i-1]*i%mod;
	inv[N<<2]=ksm(fac[N<<2],mod-2);
	for(ll i=(N<<2);i;i--)inv[i-1]=inv[i]*i%mod;
	for(ll i=1;i<=n;i++)
	{
		Add(ans+=f[N+a[i]][N+b[i]]);
		Add(ans+=(mod-Calc(((a[i]+b[i])<<1),(a[i]<<1))));
	}
	printf("%lld\n",ans*ksm(2,mod-2)%mod);
    return 0;
}
/*
*/

Measured memory_bytes: 133256
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {

	uint N;
	cin >> N;

	vector<int> h(N);
	for(uint i=0; i<N; i++) {
		cin >> h[i];
	}

	uint dp_2 = 0;
	uint dp_1 = abs(h[0] - h[1]);
	ull dp = dp_1;

	for(uint i=2; i<N; i++) {
		uint cost_2 = abs(h[i] - h[i-2]);
		uint cost_1 = abs(h[i] - h[i-1]);

		dp = min(cost_2 + dp_2, cost_1 + dp_1);

		dp_2 = dp_1;
		dp_1 = dp;
	}

	cout << dp;
	return 0;
}


Measured memory_bytes: 640
S = str(input())
BW, WB = 0, 0
for n in range(0, len(S)):
    if n % 2 == 0:
        # 偶数番目(0, 2, 4)
        if S[n] == "0":
            # B
            WB += 1
        else:
            # W
            BW += 1
    else:
        # 奇数番目(1, 3, 5)
        if S[n] == "0":
            # B
            BW += 1
        else:
            # W
            WB += 1

if BW < WB:
    print(BW)
else:
    print(WB)

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

int main(){
  int n; vector<pair<int,int>> town;
  cin >> n; town.resize(n);
  for(int i=0;i<n;i++){
    cin >> town.at(i).first >> town.at(i).second;
  }
  sort(town.begin(),town.end());
  
  double dsum = 0; int cnt=0;
  do{
    double d = 0.0; pair<int,int> from = town.at(0);
    for(pair<int,int> p : town){
      d += (double)sqrt(pow(p.first-from.first,2)+pow(p.second-from.second,2));
      from = p;
    }
    dsum += d; cnt++;
  }while(next_permutation(town.begin(),town.end()));
  cout << setprecision(12) << dsum/(double)cnt << endl;
}

Measured memory_bytes: 256
program ABC134C;
var
	n, i, m0, m1, x: integer;
	A: array[0..200000] of integer;
begin
	read(n);
	m0 := 0;
	m1 := 0;
	for i := 1 to n do begin
		read(x);
		if x > m0 then begin
			m1 := m0;
			m0 := x;
		end
		else if x > m1 then begin
			m1 := x;
		end;
		A[i] := x;
	end;
	for i := 1 to n do begin
		if A[i] = m0 then begin
			writeln(m1);
		end
		else begin
			writeln(m0);
		end;
	end;
end.


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N; cin>>N;
  string S;
  while(N>0){
    ll n=N%26;
    if(n==0){
      S+='z';
      N-=26;
    }
    else S+=n-1+'a';
    N/=26;
  }
  ll ssz=S.size();
  for(ll i=ssz-1; i>=0; i--) cout<<S[i];
  cout<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int a,b,c,x,y;
int main(){
    cin >> a >> b >> c >> x >> y;
    ll ans = a*x + b*y;
    ll tmp;
    if(x > y){
        tmp = c*2*y + (x-y)*a;
        ans = min(tmp,ans);
    } else {
        tmp = c*2*x + (y-x)*b;
        ans = min(ans,tmp);
    }
    tmp = max(x,y)*c*2;
    ans = min(ans,tmp);
    cout << ans << endl;
}



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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

int main(){

    ll n, k; cin >> n >> k;

    ld ans = 0.0;
    for(ll i=1;i<=n;i++){
        ll j;
        for(j=0;(i*pow(2, j))<k;j++);
        ans += (ld)1/(ld)(pow(2, j)*n);
    }

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    ll sum = 0;
    for(ll a : A){
        sum += a;
    }
    
    if(sum%10!=0){
        p(sum);
        return 0;
    }
    else{
        sort(ALL(A));
        for(ll a : A){
            if(a%10!=0){
                // それを引いて終了
                p(sum-a);
                return 0;
            }
        }
        // 引くものがなかった
        p(0);
        return 0;
    }
    
    return 0;
}

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

int main()
{
    int n,l[1000],ans=0,m;
    cin>>n;
    m = 2*n;
    vector<int>v;
    for(int i=0;i<m;i++)
    {
        cin>>l[i];
    }
    sort(l,l+m);
    for(int i=0;i<m;i=i+2)
    {
        v.push_back(l[i]);
    }

    for(int i=0;i<v.size();i++)
    {
        ans = ans + v[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll k, now;
    cin >> k;
    if(k <= 9){
        cout << k << endl;
        return 0;
    }
    priority_queue<ll, vector<ll>, greater<ll>> que;
    REP(i, 9)que.push(i);
    rep(i, k){
        now = que.top();
        que.pop();
        if(now % 10 == 0){
            que.push(now*10);
            que.push(now*10+1);
        }
        else if(now % 10 == 9){
            que.push(now*10+9);
            que.push(now*10+8);
        }
        else{
            ll a = now % 10;
            que.push(now*10+a);
            que.push(now*10+a+1);
            que.push(now*10+a-1);
        }
    }
    cout << now << endl;
}   

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

A = [input() for i in range (N)]

AC = A.count('AC')
WA = A.count('WA')
TLE = A.count('TLE')
RE= A.count('RE')

print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n;
int x,y;
int sum=0,sum2=0;

int32_t main()
{
    IOS
    cin>>n;
    while (n--)
    {
        cin>>x>>y;
        sum+=x*y;
        sum2+=y;
    }
    cout<<(sum-1)/9+(sum2-1)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
	int n=0,d,sw;
	long int i,j,k,s[1000],sum;

	while(1)
	{
		n=1;
		sum=0;
		scanf("%d",&d);
		if(!d)
			break;
		s[0]=2;
		s[1]=3;
		if(d<=2)
		{
			for(i=0;i<d;i++)
				sum+=s[i];
		}
		else
		{
			sum=5;
			for(i=5;;i+=2)
			{
				sw=0;
				k=(long int)sqrt((double)i);
				for(j=0;s[j]<=k;j++)
				{
					if(i%s[j]==0)
					{
						sw=1;
						break;
					}
				}
				if(!sw)
				{
					n++;
					if(n<1000)
						s[n]=i;
					sum+=i;
					if(n==d-1)
						break;
				}
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 608
x, y = map(int, input().split())
#print(x,y)
if y % 2 == 1:
  print("No")
elif x == 0 and y != 0:
  print("No")
elif x != 0 and y == 0:
  print("N0")
elif x * 2 <= y and x * 4 >= y:
  print("Yes")
else:
  print("No")

  

Measured memory_bytes: 9156
/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
const int N = 201000;
int n;
ll x, p[N], ans = infll, sum[N];
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(), x = read();
	for (int i = 1; i <= n; i++) p[i] = read();
	int lim = n / 1000;
	sum[0] = n * x;
	for (int i = 1; i <= n; i++) sum[i] = x; 
	sum[1] += p[n] * 5; 
	for (int i = 1; i <= n; i++){
		int id = n - i + 1, nxt = 1, k = i - 1;
		bool flag = false;
		for (int j = 1; j <= k; j = nxt + 1){
			nxt = k / (k / j);
			int w = k / j + 1;
			if (j != 1 && flag == true){
				int las = k / (j - 1) + 1;
				sum[j] = sum[j] - p[id] * (2 * las + 1);
			}
			if (j >= lim || k / j == 1){
				sum[j] = sum[j] + p[id] * (2 * w + 1);
				flag = true;
			}
		} 
	} 
	for (int i = 1; i <= n; i++){
		sum[i] += sum[i - 1]; 
		if (i >= lim) ans = min(ans, sum[i]);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 ll k,m,n,s,x;
 s=0;
 map<ll,ll> mp;
 cin >> n >> m;
 while(n--)
 {
  cin >> x;
  mp[x]++;
 }
 while(m--)
 {
  auto it=mp.end();
  it--;
  k=(it->ff)/2;
  mp[it->ff]--;
  if(mp[it->ff]==0)
  mp.erase(it->ff);
  mp[k]++;
 }
 for(auto it:mp)
 s+=(it.ff*it.ss);
 cout << s;
 return 0;
}

Measured memory_bytes: 9848
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
template <typename T> class dijkstra {
private:
  using ll = long long;
  using pp = pair<int, ll>;
public:
  ll INF_DIST = std::numeric_limits<ll>::max() / 2;
private:
  int start = 0;
  int siz = 0;
  void calc (const vector<vector<pair<int, T>>>& g) {
    dist.resize(siz);
    fill(dist.begin(), dist.end(), INF_DIST);
    dist[start] = 0;
    priority_queue<pp, vector<pp>, greater<pp>> que;
    que.emplace(0, start);
    while (que.size()) {
      pp cur = que.top();
      que.pop();
      int idx = cur.second;
      ll d = cur.first;
      if (d > dist[idx]) continue;
      for (const pp& nxt : g[idx]) {
        int j = nxt.first;
        ll d2 = d + nxt.second;
        if (d2 <  dist[j]) {
          dist[j] = d2;
          que.emplace(dist[j], j);
        }
      }
    }
  }
public:
  dijkstra (const vector<vector<pair<int, T>>>& g, int st, int n = -1) : start(st) {if (n < 0) siz = (int) g.size(); calc(g); }
  dijkstra (const vector<pair<int, T>> in[], int st, int n) : start(st), siz(n) {
    vector<vector<pair<int, T>>> g(n);
    for (int i = 0; i < n; ++i) for (int j = 0; j < (int) in[i].size(); j++) g[i].push_back(in[i][j]);
    calc(g);
  }
  vector<ll> dist;
  vector<ll> get() {return dist;}
};
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m, r;
  cin >> n >> m >> r;
  vector<vector<pair<int, int>>> g(n);
  for (int i = 0; i < m; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    g[s].emplace_back(t, c);
    //g[t].emplace_back(s, c);
  }
  dijkstra<int> di(g, r);
  for (int i = 0; i < n; i++) {
    if (di.dist[i] != di.INF_DIST) cout << di.dist[i] << '\n';
    else cout << "INF\n";
  }
  // int n, m;
  // cin >> n >> m;
  // vector<vector<pair<int, int>>> g(m + 1);
  // for (int i = 1; i <= m; i++) g[i].emplace_back(i - 1, 0);
  // for (int i = 0; i < n; i++) {
  //   int x, s;
  //   cin >> x >> s;
  //   for (int left = max(0, x - s), right = min(m, x + s), cost = 0; left > 0 || right < m; left = max(0, --left), right = min(m, ++right), cost++) {
  //     g[left].emplace_back(right, cost);
  //   }
  // }
  // dijkstra dkt(g, 0);
  // cout << dkt.dist[m] << '\n';
  return 0;
}


Measured memory_bytes: 14380
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Integer integ = sc.nextInt();
         
      	Integer fh = 0;
      	while(integ >= 500){
        	integ -= 500;
          	fh++;
        }
      	Integer f = 0;
      	while(integ >= 5){
        	integ -= 5;
          	f++;
        }
      	int happy = (fh*1000) + (f*5);
      
		System.out.println(happy);
	}
}

Measured memory_bytes: 57680
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
ll factorial(ll kaijou)
{
    ll sumRes = 1;
	for (ll i = 1; i <= kaijou; i++) {
		ll sumPrev = sumRes % MOD;
		ll sumNext = sumPrev * (i % MOD);
		sumRes = sumNext % MOD;
    }
    return sumRes;
}

int main()
{
	ll N, M;
	cin >> N >> M;

	ll ans = 0;
	if (N == M) {
		ans = (factorial(N) * factorial(M)) % MOD;
		ans *= 2;
		ans %= MOD;
	} else if ((N == (M + 1)||((N + 1) == M))) {
		ans = (factorial(N) * factorial(M)) % MOD;
	}

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



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n,m,c,a,b[100],sum,ans=0;
    cin>>n>>m>>c;
    for(int i=0;i<m;i++) cin>>b[i];
    for(int i=0;i<n;i++){
        sum=c;
        for(int i=0;i<m;i++){
            cin>>a;
            sum+=a*b[i];
        }
        if(sum>0) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const int M = 1000000007;

int n;
map<pair<string,int>, int> memo;

bool isAGC(string& s){
	rep(i,s.size()){
		string t = s;
		if(i >= 1){
			swap(t[i - 1], t[i]);
		}
		if(t.find("AGC") != string::npos) return true;
	}
	return false;
}

int dfs(string s, int cnt){
	if(memo.count(make_pair(s,cnt))) return memo[make_pair(s,cnt)];

	if(isAGC(s)) return 0;
	if(cnt == n) return 1;

	int sum = 0;
	rep(i,4){
		sum += dfs(s.substr(1,3) + "ACGT"[i], cnt + 1);
		sum %= M;
	}

	return memo[make_pair(s,cnt)] = sum;
}

signed main(){
	cin >> n;

	cout << dfs("@@@@", 0) << endl;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
int main(void){
  int N;
  cin>>N;
  int ans1=N/1.08;
  int ans2=ans1+1;
  if((int)(ans1*1.08)==N)cout<<ans1<<endl;
  else if((int)(ans2*1.08)==N)cout<<ans2<<endl;
  else cout<<":("<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(raw_input())
T, A = map(int, raw_input().split(" "))

H = map(int, raw_input().split(" "))
index = 0
closet = abs(T - 0.006*H[0] - A)
for i in range(1, N):
    diff = abs(T - 0.006*(H[i]) - A)
    if diff == 0:
        index = i
        break
    elif diff < closet:
        closet, index = diff, i
print index + 1

Measured memory_bytes: 2692
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
string s;
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5]){
  cout<<"Yes"<<endl;
    
  }
  else{
  cout<<"No"<<endl;
  }
 
 
 
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(void) {
    io;
    int n;
    string s;
    cin >> n >> s;
    int x = 0;
    int res = 0;
    rep(i,n) {
        if (s[i] == 'D') {
            x--;
        } else {
            x++;
        }
        if (res < x) res = x;
    }
    cout << res << "\n";
    return 0;
}



Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    int t;
    cin>>t;
    for(int q=0;q<t;q++){
        int n;
        cin>>n;
        int a,b;
        int u=0,d=0;
        int au=0,ad=0;
        for(int i=0;i<n;i++){

            cin>>a;
            if(i>=1){
                if(a>b){
                    d=a-b;
                }
                else u=b-a;
                au=max(au,u);
                ad=max(ad,d);
            }
            b=a;
        }
        cout<<ad<<" "<<au<<endl;
    }

	return 0;
}

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

int calc(int a, int b, char op) {
    switch(op){
      case '+':
        return a+b;
      case '-':
        return a-b;
      case '*':
        return a*b;
      case '/':
        return a/b;
    }
}

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;
    while (op != '?') {
      cout << calc(a, b, op) << endl;
      cin >> a >> op >> b;
    }

    return 0;
}


Measured memory_bytes: 3072
from collections import Counter
from itertools import combinations_with_replacement
N, M = map(int, input().split())
mod = 10 ** 9 + 7

# 重複組み合わせ
def nHk(n, k):
    value = 1
    nk = n + k - 1
    k = min(nk-k, k)
    for i in range(k):
        value = (value * nk) % mod
        nk -= 1
    for x in range(1, k + 1):
        value = (value * pow(x, mod-2, mod)) % mod
    return value


# 素因数分解
def prime_factorization(n):
    table = []
    for x in range(2, int(n**0.5)+1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


ans = 1
T = prime_factorization(M)
C = Counter(T)
for v in C.values():
    ans = ans * nHk(N, v) % mod

print(ans)


Measured memory_bytes: 3444
n, m = map(int, input().strip().split())
conditions = [list(map(int, input().strip().split()))
              for _ in range(m)]


def check(number):
    str_num = str(number)
    if len(str_num) != n:
        return False
    for s, c in conditions:
        if len(str_num) < s:
            return False
        if str_num[s - 1] != str(c):
            return False

    return True


def check_all():
    for number in range(1000):
        if check(number):
            return number

    else:
        return -1


def main():
    ans = check_all()
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import sys, math

def input():
    return sys.stdin.readline()[:-1]

def main():
    A = list(map(int,input().split()))
    if A.count(5) == 2 and A.count(7) == 1:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define MAXN 20000005
#define int long long
int n;
int a[MAXN],v[MAXN];
int resp=0LL;
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>v[i];
        a[v[i]]++;
    }

    for(int i=1;i<=n;i++){
        resp+=(long long)(a[i]*(a[i]-1)/2);

    }

    for(int i=0;i<n;i++){
        cout<<resp-a[v[i]]+1<<"\n";
    }


}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define rrep(i,n) for(ll i=(n)-1;i>=0;--i)
#define rep1(i,n) for(ll i=1;i<=(n);++i)
#define rrep1(i,n) for(ll i=(n);i>=1;--i)
#define fr first
#define sc second
#define pb push_back
#define INF 0xfffffff
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
struct edge{ll to,cap,rev; }; // ????????????????????????

vector<edge> G[100];
ll level[100];
ll iter[100];

void add_edge(ll from,ll to,ll cap){
	G[from].pb((edge){to, cap, G[to].size() });
	G[to].pb((edge){from, 0, G[from].size()-1} );
}

void bfs(ll s){
	memset(level, -1, sizeof(level) );
	queue<ll> que;
	level[s] =  0;
	que.push(s);
	while(!que.empty()){
		ll v = que.front(); que.pop();
		rep(i, G[v].size()){
			edge &e =G[v][i];
			if(e.cap > 0 && level[e.to] < 0){
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

ll dfs(ll v,ll t,ll f){
	if(v==t) return f;
	for(ll &i = iter[v]; i<G[v].size() ;++i ){
		edge &e = G[v][i];
		if(e.cap > 0 && level[v] < level[e.to]){
			ll d = dfs(e.to, t, min(f, e.cap));
			if (d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

ll max_flow(ll s,ll t){
	ll flow = 0;
	for(;;){
		bfs(s);
		if(level[t] < 0) return flow;
		memset(iter, 0, sizeof(iter));
		ll f;
		while ( (f = dfs(s, t, INF)) > 0 ){
			flow += f;
		}
	}
}

ll V,E,a[1000],b[1000],c[1000];

void input(){
	scanf("%lld%lld",&V,&E);
	rep(i,E){
		scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
	}
}

int main()
{
	input();
	rep(i,E) add_edge(a[i], b[i], c[i]);
	cout<<max_flow(0,V-1)<<endl;
}

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

typedef long long int ll;
typedef long double   ld;

//#include <ext/pb_ds/assoc_container.hpp>   
//#include <ext/pb_ds/tree_policy.hpp>  
//#include <functional> 
//using namespace __gnu_pbds;  
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> OST;  

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                       cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int t; cin >> t; while(t--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    pll                      pair <long long int , long long int>
#define    ook(x)                   order_of_key(x)
#define    fbo(x)                   find_by_order(x)

bool vis[100005];
int k , n;
vector <int> adj[100005];
int col[100005];

void dfs(int root){
    vis[root] = true;
    int m = col[root];
    m = max(m-1 , k-2);
    int size = adj[root].size();
    f(i,0,size-1){
        if(!vis[adj[root][i]]){
            col[adj[root][i]] = m;
            m--;
            dfs(adj[root][i]);
        }
    }
}

int main(){
    cin >> n >> k;
    int x , y;
    f(i,1,n-1){
        cin >> x >> y;
        adj[x].pb(y); adj[y].pb(x);
    }
    col[1] = k;
    dfs(1);
    ll ans = 1;
    f(i,1,n){
        ans = ans*col[i];
        ans%=mod;
    }
    cout << ans << '\n';     
}



Measured memory_bytes: 9728
#include <stdio.h>

int main(void)
{
	int A, B, ans = 0;
	scanf("%d %d", &A, &B);

	if (A >= 13)
		ans = B;
	else if (A >= 6)
		ans = B / 2;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	scanf("%d", &n);
	vector<int> a(n), b(n);
	for(int i = 0; i < n; ++i) {
		scanf("%d%d", &a[i], &b[i]);
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	int low = a[(n-1)/2] + a[n/2];
	int high = b[(n-1)/2] + b[n/2];
	int answer = high - low + 1;
	if(n % 2 == 1) {
		answer = (answer + 1) / 2;
	}
	printf("%d\n", answer);
}


Measured memory_bytes: 4828
#include <iostream>
#include <string>
namespace Mylib{
    using namespace std;
    
}
int main(void){
    using namespace std;
    int N;
    cin >> N;
    int P[N];

    for(int i=0;i<N;i++)cin >> P[i];
    //任意の整数j(1<=j<=i)に対してP[i]<=p[j]
    //この条件を満たす整数i(1<=i<=N)の個数を求める
    //配列の前の要素に自分より小さいものが1個以上あればFalse
    //jはi以下であり
    //iはN以下である
    int cnt=0;
    
    int Lownum=200010;
    for(int i=0;i<N;i++){
        
        
        if(P[i]==min(P[i],Lownum)){
            Lownum=min(P[i],Lownum);
            cnt++;
        }
        
    }
    
    
    
    /*
    //O(N^2)なので多分ボツ
    for(int i=1;i<=N;i++){
        flag=false;
        for(int j=1;j<=i;j++){
            if(P[i]>P[j]){
                cout << "false call i:"<< i << " j:" << j <<endl;
                flag=false;
                break;
            }else{
                flag=true;
                cout << "true call i:"<< i << " j:" << j <<endl;
            }
        }
        
        if(flag==true)cnt++;
    }
    
    
    */
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    tmp = []
    for a in A:
        if a % 2 == 0:
            tmp.append(a)

    ans = 0
    for n in tmp:
        while n % 2 == 0:
            ans += 1
            n //= 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int cnt = 0;
		while(n-->0) {
			int num = sc.nextInt();
			if(isPrime(num)) cnt++;
		}
		System.out.println(cnt);
	}
	
	public static boolean isPrime(int num){
		for(int i=2;i*i<=num;i++)
			if(num%i==0) return false;
		return true;
	}
}


Measured memory_bytes: 41860
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int x, y;
    cin >> x >> y;

    int ans = INT_MAX;
    if(y-x>=0){
        ans = min(ans,y-x);
    }
    if(y+x>=0){
        ans = min(ans,y+x+1);
    }
    if(-y-x>=0){
        ans = min(ans,-y-x+1);
    }
    if(-y+x>=0){
        ans = min(ans,-y+x+2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    input()
    H = map(int, input().split())
    ans = 0
    prev = float('inf')
    cnt = -1
    for cur in H:
        if prev >= cur:
            cnt += 1
        else:
            if ans < cnt:
                ans = cnt
            cnt = 0
        prev = cur
    if ans < cnt:
        ans = cnt
    print(ans)
    return


main()


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

int main() {
  int a, b;
  char op;
  bool flag = true;

  while (flag) {
    cin >> a >> op >> b;

    if (op == '+') {cout << a + b << endl;}
    if (op == '-') {cout << a - b << endl;}
    if (op == '*') {cout << a * b << endl;}
    if (op == '/') {cout << a / b << endl;}
    if (op == '?') {flag = false;}
  }
  return 0;
}


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

int main(){
    int X, Y;
    cin >> X >> Y;
    int ans = 0;
    if (X == 1) ans += 300000;
    if (X == 2) ans += 200000;
    if (X == 3) ans += 100000;
    if (Y == 1) ans += 300000;
    if (Y == 2) ans += 200000;
    if (Y == 3) ans += 100000;
    if (X == 1 && Y == 1) ans += 400000;
    cout << ans << endl;
    return 0;
}

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

int main() {
  int h, a;

  cin >> h >> a;
  int count = 0;

  for(int i = h; i > 0; i-=a){
      count += 1;
      if(i <= 0){
          break;
      }
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a = list(map(int,input().split()))

sum = 0
for i in range(n):
    sum = sum + a[i]
sum_divided = sum/(4*m)
cnt = 0
for i in range(n):
    if a[i] >= sum_divided:
        cnt = cnt + 1
if cnt >= m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N>>S;
}
//=============================
void func(){}
//=============================
void solve()
{
    int ans = -INF;
    int t = 0;
    set<char> l;
    set<char> r;
    rep(i,N){
            l = set<char>();
            r = set<char>();
        rep(j,N){
            debug(S[j]);
            if (i<j){
            l.insert(S[j]);
            debug("l.insert");
            }
            else{
                r.insert(S[j]);
                debug("r.insert");
            }
        }
        t=0;
        debug(l.size());
        debug(r.size());
        for(auto a : l){
            debug(a);
            if(r.find(a) != r.end()) t++;
        }
        ans = max(ans,t);
    }
    cout<<ans<<endl;


    
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
def main():
  M=10**9+7
  r1,c1,r2,c2=map(int,input().split())
  n=r2+c2+2
  fac=[0]*(n+1)
  fac[0]=1
  for i in range(1,n+1):fac[i]=fac[i-1]*i%M
  f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
  print((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M)
main()

Measured memory_bytes: 82164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,count;
  cin >> N >> K;
  count = 0;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
    if(h.at(i) >= K){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

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

int where_n(int num, int s_p){
  for(int i=s_p; i<n; i++){
    if(num==(int)(s.at(i)-48)){
      return i;}
  }
  return n;
}

int main(){
  cin >> n;
  cin >> s;
  int ans=0;
  int ret=0;
  int tmp =0;
  int tmp2 =0;
  for(int i=0; i<10; i++){
    ret = where_n(i,0);
    if(ret==n){continue;}
    else{
      tmp = ret;
      for(int j=0; j<10; j++){
        ret = where_n(j,tmp+1);
        if(ret==n){continue;}
        else{
          tmp2 = ret;
          for(int j=0; j<10; j++){
            ret = where_n(j,tmp2+1);
            if(ret==n){continue;}
            else ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}


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

int main(){
    int N;
    cin>>N;
    vector<int>vec(N);
    vector<int>count(N);
    for(int i=0;i<N;i++){
        cin>>vec[i];
        while(vec[i]%2!=1){
            vec[i]/=2;
            count[i]++;
        }
    }
    sort(count.begin(),count.end());
    cout<<count[0]<<endl;
}

Measured memory_bytes: 256
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
n = input()

ans = "No"
if "7" in n:
    ans = "Yes"

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 9016