akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#define pb push_back
#define S n*(n+1)/2
#define INF (1e9)
#define N 100
using namespace std;
int n,c,inv[N],p,l,dat[N],ans,flag,f,sum;
vector<int> s[N],v[N];
int visited[N];
void func(int);

int main(){
  while(1){
    cin>>n>>c;
    if(!n&&!c) break;
    for(int i=0;i<S;i++) cin>>inv[i];
    p=0;
    for(int i=1;i<=n;i++)
      for(int j=0;j<i;j++,p++) s[i-1].push_back(inv[p]);
    p=0;
    for(int i=1;i<=n;i++)
      for(int j=0;j<s[i-1].size();j++,p++){
	if(i!=n){
	  v[p].pb(p+i);
	  v[p].pb(p+1+i);
	  v[p+i].pb(p);
	  v[p+1+i].pb(p);
	}
	if(j==s[i-1].size()-1) continue;
	v[p].pb(p+1);
	v[p+1].pb(p);
      }
    ans=-INF;
    for(int i=0;i<S;i++){
      if(inv[i]) continue;
      for(int j=0;j<S;j++) dat[j]=0,visited[j]=0;
      inv[i]=c;
      l=1;
      for(int j=0;j<v[i].size();j++){
	if(!inv[v[i][j]]||visited[v[i][j]]) continue;
	flag=1;	
	func(v[i][j]);
	if(flag==1&&inv[v[i][j]]==c) flag=-1;
	for(int k=0;k<S;k++)
	  if(visited[k]==l) dat[k]=flag;
	l++;
      }
      f=0;
      for(int j=0;j<v[i].size();j++)
	if(inv[v[i][j]]==0) f=1;
      if(visited[i]==0&&!f) dat[i]=-1;
      inv[i]=sum=0;
      for(int j=0;j<S;j++) sum+=dat[j];
      ans=max(ans,sum);
    }
    cout<<ans<<endl;
    for(int i=0;i<N;i++) s[i].clear(),v[i].clear();
  }
  return 0;
}

void func(int d){
  visited[d]=l;
  for(int i=0;i<v[d].size();i++){
    if(inv[v[d][i]]==0) flag=0;
    if(visited[v[d][i]]) continue;
    if(inv[v[d][i]]==inv[d]||inv[v[d][i]]==0) func(v[d][i]);
  }
}

Measured memory_bytes: 1220
#include<iostream>

using namespace std;

int main(){
    int k,x;
    cin >> k >> x;
    int min, max;
    if((x-k)<-1000000){
        min = -1000000;
    } else {
        min = x-k;
    }
    if((x+k)>1000000){
        min = 1000000;
    } else {
        max = x+k;
    }
    for(int i=min+1;i<max;i++){
        cout << i << " ";
    }
}

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

int main() {
  string ans, b;
  cin >> ans;
  
  int count = 0;
  while (true) {
    cin >> b;
    if(b == "END_OF_TEXT") break;
    
    for(int i=0; i<b.size(); i++) {
      if(isupper(b.at(i))) b.at(i) = tolower(b.at(i));
      if(ans == b) { 
        count++;
        break;
      }
    }
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	while (1)
	{
		int a = 0, b = 0, n = 0;
		vector<int> x, y;
		int dp[17][17];
		cin >> a >> b;
		if (a == 0 && b == 0)
		{
			break;
		}
		cin >> n;
		for (int i = 0; i <= a; i++)
		{
			for (int j = 0; j <= b; j++)
			{
				dp[i][j] = 0;
			}

		}
		for (int i = 0; i < n; i++)
		{
			int j, k;
			cin >> j >> k;
			x.push_back(j);
			y.push_back(k);
		}

		for (int i = 1; i <= a; i++)
		{
			for (int j = 1; j <= b; j++)
			{
				bool ch = 1;
				for (int ii = 0; ii < n; ii++)
				{
					if (i == x[ii] && j == y[ii])
					{
						dp[i][j] = 0;
						ch = 0;
					}
				}
				if (ch == 1)
				{
					dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
				}
				dp[1][1] = 1;
			}
		}
		cout << dp[a][b] << endl;
	}
	return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << endl
#define print10(ele) cout << fixed << setprecision(10) << (ele) << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int n;
  cin >> n;
  ivec h(n);
  REP(i, n) cin >> h[i];
  int ans = 0;
  int active = 0;
  REP(i, n) {
    if (active >= h[i]) {
      active = h[i];
    } else {
      ans += h[i] - active;
      active = h[i];
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int e,y;
	scanf("%d %d",&e,&y);
	switch(e){
	case 0:
		if(y<1912){
			printf("M%d\n",y-1867);
		}else if(y<1926){
			printf("T%d\n",y-1911);
		}else if(y<1989){
			printf("S%d\n",y-1925);
		}else{
			printf("H%d\n",y-1988);
		}
		break;
	case 1:
		printf("%d\n",1867+y);
		break;
	case 2:
		printf("%d\n",1911+y);
		break;
	case 3:
		printf("%d\n",1925+y);
		break;
	default:
		printf("%d\n",1988+y);
	}
	return 0;
}

Measured memory_bytes: 2756
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class Type>struct is_vector : std::false_type {};
	template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
	template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
		if (v.empty())return out;
		constexpr bool is_vector_v = is_vector<T>::value;
		if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
		else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
		return out;
	}
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
	inline void putn() {}
	template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

	void solve() {
		IOS;
		int n;
		cin >> n;
		ll res = 0;
		FOR(i, 1, n + 1) {
			if (i % 3 != 0 && i % 5 != 0) {
				res += i;
			}
		}
		put(res);
	}
} // namespace idaten

int main() {
	idaten::solve();
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll X,ans;
    cin >> X;
    ans = 10 - X / 200;
    cout <<ans<<endl;
    return 0;  
}


Measured memory_bytes: 3632
x,y,a,b,c = map(int,input().split())
p= list(map(int,input().split()))
q= list(map(int,input().split()))
r= list(map(int,input().split()))

p = sorted(p)[-x:]
q = sorted(q)[-y:]

r = r+p+q
print(sum(sorted(r)[-(x+y):]))

Measured memory_bytes: 113900
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
typedef int ll;
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define orz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    
#define inp freopen("input.txt","r",stdin);freopen("out.txt","w",stdout); 
ll mod1=1e9+7;
void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}

