akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
using namespace std;
int N;
int D[101],d[101][101];
void bfs(int src){
    int u,k,a;
    bool visit[101];
    for(int i=1;i<=N;++i){
        cin>>u>>k;
        for(int j=0;j<k;++j){
            cin>>a;
            d[u][a]=1;
        }
        visit[i]=true;
    }
    queue<int>Q;
    Q.push(src);
    D[src]=0;
    visit[src]=false;
    while(!Q.empty()){
        int cur=Q.front();
        Q.pop();
        for(int i=1;i<=N;++i){
            if(d[cur][i]==1&&visit[i]){
                visit[cur]=false;
                visit[i]=false;
                D[i]=D[cur]+1;
                Q.push(i);
            }
        }
    }
    for(int i=1;i<=N;++i){
        if(i!=1&&D[i]==0){
            D[i]=-1;
        }
        cout<<i<<" "<<D[i]<<endl;
    }
}
int main(){
    cin>>N;
    int start=1;
    bfs(start);
}

Measured memory_bytes: 3080
#include <iostream>
using namespace std;
int main(){
	int a[5],j,i;
	while(cin>>a[0],a[0]){
		j=0;
		if(!(j & 1<<a[0]))j+=1<<a[0];
		for(i=1;i<5;i++){
			cin>>a[i];
			if(!(j & 1<<a[i]))j+=1<<a[i];
		}
		if(j==14||j==2||j==4||j==8)for(int i=0;i<5;i++)cout<<'3'<<endl;
		else{
			for(int i=0;i<5;i++){
				if(j==10)cout<< ((j-(1<<a[i]))>(1<<a[i])?'2':'1') << endl;
				else cout<< ((j-(1<<a[i]))>(1<<a[i])?'1':'2') << endl;
			}
		}
	}
}

Measured memory_bytes: 1152
import Control.Monad
import Data.List
import Data.Vector.Unboxed (Vector,(!))
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as B

main = do
  [_,q] <- readIntsLn
  s <- getLine
  let c = solve s
  qs <- replicateM q readIntsLn
  forM_ qs $ \[l,r] -> print (c!r - c!l)
  
solve :: String -> Vector Int
solve = U.fromList . f 0 where
  f a [] = [a]
  f a ('A':'C':s) = a : a : f (a+1) s
  f a (c:s) = a : f a s

readIntsLn
  = unfoldr (B.readInt . B.dropWhile(==' ')) <$> B.getLine

