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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 24;

int w, h, sum;
vvi field_origin;

string res;

vi dx = { 1, 0,-1, 0};
vi dy = { 0,-1, 0, 1};

#define F first
#define S second

typedef complex<int> P;

#define X real()
#define Y imag()

inline P f(P p, P delta, int k, int r){
    if(r == 0) r = -1;

    switch(k){
    case 0: p += P( delta.X * r, delta.Y); break;
    case 1: p += P(-delta.Y * r, delta.X); break;
    case 2: p += P(-delta.X * r,-delta.Y); break;
    case 3: p += P( delta.Y * r,-delta.X); break;
    }

    return p;
}

bool check(P p1, P p2, int k, int r){

    vvi field = field_origin;

    field[p1.Y][p1.X] = 8;
    field[p2.Y][p2.X] = 9;
    int cnt = 1;

    queue<P> q;
    q.push(P(0, 0));

    while(!q.empty()){
        P cur_delta = q.front();
        q.pop();

        rep(i, 4){
            P next_delta = P(cur_delta.X + dx[i], cur_delta.Y + dy[i]);

            P np1 = p1 + next_delta;
            P np2 = f(p2, next_delta, k, r);

            if(np1.X < 0 || w <= np1.X || np1.Y < 0 || h <= np1.Y ||
               np2.X < 0 || w <= np2.X || np2.Y < 0 || h <= np2.Y ||
               np1 == np2 || field[np1.Y][np1.X] != 1 || field[np2.Y][np2.X] != 1) continue;

            field[np1.Y][np1.X] = 8;
            field[np2.Y][np2.X] = 9;

            q.push(next_delta);

            cnt++;
        }
    }

    if(cnt == sum / 2){
        return true;
    }
    return false;
}

int main(void){
    for(; cin >> w >> h, w;){

        res = "NO";
        
        field_origin = vvi(h, vi(w));
        rep(y, h) rep(x, w) cin >> field_origin[y][x];

        sum = 0;
        vector<P> choco;
        rep(y, h) rep(x, w) if(field_origin[y][x] == 1) sum++, choco.pb(P(x, y));

        if(sum % 2 == 1){
            cout << res << endl;
            continue;
        }

        rep(i, choco.size()){
            range(j, i + 1, choco.size()){
                rep(k, 4){
                    rep(r, 2){
                        if(check(choco[i], choco[j], k, r)){
                            res = "YES";
                        }
                    }
                }
            }
        }

        cout << res << endl;
    }

	return 0;
}

