akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main
{
	static int count = 0;
	static int m = 0;
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (true)
		{
			int n = sc.nextInt();
			m = sc.nextInt();
			if (n == 0 && m == 0) break;

			count = 0;
			sum(n, 0, 0);
			System.out.println(count);
		}
	}
	private static void sum(int n, int sum, int start)
	{
		if (n == 0)
		{
			if (sum == m)
			{
				count++;
			}
		}
		else
		{
			for (int i = start; i < 10; i++)
				sum(n - 1, sum + i, i + 1);
		}
	}
}

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

using namespace std;
using ll=long long;
int main()
{
   int n;cin >>n;
   string s;cin >>s;
   int c[3]={0};
   char k[3]={'R','B','G'};
   for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
        if(k[j]==s[i])c[j]++;
    }
   }
   ll ans=1;
   for(int i=0;i<3;i++){
    ans*=c[i];
   }
   for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        if(s[i]!=s[j]){
            int k=j+j-i;
            if(k>=n)continue;
            if(s[k]!=s[i]&&s[k]!=s[j])ans--;
        }
    }
   }
   cout << ans << endl;
    return 0;
}


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

const ll INF = (ll)INT32_MAX;
int wt[105],val[105];
ll dp[105][100005];


int main()
{
	int n,w;
	scanf("%d %d",&n,&w);
	
	for(int i=1;i<=n;i++)
	scanf("%d %d",&wt[i],&val[i]);
	
	//dp[i][j] = min weight needed to get to value j using  1 to i items;;;;
	for(int i=0;i<=101;i++)
	for(int j=0;j<100002;j++)
	dp[i][j] = INF;
	
	for(int i=0;i<=n;i++)
	dp[i][0] = 0;
	
	for(int i=1;i<=n;i++)
	{
		for(int value=1;value<=100001;value++)
		{
			if(value-val[i]>=0)
			dp[i][value] = min(dp[i-1][value],(ll)wt[i]+dp[i-1][value-val[i]]);
			
			else
			dp[i][value] = dp[i-1][value];
		}
	}
	
	int ans = 0;
	
	for(int i=1;i<=100001;i++)
	{
	  // cout<<dp[n][i]<<" "<<i<<endl;
		if(dp[n][i]<=w)
		ans = max(ans,i);
	}
	
	printf("%d\n",ans);
	return 0;	
	
}

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

