akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll x, n; cin >> x >> n;
	ll p[n]; zep(i, 0, n)cin >> p[i];
	
	bool use[102]; memset(use, 0, sizeof(use));
	zep(i, 0, n){
		use[p[i]] = true;
	}
	
	ll ans = 0;
	rep(i, 0, 101){
		if(!use[i]){
			if(abs(i - x) < abs(ans - x)){
				ans = i;
			}
		}
	}
	print(ans)
	
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#define MAX 100001
#define SENTINEL 2000000000
using namespace std;

struct Card
{
    string suit;
    int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

int cnt;
int n;

void merge(Card A[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++)
    {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++)
    {
        R[i] = A[mid + i];
    }
    L[n1].value = SENTINEL;
    R[n2].value = SENTINEL;
    int i = 0;
    int j = 0;
    for (int k = left; k < right; k++)
    {
        cnt++;
        if (L[i].value <= R[j].value)
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
        }
    }
}

void mergeSort(Card A[], int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

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

void quickSort(Card A[], int p, int r)
{
    if (p < r)
    {
        int q = partition(A, p, r);
        quickSort(A, p, q - 1);
        quickSort(A, q + 1, r);
    }
}

int main()
{
    scanf("%d", &n);
    Card A[MAX], B[MAX];
    string S;
    int v, stable = 1;
    for (int i = 0; i < n; i++)
    {
        cin >> S >> v;
        A[i].suit = B[i].suit = S;
        A[i].value = B[i].value = v;
    }
    mergeSort(A, 0, n);
    quickSort(B, 0, n - 1);

    for (int i = 0; i < n; i++)
    {
        if (A[i].suit != B[i].suit)
            stable = 0;
    }
    if (stable)
        cout << "Stable" << endl;
    else
        cout << "Not stable" << endl;

    for (int i = 0; i < n; i++)
    {
        cout << B[i].suit << " " << B[i].value << endl;
    }
    return 0;
}



Measured memory_bytes: 12432
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

def main():
    import sys
    input = sys.stdin.readline
    N,K = map(int,input().split())
    print(len(Base_10_to_n(N, K)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
// AOJ 0548 Reindeer with no sense of direction
// 2018.2.23 bal4u

#include <stdio.h>

int w, h, cnt, ans;
char map[13][13];
int mv[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};

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

void dfs(int r, int c, int s)
{
	int i, nr, nc;
	
	for (i = 0; i < 4; i++) {
		nr = r, nc = c;
		while (1) {
			nr += mv[i][0], nc += mv[i][1];
			if (nr < 0 || nr >= h || nc < 0 || nc >= w) break;
			if (map[nr][nc] == 1) {
				map[nr][nc] = -1;
				dfs(nr, nc, s+1);
				map[nr][nc] = 1;
				break;
			} else if (map[nr][nc] == 2) {
				if (s == cnt) { ans++; return; }
			}
		}
	}
}

int main()
{
	int k, r, c, sr, sc;

	while (w = in()) {
		h = in();
		cnt = 0;
		for (r = 0; r < h; r++) for (c = 0; c < w; c++) {
			map[r][c] = k = in();
			if      (k == 1) cnt++;
			else if (k == 2) sr = r, sc = c;
		}
		ans = 0;
		dfs(sr, sc, 0);
		printf("%d\n", ans);
	}
	return 0;
}



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

int main() {
  int a, b; cin >> a >> b;
  if ((a + b) % 2 == 0) {
    cout << (a + b) / 2 << endl;
  }
  else {
    cout << (a + b) / 2 + 1 << endl;
  }
}



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

#define nax 3005
#define FOR(i,n,m) for(int i =(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) v.begin(),v.end()

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

int n;
double dp[nax][nax];

int main(){
	cin>>n;
	vector<double> p(n);

	REP(i,n){
		cin>>p[i];
	}
	
	memset(dp,0,sizeof dp);
	dp[0][0] = p[0];
	FOR(i,1,n){
		REP(j,n){
			dp[i][j] = dp[i-1][j]*(1-p[i]);
			if(j>0) dp[i][j] += dp[i-1][j-1]*p[i];
			else dp[i][j] +=p[i];
		}
	}

	printf("%.10f",dp[n-1][n/2]);
	
	return 0;
}

Measured memory_bytes: 70784
package main

import "fmt"

func main() {
	// Code for A - Connection and Disconnection
	var S string
	var K int
	fmt.Scan(&S, &K)

	var count1, count2 int
	var flag int
	for i := 0; i < len(S)-1; i++ {
		if S[i] == S[i+1] {
			count1++
			i++
		}

		if S[i] != S[0] {
			flag++
		}
	}

	if flag == 0 {
		fmt.Println(len(S) * K / 2)
	} else if S[0] != S[len(S)-1] {
		fmt.Println(count1 * K)
	} else {
		count2 = 0
		T := S + S
		for i := 0; i < len(T)-1; i++ {
			if T[i] == T[i+1] {
				count2++
				i++
			}
		}

		fmt.Println((K-1)*(count2-count1) + count1)
	}

}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int h,n;
    cin>>h>>n;
    vi a(n);

    rep(i,n){
       cin>>a[i];
    }

    ll sum=0;

    rep(i,n){
        sum+=a[i];
    }

    if(sum>=h)cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
cin>>n;int a[n];
for(i=0;i<n-1;i++)
cin>>a[i];
int ans=0;
if(n==2)
cout<<2*a[0]<<endl;
else{
for(i=1;i<n-1;i++)
ans+=min(a[i],a[i-1]);
ans+=min(a[0],a[0]);
ans+=a[n-2];
cout<<ans<<endl;}

  return 0;
}


Measured memory_bytes: 256
//Author : Ayush Jain

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	int n,m,k,i,j;
	cin>>n>>m>>k;	
	for(i=0;i<=n;i++){
		for(j=0;j<=m;j++){
			if(k==(n*j - j*i + (m-j)*i)){
				cout<<"Yes\n";
				return 0;
			}
		}
	}	
	cout<<"No\n";
	return 0;
	
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = (ll)(1e9 + 7);
const int MAX_K = 112345;
int a[105];
ll dp[2][MAX_K];

int main2() {
  int N = nextInt();
  int K = nextInt();
  REP(i, N) a[i] = nextInt();

  CLR(dp, 0);
  dp[1][0] = 1;
  REP(i, N) {
    int f = i & 1;
    REP(k, MAX_K) dp[f][k] = 0;
    for (int k = 0; k <= K; k++) {
      dp[f][k] = (k-1 >= 0 ? dp[f][k-1] : 0)
                + dp[1-f][k]
                - (k-a[i]-1 >= 0 ? dp[1-f][k-a[i]-1] : 0);
      dp[f][k] = (dp[f][k] % MOD + MOD) % MOD;
    }
  }
  ll ans = dp[1-(N&1)][K];
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define lp(n) for(int i = 0; i < n; i++)
#define lpp(i, n) for(int i = 0; i < n; i++)

int A[2000001];
int B[2000001];
int C[10001];
using namespace std;
int main() {
    int n;
    cin >> n;
    lp(10001) C[i] = 0;
    lp(n) {
      cin >> A[i];
      C[A[i]]++;
    }
    for(int i = 1; i < 10001; i++) C[i] = C[i] + C[i-1];
    for(int i = n-1; i >= 0; i--) {
        B[C[A[i]]] = A[i];
        C[A[i]]--;
    }
    for(int i = 1; i <= n; i++) cout << B[i] << ((i == n)?"\n":" ");
    return 0;
}






Measured memory_bytes: 18748
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=2e5+5,M=2e6+5,MOD=1e9+7,OO=1e9;
string a;
int k;
int n;
ll memo[105][5][2];
ll solve(int indx,int curr,bool already){
	if(curr>k)return 0;
	if(indx==n){
		return (curr==k);
	}
	ll &ret = memo[indx][curr][already];
	if(~ret)return ret;
	ret = 0;
	if(already){
		ret = solve(indx+1,curr,1);
		for(int i=1;i<=9;i++){
			ret+=solve(indx+1,curr+1,1);
		}
	}
	else{	
		ret = (a[indx]=='0')?solve(indx+1,curr,0):solve(indx+1,curr,1)+solve(indx+1,curr+1,0);
		for(int i=1;i<(a[indx]-'0');i++)ret+=solve(indx+1,curr+1,1);
	}
	return ret;
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();	
 	
 	cin>>a>>k;

 	n = sz(a);

 	memset(memo,-1,sizeof(memo));

 	cout<<solve(0,0,0)<<endl;
}		


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    vector<int>pref(n + 3, 0);
    for(int i = 1; i <= m; i++){
        int l, r;
        cin >> l >> r;
        pref[l]++;
        pref[r + 1]--;
    }
    int k = 0;
    for(int i = 1; i <= n; i++){
        pref[i] = pref[i - 1] + pref[i];
        if(pref[i] == m){
            k++;
        }
    }
    cout << k;
    return 0;
}

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

int main(){
    int n;  cin >> n;
    vector<ll>a(n);
    rep(i, n){
        int tmp;    cin >> tmp;
        a[i] = tmp-(i+1);
    }
    sort(a.begin(), a.end());
    ll ans = 1000000000000000;
    rep(i, 2){
        ll b = a[n/2 + i];
        ll tmp = 0;
        rep(j, n){
            tmp += abs(a[j] - b);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 200000 + 5;
int a[10005],vis[1000005];
 
ll modpow(ll x,ll n){
    ll ans = 1;
    while(n != 0){
        if(n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n = n>>1; 
    }
    return ans;
}
 
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		int t = a[i];
		for(int j = 2; j*j <= t; j++){
			if(t % j != 0)
				continue;
			int cnt = 1;
			while((t/=j)%j == 0)
				++cnt;
			vis[j] = max(vis[j],cnt);
		}
		if(t > 1)
			vis[t] = max(vis[t],1);
	}
	ll z = 1;
	ll ans = 0;
	for(int i = 1; i <= 1000000; i++){
		while(vis[i]--)
			z = z * i % mod;
	}
	for(int i = 1; i <= n; i++){
		ans = (ans + z * modpow(a[i],mod-2))%mod;
	}
	cout << ans << endl;
    return 0;
}

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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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

int MOD = (int) 1e9 + 7;

auto solve() {
    int N;
    string S;
    cin >> N >> S;

    vi cost_b(N + 1, 0);
    vi cost_w(N + 1, 0);
    FOR(i, 1, N + 1) {
        cost_b[i] = cost_b[i - 1];
        if (S[i - 1] == '#') cost_b[i]++;
    }
    RREP(i, N) {
        cost_w[i] = cost_w[i + 1];
        if (S[i] == '.') cost_w[i]++;
    }

    int res = 1<<29;
    REP(i,N+1) {
        chmin(res, cost_b[i] + cost_w[i]);
    }

    return res;
}

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

    cout << solve() << endl;
//    solve();

    return 0;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> table(H,vector<char>(W));
  
  for(int i=0 ; i<H ; i++){
  	for(int j=0 ; j<W ; j++){
    	cin >> table.at(i).at(j);
    }
  }
  
  for(int i=0 ; i<H ; i++){
    int count = 0;
    	for(int j=0 ; j<W ; j++){
        	if(table.at(i).at(j)=='.'){
            	count++;
            }
        }
    if(count==W){
      	for(int j=0 ; j<W ; j++){
        table.at(i).at(j)='x';
        }    	
    }
  }

  for(int j=0 ; j<W ; j++){
    int count = 0;
    	for(int i=0 ; i<H ; i++){
        	if(table.at(i).at(j) != '#'){
            	count++;
            }
        }
    if(count==H){
      	for(int i=0 ; i<H ; i++){      
    	table.at(i).at(j)='x';
        }
    }
  }
  
  for(int i=0 ; i<H ; i++){
  	for(int j=0 ; j<W ; j++){
    	if(table.at(i).at(j) != 'x'){
        	cout << table.at(i).at(j);
        }
        if(j==W-1){
        	cout << endl;
        } 
    }
  }
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, k; std::cin >> n >> k;
  k--, n--;
  std::cout << (n + k-1) / k << "\n";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<queue>
#include<string.h>
using namespace std;

#define inf 0x3f3f3f3f; 

int d[21000];

int gh[1100][1100];
bool v[1100][1100]={0};
int lowcost[2100];
int n,m;
bool vis[2100]={0};
queue<int>q;                              

int main()
{
     int i,j,k,l,x,p,flag=0;
     long long ans;
     cin>>n;
     cin>>m;
     cout<<n*n-m<<endl; 
   return 0;
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-

n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)

  
can = "Yes"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "No"
  if(dist % 2 != dt % 2):
    can = "No"
print(can)

Measured memory_bytes: 11732
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

int main() {
    ll N, K;
    cin>>N>>K;
    
    ll nums[100009];
    mem(nums,0);
    
    rep(i,N){
        int a,b; scnd2(a,b);
        nums[a] += b;
    }
    
    int i=0;
    while( K>0) K-=nums[i++];
    
    cout1(i-1);
}

Measured memory_bytes: 1024
ans = 0
A,B,C,X = int(input()),int(input()),int(input()),int(input())
for i in range(A+1):
        for j in range(B+1):
                for k in range(C+1):
                        if 500*i+100*j+50*k == X:
                                ans += 1
print(ans)

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = 998244353;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  string S; cin >> S;
  vector<int> R, G, B;
  rep(i,N*3) {
    if (S[i]=='R') R.push_back(i);
    else if (S[i]=='G') G.push_back(i);
    else if (S[i]=='B') B.push_back(i);
  }
  rep(i,N) {
    if (R[i]<G[i]) swap(R[i],G[i]);
    if (R[i]<B[i]) swap(R[i],B[i]);
    if (G[i]<B[i]) swap(G[i],B[i]);
  }

  ll result = 1;
  rep(i,N) {
    ll pl = lower_bound(B.begin(),B.end(),G[i])-B.begin();
    ll pr = i==N-1 ? N : lower_bound(R.begin(),R.end(),G[i+1])-R.begin();
    result *= (pl-i)*(i+2-pr); result %= MOD;
    // cout << pl << " " << pr << endl;
  }
  repr(i,1,N+1) { result *= i; result %= MOD; }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 2172
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

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

    if (b - a == c - b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/numeric>
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     pi        acos(-1)
#define     ll        long long int
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))
#define     pii       pair<int,int>
#define     N         100005
using namespace std;

int main(){
    __;
/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
*/


    int n;

    cin >> n;

    cout << (n-2)*180;


   return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var X int
	var ans string
	fmt.Scan(&X)

	if (X == 3) || (X == 5) || (X == 7) {
		ans = "YES"
	} else {
		ans = "NO"
	}
	
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int cmp(int x,int y) {
	return x>y;
}

int main()
{
	int n,k;
	int a[200005] ;
	cin >> n >> k;
	for(int i=0;i<n;i++){
		cin >> a[i] ;             
	}   
	sort(a,a+n,cmp);
	if(n<=k) cout <<"0";
	else {
		long long s=0;
		for(int i=k;i<n;i++ )
			s+=a[i] ;
		cout << s<<endl;
	}
	return 0;
}


Measured memory_bytes: 1024
a = [int(input()) for _ in range(5)]
k = int(input())
f = True
for i in range(5):
  for j in range(4-i):
    if abs(a[i]-a[i+j+1]) > k:
      f = False
      break
if f:
  print('Yay!')
else:
  print(':(')


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

using namespace std;

const int N = 200;
const int INF = (1<<28);

int n, m, r, G[2][N][N], z[1000];

void floyd(){
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        for(int l=0;l<2;l++){
          G[l][i][j] = min(G[l][i][j], G[l][i][k] + G[l][k][j]);
        }
      }
    }
  }
}

main(){
  while(cin >> n >> m && (n|m)){
    fill(G[0][0], G[2][0], INF);
    for(int i=0;i<n;i++) G[0][i][i] = G[1][i][i] = 0;
    for(int i=0;i<m;i++){
      int a, b, c, e;
      char d;
      cin >> a >> b >> c >> d;
      a--; b--;
      e = (d == 'L' ? 0 : 1);
      G[e][a][b] = min(G[e][a][b], c);
      G[e][b][a] = min(G[e][b][a], c);
    }
    cin >> r;
    for(int i=0;i<r;i++) cin >> z[i];
    for(int i=0;i<r;i++) z[i]--;
    floyd();
    int dp[1000][N];
    fill(dp[0], dp[1000], INF);
    dp[0][z[0]] = 0;
    for(int i=0;i+1<r;i++){
      for(int j=0;j<N;j++){
        if(dp[i][j] >= INF) continue;
        dp[i+1][j] = min(dp[i+1][j], dp[i][j] + G[0][z[i]][z[i+1]]);
        for(int k=0;k<N;k++){
          int cost = G[0][z[i]][j] + G[1][j][k] + G[0][k][z[i+1]];
          dp[i+1][k] = min(dp[i+1][k], dp[i][j] + cost);
        }
      }
    }
    int ans = INF;
    for(int i=0;i<N;i++) ans = min(ans, dp[r-1][i]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 2256
from itertools import accumulate
n,k = map(int,input().split())
A = list(map(int,input().split()))
for _ in range(k):
    c = [0]*n
    for i,j in enumerate(A):
        l = max(0,i-j)
        r = min(n-1,i+j)
        c[l] += 1
        if r+1 < n:
            c[r+1] -= 1
    #print(c)
    d = list(accumulate(c))
    if A == d:
        break
    A = d
print(" ".join(map(str,A)))

Measured memory_bytes: 189460
#include <iostream>

using namespace std;

int main()
{
    int x[3];
    for(int i =0 ;i<3;i++){
        cin >> x[i];
    }
    if(x[0]==x[1]){
        cout<<x[2];
    }
    else if(x[1]==x[2]){
        cout<<x[0]<<endl;
    }
    else{cout<<x[1]<<endl;}


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define N 100001
#define NIL -1
using namespace std;
 
struct Node{
  int parents,left,right,sib;
};
Node T[N];
 
void preparse(int u){
  if(u<0) return;
  cout<<" "<<u;
  preparse(T[u].left);
  preparse(T[u].right);
}
 
void inparse(int u){
  if(u<0) return;
  inparse(T[u].left);
  cout<<" "<<u;
  inparse(T[u].right);
}
 
void postparse(int u){
  if(u<0) return;
  postparse(T[u].left);
  postparse(T[u].right);
  cout<<" "<<u;
}
 
int main(){
  int n,id,c;
  cin>>n;
  for(int i=0;i<n;i++){
      T[i].left=NIL;
      T[i].parents=NIL;
      T[i].right=NIL;
      T[i].sib=NIL;
  }
for(int i=0;i<n;i++){
    cin>>id;
    for(int j=0;j<2;j++){
      cin>>c;
      if(c>=0)T[c].parents=id;
      if(j==0) T[id].left=c;
      else T[id].right=c;
    }
  }
 
  int root;
  for(int i=0;i<n;i++) if(T[i].parents==NIL) root=i;
 
  cout<<"Preorder"<<endl;
  preparse(root);
  cout<<endl;
  cout<<"Inorder"<<endl;
  inparse(root);
  cout<<endl;
  cout<<"Postorder"<<endl;
  postparse(root);
  cout<<endl;
 
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    n *= 2;
    int l[n];
    scn(n, l);
    sort(l, l + n);

    int res = 0;
    rep(i, n / 2){
      res += l[i * 2];
    }

    pri(res);

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
struct Mint {
	int val;
	Mint() { val = 0; }
	Mint(const ll& x) {
		val = (-MOD <= x && x < MOD) ? x : x % MOD;
		if (val < 0) val += MOD;
	}
	friend bool operator==(const Mint& a, const Mint& b) { return a.val == b.val; }
	friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
	friend bool operator<(const Mint& a, const Mint& b) { return a.val < b.val; }
	Mint& operator+=(const Mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	Mint& operator-=(const Mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	Mint& operator*=(const Mint& m) { val = (ll)val * m.val % MOD; return *this; }
	friend Mint modex(Mint a, ll p) {
		assert(p >= 0);
		Mint ans = 1;
		for (; p; p >>= 1, a *= a) if (p & 1) ans *= a;
		return ans;
	}
	Mint& operator/=(const Mint& m) { return *this *= modex(m, MOD - 2); }
	Mint& operator++() { return *this += 1; }
	Mint& operator--() { return *this -= 1; }
	Mint operator++(int) { Mint result(*this); *this += 1; return result; }
	Mint operator--(int) { Mint result(*this); *this -= 1; return result; }
	Mint operator-() const { return Mint(-val); }
	friend Mint operator+(Mint a, const Mint& b) { return a += b; }
	friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
	friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
	friend Mint operator/(Mint a, const Mint& b) { return a /= b; }
	friend ostream& operator<<(ostream& os, const Mint& x) { return os << x.val; }
};
const int MAXN = 100005;
Mint fac[MAXN], invfac[MAXN];
int main() {
	fac[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		fac[i] = fac[i - 1] * i;
	int n, m;
	scanf("%d%d", &n, &m);
	if (n > m) swap(n, m);
	if (m > n + 1) {
		printf("0\n");
		return 0;
	}
	Mint ans = fac[n] * fac[m];
	if (m == n) ans *= 2;
	printf("%d\n", ans.val);
}


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

int main() {
  ll x, y;
  cin >> x >> y;
  ll ans = 1;
  while(x<=y/2) {
    y /= 2;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using ll = long long;
using namespace std;

void solve() {
    int n;
    cin>>n;
    int l[1000];
    for(int i=0;i<n;i++)
    cin>>l[i];
    int c=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]!=l[j] && l[i]!=l[k] && l[k]!=l[j])
                if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[i]+l[k]>l[j])
                c++;
            }
        }
    }
    cout<<c<<'\n';

}

int main() 
{
    std::ios::sync_with_stdio(false); \
        std::cin.tie(NULL);
    int test;
    test = 1;
    while (test--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>

int main()
{
	int d, n;

	scanf("%d%d", &d ,&n);

	if (d == 0) {
		printf("%d\n", n + n / 100);
	} else if (d == 1) {
		printf("%d\n", n * 100 + n * 100 / 10000 * 100);
	} else if (d == 2) {
		printf("%d\n", n * 10000 + n * 10000 / 1000000 * 10000);
	}

	return 0;
}


Measured memory_bytes: 128
while(<>){
	chomp;
	$n = $_ if($. == 1);
	@a = split(/ /, $_) if($. == 2);
	@b = split(/ /, $_) if($. == 3);
	@c = split(/ /, $_) if($. == 4);
}
unshift(@a, " "); unshift(@b, " "); unshift(@c, " ");
($r, $pre) = (0, 0);
for $i (1 .. $n){
	$r += $b[$a[$i]];
	$r += $c[$pre] if($a[$i] - $pre == 1) and ($i > 1);
	$pre = $a[$i];
}
print "$r\n";


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10000)


def initRMQ(n, D):
    n_ = 1

    while n_ < n:
        n_ *= 2

    for i in range(2*n_ - 1):
        D.append(2147483647)

    return n_


def update(k, a):
    k += n_ - 1
    D[k] = a
    while k > 0:
        k = int((k - 1) / 2)
        D[k] = min(D[k*2 + 1], D[k*2 + 2])


def findMin(a, b):
    return query(a, b + 1, 0, 0, n_)


def query(a, b, k, l, r):
    #print('q', a, b, k, l, r)
    if r <= a or b <= l:
        return 2147483647

    if a <= l and r <= b:
        return D[k]

    vl = query(a, b, k*2 + 1, l, int((l + r)/2))
    vr = query(a, b, k*2 + 2, int((l + r)/2), r)

    return min(vl, vr)


if __name__ == '__main__':
    n, q = map(int, input().split())

    D = []
    n_ = initRMQ(n, D)

    for _ in range(q):
        #print(D)
        c, x, y = map(int, input().split())

        if c == 0:
            update(x, y)

        else :
            print(findMin(x, y))



Measured memory_bytes: 9016
import java.util.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    int zero = 0, one = 0;
    for (char ch : S) {
      if (ch == '0') {
        zero++;
      } else {
        one++;
      }
    }
    System.out.println(Math.min(zero, one) * 2);
  }
}

Measured memory_bytes: 26300
o,f,i=998244353,[1],1
while i<o/399:f+=[f[-1]*i%o];i+=1
c=lambda n,k:f[n]*pow(f[n-k],o-2,o)*pow(f[k],o-2,o)
n,m=map(int,input().split())
w,u=3*m,n-1
a=c(w+u,u)-n*c(n+m-2,u)
if u>m:
 for i in range(m+1,min(w,n)+1):
  if w-i+1&1:a-=c(n,i)*c((w-i)//2+u,u) 
print(a%o)

Measured memory_bytes: 115344
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
 
#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 loop(i, l, r) for(int i = l; i < r; i++)
#define rloop(i, l, r) for(int i = l; i >= r; i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vec_i;

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

int main()
{
	int n;
	cin >> n;
	vec_i v(n+1);
	rep(i, n) cin >> v[i+1];

	vec_i b(n+1, 0);
	int num = 0;
	for(int i=n;i>=1;i--){
		int sum = 0;
		for(int j=i;j<=n;j+=i){
			sum += b[j];
		}
		if(v[i] != (sum%2)){
			b[i] = 1;
			num++;
		}
	}
	cout << num << endl;
	if(num>0){
		loop(i, 1, n+1) if(b[i]==1) cout << i << " ";
		cout << endl;		
	}
}

Measured memory_bytes: 2432
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Math.*;
class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		System.out.println(a*b+" "+2*(a+b));
	}

}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k, m = 0;
  cin >> n >> k;
  vector <long long int> a(n);
  for (int i = 0; i < n; ++i){
cin >> a[i];
  }
  sort(a.begin(),a.end());
  for (int j = 0; j < n - k; ++j){
	m += a[j];
}
cout << m << "\n";
  return 0;
}


Measured memory_bytes: 2428
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
// Function to find gcd of array of 
// numbers 
int findGCD(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
        result = gcd(arr[i], result); 
  
    return result; 
} 
int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=n; j++)
		{
			for(int k=1; k<=n; k++)
			{
				ans+= gcd(gcd(i,j),k);
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

const ll mod = 1000000007;

int main(){
  int n; cin >> n;
  vector<double> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  vector<int> idx(n);
  rep(i, n) idx[i] = i;
  double res = 0;
  double cnt = 0;
  double dist;
  do {
    for (int i = 0; i < n; ++i){
      if (i + 1 >= n) continue;
      dist = sqrt((x[idx[i + 1]] - x[idx[i]]) * (x[idx[i + 1]] - x[idx[i]]) + (y[idx[i + 1]] - y[idx[i]]) * (y[idx[i + 1]] - y[idx[i]]));
      res += dist;
    }
    cnt++;
  } while(next_permutation(idx.begin(), idx.end()));

  printf("%.16f\n",res / cnt);
}


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

int main(){
  int x,y;
  cin >> x >> y;
  
  if(x==y) cout << 0 << endl;
  else if(x==0) cout << max(y,-1*y)+(y<0) << endl;
  else if(x<0){
    if(y==0) cout << -1*x << endl;
    else if(0<y){
      x*=-1;
      cout << max(x-y,y-x)+1 << endl;
    } else{
      if(x<y) cout << y-x << endl;
      else cout << x-y+2 << endl;
    }
  }
  else{ //0<x
    if(y==0) cout << x+1 << endl;
    else if(0<y){
      if(x<y) cout << y-x << endl;
      else cout << x-y+2 << endl;
    }
    else {
      y*=-1;
      cout << max(x-y,y-x)+1 << endl;
    }
  }
}

Measured memory_bytes: 3640
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>


#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>
#include<ctime>

#include <cstring>

#define pb push_back
#define p push

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e6+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph;


signed main(){
	IOS;

	string s;
	cin >> s;
	
	bool ctr = 0;
	for (auto el : s){
		if (el == '7')ctr = 1;
	}
	if (ctr)cout << "Yes";
	else cout << "No";
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b;
    c = a * b;
    if (c % 2 == 0)
    {
        cout << "Even" << endl;
    }
    else
    {
        cout << "Odd" << endl;
    }
}


Measured memory_bytes: 256
function Main(input){
	var array = [];
	var difficultFlag = 0;
  	var threeNumbers = [];
	for(var i = 0; i<input.length;i++){	
		array.push(input.slice(i,i+1));
    }
  	var intArray = array.map(i=>parseInt(i));

  	for(var j = 0;j<2;j++){
		threeNumbers.push(intArray.slice(j,j+3));      
    }
  	if(threeNumbers[0][0] == threeNumbers[0][1] || threeNumbers[0][1] == threeNumbers[0][2]){
    	difficultFlag = 1;
    }else if(threeNumbers[1][0] == threeNumbers[1][1] || threeNumbers[1][1] == threeNumbers[1][2]){
        difficultFlag = 1;
    }
  
  	if(difficultFlag == 1){
     console.log('Bad'); 
    }else{
     console.log('Good'); 
    }

}



Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<vector<int>> c_num(3, vector<int>(2 * N));
  char c[] = {'R', 'G', 'B'};
  for (int i = 0; i < 3; ++i)
    if (S[0] == c[i])
      c_num[i][0] = 1;
  for (int i = 0; i < 3; ++i)
    for (int j = 1; j < N; ++j)
      if (S[j] == c[i])
        c_num[i][j] = c_num[i][j - 1] + 1;
      else
        c_num[i][j] = c_num[i][j - 1];

  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      bool is_r = S[i] == 'R' || S[j] == 'R', is_g = S[i] == 'G' || S[j] == 'G',
           is_b = S[i] == 'B' || S[j] == 'B';
      if (!is_r && is_g && is_b) {
        ans += c_num[0][N - 1] - c_num[0][j];
        if (S.size() < 2 * j - i)
          continue;
        if (S[2 * j - i] == 'R')
          --ans;
      } else if (is_r && !is_g && is_b) {
        ans += c_num[1][N - 1] - c_num[1][j];
        if (S.size() < 2 * j - i)
          continue;
        if (S[2 * j - i] == 'G')
          --ans;
      } else if (is_r && is_g && !is_b) {
        ans += c_num[2][N - 1] - c_num[2][j];
        if (S.size() < 2 * j - i)
          continue;
        if (S[2 * j - i] == 'B')
          --ans;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int func1(int a, int b){
    if (b == 0){
        return a;
    }
    return func1(b, a%b);
}

int main(){
    int n; cin >> n;
    int max = 0;
    vector<int> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
    }
    for (int i = 0; i < n; i++){
		
        max = func1(v[i], max);
    }
    cout << max << endl;
}

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

int main()
{
	int n,y,a,b,c;
	cin>>n>>y;
	for(a=0;a<=y/10000;a++)
		for(b=0;b<=y/5000;b++)
		{
			c=n-a-b;
			if(c>=0 && a*10000+b*5000+c*1000==y)
			{
				cout<<a<<" "<<b<<" "<<c<<endl;
				return 0;
			}
		}
	cout<<"-1 -1 -1"<<endl;
	return 0;
}

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

long long  fac(long long x) {
	if (x == 0ll)
	{
		return 1ll;
	}
	else
	{
		return x*fac(x - 1ll);
	}
}

int main()
{
	long long n;
	cin >> n;
	cout << fac(n) << endl;
}

Measured memory_bytes: 2976
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll ans = 0;
  vector<ll> sum(n);
  for(int i = 0; i < n; i++) {
    ll a = 0, b = 0;
    cin >> a >> b;
    sum[i] = a + b;
    ans -= b;
  }
  sort(sum.rbegin(), sum.rend());
  for(int i = 0; i < n; i++) {
    if(i % 2 == 0) {
      ans += sum[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N ;
  int a = N/1000;
  int b = (N-a*1000)/100;
  int c = (N-a*1000-b*100)/10;
  int d = (N-a*1000-b*100-c*10);
    
  if (b==c){
   if(a == b || c == d){
     cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
    }
 else{
   cout << "No" << endl;
}
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
#define MN 200000
#define mod 1000000007
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
vector<int> v[MN+5];
pair<int,int> q[MN+5];
int n,X,Y,c[MN+5],w[MN+5],mn=2e9,from,mn2=2e9,s[MN+5],top=0,size[MN+5],ans=1,inv[MN+5],p[MN+5];
bool cmp(int x,int y){return w[x]<w[y];}
inline int getfa(int x){return s[x]?s[x]=getfa(s[x]):x;}
void Merge(int x,int y){if((x=getfa(x))!=(y=getfa(y)))size[y]+=size[x],s[x]=y;}
int main()
{
	n=read();X=read();Y=read();p[0]=inv[0]=inv[1]=p[1]=1;
	for(int i=2;i<=n;++i) p[i]=1LL*p[i-1]*i%mod,inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod; 
	for(int i=2;i<=n;++i) inv[i]=1LL*inv[i-1]*inv[i]%mod;
	for(int i=1;i<=n;++i) size[i]=1,c[i]=read(),w[i]=read(),v[c[i]].push_back(i);
	for(int i=1;i<=n;++i) if(v[i].size())
	{
		if(v[i].size()==n) return 0*puts("1");
		sort(v[i].begin(),v[i].end(),cmp);
		int V=w[v[i][0]];
		if(V<mn) mn2=mn,mn=V,from=i;
		else if(V<mn2) mn2=V;
	}
	for(int i=1;i<=n;++i) if(v[i].size())
	{
		int mx=max(X-w[v[i][0]],Y-(from==i?mn2:mn));
		for(int j=1;j<v[i].size();++j) 
			if(w[v[i][j]]<=mx) Merge(v[i][j],v[i][0]);
		q[++top]=make_pair(w[v[i][0]],v[i][0]);
	}
	sort(q+1,q+top+1);int val=Y-q[1].first;
	ans=inv[size[getfa(q[1].second)]];
	for(int j=2;j<=top;++j) if(q[j].first<=val) 
		ans=1LL*ans*inv[size[getfa(q[j].second)]]%mod,Merge(q[j].second,q[1].second);
	ans=1LL*ans*p[size[getfa(q[1].second)]]%mod;
	cout<<ans;
	return 0;
}



Measured memory_bytes: 15488
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> paii;

bool deck[100011];
int n, k;

int solve()
{
	int res = 0;
	int sqr[100011];
	bool state = false;
	int pvt = 0;
	int sq = 0;
	
	CLR(sqr);
	
	FOR(i, 1, n+1)
	{
		if( !state && deck[i] )
		{
			state = true;
			pvt = i;
			sq = 1;
			sqr[i] = 1;
		}
		else if( state && deck[i] )
		{
			sq++;
			
			FOR(k, pvt, i+1)
			{
				sqr[k] = sq;
			}
		}
		else if( state && !deck[i] )
		{
			sq = 0;
			pvt = 0;
			state = false;
		}
	}
	
	if( deck[0] )
	{
		FOR(i, 2, n)
		{
			if(deck[i-1] && deck[i+1] && !deck[i])
			{
				sqr[i] = sqr[i-1] + sqr[i+1] + 1;
			}
		}
	}
	
	FOR(i, 1, n+1)
	{
		res = max(res, sqr[i]);
	}
	
/*
	FOR(i, 0, n+1)
	{
		cout << sqr[i] << " ";
	}
	cout << endl;
*/
	return res;
}

int main()
{
	while(cin >> n >> k, (n||k))
	{
		CLR(deck);
		
		FOR(i, 0, k)
		{
			int a;
			cin >> a;
			deck[a] = true;
		}
		
		cout << solve() << endl;
	}
	
	return 0;
}

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

int f(int x, int y, int z) {
  return x*x + y*y + z*z + x*y + y*z + z*x;
}

int main(){
  int n, sum[100000]={0};
  cin >> n;

    for(int x=1; x <= 100; x++){
      for(int y=1; y <= 100; y++){
        for(int z=1; z <= 100; z++){
          sum[f(x,y,z)]++;
        }
      }
    }
  
 	for(int i=1; i <= n; i++){
      cout << sum[i] << endl;
    }
}


Measured memory_bytes: 3900
#include <iostream>
using namespace std;
const int INF=0x3f3f3f3f,maxn=100010;
//vector<int>v[maxn];
//map<int,string>mp;
//queue<int>q;
int a[maxn],n,m;
int main()
{
	int i,j,k,ans=0;
	cin>>n;
	int x=n/100;
	int y=n%100;
	if(y<=x*5)
		cout<<"1"<<endl;
	else
		cout<<"0"<<endl;
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())

mod = 10 ** 9 + 7

fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    fac.append(fac[-1] * i % mod)
    inv.append(-inv[mod%i] * (mod // i) % mod)
    finv.append(finv[-1] * inv[-1] % mod)

ans = 0
for i in range(min(n-1, k) + 1):
    com1 = fac[n] * finv[i] * finv[n-i] % mod
    com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod
    mul = com1 * com2 % mod
    ans = (ans + mul) % mod

print(ans)

Measured memory_bytes: 81264