Measured memory_bytes: 1220
a, b, c, d, e, f = map(int, input().split())
conc = 0
total = 0
sugar = 0
for i in range((f-100*a)//d + 1):
    for j in range((f-100*a-d*i)//c + 1):
        sugar_total = d*i + c*j
        conc_prep = sugar_total/(sugar_total+100*a)
        if sugar_total <= e*a and conc <= conc_prep:
            conc = conc_prep
            total = sugar_total + 100*a
            sugar = sugar_total

for i in range(1, f//(100*b)+1):
    diff = f - 100*b*i
    for j in range(diff//(100*a)+1):
        sugar_max = diff - 100*a*j
        for k in range(sugar_max//d + 1):
            for l in range((sugar_max - k*d)//c + 1):
                sugar_total = k*d + l*c
                total_prep = sugar_total + 100*(b*i + a*j)
                conc_prep = sugar_total/total_prep
                if sugar_total <= e*(b*i+a*j) and conc <= conc_prep:
                        conc = conc_prep
                        total = total_prep
                        sugar = sugar_total
print(total, sugar)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n;
	double m;
	vector<double> stddev(1001,-1);
	int count = 0;
	while(cin >> n, n != 0)
	{
		double sum = 0;
		double sqerrsum = 0;
		vector<double> s(n, 0);
		for (int i = 0; i < n; i++)
		{
			cin >> s[i];
			sum += s[i];
		}
		m = sum / n;
		for (int i = 0; i < n; i++)
		{
			sqerrsum += pow(s[i] - m, 2);
		}
		stddev[count++] = sqrt(sqerrsum / n);
	}
	for (int i = 0; stddev[i] >= 0; i++)
	{
		cout <<  fixed << setprecision(5) << stddev[i] << endl;
	}
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int N, Q;
ll A[100100], B[100100], C[100100];
int X;

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

    std::cin >> N >> Q;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    B[0] = A[0];
    B[1] = A[1];

    for(int i=2;i<N;++i){
        B[i] = A[i] + B[i-2];
    }

    for(int i=N-1;i>=0;--i){
        C[i] = A[i] + C[i+1];
    }

    for(int i=0;i<Q;++i){
        std::cin >> X;

        int lb = 0, ub = N + 1;
        while(ub - lb > 1){
            int m = (lb + ub) / 2;

            int a = (m + 1) / 2, b = m - a;
            
            bool can = true;

            if(A[N-a] <= X){
                if(b > 0){
                    can = false;
                }
            }else{
                int s = std::lower_bound(A, A+N, X - (A[N-a] - X)) - A;
                if((N - a) - s < b){
                    can = false;
                }
            }

            if(can){
                lb = m;
            }else{
                ub = m;
            }
        }

        int a = (lb + 1) / 2;
        ll res = C[N-a];

        if(lb % 2 == 0){
            if(N - lb - 1 >= 0){
                res += B[N - lb - 1];
            }
        }else{
            if(N - lb - 2 >= 0){
                res += B[N - lb - 2];
            }
        }

        std::cout << res << std::endl;
    }
}

Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main()
{
	long long x,k,d,count;
    cin>>x>>k>>d;
    if(x<0)
        x= -x;
    if(x!=0)
    {
        count=x/d;
        if(k<=count)
            cout<<x-k*d;
        else
        {
            k -= count;
            if(k%2)
                cout<<d-(x-count*d);
            else
                cout<<x-count*d;
        }
    }
    else
    {
        if(k%2)
                cout<<d;
            else
                cout<<0;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
ll ans;

int main(){
  cin >> n;
  for(ll i = 1;i*i <= n;i++){
    if(n%i == 0){
      ll m = n/i-1;
      if(m > 0 && n%m == i) ans += m;
      if(i*i != n){
        m = i-1;
        if(m > 0 && n%m == n/i) ans += m;
      }
    }
  }
  cout << ans << endl;


}


Measured memory_bytes: 256
K=int(input())
import queue
a=queue.Queue()
if K<=9:
  print(K)
else:
  for i in range(1,10):
    a.put(i)
  n=K
  while n>1:
    p=a.get()
    x=p%10
    if x%10!=0:
      a.put(10*p+x-1)
    a.put(10*p+x)
    if x%10!=9:
      a.put(10*p+x+1)
    n-=1
  ans=a.get()
  print(ans)

Measured memory_bytes: 12480
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
int a[114];
signed main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int q = 0, w = 0;
	for (int i = n - 1; i > -1; i--) {
		if (i % 2 == (n - 1) % 2)q += a[i];
		else w += a[i];
	}
	cout << abs(q - w) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ll long long
#define MOD 1000000007
#define ull unsigned long long int
#define db double
#define fi first
#define se second
#define pb push_back
#define vec vector<ll>
#define pr pair<ll,ll>
#define pq priority_queue<ll,vector<ll>, compare_queue >
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define GS(s)   string s; getline(cin,s);
#define lll __int128_t
#define endl "\n"
#define Next cout.flush()

struct compare_queue
{
    bool operator()(const ll& a, const ll& b)
    {
        return a>b;
    }
};

ll gcd(ll u,ll v)
{
	if(v==0)
	return u;
	
	else
	return gcd(v,u%v);
}

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2); 
    p = (p * p); 

    return (y%2 == 0)? p : (x * p); 
} 

    // ll power(ll x,ll y){
    //     ll i;
    //     ll ans=1;
    //     for(i=0;i<y;i++){
    //         ans=ans*x;
    //     }
    //     return ans;
    // }


// ll modInverse(int a, int m) 
// { 
//     if(a==1){return 1;}
//     return power(a, m-2, m); 
// } 
  



// // // #define MAX 1000000
// int primes[100009],cnt=0;
// // vector<int> factors[1000009];
// char str[1000009];
// void pre()
// {
//     // calcualting primes
//     int n=100000;
//     for(int i=2; i*i<=n; i++)
//         if(str[i]==0)
//             for(int j=i; j*i<=n; j++)
//                 str[i*j]=1;
//     for(int i=2; i<=n; i++)
//         if(str[i]==0)primes[cnt]=i,cnt++;
// }


// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
// vector<ll> getFactorization(ll x) 
// { 
//     vector<ll> ret; 
//     while (x != 1) 
//     { 
//         ret.push_back(spf[x]); 
//         x = x / spf[x]; 
//     } 
//     return ret; 
// } 

// C:\Users\A\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lambda


// ll getPow(ll n,ll k){
//     double f=log((double)n);
//     double g=log((double)k);
//     f=f/g;
//     return (ll)f;
// }

void Function(){
ll x;
cin >> x;
cout << 1-x << endl;

}


int main(){ 
fast;
ll t=1,i=0,j=0,k,h;
 //pre();
// cin >> t;
for(h=1;h<=t;h++){

Function();

}


return 0;

}

Measured memory_bytes: 3636
S = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".replace(' ', '').split(',')
i = int(raw_input())
print(S[i-1])



Measured memory_bytes: 2568
A, B = map(int, input().split())
def factorization(n):
  M = n
  k = 1
  faclist = [1]
  while(k**2 <= M):
    k += 1
    if M%k == 0:
      count = 0
      while M%k == 0:
        M //= k
        count += 1
      faclist.append(k)
  if M > 1:
    faclist.append(M)
  return faclist

a = factorization(A)
b = factorization(B)
from collections import deque

a = deque(a)
ans = 0
def binary_search(list, item):
  low = 0
  high = len(list) - 1
  while low <= high:
    mid = (low + high) //2
    guess = list[mid]
    if guess == item:
      return 1
    if guess > item:
      high = mid -1
    else:
      low = mid + 1
  return 0
while a:
  item = a.popleft()
  ans += binary_search(b, item)
print(ans)
  


Measured memory_bytes: 66220
h,w= map(int, input().split())
a = []
x = []
for i in range(h):
    li = input()
    aa = []
    for j in range(w):
        aa.append(li[j])
        if aa[j] == '#':
            x.append((i, j))
    a.append(aa)
ans = 0
while True:
    xx = []
    for p in x:
        pp = [(p[0]-1, p[1]), (p[0]+1, p[1]), (p[0], p[1]-1), (p[0], p[1]+1)]
        for ppp in pp:
            if (0 <= ppp[0] < h) and (0 <= ppp[1] < w):
                if a[ppp[0]][ppp[1]] == '.':
                    a[ppp[0]][ppp[1]] = '#'
                    xx.append((ppp[0], ppp[1]))
    x = xx
    if len(x) == 0:
        break
    ans += 1
    # print(x)
print(ans)


Measured memory_bytes: 129048
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  char c; cin >> c;
  if ('A' <= c and c <= 'Z') {
    cout << 'A' << endl;
  } else {
    cout << 'a' << endl;
  }

  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef map<ll, ll> mii;
const int MOD = 1e9 + 7;

#define fastIO() \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

#define what_is(args ...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename ...Args>
void err(istream_iterator<string> it, T a, Args ...args) {
    cerr << *it << " = " << a << endl;
    err(++it, args ...);
}


int main() {
    int N;
    cin >> N;
    vi a(N);
    for (auto &i : a)   cin >> i;
    int n = 303;
    vector<vector<vector<ld>>> dp(n+1, vector<vector<ld>>(n+1, vector<ld>(n+1, 0.0)));
    for (int k = 0; k <= N; ++k) {
        for (int j = 0; j <= N; ++j) {
            for (int i = 0; i <= N; ++i) {
                if (i+j+k <= 0 || i+j+k > N) continue;
                dp[i][j][k] = 0;
                if (i >= 1)
                    dp[i][j][k] += i * dp[i-1][j][k];
                if (j >= 1)
                    dp[i][j][k] += j * dp[i+1][j-1][k];
                if (k >= 1)
                    dp[i][j][k] += k * dp[i][j+1][k-1];
                assert(i + j + k > 0);
                dp[i][j][k] = (dp[i][j][k] + N)/(i + j + k);
                //cerr << i << " " << j << " " <<k << " -> " << dp[i][j][k] << endl;
            }
        }
    }
    int i, j, k;
    i = j = k = 0;
    for (auto x : a) {
        if (x == 1) ++i;
        else if (x == 2) ++j;
        else    if (x == 3) ++k;
    }
    assert(i + j + k >= 0 && i + j + k <= N);
    cout << fixed << setprecision(12);
    cout << dp[i][j][k] << endl;
    return 0;
}


Measured memory_bytes: 444288
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		int x = Integer.parseInt(str[3]);
		int y = Integer.parseInt(str[4]);

		int max = Math.max(x, y);

		long ans = Long.MAX_VALUE;
		for (int i = 0; i <= max * 2; i += 2) {
			int X = (x - i / 2) < 0 ? 0 : (x - i / 2);
			int Y = (y - i / 2) < 0 ? 0 : (y - i / 2);

			ans = Math.min(ans, i * c + X * a + Y * b);
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 20052
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x) {
	x=0; char c=getchar(); int f=1;
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=10*x+c-'0'; c=getchar();} x*=f;
}
int n,m;
ll ans;
int main() {
	read(n); read(m); if (n>m) swap(n,m); //n<=m
	if (n==1) {
		printf("%d",m==1?1:max(m-2,0));
	}
	else if (n==2) {
		printf("0");
	}
	else printf("%lld",1LL*(n-2)*(m-2));
	return 0;
}

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

#print( N,S )   

cnt = 0
s_flgs = [[False for _ in range(10) ] for _ in range(3)]

for i1 in range(N-2):
    if s_flgs[0][int(S[i1])] == True:
        continue
    s_flgs[0][int(S[i1])] = True
    s_flgs[1] = [False for _ in range(10) ]
    for i2 in range(i1+1,N-1):
        if s_flgs[1][int(S[i2])] == True:
            continue
        s_flgs[1][int(S[i2])] = True
        s_flgs[2] = [False for _ in range(10) ]
        for i3 in range(i2+1, N):
            if s_flgs[2][int(S[i3])] == True:
                continue
            s_flgs[2][int(S[i3])] = True
            cnt = cnt + 1
            #ppp = S[i1]+S[i2]+S[i3]
            #print(i1,i2,i3, ppp)

print(cnt)


Measured memory_bytes: 3188
#include <vector>
#include <math.h>
#include <iostream>

using namespace std;

int main(){

  int dp[3][100001];
  int act[3][100001];
  
  int N;
  cin >> N;
  for(int i=1; i<=N; i++){
    cin >> act[0][i] >> act[1][i] >> act[2][i];
  }

  dp[0][1] = act[0][1];
  dp[1][1] = act[1][1];
  dp[2][1] = act[2][1];

  for(int i = 2; i <= N; i++){
    dp[0][i] = max(dp[1][i-1] + act[0][i], dp[2][i-1] + act[0][i]);
    dp[1][i] = max(dp[0][i-1] + act[1][i], dp[2][i-1] + act[1][i]);
    dp[2][i] = max(dp[0][i-1] + act[2][i], dp[1][i-1] + act[2][i]);
  }

  int ret = 0;
  for(int i=0; i <3; i++){
    ret =  ret > dp[i][N] ? ret : dp[i][N]; 
  }

  cout << ret << "\n";

  
  return 0;
}


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

int main(){
    ll a, b;
    scanf("%lld %lld", &a, &b);
    if(a > b) swap(a, b);
    if((b-a)&1) printf("IMPOSSIBLE\n");
    else printf("%lld\n", a+(b-a)/2);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int n, Y, M, D, total=0, i, a, b, c, f, w, z, q;

  scanf ("%d", &n);
  for(i = 0; i < n; i++){
    total = 0;
    scanf("%d %d %d", &Y, &M, &D);
    a = (999 - Y) / 3;
    b = (999 - Y) - a;
    c = (b * 20 * 5) + (b * 19 * 5);
    f = a * 20 * 10;
    if( Y % 3 == 0){
      w = 10 - M;
      z = w * 20;
    }else if (M == 1 && Y % 3 != 0){
      z = 180;
    }else if (M == 2 && Y % 3 != 0){
      z = 161;
    }else if (M == 3 && Y % 3 != 0){
      z = 141;
    }else if (M == 4 && Y % 3 != 0){
      z = 122;
    }else if (M == 5 && Y % 3 != 0){
      z = 102;
    }else if (M == 6 && Y % 3 != 0){
      z = 83;
    }else if (M == 7 && Y % 3 != 0){
      z = 63;
    }else if (M == 8 && Y % 3 != 0){
      z = 44;
    }else if (M == 9 && Y % 3 != 0){
      z = 24;
    }else if (M == 10 && Y % 3 != 0){
      z = 5; 
    }
    if (M % 2 == 0 && Y % 3 != 0){
      q = 19 - D;
    }else if (M % 2 == 1 || Y % 3 == 0){
      q = 20 - D;
    }
  
  
    total = q + z + c + f + 1;
  
    printf("%d\n", total);
  }
    return 0;
}
  

Measured memory_bytes: 596
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define LL long long

#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"

using namespace std;

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

void outp(int i){
	printf("%d",i);
}

LL mod(LL i){
	return i % 1000000007;
}



int Lucky_7(){
	int N = inp();

	while(N > 0){
		int i = N % 10;
		if(i == 7) {
			printf("Yes");
			return 0;
		}
		N = N / 10;
	}
	printf("No");

	return 0;

}
signed main() {
	Lucky_7();
	return 0;
}



Measured memory_bytes: 3756
import heapq, sys
def input():
    return sys.stdin.readline()[:-1]

n, m, s, t = map(int, input().split())

yen_edge = [[] for _ in range(n)]
snuke_edge = [[] for _ in range(n)]

for _ in range(m):
	u, v, a, b = map(int, input().split())
	yen_edge[u - 1].append([v - 1, a])
	yen_edge[v - 1].append([u - 1, a])
	snuke_edge[u - 1].append([v - 1, b])
	snuke_edge[v - 1].append([u - 1, b])

class DijkstraList():
    #隣接リスト版
    #同一頂点の複数回探索を防ぐため訪問した頂点数を変数cntで持つ
    def __init__(self, adj, start):
        self.list = adj
        self.start = start
        self.size = len(adj)

    def solve(self):
        self.dist = [float("inf") for _ in range(self.size)]
        self.dist[self.start] = 0
        self.prev = [-1 for _ in range(self.size)]
        self.q = []
        self.cnt = 0

        heapq.heappush(self.q, (0, self.start))

        while self.q and self.cnt < self.size:
            u_dist, u = heapq.heappop(self.q)
            if self.dist[u] < u_dist:
                continue
            for v, w in self.list[u]:
                if self.dist[v] > u_dist + w:
                    self.dist[v] = u_dist + w
                    self.prev[v] = u
                    heapq.heappush(self.q, (self.dist[v], v))

            self.cnt += 1

        return

    def distance(self, goal):
        return self.dist[goal]

    def path(self, goal):
        self.path = [goal]
        while self.path[-1] != self.start:
            self.path.append(self.prev[self.path[-1]])
        return self.path[::-1]

yen = DijkstraList(yen_edge, s - 1)
snuke = DijkstraList(snuke_edge, t - 1)
yen.solve()
snuke.solve()
ans_list = []

for i in range(n):
	ans_list.append(yen.distance(i) + snuke.distance(i))

ans = []

ans.append(10 ** 15 - ans_list[n - 1])

for i in range(1, n):
	if ans_list[n - i - 1] > ans_list[n - i]:
		ans_list[n - i - 1] = ans_list[n - i]
	ans.append(10 ** 15 - ans_list[n - i - 1])

for i in range(n - 1, -1, -1):
	print(ans[i])

Measured memory_bytes: 122876
/*
Problem

Category
DFS

URL:
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1160&lang=jp

考察:


Date: 2020/04/14
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int w, h;
vector<vector<bool>> C;
vector<vector<int>> color;
int currentColor = 1;


/* ======================== */

signed main(){
    while(true){
        getInput();
        solve();
    }
    return 0;
}

void getInput() {
    cin>>w>>h;
    if(!w and !h) {exit(0);}
    C = vector<vector<bool>>(h, vector<bool>(w, false));
    color = vector<vector<int>>(h, vector<int>(w, 0));
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; ++j) {
            bool c;
            cin>>c;
            C[i][j] = c;
        }
    }
}

void dfs(int i, int j) {
    if (i < 0 or j < 0 or i >= h or j >= w) return;
    if (!C[i][j]) return;
    if (color[i][j]) return;
    color[i][j] = currentColor;
    
    for(int a: {i-1, i, i+1})
        for(int b: {j-1, j, j+1})
            dfs(a, b);
    
}


void solve() {
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; ++j) {
            dfs(i, j);
            currentColor++;
        }
    }
    set<int> colorSet {0};
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; ++j) {
            colorSet.insert(color[i][j]);
        }
    }
    cout<<colorSet.size()-1<<endl;
}







