akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  ll R, L; cin >> L >> R;
  ll Q = 2019;
  ll p = (R/Q)*Q;
  if(L<=p) cout << 0 << endl;
  else {
    ll m = 2020;
    for(ll i=L; i<R+1; ++i){
      for(ll j=i+1; j<R+1; ++j){
        m = min((i*j)%2019, m);
      }
    }
    cout << m << endl;
  }
  return 0;
}


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

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{
    public void AtCoder()
    {
        string[] input;
        input = Console.ReadLine().Split(' ');

        int a, b, c, n;
        a = int.Parse(input[0]);
        b = int.Parse(input[1]);
        
        Console.WriteLine(a - b + 1);
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 13140
#include <stdio.h>

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

Measured memory_bytes: 128
def B159():
    S = list(input())
    N = len(S)
    A = ""
    B = ""
    for i in range(0, int((N-1)/2)):
        A += S[i]
    for i in range(int((N+3)/2) - 1, N):
        B += S[i]

    if A == B:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    B159()

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main()
{
	int na[1000];
	double sig;
	while (1)
	{
		int n, i;
		double sum = 0;
		memset(na, 0, sizeof(int)*1000);
		
		scanf("%d", &n);
		if (n == 0)
			break;
		
		for (i = 0; i < n; i++)
		{
			int s = 0;
			scanf("%d", &s);
			na[i] = s;
			sum += s;
		}
		
		sig = 0;
		for (i = 0; i < n; i++)
		{
			sig += (pow(na[i] - (sum/n), 2));
		}
		printf("%.8f\n", sqrt(sig / n));
	}
	
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std; 
#define ll long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define fi first
#define se second
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define mul(x,y)	x=x*(y)%mod
#define Add(x,y)	x=(x+(y))%mod
#define EXIT(x)	return writeln(x),0;
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
	struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif 
#define NEG 0
    const int L=2333333;
    char SZB[L],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,L,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
}using namespace SHENZHEBEI;
const ll N=10010,mod=1e9+7;
ll g[N],h[N],head[N],nxt[N],vet[N],fac[N],n,tot,cnt,sz[N],son[N],inv[N],rt,SZ,f[N];
void insert(ll x,ll y){	nxt[++tot]=head[x];head[x]=tot;vet[tot]=y;}
void dfs(ll x,ll pre){
	sz[x]=1;
	for(ll i=head[x];i;i=nxt[i])if (vet[i]!=pre)
		dfs(vet[i],x),sz[x]+=sz[vet[i]],son[x]=max(son[x],sz[vet[i]]);
	son[x]=max(son[x],n-sz[x]);
	if (son[x]<=n/2)	rt=x,++cnt;
}
ll C(ll a,ll b){	return a<b?0:fac[a]*inv[b]%mod*inv[a-b]%mod;	}
int main(){
	n=read();
	fac[0]=inv[0]=fac[1]=inv[1]=1;
	For(i,2,n)inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	For(i,2,n)inv[i]=inv[i-1]*inv[i]%mod,fac[i]=fac[i-1]*i%mod;
	For(i,2,n){
		ll x=read(),y=read();
		insert(x,y),insert(y,x);
	}dfs(1,0);
	if (cnt==2)	return writeln(fac[n/2]*fac[n/2]%mod),0;
	dfs(rt,0);
	f[0]=1;
	for(ll i=head[rt];i;i=nxt[i]){
		ll t=sz[vet[i]];
		For(j,0,t)	g[j]=C(t,j)*C(t,j)%mod*fac[j]%mod;
		memset(h,0,sizeof h);
		For(j,0,SZ)	For(k,0,t)	Add(h[j+k],f[j]*g[k]);
		memcpy(f,h,sizeof h);
		SZ+=t;
	}
//	For(i,0,n)writeln(f[i]);
	FOr(i,n,0){
		f[i]=f[i]*fac[n-i]%mod;
		For(j,i+1,n)	f[i]=(f[i]-f[j]*C(j,i))%mod;
	}
	writeln((f[0]%mod+mod)%mod);
}
/*
f[i][j]
i*(i-1)*(i-2)
*/

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d)cout << "Left" << endl;
    else if (a+b == c+d) cout << "Balanced" << endl;
    else cout << "Right" << endl;
    return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int GCD;
	int LCM;
	
	while (scanf("%d %d", &a, &b) != EOF){
	
		GCD = a;
		LCM = b;
		
		while (GCD != LCM){
			if (GCD > LCM){
				GCD -= LCM;
			}
			else {
				LCM -= GCD;
			}
		}
		LCM = a / GCD * b;
		
		printf("%d %d\n", GCD, LCM);
	}
	return 0;
}

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

