akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;

int main() {
 string s;
  cin>>s;
  /////
  int  ans=0;
  int n=s.size();
  rep(i,n-1){
    if(s[i]==s[i+1]){
      ans++;
        if(s[i+1]=='0') s[i+1]='1'; 
        else          s[i+1]='0';
    }
    //cout<<s[i]<<s[i+1]<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[222222];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}

signed main(){
	int n,a[22],ans=0;
	cin>>n;
	rep(i,n)cin>>a[i];
	for(int i=1;i<n-1;i++){
		int ma=max({a[i-1],a[i],a[i+1]});
		int mi=min({a[i-1],a[i],a[i+1]});
		if(a[i]!=ma&&a[i]!=mi)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 764
#define _CRT_SECURE_NO_DEPRECATE
#include<cstdio>
using namespace std;
typedef long long int ll;
int ans = 0;
ll T;
void DFS(ll n,bool r3,bool r5,bool r7) {
	if (n <= T) {
		if (r3&&r5&&r7)
			ans++;
		DFS(n * 10 + 3, true, r5, r7);
		DFS(n * 10 + 5, r3, true, r7);
		DFS(n * 10 + 7, r3, r5, true);
	}
}

int main() {
	scanf("%ld", &T);
	DFS(0,false,false,false);
	printf("%d\n", ans);
	getchar();getchar();
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
#define int long long int 
#define F first
#define S second
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL);
const int MOD = 998244353;
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp>  
//using namespace __gnu_pbds; 
//stringstream ss; string temp; ss<<str(original string) ss>>temp;


int32_t main()
{	
	
  	
  	int n; cin>>n;
  	int a[n];
  	for(int i=0;i<n;i++)
  	{
  		cin>>a[i];
  	}

  	int coff = 2*a[0];
  	int x = -1;
  	for(int i=1;i<n;i++)
  	{
  		coff = 2*a[i] - coff;
  		//cout<<coff<<" ";
  		x*=(-1); 
  	}

  	int ok = coff/2;

  	cout<<ok<<" ";
  	for(int i=1;i<n;i++)
  	{
  		cout<<2*a[i-1] - ok<<" ";
  		ok = 2*a[i-1] - ok;
  	}
	return 0;
} 


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int r,g;
  cin >> r >> g;
  cout << 2*g-r << endl;

  return 0;
}


Measured memory_bytes: 256
alpha = input()

if alpha=="a" or alpha=="b" or alpha=="c" or alpha=="d" or alpha=="e" or alpha=="f" or alpha=="g" or alpha=="h" or alpha=="i" or alpha=="j" or alpha=="k" or alpha=="l" or alpha=="m" or alpha=="n" or alpha=="o" or alpha=="p" or alpha=="q" or alpha=="r" or alpha=="s" or alpha=="t" or alpha=="u" or alpha=="v" or alpha=="w" or alpha=="x" or alpha=="y" or alpha=="z":
    print("a")
else:
    print("A")


Measured memory_bytes: 9060
using System;
using System.Linq;

namespace apc001_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long ret1 = 0; long ret2 = 0;
            for (int i = 0; i < n; i++)
            {
                if (a[i] > b[i]) ret1 += a[i] - b[i];
                else if (a[i] < b[i]) ret2 += (b[i] - a[i] + 1) / 2;
            }
            Console.WriteLine(Math.Max(ret1,ret2) <= b.Sum() - a.Sum() ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 13536
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}

int main(void){
    int n;
    int x[105]; 
    int y[205] = {0};
    int min = 1000000000;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &x[i]);
    }
    for (int i = -100; i <= 100; i++){
        for (int j = 0; j < n; j++){
            y[i+100] += (x[j]-i)*(x[j]-i);
        }
    }

    for (int i = 0; i < 201; i++){
        min = min<y[i]?min:y[i];
    }
    printf("%d\n", min);
    return 0;



}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int id,k,temp2,t,j,n,a,b,c[600010],i,temp;
        scanf("%d%d%d",&n,&a,&b);
        if((b>(n-a+1)) || (b<((n+a-1)/a)))
            cout<<"-1\n";
        else
        {
            for(i=1;i<=n;i++)
                c[i]=n-i+1;
            for(i=1;i<=n;i++)
                if(i+(n-i*a)<b)
                    break;
            i--;
            id=i;
            for(j=1;j<=id;j++)
            for(i=1+(j-1)*a,k=0;i<=(j*a+1+(j-1)*a)/2;i++,k++)
            {
                temp=c[j*a-k];
                c[j*a-k]=c[i];
                c[i]=temp;
            }
            b-=id;
            temp=n-id*a;
            temp-=(b-1);
            for(j=id*a+1,k=1;k<=temp/2;k++,j++)
            {
                temp2=c[id*a+temp-k+1];
                c[id*a+temp-k+1]=c[j];
                c[j]=temp2;
            }
            for(i=1;i<=n;i++)
               printf("%d ",c[i]);
           cout<<endl; 
        }
    return 0;
}