Measured memory_bytes: 3428
#include<iostream>
#include<cmath>
using namespace std;
long long N, T, Q, a[1 << 17], b[1 << 17], c[1 << 17];
int main() {
	cin >> N >> T >> Q;
	for (int i = 0; i < N; i++)cin >> a[i] >> b[i];
	long long H = -1LL << 62;
	for (int i = 0; i < N; i++) {
		if (b[i] == 2) {
			if (i >= 1) {
				if (b[i - 1] == 1) {
					long long C = (a[i - 1] + a[i]) / 2;
					if (abs(C - a[i]) <= T) { H = C; c[i] = C; }
					else { c[i] = a[i] - T; }
				}
				else {
					if (abs(H - a[i]) <= T)c[i] = H;
					else { c[i] = a[i] - T; }
				}
			}
			if (i == 0)c[i] = a[i] - T;
		}
	}
	H = 1LL << 62;
	for (int i = N - 1; i >= 0; i--) {
		if (b[i] == 1) {
			if (i < N - 1) {
				if (b[i + 1] == 2) {
					long long C = (a[i + 1] + a[i]) / 2;
					if (abs(C - a[i]) <= T) { H = C; c[i] = C; }
					else { c[i] = a[i] + T; }
				}
				else {
					if (abs(H - a[i]) <= T)c[i] = H;
					else { c[i] = a[i] + T; }
				}
			}
			if (i == N - 1)c[i] = a[i] + T;
		}
	}
	for (int i = 0; i < Q; i++) {
		int p; cin >> p; p--; cout << c[p] << endl;
	}
	return 0;
}