Measured memory_bytes: 34044
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int32_t H;
    cin >> H;

    vector<int32_t> heap(H);
    for (int32_t i = 0; i < H; i++) {
        cin >> heap[i];
    }

    for (int32_t i = 0; i < H; i++) {
        cout << "node " << (i+1) << ": ";
        cout << "key = " << heap[i] << ", ";
        if (ceil(i/2.0)-1 >= 0) cout << "parent key = " << heap[ceil(i/2.0)-1] << ", ";
        if (2*i+1 < H) cout << "left key = " << heap[2*i+1] << ", ";
        if (2*i+2 < H) cout << "right key = " << heap[2*i+2] << ", ";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3100
#include<cstdio>
#include<climits>
#include<iostream>
#define MAX 100000
using namespace std;

struct Card{ char s; int num;};
Card L[MAX/2 + 2], R[MAX/2 + 2];

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

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

void Merge(Card C[], int left, int mid, int right)
{
  int n1, n2;
  n1 = mid - left;
  n2 = right - mid;
  for(int i=0; i<n1; i++)
  {
    L[i] = C[left+i];
  }
  for(int i=0; i<n2; i++)
  {
    R[i] = C[mid+i];
  }
  L[n1].num = R[n2].num = INT_MAX;
  int i, j;
  i = j = 0;
  for(int k = 0; k < right-left; k++)
  {
    if(L[i].num <= R[j].num)
    {
      C[left+k] = L[i];
      i++;
    }
    else
    {
      C[left+k] = R[j];
      j++;
    }
  }
}

void MergeSort(Card C[], int left, int right)
{
  if(left < right - 1)
  {
    int mid = (left + right) / 2;
    MergeSort(C, left, mid);
    MergeSort(C, mid, right);
    Merge(C, left, mid, right);
  }
}
int main()
{
  struct Card A[MAX], B[MAX];
  int n;
  scanf("%d", &n);
  char s; int v;
  for(int i=0; i<n; i++)
  {
    getchar();
    scanf("%c %d", &s, &v);
    B[i].s = A[i].s = s;
    B[i].num = A[i].num = v;
  }
  MergeSort(B, 0, n);
  quickSort(A,0, n-1);
  int flag = 1;
  for(int i=0; i<n; i++)
  {
    if(B[i].s != A[i].s)
      flag = 0;
  }
  if(flag) printf("Stable\n");
  else printf("Not stable\n");
  for(int i=0; i<n; i++)
  {
    printf("%c %d\n", A[i].s, A[i].num);
  }

  return 0;
}



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

int main()
{
	int N;
	std::cin >> N;
	std::pair<int,int>* A = new std::pair<int,int>[N+1];
	for (int i=1; i<=N; i++) {
		std::cin >> A[i].first;
		A[i].second = i;
	}
	std::sort(A+1, A+N+1);
	for (int i=1; i<=N; i++) std::cout << A[i].second << " ";
	std::cout << std::endl;
	delete[] A;
	return 0;
}


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

string g; int y, m, d;

int main() {
	while (cin >> g) {
		if (g == "#") break;
		cin >> y >> m >> d;
		if (y >= 32 || (y == 31 && m >= 5)) {
			g = "?";
			y -= 30;
		}
		cout << g << " " << y << " " << m << " " << d << endl;
	}
	return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<utility>
#include<functional>
#include<iomanip>
#include<sstream>
#include<ctime>
#include<cassert>

using namespace std;

int main(int argc, char ** argv) {
	int N = 0;
	vector <int> *ptrV = new vector<int>();
	cin >> N;
	while (N--) {
		int tmp = 0;
		cin >> tmp;
		ptrV->push_back(tmp);
	}

	int cnt = 0;
	int sizeV = ptrV->size();
	for (int i = 0; i < sizeV; ++i)
	{
		int num = ptrV->at(i);
		if (num == -1) continue;
		if (ptrV->at(num - 1) == i + 1) {
			ptrV->at(num - 1) = -1;
			cnt++;
		}
		ptrV->at(i) = -1;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
using namespace std;

vector<int> V;
int N, M;
int main(){
    cin >> N >> M;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        sum += x;
        V.push_back(x);
    }

    sort(V.begin(), V.end());
    reverse(V.begin(), V.end());
    int k = 0;

    double threshold = sum * ( 1.0 / (4 * M));
    for (int i = 0; i < N; i++) {
        if (V[i] >= threshold ) k++;
    }
    if (k >= M) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    
    return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;




int dp[maxn][2];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    int n;
    string s;
    cin>>n>>s;
    vector<int> a(n,0);
    for (int i=0; i<n; i++) {
	if (s[i]=='#') a[i]=1;
    }

    dp[0][a[0]^1]++;

    for (int i=1; i<n; i++) {
	dp[i][a[i]^1]++;
	dp[i][1] += min(dp[i-1][0],dp[i-1][1]);
	dp[i][0] += dp[i-1][0];
    }

    cout<<min(dp[n-1][0],dp[n-1][1])<<endl;
    
    
    return 0;
}


Measured memory_bytes: 5992
#include <stdio.h>

int main() {
	char num[10];
	scanf("%s", num);
	//987
	//num[0] = '9'; num[1] = '8'; num[2] = '7';
	if (num[0] == '7' || num[1] == '7' || num[2] == '7') {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     pi        acos(-1)
#define     ll        long long int
#define     fopen     freopen("in.txt","r",stdin)
#define     fwrite    freopen("o.txt","w",stdout)
#define     f0(n)     for(int i=0;i<n;i++)
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))
#define     gcd(a,b)  __gcd(int a,int b)

int main()
{
    __

    int n,m,X,y;
    cin>>n>>m>>X>>y;
    int a[n],b[m];
    f0(n) cin>>a[i];
    f0(m) cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    if(b[0]>a[n-1] && b[0]>X && b[0]<=y) cout<<"No War";
    else cout<<"War";


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }
 
    // 素数である
    return 1;
}


 
int main(){
   string s;
   lint K;
   cin>>s>>K;
   rep(i,s.size()){
       lint h;
        if(i==(s.size()-1)){
           h=s[i]-'a';
           
           s[i]='a'+(h+K)%26;
           break;
       }
       if(s[i]=='a')continue;
       h='z'-s[i]+1;
       if(K>=h){s[i]='a';
       K-=h;}
   }
   cout<<s;
}

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

int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	   if(s[i]!=t[i])
	   {
	     cout<<"No";
	     return 0;
	   }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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>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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,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;}

int main(){
  ll ans=0,cnt=0;
  string S;
  cin>>S;
  
  for(int i=0; i<S.size(); ++i){
    if(S[i]=='W'){
      ans+=i;
      cnt++;
    }
  }
  
  co(ans-cnt*(cnt-1)/2);
  return 0;
}

Measured memory_bytes: 640
n=int(input())
l=sorted(map(int,input().split()))
mod=10**9+7
if n%2==1:
	for i in range(n):
		if l[i]!=i+i%2:
			print(0)
			break
	else:
		print(pow(2,n//2,mod))
else:
	for i in range(n):
		if l[i]!=i+(i+1)%2:
			print(0)
			break
	else:
		print(pow(2,n//2,mod))


Measured memory_bytes: 14008
package main

import "fmt"

var count int

func main() {
	var inputNum, inputCount int
	var resultArr [50]int
	for {
		fmt.Scanf("%d", &inputNum)
		if inputCount == 50 {
			break
		}
		resultArr[inputCount] = calcA(inputNum)
		inputCount++
		count = 0
	}
	for _, v := range resultArr {
		fmt.Printf("%d\n", v)
	}
}

func calcA(input int) int {
	for i := 0; i <= 9; i++ {
		calcB(input, i)
	}
	return count
}

func calcB(input, a int) {
	for i := 0; i <= 9; i++ {
		calcC(input, a, i)
	}
}

func calcC(input, a, b int) {
	for i := 0; i <= 9; i++ {
		calcD(input, a, b, i)
	}
}

func calcD(input, a, b, c int) {
	for i := 0; i <= 9; i++ {
		if a+b+c+i == input {
			count++
		}
	}
}



Measured memory_bytes: 1136
a, b, h, m = gets.split.map(&:to_i)
pi = Math::PI
hx = a * Math.cos(2 * pi * ((h / 12.0) + (m / 720.0)));
hy = a * Math.sin(2 * pi * ((h / 12.0) + (m / 720.0)));
mx = b * Math.cos(2 * pi * (m / 60.0));
my = b * Math.sin(2 * pi * (m / 60.0));
puts ((hx - mx)**2 + (hy - my)**2)**(1/2.0)

Measured memory_bytes: 14844
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-5;
typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};

const int MAX_J = 5001;

int X,Y,Z;
int V[4];
int event[51];
int event_A[51];
double dp[51][MAX_J];

int main(){
    while(1){
        scanf("%d%d%d",&X,&Y,&Z);
        if(!X)break;

        for(int i=0;i<X;i++){
            scanf("%d",&V[i]);
        }
        fill(event,event+Y+1,0);
        for(int i=0;i<Z;i++){
            int N,E,A;
            scanf("%d%d%d",&N,&E,&A);
            event[N] = E;
            event_A[N] = A;
        }
        for(int i=0;i<Y+1;i++){
            for(int j=0;j<MAX_J;j++){
                dp[i][j] = 0;
            }
        }

        dp[0][0] = 1;
        for(int i=0;i<Y;i++){
            for(int j=0;j<MAX_J;j++){
                for(int k=0;k<X;k++){
                    int ni = min(Y, i+V[k]), nj = j;
                    if(event[ni] == 2) nj += event_A[ni];
                    else if(event[ni] == 3) nj = max(0, j-event_A[ni]);
                    else if(event[ni] == 1) ni = min(Y, ni + event_A[ni]);
                    dp[ni][nj] += dp[i][j] / X;
                }
            }
        }
        double ans = 0;
        for(int j=1;j<MAX_J;j++){
            ans += j*dp[Y][j];
        }
        printf("%d\n", (int)(ans+EPS));

        //break;
    }

    return 0;
}

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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

typedef pair<int, int> P;
const int N = 100005;
vector<int> g[N];
int nums[N];

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n, k;
	MEM(nums, -1);

	cin >> n;
	REPU(i, 1, n) {
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cin >> k;
	set<P> st;
	REPU(i, 0, k) {
		int v, p;
		cin >> v >> p;
		nums[v] = p;
		st.insert(P(p, v));
	}
	while (st.size() > 0) {
		auto p = *st.begin(); st.erase(st.begin());
		for (int v : g[p.second]) {
			if (nums[v] == -1) {
				nums[v] = p.first + 1;
				st.insert(P(nums[v], v));
			}
		}
	}
	REPU(i, 1, n + 1) {
		for (int u : g[i]) {
			if (abs(nums[u] - nums[i]) != 1) {
				puts("No"); return 0;
			}
		}
	}
	puts("Yes");
	REPU(i, 1, n + 1) printf("%d\n", nums[i]);

	return 0;
}


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

long long n;
vector<long long> c,v;

int main() {

    cin >> n;
    c.resize(n);
    v.resize(n);
    for(int i = 0;i < n; ++i )cin >> v[i];
    for(int i = 0;i < n; ++i )cin >> c[i];
    long long ans = 0;
    for(int i = 0;i < n;++i)ans += max(0LL,v[i] - c[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n,d;
int main(){
	cin >> n;
	for(int i = 1; i <= n; i ++){
		d = (d * 10 + 7) % n;
		if(d == 0){
			printf("%d\n",i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 3708
#include<iostream>
#include<string>
#include<cmath>
#include <stdexcept>
#include<algorithm>
using namespace std;

int main(){

	string S,st;
	int ans=99999999;

	int temp;
	cin >>S;

	for(int i=0; i<S.size()-2; i++){

		int a = S[i]-'0';
		int b = S[i+1]-'0';
		int c = S[i+2]-'0';

		int temp=a*100+b*10+c;

//cout << S.size()<< " " <<temp<<" " <<temp <<" " <<st<<endl;
		ans=min(ans,abs(temp-753));

	}
	cout << ans<<endl;
}

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

using namespace std;

int main(){
   string s;
   cin >> s;
   
   long long ans = 0;
   long long count = 0;
   
   for (int i = 0; i < s.size(); i++){
       if (s[i] == 'B') count++;
       else{
           ans += count;
       }
   }
   
   cout << ans << endl;
}

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

#define I cin
#define O cout
#define EN endl
#define ln cout<<endl
#define pb(a) push_back(a)

typedef long long int llint;

int i, j;
int a, b, c, d, e, f;
double m = 0;
int x, y;
int vmemo[3001];
int memo[3001][3001];

void dfs(int v);
int sugar(int v, int slim);

int main()
{
  I >> a >> b >> c >> d >> e >> f;
  a *= 100; b *= 100;

  memset(memo, -1, sizeof(memo));
  memset(vmemo, -1, sizeof(vmemo));
  for(i = 100; i <= 3000; i += 100) sugar(i, e * i / 100);
  
  dfs(a);
  dfs(b);

  O << x << ' ' << y << EN;
  
  return 0;
}

void dfs(int v)
{
  if(v > f || vmemo[v] != -1) return;

  vmemo[v] = 1;
  int s = memo[v][e * v / 100];

  double tmp = (double)100 * s / (v + s);
  if(m <= tmp) {
    m = tmp;
    x = v + s;
    y = s;
  }

  dfs(v + a);
  dfs(v + b);
}

int sugar(int v, int slim)
{
  if(v > f || slim < 0)   return -1000000000;
  if(memo[v][slim] != -1) return memo[v][slim];
  
  int rec = 0;

  rec = max(rec, max(sugar(v + c, slim - c) + c,
		     sugar(v + d, slim - d) + d));

  return memo[v][slim] = rec;
}


Measured memory_bytes: 35456
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		a, _ := strconv.ParseFloat(scanner.Text(), 64)
			t := a/9.8
			x := t*t*4.9
			ans := (x+5)/5+1
			fmt.Printf("%d\n", int(ans))
	}
}


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

using namespace std;
typedef long long ll;

const int N = 100'010;
int h[N];
vector<int> g[N];
bool bad[N];

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
    for (int i = 1; i <= m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (bad[i]) continue;
        bool res = true;
        for (auto to : g[i]) {
            if (h[to] >= h[i]) {
                res = false;
                break;
            }
        }
        if (res) {
            ans++;
            for (auto to : g[i]) bad[to] = 1;
        } else {
            bad[i] = 1;
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 9384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
map<string, ll> mp;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll ans = 0;
    while(n--) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ans += mp[s];
        mp[s]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11264
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		char[] C = S.toCharArray();

		int ans = 0;

		for(int i=0;i<S.length();i++) {

			int x = C[i]-48;
			ans = (ans + x)%9;

		}
		if(ans==0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

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

  vector<int> value(N);
  vector<int> cost(N);
  int max = 0;

  for(int i = 0; i < N; i++){
    int val;
    cin >> val;
    value[i] = val;
  }

  for(int j = 0; j < N; j++){
    int cos;
    cin >> cos;
    cost[j] = cos;
  }

  for(int k = 0; k < N; k++){
    int vc = value[k] - cost[k];
    if(vc > 0)  max += vc;
  }

  cout << max << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    long long people_num;
    long long occupancy_limits[5];

    cin >> people_num;
    
    for(int i = 0; i < 5; i++){
        cin >> occupancy_limits[i];
    }
    long long min_occupancy = occupancy_limits[0];
    for(int i = 1; i < 5; i++){
        if(min_occupancy > occupancy_limits[i]){
            min_occupancy = occupancy_limits[i];
        }
    }

    cout << 4 + (people_num + min_occupancy - 1) / min_occupancy << endl;

    return 0;
}

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

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

    int ans = 0;

    while(true){
        if(ans * ans > N){
            break;
        }
        ans++;
    }    
    cout << (ans - 1) * (ans - 1) << endl;
} 

Measured memory_bytes: 3620
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = 0;
		int b = 0;
		int c = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
				case 'a' :
				a++;
				break;
				case 'b' :
				b++;
				break;
				case 'c' :
				c++;
			}
		}
		if (a == 1 && b == 1 && c == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  ll x, y;
  cin >> x >> y;
  if(x < y) swap(x, y);
  bool f = false;
  if(x+y < 2){
    f = true;
  }else{
    if(x-y <= 1) f = true;
    else f = false;
  }
  if(f == false) cout << "Alice" << endl;
  else cout << "Brown" << endl;
  return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	
	vector<int> a;
	a.push_back(-1);
	for(int i = 1;i <= n;i++){
		int ai;
		cin >> ai;
		a.push_back(ai);
	}
	
	int sum = 0;
	for(int i = 1;i <= n;i++){
		if(a[i] == i){
			sum++;
			i++;
		}
	}
	
	cout << sum << endl;
	
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


int main() {

    int a,b,h,m;
    cin>>a>>b>>h>>m;
    h=h%12;
    double placeh,placem;
    placeh=h*30+m*0.5;
    placem=m*6;
    double kaku;
    if(placem<placeh){
        kaku=placeh-placem;
    }
    else{
        kaku=placem-placeh;
    }



double deg = kaku;                   /* ３０度 */
	double  deg_r, pi, unit, unit_r, x,y,z;

	pi     = 2.0 * asin(1.0);            /* πの値 */
	unit   = pi / 180.0;                 /* 度 → ラジアン */
	unit_r = 180.0 / pi;                 /* ラジアン → 度 */

	deg_r  = deg * unit;
  double san = cos(deg_r);
  double ans=a*a+b*b-2*a*b*san;
  double ans2=sqrt(ans);
  cout<<fixed<<setprecision(10)<<ans2<<endl;

  
}

Measured memory_bytes: 4256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mod 1000000007
#define int long long
using namespace std;
inline int read(){
	int f=1,ans=0;char c;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}
const int N=200001;
const int MAXN=4011;
int f[MAXN][MAXN],C[MAXN][MAXN],n,a[N],b[N],ans,zero=2001;
int calc(int a,int b){return C[a][b];}
int ksm(int A,int B){
	int Ans=1;
	while(B){
		if(B&1) Ans*=A,Ans%=mod;
		A*=A,A%=mod;
		B>>=1;
	}return Ans;
}
signed main(){
	n=read();
	for(int i=1;i<=n;i++) a[i]=read(),b[i]=read(),f[zero-a[i]][zero-b[i]]++;
	for(int i=1;i<=4001;i++)
	     for(int j=1;j<=4001;j++) f[i][j]+=(f[i-1][j]+f[i][j-1]),f[i][j]%=mod;
	for(int i=0;i<=4000;i++) C[0][i]=C[i][0]=1;
	for(int i=1;i<=4000;i++)
	    for(int j=1;j<=4000;j++) C[i][j]=C[i-1][j]+C[i][j-1],C[i][j]%=mod;
	for(int i=1;i<=n;i++){
		ans+=f[zero+a[i]][zero+b[i]];ans%=mod;
		ans-=calc(2*a[i],2*b[i]);ans%=mod;
	}
	ans=((ans%mod)+mod)%mod;
	printf("%d\n",(ans*ksm(2,mod-2))%mod);
}


Measured memory_bytes: 254464
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

typedef struct Info_t {
  long long c;
  long long s;
  long long f;
} Info_t;
int main (void) {
  long long n;
  cin >> n;

  vector<Info_t> infov(n);

  for (int i = 1; i < n; i++) {
    Info_t tmp;
    cin >> tmp.c >> tmp.s >> tmp.f;
    infov[i] = tmp;
   }

  for (int i = 1; i < n; i++) {
    long long now = 0;
    for (int j = i; j < n; j++) {
      if (now < infov[j].s) {
        now = infov[j].s;
      } else if (now % infov[j].f != 0) {
        now += infov[j].f - (now % infov[j].f);
      }
      now += infov[j].c;
    }
    cout << now << endl;
  }

  cout << 0 << endl;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%s", $num);
// $num = fgets(STDIN);
$input = trim(fgets(STDIN));
$a = explode(" ", $input);
$count = 0;
$flag = 0;
// exit;
while($flag == 0) {
  for($i = 0; $i < $num; $i++) {
    if(($a[$i] % 2) != 0) {
      $flag = 1;
      echo "$count\n";
      break;
    }
    $a[$i] = $a[$i] / 2;
  }
  $count++;
}
exit;

?>


Measured memory_bytes: 3576
def resolve():
    N,Y=map(int,input().split())

    def main():
        for i in range(N+1):
            for j in range(N+1-i):

                if i*10000+j*5000+(N-i-j)*1000==Y:
                    return [i,j,N-i-j]
        return [-1,-1,-1]

    for i in main():
        print(i,end=' ')





resolve()

Measured memory_bytes: 38768
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        long sumA = 0;
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
            sumA += (long) a[i];
        }
        long sumB = 0;
        for (int i = 0 ; i < n ; i++) {
            b[i] = sc.nextInt();
            sumB += (long) b[i];
        }
        sc.close();
        long dif = sumB - sumA;
        long count = 0;
        for (int i = 0 ; i < n ; i++) {
            if (a[i] > b[i]) {
                //count += (long) (a[i] - b[i]);
            } else {
                if ((b[i] - a[i]) % 2 == 0) {
                    count += (long) (b[i] - a[i]) / 2;
                } else {
                    count += (long) (b[i] - a[i] + 1) / 2;
                }
            }
        }

        if (count <= dif) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }


    }

}

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

bool small(const pair<long, long> &p1, const pair<long, long> &p2) {
	return p1.first < p2.first ? true : false;
}

int main() {
	vector<pair<long, long> > v;
	long N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		long a, b;
		cin >> a >> b;
		v.push_back(make_pair(a, b));
	}
	sort(v.begin(), v.end(), small);

	long sum = 0;
	long cnt = 0;
	for (int i = 0; i < N; i++) {
		sum += v[i].first * v[i].second;
		cnt += v[i].second;
		if (cnt > M) {
			int remaining = cnt-M;
			cnt = M;
			sum -= v[i].first*remaining;
		}
		if (cnt == M) {
			break;
		}
	}
	cout << sum << endl;
}


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

int main() {
  int N, A, X;
  X = 0;
  cin >> N;
  for(int i = 0; i < N; i++) {
    int Y = 0;
    cin >> A;
    if(A % 2 != 0) {
      break;
    }
    while(A % 2 == 0) {
      Y++;
      A /= 2;
    }
    if (X == 0) {
      X = Y;
    }
    if (X > Y) {
      X = Y;
    }
  }
  cout << X << endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
using psi = pair<string, int>;


int main() {
    int N, P;
    string S;
    cin >> N;
    psi p1;
    pair<psi, int> p;
    vector<pair<psi, int>> data(N);
    for (int i = 0; i < N; i++) {
        cin >> S >> P;
        p1 = make_pair(S, P * -1);
        p = make_pair(p1, i + 1);
        data.at(i) = p;
    }
    sort(data.begin(), data.end());
    for (int i = 0; i < N; i++) {
        cout << data.at(i).second << endl;
    }
}

Measured memory_bytes: 3564
def q(n)
	($><<n<<"\n").flush
	(c=gets[0])==?V && exit
	c==?M
end
n=gets.to_i
pr=q pri=0
(1...n).bsearch{|i|
	cu=q i
	f=((i%2==pri%2)^(i<pri)) == (cu!=pr)
	pr=cu
	pri=i
	f
}

Measured memory_bytes: 2384
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int n;
    string a,b,c="";
    cin>>n>>a>>b;
    rep(i,n){
        c.push_back(a[i]);
        c.push_back(b[i]);
    }
    cout<<c;
	return 0;
}


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

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

        static void C()
        {
            var N = ReadInt();
            var ABC = new int[N, 3];
            var dp = new int[N, 3];

            for (var i = 0; i < N; i++)
            {
                var abc = ReadSplitInt();
                ABC[i, 0] = abc[0];
                ABC[i, 1] = abc[1];
                ABC[i, 2] = abc[2];
            }

            Func<int, int, int> func = null;
            func = (i, j) =>
            {
                if (i < 0) return 0;
                if (dp[i, j] > 0) return dp[i, j];

                for (int k = 0; k < 3; k++)
                {
                    if (j == k) continue;
                    dp[i, j] = Max(dp[i, j], func(i - 1, k) + ABC[i, j]);
                }
                return dp[i, j];
            };

            Println(Max(Max(func(N - 1, 0), func(N - 1, 1)), func(N - 1, 2)));
        }

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

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

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 23736
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int q,ans=0;
vector<int> e;
vector<int> f;
struct matter
{
  int a,b,c,d;
};
matter p[50];
void check()
{
  int val=0;
  for (int i=0;i<q;i++)
  {
    if ((f[p[i].b-1]-f[p[i].a-1])==p[i].c)
      val=val+p[i].d;
  }
  ans=max(ans,val);
}
void solve(int init,int k)
{
  if (k==0)
  {
    check();
    return;
  }
  int prev=0;
  if (init!=0)
  prev=init-1;
  for (int i=prev;i<e.size();i++)
  {
    f.push_back(e[i]);
    solve(i+1,k-1);
    f.pop_back();
  }
}
int main()
{
  int n,m;
  scanf("%d%d%d",&n,&m,&q);
  for (int i=0;i<q;i++)
    scanf("%d%d%d%d",&p[i].a,&p[i].b,&p[i].c,&p[i].d);
  for (int i=0;i<m;i++)
    e.push_back(i+1);
  solve(0,n);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x,y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
int32_t main()
{
    nitin;
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
    }
    cout<<ceil((n-1)/floor((k-1)))<<endl;
    return 0;
}

Measured memory_bytes: 3800
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2254

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;

const int Co = 65536;
int T[17];
const int infty = 1e7;

void init() {
  int c = 1;
  for (int i=0; i<17; i++) {
    T[i] = c;
    c *= 2;
  }
}

void two(int c, bool* ans) {
  for (int i=15; i>=0; i--) {
    if (c / T[i] == 0) {
      ans[i] = false;
    } else {
      c -= T[i];
      ans[i] = true;
    }
  }
}

int ten(bool* h) {
  int ans = 0;
  for (int i=0; i<16; i++) {
    if (h[i]) {
      ans += T[i];
    }
  }
  return ans;
}

int main() {
  init();
  int N;
  while (scanf("%d", &N) != EOF && N) {
    int t;
    int C[16][17];
    for (int i=0; i<N; i++) {
      for (int j=0; j<=N; j++) {
	scanf("%d", &t);
	C[i][j] = t;
	// cerr << "t_" << i << j << " = " << t << endl;
      }
    }
    vector<pair<int, int>> V[Co];
    for (int i=0; i<T[N]; i++) { // passを入れる。
      bool b[16];
      two(i, b);
      /*for (int j=0; j<16; j++) {
	cerr << b[j];
	}
	cerr << endl; */
      for (int j=0; j<N; j++) {
	if (!b[j]) {
	  int min = C[j][0];
	  for (int k=0; k<N; k++) {
	    if (b[k] && min > C[j][k+1]) {
	      // cerr << "updated : k = " << k << ", j = " << j << ", C[i][k+1] = " << C[i][k+1] << endl;
	      min = C[j][k+1];
	    }
	  }
	  int dst = i + T[j];
	  V[i].push_back(make_pair(min, dst));
	  // cerr << i << " to " << dst << " costs " << min << endl;
	}
      }
    }
    priority_queue<pair<int, int>> Q;
    Q.push(make_pair(0, 0));
    int S[Co];
    fill(S, S+Co, infty);
    while (! Q.empty()) {
      int cost = -1 * Q.top().first;
      int cur = Q.top().second;
      Q.pop();
      if (S[cur] == infty) {
	S[cur] = cost;
	for (unsigned int i=0; i<V[cur].size(); i++) {
	  int ncost = V[cur][i].first;
	  int dst = V[cur][i].second;
	  if (S[dst] == infty) {
	    Q.push(make_pair(-1 * (cost + ncost), dst));
	  }
	}
      }
    }
    printf("%d\n", S[T[N]-1]);
  }
}

Measured memory_bytes: 11608
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    a_dic = {}
    for i in range(n):
        if a[i] in a_dic:
            a_dic[a[i]] += 1
        else:
            a_dic[a[i]] = 1

    ans = 0
    for aa in a_dic:
        tmp = a_dic[aa] - aa
        if tmp < 0:
            tmp = a_dic[aa]
        ans += tmp

    print(ans)


Measured memory_bytes: 17780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll N, M, K;
    cin >> N >> M >> K;
    VL a(N), b(M), aa(N+1, 0), bb(M+1, 0);
    rep(i, 0, N) cin >> a[i];
    rep(i, 0, M) cin >> b[i];
    rep(i, 0, N) aa[i+1] = aa[i] + a[i];
    rep(i, 0, M) bb[i+1] = bb[i] + b[i];
    ll ans = 0;
    rep(i, 0, N+1){
        ll rem = K - aa[i];
        if(rem < 0) continue;
        auto itr = upper_bound(ALL(bb), rem);
        auto pos = itr - bb.begin();
        //cerr << rem << " " << pos-1 << endl;
        ans = max(i + pos - 1, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9468
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string in;
    cin >> in;
    
    for(int i=0;i<3;i++){
        if(in[i]=='7'){
             cout << "Yes" << endl;
             return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3596
def main():
	n,m = map(int,input().split())
	# n,k = map(int,input().split())
	# n = str(input())
	# a = list(map(int,input().split()))
	# rsp = list(str(input()))
	l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	
	# print(l)
	l_s = sorted(l)
	# print(len(l))

	ans_yen = 0
	ans_can = 0
	stock = 0
	i = 0
	while m > ans_can and i <= int(len(l_s))-1:
		while stock < l_s[i][1] and m > ans_can:
			# print("shop {} 's turn".format(i))
			ans_yen += l_s[i][0]
			stock += 1
			ans_can += 1
			# print("--¥ {}--".format(ans_yen))
			# print("--ans_can is {}--".format(ans_can))
		# print("i is {}".format(i))
		stock = 0
		i += 1
		# print("ans_can is {}".format(ans_can))
		# ans_can += 1
	print(ans_yen)


 
if __name__ == '__main__':
	main()

Measured memory_bytes: 61528
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> Graph;

//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
int main(){

    int n;
    ll c,k;
    cin >> n >> c >> k;
    vl t(n);
    rep(i,n) cin >> t.at(i);
    sort(all(t));
    int ret = 1;
    int s = 0;
    rep(i,n){
        if(s+c<=i || t.at(s)+k < t.at(i)){
            ret++;
            s = i;
        }
    }
    cout << ret << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  long long i, j, k, n, ans[10010];
  ans[1] = 2;
  for(i = 2; i < 10010; ++i) ans[i] = ans[i - 1] + i;
  while(scanf("%lld", &n) != EOF) {
    printf("%lld\n", ans[n]);
  }
  return 0;
} 


Measured memory_bytes: 2660
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

vector< vector<int> > gra;
vector< int > color;
vector< int > wei;

//ダメなら空vectorを返す
vector<int> dfs(int v){
	int size = gra[v].size();
	vector< vector<int> > res(size);
	vector<int> temp;
	if( size == 0 ){//葉
		vector<int> ans;
		ans.push_back(0);
		ans.push_back(wei[v]);
		return ans;//(0,X)を返す
	}

	LL sum = 0;//子の総重量
	for(int i=0;i<size;++i){
		int to = gra[v][i];
		temp = dfs(to);
		if( temp.size() == 0 ){//この部分木で失敗
			return temp;
		}
		res[i] = temp;
		sum += temp[0] + temp[1];
	}

	int X = wei[v];//
	vector<bool> dp(X+1,false),next(X+1);
	dp[0] = true;
	
	for(int i=0;i<size;++i){
		next.assign(X+1,false);//初期化
		for(int w=X;w>=0;--w){
			if( dp[w] ){//作れるなら
				int size = res[i].size();//固定で2
				for(int j=0;j<size;++j){
					if( w+res[i][j] <= X ){
						next[w+res[i][j]] = true;
					}
				}
			}
		}
		dp = next;
	}
	vector<int> ans;
	for(int i=X;i>=0;--i){
		//dp[i]の重さと合わせてXを作る。
		if( dp[i] ){//Xの他方を小さくする。調整は親に任せる
			ans.push_back( sum-i );
			break;
		}
	}
	if( ans.size() ){
		ans.push_back( X );
	}
	return ans;
}
void solve(){
	int N;
	cin >> N;
	gra = vector< vector<int> >(N);
	for(int i=2;i<=N;++i){
		int v = i-1;
		int oya;
		cin >> oya;
		--oya;
		gra[oya].push_back( v );
	}

	wei = vector<int>(N);
	for(int i=0;i<N;++i){
		cin >> wei[i];//自分も含めた部分木での同じ色の重さ
	}
	
	vector<int> ans = dfs(0);
	int size = ans.size();
	for(int i=0;i<size;++i){
		if( ans[i] <= wei[0] ){
			cout << "POSSIBLE" << endl;
			return;
		}
	}

	cout << "IMPOSSIBLE" << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 512
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
# print(WV)
max_v = 0
for i in range(N):
    max_v += WV[i][1]
# print(max_v)
dp = [[INF]*(max_v+1) for _ in range(N+1)]
dp[0][0] = 0
# print(dp)
for n in range(N):
    for sum_v in range(max_v+1):
        weight = WV[n][0]
        value = WV[n][1]
        #print('weight', weight, 'value', value)
        if sum_v-value >= 0:
            dp[n+1][sum_v] = min(dp[n+1][sum_v], dp[n][sum_v-value]+weight)
        dp[n+1][sum_v] = min(dp[n+1][sum_v], dp[n][sum_v])
ans = 0
# print(dp)
for sum_v in range(max_v+1):
    if dp[N][sum_v] <= W:
        ans = sum_v
print(ans)


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

const int maxn = 3e3 + 10, mod = 998244353;

int f[maxn][maxn], n1, n2, m2, m1;

namespace {
  inline int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
  inline int dec(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
  inline int mul(int x, int y) { return 1ll * x * y % mod; }
}

int main(void) {
  scanf("%d%d%d%d", &n1, &m1, &n2, &m2);
  f[n1][m1] = 1;
  for(int i = n1; i <= n2; i++) {
    for(int j = m1; j <= m2; j++) {
      if(i - n1 == 0 && j == m1) continue;
      f[i][j] = add(mul(j, f[i - 1][j]), mul(i, f[i][j - 1]));
      f[i][j] = dec(f[i][j], mul((i - 1) * (j - 1), f[i - 1][j - 1]));
    }
  }
  cout << f[n2][m2] << endl;
}


Measured memory_bytes: 38828