Measured memory_bytes: 4096
import math
a,b,x=[int(i) for i in input().split(" ")]

V=a*a*b
if x>0.5*V:
    sita=math.atan(2*(V-x)/a/a/a)
else:
    sita=math.atan(a*b*b/2/x)
print(math.degrees(sita))


Measured memory_bytes: 3060
n,a,b=map(int,input().split())
N=10**9+7
def modpow(a,n,p):#a^n mod p ,O(log n)
    res=1
    while n>0:
        if n&1:#１とのビット論理積が１、つまり奇数
            res=res*a%p
        a=a*a%p
        n>>=1
        #ビットの右シフト_2進数表記のnを小数点を固定して右に１桁ずらす_１桁小さくなる
    return res
cmban=1
faca=1
cmbbn=1
facb=1
for i in range(a):
    cmban=cmban*(n-i)%N
    faca=faca*(i+1)%N
for i in range(b):
    cmbbn=cmbbn*(n-i)%N
    facb=facb*(i+1)%N
print((modpow(2,n,N)-cmban*modpow(faca,N-2,N)%N-cmbbn*modpow(facb,N-2,N)%N-1)%N)


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

int main () {
  int N,K,A;
  cin >> N >> K;
  A = 1;
  for (int i=0;i<N;i++) {
    if ( A*2 < A + K ) A = A*2;
    else A = A + K;
  }
  cout << A << endl;
}


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

typedef long long ll;

#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, m; cin >> n >> m;
	int h[n];
	for (int i = 0; i < n; ++i) cin >> h[i];
	int good[n] = {0};
	for (int i = 0; i < m; ++i) {
		int a, b; cin >> a >> b;
		a -= 1;
		b -= 1;
		if (h[a] < h[b]) good[a] = 1;
		else if (h[b] < h[a]) good[b] = 1;
		else {
			good[a] = 1;
			good[b] = 1;
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (good[i] == 0) ans++;
	}
	cout << ans << "\n"; 
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* print new lines
*/


Measured memory_bytes: 4348
#include<bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
        int N; cin>>N;
        double ans=0;
        REP(i,N){
                double x; cin>>x;
                string s; cin>>s;
                if(s[0]=='J') ans+=x;
                else ans+=380000*x;
        }
        cout<<fixed<<setprecision(10)<<ans<<endl;

}


Measured memory_bytes: 256
x, y = map(int, input().split())

ga = [4,6,9,11]
gb = [1,3,5,7,8,10,12]
gc = [2]

xg = yg = ""
def group(x):
  if x in ga:
    return "ga"
  if x in gb:
    return "gb"
  if x in gc:
    return "gc"
xg = group(x)
yg = group(y)
if xg == yg:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9020
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int n;
void solve(){
  
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  sort(a.begin(),a.end());
  int ans = 1<<30;
  REP(i,n-1) ans = min(ans,a[i+1]-a[i]);

  cout << ans << endl;
}

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

  //int q; cin >> q;
  //while(q--) solve();
  while(cin >> n, n) solve();

  return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;