Measured memory_bytes: 3516
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;

int R;
int main()
{
	scanf("%d",&R);
	if(R<1200) printf("ABC");
	else if(R<2800) printf("ARC");
	else printf("AGC");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(0);cin.tie(0)
const int inf=1e18;

vector<vector<PI>>g;
vector<int>color;


int32_t main()
{
    boost;
   

    int n;
    cin>>n;
    g.resize(n+1);
    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back({v,i});
        g[v].push_back({u,i});
    }
    
    color.resize(n,0);
        
    int dum[n+1]={0};
    for(int i=1;i<=n;i++)
    {
        int c=1;
        for(PI u:g[i])
        {
            if(c==dum[i])
                c++;
            if(color[u.ss]==0)
            {
                color[u.ss]=c;
                dum[u.ff]=c;
                c++;
            }
        }
    }
    int ans=0;
    for(int i=1;i<n;i++)
        ans=max(ans,color[i]);
    cout<<ans<<endl;
    for(int i=1;i<n;i++)
        cout<<color[i]<<endl;
}


Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    s[k-1]-='A'-'a';
    OUT(s);
    return 0;
}

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

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

    int cnt = 0, maxCnt = 0;
    for(int i = 0; i < 3; i++) {
        if(S[i] == 'R') {
            cnt ++;
            if(cnt > maxCnt) {
                maxCnt = cnt;
            }
        } else {
            cnt = 0;
        }
    }
    cout << maxCnt << endl;

    return 0;
}

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