int main() {
	int n;
	cin >> n;
	int arr[n] = {};
	for(int i=0; i<n; i++){
		cin >> arr[i];
	}
	for(int i=n-1; i>=0; i--){
		cout << arr[i];
		if(i!=0) cout << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
#include<math.h>
int main(){ 
	int N,L,i;
	scanf("%d %d", &N, &L);
	int apple[N];
	for (i = 0; i < N; i++){
		apple[i] = (L + i - 1)+1;
	}
	int sum = 0;
	for (i = 0; i < N; i++){
		sum += apple[i];
	}
	int less = 1000;
	for (i = 0; i < N; i++){
		if (abs(apple[i]) < abs(less)){
			less = apple[i];
		}
	}
	printf ("%d\n",sum - less);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main() {
    int n;
    
    ll ans = 0;

    vector<int> a;
    vector<int> b;

    cin >> n;

    for (int i = 0; i < n+1; i++) {
         int aa;
         cin >> aa;
         a.push_back (aa);
    }
    
    for (int i = 0; i < n; i++) {
         int bb;
         cin >> bb;
         b.push_back (bb);
    }

    b.push_back (0);
    
    for (int i = n; i >= 1; i--) {
        if (b[i-1] + b[i] - a[i] >= 0) {
            ans += a[i];
            b[i-1] = min (b[i-1] + b[i] - a[i], b[i-1]);
        } else {
            ans += b[i-1] + b[i];
            b[i-1] = 0;
        }
    }
    
    if (b[0] - a[0] >= 0) {
        ans += a[0];
    } else {
        ans += b[0];
    }
    

    cout << ans << endl;
}



Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//入力
#define in(N) cin >> N
#define in2(N,M) in(N) >> M
#define in3(N,M,K) in2(N,M) >> K
#define in4(N,M,K,L) in3(N,M,K) >> L
//出力
#define out(ans) cout << (ans) << endl
#define out2(a,b) cout << (a) << " " << (b) << endl
#define out3(a,b,c) cout << (a) << " " << (b) << " " << (c) << endl
#define outf(ans) cout << fixed << setprecision(6) << (ans) << endl

#define rep(i,n) for(int i=0; i<n; i++) //n回ループ
#define all(v) v.begin(), v.end() //vectorの全体を指定
#define sort_g(A,T) sort(all(A),greater<T>()) //降順ソート

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vstr;
const ll mod=1e9+7;

int main(){
	ll A,B,N;
	in3(A,B,N);

	ll ans;
	ll x=B-1;
	if(x <= N){
		ans = (ll)(A*x/B) + A * (ll)(x/B);
	}else{
		while(x>N){
			x -= B;
		}
		if(x>=0){
			ans = (ll)(A*x/B) + A * (ll)(x/B);
		}else{
			x = N;
			ans = (ll)(A*x/B) + A * (ll)(x/B);
		}
	}

	out(ans);
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
        cin >> a[i];
    int min = *std::min_element(a.begin(), a.end());
    int max = *std::max_element(a.begin(), a.end());
    printf("%d\n", max - min);
}

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




int main() {
	//freopen("data_in.txt", "r",stdin);
	
	LL a, b, c;
	cin >> a >> b >> c;
	if (a + b >= c) {
		cout << "No" << endl;
	}
	else {
		if(4 * a * b < (c - a - b)* (c - a - b))
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
H, W = [int(_) for _ in input().split()]

S = ["."*(H+2)] + ["." + input() + "." for i in range(H)] + ["."*(H+2)]

for y in range(H):
    for x in range(W):
        c = S[y+1][x+1]
        if c != "#":
            c = str(sum([S[i][x:x+3].count("#") for i in range(y,y+3)]))
        print(c, sep="", end="")
    print()

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <vector>
#include <string.h>

#define REP(i, n) for(int i = 0;i < n;i++)
using namespace std;

string make_str(int y1, int x1, int y2, int x2){
    string s = "";
    s += to_string(y1+1);
    s += " ";
    s += to_string(x1+1);
    s += " ";
    s += to_string(y2+1);
    s += " ";
    s += to_string(x2+1);
    return s;
}

int a[500][500];
int main(){
    int H,W;
    cin >> H >> W;
    REP(i,H)
        REP(k,W)
            cin >> a[i][k];

    int N = 0;
    vector<string> str;
    REP(i,H){
        REP(k,W){
            if(a[i][k] % 2 == 0) continue;
            //else if(k < W-1 && a[i][k+1] % 2 == 1){
            else if(k < W-1){
                a[i][k]--;
                a[i][k+1]++;
                string s = make_str(i,k,i,k+1);
                //cout << s << endl;
                str.push_back(s);
                N++;
            }
            else if(k == W-1 && i < H-1){
                a[i][k]--;
                a[i+1][k]++;
                string s = make_str(i,k,i+1,k);
                //cout << s << endl;
                str.push_back(s);
                N++;
            }
        }
    }

    cout << N << endl;
    REP(i,N)
        cout << str[i] << endl;
    return 0;
}


Measured memory_bytes: 11892
def fact(n):
    res = 1
    for i in range(1, n+1):
        res *= i
    return res

def combination(n, k):
    return fact(n)//fact(n-k)//fact(k)

n, m, r = list(map(int, input().split()))

print(combination(r - n*m + n - 1, n-1))

Measured memory_bytes: 6772
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class T> void print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec); } }
const int INF = 1e9;
const int MOD = 1e9+7;

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

	while (true) {
		int n, nmin, nmax; cin >> n >> nmin >> nmax;
		if (n+nmin+nmax==0) break;

		vector<int> vec(n);
		rep(i, n) cin >> vec[i];
		int difmax = 0;
		int ans;
		rep(i, n) {
			int dif = 0;
			if (i>=nmin && i<=nmax) dif = vec[i-1]-vec[i];
			if (dif>=difmax) {
				difmax = dif;
				ans = i;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

int main() {
    int n;
    cin >> n;
    char *s = new char[n];
    int rblack = 0, rwhite = 0, lblack = 0, lwhite = 0;
    char c = getchar();
    while (c < 32)
        c = getchar();
    for (int i = 0; i < n; ++i) {
        s[i] = c;
        if (s[i] == '.')
            ++rwhite;
        else
            ++rblack;
        c = getchar();
    }
    int result = rwhite;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '.')
            --rwhite, ++lwhite;
        else
            --rblack, ++lblack;
        result = min(result, rwhite + lblack);
    }
    cout << result << endl;
    return 0;    
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i = a; i < (int) b; i++)
#define F0R(i, a) FOR (i, 0, a)
#define ROF(i, a, b) for(int i = a; i >= (int) b; i--)
#define R0F(i, a) ROF(i, a, 0)
#define GO(i, a) for (auto i : a)
 
#define rsz resize
#define eb emplace_back
#define pb push_back
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define f first
#define s second
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

bool is_prime (int n) {
  if (n <= 1) return 0;
  if (n == 2) return 1;
  if ((n % 2) == 0) return 0;
  for (int i = 3; i * i <= n; i += 2) {
    if ((n % i) == 0) return false;
  }
  return 1;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  while (!is_prime(n)) ++n;
  cout << n << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,m,count,b;
  	long long c;
    long long ans = 0;
  	count = 0;
    cin >> n>>m;
    vector<pair<long long,int>> card(n+m);
    for (int i=0;i<n;i++){
        cin >> c;
        card.at(i) = make_pair(c,1);
    }
    for (int i=n;i<n+m;i++){
        cin >> b>>c;
        card.at(i) = make_pair(c,b);
    }
    sort(card.begin(), card.end());
    reverse(card.begin(), card.end());
    for (int i = 0;count <n;i++){
        if (n-count-card.at(i).second > 0){
            ans +=card.at(i).first * card.at(i).second;
        }
        else {
            ans +=card.at(i).first * (n-count); 
        }
        
        count += card.at(i).second;

    }

    cout << ans<<endl;


}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())

int main() {
    int n;
    cin >> n;
    ll a[n], b[n];
    rep(i, n) cin >> a[i] >> b[i];
    
    ll sum = 0;
    for (int i = n - 1; i >= 0; --i) {
        sum += (b[i] - (a[i] + sum) % b[i]) % b[i];
    }
    
    out(sum);
}


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

int main() {
  int N;
  scanf("%d", &N);
  int V[N],C[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &V[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &C[i]);
  }

  int count = 0;

  for (int i = 0; i < N; ++i) {
    if(V[i]-C[i]>0){
      count += V[i] - C[i];
    }
  }

  cout << count << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define ld long double 
#define float long double 
#define ll long long
#define int long long
#define vl vector<ll> 
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define endl '\n'
#define cnl cout<<endl;
#define pi  3.141592653589793238
#define ms(x,v) ((x), v, sizeof((x)))
#define MAXN 100009
#define CASET int ___T; scanf("%lld", &___T); for(int cs=1; cs <= ___T; cs++)
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
const int N = 200 * 1000 + 9;
const int  inf = 1e18;
const int mod=1e9+7;
int i,j,k;
void solve(){
int n, b, r; cin >> n >> b >> r; 
   int sum  = 0;
   int bl = 0;
   i = 1;
  int no = (n/(b+r));
  int rem = n % (b+r);
  cout << (no*b + min(rem, b)) << endl;


 return ;
}
    signed main(){
    
    //CASET
    solve();
    
   
    return 0;
  }

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

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

int N, X;
int L[123];

int main() {

	scanf("%d%d", &N, &X);
	rep(i, N) scanf("%d", &L[i]);

	int c = 0;
	rep(i, N) {
		c += L[i];
		if (c > X) {
			printf("%d\n", i + 1);

			return 0;
		}
	}

	printf("%d\n", N+1);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n, m, x, i, j, ai=0;
  int a[110];

  scanf("%d %d %d",&n, &m, &x);
  for(i=0;i<m;i++){
    scanf("%d", &a[i]);
  }

  for(j=0;x>a[j];j++){
    if(a[j]<x){
      //printf("%d\n", a[j]);
      ai++;
    }
  }

  //printf("%d\n", ai);

  if(ai < m/2){
    printf("%d\n", ai);
  }else{
    printf("%d\n", m-ai);
  }

  return 0;
}

Measured memory_bytes: 128
s = input()
firstHalf = s[:2]
secondHalf = s[2:]
val1 = 0
val2 = 0
if firstHalf[0] == '0':
    val1 = int(firstHalf[1])
else:
    val1 = int(firstHalf)
if secondHalf[0] == '0':
    val2 = int(secondHalf[1])
else:
    val2 = int(secondHalf)
first = False
second = False
if val1 <= 12 and val1 > 0:
    first = True
if val2 <= 12 and val2 > 0:
    second = True
if first and second:
    print("AMBIGUOUS")
elif first:
    print("MMYY")
elif second:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	cin.ignore();
	string s;
	cin>>s;
	int i=s.size()-1;
	int A[16],conta=0;
	while(i>=0){
		int a,b,c;
		a=s[i];b=s[i-1];c=s[i-2];
		if(a==67 && b==66 && c==65){
			A[conta]=i-1;
			i=i-2;
			conta++;
		}
		i--;
	}
	cout<<conta<<endl;
	
}

Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

#define ifr(i,n) for(int i=(n)-1;i>=0;--i)

signed main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    unordered_map<int, int> B(N);

    vector<int> a(N);
    for(auto&i:a) cin>>i;
    unordered_map<int,int> mp;
    ll ans{};
    ifr(i,N){
        ans+=mp[a[i]+i];
        mp[i-a[i]]++;
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 21708
#include <algorithm>
#include <iostream>
#include <vector>

const int V_MAX = 100'000;

// リストに最も多く出現した値（の一つ）を返す
int mode(const std::vector<int> &list) {
	// XXX: 命名
	std::vector<int> num(V_MAX + 1, 0);
	for(const auto &n : list) {
		num[n]++;
	}
	const auto maxItr = std::max_element(num.begin(), num.end());
	return std::distance(num.begin(), maxItr);
}

// リストに2番目に多く出現した値（の一つ）を返す
// ※　modeと同じ頻度の場合もある
int secondMode(const std::vector<int> &list) {
	const int most = mode(list);
	// XXX: かぶってます
	std::vector<int> num(V_MAX + 1, 0);
	for(const auto &n : list) {
		if(n != most) {
			num[n]++;
		}
	}
	const auto maxItr = std::max_element(num.begin(), num.end());
	return std::distance(num.begin(), maxItr);
}

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

	std::vector<int> a;
	std::vector<int> b;

	for(int i = 0; i < n; i++) {
		int v;
		std::cin >> v;
		if(i % 2 == 0) {
			a.emplace_back(v);
		} else {
			b.emplace_back(v);
		}
	}

	int answer = 0;

	// 最頻値？
	const int modeA = mode(a);
	const int modeB = mode(b);
	const int numModeA = std::count(a.begin(), a.end(), modeA);
	const int numModeB = std::count(b.begin(), b.end(), modeB);
	
	if(modeA == modeB) {
		const int secondModeA = secondMode(a);
		const int secondModeB = secondMode(b);
		const int numSecondModeA = std::count(a.begin(), a.end(), secondModeA);
		const int numSecondModeB = std::count(b.begin(), b.end(), secondModeB);
		// 偶数だからできる（多分）
		// 多いほうを採用
		if(numSecondModeA >= numSecondModeB) {
			answer += a.size() - numSecondModeA;
			answer += b.size() - numModeB;
		} else {
			answer += b.size() - numSecondModeB;
			answer += a.size() - numModeA;
		}
	} else {
		answer += a.size() - numModeA;
		answer += b.size() - numModeB;
	}

	std::cout << answer << std::endl;

	return 0;
}

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

using Graph = vector<vector<int>>;
vector<int> p;
int Fennec;
int Snuke = 0;
void dfs(int node, Graph &g, int type) {
  if(type) Snuke++;
  for(auto& el : g[node]) {
    if(el == p[node]) continue;
    p[el] = node;
    dfs(el, g, type);
  }
}

int main() {
  int n;
  cin >> n;
  Graph g(n);
  p.resize(n, -1);
  for(int i=0;i<n-1;i++) {
    int a, b;
    cin >> a >> b;
    a--;b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  dfs(0, g, 0);
  vector<int> path;
  path.emplace_back(n-1);
  while(p[path.back()] != -1) {
    path.emplace_back(p[path.back()]);
  }
  int target = path[path.size()/2-1];
  dfs(target, g, 1);
  Fennec = n - Snuke;
  if(Fennec > Snuke) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;
  return 0;
}


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

int main() {
  string S, T;
  cin >> S >> T;
  
  int len_diff;
  len_diff = T.length() - S.length();
  
  string sub;
  sub = T.substr(0, T.length()-1);
  
  if (len_diff == 1 && S == sub) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,ans,tmp,hoge,fuga,piyo,sum;
ll A[200100],B[200100],C[200100],D[200100];
string st,str;
char ch;
int main(){
  cin>>a;
  cout<<a*(a*(a+1)+1);
  return 0;
}

Measured memory_bytes: 3616
a,b = map(int,input().split())

if a > 0:
    print("Positive")
elif b < 0 and (b-a+1)%2 == 1:
    print("Negative")
elif b < 0 and (b-a+1)%2 == 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")

Measured memory_bytes: 3060
# include <bits/stdc++.h>
using namespace std;
int k,a,b; 
int main(){
	cin>>k>>a>>b;
	if(a%k==0||b%k==0) return puts("OK"),0;
	int t1=a/k,t2=b/k;
	if(t1<t2) puts("OK");
	else puts("NG");
	return 0;
}

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

int main() 
{
    int N;
    cin >> N;
    
    while (N) {
        if (N % 10 == 9) {
            cout << "Yes" << endl;
            return 0;
        }
        N /= 10;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3592
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let (n,k) = {
        let h:Vec<usize> = get_input().split_whitespace().map(|x| x.parse().unwrap()).collect();
        (h[0], h[1])
    };
    let h:Vec<i64> = get_input().split_whitespace().map(|x| x.parse().unwrap()).collect();

    let mut dp = [0; 100010];
    dp[1] = i64::abs(h[0] - h[1]);

    for i in 2..n {
        let mut j:Vec<i64> = Vec::new();
        for l in 1..k+1 {
            if l > i {
                break;
            }
            j.push(dp[i - l] + i64::abs(h[i] - h[i - l]));
        }
        dp[i] = j.into_iter().min().unwrap();
    }

    println!("{}", dp[n-1]);

}


Measured memory_bytes: 7164
N = int(input())
s = input()

l = [0]*N
r = [0]*N

for i in range(1,N):
	l[i] = l[i-1]+(s[i-1]=='W')
for i in range(N-1)[::-1]:
	r[i] = r[i+1]+(s[i+1]=='E')

ans = 10**6
for a,b in zip(l,r):
	ans = min(a+b, ans)

print(ans)

Measured memory_bytes: 27040
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<P, int> PP;
int main() {
	int n; ll L; cin >> n >> L;
	ll a[100000];
	rep(i, n) {
		cin >> a[i];
	}
	int chk = -1;
	rep(i, n - 1) {
		if (a[i] + a[i + 1] >= L) {
			chk = i; break;
		}
	}
	if (chk == -1)cout << "Impossible" << endl;
	else {
		cout << "Possible" << endl;
		rep(i, chk) {
			cout << i + 1 << endl;
		}
		for (int i = n - 2; i > chk; i--) {
			cout << i + 1 << endl;
		}
		cout << chk + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	std::string str;
	std::cin >> str;
	int ans = 0;
	std::string wtf;
	std::string cur;
	for(char cc : str) {
		cur += cc;
		if(cur != wtf) {
			cur.swap(wtf);
			cur.clear();
			ans++;
		}
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n, i, j, k, ans=0;
    cin >> n;
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            for(k=1;k<=n;k++){
                ans+=gcd(gcd(i, j), k);

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

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

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)

#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
// #define LREP(i,n) LFOR(i,0,(ll)(n)-1)
// #define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;



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

  string s;
  
  char a,b; //頭と尾
  cin >> s;
  ll k, ans=0;
  cin >> k;
  a = s[0];
  b = s[s.length()-1];
  int q=1,qa=0,qb=0,i=0;
  bool one=true;
  while(++i<s.length()){
    if(s[i-1]==s[i])  q++;
    else{
      one = false;
      if(!qa) qa=q;
      else ans += q/2;
      q = 1;
    }
  }
  if(one) ans = (k*s.length())/2;
  else{
  ans *= k;
  qb = q;
  if(a==b) ans += ((qa+qb)/2)*(k-1) + qa/2 + qb/2;
  else ans += (qa/2+qb/2)*k;
  }
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  deque<int> b;
  rep(i,n){
    if(n%2 == (i+1)%2){
      b.push_front(a[i]);
    }else{
      b.push_back(a[i]);
    }
  }
  rep(i,n){
    cout<<b[i];
    if(i!=n-1)cout<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 3840
import sys
def input(): return sys.stdin.readline().strip()

S  = lambda: input()

s = S()
t = S()

count = 0
loop = -1
s_index = 0
t_index = 0
is_ok = True
while True:
  loop += 1
  s_index = 0
  if t[t_index] not in s:
    is_ok = False
    break

  while t[t_index] in s[s_index:]:
    s_index += s[s_index:].find(t[t_index]) + 1
    t_index += 1
    if t_index == len(t):
      break
  
  if t_index == len(t):
      break

if is_ok:
  print(loop * len(s) + s_index)
else:
  print(-1)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
void Yes(bool cnd){
    if(cnd)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a;
        cin>>a;
        n-=a;
    }
    if(n>=0)cout<<n<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }
 
    void solve (){
        int n,m,c;
        cin>>n>>m>>c;
        vector<int>b(m);
        for(int i=0;i<m;i++)
            cin>>b[i];
        vector<vector<int>>a(n,vector<int>(m));
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++)
                cin>>a[i][j];
        }
        int correct=0;
        for(int i=0;i<n;i++){
            int total=0;
            for(int j=0;j<m;j++){
                total+=a[i][j]*b[j];
            }
            total+=c;
            if(total>0)
                correct++;
        }
        cout<<correct;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

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

int main() {
    int N;
    cin >> N;
    
    set<int> S;
    rep(i, 100) rep(j, 100) S.insert(4 * i + 7 * j);
    if (S.count(N)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, m; scanf("%d%d", &n, &m);
	std::vector<int> a(m), b(m);
	for(int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
	}
	
	int ans = -1;
	for(int i = 0; i < 1000; i++) {
		std::string s = std::to_string(i);
		if(s.size() != n) continue;
		
		bool tmp = true;
		for(int j = 0; j < m; j++) {
			if(s[a[j]] == (char)(b[j] + '0')) continue;
			tmp = false;
		}
		if(!tmp) continue;
		
		ans = i;
		break;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main()
{
	for(;;){
		char todoset[2][51];
		int n, m;
		bool flg = 0;
		
		cin >> n;
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < n; i++){
			cin >> todoset[0][i];
			cin >> todoset[1][i];
		}
		
		cin >> m;
		vector<char> str(m);
		for(int i = 0; i < m; i++){
			cin >> str[i];
		}
		
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++){
				if(str[i] == todoset[0][j]){
					cout << todoset[1][j];
					flg = 1;
					break;
				}
			}
			if(flg != 1){
				cout << str[i];
			}
			flg = 0;
		}
		cout << endl;
	}
}

Measured memory_bytes: 992
from collections import deque
s = input()
q = int(input())
tmp = deque()
for i in range(len(s)):
    tmp.append(s[i])
flag = 0
for _ in range(q):
    _s = input()
    if _s == "1":
        flag += 1
    else:
        t, f, c = _s.split(" ")
        r = flag % 2
        if f == "1" and r == 0:
            #tmp = c + tmp
            tmp.appendleft(c)
        elif f == "1" and r == 1:
            #tmp = tmp + c
            tmp.append(c)
        elif f == "2" and r == 0:
            #tmp = tmp + c
            tmp.append(c)
        elif f == "2" and r == 1:
            #tmp = c + tmp
            tmp.appendleft(c)
if flag % 2 == 0:
    for i in range(len(tmp)):
        print(tmp.popleft(), end="")
else:
    for i in range(len(tmp)):
        print(tmp.pop(), end="")
        

Measured memory_bytes: 7796
N = input()
a = map(int, raw_input().split())

kinds = [0 for i in range(8)]
wild = 0
for v in a:
    if v < 400: kinds[0]= 1
    elif v < 800: kinds[1]= 1
    elif v < 1200: kinds[2]= 1
    elif v < 1600: kinds[3]= 1
    elif v < 2000: kinds[4]= 1
    elif v < 2400: kinds[5]= 1
    elif v < 2800: kinds[6]= 1
    elif v < 3200: kinds[7]= 1
    else:
        wild += 1

mn = sum(kinds)
if mn == 0:
    mn = 1
    mx = wild
else:
    mx = mn + wild
print mn,mx

Measured memory_bytes: 2692
// Ref: https://www.youtube.com/watch?v=UHfTqvaD0pk

package main

import "fmt"

func isEven(n int) bool { return n%2 == 0 }
func isOdd(n int) bool  { return n%2 != 0 }

func rec(a, b, c int) int {
	if isOdd(a) || isOdd(b) || isOdd(c) {
		return 0
	}
	return rec((b+c)/2, (c+a)/2, (a+b)/2) + 1
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	if isEven(a) && a == b && b == c {
		fmt.Println(-1)
		return
	}

	ans := rec(a, b, c)
	fmt.Println(ans)
}


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


int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);

    int p;
   if(a>b)
    p=a-b-1;
   else
    p=b-a-1;

    if(p%2==1)
        printf("Alice");
    else
        printf("Borys");

}






Measured memory_bytes: 1700
using System;


	public class Bubble
	{
		public static void Main(string[] args)
		{
			int count=int.Parse(Console.ReadLine());			
			string data=Console.ReadLine();
			string[] num=data.Split();
			int[] target=new int[count];
			int temp;
			int sortCount=0;//?????????????????°???
			for(int d=0;d<num.Length;d++)
			{
				target[d]=int.Parse(num[d]);
			}
			
			for(int i=0;i<count-1;i++)
			{
				for(int j=count-1;j>i;j--)
				{
					if(target[j]<target[j-1])
					{
						temp=target[j-1];
						target[j-1]=target[j];
						target[j]=temp;
						sortCount++;
					}
				}				
			}
			Console.Write(target[0]);
			for(int k=1;k<target.Length;k++)
			{
				Console.Write(" "+target[k]);
			}
			Console.Write("\r\n");
			Console.WriteLine(sortCount);
		}
	}

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

N = int(input())

B = list(map(int, input().split()))

A = [0]*N

A[0] = B[0]
for i in range(1, N-1):
    A[i] = min(B[i-1], B[i])

A[N-1] = B[N-2]

print(sum(A))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  string s, t; cin >> s >> t;
  int n = s.size();
  vector<int> cnt1(26), cnt2(26);
  rep(i, n) {
    cnt1.at(s.at(i) - 'a')++;
    cnt2.at(t.at(i) - 'a')++;
  }

  rep(i, n) {
    if (cnt1.at(s.at(i) - 'a') != cnt2.at(t.at(i) - 'a')) {
      cout << "No" << endl;
      return 0;
    }
  }


  sort(cnt1.begin(), cnt1.end());
  sort(cnt2.begin(), cnt2.end());

  if (cnt1 == cnt2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i, N)
  {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  int current = 101, ans = 0;
  rep(i, N)
  {
    if (current == d.at(i))
      continue;

    current = d.at(i);
    ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};

ll n,m;
string s[55],t[55];

bool ok(ll x,ll y) {
	rep(i,m) rep(j,m) if(s[i+x][j+y]!=t[i][j]) return false;
	return true;
	
}

int main(){
    cin >> n >> m;
	rep(i,n) cin >> s[i];
	rep(i,m) cin >> t[i];
	rep(i,n-m+1) rep(j,n-m+1) if(ok(i,j)) {
		puts("Yes");
		return 0;
	}
	puts("No");
	return 0;
}  


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

public class Main{
	public int findMaxHappiness(int[][]a, int n) {
        int[][]dp = new int[n][3];
        for(int i=0;i<3;++i) {
            dp[0][i]=a[0][i];
        }
        for(int i=1;i<n;++i) {
            for(int j=0;j<3;++j) {
                dp[i][j]=a[i][j]+Math.max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
            }
        }
        return Math.max(dp[n-1][0],Math.max(dp[n-1][1],dp[n-1][2]));
    }

    public static void main(String[] args) {
        InputStreamReader r=new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(r);
        String input = null;
        try {
            input=reader.readLine();
            int n = Integer.parseInt(input);
            int[][] a = new int[n][3];
            for(int i=0;i<n;++i) {
                String[] row = reader.readLine().split(" ");
                for(int j=0;j<3;++j) {
                    a[i][j]=Integer.parseInt(row[j]);
                }
            }
            Main c = new Main();
            System.out.println(c.findMaxHappiness(a,n));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 51672
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int H,W,i,j,k;
	for(k;;k++){	
	
	cin >> H >> W;	
		if(H==0 && W==0){
			break;
		}
		else{
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if(i==1 || i==H){
					cout << "#";
				}
				else if( j==1 || j==W){
					cout << "#" ;
				}
				else{
					cout << "." ;
				}
			}
			cout << endl;
		}
	
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
import math
N,M= map(int, input().split())
 
answer = 1
list = []
for i in range(1,math.floor(M**(1/2))+1):
    if M % i == 0 and int(M/i) >= N:
        answer = i
        list.append(int(M/i))
 
 
for k in list:
    if M/k >= N:
        answer = k
        break
 
print(answer)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
    int n, m,ans =0;cin >> n >> m;
    for (int i = n;i <= m;i++) {
        if (i / 10000 == i % 10) {
            int a =i - (i / 10000) * 10000 - (i % 1000);
            int b = i - (i / 100) * 100 - (i % 10);
            if (a / 1000 == b / 10)
                ans++;
        }
    }
    cout << ans << endl;
 }

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;



void solve()
{
    int a[] = { 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 };
    int i;
    scanf("%d", &i);
    printf("%d\n", a[i - 1]);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> S(N+1);
  S.at(0) = 0;
  for(int i=0;i<N;i++){
    cin >> A.at(i); 
    S.at(i+1) = S.at(i) + A.at(i);
  }
  map<long long, long long> cnt;
  for(int i=0;i<N+1;i++){
    cnt[S.at(i)] ++;
  }
  long long res=0;
  for(auto p : cnt){
    long long num = p.second;
    res += num * (num - 1) / 2;
  }
 
  cout << res << endl;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


string S;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    S[3] = '8';
    cout << S << endl;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    REP(i, n) cin >> l[i];

    sort(all(l), greater<int>());
    int ans = 0;
    REP(i, k) ans += l[i];
    cout << ans << endl;
}


Measured memory_bytes: 256
N,n,v,w,i,m,*p;s(){scanf("%d,%d",&v,&w);}main(W){for(s();W=v;){int c[1001]={0};for(s(),n=v;s(p=c),n--;)for(m=i=W+1;i--;m-=*p++==*c)i<w||*p<p[w]+v&&(*p=p[w]+v);printf("Case %d:\n%d\n%d\n",++N,*c,m);}return 0;}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<unordered_map>

using namespace std;

typedef long long LL;

int n, k;

int main()
{
    scanf("%d%d", &n, &k);
    
    int x = 1;
    while(n --)
    {
        if(x * 2 < x + k)  x *= 2;
        else  x += k;
    }
    printf("%d", x);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  i64 H, W, N;
  cin >> H >> W >> N;
  i64 a = std::max(H, W);
  cout << (N + a - 1) / a << endl;
}


Measured memory_bytes: 256
def examA():
    N = SI()
    ans = "No"
    for s in N:
        if s=="7":
            ans = "Yes"
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 9980
import math

def plot(x,y):
    print(f'{x:8f} {y:8f}')
    
def Koch(n, x1,y1,x2,y2):
    if n == 0:
        plot(x1,y1)
        return
    sx = (2*x1+x2) / 3
    sy = (2*y1+y2) / 3
    tx = (x1+2*x2) / 3
    ty = (y1+2*y2) / 3
    ux = (tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
    uy = (tx-sx)*(math.sqrt(3)/2)+(ty-sy)*(1/2)+sy
    Koch(n-1, x1,y1,sx,sy)
    Koch(n-1, sx,sy,ux,uy)
    Koch(n-1, ux,uy,tx,ty)
    Koch(n-1, tx,ty,x2,y2)

n=int(input())    
Koch(n, 0,0, 100,0)
plot(100,0)


Measured memory_bytes: 5772
#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() {
  int s, w;
  cin >> s >> w;
  if (s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}

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

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  int T[N][N];
  int S[N+1][N+1];
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      T[i][j]=0;
    }
  }
  for(int i=0; i<N+1; i++){
    for(int j=0; j<N+1; j++){
      S[i][j]=0;
    }
  }
  for(int i=0; i<M; i++){
    int L, R;
    cin >> L >> R;
    T[L-1][R-1]++;
  }
  for(int i=1; i<N+1; i++){
    for(int j=1; j<N+1; j++){
      if(j==0) S[i][j]=T[i-1][j-1];
      else S[i][j]=T[i-1][j-1]+S[i][j-1];
    }
  }
  for(int i=1; i<N+1; i++){
    for(int j=2; j<N+1; j++){
      S[j][i]=S[j-1][i]+S[j][i];
    }
  }
  vector<int> p(Q);
  vector<int> q(Q);
  for(int i=0; i<Q; i++){
    cin >> p.at(i) >> q.at(i);
  }
  for(int i=0; i<Q; i++){
    int ans=S[q.at(i)][q.at(i)]-S[p.at(i)-1][q.at(i)];
    cout << ans << endl;
  }
}

Measured memory_bytes: 3712