akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
multiset<int>s;
PII A[MAXN],B[MAXN];
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		A[i]=mp(x,y);
	}sort(A+1,A+n+1);
	 for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		B[i]=mp(x,y);
	}sort(B+1,B+n+1);
	int p=1,ans=0;
	for(int i=1;i<=n;i++){
		int x=B[i].ff,y=B[i].ss;
		while(p<=n and A[p].ff<x)
			s.insert(A[p].ss),p++;
		if(s.size()){
			__typeof((s).begin())it=s.lower_bound(y);
			if(it!=s.begin()){
				it--;ans++;
				s.erase(it);
			}
		}
	}printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
s = list(input())
t = list(input())


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    elif s != [] and t == []:
      print('No')
      exit()
  if min(s) < max(t):
    print('Yes')
    exit()


Measured memory_bytes: 3064
n, k = map(int,input().split())
a = list(map(int, input().split()))

s = []
ord = [-1]*(n+1)
c = 1
l = 0


v = 1
while (ord[v] == -1):
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
    
c = len(s) - ord[v]
l = ord[v]


if (k < l): print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])

Measured memory_bytes: 32296
#include <stdio.h>

int main(void){
	
	int N,i,count;
	
	scanf("%d",&N);
	
	int a[N+1];
	a[0] = -1;
	for(i=1;i<N+1;i++){
		scanf("%d",&a[i]);
	}
	
	for(i=1;i<N+1;i++){
		
		if(a[a[i]] == i){count++;}
	}
	count /= 2;
	
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 512
import itertools as t;N,a,X=input(),0,[]
for i in range(len(N)+1):X+=list(t.product((3,5,7),repeat=i))
for i in X:
    s=''
    for j in i:s+=str(j)
    if len(set(i))>2and int(s)<=int(N):a+=1
print(a)

Measured memory_bytes: 7028
#include <iostream>
#include <algorithm>

int main() {
    int A[5], K;
    for (auto& a : A) std::cin >> a;
    std::cin >> K;

    std::sort(A, A + 5);
    std::cout << (A[4] - A[0] <= K ? "Yay!" : ":(") << std::endl;
    return 0;
}

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

class OnePercent
{
    static void Main(string[] args)
    {

        long input = 100;
        long money = long.Parse(Console.ReadLine());
        long count = 0;



        while(input < money)
        {
            input =(long) (input * 1.01);
            count++;

        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 17596
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i;
	long long int a,b,x,c,y;
	scanf("%d %lld",&n,&a);
	for(i=1;i<n;i++){
		scanf("%lld",&b);
		if(a<b) swap(a,b);
		x=a; y=b;
//printf("x=%lld y=%lld\n",x,y);
		c=1;
		while(c!=0){
			c=a%b;
			a=b;
			b=c;
//printf("aaa\n");
		}
		a=x/a*y;
//printf("a=%lld c=%lld\n",a,c);
	}
	printf("%lld\n",a);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>

using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main() {
  int N, M, a;
  cin >> N >> M;
  set<int> s;
  while(cin >> a) {
    s.insert(a);
  }

  ll dp[2] {1,0};
  for (int i = 1; i <= N; ++i) {
    dp[i%2] = s.count(i) ? 0 : (dp[0]+dp[1])%MOD;
  }
  cout << dp[N%2] << endl; 
}


Measured memory_bytes: 4992
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * n for _ in range(n)]
for i in range(n):
    dp[i][i] = a[i]

for i in range(n - 2, -1, -1):
    for j in range(i + 1, n):
        dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])

print(dp[0][n - 1])

# 下記提出と全く同じ内容で提出します
# https://atcoder.jp/contests/dp/submissions/6590284

# これまでの連投で参考にしていたコード
# ほぼ同じ内容で提出しているつもりなのに、速度差が一向に縮まらない

# maxの引数の順番が自分と違うのが速度差の原因？


Measured memory_bytes: 111964
import sys
input = sys.stdin.readline
n=int(input())

B = [int(input())-1 for i in range(n)]


def fun(k):
    if B[k] == 1:
     	return -5                                                    
    else:
        return B[k]
ans = 0
cnt = 0
for i in range(n+1):
    cnt = fun(cnt)
    ans +=1
    
    if cnt ==-5:
        print(ans)
        sys.exit() 
print(-1)
sys.exit()
        

Measured memory_bytes: 7084
fun main(args: Array<String>) {
    val n = readInt()
    val a = readLongList().toMutableList()

    var ans = 0L
    for (i in 1 until n) {
        if (a[i] < a[i - 1]) {
            val diff = (a[i - 1] - a[i])
            a[i] += diff
            ans += diff
        }
    }
    println(ans)
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 68428
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    vector<int> ps;
    int max_p;

    ps.reserve(10000);

    ps.push_back(max_p = 2);

    int n, sum;
    bool f;
    while (true) {
        cin >> n;
        if (n == 0) break;
        while (ps.size() < n) {
            max_p++;
            f = true;
            for (int i = 0; ps[i] * ps[i] <= max_p; i++) {
                if (max_p % ps[i] == 0) {
                    f = false;
                    break;
                }
            }
            if (f) ps.push_back(max_p);
        }
        sum = 0;
        for (int i = 0; i < n; i++) {
            sum += ps[i];
        }
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<complex>
#include<vector>
using namespace std;
typedef complex < double > P;
typedef vector< P > G;
vector< G > g;
const double EPS = 1e-8;
const double INF = 1e12;
double cross(const P& a,const P& b){ //外積
  return imag(conj(a) * b);
}
double dot(const P& a,const P& b){ // 内積
  return real(conj(a) * b);
}
struct L: vector < P >{
  L(const P& a,const P& b){
    push_back(a);
    push_back(b);
  }
};
int ccw(P a,P b,P c){
  b -= a; c -= a;
  if(cross(b,c) > 0) return 1;
  if(cross(b,c) < 0) return -1;
  if(dot(b,c) < 0) return 2; // c--a--b
  if(norm(b) < norm(c)) return -2; // a--b--c
  return 0; // a--c--b
}
bool intersectSS(const L& s,const L& t){ //交差判定 線分:線分
  return ccw(s[0],s[1],t[0]) * ccw(s[0],s[1],t[1]) <= 0 &&
    ccw(t[0],t[1],s[0]) * ccw(t[0],t[1],s[1]) <= 0;
}
#define curr(P,i) P[i]
#define next(P,i) P[(i+1)%P.size()]
bool conteins(const G& Q, const P& p){
  bool in = false;
  for(int i = 0 ; i < Q.size() ; i++ ){
    P a = curr(Q,i) - p, b = next(Q,i) - p;
    if(imag(a) > imag(b)) swap(a,b);
    if(imag(a) <= 0 && 0 < imag(b) && cross(a,b) < 0) in = !in;
    if(cross(a,b) == 0 && dot(a,b) <= 0) return true;
  }
  return in;
}
bool intersect( int x, int y){ //交差判定 g[x] == g[y]
  // g[x] or g[y] が包容
  for(int i = 0 ; i < 4 ; i++ ){
    if(conteins(g[y],g[x][i]) || conteins(g[x],g[y][i])) return true;
  }
  // g[x] と g[y]の辺が交差
  for(int i = 0 ; i < 4 ; i++ ){
    for(int j = 0 ; j < 4 ; j++ ){
      if(intersectSS(L(curr(g[x],i),next(g[x],i)),L(curr(g[y],j),next(g[y],j)))) return true;
    }
  }
  return false;
}
//UnionFind
vector< int > rank, p;
void link(int x,int y){
  if(rank[x] > rank[y]) p[y] = x;
  else{
    p[x] = y;
    if(rank[x] == rank[y]) rank[y]++;
  }
}
void init(int size){
  rank.resize(size);
  p.resize(size);
  for(int i = 0 ; i < size ; i++ ){
    p[i] = i, rank[i] = 0;
  }
}
int findSet(int x){
  if(x != p[x]) p[x] = findSet(p[x]);
  return p[x];
}
void Union(int x,int y){
  link(findSet(x),findSet(y));
}
bool isSame(int x,int y){
  return findSet(x) == findSet(y);
}

int main(){
  int N, M;
  while(cin >> N , N){
    for(int i = 0 ; i < N ; i++ ){
      cin >> M;
      g.resize(M);
      init(M);
      for(int j = 0 ; j < M ; j++ ){
        for(int k = 0 ; k < 4 ; k++ ){
          P buff;
          cin >> buff.real() >> buff.imag();
          g[j].push_back(buff);
        }
      }
      for(int j = 0 ; j < M ; j++ ){
        for(int k = 0 ; k < j ; k++ ){
          if(!isSame( j, k) && intersect( j, k)) Union( j, k);
        }
      }
      int ret = 0;
      for(int j = 0 ; j < M ; j++ ){
        if(findSet(j) == j) ret++;
      }
      cout << ret << endl;
      g.clear();
    }
  }
}

Measured memory_bytes: 1292
#include <iostream>
#include<cstdio>
#include <vector>
using namespace std;

int main(){

  


  int N;
  vector<int> a;
  vector<int> b;

  cin >> N;
  a.reserve(N);
  for(int i=0;i<N;i++)
  // scanf("%d", &a[i]);
    cin >> a[i];
  b.reserve(N);
  for(int i=0;i<N;i++)
  // scanf("%d", &a[i]);
    cin >> b[i];

  vector<int>suma;
  vector<int>sumb;
  suma.reserve(N);
  sumb.reserve(N);
  suma[0] = a[0];
  for(int i=1; i<N;i++){
    suma[i] = a[i] + suma[i-1];
  }
  sumb[N-1] = b[N-1];
  for(int i=N-2; i>=0;i--){
    sumb[i] = sumb[i+1] + b[i];
  }

  int tmp, max=0;
  for(int i=0; i<N;i++){
    tmp = suma[i] + sumb[i];
    if(tmp > max)
      max = tmp;
  }
  cout << max<<endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		while(true){
			int n = Integer.parseInt(scan.next());
			int m = Integer.parseInt(scan.next());
			if(n==0) break;
			boolean[][] relation = new boolean[n][n];
			boolean[] used = new boolean[n];

			for (int i = 0; i < m; i++) {
				int a = Integer.parseInt(scan.next())-1;
				int b = Integer.parseInt(scan.next())-1;
				relation[a][b] = relation[b][a] = true;
			}

			Stack<int[]> stk = new Stack<int[]>();
			stk.push(new int[]{0,0});
			used[0]=true;
			int ans = 0;
			while(!stk.isEmpty()){
				int[] p = stk.pop();
				int num = p[0],deep = p[1];
				ans++;
				if(deep!=2) for (int i = 0; i < n; i++) {
					if(!used[i] && relation[num][i]){
						used[i]=true;
						stk.push(new int[]{i,deep+1});
					}
				}
			}
			out.println(ans-1);
		}
		out.flush();
	}
}

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

typedef long long ll;

ll N;
typedef tuple<ll, ll, ll> Point;
vector<Point> Points[2];
typedef tuple<ll, ll, ll> Edge;
vector<Edge> Edges;
vector<ll> Parent, Rank;
ll R;

void init() {
  Parent.resize(N, -1);
  Rank.resize(N, 0);
}
ll root(ll v) {
  if (Parent[v] == -1) return v;
  return Parent[v] = root(Parent[v]);
}
bool same(ll u, ll v) { return root(u) == root(v); }
void unite(ll u, ll v) {
  u = root(u);
  v = root(v);
  if (u == v) return;
  if (Rank[u] < Rank[v]) swap(u, v);
  Parent[v] = u;
  if (Rank[u] == Rank[v]) ++Rank[u];
}
int main() {
  cin >> N;
  for (ll v = 0; v < N; ++v) {
    ll x, y;
    cin >> x >> y;
    Points[0].push_back(Point(x, y, v));
    Points[1].push_back(Point(y, x, v));
  }
  for (ll k : {0, 1}) sort(Points[k].begin(), Points[k].end());
  for (ll k : {0, 1})
    for (ll i = 0; i < N - 1; ++i) {
      ll x, y, u, x2, y2, v;
      tie(x, y, u) = Points[k][i];
      tie(x2, y2, v) = Points[k][i + 1];
      Edges.push_back(Edge(min(abs(x2 - x), abs(y2 - y)), u, v));
    }
  sort(Edges.begin(), Edges.end());
  init();
  for (Edge edge : Edges) {
    ll d, u, v;
    tie(d, u, v) = edge;
    if (!same(u, v)) {
      unite(u, v);
      R += d;
    }
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 13860
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 = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();

        int count = 0;
        for (int i = 0; i < a + 1; i++) {
            for (int j = 0; j < b + 1; j++) {
                for (int k = 0; k < c + 1; k++) {
                    if (500 * i + 100 * j + 50 * k == x) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }

}


Measured memory_bytes: 21844
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int to[400004], ne[400004], he[100001];
int kotae[100001], Q[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	int k = 1;
	rep(i, M) {
		int a = getint(), b = getint();
		to[k] = b;
		ne[k] = he[a];
		he[a] = k++;
		to[k] = a;
		ne[k] = he[b];
		he[b] = k++;
	}

	int q = 0;
	Q[q++] = 1;
	kotae[1] = 1;
	rep(i, N) {
		int u = Q[i];
		for (int v = he[u]; v; v = ne[v]) {
			int To = to[v];
			if (!kotae[To]) {
				kotae[To] = u;
				Q[q++] = To;
			}
		}
	}
	printf("Yes\n");

	for (int i = 2; i <= N; i++) putint(kotae[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 6392
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int h,a;
int main(){
	cin>>h>>a;
	if(h%a==0)
		cout<<h/a;
	else
		cout<<h/a+1;
	return 0;
}

Measured memory_bytes: 256
S = input()

output = [0] * len(S)
R_counter = 0
L_counter = 0
index_save = 0

for i, s in enumerate(S):
    if i != len(S)-1:
        if s == 'R':
            if S[i+1] == 'R':
                R_counter += 1
            else:
                R_counter += 1
                index_save = i
        if s == 'L':
            if S[i+1] == 'L':
                L_counter += 1
            else:
                L_counter += 1
                output[index_save] = ((R_counter+1)//2 + L_counter //2)
                output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
                R_counter = 0
                L_counter = 0
    else:
        L_counter += 1
        output[index_save] = ((R_counter+1)//2 + L_counter //2)
        output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
        
        
print(*output)

Measured memory_bytes: 6400
#include<iostream>
#include<string>
using namespace std;
int main()
{
	long long  a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	if(a<b){
		if(a+v*t>=b+w*t)cout<<"YES";
		else cout<<"NO";
	}
	if(a>b){
		if(a-v*t<=b-w*t)cout<<"YES";
		else cout<<"NO";
	}
	return 0;
}
 

Measured memory_bytes: 3676
/*
	watch me go
*/
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define inf (int)1e18
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod=998244353;
int const mod1=1000000007;
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 #define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********
int modexp(int x, int n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}
 
int modinv(int n)
{
	return modexp(n,mod-2);
}


signed main()
{
    haha
   int n;
   cin>>n;
   int x=(n/500)*1000;
   int y=n-((n/500)*500);
   cout<<x+(y/5)*5;
    
    
    
    
    
   
  
}










 
 

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

long long n,m,a,b,sn=0;

int main(){
  long long i,j,k;

  cin >> n;
  m=n;
  while(m>0){
    sn+=m%10;
    m/=10;
  }
  if(n%sn==0)cout<<"Yes"<<endl;
  else cout <<"No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;



int main() {
	int n, a;
	cin >> n >> a;
	int b = n % 500;

	if (a >= b)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
vector<pii> g[125252];

ll x[125252];

void fail(){
  puts("No");
  exit(0);
}
const ll INF = 1e18;

void dfs(int p, ll v){
  if(x[p] != -INF){
    if(x[p] != v)fail();
    return;
  }
  x[p] = v;
  for(pii P : g[p]){
    int to = P.first;
    ll cost = P.second;
    dfs(to, v + cost);
  }
}

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int l,r,d;
    scanf("%d%d%d",&l,&r,&d);
    l--; r--;
    g[l].push_back(pii(r,d));
    g[r].push_back(pii(l,-d));
  }
  REP(i,n)x[i] = -INF;
  REP(i,n)if(x[i]==-INF){
    dfs(i,0);
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;

int main(void) {
    i64 n;
    cin >> n;
    vector<pair<pair<string, i64>, i64>> r(n);
    for (i64 i = 0; i < n; i++) {
        cin >> r[i].first.first >> r[i].first.second;
        r[i].first.second *= -1;
        r[i].second = i + 1;
    }
    sort(r.begin(), r.end());
    for (i64 i = 0; i < n; i++) cout << r[i].second << endl;
}

Measured memory_bytes: 384
for _ in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    s=[int(c) for c in input()]

    base=[]

    for i in range(n-1,-1,-1):
        v=a[i]

        for x in base:
            v=min(v,v^x)
        
        if v:
            if s[i]==0:
                base.append(v)
            else:
                print(1)
                break
    else:
        print(0)

Measured memory_bytes: 73416
S = input().rstrip()
zero_zero = 0
one_zero = 0
zero_one = 0
one_one = 0
one = 0
zero = 0
for i in range(-(-len(S)//2)):
    tmp = S[i*2:i*2+2]
    if tmp == "00":
        zero_zero += 1
    elif tmp == "01":
        zero_one += 1
    elif tmp == "10":
        one_zero += 1
    elif tmp == "11":
        one_one += 1
    elif tmp == "1":
        one += 1
    else:
        zero += 1
counter = 0
if zero_one > one_zero:
    counter += one_zero*2 + zero_zero + one_one + one
elif zero_one < one_zero:
    counter += zero_one*2 + zero_zero + one_one + zero
else:
    counter += zero_one*2 + zero_zero + one_one
print(counter if len(S) != 1 else 0)

Measured memory_bytes: 3188
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.mutable
import scala.collection.immutable._
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}

object Main {
  def solve(sc: => Scanner): Unit = {
    println(Array(1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60)(sc.nextInt - 1))
  }

  def gcd(i: Long, j: Long): Long = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}


Measured memory_bytes: 44940
#include <bits/stdc++.h>
using namespace std;
bool exnc(int x, int y, int h, int w){
	if(x<h && y<w && x>=0 && y>=0){
		return true;
	}
	else{
		return false;
	}
}
int main() {
	int h,w;
	cin>>h>>w;
	vector<string> s(h);
	for(int i=0;i<h;i++){
		cin>>s.at(i);
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if((s.at(i)).at(j)=='#'){
				cout<<"#";
			}
			else{
				int count=0;
				for(int hs=-1;hs<2;hs++){
					for(int ws=-1;ws<2;ws++){
						if((hs!=0 || ws!=0) && exnc(i+hs,j+ws,h,w)){
							if((s.at(i+hs)).at(j+ws)=='#'){
								count++;
							}
						}
					}
				}
				cout<<count;
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
STDOUT.sync = true
n,t,e = gets.split.map(&:to_i)
boiltimes=(t-e..t+e) #2880*100 = 288000
sc = gets.split.map(&:to_i)
c=0
sc.each do |xi|
  c+=1
  if xi<=t+e
    boiltimes.each do |j|
      if j%xi==0
        puts c
        exit
      end
    end
  end
end

puts -1

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

int hash(int data[2][4])
{
    int g = 1, ret = 0;
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 4; j++) {
            ret += g * data[i][j];
            g *= 8;
        }
    }
    return (ret);
}
void back(int val, int data[2][4])
{
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 4; j++) {
            data[i][j] = val % 8;
            val /= 8;
        }
    }
}

short mc[(1 << 24) + 2];         

int main()
{
    int sdata[2][4];
    int gdata[2][4] = { {0, 1, 2, 3}, {4, 5, 6, 7} };
    int my[] = {1, 0, -1, 0};
    int mx[] = {0, 1, 0, -1};
    int gval = hash(gdata);
    queue < int > que;
    memset(mc, -1, sizeof(mc));

    mc[gval] = 0; que.push(gval);
    back(gval, sdata);
    while(!que.empty()) {
        int val = que.front(); que.pop();
        int data[2][4];
        back(val, data);
        for(int i = 0; i < 2; i++) {
            for(int j = 0; j < 4; j++) {
                if(data[i][j] == 0) {
                    for(int k = 0; k < 4; k++) {
                        int ny = i + my[k], nx = j + mx[k];
                        if(ny < 0 || nx < 0 || nx >= 4 || ny >= 2) continue;
                        swap(data[i][j], data[ny][nx]);
                        int nval = hash(data);
                        swap(data[i][j], data[ny][nx]);
                        if(mc[nval] == -1) {
                            mc[nval] = mc[val] + 1;
                            que.push(nval);
                        }
                    } 
                }
            }
        }
    }
    
    while(cin >> sdata[0][0] >> sdata[0][1] >> sdata[0][2] >> sdata[0][3] >> sdata[1][0] >> sdata[1][1] >> sdata[1][2] >> sdata[1][3]) { 
        cout << mc[hash(sdata)] << endl;
    }

    return (0);
}
        



     

Measured memory_bytes: 35908
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 998244353;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var a = MakeArray(N, _i => F);
		var S = a.Sum();
		var dp = new long[S + 1];
		dp[0] = 1;
		for (var i = 0; i < N; i++)
		{
			var next = new long[S + 1];
			for (var s = 0; s < a[i]; s++) next[s] = 2 * dp[s] % MOD;
			for (var s = a[i]; s <= S; s++) next[s] = (2 * dp[s] + dp[s - a[i]]) % MOD;
			dp = next;
		}
		var ans = 0L;
		for (var b = (S + 1) / 2; b <= S; b++) ans += dp[b];
		if (S % 2 == 0)
		{
			var dp2 = new long[S + 1];
			dp2[0] = 1;
			for (var i = 0; i < N; i++)
			{
				var next = new long[S + 1];
				for (var s = 0; s < a[i]; s++) next[s] = dp2[s] % MOD;
				for (var s = a[i]; s <= S; s++) next[s] = (dp2[s] + dp2[s - a[i]]) % MOD;
				dp2 = next;
			}
			ans -= dp2[S / 2];
		}
		ans = (Pow(3, N, MOD) - 3 * ans) % MOD;
		if (ans < 0) ans += MOD;
		WriteLine(ans);
	}
	public static long Pow(long a, long b, long mod)
	{
		var p = 1L;
		var x = a;
		while (b > 0)
		{
			if ((b & 1) == 1) p = (p * x) % mod;
			b >>= 1;
			x = (x * x) % mod;
		}
		return p;
	}
}


Measured memory_bytes: 30316
#include <stdio.h>
#define max(a, b) ((a)<(b) ? (b) : (a))

static long long int dp[100005] = {0};

int main(){
  int n, w;  scanf("%d%d", &n, &w);
  long long int weight, value;
  long long int ans = 0;
  for(int i=0; i<n; i++){
    scanf("%lld %lld", &weight, &value);
    for(int j=w; j>=weight; j--){
      dp[j] = max(dp[j], dp[j-weight]+value);
      ans = max(ans, dp[j]);
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 896
#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() {
  ll k;
  cin >> k;
  int x = 0;
  x = 7 % k;
  set<int> s;
  int i = 1;
  while(s.count(x) == 0){
    if(x == 0){
      cout << i << endl;
      return 0;
    }
    s.insert(x);
    ++i;
    x = (10 * x + 7) % k ;
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 50476
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
using namespace std;
#define ll long long
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
using namespace std;
 
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (long long i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define fillinf(ar, n) fr(i,0,(n)) ar[i] = INF
#define debug(x) cout<<#x<<": "<<x<<endl
#define arr1d(a,n) cout << #a << " : "; fr(_,1,n) cout << a[_] << ' '; cout << endl;
#define arr1d0(a,n) cout << #a << " : "; rep(_,n) cout << a[_] << ' '; cout << endl;
#define arr2d(a,n,m) cout << #a << " :" << endl; fr(_,1,n) {fr(__,1,m) cout << a[_][__] << ' '; cout << endl;}
#define arr2d0(a,n,m) cout << #a << " :" << endl; rep(_,n) {rep(__,m) cout << a[_][__] << ' '; cout << endl;}


#define ull unsigned long long
#define ld long double
#define ui unsigned int
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define y0 yyyyyy0
auto clk=clock();
#define y1 yyyyyy1
#define setb __builtin_popcount
#define BIT(n) (1<<(n))
#define SQR(x) ((x) * (x))
#define CUBE(x) ((x) * (x) * (x))
#define LSOne(S) (S) & (-S)
inline bool EQ(double a, double b) {return fabs(a - b) < 1e-9;}
 
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;


 
inline int two(int n) {return 1 << n;}
inline int isOnBit(int n, int b) {return (n >> b) & 1;}
inline void onBit(int & n, int b) {n |= two(b);}
inline void offBit(int & n, int b) {n &= ~two(b);}
inline int lastBit(int n) {return n & (-n);}
inline int cntBit(int n) {int res = 0; while(n && ++res) n -= n &(-n); return res;}
 
#define INP "test.inp"
#define OUT "test.out"
 
#define PI 3.1415926535897932385
#define INF 10000000000000000ll
#define EPS 1e-7
#define MAXN 100000
#define MOD 998244353
#define dec decr
#define endl '\n'
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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


    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n<3200)cout<<"red";
    else cout<<s;
    
    return 0;
}   

Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	bb=[0]*8
	free=0
	al=list(IN())
	for rate in al:
		#rate = int(input())
		cc = rate // 400
		if cc < 8:
			bb[cc]+=1
		else:
			free+=1
	ccc=0
	for b in bb:
		ccc += b>0
	min_n = max(1,ccc)
	max_n = ccc + free
	print(min_n, max_n)
				
	#b , c = IN()
	#s = input()
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
from fractions import gcd
import math
a,b = map(int,input().split())
n = gcd(a,b)
if n == 1:
    print(1)
    exit()
count = 1
for i in range(2,math.ceil(math.sqrt(n))+1):
    if n % i == 0:
        count += 1
        while n % i == 0:
            n //= i
if n > 1:
    count += 1
print(count)


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int i=0; 
    while(a>0 && c>0){
        if(i%2==1){
            a-=d;
            if(a<=0){
                cout << "No" << endl;
                return 0;
            }
            i++;
        }
        else{
            c-=b;
            if(c<=0){
                cout << "Yes" << endl;
                return 0;
            }
            i++;
        }
    }
}

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

namespace EDPC
{
    class B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[] input = new string[N];
            int[,] score = new int[N, 3];

            for (int i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ');
                for (int j = 0; j < 3; j++)
                {
                    score[i, j] = int.Parse(input[j]);
                }
            }


            int[,] dp = new int[N + 10, 3];

            // Main processing
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (j != k) dp[i + 1, k] = Math.Max(dp[i + 1, k], dp[i, j] + score[i, k]);
                    }
                }
            }

            int max = 0;
            for (int i = 0; i < 3; i++)
            {
                if (max < dp[N, i]) { max = dp[N, i]; }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 20160
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int w,h,n,a,b,c,i,j,k;
	cin>>w>>h>>n;
	int m[h][w];
	for(j=0;j<h;j++) for(k=0;k<w;k++) m[j][k]=0;
	for(i=0;i<n;i++){
		cin>>a>>b>>c;
//		for(j=0;j<h;j++){
//			for(k=0;k<w;k++){
//				cout<<m[j][k]<<" ";
//			}
//			cout<<endl;
//		}
		switch(c){
			case 1:
				for(j=0;j<h;j++){
					for(k=0;k<w;k++){
						if(k<a)m[j][k]=1;
					}
				}
				break;
			case 2:
				for(j=0;j<h;j++){
					for(k=0;k<w;k++){
						if(k>=a)m[j][k]=1;
					}
				}
				break;
			case 3:
				for(j=0;j<h;j++){
					for(k=0;k<w;k++){
						if(j<b)m[j][k]=1;
					}
				}
				break;
			case 4:
				for(j=0;j<h;j++){
					for(k=0;k<w;k++){
						if(j>=b)m[j][k]=1;
					}
				}
				break;
		}
//		for(j=0;j<h;j++){
//			for(k=0;k<w;k++){
//				cout<<m[j][k]<<" ";
//			}
//			cout<<endl;
//		}
	}
	int s=0;
	for(j=0;j<h;j++){
		for(k=0;k<w;k++){
//			cout<<m[j][k]<<" ";
			s+=m[j][k];
		}
//		cout<<endl;
	}
	cout<<w*h-s<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>


using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;


int main(void)
{
	int a, b, c;

	while(scanf("%d%d%d", &a, &b, &c)==3)
	{
		if(a<b) swap(a, b);
		if(a<c) swap(a, c);
		if(b<c) swap(b, c);

		printf("%d\n", a*10+b+c);
	}

	return 0;
}


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

int main ()
{
    int n;
    while (cin >> n, n) {
        int r = 0, l = 0;
        int past = 0;
        int count = 0;
        while (n--) {
            string str;
            cin >> str;
            if (str == "lu") l = 1;
            else if (str == "ru") r = 1;
            else if (str == "ld") l = 0;
            else r = 0;
            if (!(r^l) && (r&l) != past) count++, past = r&l;
        }
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-7
#define inf 0x3f3f3f3f
#define mod 1000000007ll
using namespace std;

ll calc(const vector<ll>& v) {
	int n = v.size() - 1;
	vector<ll> l(n);
	for (int i = 0; i < n; ++i)
		l[i] = (v[i + 1] - v[i]) % mod;
	vector<ll> s(n);
	s[0] = l[0];
	for (int i = 1; i < n; ++i)
		s[i] = (s[i - 1] + l[i]) % mod;
	ll cur = 0;
	for (auto i : s)
		cur = (cur + i) % mod;
	ll ans = cur;
	for (int i = 0; i < n; ++i) {
		ll diff = (1LL * (n - i) * l[i]) % mod;
		cur = (cur + mod - diff) % mod;
		ans = (ans + cur) % mod;
	}
	return ans;
}

int main() {
	speed;
	int n, m;
	cin >> n >> m;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	vector<ll> b(m);
	for (int i = 0; i < m; ++i)
		cin >> b[i];
	cout << (calc(a) * calc(b)) % mod;
}

Measured memory_bytes: 3456
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a[101][101],b[101][101];
    int l,m,n,i,j,k;
    long long int c[101][101];
    
    scanf("%d %d %d", &l, &m, &n);
    
    for(i=0; i<l; i++){
        for(j=0; j<m; j++){
            scanf("%d",&a[i][j]);
        }
        scanf("\n");
    }
    
    for(i=0; i<m; i++){
        for(j=0; j<n; j++){
            scanf("%d",&b[i][j]);
        }
        scanf("\n");
    }
    
    for(i=0; i<l; i++){
        for(j=0; j<n; j++){
            c[i][j] = 0;
            for(k=0; k<m; k++){
                c[i][j] += (a[i][k]*b[k][j]);
            }
            printf("%lld",c[i][j]);
            if(j<n-1)printf(" ");
        }
        printf("\n");
    }
    
    return 0;
}



Measured memory_bytes: 2048
#include <iostream>

using namespace std;

const int W_MAX = 102;
const int H_MAX = 102;
int block[W_MAX][H_MAX];

void fill(int x, int y) {
  if (0 <= x && x < W_MAX && 0 <= y && y < H_MAX && block[x][y] == 0) {
    block[x][y] = 2;
    fill(x-1,y);
    fill(x+1,y);
    fill(x,y-1);
    fill(x,y+1);
    if (y % 2) {
      fill(x+1,y-1);
      fill(x+1,y+1);
    } else {
      fill(x-1,y-1);
      fill(x-1,y+1);
    }
  }
}

int main() {
  int W, H;
  cin >> W >> H;
  for (int j = 0; j < H; j++) {
    for (int i = 0; i < W; i++) {
      cin >> block[i+1][j+1];
    }
  }
  fill(0, 0);
  int ans = 0;
  for (int x = 1; x < W+1; x++) {
    for (int y = 1; y < H+1; y++) {
      if (block[x][y] != 1) continue;
      if (block[x-1][y] == 2) ans++;
      if (block[x+1][y] == 2) ans++;
      if (block[x][y-1] == 2) ans++;
      if (block[x][y+1] == 2) ans++;
      if (y % 2) {
        if (block[x+1][y-1] == 2) ans++;
        if (block[x+1][y+1] == 2) ans++;
      } else {
        if (block[x-1][y-1] == 2) ans++;
        if (block[x-1][y+1] == 2) ans++;
      }
      
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 2010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
ll ans = 0;
vector<int> t_sort(vector<vector<int>> &g){
    vector<int> res,cnt(g.size(),0);
    queue<int> p,q;
    rep(i,g.size()){
        for (int e:g[i]){
            cnt[e]++;
        }
    }
    rep(i,g.size()){
        if (cnt[i] == 0) q.push(i);
    }
    while(!q.empty()){
        ans++;
        while(!q.empty()){
            p.push(q.front());
            q.pop();
        }
        while(!p.empty()){
            int v = p.front();p.pop();
            res.push_back(v);
            for (int u:g[v]){
                cnt[u]--;
                if (cnt[u] == 0){
                    q.push(u);
                }
            }
        }
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> g(n*(n-1)/2),a(n,vector<int>(n-1)),edge(n,vector<int>(n));
    int cnt = 0;
    rep(i,n){
        rep(j,n){
            if (i < j){
                edge[j][i] = edge[i][j] = cnt;
                cnt++;
            }
        }
    }
    rep(i,n){
        rep(j,n-1){
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    rep(i,n){
        rep(j,n-2){
            g[edge[i][a[i][j]]].push_back(edge[i][a[i][j+1]]);
        }
    }
    vector<int> t = t_sort(g);
    if (t.size() < n*(n-1)/2){
        PRINT(-1);
    }
    else PRINT(ans);
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

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

ll n;
ll d[300][300];

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

	cin>>n;
	REP(i,n) REP(j,n) cin>>d[i][j];
	ll ans=0;
	REP(i,n) {
		FOR(j,i+1,n) {
			bool flg=false;
			REP(k,n) {
				if(d[i][j]>d[i][k]+d[k][j]) {
					cout<<"-1"<<endl;
					return 0;
				}
				if(i!=k&&j!=k&&d[i][j]==d[i][k]+d[k][j]) flg=true;
			}
			if(!flg) ans+=d[i][j];
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1532
N,M = map(int,input().split())
broken = set()
for i in range(M):
    broken.add(int(input()))
if N == 1:
    if 1 in broken:
        print(0)
    else:
        print(1)
elif N == 2:
    if 2 in broken:
        print(0)
    elif 1 in broken:
        print(1)
    else:
        print(2)
else:
    dp = [0 for i in range(N+1)]
    if 1 not in broken:
        dp[1] = 1
    if 2 not in broken:
        dp[2] = dp[1] + 1
    for i in range(3,N+1):
        if i in broken:
            dp[i] = 0
        else:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= 1000000007
    print(dp[N])

Measured memory_bytes: 17488
n = int(input())
x = list(map(int, input().split()))
a = sorted(range(n), key=lambda i: x[i])
l = x[a[n//2-1]]
r = x[a[n//2]]
b = [0]*n
for i, j in enumerate(a):
    if i < n//2:
        b[j] = r
    else:
        b[j] = l
for e in b:
    print(e)

Measured memory_bytes: 26772
#include <stdio.h>
int main(void){
    int x, y;
    
    while (1)
    {
        char str[1024];
        int x, y;
        fgets(str, sizeof(str), stdin);
        sscanf(str, "%d %d", &x, &y);
        if (x == 0 && y == 0)
        {
            break;
        }
        if (x > y)
        {
            printf("%d %d\n", y, x);
        }
        else
        {
            printf("%d %d\n", x, y);
        }
    }
}



Measured memory_bytes: 1976
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int MOD = 1e9 + 7;

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());

	if (n % 2 == 1) {

		if (a[0] != 0) {
			cout << 0 << endl;
			return 0;
		}

		int cnt = 2;
		for (int i = 1; i < n; i++) {

			if (a[i] != cnt) {
				cout << 0 << endl;
				return 0;
			}

			if (i % 2 == 0) cnt += 2;
		}
	}
	else {
		int cnt = 1;
		for (int i = 0; i < n; i++) {

			if (a[i] != cnt) {
				cout << 0 << endl;
				return 0;
			}

			if (i % 2 == 1) cnt += 2;
		}
	}
	
	ll ans = 1;
	for (int i = 1; i <= n / 2; i++) {
		ans *= 2;
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
n, k = map(int, input().split())
p = list(map(int, input().split()))

temp= sum(p[:k])
ans = temp

for i in range(n-k):
    temp = temp - p[i]
    temp = temp + p[i+k]
    ans = max(temp, ans)
    
ans = (ans+k) / 2

print(ans)

Measured memory_bytes: 24804
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo 100000000000000000
const ll dx[]={-1,0,1, 0,-1,1, 1,-1};
const ll dy[]={ 0,1,0,-1, 1,1,-1,-1};
void solve(){
    ll x;
    cin>>x;
    if(x>=30)cout<<"Yes\n";
    else cout<<"No\n";
}

int main(){
    Boost();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3644