int a[26];

int main()
{
    //freopen("demo.in", "r", stdin);
    //freopen("demo.out", "w", stdout);
    char s[10];
    scanf("%s", s);
    for (int i = 0; i < strlen(s); i++)
    {
        a[ s[i] - 'A' ]++;
    }
    for (int i = 0; i < 26; i++)
    {
        if (a[i] == 1 || a[i] == 3 || a[i] == 4)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int Total[51]; // Total[i]: バーガーiの全枚数
int Pat[51]; // Pat[i]: バーガーiの全パティ数

// バーガーk, その時のXの長さ
int rec(int k, int x) {
   // バーガー全部なら前計算の結果を返す
   if (x == Total[k]) return Pat[k];

   int ans = 0;

   // 下のパン
   x--;

   // 下のk-1のバーガー
   if (x > 0) {
      int l = min(x, Total[k-1]);
      ans += rec(k-1, l);
      x -= l;
   }

   // 真ん中のパティ
   if (x > 0) {
      ans++;
      x--;
   }

   // 上のk-1バーガー
   if (x > 0) {
      int l = min(x, Total[k-1]);
      ans += rec(k-1, l);
      x -= l;
   }

   return ans;
}

signed main() {
   int N, X;
   cin >> N >> X;

   Total[0] = Pat[0] = 1;
   for (int i = 1; i <= N; i++) {
      Total[i] = Total[i-1] * 2 + 3;
      Pat[i] = Pat[i-1] * 2 + 1;
   }

   cout << rec(N, X) << endl;

   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
  	int	n;
  	int a[102];
  	int	i;
  	int cnt;
  
  	scanf("%d\n", &n);
  	for(i=0; i<n; i++)
    {
      	scanf("%d", &a[i]);
    }
  
  	cnt = 0;
  	for(i=0; i<n; i++)
    {
      	if (i % 2 == 0 && a[i] % 2 == 1)
          	cnt++;
    }
  
  	printf("%d", cnt);
  	return (0);
}

Measured memory_bytes: 1684
from collections import deque


N,M=map(int,input().split())
a=[]
min=[0] * (N + 1)
heya=[[] for _ in range(N + 1)]


for i in range(M):
    tmp = list(input().split())
    tmp_i = [int(s) for s in tmp]
    a.append(tmp_i)

heya[0].append(1)
for i in range(M):
    tmp1 = a[i][0]
    tmp2 = a[i][1]
    heya[tmp1].append(tmp2)
    heya[tmp2].append(tmp1)

que = list(heya[0])
prev = []
tmp = []
prevtmp =[]
cnt = 0
prev.append(0)
while cnt < 1000000:
    #print('cnt:'+str(cnt))
    tmp.clear()
    prevtmp.clear()
    if len(que) == 0:
        #print('探索終了')
        break

    for i in range(len(que)):
        chk = que[i]
        #print('chk')
        #print('chk:' + str(chk))

        #初めて探索する場所、または最小探索回数の場合、次の探索先にする
        if min[chk] == 0:
            #print('i')
            #print(i)
            min[chk] = prev[i]
            for j in range(len(heya[chk])):
                #print('add:' + str(heya[chk][j]))
                tmp.append(heya[chk][j])
                prevtmp.append(chk)

    #次の探索先を設定する
    que.clear()
    for i in range(len(tmp)):
        que.append(tmp[i])

    prev.clear()
    for i in range(len(prevtmp)):
        prev.append(prevtmp[i])

    cnt = cnt + 1

#最小探索回数がない＝どこの部屋ともつながっていない
chk = 0
for i in range(1,N+1):
    if min[i] == 0:
        print('No')
        chk = 1
        break

if chk == 0:
    print('Yes')
    for i in range(2,N+1):
        print(min[i])


Measured memory_bytes: 62012
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool check = true;
  for(int i=0; i<=s.length()/2; i++){
    if(s[i]!=s[s.length()-i-1]){
      check = false;
      break;
    }
  }

  if(check)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
import time
# import itertools

mod = int(1e9+7)
INF = 1<<29

def main():
    a,b,c = map(int,input().split())
    if a == b and b == c:
        print("No")
    elif a != b and b != c and a != c:
        print("No")
    else:
        print("Yes")
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 38384
#include <stdio.h>
#define max 25
#define nil -1
typedef struct{
  int prev;
  int right;
  int left;
  int sibling;
  int degree;
  int Depth;
  int Height;
} node;
void printData(void);
void HowDepth(int, int);
int HowHeight(int);
int n;
node data[max];

int main()
{
  int i, id;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    data[i].prev = nil;
    data[i].sibling = nil;
    data[i].degree = 0; }
  
  for(i = 0 ; i < n ; i++){
    scanf("%d",&id);
    scanf("%d%d",&data[id].left,&data[id].right);
    if(data[id].left != nil){
      data[data[id].left].prev = id;
      data[id].degree++; }
    if(data[id].right != nil){
      data[data[id].right].prev = id;
      data[id].degree++; }
    if(data[id].left != nil && data[id].right != nil){
      data[data[id].left].sibling = data[id].right;
      data[data[id].right].sibling = data[id].left; }
  } 
  
  for(i = 0 ; i < n ; i++){
    if(data[i].prev == nil){
      HowDepth(i,0);
      break; }
  }

  for(i = 0 ; i < n ; i++) data[i].Height = HowHeight(i);
  printData();

  return 0;
}

void printData(void)
{
  int i; 

  for(i = 0 ; i < n ; i++){
    printf("node %d: ",i);
    printf("parent = %d, ",data[i].prev);
    printf("sibling = %d, ",data[i].sibling);
    printf("degree = %d, ",data[i].degree); 
    printf("depth = %d, ",data[i].Depth);
    printf("height = %d, ",data[i].Height);
    if(data[i].prev == nil) printf("root\n");
    else if(data[i].right == nil && data[i].left == nil) printf("leaf\n");
    else printf("internal node\n"); }
}

void HowDepth(int i, int count)
{
  data[i].Depth = count;
  if(data[i].right != nil) HowDepth(data[i].right,count + 1);
  if(data[i].left != nil) HowDepth(data[i].left, count + 1);
}

int HowHeight(int i)
{
  int H1 = 0, H2 = 0;
      
  if(data[i].right != nil) H1 = HowHeight(data[i].right) + 1;
  if(data[i].left != nil) H2 = HowHeight(data[i].left) + 1; 

  if(H1 >= H2) return H1;
  if(H1 < H2) return  H2;
}				  


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

#include<stdlib.h>
#include<iostream>
#include<math.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define INF 2000000000
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define PI 3.1415926535897932
using namespace std;






int main()
{
long long a;
cin>>a;
long long  ans=100;
int count=0;
while(ans<a){
	ans=ans*1.01;
	count++;
}
cout<<count;

return 0;
}



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

int L, N, X[200000];
ll r[200001], l[200001], MAX;
int main()
{
	cin >> L >> N;
	for (int i = 0; i < N; ++i)
    {
        cin >> X[i];
    }
	for (int i = 0; i < N; ++i)
    {
        l[i + 1] = l[i] + X[i] * 2;
    }
	for (int i = N - 1; i >= 0; --i)
    {
        r[i] = r[i + 1] + (L - X[i]) * 2;
    }
	for (int i = 0; i < N; ++i)
    {
		ll cnt = X[i] + l[i] + r[i + 1];
		if (i >= N - (i + 1))
		{
			cnt -= l[i - (N - (i + 1))];
		}
		else
		{
			cnt -= r[i + 1 + i + 1];
		}
		MAX = max(MAX, cnt);

		cnt = L - X[i];
		if (i <= N - (i + 1))
		{
			cnt += l[i];
			cnt += r[i + 1] - r[i + 1 + i];
		}
		else
		{
			cnt += r[i + 1];
			cnt += l[i] - l[i - (N - (i + 1)) - 1];
		}
		MAX = max(MAX, cnt);
	}

	cout << MAX << endl;

	return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include<functional>  
#define ll long long
#define out(a) printf("%d",a)
using namespace std;
int n;
int a,b;
int read()
{
	int s=0,t=1; char ch;
	while (ch<'0'||ch>'9') {if (ch=='-') t=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') {s=s*10+ch-'0';ch=getchar();}
	return s*t;
}
int main()
{
	a=read(); b=read();
	if (a>=b) out(a-b);
	else out(0);
}

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

 
int main() {
  string s;
  cin >> s;
  int co=0;
  
  rep(i,(int)s.size()){
   int a= s.at(i)-'0';
    co+=a;

  }
  
  
  co%=9;
  if(co==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k, x; cin >> k >> x;
	if(k * 500 >= x) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

using namespace std;

#define INF 2000000000

typedef long long ll;

ll n, w, val[200], weight[200], dp[100010][200];

ll f(ll cur_val, ll cur_i){
//    cout << "inside with: " << cur_val << " " << cur_i << endl;
    if(cur_val < 0){
//        cout << "negative!" << endl;
        return INF;
    }
    if(dp[cur_val][cur_i] != -1){
//        cout << "already: " << dp[cur_val][cur_i] << endl;
        return dp[cur_val][cur_i];
    }
    if(cur_i == n){
        if(cur_val == 0){
//            cout << "returning 0" << endl;
            return 0;   
        }
        else{
//            cout << "returning INF" << endl;
            return INF;
        }
    }
    dp[cur_val][cur_i] = min( f(cur_val, cur_i+1), f(cur_val-val[cur_i], cur_i+1)+weight[cur_i] );
    return dp[cur_val][cur_i];
}

int main() {

    for(ll i = 0; i < 100001; i++){
        for(ll j = 0; j < 200; j++){
            dp[i][j] = -1;
        }
    }

    cin >> n >> w;
    for(ll i = 0; i < n; i++){
        cin >> weight[i] >> val[i];
    }
//    cout << " " << endl;
//    return 0;

/*
    for(ll i = 0; i < 100001; i++){
        for(ll j = 0; j < 200; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
*/    
    
    for(ll i = 100000; i >= 0; i--){
//        cout << "outside with: " << i << endl;
        if( f(i, 0) <= w ){
            cout << i;
            return 0;
        }
    }
}

Measured memory_bytes: 156544
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    int N;
    bool ans=true;
    cin >> N;
    int dis[N]={};
    rep(i,N){
        int x; cin >> x;
        dis[x]++;
    }
    int remain=N,p=N-1;
    while(true){
        if(dis[p]==1) ans=false;
        else if(dis[p]>=2){
            dis[p]-=2;
            remain-=2;
            break;
        }
        p--;
    }
    int L=p-1,able;
    while(L>0){
        p--;
        if(p==0 && L>0){
            ans=false;
            break;
        }
        int minus=min(L,2);
        if(dis[p]<minus) ans=false;
        dis[p]-=minus;
        L-=minus;
        remain-=minus;
        able=p;
    }
    able++;
    rep(i,N) if(i<able && dis[i]>0) ans=false;
    if(ans) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

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


ll power(ll m, ll n)
{
    ll base = m;
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        n >>= 1;
    }
    return res;
}

ll invmod(ll n)
{
    return power(n, MOD - 2);
}

ll comb(ll n, ll m)
{
    ll res = 1;
    rep(i, m)
    {
        res = (res * (n - i)) % MOD;
        res = (res * invmod(i + 1)) % MOD;
    }
    return res;
}

int main()
{
    // cout << comb(3, 0) << endl;
    // cout << comb(4, 3) << endl;
    // cout << power(2, 4) << endl;
    // cout << power(2, 3) << endl;
    // cout << (invmod(3) * 3 ) % MOD<< endl;
    // return 0;

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

    rep(num_b, k + 1)
    {
        if (num_b == 0) continue;
        if (num_b - 1 > n - k)
        {
            cout << 0 << endl;
            continue;
        }

        ll res = 0;
        rep(r, 3)
        {
            int num_r = num_b - 1 + r;
            if (num_r == 0) continue;

            ll cnt = (comb(k - 1, num_b - 1) * comb(n - k - 1, num_r - 1)) % MOD;
            if (r == 1)
                res = (res + 2 * cnt) % MOD;
            else
                res = (res + cnt) % MOD;
            // cout << comb(k - 1, num_b - 1) << ' ' << comb(n - k - 1, num_r - 1) << endl;
        }
        // cout << "*********" << endl;
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 10000000000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 101
#define MOD 1000000007

int main(){

    ll h,w;
    cin >> h >> w;
    ll ans1= INF,ans2 = INF,ans3 = INF,ans4 = INF;

    //横横
    for(int i = 0;i <= h;i++){
        ll Sa,Sb,Sc;
        Sa = i*w;
        Sb = (h-i)/2*w;
        Sc = (h-i-(h-i)/2)*w;
        ll maxi = max(Sa,max(Sb,Sc));
        ll mini = min(Sa,min(Sb,Sc));
        ans1 = min(ans1,maxi-mini);
    }

    //縦縦
    for(int i = 0;i <= w;i++){
        ll Sa,Sb,Sc;
        Sa = h*i;
        Sb = (w-i)/2*h;
        Sc = (w-i-(w-i)/2)*h;
        ll maxi = max(Sa,max(Sb,Sc));
        ll mini = min(Sa,min(Sb,Sc));
        ans2 = min(ans2,maxi-mini);
    }

    //横縦
    for(int i = 0;i <= h;i++){
        ll Sa,Sb,Sc;
        Sa = i*w;
        Sb = (h-i)*(w/2);
        Sc = (h-i)*(w-w/2);
        ll maxi = max(Sa,max(Sb,Sc));
        ll mini = min(Sa,min(Sb,Sc));
        ans3 = min(ans3,maxi-mini);
    }

    //縦縦
    for(int i = 0;i <= w;i++){
        ll Sa,Sb,Sc;
        Sa = h*i;
        Sb = (w-i)*(h/2);
        Sc = (w-i)*(h-h/2);
        ll maxi = max(Sa,max(Sb,Sc));
        ll mini = min(Sa,min(Sb,Sc));
        ans4 = min(ans4,maxi-mini);
    }

    ll ans = min(min(ans1,ans2),min(ans3,ans4));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Lazy.Char8 as B
import           Data.Char

sumDigits :: B.ByteString -> Int
sumDigits = sum . fmap digitToInt . B.unpack

main :: IO ()
main = do
    xss <- takeWhile (/= B.pack "0") . B.lines <$> B.getContents
    mapM_ (print . sumDigits) xss



Measured memory_bytes: 4004
h, w = [int(x) for x in input().split()]
grid = [[]]
for _ in range(h):
    grid.append([0] + [int(x) for x in input().split()])

operations = []
for i in range(1, h+1):
    for j in range(1, w+1):
        if grid[i][j] % 2 == 0: continue
        if j < w:
            operations.append((i, j, i, j+1))
            grid[i][j+1] += grid[i][j]
        elif i < h:
            operations.append((i, j, i+1, j))
            grid[i+1][j] += grid[i][j]

print(len(operations))
for op in operations:
    print(*op)


Measured memory_bytes: 22356
#include <stdio.h>

int main(){
	int a, b;
	scanf("%d %d",&a, &b);
    if (a < b) {
        printf("a < b\n");
    } else if (a == b) {
        printf("a == b\n");
    } else if (a > b) {
        printf("a > b\n");
    }
}


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

int main(){
  int n; cin>>n;
  ll ac=0,bc=0,suma=0,sumb=0;
  vector<ll> a(n),b(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    suma+=a[i];
  }for(int i=0;i<n;i++){
    cin>>b[i];
    sumb+=b[i];
  }
  for(int i=0;i<n;i++){
    if(a[i]!=b[i]){
      if(a[i]<b[i]) ac+=(b[i]-a[i]+1)/2;
      else bc+=a[i]-b[i];
    }
  }
  if((sumb-suma)<max(ac , bc)){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef pair<int, int> P;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n-1);
    vector<int> b(n-1);
    rep(i, 0, n-1) {
        cin >> a[i] >> b[i];
    }
    vector<vector<int>> tree(n+1);
    vector<P> vp;
    rep(i, 0, n-1) {
        tree[a[i]].push_back(b[i]);
        tree[b[i]].push_back(a[i]);
        vp.push_back(make_pair(a[i], b[i]));
    }
    int v = 0;
    rep(i, 1, n+1) {
        int tmp = tree[i].size();
        v = max(tmp, v);
    }
    cout << v << endl;

    queue<int> que;
    map<P, int> mp;
    que.push(1);
    vector<int> check(n+1);
    vector<int> ans(n+1, 0);
    check[0] = 1;
    check[1] = 1;
    ans[0] = 0;
    ans[1] = 0;
    int color = 1;
    while(!que.empty()) {
        int u = que.front();
        que.pop();
        //cout << u << endl;
        color = 1;
        for(auto i : tree[u]) {
            //cout << "i: " << i << endl;
            if(check[i] == 1) {
                //color = ans[i];
                continue;
            }
            if(ans[u] == color) {
                color++;
            }
            ans[i] = mp[make_pair(i, u)] = mp[make_pair(u, i)] = color++;
            check[i] = 1;
            que.push(i);
        }
    }
    for(auto p:vp) {
        cout << mp[p] << endl;
    }
    return 0;
}

Measured memory_bytes: 20852
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
#endif

	int a,l;
	cin>>a>>l;
	if(l%2!=0)
	{
		cout<<"No"<<endl;
	}
	else
	{
		if((4*a-l)/2<0 || (l-2*a)/2<0)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

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

void solve() {
  ll n;
  cin >> n;
  ll ans = n * (n - 1) / 2;
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
using namespace std;
int main() {
    int h1,h2,m1,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    cout<<(h2-h1)*60+m2-m1-k<<endl;
    return 0;
}

Measured memory_bytes: 3624