akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define sz(x)      (int)x.size()
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
 
 
int n;
int A;
int a[100100];
bool baned[1234567];
int alic;
int mx = 0;
int col ;
map < int, int > mm;
int main()
{
    speed;
    int a[3];
    lop(i,3) cin >> a[i];
    sort(a,a+3);
    cout << a[0] + a[1];
    return 0;
}

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

int main() {
	char b;
	char A='A', C='C', G='G', T='T';
	cin >> b;
	
	if(b == A) cout << T;
	else if(b==T) cout << A;
	else if(b==G) cout << C;
	else if(b==C) cout << G;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int gcd(int x,int y){
	if(!y)return x;
	return gcd(y,x%y);
}
int main()
{
	int k; cin>>k;
	long long sum=0;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=k;j++){
			int w=gcd(i,j);
			for(int t=1;t<=k;t++)
				sum+=gcd(w,t);
		}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
int max(int a,int b){return a > b ? a : b;}
int main(){
    char s[11];
    scanf("%s",s);
    int n = strlen(s);
    int a[n];
    for(int i = 0; i < n; i++)
        a[i] = 0;
    for(int i = 0; i < n; i++)
        if(s[i] == 'A' || s[i] =='T' || s[i] == 'G' || s[i] =='C')
            a[i]++;
    int ans = 0;
    int m = 0;
    for(int i = 0; i < n; i++){
        if(a[i])
            m++;
        else{
            ans = max(ans,m);
            m = 0;
        }
    }
    ans = max(ans,m);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

int main(){
	for(int a,b;scanf("%d%d",&a,&b),a;){
		int a_div[100],a_num=0;	for(int i=1;i*i<=a;i++) if(a%i==0) a_div[a_num++]=i;
		int b_div[100],b_num=0;	for(int i=1;i*i<=b;i++) if(b%i==0) b_div[b_num++]=i;

		int ans=INF;
		rep(i,a_num)rep(j,b_num){
			int s[]={a_div[i],a/a_div[i],b_div[j],b/b_div[j]};
			sort(s,s+4);
			ans=min(ans,(s[1]-s[0])*(s[1]-s[0])+(s[2]-s[1])*(s[2]-s[1])+(s[3]-s[2])*(s[3]-s[2]));
		}

		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000

class edge{
public:
    int toid;
    int norm;
    int dist;
    edge(int toid,int norm,int dist){
        this -> toid = toid;
        this -> norm = norm;
        this -> dist = dist;
    }
    bool operator < (const edge &E) const {
        return dist < E.dist;
    }
    bool operator > (const edge &E) const {
        return dist > E.dist;
    }
};

vector<edge> V[10000];
int d[10000];
int count_P = 0;
priority_queue<edge,vector<edge>,greater<edge> > PQ;

void Dijksra(int i,int dist,int n){
    PQ.pop();
    d[i] = dist;
    count_P++;
    if(count_P == n) return;
    
    REP1(k,V[i].size()){
        if (d[V[i][k].toid] == INF && V[i][k].dist > dist + V[i][k].norm){
            V[i][k].dist = dist + V[i][k].norm;
            PQ.push(V[i][k]);
        }
    }
    
    while (d[PQ.top().toid] != INF) PQ.pop();
    if (!PQ.empty()) Dijksra(PQ.top().toid,PQ.top().dist,n);
}

int main(){
    INT(N);
    REP1(i,N) d[i] = INF;
    REP1(i,N){
        int from,n;
        scanf("%d %d",&from,&n);
        REP1(j,n){
            int toid,norm;
            scanf("%d %d",&toid,&norm);
            edge E = edge(toid,norm,INF);
            V[i].push_back(E);
        }
    }
    
    PQ.push(edge(0,0,0));
    Dijksra(PQ.top().toid,0,N);
    
    REP1(i,N){
        printf("%d %d\n",i,d[i]);
    }
    
    return 0;
}

Measured memory_bytes: 12380
#include <iostream>
#include <string>

int main(void)
{
    std::string s, t;
    std::cin >> s;
    for (int i = 0; i < int(s.length()); i += 2)
    {
        t += s[i];
    }
    std::cout << t << std::endl;
    return 0;
}


Measured memory_bytes: 576
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int x, n;
  cin >> x >> n;
  /*
  vector<int> p(n);
  vector<int> orip(n);
  rep(i, n){
    int inp;
    cin >> inp;
    orip[i]=inp;
    if(inp-x>=0){
      p[i]=inp-x;
    } else {
      p[i]=x-inp;
    }
  }
  sort(p.begin(), p.end());
  int ans=-1;
  int prep=-1;
  rep(i, n){
    if(p[i]-prep>=2){
      ans=p[i]-1;
    }
    prep=p[i];
  }
  if(ans==-1){
    ans=p[n-1]+1;
  }
  int minans=x-ans, maxans=x+ans;
  bool minok=true;
  rep(i, n){
    if(minans==orip[i]){
      minok=fakse;
      break;
    }
  }
  if(minok){
    cout << minans << endl;
    return 0;
  }
  */
  int inp;
  vector<int> count(1005);
  rep(i, n){
    cin >> inp;
    count[inp]++;
  }
  if(count[x]==0){
    cout << x << endl;
  } else {
    int xr=x, xl=x;
    while(1){
      xr++;xl--;
      if(xl>=0 && count[xl]==0){
        cout << xl << endl;
        return 0;
      } else if(xr<=101 && count[xr]==0){
        cout << xr << endl;
        return 0;
      }
    }
    /*
    if(xr>100 && xl<=0){
      if(abs(x)<=abs(x-101)){
        cout << 0 << endl;
      } else {
        cout << 101 << endl;
      }
    }
    */
  }
  return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//



int solve(int N, vvi& a) {
    vvi dp(N, vi(3, 0));
    rep(i,3) dp[0][i] = a[0][i];

    for (int t=1; t<N; ++t) {
        rep(i,3) {
            rep(j,3){
                if (j==i) continue;
                amax(dp[t][j], dp[t-1][i]+a[t][j]);
            }
        }
    }
    return *max_element(ALL(dp[N-1]));
}

int main() {
    int N; scanf("%d", &N);
    vvi a(N, vi(3));
    rep(i,N) scanf("%d%d%d", &a[i][0],&a[i][1],&a[i][2]);
    cout << solve(N,a) << endl;
    return 0;
}


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

int main()
{
    int A[101][101] = { 0 };
    int r, c;
    cin >> r >> c;
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cin >> A[i][j];
            A[r][c] += A[i][j];
            A[i][c] += A[i][j];
            A[r][j] += A[i][j];
        }
    }
    for (int i = 0; i <= r; i++) {
        for (int j = 0; j <= c; j++) {
            if (j != 0)cout << ' ';
            cout << A[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>

int		to_ten(int n)
{
	while (1)
	{
		if (n % 10)
			n++;
		if (n % 10 == 0)
			break ;
	}
	return (n);
}

int		diff(int nb)
{
	int diff = 0;
	diff = to_ten(nb) - nb;
	return (diff);
}

int main()
{
	int dish[6];
	int sum = 0;
	int i = 0;
	while (i < 5)
		scanf("%d", &dish[i++]);
	int min = diff(dish[0]);
	int one = 0;
	int max = diff(dish[4]);
	int last = 4;

	i = 0;
	while (i < 5)
	{
		// printf("%d\n", diff(dish[i]));
		if (diff(dish[i]) > 0 && diff(dish[i]) < min)
		{
			min = diff(dish[i]);
			one = i;
		}
		if (diff(dish[i]) > max)
		{
			max = diff(dish[i]);
			last = i;
		}
		i++;
	}
	sum += to_ten(dish[one]);
	i = 0;
	while (i < 5)
	{
		if (i != one && i != last)
			sum += to_ten(dish[i]);
		i++;
	}
	sum += dish[last];
	// printf("%d %d", one, last);
	printf("%d\n", sum);
	return (0);
}

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

using namespace std;

//#define int long long
#define FR first
#define SC second
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

typedef pair<int, int> P;

//const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int dp[5005][5005]; // dp[i][j] := i???????????????????????????j?????????????????´????????°

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  int N, L; cin >> N >> L;
  vector<int> x(N), a(N);
  rep(i, N) cin >> x[i];
  rep(i, N) cin >> a[i];
  rep(i, L) dp[0][i] = 1;
  rep(i, N) rep(j, L) {
    if(j >= x[i]){
      if(a[i] == 0 && j == x[i]) {
	dp[i+1][j+1] = dp[i][j] % mod;
      } else if(a[i] != 0 && (j-x[i]) % a[i] == 0) {
	dp[i+1][j+1] = (dp[i][j] + dp[i+1][j+1-a[i]*(j != x[i])]) % mod;
      } else {
	dp[i+1][j+1] = dp[i+1][j];
      }
    }
  }
  cout << dp[N][L] << endl;
  return 0;
}

Measured memory_bytes: 69924
#include<iostream>
#include<vector>
#include<list>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	int m, n;
	while (cin >> m >> n&&m != 0 && n != 0) {
		list<int>a;
		for (int i = 1; i <= m; i++) a.push_back(i);
		list<int>::iterator it = a.begin(), it2;
		for (int z = 1; z <= n; z++) {
			string b;
			cin >> b;
			if (a.size() != 1) {
				if ((z % 3 == 0 && z % 5 != 0 && b == "Fizz") ||
					(z % 5 == 0 && z % 3 != 0 && b == "Buzz") ||
					(z % 5 == 0 && z % 3 == 0 && b == "FizzBuzz") ||
					(z % 3 != 0 && z % 5 != 0 && b == to_string(z))) {
					it++;
				}
				else {
					it2 = it;
					it2++;
					a.erase(it);
					it = it2;
				}
				if (it == a.end()) {
					it = a.begin();
				}
			}
		}
		it = a.begin();
		while (it != a.end()) {
			if (it == a.begin()) cout << (*it);
			else cout << " " << (*it);
			it++;
		}
		cout << endl;
	}
}

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

#define rep(i,a,n) for (int i = a;i<=b;++i)
#define per(i,a,n) for (int i = n;i>=a;--i)
#define all(x) (x).begin(), (x).end()     
#define SZ(x) ((int)x.size())

typedef vector<int> VI;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef long double ld;

mt19937 mrand(random_device{}());
ll rnd(ll a, ll b) { return a + mrand() % (b - a + 1); }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
      ios::sync_with_stdio(false); cin.tie(0);
#ifdef arrias
      freopen("a.txt", "r", stdin);
#endif
      int n;
      cin >> n;
      int ok = 0;
      while (n) { if (n % 10 == 7)ok = 1; n /= 10; }
      cout << ((ok) ? "Yes" : "No");
      return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}
ll pw10[20];
int main(){

    string s;
    cin>>s;
    if(s.length()==1){
        cout<<s<<endl;
        return 0;
    }
    pw10[0]=1;

    for(int i=1;i<20;i++) pw10[i]=pw10[i-1]*10;
    int n=s.length();
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll t = s[i]-'0';
        ll tmp = pw10[n-1-i];

        ll x = n-2-i;
        for(int j=0;j<n;j++){
            if(i+j>=n-1) continue;
            tmp = tmp + pw10[j]*(1<<x);
            x--;
        }

        tmp = tmp*(1<<i)*t;
        ans+=tmp;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int co=0;
	string s;
	while(cin>>s){
		string tmp=s;
		reverse(all(s));
		if(s==tmp)co++;
	}
	cout<<co<<endl;
}

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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, q;
    cin >> n;
    map<ll, ll> mp;
    ll res = 0;
    rep (i, n) {
        ll a;
        cin >> a;
        res += a;
        mp[a]++;
    }
    cin >> q;
    rep (i, q) {
        ll b, c;
        cin >> b >> c;
        mp[c] += mp[b];
        res -= b * mp[b];
        res += c * mp[b];
        mp[b] = 0;
        cout << res << endl;
    }

    return 0;
}



Measured memory_bytes: 9552
while(1)
$card=gets.chomp.to_s
if $card=="-"
 break
end
num=$card.length#カード枚数を取得
n=gets.to_i #シャッフル回数
for i in 1..n do
h=gets.to_i
#文字列の最初のh文字を最後に
mae=$card[0,h]
ato=$card[h,num]
$card=ato+mae
end
print $card
print"\n"
end


Measured memory_bytes: 8868
#include <iostream>
#define int long long int
using namespace std;
signed main()
{
    int n;
    cin >> n;
    int a[n + 1];
    int count[n + 1] = {0};
    int ans[n + 1];
    int total = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        count[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (count[i] > 1)
            total += (count[i] * (count[i] - 1) / 2);
    }
    for (int i = 1; i <= n; i++)
    {
        if (count[i] > 1)
            ans[i] = total - (count[i] - 1);
        if (count[i] == 1 || count[i] == 0)
            ans[i] = total;
    }
    for (int i = 1; i <= n; i++)
    {
        cout << ans[a[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
const int N=4005;
const int mo=1000000007;
using namespace std;
int f[N][N],inv[N*2],fac[N*2];
int a[200005],b[200005],n,ans;
int C(int x,int y){
	return 1ll*fac[x]*inv[y]%mo*inv[x-y]%mo;
}
int main(){
	scanf("%d",&n);
	fac[0]=inv[0]=inv[1]=1;
	for (int i=2;i<2*N;i++)
		inv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;
	for (int i=1;i<2*N;i++)
		fac[i]=1ll*fac[i-1]*i%mo,
		inv[i]=1ll*inv[i-1]*inv[i]%mo;
	for (int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		ans=(ans+mo-C(2*a[i]+2*b[i],2*a[i]))%mo;
		f[2001-a[i]][2001-b[i]]++;
	}
	for (int i=1;i<N;i++)
		for (int j=1;j<N;j++)
			f[i][j]=(f[i][j]+1ll*f[i-1][j]+f[i][j-1])%mo;
	for (int i=1;i<=n;i++)
		ans=(ans+f[2001+a[i]][2001+b[i]])%mo;
	printf("%d\n",1ll*ans*500000004%mo);
}
			
	
	

Measured memory_bytes: 64512
n = int(input())
p = [int(x) for x in input().split()]

count = 0
for i in range(n-2):
    if p[i] < p[i+1] <= p[i+2]:
        count += 1
    elif p[i] >= p[i+1] > p[i+2]:
        count += 1

print(count)

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

int main(){
    unsigned long n,tmp;
    cin >> n;
    unsigned long a=1;
    int _min = max(1,(int)log10(n)+1);

    for(unsigned long i=2; i<=sqrt(n);i++){
        if(n%i == 0){
            tmp = n;
            tmp /= i;
            _min = (_min, max((int)log10(tmp)+1, (int)log10(i)+1));
        }
    }

    cout << _min << endl;
}

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

int main()
{   int i=0,j,flag[7]={0};
    char s[101];
    scanf("%s",s);
    int l=strlen(s);
        if(s[0]=='k'&&s[1]=='e'&&s[2]=='y'&&s[3]=='e'&&s[4]=='n'&&s[5]=='c'){
            for(j=6;j<l;j++){
                if(s[l-1]=='e'){
                    printf("YES");
                    return 0;
                }
            }
        }else if(s[i]=='k'&&s[i+1]=='e'&&s[i+2]=='y'&&s[i+3]=='e'&&s[i+4]=='n'){
                    if(s[l-2]=='c'&&s[l-1]=='e'){
                        printf("YES");
                        return 0;
                    }
                }
            else if(s[i]=='k'&&s[i+1]=='e'&&s[i+2]=='y'&&s[i+3]=='e'){
                
                    if(s[l-3]=='n'&&s[l-2]=='c'&&s[l-1]=='e'){
                        printf("YES");
                        return 0;
                    
                }
            }else if(s[i]=='k'&&s[i+1]=='e'&&s[i+2]=='y'){
                
                    if(s[l-4]=='e'&&s[l-3]=='n'&&s[l-2]=='c'&&s[l-1]=='e'){
                        printf("YES");
                        return 0;
                    }
                }
            else if(s[i]=='k'&&s[i+1]=='e'){
                
                    if(s[l-5]=='y'&&s[l-4]=='e'&&s[l-3]=='n'&&s[l-2]=='c'&&s[l-1]=='e'){
                        printf("YES");
                        return 0;
                    
                }
            }else if(s[i]=='k'){
               
                    if(s[l-6]=='e'&&s[l-5]=='y'&&s[l-4]=='e'&&s[l-3]=='n'&&s[l-2]=='c'&&s[l-1]=='e'){
                        printf("YES");
                        return 0;
                    
                }
            }

    printf("NO");

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
	long long m,n,max;
	scanf("%lld%lld",&n,&m);
	if(n*2<=m)
	{
	m-=n*2;
	max=n+m/4;
    }
	else
	max=m/2;
	printf("%lld\n",max);
	return 0;
}

Measured memory_bytes: 128
function main(input) {
    var args = input
        .trim()
        .split('\n');
    var length = parseInt(args[0]);
    if (length >= args[1].length) {
        console.log(args[1]);
    } else {
        console.log(args[1].substr(0, length) + '...');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29632
def main():
    from functools import reduce
    class comb_mod:
        mod = 1000000007
        MAX = pow(10, 6)
        fac = [0 for i in range(MAX)]
        finv = [0 for i in range(MAX)]
        inv = [0 for i in range(MAX)]

        def __init__(self):
            self.fac[0], self.fac[1] = 1, 1
            self.finv[0], self.finv[1] = 1, 1
            self.inv[1] = 1
            for i in range(2, self.MAX):
                self.fac[i] = self.fac[i - 1] * i % self.mod
                self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
                self.finv[i] = self.finv[i - 1] * self.inv[i] % self.mod
        def combination(self, n, r):
            if n < r:
                return 0
            if n < 0 or r < 0:
                return 0
            return self.fac[n] * (self.finv[r] * self.finv[n - r] % self.mod) % self.mod
        def combination_mul(self, N, R):
            return reduce(lambda x, y: x * self.combination(y[0], y[1]) % self.mod, zip(N, R), 1)
    x, y = list(map(int, input().split()))
    ans = 0
    C = comb_mod()
    for i in range(x, -1, -2):
        j = (x - i) // 2
        if 2 * i + j == y:
            ans += C.combination(i + j, i)
    print(ans)




if __name__ == '__main__':
    main()


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

typedef struct circle
{
    double x, y;
} cir;

int main()
{
    int n;
    while (cin >> n, n)
    {
        cir c[n];
        char ch;
        rep(i, n) cin >> c[i].x >> ch >> c[i].y;

        int maxv = 0;

        for (double i = 0; i <= 10; i += 0.1)
        {
            for (double j = 0; j <= 10; j += 0.01)
            {
                int cnt = 0;
                rep(k, n)
                {
                    if (sqrt(pow(i - c[k].x, 2) + (pow(j - c[k].y, 2)) <= 1.001))
                        cnt++;
                }
                maxv = max(maxv, cnt);
            }
        }
        OP(maxv);
    }
    return 0;
}


Measured memory_bytes: 3056
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//1 2 3 4 100 1
/*
繋がってるものでクエリを分ける
それぞれで

*/


int main(void){
    int N,val,t_gap;
    scanf("%d",&N);
    int i,t[N+1],x[N+1],y[N+1];
    for(i=1;i<N+1;i++){
        scanf("%d %d %d",&t[i],&x[i],&y[i]);
    }
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for(i=0;i<N;i++){
        t_gap = t[i+1]-t[i];
        val = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(!(t_gap%2==val%2 && t_gap >= val)){
            printf("No\n");
            break;
        }else if(i == N-1){
            printf("Yes\n");
        }
    }

    return 0;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string N;
	cin >> N >> K;
	M = N.size();
	int dp[110][2][4];
	fill(dp[0][0], dp[110][0], 0);
	dp[0][1][0] = 1;
	rep(i, M) rep(tight, 2) rep(j, K + 1) {
		int n = N[i] - '0';

		rep(x, 10) {
			int ni = i + 1, ntight = tight, nj = j;
			if (x != 0)
				nj++;
			if (nj > K)
				continue;
			if (tight) {
				if (x > n)
					continue;
				if (x < n)
					ntight = 0;
			}
			//cout << i << " " << tight << " " << j << " " << x << endl;
			//cout << ni << " " << ntight << " " << nj << " " << endl;
			dp[ni][ntight][nj] += dp[i][tight][j];
		}
	}
	cout << dp[M][0][K] + dp[M][1][K] << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 *   author: bholuakku
**/

#include <bits/stdc++.h>
#define For(i,a,b) for(i=(a); i<(b); i++)
#define rep(i,n) for(i=0; i<(n); i++)
#define Nfor(i,a,b) for(i=(a)-1; i>=(b); i--)
#define dep(i,n) for(i=(n-1);i>=0; i--)
#define mp make_pair
#define pb push_back
#define Auto(a) for(auto &val : a)
#define X first
#define Y second
#define MOD 1000000007
#define MOD1 998244353
#define iterate(A, i) for(auto i = A.begin(); i!=A.end(); i++)
#define mset(A,val,n) memset(A, val, n*sizeof(int))
#define Endl cout<<"\n"
#define Test cout<<"Hello\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<bool> vb;
typedef vector<vector<bool> > vvb;
typedef pair<int, int> pii;
typedef vector<vector<pair<int, int> > > vvp;

int power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y>0){ if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x)%p;} return res;}
int modInverse(ll n) {ll p = MOD;return power(n, p-2, p);}
int min(int a, int b, int c) { return min(a, min(b, c)); }
int max(int a, int b, int c) { return max(a, max(b, c)); }
inline void swap(int &a, int &b) { int t = a; a = b; b = t;}
bool cmp(int a, int b){return a>b;}

ll f(int a, int b, vl &s){
    a++; b++;
    return s[b]-s[a-1];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        //freopen("C:\\Users\\ACER\\Desktop\\Codes\\input.txt", "r", stdin);
    #endif
    int n, L, R,i;
    cin>>n;
    vi A(n); vl sum(n+1, 0);
    rep(i, n) sum[i+1] = sum[i]+A[i];
    vvl dp(n, vl(n));
    for(int &a : A) cin>>a;
    for(L=n-1; L>=0; --L){
        for(R=L; R<n; ++R){
            if(L==R) dp[L][R] = A[L];
            else {
                dp[L][R] = max(A[L]+f(L+1,R,sum)-dp[L+1][R], A[R] + f(L, R-1, sum) - dp[L][R-1]);
            }
        }
    }
    cout<<dp[0][n-1];
    return 0;
}


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

int main() {
  int c[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> c[i][j];
    }
  }

  bool flag = false;
  int c2[3][3];
  for (int up = 0; up <= 100; up++) {
    for (int mid = 0; mid <= 100; mid++) {
      for (int down = 0; down <= 100; down++) {
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            c2[i][j] = c[i][j];
          }
        }
        for (int i = 0; i < 3; i++) c2[0][i] -= up;
        for (int i = 0; i < 3; i++) c2[1][i] -= mid;
        for (int i = 0; i < 3; i++) c2[2][i] -= down;

        int cnt = 0;
        for (int i = 0; i < 2; i++) {
          for (int j = 0; j < 3; j++) {
            if (c2[i][j] == c2[i + 1][j]) cnt++;
          }
        }
        if (cnt == 6) flag = true;
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
  bool operator==(const mint rhs) const { return x == rhs.x; }
  bool operator!=(const mint rhs) const { return x != rhs.x; }
  bool operator<(const mint &a) const{ return x<a.x;};
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



void dfs(int v, int d, const int k, const vector<vector<int> > &G, vector<mint>& dp) {
  int cnt = k - d - 1;
  chmax(cnt, k-2);
  for(auto&& to:G[v]) {
    if (dp[to] != -1) continue;
    dp[to] = cnt--;
    chmax(dp[to], mint(0));
    dfs(to, d+1, k, G, dp);
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n,k;
  cin >> n >> k;
  vector<vector<int> > G(n);
  rep(i,n-1) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  vector<mint> dp(n,-1);
  dp[0] = k;
  dfs(0, 0, k, G, dp);
  mint ans = 1;
  rep(i,n) ans *= dp[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12416
#include<stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfsVisit(int);
void dfs();

int main(){

  int u,v,k,i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  dfs();
  
  return 0;
}

void dfsVisit(int u){
  int v;

  color[u] = GRAY;
  d[u] = ++tt;

  for(v=0;v<n;v++){
    if(M[u][v] == 0)continue;
    if(color[v] == WHITE){
      dfsVisit(v);
    }
  }

  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs(){
  int u;

  for(u=0;u<n;u++)color[u] = WHITE;

  tt = 0;

  for(u=0;u<n;u++){
    if(color[u] == WHITE)dfsVisit(u);
  }

  for(u=0;u<n;u++)printf("%d %d %d\n",u+1,d[u],f[u]);
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

ll dp[101][101];

void nck(ll n,ll k){
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j-1>=0){
				dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
			}
			else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
}

int main(){
	ll n,a,b; cin >> n >> a >> b;
	for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
			dp[i][j]=0;
		}
	}
	nck(n+1,n+1);
	ll v[n];
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	sort(v,v+n);
	reverse(v,v+n);
	ll s[n];
	s[0]=0;
	for(int i=0;i<n;i++){
		s[i+1]=s[i]+v[i];
	}
	printf("%.8f\n",(double)s[a]/a);
	ll cnt=0;
	for(int i=a;i<=b;i++){
		if(s[a]*i==s[i]*a){
			if(i==n){
				cnt++;
				continue;
			}
			ll tmp=0,idx=-1;
			for(int j=0;j<n;j++){
				if(v[i]<v[j])idx=j;
				if(v[i]==v[j])tmp++;
			}
			if(tmp==1){
				cnt++;
				break;
			}
			cnt+=dp[tmp][i-idx-1];
		}
		else{
			break;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 384
using System;
using System.Text;

namespace _078_MagicSquare
{
	class Program
	{
		const int Nothing = 0;

		static void Main ( string[] args )
		{
			StringBuilder[] output = new StringBuilder[15 + 1];

			//pre-processing
			for (int i = 3; i < output.Length; i += 2)
			{
				int[,] square = new int[i, i];

				int x = i / 2;
				int y = i / 2;
				int value = 1;

				y++;
				square[y, x] = value;
				value++;

				int limit = i * i;

				while (value <= limit)
				{
					bool isPadding = false;

					while (true)
					{
						if (isPadding)
						{
							x -= 1;
							y += 1;
							isPadding = false;
						}
						else
						{
							x += 1;
							y += 1;
						}

						x = Range (x, 0, i);
						y = Range (y, 0, i);

						if (square[y, x] == Nothing)
						{
							square[y, x] = value;
							value++;
							break;
						}
						else
						{
							isPadding = true;
						}
					}
				}

				//memory
				output[i] = new StringBuilder (4 * i * i);

				for (int row = 0; row < i; row++)
				{
					for (int col = 0; col < i; col++)
					{
						//?????°??? 4???
						output[i].AppendFormat ("{0,4}", square[row, col]);
					}
					output[i].AppendLine ();
				}
			}

			//input and output
			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				int index = int.Parse (inputStr);
				Console.Write (output[index]);
			}
		}

		static int Range ( int value, int min, int max )
		{
			if (max <= value)
			{
				return min;
			}
			if (value < min)
			{
				return max - 1;
			}
			return value;
		}
	}
}

Measured memory_bytes: 9244
#include<stdio.h>

int main() {
    int a,b;
    scanf("%d%d", &a,&b);
    if(a >= 13) {
        printf("%d\n", b);
    } else if(a >= 6) {
        printf("%d\n", b/2);
    } else {
        printf("0");
    }
    return 0;
}


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

int main() {
  int h, w;
  std::cin >> h >> w;
  std::vector<char> vec(h*w);
  for (int i = 0; i < h*w; i++) {
    std::cin >> vec.at(i);
  }
  
  for (int i = -1; i < h+1; i++) {
	for (int j = -1; j < w+1; j++) {
      if (i == -1 || j == -1 || i == h || j == w) {
        std::cout << '#';
        if (j == w) {
          std::cout << '\n';
        }
      } else {
        std::cout << vec.at(i*w + j);
      }  
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct edge {
    int to;
    ll cost;
};

vector<vector<edge>> G;
vector<bool> path;
vector<ll> dist;
int N, M;
bool f = false;

void dfs(int v, ll cost) {
    if (path[v]) {
        if (dist[v] != cost) {
            f = true;
            return;
        }
    } else {
        path[v] = true;
        dist[v] = cost;
        REP(i, G[v].size()) { dfs(G[v][i].to, cost + G[v][i].cost); }
    }
}

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

    cin >> N >> M;
    G.resize(N);
    path.resize(N, false);
    dist.resize(N, -1);
    REP(i, M) {
        int L, R, D;
        cin >> L >> R >> D;
        L--;
        R--;
        G[L].push_back({R, D});
        G[R].push_back({L, -D});
    }
    dist[0] = 0;
    REP(i, N) {
        if (!path[i]) {
            dist[i] = 0;
            dfs(i, 0LL);
        }
    }

    if (f) {
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 15616
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int a[3][3];
  int x[3];
  int y[3];
  
  rep(i,3){
    rep(j,3){
      cin >> a[i][j];
    }
  }
  
  x[0] = 0;
  rep(i,3) y[i] = a[0][i] - x[0];
  rep(i,3) x[i] = a[i][0] - y[0];
  
  rep(i,3){
    rep(j,3){
      if(a[i][j] != x[i] + y[j]){
        cout << "No";
        return 0;
      }
    }
  }
  
  cout << "Yes";
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

// ????????°????????§??°
#define MAX_V 100000

vector <int> graph[MAX_V];
bool vis[MAX_V];
int ord[MAX_V], parent[MAX_V], lowlink[MAX_V], timer;

vector <pair<int, int> > edges;
vector <pair<int, int> > bridge;

void dfs(int current, int prev) {
  ord[current] = lowlink[current] = timer;
  timer++;

  vis[current] = true;

  int next;
  for (int i = 0; i < graph[current].size(); i++) {
    next = graph[current][i];
    if (!vis[next]) {
      parent[next] = current;

      dfs(next, current);
      lowlink[current] = min(lowlink[current], lowlink[next]);
    }else if (next != prev) {
      lowlink[current] = min(lowlink[current], ord[next]);
    }
  }
}

bool is_bridge(int s, int t) {
  if (ord[s] > ord[t]) swap(s, t);
  return ord[s] < lowlink[t];
}

void init_bridge() {
  memset(vis, false, sizeof(vis));
  timer = 1;
  dfs(0, -1);
}

int main() {
  int v, e;
  cin >> v >> e;

  for (int i = 0; i < e; i++) {
    int s, t;
    cin >> s >> t;
    graph[s].push_back(t);
    graph[t].push_back(s);
    if (s > t) swap(s, t);
    edges.push_back(make_pair(s, t));
  }
  sort(edges.begin(), edges.end());
  init_bridge();
  for (int i = 0; i < e; i++) {
    int s = edges[i].first, t = edges[i].second;
    if (is_bridge(s, t)) {
      cout << s << " " << t << endl;
    }
  }
}

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

int main() {
  int n, x;
  cin>>n>>x;
  
  vector<int> vec(n);
  int sum=0;
  int ans=1;
  
  for (int i=0; i<n; i++) {
  	cin >> vec.at(i);
    sum += vec.at(i);
    if(sum <= x) {
    	ans++;
    }
    else
      break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    vector<int> cnt(9);
    int N; cin >> N;
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        cnt[min(a / 400, 8)]++;
    }
    int ans = 0;
    for (int i = 0; i < 8; i++) { ans += (cnt[i] > 0); }
    cout << ans + ((ans == 0) && (cnt[8] > 0)) << ' ';
    cout << ans + cnt[8] << '\n';
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N, M, sum, cnt = 0;
    int n1[100], m1[100];
    cin >> N >> M;
    for(int i = 0; i < N; i++){ //偶数
        n1[i] = 2 + i * 2;
    }
    for(int i = 0; i < M; i++){ //奇数
        m1[i] = 1 + i * 2;
    }    
    //奇数+偶数
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            sum = n1[i] + m1[j];
            
          //  cout << sum << '\n'; 
            if(sum %2 == 0) cnt++;
        }
    }
    //奇数＋奇数
    cnt = cnt +  M * (M-1) / 2;
    //偶数＋偶数
    cnt = cnt +  N * (N-1) / 2;
    cout << cnt;
}


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

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

int main() {
  ll n, x, m, cnt = 0, tot = 0, ans = 0, stot = 0;
  cin >> n >> x >> m;
  unordered_map<ll, ll> mp;
  vector<ll> v;
  while (mp.count(x) == 0) {
    mp[x] = cnt++;
    v.push_back(x);
    tot += x;
    x = x * x % m;
  }

  if (n <= cnt) {
    rep(i, n) ans += v[i];
    cout << ans << endl;
    return 0;
  }

  n -= mp[x];
  for (auto t : v) {
    if (t == x) break;
    stot += t;
  }
  ll num = n / (cnt - mp[x]);
  ll mod = n % (cnt - mp[x]);
  ll cycle = tot - stot;
  ans = cycle * num + stot;
  for (int i = mp[x]; i < mp[x] + mod; ++i) ans += v[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5700
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdlib>5
#include<string>
#include<algorithm>
#define LL long long
#define INF 1000000009
using namespace std;
int main()
{
    int n,a[10],b;
    scanf("%d",&n);
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
    {
        scanf("%d",&b);
        if(0<b&&b<400)
        {
            a[0]++;
        }
        else if(399<b&&b<800)
        {
            a[1]++;
        }
        else if(799<b&&b<1200)
        {
            a[2]++;
        }
        else if(1199<b&&b<1600)
        {
            a[3]++;
        }
        else if(1599<b&&b<2000)
        {
            a[4]++;
        }
        else if(1999<b&&b<2400)
        {
            a[5]++;
        }
        else if(2399<b&&b<2800)
        {
            a[6]++;
        }
        else if(2799<b&&b<3200)
        {
            a[7]++;
        }
        else
        {
            a[8]++;
        }
    }
    int ans=0;
    for(int i=0;i<8;i++)
    {
        if(a[i]>0)
        ans++;
    }
    if(ans!=0)
    printf("%d %d\n",ans,ans+a[8]);
    else
    printf("1 %d\n",ans+a[8]);
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = l[0], W = l[1];
            var array = new char[H][];

            for (var i = 0; i < H; i++) array[i] = Console.ReadLine().ToCharArray();

            var left = new int[H, W];
            var right = new int[H, W];
            var up = new int[H, W];
            var down = new int[H, W];

            for (var i = 0; i < H; i++)
            {
                var count1 = 0;
                var count2 = 0;
                for (var j = 0; j < W; j++)
                {
                    if (array[i][j] == '#')
                    {
                        left[i, j] = 0;
                        count1 = 0;
                    }
                    else
                    {
                        left[i, j] = ++count1;
                    }

                    if (array[i][W - j - 1] == '#')
                    {
                        right[i, W - j - 1] = 0;
                        count2 = 0;
                    }
                    else
                    {
                        right[i, W - j - 1] = ++count2;
                    }
                }
            }

            for (var i = 0; i < W; i++)
            {
                var count1 = 0;
                var count2 = 0;
                for (var j = 0; j < H; j++)
                {
                    if (array[j][i] == '#')
                    {
                        up[j, i] = 0;
                        count1 = 0;
                    }
                    else
                    {
                        up[j, i] = ++count1;
                    }

                    if (array[H - j - 1][i] == '#')
                    {
                        down[H - j - 1, i] = 0;
                        count2 = 0;
                    }
                    else
                    {
                        down[H - j - 1, i] = ++count2;
                    }
                }
            }

            var max = 0L;
            for (var i = 0; i < H; i++)
            {
                for (var j = 0; j < W; j++)
                {
                    max = Math.Max(left[i,j]+right[i,j]+up[i,j]+down[i,j]-3, max);
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 92608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n; cin >> n;
	vi h(n); rep(i,n) cin >> h[i];
	int mx = 0;
	rep(i,n){
		if(h[i]<=mx-2){
			out("No"); return 0;
		}
		mx = max(mx,h[i]);
	}
	out("Yes");
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
 
	string s;
	int l;
	cin >> l;
	cin >> s;
	if (s.length() > l) {
		for (int i = 0; i < l; i++) {
			cout << s[i];
		}cout << "...\n";
	}
	else {
		cout << s << "\n";
	}
 
	return 0;
}

Measured memory_bytes: 3652
import itertools

while True:
    n, x = map(int, input().split(' '))
    if (n == 0) & (x == 0): break

    ret = 0
    for v in itertools.combinations(list(range(1, n + 1)), 3):
        if sum(v) == x:
            ret += 1

    print(ret)


Measured memory_bytes: 5632
#include <stdio.h>
int main(void) {
	while(1){
		int l;
		scanf("%d",&l);
		if(l==0) break;
		int i,m[12],n[12];
		for(i=0;i<12;i++){
			scanf("%d %d",&m[i],&n[i]);
		}
		int p[12];
		for(i=0;i<12;i++){
			p[i]=m[i]-n[i];
		}
		int sum=p[0],k=1;
		for(i=0;i<12;i++){
			while(l>sum){
				i++;
				sum=sum+p[i];
				k++;
			}
		}
		if(k<=12){
		    printf("%d\n",k);
		}
		else{
		    printf("NA\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2084