akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef long double D;
typedef pair<D,D> P;
D eps=1e-12,inf=1e50;
vector<P> vc;
int main(){
	while(true){
		int N;
		cin>>N;
		if(N==0) break;
		vc.clear();
		rep(i,N){
			D x,y;
			cin>>x>>y;
			vc.pb(P(y/x,4.9/x/x));
		}
		D X,Y;
		cin>>X>>Y;
		sort(all(vc),greater<P>());
		D ans=-inf;
		rep1(n,N){
			D ub=X,lb=0;
			while(ub-lb>eps){
				D t0=(ub+lb)/2;
				D t=t0;
				rep1(i,n-1){
					D ti=(2*vc[0].sc*t0-vc[0].fs+vc[i].fs)/(2*vc[i].sc);
					t+=ti;
				}
				if(t>X) ub=t0;
				else lb=t0;
			}
			D y=0,tsum=0;
			bool can=true;
			rep(i,n){
				D t=(2*vc[0].sc*ub-vc[0].fs+vc[i].fs)/(2*vc[i].sc);
				if(t<eps) can=false;
				tsum+=t;
				y+=vc[i].fs*t-vc[i].sc*t*t;
			}
			if(can) ans=max(ans,y);
		}
		D lb=inf;
		rep(i,N){
			lb=min(lb,vc[i].fs*X-vc[i].sc*X*X);
		}
		if(lb-5*eps<Y&&Y<ans+5*eps) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1260
#include "bits/stdc++.h"

using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define lin "\n"
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(0)

void solve() {
    int x;
    cin >> x;
    cout << !x << lin;
}

int main() {
    fast_io;
    int t = 1;
//    cin >> t;
//    scanf("%d",&t);
    int c = 1;
    while (t--) {
//        printf("Case %lld: ",c);
//        cout<<"Case "<<c<<": ";
        solve();
        c++;
    }
}

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

void fnInsertionSort(vector<int> &a_rviSort, int a_iGap, int &a_riSortCnt)
{
  for (int ixSorting = a_iGap; ixSorting < a_rviSort.size() ; ixSorting++)
  {
    int iTarget = a_rviSort[ixSorting];
    int ixSorted = ixSorting - a_iGap;

    while (ixSorted >= 0              &&
           iTarget < a_rviSort[ixSorted])
    {
      a_rviSort[ixSorted + a_iGap] = a_rviSort[ixSorted];
      ixSorted -= a_iGap;

      a_riSortCnt++;
    }
    a_rviSort[ixSorted + a_iGap] = iTarget;
  }
}

void fnShellSort(vector<int> &a_rviSort, vector<int> &a_rviGap, int &a_riSortCnt)
{
  for (int iGap = 1; iGap <= a_rviSort.size(); iGap = 3 * iGap + 1)
    a_rviGap.push_back(iGap);
  
  for (int i = a_rviGap.size() - 1; i >= 0; i--)
    fnInsertionSort(a_rviSort, a_rviGap[i], a_riSortCnt);
}

void fnOutput(const vector<int> &a_cnrviSort, const vector<int> &a_cnrviGap, int a_iSortCnt)
{
  cout << a_cnrviGap.size() << endl;

  for (int i = a_cnrviGap.size() - 1; i >= 0; i--)
  {
    if (i != a_cnrviGap.size() - 1) cout << " ";
    cout << a_cnrviGap[i];
  }
  cout << endl;

  cout << a_iSortCnt << endl;

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

int main()
{
  vector<int> viSort;
  vector<int> viGap;
  int iSortCnt = 0;
  int iMaxSize;
  
  cin >> iMaxSize;
  for (int i = 0; i < iMaxSize; i++)
  {
    int iNum;
    cin >> iNum;
    viSort.push_back(iNum);
  }

  fnShellSort(viSort, viGap, iSortCnt);
  fnOutput(viSort, viGap, iSortCnt);

  return 0;
}

Measured memory_bytes: 7256
#include "cstdio"
#include <algorithm>

using namespace std;

int main (){
    int n,mx=-1000000,mn=1000000,a;
    long sum=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        mx = max(mx,a);
        mn = min(mn,a);
        sum += a;
    }
    printf("%d %d %ld\n",mn,mx,sum);
}

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

int main(){
  int A[4];
  int B[4];
  while(cin >> A[0] >> A[1] >> A[2] >> A[3]){
    cin >> B[0] >> B[1] >> B[2] >> B[3];
    
    int hit = 0;
    int blow = 0;
    for(int i=0;i<4;i++){
      if(A[i] == B[i]) hit++;

      for(int j=0;j<4;j++){
        if(j==i) continue;
        else if(B[i] == A[j]) blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

ll n,k;

int main()
{
	cin>>n>>k;
	if(k%2==1)
	{
		ll x=n/k;
		cout<<x*x*x<<endl;
	}
	else
	{
		ll x=n/k;
		ll x1=n-k/2;
		if(x1<0) x1=0;
		else x1=(x1/k)+1;
		cout<<x*x*x+x1*x1*x1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;

int main()
{
	int N;
	cin >> N;
	int a[1000];
	int b = 0;
	while (b <= 2 * N - 1) {
		cin >> a[b];
		++b;
	}
	stable_sort(a, a+b);
	b = 0;
	int c = 0;
	while (b <= 2*N-1) {
		if (a[b] > a[b + 1]) c = c + a[b + 1];
		else c = c + a[b];
		b = b + 2;
	}
	cout << c;
}

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

int main(void)
{
  int a, b;
  int ans;
  
  scanf("%d%d", &a, &b);
  
  if((a+b)%2==0){
    ans = (a+b)/2;
    printf("%d", ans);
  }else{
    printf("IMPOSSIBLE");
  }
  
  return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define mem(a) memset(a,0,sizeof(a))
#define pd(a) printf("%.10f\n",a)
#define pb(a) push_back(a)
#define in(a) insert(a)
#define pi M_PI
#define R cin>>
#define F first
#define S second
#define C class
#define ll long long
#define ln cout<<'\n'
#define _(_1,_2,_3,N,...)N
#define pr(...) _(__VA_ARGS__,pr3,pr2,pr1)(__VA_ARGS__)
template<C T>void pr1(T a){cout<<a;ln;}
template<C T,C T2>void pr2(T a,T2 b){cout<<a<<' '<<b;ln;}
template<C T,C T2,C T3>void pr3(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;}
template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  while(R n && n) {
    ll d[n],c[n],m;
    mem(c);
    rep(i,n) {
      cin >> m >> d[i];
      rep(j,m) {
        int l,r;
        cin >> l >> r;
        l-=6,r-=6;
        c[i]|=((1<<r)-1)-((1<<l)-1);
      }
    }
    ll dp[1<<16];
    mem(dp);
    rep(i,n) {
      rep(t,1<<16) {
        if(t&c[i]) continue;
        dp[t|c[i]]=max(dp[t|c[i]],dp[t]+d[i]);
      }
    }
    ll ans=0;
    rep(i,1<<16) ans=max(ans,dp[i]);
    pr(ans);
  }
}

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  Main();return 0;
}


Measured memory_bytes: 1720
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <deque>

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
    int a,b;
    cin >> a >> b;
    cout << b + b - a;
}



Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <queue>

using namespace std;

struct edge {
  int to;
  int cost;
};

int main() {
  int n,m,p;
  cin >> n >> m >> p;
  
  vector<vector<edge>> edges(n+1);
  for (int i = 0; i < m; i++) {
    int a,b,c;
    cin >> a >> b >> c;
    edges[a].push_back({b,p-c}); // 支払いを辺の重みとして、最小値を求める
  }

  //ベルマンフォード法で探す
  bool is_minus = false;
  int init_value = pow(10,9); // ありえない最大値
  vector<int> d(n+1, init_value);
  d[1] = 0; // 始点は0
  
  for (int count = 1; count <= n+m; count++) {
    for (int from = 1; from <= n; from++) {
      for (const auto& e : edges[from]) {
        int to = e.to;
        int old = d[to];
        d[to] = min(d[to], d[from] + e.cost);
        if (to == n && count >= n && old != d[to]) {
          is_minus = true; // 負の経路あり
        }
      }
    }
  }
  
  if (is_minus) {
    cout << -1 << endl;
  } else if (d[n] > 0) {
    // 支払のほうが多い
    cout << 0 << endl;
  } else {
    cout << -d[n] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 512
N,D = map(int,input().split())
X = [tuple(map(int,input().split())) for i in range(N)]
ans = 0
for i,x in enumerate(X[:-1]):
    for y in X[i+1:]:
        d = 0
        for a,b in zip(x,y):
            d += (a-b)**2
        if int(d**0.5) == d**0.5:
            ans += 1
print(ans)

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main(){
    
    ll A;
    cin >> A;

    cout << A / 2 + A % 2 << endl;
    
}

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

typedef pair<int, int> pii;

const int MN = 300010;

int N, M;
pii seg[MN];
int ans[MN];

struct Fenwick {
    vector<int> tree;
    void init() {
        tree = vector<int>(MN + 1, 0);
    }
    void upd(int idx, int val) {
        for(int i = idx + 1; i <= MN; i += (i & -i)) tree[i] += val;
    }
    int quer(int a) {
        int ret = 0;
        for(int i = a + 1; i >= 1; i -= (i & -i)) ret += tree[i];
        return ret;
    }
} fw;

bool cmp(pii a, pii b) {
    return a.second - a.first < b.second - b.first;
}

int main() {
    scanf("%d %d", &N, &M);

    for(int i = 0; i < N; i++) {
        scanf("%d %d", &seg[i].first, &seg[i].second);
    }

    sort(seg, seg + N, cmp);

    fw.init();
    for(int i = 0; i < N; i++) {
        fw.upd(seg[i].first, 1);
        fw.upd(seg[i].second + 1, -1);
    }
    int pos = N - 1;
    for(int i = M; i >= 1; i--) {
        while(pos >= 0 && seg[pos].second - seg[pos].first >= i) {
            fw.upd(seg[pos].first, -1);
            fw.upd(seg[pos].second + 1, 1);
            pos--;
        }

        ans[i] += N - 1 - pos;
        for(int j = i; j <= M; j += i) {
            ans[i] += fw.quer(j);
        }
    }
    for(int i = 1; i <= M; i++) {
        printf("%d\n", ans[i]);
    }
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
const int N=1e2+5, M = 5e5+5, OO = 0x3f3f3f3f;
typedef long long ll;
#define PI 3.14159265358979323846
#define MOD 1000000007
int main()
{
    ll a,b,k; cin>>a>>b>>k;
    if (a>=k) a-=k;
    else {
            k-=a;
            a=0;
            if (b>=k) b-=k;
            else b=0;
    }
    cout<<a<<" "<<b;
   return 0;
}


Measured memory_bytes: 256
program main
   implicit none 
   integer ::a(4)=0,hantei(4)=1
   integer i
   read(*,*)a
   do i=1,4
      if(a(i)==1)hantei(1)=0
      if(a(i)==9)hantei(2)=0
      if(a(i)==7)hantei(3)=0      
      if(a(i)==4)hantei(4)=0
   enddo
   if(all(hantei==0))then
      write(*,"(a3)")"YES"
   else
      write(*,"(a2)")"NO"
   endif
end program main


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

int main()
{
  int A, B, price = 0;
  cin >> A >> B;
  
  if(A >= 13)
    price = B;
  else if((A >= 6) && (A <= 12))
    price = B / 2;

  cout << price << endl;
}

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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 51;
const int MOD = (int)1e9 + 7;

int n, k;

vector<VI> mul(vector<VI> m1, vector<VI> m2) {
  int n = m1.size();
  int m = m1[0].size();
  int k = m2[0].size();
  vector<VI> res(n, vector<int>(k, 0));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < k; ++j)
      for (int l = 0; l < m; ++l)
        res[i][j] = (res[i][j]+m1[i][l]*m2[l][j])%MOD;
  return res;
}

signed main() {
  init_ios();
  cin >> n >> k;
  vector<VI> ma(n, vector<int>(n, 0));
  vector<VI> id(n, vector<int>(n, 0));
  for (int i = 0; i < n; ++i)
    id[i][i] = 1;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      cin >> ma[i][j];
  for (int i = 0; i <= 63; ++i) {
    if (k&(1LL<<i))
      id = mul(id, ma);
    ma = mul(ma, ma);
  }
  int wyn = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      wyn = (wyn+id[i][j])%MOD;
  cout<<wyn<<"\n";
}

Measured memory_bytes: 512
Integer N,Q
Character(1000000) moji
character(1),Allocatable,Dimension(:)::t,d
integer l,r
integer mi,ma,md
read*,N,Q
allocate(t(Q),d(Q))

read*,moji

do i=1,Q
  read*,t(i),d(i)
end do
!二部探索法、まずは0に落ちるもの
mi=0!辿り着く
ma=N+1!辿り着かないもの
Do while(mi+1<ma)
  md=(mi+ma)/2
  if( achievableLEFT(N,moji,Q,t,d,md) )then
    mi=md
  else
    ma=md
  end if
End do
l=mi

!二部探索法N+1に落ちるもの
mi=0
ma=N+1
Do while(mi+1<ma)
  md=(mi+ma)/2
  if( achievableRIGHT(N,moji,Q,t,d,md) )then
    ma=md
  else
    mi=md
  end if
End do
r=ma

print"(i0)",r-l-1

contains
pure function achievableLEFT(N,moji,Q,t,d,md)
  Integer,intent(in)::N,Q
  Character(1000000),intent(in)::moji
  Character(1),intent(in)::t(1:Q),d(1:Q)
  Integer,intent(in)::md
  Integer soeji,i
  logical::achievableLEFT
  
  soeji=md
  do i=1,Q
    if (soeji==0 .or. soeji==N+1)EXIT
    if( moji(soeji:soeji) ==t(i) )then
      if(d(i)=="L")then
        soeji=soeji-1
      endif
      if(d(i)=="R")then
        soeji=soeji+1
      endif
    endif
  end do
  achievableLEFT=(soeji==0)
end function achievableLEFT
pure function achievableRIGHT(N,moji,Q,t,d,md)
  Integer,intent(in)::N,Q
  Character(1000000),intent(in)::moji
  Character(1),intent(in)::t(1:Q),d(1:Q)
  Integer,intent(in)::md
  Integer soeji,i
  logical::achievableRIGHT
  
  soeji=md
  do i=1,Q
    if (soeji==0 .or. soeji==N+1)EXIT
    if( moji(soeji:soeji) == t(i) )then
      if(d(i)=="L")then
        soeji=soeji-1
      endif
      if(d(i)=="R")then
        soeji=soeji+1
      endif
    endif
  end do
  achievableRight=(soeji==N+1)
end function achievableRIGHT
end

Measured memory_bytes: 1932
from collections import deque
N, M = map(int, input().split())

graph = [set() for _ in range(N + 1)]
edge = []
##immutableに気をつけて
for m in range(M):
    a, b = map(int, input().split())
    graph[a].add(b)
    graph[b].add(a)
    edge.append([a, b])

ans = 0
for m in range(M):
    Bridge = True
    fr, to = edge[m][0], edge[m][1]
    V = {fr} | set(graph[fr]) - {to}
    que = deque(set(graph[fr]) - {to})
    while que:
        node = que.pop()
        for new_node in graph[node]:
            if new_node == to:
                Bridge = False
                break
            if new_node not in V:
                que.append(new_node)
                V.add(new_node)
        else:
            continue
        break
    if Bridge:
        ans += 1
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
long long ans,sum;
int m;
int main() {
	scanf("%d",&m);
	for(int i=0;i<m;i++) {
		long long c,d;
		scanf("%lld%lld",&d,&c);
		sum+=c;
		ans+=d*c;
	}
	int d=0;
	if(ans%9==0) d=-1;
	ans=ans/9+sum-1+d;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
 
const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int n;
string s;

int main() {
    cin >> s;
    n = s.size();
    if (s[n-1] == '1' || s[0] == '0'){
        cout << -1 << endl;
        return 0;
    }
    for (int i = 0; ; i++) {
        if (i >= n-2-i) break;
        if (s[i] != s[n-2-i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    int now = 1;
    for (int i = 0; i < n-1; i++) {
        if (s[i] == '0') {
            cout << now << " " << i+2 << endl;
        } else {
            cout << now << " " << i+2 << endl;
            now = i+2;
        }
    }
}



Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
bool isPrime[100005];
vector<int> Primes;
vector<int> temp;
int n;
bool check()
{
    for(int i = 0;i < n;i++)
    {
        for(int j = i+1;j < n;j++)
        {
            for(int k = j+1;j < n;j++)
            {
                for(int z = k+1;z < n;z++)
                {
                    for(int q = z+1;q < n;q++)
                    {
                        int temp = Primes[i] + Primes[j] + Primes[k] + Primes[z] + Primes[q];
                        if(isPrime[temp])
                            cout << Primes[i] << " " << Primes[j] << " " << Primes[k] << " " << Primes[z] << " " << Primes[q] << " " << temp << endl;
                    }
                }
            }
        }
    }
    return true;
}
int main()
{
    memset(isPrime,true,sizeof isPrime);
    for(int i = 2;i <= 100000;i++)
    {
        if(isPrime[i])
        {
            if(i < 55555)
            Primes.push_back(i);
            for(int j = i*2;j <=100000;j += i)
                isPrime[j] = false;
        }
    }
    cin >> n;
    for(int i = 0;i < Primes.size() && n;i++)
    {
        if(Primes[i] % 5 == 1)
            cout << Primes[i] << " ",n--;
    }
}


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

using namespace std;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		
		vector<string> l;
		vector<double> eff;
		vector<int> index;
		for(int i = 0;i < n;i++){
			string tl;
			int p,a,b,c,d,e,f,s,m;
			cin >> tl >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			l.push_back(tl);
			int time = 0,inc = 0;
			time = a + b + c + (d + e) * m;
			inc = f * m * s;
			eff.push_back((inc - p) * 1.0 / time);
			index.push_back(i);
		}
		
		for(int i = 0;i < n;i++){
			for(int j = i +1;j < n;j++){
				if(eff[index[i]] < eff[index[j]]){
					int ti = index[i];
					index[i] = index[j];
					index[j] = ti;
				}else if(eff[index[i]] == eff[index[j]]){
					if(l[index[i]] > l[index[j]]){
						int ti = index[i];
						index[i] = index[j];
						index[j] = ti;
					}
				}
			}
		}
		
		for(int i = 0;i < n;i++){
			cout << l[index[i]]  << endl;
		}
		cout << '#' << endl;
	}
	return 0;
}


Measured memory_bytes: 3032
#include <stdio.h>

int main()
{
  int A[100],N,flag=1,j,i,temp,count;

    scanf("%d",&N);
    for(i=0;i<N;i++){
      scanf("%d",&A[i]);
    }
    i=0;
    while(flag){
      flag=0;
      for(j=N-1;j>=i+1;j--){
	if(A[j]<A[j-1]){
	  temp = A[j];
	  A[j] = A[j-1];
	  A[j-1] = temp;
	  flag=1;
	  count++;
	}
      }
      if(flag==1){
	i+=1;
      }
    }
    for(i=0;i<N-1;i++){
      printf("%d ",A[i]);
    }
    printf("%d",A[N-1]);
    printf("\n");
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
// for文短縮類
#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--)
// iteratorのbeginとendをまとめて渡す
#define ALL(x) (x).begin(), (x).end()
//略
#define PB push_back  // vectorヘの挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素
//出力
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "
#define ENDL cout << endl
/************ Combination wtih MOD ************
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// preprocess for some tables
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int 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;
  }
}
// combination
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
*******************************************************/
int main(int argc, char *argv[]) {
  // input高速化。cinとcoutの結合解除。scanfとprintfは使えない。
  cin.tie(0);
  ios_base::sync_with_stdio(0);

  ll h, w, k;
  cin >> h >> w >> k;
  vector<vector<char>> c(h, vector<char>(w));
  REP(i, h){
      REP(j, w){
          char ci;
          cin >> ci;
          c[i][j] = ci;
      }
  }

  ll ans = 0;

  for (int mask_h = 0; mask_h < (1 << h); mask_h++)
  {
      for (int mask_w = 0; mask_w < (1 << w); mask_w++)
      {

          ll part = 0;
          vector<vector<char>> tmp(h, vector<char>(w));
          REP(i, h){
              REP(j, w){
                  tmp[i][j] = c[i][j];
              }
          }

          REP(i, h){
              if(mask_h & (1 << i)){
                  REP(j,w){
                      tmp[i][j] = 'r';
                  }
              }
          }
          REP(i, w) {
            if (mask_w & (1 << i)) {
              REP(j, h) { tmp[j][i] = 'r'; }
            }
          }

          REP(i, h){
              REP(j, w){
                  if(tmp[i][j] == '#'){
                      part += 1;
                  }
              }
          }

          if(part == k)
              ans += 1;

          part = 0;
      }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
# include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, mod = 1e9 + 7;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k - 1] -= 'A' - 'a';
    cout << s << endl;
}


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

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

  int ans = 700;
  if(s[0]=='o'){
    ans += 100;
  }if(s[1]=='o'){
    ans += 100;
  }if(s[2]=='o'){
    ans += 100;
  }

  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

const int MOD=1e9+7;
const int MAX_N=200005;
long long fact[MAX_N+1];
long long fact_inv[MAX_N+1];
long long bin_pow_mod(long long x,long long y) {
      if(x==0) return 0;
      long long prod=1;
      while(y>0) {
          if(y&1) {
              prod=(prod*x)%MOD;
          }
          x=(x*x)%MOD;
          y>>=1;
      }
      return prod%MOD;
}
void init_fact() {
    fact[0]=1, fact_inv[0]=1;
    REPF(i,1,MAX_N+1) {
        fact[i]=(fact[i-1]*i)%MOD;
        fact_inv[i]=bin_pow_mod(fact[i],MOD-2);
    }
}

signed main() {
    init_fact();
    int H,W,A,B;
    cin>>H>>W>>A>>B;

    int ans=0;
    for(int i=B;i<W;i++) {
        int a=((fact[H-A-1+i]*fact_inv[H-A-1])%MOD*fact_inv[i])%MOD;
        int b=((fact[A-1+W-i-1]*fact_inv[A-1])%MOD*fact_inv[W-i-1])%MOD;
        ans+=(a*b)%MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
n,m=map(int,input().split())
ls=[list(map(int,input().split())) for _ in range(n)]
lc=[list(map(int,input().split())) for _ in range(m)]

for i in range(n):
    p=0
    ans=10**9
    for j in range(m):
        dis=abs(lc[j][1]-ls[i][1])+abs(lc[j][0]-ls[i][0])
        if ans>dis:
            ans=dis
            p=j+1
    print(p)
    
    
        

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#define MAX_N 1000010
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){// this size is really ok??
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

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

ll mod_inverse(ll x){
  return mod_pow(x,MOD-2);
}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

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

  setComb();

  ll N;
  cin>>N;
  if(N==1){
    cout<<0<<endl;
    return 0;
  }

  ll ans=mod_pow(10,N);
  add(ans,MOD-mod_pow(9,N));
  add(ans,MOD-mod_pow(9,N));
  add(ans,mod_pow(8,N));
  cout<<ans<<endl;



  return 0;
}


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

using namespace std;

int main(){
    int n=0,k=0;
    long long sum=0;
    cin>>n>>k;
    vector<int> v(n);
    for(int i=0; i<n; i++){
            cin>>v[i];
        }
    if(n<=k)cout<<0<<endl;
    else if(k==0){
        for(int i=0; i<n; i++){
            sum+=v[i];
        }
        cout<<sum<<endl;
    }
    else{
        sort(v.begin(), v.end());
        for(int i=0; i<n-k; i++){
            sum+=v[i];
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 1024
#include <math.h>
#include <stdio.h>
typedef long long ll;
int main() {
	int n, a[100000], mCnt = 0, min = 1e9;
	ll ans = 0, sum = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		sum += abs(a[i]);
		if (a[i] < 0)
			mCnt++;
		if (min > abs(a[i]))
			min = abs(a[i]);
	}
	if (mCnt % 2 == 0) {
		ans = sum;
	} else {
		ans = sum - 2 * min;
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){ 
int n; cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
bool ans = true;
for(int i = 0; i < n; i++){
   if(a[i]%2==0){
     if(a[i]%3 != 0 && a[i]%5 != 0) ans = false;
       }
}
if(ans) cout << "APPROVED" << endl;
else cout << "DENIED" << endl;
return 0;
}


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

const int nm = 2e5;
int n, a[nm], ans[nm], dp[nm + 1], am = 1e9;
vector<int> g[nm];
void dfs(int v, int p, int l) {
	int inf = 0, sup = l + 1;
	while (sup - inf > 1) {
		int mid = (inf + sup) / 2;
		if (dp[mid] >= a[v])
			sup = mid;
		else
			inf = mid;
	}
	int prev = dp[sup];
	dp[sup] = a[v];
	ans[v] = max(sup, l);
	for (int nv : g[v]) {
		if (nv == p)
			continue;
		dfs(nv, v, ans[v]);
	}
	dp[sup] = prev;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0, u, v; i < n - 1; i++) {
		cin >> u >> v;
		u--, v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for (int i = 1; i <= n + 1; i++)
		dp[i] = 1e9 + 1;
	dfs(0, -1, 0);
	for (int i = 0; i < n; i++)
		cout << ans[i] << endl;
}


Measured memory_bytes: 31076
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
  int h, w, d;
  int px[100005], py[100005];
  int dist[90004] = {0};

  cin >> h >> w >> d;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      int a; cin >> a;
      --a;
      px[a] = j;
      py[a] = i;
    }
  }

  for (int i = 0; i < d; i++) {
    for (int j = i; j < h*w; j+=d) {
      if (j-d < 0) {
        continue;
      } else {
        dist[j] += dist[j-d] + abs(px[j]-px[j-d]) + abs(py[j]-py[j-d]);
      }
    }
  }

  int q;
  cin >> q;

  while (q--) {
    int l, r;
    cin >> l >> r;
    --l; --r;
    printf("%d\n", dist[r] - dist[l]);
  }

  return 0;
}

Measured memory_bytes: 2176
package main

import (
	"fmt"
	"math"
)

var N, M int
var mod int = pow(10, 9) + 7

func main() {
	fmt.Scan(&N, &M)

	S := make([]int, N)
	T := make([]int, M)

	for i := 0; i < N; i++ {
		fmt.Scan(&S[i])
	}
	for i := 0; i < M; i++ {
		fmt.Scan(&T[i])
	}

	dp := make([][]int, N+1)
	for i := 0; i < N+1; i++ {
		dp[i] = make([]int, M+1)
	}

	dp[0][0] = 1
	for i := 0; i < N+1; i++ {
		for j := 0; j < M+1; j++ {
			if 0 < i && 0 < j && S[i-1] == T[j-1] {
				dp[i][j] += dp[i-1][j-1]
				dp[i][j] %= mod
			}
			if 0 < i {
				dp[i][j] += dp[i-1][j]
				dp[i][j] %= mod
			}
			if 0 < j {
				dp[i][j] += dp[i][j-1]
				dp[i][j] %= mod
			}
			if 0 < i && 0 < j {
				dp[i][j] -= dp[i-1][j-1]
				dp[i][j] %= mod

				if dp[i][j] < 0 {
					dp[i][j] += mod
				}
			}
		}
	}
	fmt.Println(dp[N][M])
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}
type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 33920
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int n = sc.nextInt();
        Integer val;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            val = sc.nextInt();
            if (!list.contains(val)) {
                list.add(val);
            }
        }
        // 出力
        System.out.println(list.size());
    }
}


Measured memory_bytes: 21844
line = ["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"]
s = input()

# for i in line:
#     if i == s:
#         print(line)
# print(len(line))

for i in range(len(line)):
    # print(line[i])
    if line[i] == s:
        print(line[i + 1])

Measured memory_bytes: 3060
H,W,K=map(int,input().split())
if W==1:
    print(1)
    quit()

INF=1e9+7
dp=[[0]*W for i in range(H+1)]
dp[0][0]=1
d=W-1
a=max(0,d-1)
b=max(0,d-2)
f=max(0,d-3)
dic={0:0,1:1,2:2,3:4,4:7,5:12,6:20}
a=dic[a]+1
b=dic[b]+1
f=dic[f]+1
def func(w):
    c=dic[w-1]+1
    e=dic[d-w-1]+1
    return c*e
def func1(w):
    c=dic[w-1-1]+1
    e=dic[d-w-1]+1
    return c*e
def func2(w):
    c=dic[w-1]+1
    e=dic[d-w-1-1]+1
    return c*e
for i in range(H):
    for w in range(W):
        if w==0:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        elif w==W-1:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w-1]*b)
            dp[i+1][w]%=INF
        elif w==1 :
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*b)+(dp[i][w+1]*f)
            dp[i+1][w]%=INF
        elif w==W-2:
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*f)+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        else:
            dp[i+1][w]=(dp[i][w]*func(w))+(dp[i][w-1]*func1(w))+(dp[i][w+1]*func2(w))
            dp[i+1][w]%=INF

print(int(dp[H][K-1]%INF))


Measured memory_bytes: 38256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define here  cout<<"Here"<<endl;


//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

signed main(){
  int N;cin>>N;
  vector<int> A(N),ans(N,0);
  REP(i,0,N){
    cin>>A[i];
  }
  bool ans_f=true;
  RREP(i,N,0){
    int tmp_i=i,tmp=0;
    while(tmp_i<N+1){
      tmp+=ans[tmp_i-1];
      tmp_i+=i;
    }
    tmp+=A[i-1];
    tmp%=2;
    if(tmp==1){ans[i-1]=1;}
    else {ans[i-1]=0;}
  }
  vector<int> vec;
  int cnt=0;
  REP(i,0,N){
    if(ans[i]==1){
      vec.push_back(i+1);
      cnt++;
    }
  }
  print(cnt)
  REP(i,0,vec.size()){
    print(vec[i])
  }

}


Measured memory_bytes: 5108
#include <algorithm>
#include <iostream>
#include <list>
#include <map> //連想配列
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector> //動的配列

#define rep(i, n) for (int i = 0; i < N; i++)

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


Measured memory_bytes: 256
X, N = [int(i) for i in input().split(' ')]
p_str = input()
p = [] if len(p_str) == 0 else [int(i) for i in p_str.split(' ')]

sorted(p)

j = 0 
while True:
  a = p.count(X+j)
  b = p.count(X-j)
  if b == 0:
    ans = X - j
    break
  if a == 0:
    ans = X + j
    break 
  j += 1

print(ans)

Measured memory_bytes: 9196
import java.util.Scanner;

public class Main {

	public static void main (String[] args)  {

		Scanner sc = new Scanner(System.in);
		
		int[] a = new int[] {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 s = sc.nextInt();
		
		
		System.out.println(a[s-1]);


	}




}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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

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

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 a, b;
	cin >> a >> b;
	string aa = to_string(a), bb = to_string(b);
	if (aa < bb) {
	  REP(i, b) {
	    cout << aa;
	  }
	} else {
	  REP(i, a) {
	    cout << bb;
	  }
	}
	cout << endl;
}


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}


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

int main(){
  string N,ans;
  ans = "No";
  cin>>N;
  if(N.at(0)=='7'||N.at(1)=='7'||N.at(2)=='7')ans ="Yes";













  cout<<ans<<endl;
}


Measured memory_bytes: 3600
#include <stdio.h>

int main(void)
{
	int i, j, k, a, b, dice[2][7],
		side[5] = { 2, 3, 5, 4, 2 },
		n = 0;

	for (i = 0; i<2; i++)
		for (j = 1; j<7; j++)
			scanf("%d", &dice[i][j]);

	for (i = 0; i<6; i++){
		if (dice[0][1] == dice[1][1])
			for (j = 0; j<4; j++){
				
				for (k = 1; k<7; k++)
					if (dice[0][k] != dice[1][k]) break;

				if (k == 7){
					printf("Yes\n");
					return 0;
				}
				
				dice[1][0] = dice[1][2];
				dice[1][2] = dice[1][3];
				dice[1][3] = dice[1][5];
				dice[1][5] = dice[1][4];
				dice[1][4] = dice[1][0];


			}		

		dice[1][0] = dice[1][1];

		switch (i){

		case 2:
			dice[1][1] = dice[1][3];
			dice[1][3] = dice[1][6];
			dice[1][6] = dice[1][4];
			dice[1][4] = dice[1][0];
			break;

		default:
			dice[1][1] = dice[1][2];
			dice[1][2] = dice[1][6];
			dice[1][6] = dice[1][5];
			dice[1][5] = dice[1][0];
			break;

		}
	}

	printf("No\n");
	return 0;

}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll h,w;
  	ci(h>>w);
  vst A(h);
  FOR(i,0,h){
    ci(A[i]);
  }
  st s;
  FOR(i,0,w){
    s+='.';
  }

  FOR(i,0,h){
    if(A[i]==s) continue;
    
    else{
    FOR(j,0,w){
      bool b=false;
      FOR(k,0,h){
        if(A[k][j]!='.'){
          b=true;
            break;
        }
      }
        if(b) cout<<A[i][j];
    }
    }
    co(" ")
  }
}

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

#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define init(a, x) memset(a, x, sizeof(a))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	
	int x, k, d;

	cin >> x >> k >> d;
	x = abs(x);

	int quo = x / d;
	
	int res1 = 1e18, res2 = 1e18;
	if ((quo <= k) && ((k - quo) % 2 == 0) ){
		res1 = x - (quo * d);		
	} 
	if ((quo <= k + 1) && ((k - quo - 1) % 2 == 0)){
		res2 = x - ((quo + 1) * d);

	} 
	if (quo > k){
		res1 = x - (k * d);
	}

	int res = min(abs(res1), abs(res2));
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3604
/*---> praveenojha33 <---> 01 September 2019 <--- > 17:28:12 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
	string s,t;
	cin>>s>>t;
	int ans=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i])
			ans++;
	}
	cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < (ll)n; i++)




int main() {
    ll r, c, n;
    cin >> r >> c >> n;
    vector<pair<ll, ll>> ue, migi, sita, hidari;
    REP(i, n){
        ll x1, y1, x2, y2;
        cin >> y1 >> x1 >> y2 >> x2;
        if((x1 == 0 || x1 == c || y1 == 0 || y1 == r) && (x2 == 0 || x2 == c || y2 == 0 || y2 == r)){
            if(y1 == 0) ue.push_back({x1, i});
            else if(x1 == c) migi.push_back({y1, i});
            else if(y1 == r) sita.push_back({x1, i});
            else hidari.push_back({y1, i});
            
            if(y2 == 0) ue.push_back({x2, i});
            else if(x2 == c) migi.push_back({y2, i});
            else if(y2 == r) sita.push_back({x2, i});
            else hidari.push_back({y2, i});
        }
    }
    
    sort(ue.begin(), ue.end());
    sort(migi.begin(), migi.end());
    sort(sita.begin(), sita.end(), greater<pair<ll, ll>>());
    sort(hidari.begin(), hidari.end(), greater<pair<ll, ll>>());
    
    vector<ll> v;
    REP(i, ue.size()) v.push_back(ue[i].second);
    REP(i, migi.size()) v.push_back(migi[i].second);
    REP(i, sita.size()) v.push_back(sita[i].second);
    REP(i, hidari.size()) v.push_back(hidari[i].second);
    
    stack<ll> s;
    REP(i, v.size()){
        if(s.empty()) s.push(v[i]);
        else if(s.top() != v[i]) s.push(v[i]);
        else s.pop();
    }
    
    if(s.empty()) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 7216
#include <bits/stdc++.h>
using namespace std;
struct parent
{
	int x,y;
};

int main()
{
	string s,t;
	cin>>s>>t;
	char dp[s.size()+1][t.size()+1];
	parent p[s.size()+1][t.size()+1];
	int length[s.size()+1][t.size() + 1];
	for(int i=0; i<=s.size(); i++)
	{
		dp[i][0]='*';
		length[i][0]=0;
	}
	for(int i=0; i<=t.size(); i++)
	{
		dp[0][i]='*';
		length[0][i]=0;
	}
	for(int i=1; i<=s.size(); i++)
	{
		for(int j=1; j<=t.size(); j++)
		{
			if(s[i-1] == t[j-1])
			{
				dp[i][j] = s[i-1];
				p[i][j].x = i-1;
				p[i][j].y = j-1;
				length[i][j]=length[i-1][j-1]+1;
			}
			else
			{
				if(length[i][j-1] >= length[i-1][j])
				{
					dp[i][j] = dp[i][j-1];
					p[i][j].x = p[i][j-1].x;
					p[i][j].y = p[i][j-1].y;
					length[i][j] = length[i][j-1];
				}
				else
				{
					dp[i][j] = dp[i-1][j];
					p[i][j].x = p[i-1][j].x;
					p[i][j].y = p[i-1][j].y;
					length[i][j] = length[i-1][j];
				}
			}
		}
	}
	int i=s.size(),j=t.size(),ti,tj;
	string ans;
	while(!(dp[i][j] == '*'))
	{
		ti=i;
		tj=j;
		//cout<<dp[i][j];
		ans = dp[i][j] + ans;
		i=p[ti][tj].x;
		j=p[ti][tj].y;
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 114560
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
dp = [0 for i in range(n+1)]
if a[0] != 0:
    print(0)
    exit()
dp[0] = 3
r,g,b = 1,0,0
for i in range(1,n):
    if a[i] == r:
        if r == g and g == b:
            dp[i] = dp[i-1]*3
        elif r == g or r == b:
            dp[i] = dp[i-1]*2
        else:
            dp[i] = dp[i-1]
        dp[i] %= mod
        r += 1
    elif a[i] == g:
        if g == b:
            dp[i] = dp[i-1]*2
        else:
            dp[i] = dp[i-1]
        dp[i] %= mod
        g += 1
    elif a[i] == b:
        dp[i] = dp[i-1]
        b += 1
    else:
        dp[i] = 0
print(dp[n-1])

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

int main(){
    long long x, y;
    cin >> x >> y;
    long long cnt = 0;
    while(x <= y){
        x *= 2;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256