char c_min(char x,char y){
	if(x < y){
		return x;
	}else{
		return y;
	}
}
char c_max(char x,char y){
	if(x > y){
		return x;
	}else{
		return y;
	}
}

int main(){
	string s,t;
	cin >> s >> t;
	int s_size = s.size();
	int t_size = t.size();
	for(int i=0;i<s_size - t_size;i++){
		t += char(0);
	}
	for(int i=0;i<t_size - s_size;i++){
		s += char(0);
	}
	for(int i=0;i<s.size();i++){
		for(int j=0;j<s_size-1;j++){
			char Min = c_min(s[j],s[j+1]);
			char Max = c_max(s[j],s[j+1]);
			s[j] = Min;
			s[j+1] = Max;
		}
	}
	for(int i=0;i<t.size();i++){
		for(int j=0;j<t_size-1;j++){
			char Min = c_min(t[j],t[j+1]);
			char Max = c_max(t[j],t[j+1]);
			t[j] = Max;
			t[j+1] = Min;
		}
	}
	
	for(int i=0;i < max(s.size(),t.size());i++){
		if(s[i] < t[i]){
			cout << "Yes" << endl;
			return 0;
		}else if(s[i] > t[i]){
			break;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define PI (acos(-1))
#define _GLIBCXX_DEBUG

int main(){
  
  int n, a, b;
  cin >> n >> a >> b;
  
  int c = 1;
  int ans = 0;


  while(c <= n){
    int tp = c, cp = 0;
    while(tp > 0){
      cp += tp % 10;
      tp /= 10; 
    }
    
    if(a <= cp && cp <= b) ans += c;
    c++;
  }

  cout << ans << endl;

}


Measured memory_bytes: 384
from collections import Counter
def main():
    N,*A=map(int, open(0).read().split())
    C=Counter(A)
    x=0
    for v in C.values():
        x+=v*(v-1)//2
    for a in A:
        print(x-(C[a]-1))

if __name__ == "__main__":
    main()

Measured memory_bytes: 25932
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ii>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1e5 + 3;
ll n;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    cout<<(n * (n - 1)) / 2;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 2e5+5;
ll a[M],ans,dp[M][3][2],csEven[M],csVal[M];
void pre(int L)
{
	for(int i=1;i<=L;i++)
	{
		csEven[i] = csEven[i-1];
		if(a[i] % 2 == 0)
			csEven[i]++;
		csVal[i] = csVal[i-1];
		if(a[i] == 0)
			csVal[i] += 2;
		if(a[i] % 2)
			csVal[i] += 1;
	}
}
void solve(int L,int f)
{
	pre(L);
	ll sum = 0;
	ll mnEven = csEven[L];
	ll mnRet = csVal[L];
	for(int i = L-1;i>=0;i--)
	{
		sum += a[i+1];
		// forward	
		dp[i][0][0] = min(sum, mnEven - csEven[i]);
		// return
		dp[i][1][0] = min(sum, mnRet - csVal[i]);
		mnRet = min(mnRet, csVal[i] + sum);
		mnEven = min(mnEven, csEven[i] + min(dp[i][0][0], dp[i][1][0]));
	}
	sum = 0;
	mnEven = 0;
	mnRet = 0;
	for(int i=1;i<=L;i++)
	{
		sum += a[i];
		dp[i][0][1] = min(sum, mnEven + csEven[i]);
		dp[i][1][1] = min(sum, mnRet + csVal[i]);
		mnRet = min(mnRet, sum - csVal[i]);
		mnEven = min(mnEven, -csEven[i] + min(dp[i][0][1], dp[i][1][1]));
	}
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int L;
	cin>>L;
	for(int i=1;i<=L;i++)
		cin>>a[i];
	solve(L,0);
	reverse(a+1,a+L+1);
	solve(L,1);
	ans = L;
	for(int i=0;i<=L;i++)
	{
		for(int j=0;j<2;j++)
		{
			for(int k=0;k<2;k++)
			{
				if(j+k!=0)
				{
					ans = min(ans, dp[i][j][0]+dp[i][k][1]);
				}
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main()
{
	int a, b;
	cin>>a>>b;
	if(a>b)
	{
		cout<<a*2-1<<endl;
	}
	else if(a<b)
	{
		cout<<b*2-1<<endl;
	}
	else cout<<a+b<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

ll facMod(ll x, ll y, ll MOD) {
  if(x==y) {
    return y;
  }
  return (x * facMod(x-1, y, MOD))%MOD;
}

// ll repeatSquaring(ll n, ll p, ll MOD) { // nのp乗 mod m
//   if(p==0) return 1;
//   if(p%2==0) {
//     ll t = repeatSquaring(n, p/2, MOD);
//     return t*t % MOD;
//   } else {
//     return n * repeatSquaring(n, p-1, MOD);
//   }
// }
ll repeatSquaring(ll n,ll p,ll MOD) {
  ll res=1;
    while(p>0) {
      if(p&1) res =res * n % MOD;
      n = n * n % MOD;
      p >>= 1;
    }
    return res;
}

int main(void) {
  ll n,a,b;cin>>n>>a>>b;
  // --a;
  // --b;
  ll MOD=pow(10,9)+7;

  ll x,y;
  x = facMod(n,n-a+1,MOD);
  y = facMod(a,1,MOD);
  ll nota = (x*repeatSquaring(y,MOD-2,MOD))%MOD;
  // pr(repeatSquaring(y,MOD-2,MOD)%MOD);

  x = facMod(n,n-b+1,MOD);
  y = facMod(b,1,MOD);
  ll notb = (x*repeatSquaring(y,MOD-2,MOD))%MOD;
  // pr(repeatSquaring(y,MOD-2,MOD)%MOD);

  pr((repeatSquaring(2,n,MOD)-(nota+notb)%MOD-1+2*MOD)%MOD);
  return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>

using namespace std;

int main(){
    int a,b;

    cin >> a >> b;

    if (a < b){
        printf("a < b\n");
    }

    else if (a > b){
        printf("a > b\n");
    }
    else printf("a == b\n");

    return 0;
}


Measured memory_bytes: 3080
a, v = list(map(int, input().strip().split()))
b, w = list(map(int, input().strip().split()))
t = int(input())

if a == b: print("YES")
else:
    if w >= v: print("NO")
    else:
        tt = abs(a-b)/(v-w)
        
        if tt <= t: print("YES")
        else: print("NO")

Measured memory_bytes: 9196
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	long long x, y;
	cin >> x >> y;
	int ans = 0;
	for (int i = 0; i < 1000; i++) {
		if (x > y) break;
		ans++;
		x *= 2;
	}
	cout << ans << endl;
	return 0;	
}

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

using namespace std;

typedef long long ll;

  int main() {
  int n,a,b,c,flag=0;
  cin >> n;
  a = n%10;
  b = (n%100 - a)/10;
  c = n/100;
  if(a == 7){
  flag = 1;
  }
  if(b == 7){
  flag = 1;
  }
  if(c == 7){
  flag = 1;
  }
  if(flag == 0){
  cout << "No" << endl;
  }
  if(flag == 1){
  cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
  	sort(a,a+3);
    int k;
    cin>>k;
    cout<<a[0]+a[1]+(a[2]<<k);
}


Measured memory_bytes: 3596
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
//#define int long long
const int MAX_R = 2010;
const int MAX_P = 15;
const int MAX_T = 55;

class C{
  public:
    int n, penalty[MAX_P], ac, time;
    C(){
      ac = time = 0;
      memset(penalty, 0, sizeof(penalty));
    }
    bool operator<(const C &c) const{
      if(ac != c.ac) return ac < c.ac;
      else if(time != c.time) return time > c.time;
      else return n < c.n;
    }
};

int main() {
  int M, T, P, R;
  while(cin >>M >>T >>P >>R && M){
    C team[MAX_T];
    REP(i, T) team[i].n = i + 1;
    REP(i, R){
      int m, t, p, j; cin >>m >>t >>p >>j;
      --t;
      if(j == 0){
        team[t].ac += 1;
        team[t].time += team[t].penalty[p] + m;
      } else team[t].penalty[p] += 20;
    }
    sort(team, team + T);
    reverse(team, team + T);
    stringstream ss;
    REP(i, T){
      ss << team[i].n;
      if(i == T - 1) continue;
      if(team[i + 1].ac == team[i].ac && team[i + 1].time == team[i].time) ss <<"=";
      else ss <<",";
    }
    cout <<ss.str() <<endl;
  }
  return 0;
}

Measured memory_bytes: 1232
while True:
  h = int(input())
  if h==0:
    break
  board = [list(map(int, input().split())) for i in range(h)]
  ans = 0

  while True:
    tans = 0
    for y in range(h):
      begin, end = 0, 0
      for x in range(1, 5):
        if board[y][x]==board[y][x-1]:
          end = x
        elif end-begin+1>=3:
          break
        else:
          begin = x
          continue
      if end-begin+1>=3:
        tans += board[y][begin]*(end-begin+1)
        for x in range(begin, end+1):
          board[y][x] = 0

    move = True
    while move:
      move = False
      for y in range(1, h):
        for x in range(5):
          if board[y][x]==0 and board[y-1][x]==0:
            continue
          elif board[y][x]==0:
            board[y][x], board[y-1][x] = board[y-1][x], board[y][x]
            move = True
    if tans>0:
      ans += tans
    else:
      break
  print(ans)


Measured memory_bytes: 5628
if __name__ == "__main__":

    while True:
        n = int(input())
        if n == 0:
            break
        else:
            g = []
            #print(n)
            sa = sb = 0
            for i in range(n):
                a, b = map(int, input().strip("\n").split(" "))
                #print(a, b)
                if a > b:
                    sa += (a + b)
                elif b > a:
                    sb += (a + b)
                else:  # a==b
                    sa += a
                    sb += b
            print(sa,sb)
pass

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

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

  if(s[2]==s[3] && s[4]==s[5]){
      cout <<"Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

/*
vector<char>al(26);
al = {'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'};
vector<char>AL(26);
AL = {'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'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int N;
	cin >> N;
	cout << 180 * (N - 2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,K;
    string S;
    cin >> N >> K >> S;
    ll X,Y;
    X = 0;Y = 0;
    ll base = 0;
    for (int i = 0; i < N-1; ++i) {
        if(S[i] == 'R' && S[i+1] == 'R'){
            base++;
        }
    }
    for (int i = N-1; i > 0; --i) {
        if(S[i] == 'L' && S[i-1] == 'L'){
            base++;
        }
    }

    if(S[0] == 'L'){
        Y++;
    }else if(S[N-1] == 'R'){
        Y++;
    }
    for (int i = 0; i < N-1; ++i) {
        if(S[i] == 'R' && S[i+1] == 'L'){
            X++;
        }
    }
    cout << min(base + 2 * K,N-1) << endl;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(2000000)
input=sys.stdin.readline
import heapq

N=int(input())

G = [[] for j in range(N)]

color = [0]*N

for _ in range(N-1):
    e,f,g = list(map(int, input().split()))
    heapq.heappush(G[e-1], [f-1,g%2])
    heapq.heappush(G[f-1], [e-1,g%2])

def dfs(v,p,c):
    color[v]=c
    for k in range(len(G[v])):
        i,j = heapq.heappop(G[v])
        if i==p:
            continue
        elif j ==0 :
            dfs(i,v,c)
        elif j ==1 :
            dfs(i,v,1-c)
        
dfs(0,-1,0)

for k in color:
    print(k)


Measured memory_bytes: 82520
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

class modfact(object):
    def __init__(self,n):
        fact=[1]*(n+1)
        invfact=[1]*(n+1)
        for i in range(1,n+1):
            fact[i]=i*fact[i-1]%MOD
        invfact[n]=pow(fact[n],MOD-2,MOD)
        for i in range(n-1,-1,-1):
            invfact[i]=invfact[i+1]*(i+1)%MOD
        self.__fact=fact
        self.__invfact=invfact

    def fact(self,n):
        return self.__fact[n]

    def invfact(self,n):
        return self.__invfact[n]

    def comb(self,n,k):
        if(k<0 or n-k<0): return 0
        return (self.fact(n)*self.invfact(k)*self.invfact(n-k))%MOD

def resolve():
    x,y=map(int,input().split())
    if((x+y)%3):
        print(0)
        return
    z=(x+y)//3
    mf=modfact(z)
    print(mf.comb(z,x-z))
resolve()

Measured memory_bytes: 49008
def main():

    from collections import deque
    h, w = map(int, input().split())
    s = [input() for _ in range(h)]
    cost = [[600] * w for _ in range(h)]
    nb = [(-1, 0), (0, -1), (1, 0), (0, 1)]
    ans = 0

    def bfs(sx, sy):
        q = deque([(sx, sy)])
        cost[sx][sy] = 0
        value = 0
        while q:
            x, y = q.popleft()
            for dx, dy in nb:
                nx = x + dx
                ny = y + dy
                if 0 <= nx and nx < h and 0 <= ny and ny < w and s[nx][ny] == "." and cost[nx][ny] == 600:
                    q.append((nx, ny))
                    cost[nx][ny] = cost[x][y] + 1
                    value = max(value, cost[nx][ny])
        return value

    ans = 0
    for i in range(h):
        for j in range(w):
            if s[i][j] == ".":
                cost = [[600] * w for _ in range(h)]
                tmp = bfs(i, j)
                ans = max(tmp, ans)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  set<int> S;
  
  int q;
  cin>>q;
  while(q--){
    int cmd, num;
    cin>>cmd>>num;
    if(cmd == 0){
      S.insert(num);
      cout<<S.size()<<endl;
    }

    if(cmd == 1){
      cout<<S.count(num)<<endl;
    }
    
    if(cmd == 2){
      S.erase(num);
    }

    if(cmd == 3){
      int l = num, r;
      cin>>r;
      //      auto start = S.lower_bound(l);
      //auto last= S.upper_bound(r);
      for(auto it = S.lower_bound(l); it != S.upper_bound(r); it++) cout<<*it<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 12504
n,m = gets.chomp.split.map(&:to_i)
ks = m.times.map{gets.chomp.split.map(&:to_i)}
ps = gets.chomp.split.map(&:to_i)
combi = [0,1].repeated_permutation(n).to_a
cnt = 0
ans = 0
flag = true
combi.each do |c|
  ks.each_with_index do |k,i|
    break if !flag
    size = k[0]
    (1..size).each do |j|
      cnt += c[k[j]-1]
    end
    if !(cnt%2 == ps[i])
      flag = false
      cnt = 0
      break
    else
      cnt = 0
    end
  end
  if flag
    ans += 1
  else
    flag = true
  end
end
puts ans



Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }

  vector<P> v;
  rep(i,n){
    v.PB(P(-a[i],-i));
  }
  
  sort(all(v));

  vector<int> ans(n,0);
  int i=0;
  int s=0,r=n+1;
  while(i<n){
    int j=i;
    while(j<n&&v[i].F==v[j].F) j++;
    s+=j-i;
    //cout<<v[j].F<<' '<<v[i].F<<' '<<s<<endl; 
    r=min(r,-v[j-1].S);
    ans[r]+=s*(v[j].F-v[i].F);
    //cout<<ans[r]<<endl;
    i=j;
  }


  rep(i,n){
    cout<<ans[i]<<endl;
  }

}


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

#define N 3
#define N2 9
#define LIMIT 31

typedef struct { char b[N2+1]; } Board;
Board board;
int minstep;
typedef enum { R, U, L, D } Direction;
typedef struct { int pos; Direction dir; } Motion;

const Motion motion[N2][5] =
  {{{1,L},{3,U},{-1}}, {{0,R},{2,L},{4,U},{-1}}, {{1,R},{5,U},{-1}},
   {{0,D},{4,L},{6,U},{-1}}, {{1,D},{5,L},{7,U},{3,R},{-1}},
   {{2,D},{8,U},{4,R},{-1}},
   {{3,D},{7,L},{-1}}, {{4,D},{8,L},{6,R},{-1}}, {{5,D},{7,R},{-1}}  };

const int rr[4][5] = {{0,0,1,0,0},{0,0,0,1,0},{1,0,0,0,0},{0,1,0,0,0}};

int dd[N2][N2];
int dist(char *b)
{
  int i, n, d = 0;
  for (i=0; i<N2; i++) {
    n = b[i]-1;
    if (n<0)   continue;
    d += dd[n][i];
  }
  return d;
}

void search(int step, Motion prev)
{
  int i, d=0;
  d = dist(board.b);
  if (step+d>minstep) return;
  if (d==0) {
    printf("%d\n", step);
    exit(0);
  }
  Board board_bak = board;
  for (i=0; motion[prev.pos][i].pos>=0; i++) {
    Motion m = motion[prev.pos][i];
    if (rr[m.dir][prev.dir]) continue; //元に戻るのを防止
    board.b[prev.pos] = board.b[m.pos];
    board.b[m.pos] = 0;
    search(step+1, m);
    board = board_bak;
  }
}

int main()
{
  int i, j;
  for (i=0; i<N2; i++)
    for (j=0; j<N2; j++)
      dd[i][j] = abs(i%N-j%N) + abs(i/N-j/N);
  
  Motion m;
  m.dir = 4;
  Board ini_board;
  for (i=0; i<N2; i++) {
    fscanf(stdin, "%hd", (short int*)&ini_board.b[i]);
    if (ini_board.b[i]==0) m.pos = i;
  }
  for (minstep=dist(ini_board.b); minstep<=LIMIT; minstep++) {
    board = ini_board;
    search(0, m);
  }
  puts("no result.");
  return 0;
}



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

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

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<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_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 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))

int sub(string& s) {
    int L=s.size();
    int mx = L;
    for (int i=0; i<L/2; ++i){
        if (s[i]=='1' || s[L-1-i]=='1') mx=L-1-i;
        // printf("i=%d, mx=%d\n", i, mx);
    }
    if (L%2) {
        if (s[L/2]=='1') mx=L/2;
        // printf("i=%d, mx=%d\n", L/2, mx);
    }
    return mx;
}
int solve(string& s) {
    int best = sub(s);
    for (char &c:s) c = ('0'+'1'-c);
    // cerr << s << endl;
    best = max(best,sub(s));
    return best;
}

int main() {
    string s; cin >> s;
    cout << solve(s) << endl;
    // cout << (solve(N,a) ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 512
from sys import stdin
from sys import setrecursionlimit
import math

a,b,n = map(int,stdin.readline().rstrip().split())
if n >= b:
    print(math.floor(a*(b-1)/b)-a*math.floor((b-1)/b))
else:
    print(math.floor(a*n/b)-a*math.floor(n/b))

Measured memory_bytes: 62180
import java.util.Scanner;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         long A=gl();
         long B=gl();

         long c=0;
         if (A<B) {
        	 for (long i=1; i<=Math.sqrt(A); i++) {
        		 if(A%i==0) {
        			 long i2=A/i;
        			 if(B%i==0) {
                         if(isP(i) || i==1) c++;
        			 }

        			 if(B%i2==0 && i2!=i) {
                         if(isP(i2) || i2==1) c++;
        			 }
        		 }
        	 }
         } else {
        	 for (long i=1; i<=Math.sqrt(B); i++) {
        		 if(B%i==0) {
        			 long i2=B/i;
        			 if(A%i==0) {
                         if(isP(i) || i==1) c++;
        			 }

        			 if(A%i2==0 && i2!=i) {
                         if(isP(i2) || i2==1) c++;
        			 }
        		 }
        	 }
         }

         System.out.println(c);
     }

  // 素数判定
 	public static boolean isP(long n) {
 		if(n==1) return false;
 		for (int i=2; i<=Math.sqrt(n);i++) {
 			if(n%i==0) {
 				return false;
 			}
 		}

 		return true;
 	}

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 36220
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

int main() {
  string S;
  int N, K;
  cin >> N >> K >> S;
  for (int i = 0; i < N; i++) {
    S[K-1] = tolower(S[K-1]);
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9


int main()
{
    fastio;
    char c;
    cin >> c;
    int a=c;
    if(a>=97)
        cout << "a" << endl;
    else
        cout << "A" << endl;
}

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

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

using namespace std;
using lint=long long;

struct point{
	lint x,y;
	point(lint x,lint y):x(x),y(y){}
};

vector<point> solve(lint X,lint Y,lint k){
	if(X<0){
		auto res=solve(-X,Y,k);
		for(auto& p:res) p.x*=-1;
		return res;
	}

	if(Y<0){
		auto res=solve(X,-Y,k);
		for(auto& p:res) p.y*=-1;
		return res;
	}

	if(X>Y){
		auto res=solve(Y,X,k);
		for(auto& p:res) swap(p.x,p.y);
		return res;
	}

	// 0 <= X <= Y
	vector<point> res;
	if(X+Y<k && (X+Y)%2==1){ // corner case (3 回曲がる)
		assert(k%2==1);
		lint x=0,y=0,dx,dy;
		lint a=(3*k-(X+Y))/2;
		lint a1=a/2,a2=(a+1)/2; // a1 + a2 == a
		dx=k-a1;
		dy=-a1;
		x+=dx; y+=dy; res.emplace_back(x,y);
		dx=(X+a2)-x;
		dy=k-dx;
		x+=dx; y+=dy; res.emplace_back(x,y);
		dx=-a2;
		dy=Y-y;
		x+=dx; y+=dy; res.emplace_back(x,y);
	}
	else if((X+Y)%k==0){ // 無駄なし (0 or 1 回曲がる)
		lint x=0,y=0;
		while((X-x)+(Y-y)>0){
			lint dx=min(k,X-x);
			lint dy=k-dx;
			x+=dx; y+=dy; res.emplace_back(x,y);
		}
	}
	else{ // 2 回曲がる
		lint x=0,y=0,dx,dy;
		while((X-x)+(Y-y)>2*k || ((X-x)+(Y-y))%2==1){
			lint dx=min(k,X-x);
			lint dy=k-dx;
			x+=dx; y+=dy; res.emplace_back(x,y);
		}
		// (X-x)+(Y-y) < 2*k and X-x <= Y-y and (X-x)+(Y-y) == 0 (mod 2)

		// あと 2 回でゴール
		lint a=(2*k-(X-x)-(Y-y))/2;
		dx=(X-x)+a;
		dy=k-dx;
		x+=dx; y+=dy; res.emplace_back(x,y);
		dx=-a;
		dy=Y-y;
		x+=dx; y+=dy; res.emplace_back(x,y);
	}
	return res;
}

int main(){
	lint k,X,Y; scanf("%lld%lld%lld",&k,&X,&Y);

	if(k%2==0 && (X+Y)%2!=0){
		cout<<-1<<'\n';
		return 0;
	}

	auto res=solve(X,Y,k);

	printf("%lu\n",res.size());
	for(auto& p:res) printf("%lld %lld\n",p.x,p.y);

	return 0;
}


Measured memory_bytes: 5484
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using vvll = vector<vll>;
const double EPS = 1e-9;
#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 SZ(x) ((int)(x).size())
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


vector<ll> checked;
ll dfs(vector<vector<ll>> &G, ll v){
  ll ret = 0;
  for(ll v_next: G[v]){
    if(checked[v_next] >= 0){
      chmax(ret, checked[v_next]);
      continue;
    }
    chmax(ret, dfs(G, v_next));
  }
  checked[v] = ++ret;
  return ret;
}
int main(){
  ll n,m; cin>>n>>m;
  vector<vector<ll>> G(n);
  checked.assign(n,-1);
  rep(i,m){
    ll x,y; cin>>x>>y;
    x--,y--;
    G[x].push_back(y);
  }
  ll ans=0;
  rep(i,n){
    chmax(ans, dfs(G, i));
  }
  cout<<--ans<<endl;
}

Measured memory_bytes: 11196
N = gets.to_i
t = x = y = 0
N.times do
  tn, xn, yn = gets.split.map(&:to_i)
  td = tn - t
  xd = (xn - x).abs
  yd = (yn - y).abs
  d = xd + yd
  if d > td || (d - td).modulo(2) == 1
    puts "No"
    exit
  end
  t, x, y = tn, xn, yn
end
puts "Yes"


Measured memory_bytes: 1788
#pragma region def
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;
using pint = pair<int, int>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long llINF = 1e18;
#pragma endregion

int main () {
    int a, b; cin >> a >> b;
    int ans = INF;
    bool can = false;
    for (int i = 1; i <= 1000; i++) {
        double x = i * 0.08;
        double y = i * 0.10;
        if (floor(x) == a && floor(y) == b) {
            can = true;
            ans = min(ans, i);
        }
    }

    if (can) cout << ans << endl;
    else cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n::Int=parseInt(readline())
    a::Vector{Int}=parseMap(split(readline()))
    cnt::Vector{Int}=[0 for i in 1:n]
    for i in a
        cnt[i+1]+=1
    end
    ans::Int=1
    if n%2==1 && cnt[1]!=1
        ans=0
    end
    for i in cnt[n%2+2:2:n]
        if i!=2
            ans=0
            break
        end
        ans*=2
        ans%=1000000007
    end
    println(ans)
end
main()

Measured memory_bytes: 169312
#include <iostream> 
#include <iomanip> 
#include <vector> 
#include <algorithm> 
#include <numeric> 
#include <functional> 
#include <cmath> 
#include <queue> 
#include <stack> 

#define Ford(i,a,b) for (int i=(a);i<(b);i++) 
#define For(i,n) Ford(i,0,n) 
typedef long long ll; 

using namespace std;

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B) cout<<C<<endl;
  else if(B==C) cout<<A<<endl;
  else cout<<B<<endl;
  
  return 0;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
const int max_n = 1010;

int n,m;
vi G[max_n];
int color[max_n];

void init(){
    rep(i,max_n){
        G[i].clear();
        color[i]=0;
    }
}

void input(){
    int a,b;
    rep(i,m){
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
}

bool dfs(int v,int c){
    color[v]=c;
    rep(i,G[v].size()){
        if(color[G[v][i]]==c) return false;
        if(color[G[v][i]]==0 && !dfs(G[v][i],-c)) return false;
    }

    return true;
}

void solve(){
    init();
    input();

    rep(i,n){
        if(color[i]==0){
            if(!dfs(i,1)){
                out(0);
                return;
            }
        }
    }
    
    int a=0,b=0;
    vi ans;
    rep(i,n){
        if(color[i]==1) a++;
        else b++;
    }
    //show(a);show(b);
    if(!(a&1)) ans.pb(a/2);
    if(!(b&1) && a!=b) ans.pb(b/2);

    sort(all(ans));
    out(ans.size());
    for(auto e : ans){
        out(e);
    }
}

signed main(){
    io();
    while(cin>>n>>m, n){
        solve();
    }

    return 0;
}



Measured memory_bytes: 3352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
ll dp[105][105][305];
int main(){
    ll N, W; cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i,N) cin >> w[i] >> v[i];
    ll base = w[0];
    rep(i,N) w[i] -= base;

    dp[0][0][0] = 0;
    rep(i, N){
        rep(j, N){
            for(int k = 0; k <= 300; k++){
                if(k < w[i]) dp[i+1][j+1][k] = dp[i][j+1][k];
                else dp[i+1][j+1][k] = max(dp[i][j+1][k], dp[i][j][k-w[i]] + v[i]);
            }
        }
    }

    ll ans = 0;
    for(int i = 1; i <= N; i++){
        if(W - base*i >= 0) ans = max(ans, dp[N][i][min(300LL, W - base*i)]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 25216
n,m,l=map(int,input().split())
a=list()
b=list()
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(m):
    b.append(list(map(int,input().split())))
for i in range(n):
    c=list()
    for j in range(l):
        d=0
        for k in range(m):
            d+=a[i][k]*b[k][j]
        c.append(d)
    print(' '.join(list(map(str,c))))


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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

//const long long int MOD=1000000007;
const long long int MOD=998244353;

vector<vector<long long int>>matrix_product(vector<vector<long long int>>v, vector<vector<long long int>>w) {
	vector<vector<long long int>>ret(v.size(), vector<long long int>(w.front().size()));
	for (int i = 0; i < ret.size(); i++) {
		for (int j = 0; j < ret[i].size(); j++) {
			for (int k = 0; k < w.size(); k++) {
				ret[i][j] += v[i][k] * w[k][j];
				ret[i][j]%=M;
			}
		}
	}
	return ret;
}

int main(){
	
	cin>>N>>L>>R>>M;
	vector<long long int>ten(19,1);
	for(int i=1;i<19;i++)ten[i]=ten[i-1]*10;
	vector<vector<long long int>>ans(1,vector<long long int>({0,L%M,R%M}));
	while(N){
		//cout<<N<<" "<<L<<endl;
		long long int box=L;
		int cnt=0;
		while(box){
			cnt++;
			box/=10;
		}
		long long int nx=L+(N-1)*R;
		box=nx;
		int ccnt=0;
		while(box){
			ccnt++;
			box/=10;
		}
		long long int num=N;
		if(ccnt!=cnt){
			long long int dif=ten[cnt]-1;
			dif-=L;
			dif/=R;
			nx=L+dif*R;
			dif++;
			num=dif;
		}
		//cout<<nx<<" "<<num<<endl;
		vector<vector<long long int>>by(3,vector<long long int>(3));
		by[0][0]=ten[cnt]%M;
		by[1][0]=1;
		by[1][1]=1;
		by[2][1]=1;
		by[2][2]=1;
		vector<vector<long long int>>ret(3,vector<long long int>(3));
		ret[0][0]=1;
		ret[1][1]=1;
		ret[2][2]=1;
		for(int i=0;i<60;i++){
			if((num>>i)&1){
				ret=matrix_product(ret,by);
			}
			by=matrix_product(by,by);
		}
		for(int i=0;i<3;i++){
			//for(int j=0;j<3;j++){
			//	cout<<ret[i][j]<<" ";
			//}
			//cout<<endl;
		}
		ans=matrix_product(ans,ret);
		N-=num;
		L=nx+R;
	}
	cout<<ans[0][0]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
  	long long int	H;
  	long long int	W;
  	int	num;
  	long long int ans;
  
  	num = scanf("%lld %lld", &H, &W);
  	if (num != 2)
      	return (0);
  
    if (H == 1)
    {
        printf("1");
        return (0);
    }
    if (W == 1)
    {
        printf("1");
        return (0);
    }
  
  	ans = H * W;
  	if (ans % 2 == 1)
      	ans = ans / 2 + 1;
  	else
      	ans = ans / 2;
  
  	printf("%lld", ans);
  
  	return (0);
}

Measured memory_bytes: 128
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;
using LL = long long;

int dp[1400][1400];
int maze[1400][1400];

int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> maze[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		if (maze[i][0] == 1)dp[i][0] = 0;
		else dp[i][0] = 1;
	}
	for (int j = 0; j < w; j++) {
		if (maze[0][j] == 1)dp[0][j] = 0;
		else dp[0][j] = 1;
	}
	for (int i = 1; i < h; i++) {
		for (int j = 1; j < w; j++) {
			if (maze[i][j] == 1)dp[i][j] = 0;
			else dp[i][j] = min({ dp[i - 1][j],dp[i][j - 1],dp[i - 1][j - 1] }) + 1;
		}
	}
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans = max(dp[i][j], ans);
		}
	}
	cout << ans*ans << endl;
}

Measured memory_bytes: 18392
#include<iostream>

using namespace std;

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

	int rate[8], o = 0;
	for (int i = 0; i <8; i++)rate[i] = 0;

	int min = 0;

	for (int i = 0; i < n; i++) {
		int v, ch=8;
		cin >> v;
		if (v >= 3200)o++;
		else if (v >= 2800)ch = 7;
		else if (v >= 2400)ch = 6;
		else if (v >= 2000)ch = 5;
		else if (v >= 1600)ch = 4;
		else if (v >= 1200)ch = 3;
		else if (v >= 800)ch = 2;
		else if (v >= 400)ch = 1;
		else if (v >= 1)ch = 0;

		if ( (ch >= 0 && ch <= 7) && rate[ch] == 0) {
			rate[ch] = 1;
			min++;
		}
	}
	if (min == 0 && o > 0) {
		min = 1;
		o--;
	}
	cout << min << " " << min + o << endl;
}

Measured memory_bytes: 256