int main() {
  int n, y;
  cin >> n >> y;
  rep(i, 0, n+1) {
    rep(j, 0, n+1) {
      if(n-(i+j) >= 0 && y-(i*10000+j*5000) >= 0 && i*10000+j*5000+(n-i-j)*1000 == y) {
        cout << i << " " << j << " " << n-(i+j) << "\n";
        return 0;
      }
    }
  }
  cout << "-1 -1 -1\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long Int;

Int n, m, x, y;
vector<int> edges[110000];
Int dist[110000];
Int visited[110000];

void dfs(Int v) {
  if (visited[v]) {
    return;
  }
  visited[v] = 1;

  for (Int v2 : edges[v]) {
    dfs(v2);
    dist[v] = max(dist[v2] + 1, dist[v]);
  }
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    edges[x].push_back(y);
  }

  for (int i = 0; i < n; i++) {
    if (visited[i] == 1) {
      continue;
    }
    dfs(i);
  }

  Int ans = 0;
  for (Int d : dist) {
    ans = max(ans, d);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12844
N = int(input())
Hs = list(map(int, input().split()))
Hs = Hs[::-1]
max_h = Hs[0]
flag = 0
min_h = 0
for idx in range(1, N):
    if max_h < Hs[idx]:
        if (Hs[idx] - max_h) == 1:
            Hs[idx] -= 1
        else:
            flag = 1
            break
    max_h = Hs[idx]
if flag == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14396
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>

using namespace std;

const int maxn = 2e5 + 10;
bool know[maxn];
int ans[maxn];
int n;
int a(string s){
	if(s == "Vacant")
		return 0;
	else if(s == "Male")
		return 1;
	else
		return 2;
}
int main(){
	cin >> n;
	cout << 0 << endl;
	cout.flush();
	string cur;
	cin >> cur;
	ans[0] = a(cur);
	if(ans[0] == 0)
		return 0;
	know[0] = 1;
	int l = 0 , r = n - 1;
	while(l < r - 2){
		int mid = (l + r) >> 1;
		cout << mid << endl;
		cout.flush();
		cin >> cur;
		ans[mid] = a(cur);
		if(ans[mid] == 0){
			return 0;
		}
		know[mid] = 1;
		if(know[l]){
			if(((ans[l] == ans[mid]) + (mid - l + 1)) & 1)
				r = mid;
			else
				l = mid;
		}
		else{
			if(((ans[mid] == ans[r]) + (r - mid + 1)) & 1)
				l = mid;
			else
				r = mid;
		}
	}
	for(int i = l ; i < r ; ++ i){
		cout << i << endl;
		cout.flush();
		cin >> cur;
		ans[i] = a(cur);
		if(ans[i] == 0)	return 0;
	}
	cout << r << endl;
	cout.flush();
	return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int a, b; cin >> a >> b;
	cout << (b - 1 + a - 2) / (a - 1) << endl;

	return 0;
}


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

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

  if(s[0] != 'A'){
    cout << "WA" << endl;
    return 0;
  }

  int foundC = 0;
  for(int i = 1; i < (int)s.length(); i++){
    if(s[i] == 'C' && i > 1 && i < (int)s.length()-1){
      if(foundC){
        cout << "WA" << endl;
        return 0;
      } else{
        foundC = 1;
        continue;
      }
    }
    if(s[i] < 'a' || s[i] > 'z'){
      cout << "WA" << endl;
      return 0;
    }
  }

  if(!foundC) cout << "WA" << endl;
  else cout << "AC" << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

// mod
int mod = 1e9 + 7;

struct mint {
    unsigned x;

    mint() : x(0) {}

    mint(signed sig) { x = sig < 0 ? sig % mod + mod : sig % mod; }

    mint(signed long long sig) { x = sig < 0 ? sig % mod + mod : sig % mod; }

    int get() const { return (int) x; }

    mint& operator+=(mint that) {
        if ((x += that.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(mint that) {
        if ((x += mod - that.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator*=(mint that) {
        x = (unsigned long long) x * that.x % mod;
        return *this;
    }

    mint& operator/=(mint that) { return *this *= that.inverse(); }

    mint operator+(mint that) const { return mint(*this) += that; }

    mint operator-(mint that) const { return mint(*this) -= that; }

    mint operator*(mint that) const { return mint(*this) *= that; }

    mint operator/(mint that) const { return mint(*this) /= that; }

    mint inverse() const {
        long long a = x, b = mod, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            std::swap(a, b);
            u -= t * v;
            std::swap(u, v);
        }
        return mint(u);
    }

    bool operator==(mint that) const { return x == that.x; }

    bool operator!=(mint that) const { return x != that.x; }

    mint operator-() const {
        mint t;
        t.x = x == 0 ? 0 : mod - x;
        return t;
    }
};

class ESumOfGcdOfTuplesHard {
public:
    mint binpow(mint x, int p) {
        if (p == 0) return 1;

        if (p % 2 == 0)
            return binpow(x * x, p / 2);
        else
            return x * binpow(x, p - 1);
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, K;
        cin >> N >> K;

        map<int, mint> cnt;
        mint res = 0;
        for (int i = K; i >= 1; i--) {
            mint val = K / i;
            mint num = binpow(val, N);

            for (int j = 2; i * j <= K; j++) {
                num -= cnt[i * j];
            }

            res += num * i;
            cnt[i] = num;
        }
        cout << res.get() << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ESumOfGcdOfTuplesHard solver;
    solver.solve(in, out);
    return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


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

    for(int i = x; i > 0; i--){
        for(int j = 2; j * j <= i; j++){
            int n = j;
            while(n < i) n *= j;
            if(n == i){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	int a, b, k[100005], ans;
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		cin >> k[i];
		ans = gcd(ans, abs(k[i] - b));
	}
	cout << ans << endl;
}

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

int main(){
  int a,b,c,d,max=0,flag=0;
  cin>> a>>b;
  for(int i=0;i<a;i++){    
    //if(b>max)max=b;
    cin>>c>>d;
    b+=c-d;
    if(b<0)flag=1;
    else if(b>max)max=b;
  }
  if(flag!=1)cout<<max<<endl;
  else cout<<"0"<<endl;
  return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

/*lli RepeatSquaring(lli N, lli P){
    if(P==0) return 1;
    if(P%2==0){
        lli t = RepeatSquaring(N, P/2);
        return t*t;
    }
    return N * RepeatSquaring(N, P-1);
}//繰り返し二乗法




lli zenbu(lli ket){
lli ret;
  ret=RepeatSquaring(3, ket)-3*RepeatSquaring(2, ket)+3;
  return ret;
}

int main(){
  lli N;
  cin >> N;
  lli keta;
  keta=log10(N);
  lli ans=0;
  if(keta<2){
    cout << 0 << endl;
    return 0;
  }
  else if(keta==2){
  if(N/100<3)
    cout << 0 << endl;
    else if(N/100<5)
    cout << 2 << endl;
    else if(N/100<7)
    cout << 4 << endl;
    else    
      cout << 6 << endl;
    return 0;
  }
  
  else {
    ans+=zenbu(keta);
  if(N/RepeatSquaring(10,keta)<3)
    ans+=0;
    else if(N/RepeatSquaring(10,keta)<5){
    ans+=RepeatSquaring(2,keta)-2;
    }
    else if(N/RepeatSquaring(10,keta)<7){
      ans*=2;
    ans+=RepeatSquaring(2,keta)-2;
    ans+=RepeatSquaring(2,keta)-2;
    }
    else    {
      ans=0;
      ans=zenbu(keta+1);
    }
  }
  cout << ans << endl;
}*/

//generate pattern

int main(){
  int N,T,A;
  cin >> N >> T >> A;
  double Height[N];
  
  
  int ans=0;
  double ansjudge=10000000;
  rep(i, N){
  cin >> Height[i];
    if(abs(T-Height[i]*0.006-A)<ansjudge)
      ans=i+1;
    ansjudge=min(abs(T-Height[i]*0.006-A),ansjudge);
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
char s[110][110];
short f[101][101][101][101];
short sum1[101][101],sum2[101][101];
short query1(int x,int l,int r){
	if(l>r)return 0;
	return sum1[r][x]-sum1[l-1][x];
}
short query2(int x,int l,int r){
	if(l>r)return 0;
	return sum2[x][r]-sum2[x][l-1];
}
void cxk(short&a,short b){if(b>a)a=b;}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi(),ex,ey;
	for(int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j){
			if(s[i][j]=='E')ex=i,ey=j;
			sum1[i][j]=sum2[i][j]=s[i][j]=='o';
			sum1[i][j]+=sum1[i-1][j];
			sum2[i][j]+=sum2[i][j-1];
		}
	memset(f,-63,sizeof f);
	f[ex][ex][ey][ey]=0;
	short ans=0;
	for(int u=ex;u<=n;++u)
		for(int d=ex;d;--d)
			for(int r=ey;r<=m;++r)
				for(int l=ey;l;--l){
					int D=1+(u-ex),U=n-(ex-d),L=1+(r-ey),R=m-(ey-l);
					cxk(ans,f[d][u][l][r]);
					if(L<l)cxk(f[d][u][l-1][r],f[d][u][l][r]+query1(l-1,std::max(D,d),std::min(U,u)));
					if(r<R)cxk(f[d][u][l][r+1],f[d][u][l][r]+query1(r+1,std::max(D,d),std::min(U,u)));
					if(D<d)cxk(f[d-1][u][l][r],f[d][u][l][r]+query2(d-1,std::max(L,l),std::min(R,r)));
					if(u<U)cxk(f[d][u+1][l][r],f[d][u][l][r]+query2(u+1,std::max(L,l),std::min(R,r)));
				}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 203520
M,D=map(int,input().split())
counter=0
for i in range(1,M+1):
    for j in range(1,D+1):

        if j<10:
            continue
        else:
            k=str(j)
            if int(k[0])>=2 and int(k[1])>=2:
                if int(k[0])*int(k[1])==i:

                    counter+=1
print(counter)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;


void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int N;
    cin >> N;
    int r[N];
    REP(i,N)cin >> r[i];
    trace(r,N);
    for(int i=1;i<N;i++){
        int value = r[i],j = i-1;
        while(j>=0 && r[j] > value){
            r[j+1] = r[j];
            j--;
        }
        r[j+1] = value;
        trace(r,N);
    }
}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;cin >> n >> m;
    ll a[n];vector<pp> v;
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i];
    }
    sort(a,a+n);
    for (int i = 0; i < m; ++i)
    {
    	ll b,c;cin >> b >> c;
    	v.push_back({c,b});
    }
    sort(v.begin(),v.end(),greater<pp>());
    ll d=0;
    for (int i = 0; i < n; ++i)
    {
    	if(d==v.size())break;
    	if(v[d].second==0)d++;
    	if(v[d].first>a[i])
    	{
    		a[i]=v[d].first;v[d].second--;
    	}
    	else break;
    }
    ll ans=0;
    for (int i = 0; i < n; ++i)
    {
    	ans+=a[i];
    }
    cout << ans;
    }

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main(){
  int n,i;
  cin >> n;
  int p[n+1],x;
  for(i=0;i<n;i++){
    cin >> x;
    p[i]=x;
  }
  long long a[n]={},b[n]={};
  a[0]=n+1;b[0]=n*n+1;
  for(i=1;i<n;i++){
    a[i]+=a[i-1]+n+1;
    b[i]=b[i-1]-n;
  }
  for(i=0;i<n;i++){
    a[p[i]-1]+=i-p[i];
  }
  for(i=0;i<n;i++)cout << a[i] << " ";
  cout << endl;
  for (i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); }

void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writerLn(int x) { writer(x, '\n'); }

vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000]{ 1 }, cnt = 1;
char b[200000], ok[100000]{ 1 };
deque<int>que;

void bfs(int u, char t) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (t) {
				if (d[v] > d[p] && !ok[v]) {
					ok[v] = 1; cnt++; que.emplace_back(v);
				}
			}
			else if (!d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(&n); reader(&m); reader(&q);
	rep(i, m) {
		reader(&u[i]); reader(&v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	bfs(0, 0);
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(&r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
		}
	}
	bfs(0, 1);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]], 1);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 13424
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int r;
    cin >> r;
    cout << 3 * r * r << endl;

}

Measured memory_bytes: 256
def solve():
    R,G,B,N = map(int,input().split())
    ans = 0
    for r in range(N // R + 1):
        for g in range(N // G + 1):
            rest = N - r * R - g * G
            if rest >=0 and rest % B == 0:
                ans += 1
                #print(r,g,rest//B)
    return ans

print(solve())


Measured memory_bytes: 2940
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
int mod;
ll n;
ll x;
ll ans[100005];
ll val[100005];
int vis[100005];
int fDate[100005];



int main() {
	scanf("%lld %d %d",&n,&x,&mod);
	ans[1]=x;
	val[1]=x;
	vis[x]=1;
	fDate[x]=1;
	ll l,r;
	bool f=0;
	for(int i=2;i<=n;i++) {
		val[i]=(val[i-1]*val[i-1])%mod;
		ans[i]=ans[i-1]+val[i];
		vis[val[i]]++;
		if(vis[val[i]]==2) {
			//fDate[curF] to i-1 is a complete cycle!
			l=fDate[val[i]];
			r=i-1;
			f=1;
			break;
		}
		fDate[val[i]]=i;
	}
	if(f) {
		ll cycleSum=ans[r]-ans[l-1];
		ll remain=n-r;
		ll trueAns=ans[r];
		trueAns+=remain/(r-l+1)*cycleSum;
		ll leftCnt=remain%(r-l+1);
		int y=0;
		while(leftCnt--) {
			trueAns=trueAns+val[l+y];
			y++;
		}
		printf("%lld",trueAns);
	}else {
		printf("%lld",ans[n]);
	}
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	ll a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	ll ans = 0;
	ans += min(k, a);
	k -= min(k, a);
	if (k > 0) k -= min(k, b);
	if (k > 0) ans -= min(k, c);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3824
import Text.Printf

ans :: Int -> (Int,Int,Int)
ans n =
  let s = n `mod` 60
      m = ( n `div` 60 ) `mod` 60
      h = ( n `div` 3600 )
  in (h,m,s)

main = do
  l <- getLine
  let n = read l
      (h,m,s) = ans n
  printf "%d:%d:%d\n" h m s

Measured memory_bytes: 3640
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    x = sorted(A)
    for i in A:
        if(i == x[-1]):
            print(x[-2])
        else:
            print(x[-1])
            
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14056
#include<bits/stdc++.h>
using namespace std;
#define int long long 
typedef long long ll;
typedef pair<int,int>pi;
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S |= (1<<j))
#define clearBit(S, j) (S &= ~(1<<j))

map<pi, int> edgeid;
vector<int> adjList[55];
int N,M,par[55],d[55],x[55];
vector<int> cons[55];

int cnt;
void dfs(int u, int p){
	par[u]=p;
	d[u]=d[p]+1;
	for (auto v:adjList[u]){
		if (v==p)continue;
		dfs(v,u);
	}
}

vector<int> findpath(int x, int y){
	vector<int> res;
	while (x!=y){
		if (d[x]>d[y]){
			res.pb(edgeid[{x,par[x]}]);
			x=par[x];
		}
		else{
			res.pb(edgeid[{y,par[y]}]);
			y=par[y];
		}
	}
	return res;
}

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	FOR(i,1,N-1){
		int a,b;cin>>a>>b;
		if(a>b) swap(a,b);
		adjList[a].pb(b);
		adjList[b].pb(a);
		edgeid[{a,b}]=i;
		edgeid[{b,a}]=i;
	}
	dfs(1,0);
	cin>>M;
	FOR(i,0,M-1){
		int a,b;cin>>a>>b;
		cons[i]=findpath(a,b);
	}
	int res = (1LL<<(N-1));
	int fails = 0;
	FOR(bm,0,(1<<M)-1){
		memset(x,0,sizeof x);
		int cnt=0, C=0;
		FOR(i,0,M-1){
			if (isOn(bm, i)){
				cnt++;
				for (auto j:cons[i]) x[j]=1;
			}
		}
		FOR(i,1,N-1) C+=x[i];
		if(cnt==0) continue;
		if (cnt%2) fails += 1LL<<(N-1-C);
		else fails -= 1LL<<(N-1-C);
	}
	cout<<res-fails;
}


Measured memory_bytes: 256
//You could not live with your own failure,
//where did that bring you? back to me.
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll lcm(ll a, ll b){return a*b/__gcd(a, b);}
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
#define N 500001
vector<int> adj[N];

void solve()
{
	int n; cin>>n;
	if(n>=30)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

using namespace std;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("outp.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
  	//cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //if(t<T)cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15464
s = input()
g_cnt, p_cnt = 0, 0
ans = 0
for si in s:
    if si == "g":
        if p_cnt < g_cnt:
            p_cnt += 1
            ans += 1
        else:
            g_cnt += 1
    else:
        if p_cnt < g_cnt:
            p_cnt += 1
        else:
            g_cnt += 1
            ans -= 1
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  int max_tmp,result=0;
  while(v.size()!=0){
    max_tmp=*max_element(v.begin(), v.end());;
    auto mng = std::remove(v.begin(), v.end(), max_tmp);
    v.erase(mng, v.end());
    result++;
  }
  cout<<result<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define MP make_pair
#define PB push_back
#define all(a)  a.begin(),a.end()
#define clr(x,val) memset((x),(val),sizeof(x))
#define endl '\n'

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    int sum=(n-1)+(m);
    int era=(n*m)-sum;
    cout<<era;
}


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

using namespace std;

int cnt[100005];
bool check[100005];

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

	int n,m,a,b;
	vector <pair<int,int>> query;

	cin >> n >> m;

	for(int i=0;i<m;i++)
	{
		cin >> a >> b;
		query.push_back(make_pair(a,b));
	}

	for(int i=1;i<=n;i++)
	{
		cnt[i] = 1;
	}
	check[1] = true;

	for(int i=0;i<query.size();i++)
	{
		int a = query[i].first;
		int b = query[i].second;
		cnt[a]-=1;
		cnt[b]+=1;
		if(check[a])
		{
			check[b] = true;
		}
		if(cnt[a]==0)
		{
			check[a] = false;
		}
	}

	int res = 0;

	for(int i=1;i<=n;i++)
	{
		res += check[i];
	}

	cout << res << '\n';
	
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int n;
vector<int> a(1000000);
ll dp[1000000][2];

int main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }

    // initialize
    dp[0][0] = 0;
    dp[0][1] = -INF;

    // DP
    for (int i=0;i<n;i++) {
       dp[i+1][0] = max(dp[i][0]+a[i], dp[i][1]-a[i]);
       dp[i+1][1] = max(dp[i][0]-a[i], dp[i][1]+a[i]);
       // cout << i << " " << dp[i][0] << endl;
    }
    ll ans = dp[n][0];
    cout << ans << endl;
}

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

#include <set>
#include <iterator>
using namespace std;
// using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF (ll)1e17
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 9
#define maxmask (1ll<<maxbits)
// typedef tree<pll, null_type, less<pll>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
const int  N=2e5 +10, M=(ll)1e9+1 ;
const int mod =(ll)1e9+7 ,sz=5, MAX=(ll)1e6+10;
string fir="Monocarp",sec="Bicarp";

void work(){
 ll n;
 cin >> n;
 vl a(n),cnt(N,0);
 for(ll i=0;i<n;i++){
    cin >> a[i];
    cnt[a[i]]++;
 }
 ll ans=0;
 for(ll i=1;i<N;i++){
    ans+=(cnt[i]*(cnt[i]-1))/2;
 }
 // cout << ans << "\n";
 for(ll i=0;i<n;i++){
    cout << ans-cnt[a[i]]+1 << "\n";
 }


} 
int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0);
    ll t;
    // cin >> t;
    t=1;
    while(t--){
            work();
    }
   return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include <utility>
#include<unordered_set>
using namespace std;


vector<int> bills(int N,int Y){
	vector<int> output(3,-1);
	if(N <0)
		return output;
	else if(N == 0){ 
		if(Y == 0){
			output = vector<int>(3,0);
			return output;
		}
		else
			return output;
	}
	int n1=0, n2=0, n3=0;
	
	while(n1<=N && 10000*n1 <= Y){
		n2 = 0;
		while(n1+n2 <=N && 10000*n1 + 5000*n2 <= Y){
			n3 = 0;
			while(n1+n2+n3 <=N && 10000*n1 + 5000*n2 + 1000*n3 <= Y){
				if(n1+n2+n3 ==N && 10000*n1 + 5000*n2 + 1000*n3 ==Y){
					output[0] = n1;
					output[1] = n2;
					output[2] = n3;
					return output;
				}
				n3++;
			}
			n2++;
		}
		n1++;
	}
	return output;
}




int main(){
	int N, Y;
	cin>>N>>Y;
	
	vector<int> output = bills(N,Y);
	
	cout<< output[0]<<" "<<output[1]<<" "<<output[2]<<"\n";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
//



int main() {
  int n;
  scanf("%d",&n);
  string s;
  cin>>s;
  vi c(26);
  rep(i,n) c[s[i]-'a']++;
  mint ans = 1;
  rep(i,26) ans *= c[i]+1;
  ans -= 1;
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 512
import sys

# sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    q, h, s, d = read_int_list()
    n = read_int()
    a, b = divmod(n, 2)
    res = min([a * d + b * s,
               a * d + 2 * b * h,
               a * d + 4 * b * q,
               n * s,
               2 * n * h,
               4 * n * q])
    print(res)


main()


Measured memory_bytes: 3064
//shara's here
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,t;
	cin>>n>>t;
	pair<ll,ll> p[n];
	for(ll i=0;i<n;i++){
		cin>>p[i].first>>p[i].second;
		}
	sort(p,p+n);
	bool ok=false;
	for(ll i=0;i<n;i++){
		if(p[i].second<=t){cout<<p[i].first<<endl; ok=true; break;}
		}
	if(!ok)cout<<"TLE"<<endl;
	return 0;
	}


Measured memory_bytes: 256