int main() {
    orz;
    //inp;
    int a,b;
    cin>>a>>b;
    for(int i=b-a+1;i<=b+a-1;i++)
        cout<<i<<' ';

}




Measured memory_bytes: 256
n, m, l = map(int, input().rstrip().split())
#print(n, m, l)

A = [list(map(int, input().rstrip().split())) for _ in range(n)]
#print(A)

B = [list(map(int, input().rstrip().split())) for _ in range(m)]
#print(B)


array = []
for i in range(n):
    lst = []
    for j in range(l):
        t = 0
        for k in range(m):
            s = A[i][k]*B[k][j]
            t += s
        lst.append(t)
    ans = " ".join([str(u) for u in lst])
    print(ans)


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

using namespace std;

int main() {
	string str;
	cin >> str;
	int len = str.size();
	string foo = "";
	for (int i = 0; i < len; i++) {
		if (str[i] == '0') {
			foo = foo + '0';
		} else if (str[i] == '1') {
			foo += str[i];
		} else {
			if (foo.size() == 0) continue;
			foo.erase(foo.end() - 1);
		}
	}
	cout << foo << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;

int32_t main(){
	string st;
	cin >> st;
	char c = st[0];
	bool ans = false;
	for(auto x:st) if(x!=c) ans = true;
	if(ans)
		cout << "Yes\n";
	else
		cout << "No\n";	
}


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

int main() {
  int N;
  cin >> N;
  vector<long> L(88);
  L.at(0)=2L;
  L.at(1)=1L;
  for(int i= 2;i<N+2;i++)L.at(i)=L.at(i-2)+L.at(i-1);
  cout << L.at(N) <<endl;
 
}


Measured memory_bytes: 256
/*
    STARK_BOY
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
typedef pair<ll,ll> pii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define setbitc(x) __builtin_popcount(x)
#define init(x,a) memset(x,a,sizeof(x))
#define PI           3.14159265358979323846  /* pi */
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#define N 100005
//Variables Start
ll inf=1e18,MOD=1e9+7;
ll n,m,k,ar[N],dp[N][2];
string s,s1;
vi adj[N];
//Variables End

ll sub(ll a, ll b){return (a-b+MOD)%MOD;}
ll add(ll a, ll b){return (a+b)%MOD;}
ll mul(ll a, ll b){return (a*b)%MOD;}
void dfs(ll ver,ll par)
{
	dp[ver][0]=dp[ver][1]=1;
	for(auto i:adj[ver])
	{
		if(i!=par)
		{
			dfs(i,ver);
			dp[ver][0]=mul(dp[ver][0],add(dp[i][1],dp[i][0]));
			dp[ver][1]=mul(dp[ver][1],dp[i][0]);
		}
	}
}
int main()
{
    ios
    int ti=1;
    //cin>>ti;
    while(ti--)
    {
		cin>>n;        
		rep(i,0,n-1)
		{
			ll x,y;
			cin>>x>>y;
			adj[x].pb(y);
			adj[y].pb(x);
		}

		dfs(1,1);

		cout<<add(dp[1][0],dp[1][1])<<endl;
    }
    return 0;
        
}

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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s; cin >> s;

  for(int i = 0; i < s.size()/2; ++i) {
    if(s[i] != s[s.size() - 1 - i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  int n = (s.size()/2);
  for(int i = 0; i < n; ++i) {
    if(s[i] != s[n-i-1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  n = (s.size()+3)/2;
  for(int i = n - 1; i < n; ++i) {
    if(s[i] != s[n-i-1]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main {
  def calc(c:Char,a:Int,b:Int) = c match { case '+' => a+b;case '-'=> a-b;case '*'=>a*b }
  def loop2(a:Int,b:Int,c:Int,d:Int,ops:List[List[Char]]):Boolean = ops match {
    case Nil => false
    case op::tl =>
      if(calc(op(2),calc(op(1),calc(op(0),a,b),c),d)==10) {
        printf("(((%d %c %d) %c %d) %c %d)\n",a,op(0),b,op(1),c,op(2),d);true
      }
      else if(calc(op(1),calc(op(0),a,b),calc(op(2),c,d))==10) {
        printf("((%d %c %d) %c (%d %c %d))\n",a,op(0),b,op(1),c,op(2),d);true
      } else loop2(a,b,c,d,tl)
  }

  def loop(l:Iterator[Array[Int]],ops:List[List[Char]]):Unit = {
    if(l.isEmpty) println(0)
    else {
      val Array(a,b,c,d):Array[Int] = l.next
      if(loop2(a,b,c,d,ops)) return
      else loop(l,ops)
    }
  }

  def main(args:Array[String]) = {
    Iterator.continually(readLine).takeWhile ( s => s != "0 0 0 0").foreach { s =>
      val l = s.split(" ").map(_.toInt).permutations
      val op = List('+','-','*')
      val ops = { for(i<-op;j<-op;k<-op) yield List(i,j,k) }.toList
      loop(l,ops)
    }
  }
}

Measured memory_bytes: 44664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N;
  cin >> N;
  int cnt = 0;
  //vector<int> A(N);
  rep(i, N){
    int a;
    cin >> a;
    if(a % 2 != 0){
      cnt++;
    }
  }
  if(cnt % 2 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


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

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    ll r;
  	cin >> r;
  	cout << 3*r*r;
    
    return 0;
}

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

namespace FastFourierTransform {
	using comp = complex<double>;
	const double PI = acos(-1);
	int calcDeg(int degG, int degH) {
		int ret = 1;
		while(ret <= degG + degH) {
			ret <<= 1;
		}
		return ret;
	}
	void dft(vector<comp> &f, int deg, bool inv) {
		if(deg == 1) return;
		vector<comp> f0(deg / 2);
		vector<comp> f1(deg / 2);
		for(int i = 0; i < deg / 2; ++i) {
			f0[i] = f[2 * i];
			f1[i] = f[2 * i + 1];
		}
		dft(f0, deg / 2, inv);
		dft(f1, deg / 2, inv);
		comp root(cos(2 * PI / (double)deg), sin(2 * PI / (double)deg));
		if(inv) root = conj(root);
		comp x(1, 0);
		for(int i = 0; i < deg; ++i) {
			f[i] = f0[i % (deg / 2)] + x * f1[i % (deg / 2)];
			x *= root;
		}
	}
	template<typename T>
	vector<T> convolution(vector<T> &g, vector<T> &h) {
		int deg = calcDeg(g.size(), h.size());
		vector<comp> gg(deg);
		vector<comp> hh(deg);
		for(int i = 0; i < deg; ++i) {
			if(i < g.size()) gg[i].real(g[i]);
			if(i < h.size()) hh[i].real(h[i]);
		}
		dft(gg, deg, false);
		dft(hh, deg, false);
		vector<comp> ff(deg);
		for(int i = 0; i < deg; ++i) {
			ff[i] = gg[i] * hh[i];
		}
		dft(ff, deg, true);
		vector<T> f(deg);
		for(int i = 0; i < deg; ++i) {
			f[i] = round(ff[i].real() / deg);
		}
		return f;
	}
};


int main() {
	using namespace FastFourierTransform;
	int64_t n, m; cin >> n >> m;
	vector<int64_t> l(100010), r(100010);
	for(int i = 0; i < n; ++i) {
		int a; cin >> a;
		l[a]++;
		r[a]++;
	}
	vector<int64_t> c = convolution(l, r);
	int cn = c.size();
	int64_t cnt = 0, ans = 0;
	for(int64_t i = cn - 1; i > 0; --i) {
		cnt += c[i];
		ans += i * c[i];
		if(cnt >= m) {
			ans -= (cnt - m) * i;
			break;
		}
	}
	cout << ans << '\n';
	return 0;
}


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

using namespace std;

typedef long long LL;
const LL mod=1000000007;

int main()
{
//    ifstream cin("input.txt");
    LL s;
    cin>>s;
    if (s<3)
    {
        cout<<0;
        return 0;
    }
    LL** c=(LL**)calloc(s+1,sizeof(LL*));
    for (int i=0;i<=s;++i)
        c[i]=(LL*)calloc(s+1,sizeof(LL));
    for (int i=0;i<=s;++i)
        c[i][0]=c[i][i]=1;
    for (int n=2;n<=s;++n)
        for (int k=1;k<n;++k)
            c[n][k]=(c[n-1][k]+c[n-1][k-1])%mod;
    int boxes=s/3;
    LL sum=1;
    for (int k=2;k<=boxes;++k)
        sum=(sum+c[s-2*k-1][k-1])%mod;
    cout<<sum;
}



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

int main() {
  int n; cin >> n;
  int d, x; cin >> d >> x;
  vector<int> arr(n);
  for (auto &a : arr) cin >> a;
  --d;
  for (auto &a : arr) x += d/a + 1;
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  string s;
  cin >> s;
  for (char c = 'a'; c <= 'z'; c++) {
    ll cnt = 0;
    for (int i = 0; i < s.size(); i++) {
      if (c != s[i]) cnt++;
      if (cnt == s.size()) {
        cout << c << endl;
        return 0;
      }
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
def main():
    n=int(input())
    s=input()
    ans = 1

    r_cnt = s.count("R")
    g_cnt = s.count("G")

    ans = r_cnt*g_cnt*(n-r_cnt-g_cnt)
 
    for i in range(n):
        for j in range(i,n):
            s1 = s[i]
            s2 = s[j]
            if s1 != s2:
                t = (s1,s2)
                for s3 in "RGB":
                    if s3 not in t:
                        if 2*j-i < n and s[2*j-i] == s3:
                            ans -= 1
                        continue

    print(ans)

if __name__ == "__main__":
    main()

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

int main()
{
    int a[3];
    for(int k=0;k<3;k++)
        cin>>a[k];
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)
    cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
s = input()
ans = 0
for i in range(n-1):
    s1 = s[:i+1]
    it = iter(s[i+1:])
    it2 = iter(s[i+1:])
    s2 = dict(zip(it,it2))
    visited = {}
    for i in s1:
        if i in visited:
            continue
        if i in s2:
            visited[i] = 1
    ans = max(ans,len(visited))
print(ans)

Measured memory_bytes: 68104
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,v,p;
int m,a[100005];
bool cmp(int a,int b)
{
	return a>b;
}
int l,r,mid;
int ans;
bool check(int x)
{
	if(x<=p)
	return true;
	if(a[x]+m<a[p])
	return false;
	int now=m*(p-1+n-x+1);
	for(int i=p;i<x;i++)
	now+=a[x]+m-a[i];
	return now>=m*v;
}
signed main()
{
	cin>>n>>m>>v>>p;
	for(int i=1;i<=n;++i)
	cin>>a[i];
	sort(a+1,a+1+n,cmp);
	l=1,r=n;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid))
		{
			l=mid+1;
			ans=mid;
		}
		else
		r=mid-1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4516
dic={}
a=[]
for i in range(1,100):
    dic[i]=[-1,-1]
for i in range(3):
    a.append(list(map(int,input().split())))
    for j in range(3):
        dic[a[i][j]]=[i,j]
n=int(input())
for i in range(n):
    x=int(input())
    if(dic[x]!=[-1,-1]):
        a[dic[x][0]][dic[x][1]]=0
flag=0
for i in range(3):
    if(max(a[i][1],a[i][2],a[i][0])==0):
        flag=1
        break
    elif(max(a[1][i],a[2][i],a[0][i])==0):
        flag=1
        break
if(max(a[0][0],a[1][1],a[2][2])==0):
    flag=1
elif(max(a[0][2],a[1][1],a[2][0])==0):
    flag=1
if(flag==1):
    print ('Yes')
else:
    print ('No')

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    constexpr unsigned long MOD = 1000000007;
    vector<unsigned long> coef(N);
    iota(coef.begin(), coef.end(), 2UL);
    const auto& modpow = [](unsigned long n) -> unsigned long {
        unsigned long ret{1}, c{2};
        while(n){
            if(n & 1)(ret *= c) %= MOD;
            (c *= c) %= MOD;
            n >>= 1;
        }
        return ret;
    };
    unsigned long d{modpow(2 * N - 2)};
    vector<unsigned long> C(N);
    for(auto& i : C)cin >> i;
    sort(C.begin(), C.end(), greater<>());
    auto t{inner_product(C.begin(), C.end(), coef.begin(), 0UL, [](auto i, auto j){return (i + j) % MOD;}, [](auto i, auto j){return i * j % MOD;})};
    cout << t * d % MOD << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

template<i64 M>
struct modint {
  i64 a;
  constexpr modint(const i64 x = 0) noexcept: a((x % M + M) % M) {}
  constexpr i64 value() const noexcept { return a; }
  constexpr modint pow(i64 r) const noexcept {
    modint ans(1);
    modint aa = *this;
    while(r) {
      if(r & 1) {
        ans *= aa;
      }
      aa *= aa;
      r >>= 1;
    }
    return ans;
  }
  constexpr modint& operator+=(const modint r) noexcept {
    a += r.a;
    if(a >= M) a -= M;
    return *this;
  }
  constexpr modint& operator=(const i64 r) {
    a = (r % M + M) % M;
    return *this;
  }
  constexpr modint& operator-=(const modint r) noexcept {
    a -= r.a;
    if(a < 0) a += M;
    return *this;
  }
  constexpr modint& operator*=(const modint r) noexcept {
    a = a * r.a % M;
    return *this;
  }
  constexpr modint& operator/=(modint r) noexcept {
    i64 ex = M - 2;
    while(ex) {
      if(ex & 1) {
        *this *= r;
      }
      r *= r;
      ex >>= 1;
    }
    return *this;
  }

  constexpr modint operator+(const modint r) const {
    return modint(*this) += r;
  }
  constexpr modint operator-(const modint r) const {
    return modint(*this) -= r;
  }
  constexpr modint operator*(const modint r) const {
    return modint(*this) *= r;
  }
  constexpr modint operator/(const modint r) const {
    return modint(*this) /= r;
  }
};


int main() {
  i64 N, M;
  cin >> N >> M;
  vector<i64> S(N);
  vector<i64> T(M);
  rep(i,0,N) cin >> S[i];
  rep(i,0,M) cin >> T[i];
  using fp = modint<(i64)(1e9 + 7)>;
  vector<vector<fp>> dp(N + 1, vector<fp>(M + 1));
  rep(i,0,N) {
    rep(j,0,M) {
      if(S[i] == T[j]) {
        dp[i + 1][j + 1] += dp[i][j] + 1;
      }
      dp[i + 1][j + 1] += dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
    }
  }
  cout << (dp[N][M] + fp(1)).value() << endl;
}


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

#define pb push_back
#define PQ priority_queue
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

typedef long long ll;
typedef long double ld;

//__builtin_popcount(x)

using namespace std;

/*const int mod = 1e9 + 7;

ll add(ll a, ll b) {
    ll res = a + b;
    if (res >= mod) res -= mod;
    return res;
}

ll sub(ll a, ll b) {
    ll res = a - b + mod;
    if (res >= mod) res -= mod;
    return res;
}

ll mul(ll a, ll b) {
    return (((a % mod) * (b % mod)) % mod);
}*/

/*vector<int> find_dividers(int x) {
    vector<int> dividers;

    for (int i = 1; i <= sqrt(x); i++) {
        if (x % i == 0) {
           dividers.push_back(i);
            if (i * i != x) {
                dividers.push_back(x / i);
            }
        }
    }

    return dividers;
}*/

/*int nok(int a, int b) {
    return a / __gcd(a, b) * b;
}*/

/*map<ll, ll> mp;
ll ans(ll v, ll u, ll w) {
    ll total = 0;
    while (v != u) {
        if (v > u) {
            total += mp[v];
            mp[v] += w;
            v /= 2;
        } else {
            total += mp[u];
            mp[u] += w;
            u /= 2;
        }
    }
    return total;
}*/

void solve() {
    string s;
    cin >> s;
    ll total = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        total += s[i] - 48;
    }
    total % 9 ? puts("No") : puts("Yes");
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    string s;cin>>s;
    bool a=true;
    if(s[0]!='A')a=false;
    bool b=false;
    for(int i=2;i<s.size()-1;++i){
        if(s[i]=='C'){
            b=true;
            break;
        }
    }
    if(!b)a=false;
    int cnt=0;
    rep(i,s.size()){
        if(s[i]<97)cnt++;
    }
    if(cnt!=2)a=false;
    if(a)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;
}


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

#include <string.h>

#define N_MIN       (1)
#define N_MAX       (100)
#define A_MIN       (0)
#define A_MAX       (1000)
#define A_MAX_DIGIT (4)
#define N_ARRAY     (N_MAX * A_MAX_DIGIT + 1)

char *getsn(char *s, int n);
void insertionSort(int *, int N);
void printArray(int *, int N);

int main(void)
{
    char str[N_ARRAY];
    int  A[N_MAX], i, j, length1;
    int  flag    = 0;
    int  length2 = 0;

    /* input line 1 */
    if(getsn(str, 4) == NULL)
    {
        printf("Err: input line 1 is invalid.");
        return -1;
    }

    if((atoi(&str[0]) < N_MIN) || (N_MAX < atoi(&str[0])))
    {
        printf("Err: %d is out of range.", atoi(&str[0]));
        return -1;
    }
    length1 = atoi(&str[0]);

    /* input line 2 */
    if(getsn(str, length1 * A_MAX_DIGIT + length1) == NULL)
    {
        printf("Err: input line 2 is invalid.");
        return -1;
    }

    /* get N elements */
    j = strlen(str);
    for(i=0; i<j; i++)
    {
        if(str[i] == ' ')
        {
            flag = 0;
        }
        else
        {
            if(flag == 0)
            {
                A[length2] = atoi(&str[i]);
                if((A[length2] < A_MIN) || (A_MAX < A[length2]))
                {
                    printf("Err: %d is out of range.", A[length2]);
                    return -1;
                }
                length2++;
                flag = 1;
            }
        }
    }

    /* check the number of elements between line 1 and 2 */
    if(length1 != length2)
    {
        printf("Err: line 1 and 2 are inconsistent.");
        return -1;
    }

    /* exec insertionSort */
    insertionSort(A, length2);

    return 0;
}

char *getsn(char *s, int n)
{
    char *ln;

    if(fgets(s, n, stdin) == NULL)
    {
        return NULL;
    }

    ln = strchr(s, '\n');
    if(ln)
    {
        *ln = '\0';
    }
    else
    {
        while(1)
        {
            int c = getchar();
            if (c == '\n' || c == EOF) break;
        }
    }
    return s;
}

void insertionSort(int A[], int N)
{
    int  i, j, v;

    printArray(A, N);

    for(i=1; i<N; i++)
    {
        v = A[i];
        j = i - 1;
        while((j>=0) && (A[j] > v))
        {
            A[j+1] = A[j];
            j--;

        }
        A[j+1] = v;
        printArray(A, N);
    }
}

void printArray(int A[], int N)
{
    int i;

    for(i=0; i<N-1; i++)
    {
        printf("%d ", A[i]);
    }
    printf("%d\n", A[N-1]);
}

Measured memory_bytes: 1816
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <numeric> //accumulate
#include <unordered_map>

using namespace std;

//???????????°??????TEST????????????????????¬???????????????????????????????????¢????????????
#define TEST //*******************************************************************************************************************************************

//?????????????????¨??§?????\????????????????????????????????°?????????????¨???????????????????dout???????????????????????§???????????¬??????????????????????????????????????????
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //???????????°??????dout?????????????????????????????????
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummy?????????????????????????????????????????¨?????¢?????¢???????????????
    //???????????¨??????????????????goodbit?????????????????????????????¨???????????´????????????????????????????????¨?????°?????????????????§???????????????????????????????????? http://d.hatena.ne.jp/linden/20060427/p1
#endif





int main(void) {
 
    int N;
    cin >> N;
    
    string command;
    string str;
    
    
    unordered_map<string, int> mp;


    
    for(int i=0; i<N; i++) {
        cin >> command >> str;
        
        if(command[0]=='i') {
            mp[str] = 1;
        }
        else if(command[0]=='f') {
            cout << (mp[str] ? "yes" : "no") << endl;
        }
        
    }
    
    
//    vector<string> dictionary;
//    vector<string>::iterator v;
//    
//    for(int i=0; i<N; i++) {
//        cin >> command >> str;
//        
//        if(command[0]=='i') {
//            dictionary.push_back(str); //??????
//            
//            v = dictionary.begin();
//            while(*v < str) v++;
//            
//            if( v!=dictionary.end() ) {
//                dictionary.insert(v, str);
//                dictionary.pop_back(); //????????????
//            }
//            
////            //display dictionary
////            for (vector<string>::iterator v=dictionary.begin(); v!=dictionary.end(); v++) dout<<*v<<" ";
////            dout << endl;
//            
//        }
//        else if(command[0]=='f') {
//            ans = 0;
//            for (v=dictionary.begin(); v!=dictionary.end(); v++) {
//                if(*v==str) {
//                    ans = 1;
//                    break;
//                }
//            }
//            
////            dout << str << " " << v-dictionary.begin() << " ";
//            cout << (ans ? "yes" : "no") << endl;
//        }

        
        
    
    
    return 0;
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9+7;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}


class Mll
{
    public:
    ll x;

    Mll() : x(0){}
    Mll(ll x=0) : x((x%MOD+MOD)%MOD){}

    Mll operator-() const
    {
        return Mll(-x);
    }

    Mll& operator+=(const Mll& A)
    {
        if((x += A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator-=(const Mll& A)
    {
        if((x += MOD - A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator*=(const Mll& A)
    {
        (x *= A.x) %= MOD;
        return *this;
    }
    
    Mll operator+(const Mll& A)
    {
        Mll res(*this);
        return res+=A;
    }
    Mll operator-(const Mll& A)
    {
        Mll res(*this);
        return res-=A;
    }
    Mll operator*(const Mll& A)
    {
        Mll res(*this);
        return res*=A;
    }
    
    Mll pow(ll t) const // t乗
    {
        if(t==0) return 1;
        Mll A = pow(t>>1);
        A *= A;
        if(t&1) A *= *this;
        return A;
    }

    // for prime mod
    Mll inv() const
    {
        return pow(MOD-2);
    }
    Mll& operator/=(const Mll& A)
    {
        return (*this) *= A.inv();
    }
    Mll operator/(const Mll& A) const
    {
        Mll res(*this);
        return res/=A;
    }

    friend ostream& operator<<(ostream& os, const Mll& M)
    {
        os << M.x;
        return os;
    }
};

vector<Mll> ALLIN_MLL(ll N)
{
    vector<ll> numbers_ll(N);
    ALLIN1_NUMBER(numbers_ll);

    vector<Mll> numbers_Mll;
    for(ll i=0;i<N;i++)
    {
        Mll add(numbers_ll[i]);
        numbers_Mll.push_back(add);
    }

    return numbers_Mll;
}

class UnionFind
{
    public:
    vector<ll> par;

    UnionFind(ll n) : par(n,-1){}

    ll root(ll x)
    {
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool same(ll x, ll y)
    {
        return root(x) == root(y);
    }

    void unite(ll x, ll y)
    {
        x = root(x); y = root(y);
        if(x==y) return;
        if(par[x] > par[y]) swap(x,y);
        par[x] += par[y];
        par[y] = x;
    }

    ll size(ll i)
    {
        return -par[root(i)];
    }
};


static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

int main()
{
    ll N,M,K;
    cin >> N >> M >> K;

    vector<ll> dame(N,0);

    UnionFind U(N);

    for(ll i=0;i<M;i++)
    {
        ll A,B;
        cin >> A >> B;
        A--; B--;
        dame[A]++;
        dame[B]++;
        U.unite(A,B);
    }
    for(ll i=0;i<K;i++)
    {
        ll C,D;
        cin >> C >> D;
        C--; D--;
        if(U.same(C,D))
        {
            dame[C]++;
            dame[D]++;
        }
    }

    for(ll i=0;i<N;i++)
    {
        cout << U.size(i) - dame[i] - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL A; cin >> A;
    string B; cin >> B;
    LL C;
    C = (B[0]-'0') * 100 + (B[2]-'0') * 10 + (B[3]-'0') * 1;
    cout << A * C / 100 << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>

#define INF 1000000000;
 
int MatrixOrder();
 
int n,m[101][101];
int p[111];
 
int main(){
  int i,j,c;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    if(i==n-1) scanf("%d %d",&p[i],&p[i+1]);
    else scanf("%d%d",&p[i],&c);
  }
 
  printf("%d\n",MatrixOrder());
 
  return 0;
}
 
int MatrixOrder(){
  int i,j,l,k,q;
 
  for(i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = INF;
      for(k=i;k<=j-1;k++){
	q = m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	m[i][j] = (m[i][j]<q)?m[i][j]:q;
      }
    }
  }
  return m[1][n];
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

int main(void)
{
  int val1, val2;

  while (std::cin >> val1 >> val2) {

    int sum = val1 + val2;

    int numDigit = 0;
    while (sum > 0) {
      sum /= 10;
      numDigit++;
    }

    std::cout << numDigit << std::endl;
  }

  return 0;
}

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

void read_int (int &a) {
	char c=getchar(); a=0;
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') a=(a<<1)+(a<<3)-48+c,c=getchar();
	return;
}

int n,a[200003];

int num[200003],pla[200003],tot,w;

bool inc (int lim) {
	if (pla[tot]!=w)
		++tot,pla[tot]=w,num[tot]=0;
	++num[tot];
	while (num[tot]==lim) {
		if (pla[tot]==1) return false;
		if (pla[tot-1]!=pla[tot]-1)
			--pla[tot],num[tot]=1;
		else --tot,++num[tot];
	} return true;
}

bool judge (int lim) {
	w=a[1]; tot=0;
	for (int now=2;now<=n;now++) {
		if (a[now]<w) while (pla[tot]>a[now]) --tot;
		else if (a[now]>w) { w=a[now]; continue; }
		w=a[now];
		if (!inc(lim)) return false;
	} return true;
}

int main () {
	
	read_int(n);
	for (int i=1;i<=n;i++)
		read_int(a[i]);
	
	int left=1,right=n,mid,ans;
	while (left<=right) {
		mid=left+right>>1;
		if (judge(mid)) ans=mid,right=mid-1;
		else left=mid+1;
	} printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 2372
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T &a, T b) {if (a < b) {a = b;return 1;}return 0;}
template<class T> inline bool chmin(T &a, T b) {if (a > b) {a = b;return 1;}return 0;}

int main(){
  int n,m;
  cin >> n >> m;
  rep(i,m) {
    int x;
    cin >> x;
    n -= x;
  }
  if (n < 0) cout << -1 << endl;
  else cout << n << endl;
}


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

#define ll long long
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); (i)++)
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;
#define vec vector
#define vvi vector<vector<int>>

struct Edge {
   int from, to, cost;
};
const ll INF = 4e18;
int N, M;
vec<vec<Edge>> G;

void dfs(vec<ll> &dist, int pos) {
   for (Edge e : G[pos]) {
      if (dist[e.to] == INF) {
         dist[e.to] = dist[pos] + e.cost;
         dfs(dist, e.to);
      }
   }
}

int main() {
   cin >> N >> M;
   G = vec<vec<Edge>>(N);
   rep (i, 0, M) {
      int l, r, d;
      cin >> l >> r >> d;
      l--, r--;
      G[l].push_back(Edge{l, r, d});
      G[r].push_back({r, l, -d});
   }

   vector<ll> dist(N, INF);
   rep (i, 0, N) {
      if (dist[i] == INF) {
         dist[i] = 0;
         dfs(dist, i);
      }
   }

   rep (i, 0, N) {
      for (Edge e : G[i]) {
         if (dist[e.to] - dist[e.from] != e.cost) {
            puts("No");
            return 0;
         }
      }
   }
   puts("Yes");

   return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
/**  I'm Klaus, NicKlaus :v **/
using namespace std;
#define ms(a,v) memset(a,v,sizeof a)
#define ll long long
#define LOG2(X) ((unsigned) (8*sizeof(int) - __builtin_clz((X)) - 1))
ll gcd(ll x, ll y){return (y ? gcd(y, x%y) : x); }
ll lcm(ll x, ll y){return x*(y/gcd(x,y));}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	#ifdef LOCAL_JUDGE
		//freopen("in_out/in.txt", "rt", stdin);
		//freopen("int_out/out.txt", "wt", stdout);
	#endif
	vector<string> a = { "Sunny", "Cloudy", "Rainy"};
	string s;
	cin>>s;
	if(s == a[0]) cout<<a[1];
	if(s == a[1]) cout<<a[2];
	if(s == a[2]) cout<<a[0];
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    map<string, int> mp;
    for(int i=0;i<n;++i){
        string s;
        cin >> s;
        mp[s]++;
    }
    int m;
    cin >> m;
    for(int i=0;i<m;++i){
        string t;
        cin >> t;
        mp[t]--;
    }

    int ans = 0;
    for(auto e : mp){
        ans = max(ans, e.second);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		int n=scan.nextInt();
		if(n<1200) System.out.println("ABC");
		else if(n<2800) System.out.println("ARC");
		else System.out.println("AGC");
	}

}


Measured memory_bytes: 27048
// https://atcoder.jp/contests/abc100/tasks/abc100_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

struct Cake {
    int x, y, z;
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<Cake> v(N);
    for (auto &t : v) {
        cin >> t.x >> t.y >> t.z;
    }
    int maxv = 0;
    // x, y, zで±を反転
    REP(i, 8) {
        sort(ALL(v), [&](Cake const &lhs, Cake const &rhs) {
            int ls = lhs.x * (i & 1 ? 1 : -1) + lhs.y * (i & 2 ? 1 : -1) +
                     lhs.z * (i & 4 ? 1 : -1);
            int rs = rhs.x * (i & 1 ? 1 : -1) + rhs.y * (i & 2 ? 1 : -1) +
                     rhs.z * (i & 4 ? 1 : -1);
            // 降順（大きい順）
            return ls > rs;
        });
        int sum = 0;
        REP(j, M) {
            sum += v[j].x * (i & 1 ? 1 : -1) + v[j].y * (i & 2 ? 1 : -1) +
                   v[j].z * (i & 4 ? 1 : -1);
        }
        maxv = max(maxv, sum);
    }
    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio> 
using namespace std;
int n,k,a[200010];
int l,r;
int main() {
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    l=1,r=k;
    while(r<=n-1) {
        if(a[l]<a[r+1])
            puts("Yes");
        else
            puts("No");
        l++,r++;
    }
    return 0;
}

Measured memory_bytes: 3948
#include<iostream>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    double money=0; 
    vector<vector<string>> xu(N,vector<string>(2));   
    for (int i=0;i<N;i++){
        for (int j=0;j<2;j++){
            cin >> xu.at(i).at(j);
        }
        
        if (xu.at(i).at(1)=="JPY" ){
            money += stod(xu.at(i).at(0));
        } else {
            money += stod(xu.at(i).at(0))*380000.0;
        }
    }
    cout << setprecision(20) << money << endl;
}


Measured memory_bytes: 256
// Example program
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int a;
    int b;
    int c;
    cin>>a;
    cin>>b;
    cin>>c;
    
    vector<int> v{a,b,c};
    sort(v.begin(),v.end());
    
    int size = v.size();
    for (int i = 0; i < size - 1; i++) {
        cout << v[i] << " ";
    }
    cout << v[2] << endl;
}

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

int main() {
  int w,h,x,y,r;
  cin >> w >> h >> x >> y >> r;
  if(x-r>=0 && x+r<=w && y-r>=0 && y+r<=h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

const int N = 1e5 + 10;

int n, K, a[N];

int gcd(int x, int y){
	if(x < y)	swap(x, y);
	int z = x % y;
	while(z){
		x = y; y = z; z = x % y;
	}
	return y;
}

bool ok(){
	if(n == 1){
		return a[0] == K;
	}
	int g = a[0];
	for(int i=1; i<n; i++){
		g = gcd(g, a[i]);
		if(a[i] == K)	return 1;
	}
	if(K % g != 0)	return 0;
	K /= g;
	bool same = 1;
	int mx = 0;
	for(int i=0; i<n; i++){
		a[i] /= g;
		if(i && a[i]!=a[i-1]){
			same = 0;
		}
		mx = max(mx, a[i]);
	}
	if(K > mx)	return 0;
	if(same)	return a[0] == K;
	return 1;
}

int main(){
	scanf("%d %d", &n, &K);
	for(int i=0; i<n; i++)	scanf("%d", a+i);
	puts(ok()?"POSSIBLE":"IMPOSSIBLE");
	return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int ans = 0;
    if (c <= a - b) {
        ans = 0;
    }
    else {
        ans = c - (a - b);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//constexpr ll P = 1000000007;
	//constexpr ll P = 998244353;

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

Measured memory_bytes: 3520
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a*b% 2 == 0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 23764
from collections import deque
class Dinic:
    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap):
        forward = [to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = 10**9 + 7
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow

x,y,e = map(int, input().split())
s = x+y
t = x+y+1
dinic = Dinic(x+y+2)

for _ in range(e):
    xv,yv = map(int, input().split())
    dinic.add_edge(xv,x+yv,1)

for xv in range(x):
    dinic.add_edge(s,xv,1)
for yv in range(x,x+y):
    dinic.add_edge(yv,t,1)

print(dinic.flow(s,t))


Measured memory_bytes: 7968
n = int(input())
lst = [0 for _ in range(n + 1)]
num_dict = {}
for i in range(n):
    num_dict[i+1] = int(input())

count = 0
num = 1
lst[1] = -1
while 1:
    count += 1
    num = num_dict[num]
    if num == 2:
        print(count)
        break
    if lst[num] == -1:
        print(-1)
        break
    lst[num] = -1

Measured memory_bytes: 18688