akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 21;
int g[N][N];
int dp[1 << N];
bool visit[1 << N];
int n;

int solve(int mask) {
  if (mask == 0) return 1;
  int u = n - __builtin_popcount(mask);
  int& ret = dp[mask];
  if (visit[mask]) return ret;
  visit[mask] = true;
  ret = 0;
  for (int i = 0; i < n; ++i) {
    if (!(mask & (1 << i)) || !g[u][i]) continue;
    ret = (ret + solve(mask ^ (1 << i))) % MOD;
  }
  return ret;
}

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      scanf("%d", &g[i][j]);
    }
  }
  int ret = solve((1 << n) - 1);
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 10496
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
cnt=0
for i in range(n):
  a=list(map(int,input().split()))
  mysum=0
  for j in range(m):
    mysum+=a[j]*b[j]
  if mysum+c>0:
    cnt+=1

print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
ll a[200001];
bool is_it_possible(ll val,ll k,ll n)
{
    ll i,j,l,m,o,p,q,s,flag;
    s=0;
    for(i=0;i<n;i++)
    {
        s+=(a[i]-1)/val;
    }
    return s<=k;
}
void solve()
{
    ll i,j,k,l,m,n,q,s,t;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll start=1,end=1e10,mid,ans;
    while(start<=end)
    {
        mid=(start+end)/2;
        if(is_it_possible(mid,k,n))
        {
            ans=mid;
            end=mid-1;
        }
        else 
        {
            start=mid+1;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ll i,j,k,l,m,n,o,p,q,r,t,x;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5128
#include<stdio.h>

int main(void) {
	int i, j, n, k, d, scan, ans = 0;
	int sunuke[101];

	for (i = 0; i <= 100; ++i) {
		sunuke[i] = 0;
	}
	scanf("%d %d", &n, &k);
	for (i = 0; i < k; ++i) {
		scanf("%d", &d);
		for (j = 0; j < d; ++j) {
			scanf("%d", &scan);
			sunuke[scan]++;
		}
	}

	for (i = 1; i <= n; ++i) {
		if (sunuke[i] == 0) {
			ans++;
		}
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 1732
#include<stdio.h>
int main()
{
	int A, B, T, k, x;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &T);
	k = 1;
	x = 0;
	while (k*A < T + 0.5) {
		x = x + B;
		k++;
	}
	printf("%d\n", x);


	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

#define P 1000000007

using namespace std;

long long gcd(long long a, long long b) {
  long long c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}

int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<long long > a;
  a.resize(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  bool b = true;
  for(int i = 0; i < n; i++) {
    if(a[i] == k) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
    if(a[i] > k) {
      b = false;
    }
  }
  if(b) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  if(n == 1) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  sort(a.begin(), a.end());
  long long gc = gcd(a[1], a[0]);
  for(int i = 0; i < n - 1; i++) {
    long long a1 = min(gc, a[i + 1]);
    long long a2 = max(gc, a[i + 1]);
    gc = gcd(a2, a1);
  }
  if(k % gc == 0) {
    cout << "POSSIBLE" << endl;
    return 0;
  } else {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  int n,rui[3],outcnt,i,j,k,point,homeruncnt;
  string data;
  cin >> n;
  for(i=0;i<n;i++){
    outcnt=0;
    homeruncnt=0;
    point=0;
    for(j=0;j<3;j++)
      rui[j]=0;
      while(1){
      cin >> data;
      if(data=="HIT"){
        if(rui[0]==0) rui[0]=1;
	else{
	  if(rui[1]==0) rui[1]=1;
          else{
	    if(rui[2]==0) rui[2]=1;
	    else point++;
	  }
	}
      }
      else if(data=="HOMERUN"){
        for(k=0;k<3;k++){
	  if(rui[k]==1){
	    homeruncnt++;
	    rui[k]=0;
	  }
	}
        point=point+homeruncnt+1;
	homeruncnt=0;
      }
      else{
        outcnt++;
      }
      if(outcnt==3){
	outcnt=0;
        cout << point << endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,m;
  cin >> n >> m;
  vi flag(n);
  rep(i,n) flag[i] = 0;
  vi pe(n,0);
  vi ac(n,0);
  rep(i,m){
    int p;
    string s;
    cin >>p>>s;
    p--;
    if(s == "AC") flag[p] = 1;
    else{
      if(flag[p] == 0) pe[p]++;
    }
   
  }
  int wa = 0,AC = 0;
  rep(i,n){
    wa+=pe[i]*flag[i];
    AC+=flag[i];
  }
  cout<<AC<<" "<<wa<<endl;
  return 0;
}


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m;
    cin >> n >> m;

    std::vector<std::vector<ll> > G(n);
    ll a[n];
    rep(i, n) {
        cin >> a[i];
        G[i].push_back(a[i]-1);
    }

    ll ans = 0;
    std::vector<ll> v(n, 0);
    v[0]++;
    ll loop = 0;
    std::vector<ll> l;
    rep(i, m) {
        ans = G[ans][0];
        v[ans]++;
        if ( v[ans] > 2 || loop ) {
            loop = 1;
            if ( v[ans] > 3 ) {
                m -= i+1;
                break;
            }
            l.push_back(ans);
        }
    }

    if ( loop ) {
        /*
        cout << "Yes";
        rep(i, l.size()) {
            cout << l[i] << " ";
        }
        cout << endl;*/
        cout << l[m%l.size()]+1 << endl;
    } else {
        cout << ans+1 << endl;
    }
    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto&& e : a) cin >> e;
  int l(0), r(0);
  int x(0);
  int64_t ans(0);

  while (l < n) {
    if (l == r) {
      x = a[l];
      r++;
    }
    while (r < n && ((x & a[r]) == 0)) {
      x |= a[r];
      r++;
    }
    ans += r - l;
    x ^= a[l];
    l++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <list>
#include <string>
using namespace std;

int main() {
    string s;
    cin >> s;
    int ct=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='2') ct++;
    }
    cout << ct << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    int r=read();
    cout<<2*PI*r<<endl;
	return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
#define vec vector
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll dp[10000][100],dp2[10000][100];

int main(){
	fast_io();
	string s;
	int d;
	cin >> s >> d;
	int n = s.length();
	cu(i,0,10)dp[0][i % d] += 1;
	cu(i,1,10000){
		cu(j,0,10){
			int add = j;
			cu(k,0,100){
				dp[i][(k + add) % d] += dp[i-1][k];
				dp[i][(k + add) % d] %= MOD;
			}
		}
	}
	fu(i,0,s[n-1] - '0')dp2[0][i % d] += 1;
	cu(i,1,n){
		cu(j,0,s[n - i - 1] - '0'){
			int add = j;
			cu(k,0,100){
				dp2[i][(k + add) % d] += dp[i-1][k];
				dp2[i][(k + add) % d] %= MOD; 
			}
		}
		int add = (s[n - i - 1] - '0');
		cu(k,0,100){
			dp2[i][(k + add) % d] += dp2[i-1][k];
			dp2[i][(k + add) % d] %= MOD; 
		}
	}
	cout << (dp2[n-1][0] + MOD - 1) % MOD << '\n';
}


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

int main()
{
  int64_t N, cnt = 0;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i) >> B.at(i);
  }
  for (int i = N - 1; i >= 0; i--)
  {
    if ((A.at(i) + cnt) % B.at(i) == 0)
      continue;
    cnt += B.at(i) - (A.at(i) + cnt) % B.at(i);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;



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

    sort(a.begin(),a.end());

    ll cost=0LL;
    ll res=0LL;
    bool flag = false;
    for (int i = 0; i < n; i++) {
        if(cost+a[i]>x)break;
        cost+=a[i];
        res++;
        if(i==n-1)flag=true;
    }
    if(res>0&&cost<x&&flag)res--;

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
A, B, C, D, E, F = map(int, input().split())

i = 0
j = 0
X = []

while A*i <= F:
    j = 0
    while A*i + B*j <= F:
        X.append(A*i + B*j)
        j += 100
    i += 100
X = sorted(list(set(X)))

i = 0
j = 0
Y = []

while C*i <= F:
    j = 0
    while C*i + D*j <= F:
        Y.append(C*i + D*j)
        j += 1
    i += 1
Y = sorted(list(set(Y)))

ans1 = X[1]
ans2 = 0
max_con = 0

for x in X[1:]:
    for y in Y:
        if x + y > F:
            break
        elif x + y != 0:
            con = 100*y / (x + y)
            if con > max_con and y <= E*x/100:
                ans1 = x + y
                ans2 = y
                max_con = con

print(ans1,ans2)


Measured memory_bytes: 12456
al = "abcdefghijklmnopqrstuvwxyz"
s = input()
if len(s)<26:
  for i in al:
    if i not in s:
      print(s+i)
      break
else:
  if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    k = []
    for i in range(25, 0, -1):
      k.append(s[i])
      if s[i-1] < s[i]:
        for j in sorted(k):
          if j > s[i-1]:
            print(s[:i-1] + j)
            exit()

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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<int>> A(N, vector<int>(M));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[i][j]; A[i][j]--;
		}
	}
	int l = 0, r = N;
	while (l + 1 < r) {
		int c = (l + r) / 2;
		vector<int> v(N);
		vector<int> ex(M);
		bool flag = true;
		int cnt = M;
		while (true) {
			vector<int> cc(M);
			int ma = 0, val = 0;
			for (int i = 0; i < N; i++) {
				cc[A[i][v[i]]]++;
				if (ma < cc[A[i][v[i]]]) {
					ma = cc[A[i][v[i]]];
					val = A[i][v[i]];
				}
			}
			if (ma <= c) {
				break;
			}
			else {
				ex[val] = 1;
				cnt--;
			}
			if (cnt == 0) {
				flag = false;
				break;
			}
			for (int i = 0; i < N; i++) {
				while (ex[A[i][v[i]]]) {
					v[i]++;
				}
			}
		}
		if (flag) {
			r = c;
		}
		else {
			l = c;
		}
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int c = scanner.nextInt();
			if ((n | c) == 0)
				break;
			int[] a = new int[n];
			int[] b = new int[c];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < 16; j++)
					a[i] |= (scanner.nextInt() << j);
			for (int i = 0; i < c; i++)
				for (int j = 0; j < 16; j++)
					b[i] |= (scanner.nextInt() << j);
			int[][] dp = new int[2][1 << 16];
			Arrays.fill(dp[0], -1);
			dp[0][0] = 0;
			int X = 1;
			for (int i = 0; i < n; i++, X = 1 - X) {
				Arrays.fill(dp[X], -1);
				for (int S = 0; S < 1 << 16; S++) {
					if (dp[1 - X][S] == -1)
						continue;
					int light = S | a[i];
					for (int j = 0; j < c; j++) {
						int pushed = light & b[j];
						int point = Integer.bitCount(pushed);
						int nx = light & ~b[j];
						if (dp[X][nx] < dp[1 - X][S] + point) {
							dp[X][nx] = dp[1 - X][S] + point;
						}
					}
				}
			}
			int max = 0;
			for (int i = 0; i < 1 << 16; i++)
				max = Math.max(max, dp[1 - X][i]);
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 43904
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

const int N = 1005;
ll x[3][N], val[N];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    for(int i  = 0; i < n; ++i) {
        scanf("%lld %lld %lld", &x[0][i], &x[1][i], &x[2][i]);
    }


    long long res = -1e18;
    for(int i = 0; i < 8; i++) {
        for(int k = 0; k < n; ++k) {
            val[k] = 0LL;
            for(int j = 0; j < 3; ++j) {
                if((i >> j) & 1) {
                    val[k] += x[j][k];
                }
                else val[k] -= x[j][k];
            }
        }
        sort(val, val + n, greater< ll>());
        ll sum = accumulate(val, val + m, 0LL);
        res = max(sum, res);
    }
    cout << res << "\n";
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll n, m;
    cin>>n>>m;
    cout<<(n-1)*(m-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
nm=[[] for _ in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    nm[a].append(b)
    nm[b].append(a)
for i in range(n):
    nm[i]=list(set(nm[i]))
visited=[0]*(n+1)
count=0
for i in range(n):
    if visited[i]==0:
        stack=deque()
        stack.append(i)
        visited[i]+=1
        temp=1
        while stack:
            x=stack.pop()
            
            for j in nm[x]:
                if visited[j]==0:
                    visited[j]+=1
                    stack.append(j)
                    temp+=1
        count=max(temp,count)
print(count)

Measured memory_bytes: 122960
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int p, A=0, B=0, C=0;
    REP(i, n){
        cin >> p;
        if(p <= a) A++;
        else if(a < p && p <= b) B++;
        else C++;
    }

    cout << min({A, B, C}) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int n;

int main() {
    cin >> n;
    int sum = 0;
    int x = 0, y = 0, tt = 0;
    for (int i = 1; i <= n; i++) {
        int t,  xx,  yy;
        scanf("%d%d%d", &t, &xx, &yy);
        if (tt + abs(x - xx) + abs(y - yy) > t) {
            printf("No\n");
            return 0;
        }
        else {
            if ((t - tt - abs(x - xx) - abs(y - yy)) % 2) {
                printf("No\n");
                return 0;
            }
        }
        tt = t;
        x = xx;
        y = yy;
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    s = 0
    a = list(map(int, input().split()))
    for j in range(m):
        s += a[j] * b[j]
    if s + c > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
long long n,m;
long long w[101],v[101];
long long dp[101][100001];
long long rec(int i,int j){
	if (dp[i][j]>=0) return dp[i][j];
	long long res;
	if (i==n){
		res=0;
	}else if (j<w[i]){
		res=rec(i+1,j);
	}else{
		res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
	}
	return dp[i][j]=res;
}

int main(){
	cin>>n>>m;
	for (int i=0;i<n;i++){
		cin>>w[i]>>v[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<rec(0,m)<<endl;
	return 0;
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repd(a,b,c) for(int a=c;a>=b;a--)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pb push_back
#define pbb pop_back
const int N = 5e5+100;
signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
   // cin>>T;
    for(int t=1;t<=T;t++)
  {
      //  cout<<"Case #"<<t<<": ";
      int a,b,c;
      cin>>a>>b>>c;
      swap(a,b);
      swap(a,c);
      cout<<a<<" "<<b<<" "<<c<<"\n";


       
       

  }
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = LLONG_MAX;

int a,b,c;
int main(){
  cin>>a>>b>>c;
  if(c>=a && c<=b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        
        HashSet<Character> set = new HashSet<Character>();
        
        for(int i = 0; i < n; i++) set.add(sc.next().charAt(0));
        
        String res = "";
        
        switch(set.size()){
            case 3:
                res = "Three";
                break;
            case 4:
                res = "Four";
        }
        
        System.out.println(res);
    }
}


Measured memory_bytes: 22612
from collections import deque

S = input()

q = deque(S)
forward = True
for _ in range(int(input())):
    TFC = input().split()
    if TFC[0] == '1':
        forward = not forward
    else:
        if (TFC[1] == '1') == forward:
            q.appendleft(TFC[2])
        else:
            q.append(TFC[2])

if not forward:
    q.reverse()

print(''.join(q))


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

using namespace std;


int cena[1000];
int main()
{


int n,m,x;
cin>>n>>m>>x;

for(int i =1; i <= m; i++)
{
    int a;
    cin>>a;
    cena[a] = 1;

}

int c1= 0;
int c2=0;

for(int i = 0; i < x; i++)
{

    if(cena[i]) c1++;

}
for(int i = n; i > x; i--)
{

    if(cena[i]) c2++;

}
if(c1 > c2)
{

    cout<<c2<<endl;

}

else cout<<c1<<endl;

return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b=0;
		int c=0;
		
		for(int i=1;i<=a;i++){
			if (i%2==0){
				continue;
			}
//			System.out.println("i="+i);
			b=0;
			for(int j=1;j<=i;j++){
				if(i%j==0){
					b++;
				}
			}
//			System.out.println("	b="+b);
			if(b==8){
//				System.out.println("iiiii="+i);
				c++;
			}
		}
		
		
		
		
		
		System.out.println(c);
		
		
		
		
	}

}


Measured memory_bytes: 24916
// https://atcoder.jp/contests/abc171/tasks/abc171_f    

#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n' 

using ll = long long;

ll fac[2000500];

const ll MOD = 1000000007LL;

ll modmul(ll a, ll b) {
    return (a*b) % MOD;
}

ll modpow(ll a, ll exp) {
    if(exp == 0) return 1LL;

    ll t = modpow(a, exp / 2);
    if(exp % 2) return t*t % MOD * a%MOD;
    return t*t % MOD;
}

ll modinv(ll n) {
    return modpow(n, MOD-2);
}

ll choose(ll n, ll k) {
    return modmul(fac[n], modinv(modmul(fac[k], fac[n-k])));
}

signed main() {
    ios::sync_with_stdio(0);
    cin.sync_with_stdio(0);
    cin.tie(0);
    fac[0] = 1;
    for(ll i = 1; i <= 2000000; i++) {
        fac[i] = modmul(fac[i-1], i);
    }

    ll K;
    string s;

    cin >> K >> s;

    ll N = s.size();

    ll ans = 0;
    // i = not same
    for(ll i = 0; i <= K; i++) {
        ll val = modmul(modpow(25, i), choose(N+K, i));
        ans += val;

        ans %= MOD;
    }

    cout << ans << endl;
}



Measured memory_bytes: 19892
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N];
ll sum[N];
//ll ans[N];
 
ll gao(int l,int r){  //求区间l,r的和
    return sum[r]-sum[l-1];
}
 
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 
    int n ;
    cin >>n;
    for(int i=1;i<=n;i++)   cin >> a[i];
    for(int i=1;i<=n;i++)   sum[i]=sum[i-1]+a[i]; //求前缀和
    ll l=1,r=3;
    ll ans=1e18+8;
    for(int i=2;i<=n-2;i++){
         while(l+1<i&&abs(gao(1,l)-gao(l+1,i))>=abs(gao(1,l+1)-gao(l+2,i)))//若[1,l+1]和[l+1,i]的距离比[1,l+1]和[l+2,i]的距离小，那么我们就继续加，使得两边尽可能平衡
            l++;
         while(r+1<n&&abs(gao(i+1,r)-gao(r+1,n))>=abs(gao(i+1,r+1)-gao(r+2,n)))
            r++;
         set<ll>st;///利用set的log排序
         st.insert(gao(1,l));
         st.insert(gao(l+1,i));
         st.insert(gao(i+1,r));
         st.insert(gao(r+1,n));
         ans=min(ans,abs(*st.begin()-*prev(st.end())));
    }
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 3e5 + 5;
int a[N], dp[N], T[N<<2];
int n, k;

void change(int rt, int L ,int R, int pos, int val)
{
    if(L == R){
        T[rt] = max(T[rt], val);
        return ;
    }
    int mid = L + R >> 1;
    if(mid >= pos) change(rt<<1, L, mid, pos, val);
    else change(rt<<1|1, mid + 1, R, pos, val);
    T[rt] = max(T[rt<<1], T[rt<<1|1]);
}

int query(int rt, int ql, int qr, int tl, int tr)
{
    if(tl >= ql && tr <= qr){
        return T[rt];
    }
    int mid = tl + tr >> 1;
    int res = 0;
    if(mid >= ql) res = max(res, query(rt<<1, ql, qr, tl, mid));
    if(mid + 1 <= qr) res = max(res, query(rt<<1|1, ql, qr, mid + 1, tr));
    return res;
}
int main()
{
    cin >> n >> k;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    dp[1] = 1;
    int ans = 0;
    change(1, 1, N, a[1], dp[1]);
    for(int i = 2; i <= n; ++i){
        dp[i] = query(1, max(a[i] - k, 0), min(a[i] + k, N - 5), 1, N) + 1;
        change(1, 1, N, a[i], dp[i]);
        ans = max(ans, dp[i]);
    }
    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 10012
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll maxn = 1e6+10;
const ll inf = 1e14;
struct node{
	ll x,y;
	 
}r[1100];;
bool cmp(node a,node b){
	return atan2(a.x,a.y) < atan2(b.x,b.y);
}
int main(){
	ll n,x,y;
	cin >> n;
	for(ll i = 0; i < n; i++){
		cin >> r[i].x >> r[i].y;
	}
	ll ans = 0;
	sort(r,r+n,cmp);
	for(ll i = 0; i < n; i++){
		x = r[i].x ; y = r[i].y;
		ans = max(ans,x*x+y*y);
		for(ll j = (i+1)%n; j != i; j = (j+1)%n){
			x += r[j].x ; y += r[j].y;
			ans = max(ans,x*x+y*y);
		}
		
	}
	
	double ans1 = sqrt(ans);
	printf("%.13lf\n",ans1);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    vector<string> s(n);
    cin >> s;
    int ans = 0;
    for (int sh = 0; sh < n; ++sh) {
        bool eq = true;
        forn(i, 0, n)
            forn(j, 0, n)
                if (s[(i + sh) % n][j] != s[(j + sh) % n][i])
                    eq = false;
        if (eq) ++ans;
    }
    cout << n * ans << '\n';
}


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

int main() {
  int n;
  cin >> n;
  int min = 1000000000;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    int count = 0;
    for (;a % 2 == 0; count++) {
      a /= 2;
    }
    min = (min > count)? count: min;
  }
  cout << min << endl;
}

Measured memory_bytes: 256
from decimal import Decimal, ROUND_UP
tmp = []
time = 0
for i in range(0,5):
    w = 0
    num = int(input())
    while True:
      if float.is_integer((num + w)/10):
        break
      w += 1
    tmp.append({"num":num, "weight":w})
    
tmp = sorted(tmp, key=lambda x:x['weight'])
for i in range(0,5):
    time += tmp[i]['num']
    if i < 4:
    	time = Decimal(time/10).quantize(Decimal('0'), rounding=ROUND_UP) * 10

print(time)

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

vector<pair<char, int>> decompose(string s) {
    vector<pair<char, int>> ans;
    for (char c: s) {
        if (ans.empty() || ans.back().first != c) ans.emplace_back(c, 0);
        ans.back().second++;
    }
    return ans;
}

long long brute(string s, int k) {
    string t;
    for (int i=0; i<k; i++)     t += s;
    vector<pair<char, int>> ss = decompose(t);
    long long ans = 0;
    for (auto pr: ss) ans += pr.second/2;
    return ans;
}

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

    string s;
    cin>>s;
    int n = s.size();
    int k;
    cin>>k;

//    cout<<brute(s, k)<<endl;

    int id = -1;
    for (int i=1; i<n; i++)
        if (s[i] != s[i-1]) {
            id = i;
            break;
        }

    if (id == -1) {
        cout<<(1ll*n*k)/2<<endl;
        return 0;
    }

    long long ans = brute(s, 1);

    rotate(s.begin(), s.begin()+id, s.end());
    assert(s[0] != s.back());

    ans += (k-1)*brute(s,1);
    cout<<ans<<endl;
}


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

using int64 = long long;

int N, K;

int main() {
   cin >> N >> K;

   // Kの倍数である数値の個数を数える
   int64 a = 0;
   for (int x = 1; x <=N; x++) {
      if (x % K == 0) {
         a++;
      }
   }

   // 余りがKの半分となる数値の個数を数える
   int64 b = 0;
   for (int x = 1; x <=N; x++) {
      if (x % K == K/2) {
         b++;
      }
   }

   // 全ての要素がKの倍数の場合を足す
   int64 ans = a * a * a;
   // Kが偶数なら余りがK/2の場合も考慮する
   if (K % 2 == 0) {
      // 全ての要素がK/2の場合を足す
      ans += b * b * b;
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	LL n; cin >> n;
	LL sum = 0;
	rep(i, n) {
		LL x; cin >> x; sum += x;;
	}
	Cout(sum / n);
}


Measured memory_bytes: 2984
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define lc (x<<1)
#define rc ((x<<1)|1)
const int N=105;
char s[N];
int main(){
 //   freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    int i,n;
    scanf("%s",s+1);n=strlen(s+1);
    if (n<4) {puts("No");return 0;}
    if (s[1]=='Y'&&s[2]=='A'&&s[3]=='K'&&s[4]=='I') puts("Yes");
        else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>

using namespace std;

bool check[100000];
long long pos[100000];

pair<long long, long long> dfs(int node, vector<vector<pair<int, int>>> &E){
    check[node] = true;

    pair<long long, long long> ret = make_pair(0, 0);

    for(auto next : E[node]){
        int nextNode = next.first;
        int nextCost = pos[node] + next.second;

        if(!check[nextNode]){
            pos[nextNode] = nextCost;
            auto temp = dfs(nextNode, E);
            ret.first = min(ret.first, temp.first);
            ret.second = max(ret.second, temp.second);
        }
        else{
            if(pos[nextNode] != nextCost){
                return make_pair(-1e9 - 1, 1e9 + 1);
            }
        }
    }

    return ret;
}

int main(){

    int N, M;
    cin >> N >> M;
    vector<vector<pair<int, int>>> E(N);

    int L, R, D;
    for(int i  = 0; i < M; i++){
        cin >> L >> R >> D;

        E[L - 1].push_back(make_pair(R - 1, D));
        E[R - 1].push_back(make_pair(L - 1, -D));
    }

    for(int i = 0; i < N; i++){
        check[i] = false;
    }
    memset(pos, -1, sizeof(pos));

    bool isOk = true;
    for(int i = 0; i < N; i++){
        if(!check[i]){
            pos[i] = 0;
            pair<long long, long long> minMax = dfs(i, E);
            if(minMax.second - minMax.first > 1e9){
                isOk = false;
                break;
            }
        }
    }

    if(isOk){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 13440
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to;
    double cost;
    Edge(){};
    Edge(int to0, double cost0){to = to0; cost = cost0;}
};

void shortestPath(const vector<vector<Edge> >& edges, int start, vector<int>& prev)
{
    prev.assign(edges.size(), -1);
    vector<double> dist(edges.size(), DBL_MAX);
    dist[start] = 0.0;
    priority_queue<pair<double,int> ,vector<pair<double,int> >, greater<pair<double,int> > > q;
    q.push(make_pair(0.0, start));

    while(!q.empty()){
        pair<double, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to]){
                prev[e.to] = v;
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> index(n), x(n), y(n);
        for(int i=0; i<n; ++i)
            cin >> index[i] >> x[i] >> y[i];

        vector<vector<Edge> > edges(n);
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                double dist = sqrt(pow(x[i]-x[j], 2.0) + pow(y[i]-y[j], 2.0));
                if(dist <= 50){
                    edges[i].push_back(Edge(j, dist));
                }
            }
        }
        vector<vector<int> > prev(n);
        for(int i=0; i<n; ++i)
            shortestPath(edges, i, prev[i]);

        int m;
        cin >> m;
        for(int i=0; i<m; ++ i){
            int s, g;
            cin >> s >> g;
            s = find(index.begin(), index.end(), s) - index.begin();
            g = find(index.begin(), index.end(), g) - index.begin();

            if(prev[g][s] == -1)
                cout << "NA" << endl;
            else{
                int v = s;
                cout << index[v];
                while(v != g){
                    v = prev[g][v];
                    cout << ' ' << index[v];
                }
                cout << endl;
            }
        }
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#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> 

using namespace std;


int main()
{
   FAST/**/
   
   ll n,k;
   cin>>n>>k;
   
   vector<ll> hold;
   while(n)
   {
       hold.pb(n%k);
       n/=k;
   }
   
   cout<<hold.size();
   
   return 0;        
}  
   

Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
ci = defaultdict(int)
cj = defaultdict(int)
for i in range(n):
    ci[a[i]+i] += 1
    cj[i-a[i]] += 1
cnt = 0
for k in ci.keys():
    cnt += ci[k] * cj[k]
print(cnt)

Measured memory_bytes: 74072
import copy

def can_empty(A,y,x):
    A[y][x],A[y][x+1] = A[y][x+1],A[y][x]
    num = sum(W-a.count(".") for a in A)
    while 1:
        # Fall processing
        for w in xrange(W):
            seq = ("".join(A[h][w] for h in xrange(H))).replace(".","")
            seq += "."*(H-len(seq))
            for h in xrange(H):
                A[h][w] = seq[h]

        # Banish processing
        B = [[0]*W for _ in xrange(H)]
        for h in xrange(H):
            cnt = 1
            for w in xrange(1,W):
                if A[h][w] == A[h][w-1]: cnt += 1
                else:
                    if cnt >= n and A[h][w-1] != ".":
                        for wi in xrange(w-cnt,w): B[h][wi] = 1
                    cnt = 1
            if cnt >= n and A[h][W-1] != ".":
                for wi in xrange(W-cnt,W): B[h][wi] = 1
        for w in xrange(W):
            cnt = 1
            for h in xrange(1,H):
                if A[h][w] == A[h-1][w]: cnt += 1
                else:
                    if cnt >= n and A[h-1][w] != ".":
                        for hi in xrange(h-cnt,h): B[hi][w] = 1
                    cnt = 1
            if cnt >= n and A[H-1][w] != ".":
                for hi in xrange(H-cnt,H): B[hi][w] = 1

        banish = False
        for h in xrange(H):
            for w in xrange(W):
                if B[h][w]:
                    A[h][w] = "."
                    num -= 1
                    banish = True
        if not banish: return False
        if num == 0: return True
        

# Entry point
H,W,n = map(int,raw_input().split())
A = [list(raw_input()) for _ in xrange(H)][::-1]

ans = False
for h in xrange(H):
    for w in xrange(W-1):
        if A[h][w] == A[h][w+1]: continue
        if can_empty(copy.deepcopy(A),h,w):
            ans = True
            break
    if ans: break
print "YES" if ans else "NO"

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

int main(){
    int n; cin>>n;
    Graph G(n);
    rep(i,n){
        int u,k; cin>>u>>k;
        rep(j,k){
            int v; cin>>v;
            G[u-1].push_back(v-1);
        }
    }

    vector<int> dist(n,-1);
    queue<int> que;

    dist[0]=0;
    que.push(0);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(auto nv : G[v]){
            if(dist[nv]!=-1)continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
    rep(i,n){
        cout<<i+1<<" "<<dist[i]<<endl;
    }
    return 0;
}


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

int main()
{
  int a, i, j, m, n, c;
  char buf[16];
  char *p;
  fgets(buf, 16, stdin);
  n = atoi(buf);
  c=0;  
  for (i=0; i<n; i++) {
    fgets(buf, 16, stdin);
    p = buf;
    for (a=0; *p>='0'; p++)
      a = a * 10 + *p - '0';
    m = (int)sqrt(a)+1;
    for (j=2; j<m; j++) {
      if (a%j==0) break;
    }
    if (j==m) c++;
  }

  buf[15]='\0';
  buf[14]='\n';
  for (i=13; c>0; i--, c/=10)   buf[i] = '0' + (c%10);
  fputs(buf+i+1, stdout);
  return 0;
}



Measured memory_bytes: 2044
h,w=map(int,input().split())
S=[]
for _ in range(h):
    S.append(input())
tbl=[[10**3]*w for _ in range(h)]
if S[0][0]=="#":
    tbl[0][0]=1
else:
    tbl[0][0]=0
for i in range(h):
    for j in range(w):
        if i>=1 and S[i][j]=="#" and S[i-1][j]==".":
            tbl[i][j]=min(tbl[i][j],tbl[i-1][j]+1)
        elif i>=1:
            tbl[i][j]=min(tbl[i][j],tbl[i-1][j])
        if j>=1 and S[i][j]=="#" and S[i][j-1]==".":
            tbl[i][j]=min(tbl[i][j],tbl[i][j-1]+1)
        elif j>=1:
            tbl[i][j]=min(tbl[i][j],tbl[i][j-1])
print(tbl[h-1][w-1])  

Measured memory_bytes: 42736
#include <bits/stdc++.h>
#define isFile 0
#define NAME "taskA"
#define scan 0
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<short, short> pss;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;

#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define x fr
#define y sc
#define skip continue
#define ins insert
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define _all(v, x, n) v.begin() + x, v.begin() + n + x
#define unique(a) sort(all(a));    a.resize(unique(all(a)) - a.begin())
#define rev(a) reverse(all(a))

#define bit(n, i) (n >> i) & 1
#define bpc(x) __builtin_popcount(x)

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

pair<pii, pii> intersect(pii f1, pii f2, pii s1, pii s2) {    int x5, y5, x6, y6;    x5 = max(min(f1.x, f2.x), min(s1.x, s2.x));    x6 = min(max(f1.x, f2.x), max(s1.x, s2.x));    y5 = max(min(f1.y, f2.y), min(s1.y, s2.y));    y6 = min(max(f1.y, f2.y), max(s1.y, s2.y));    if (x5 >= x6 || y5 >= y6) {        return {{0, 0}, {0, 0}};    }    return {{x5, y5}, {x6, y6}};}

bool isPrime(ll n) {    if (n < 2) return 0;    for(ll i = 2; i * i <= n; i++) {        if (n % i == 0) return 0;    }    return 1;}

void faster() {
    if (isFile) {
        freopen(NAME".in", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    if (scan) {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
}

const ll INF = 1e18;
const int inf = 1e9;
const int MAXN = (int)1e5 + 123;
const int MOD = (int)1e9 + 7;
const ld  PI = acos(-1);
const ld  EPS = 3E-16;

namespace MATH_CAL {
    const int mod = MOD;
    inline ll add(ll a, ll b) { return a + b >= mod ? a + b - mod : a + b; }
    inline ll sub(ll a, ll b) { return a - b < 0 ? a - b + mod : a - b; }
    inline ll mul(ll a, ll b) { return (ll) a * b % mod; }
    inline void Add(ll &a, ll b) { (a += b) >= mod ? a -= mod : 0; }
    inline void Sub(ll &a, ll b) { (a -= b) < 0 ? a += mod : 0; }
    inline ll qpow(ll x, ll n) { ll r = 1; for ( ; n; n /= 2, x = mul(x, x)) if (n & 1) r = mul(r, x); return r; }
    inline ll mod_inv(ll x) { return qpow(x, mod - 2); }
    inline ll gcd(ll a, ll b) {while(b) {a %= b; swap(a, b);} return a;}
} using namespace MATH_CAL;

void solve() {

    int n, k, s;
    cin >> n >> k >> s;

    if (k == 0) {
        for(int i = 1; i <= n; i++) {
            cout << min(s + 1, (int)1e9 - 1) << ' ';
        }
        return;
    }

    for(int i = 1; i <= k; i++) {
        cout << s << ' ';
    }
    for(int i = k + 1; i <= n; i++) {
        cout << min(s + 1, (int)1e9 - 1) << ' ';
    }


}

int main() {
    faster();
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}


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

int n;
int a[105];
int dp[105][100005];
int DP[105][100005];

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=1;i<=n;i++)cin>>a[i];
    fill(dp[0],dp[105],-1e9);
    fill(DP[0],DP[105],1e9);
    
    int ans=0,ANS=1e9;
    dp[0][0]=0;
    DP[0][0]=0;
    for(int i=1;i<=n;i++){
      for(int j=0;j<=100000;j++){
        int A=a[i]%1000;
        if(A==0)A=1000;
        
        dp[i][j]=dp[i-1][j];
        DP[i][j]=DP[i-1][j];

        if(A<=500){
          int k=1000-A-500;
          if(j-k>=0){
            int d=dp[i-1][j-k]+1;
            int D=DP[i-1][j-k]+a[i];
            if( (d==dp[i][j]&&D<DP[i][j]) || d>dp[i][j]){
              dp[i][j]=d;
              DP[i][j]=D;
            }
          }
        }else{
          int k=1000-A;
          if(j-k>=0){
            int d=dp[i-1][j-k];
            int D=DP[i-1][j-k]+a[i];
            if( (d==dp[i][j]&&D<DP[i][j]) || d>dp[i][j]){
              dp[i][j]=d;
              DP[i][j]=D;
            }
          }
          
          if(j+A-500<=100000){
            int d=dp[i-1][j+A-500]+1;
            int D=DP[i-1][j+A-500]+a[i];
            if( (d==dp[i][j]&&D<DP[i][j]) || d>dp[i][j]){
              dp[i][j]=d;
              DP[i][j]=D;
            }
          }
        }
        if( (ans==dp[i][j]&&DP[i][j]<ANS) || ans<dp[i][j] ){
          ans=dp[i][j];
          ANS=DP[i][j];
        }
      }
    }
    cout<<ans<<' '<<ANS<<endl;
  }
  return 0;
}

Measured memory_bytes: 83196
#include<iostream>
#include<string>
#include<algorithm>

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

    std::sort(s.begin(), s.end());

    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
        std::cout << "Yes" << "\n";
    } else {
        std::cout << "No" << "\n";
    }

}

Measured memory_bytes: 3604