akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
bool used[50][50];
vector<string> S;
int H,W;
int dfs(int y,int x){
    if(used[y][x] || S[y][x] == '.')return 0;
    used[y][x] = 1;
    int num = 1;
    int dx[] = {1,0,-1,0};
    int dy[] = {0,1,0,-1};
    for(int i = 0;i < 4;i++){
        int ny = y + dy[i],nx = x + dx[i];
        if(nx < 0 || nx >= W || ny < 0 || ny >= H)continue;
        num += dfs(ny,nx);
    }
    return num;
}
main(){
    cin >> H >> W;
    string str;
    for(int i = 0;i < H;i++){cin >> str;S.push_back(str);}
    
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(S[i][j] != '#' || used[i][j])continue;
            if(dfs(i,j) < 2){
                //cout << i << " " << j << endl;
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    
}

Measured memory_bytes: 512
/*
[abc129] C - Typical Stairs
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 1e5;
const int MAX_M = MAX_N - 1;
const int MOD = 1e9 + 7;

class gf {
public:
    int n;
    gf() : n(0) {}
    gf(int n) : n(n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
};

int N, M;
bool broken[MAX_N + 1];
gf dp[MAX_N + 1];

ll solve() {
    dp[0] = 1;
    if (!broken[1]) {
        dp[1] = 1;
    }
    for (int i = 2; i <= N; i++) {
        if (!broken[i]) {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
    }
    return dp[N].n;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        broken[a] = true;
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 768
import java.util.*;

public class Main {

    public static Scanner in = new Scanner(System.in);
    public static int n = 0, k = 2;
    public static int[] h = new int[100001];
    public static long[] dp = new long[100001];
    public final static long oo = 10000000000l;

    public static long solve(int idx) {
        if (idx == n - 1) {
            return 0;
        } else {
            if (dp[idx] == -1) {
                long c1 = solve(idx + 1) + Math.abs(h[idx] - h[idx + 1]);
                long c2 = oo;
                if (n - idx > 2) {
                    c2 = solve(idx + 2) + Math.abs(h[idx] - h[idx + 2]);
                }
                return dp[idx] = Math.min(c1, c2);
            } else {
                return dp[idx];
            }
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100001; i++) {
            dp[i] = -1;
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            h[i] = in.nextInt();
        }
        System.out.println(solve(0));
    }

}


Measured memory_bytes: 75880
#include <bits/stdc++.h>
using namespace std;
int dp[100005][3];
int main(){
    int n,i,j,k,a;
    cin >> n;
    for(i=1;i<=n;i++){
        for(j=0;j<3;j++){
            cin >> dp[i][j];
        }
    }
    int ans=0;
    for(i=1;i<=n;i++)
    {
        for(j=0;j<3;j++)
        {
            int maxi=0;
            for(k=1;k<3;k++)
            {
                a=(j+k)%3;
                maxi=max(maxi,dp[i-1][a]);
            }
            dp[i][j]+=maxi;
            ans=max(ans,dp[i][j]);
        }
    }
    cout << ans << endl;
}


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

using namespace std;
int main(){
  int N;
  cin >> N;
  
  int n = 2*N;
  vector<int> A(n);
  for(int i=0; i<n; i++){
    cin >> A[i];
  }
  
  int count =0;
  bool ans = false;
  for(int i=0; i<N; i++){
    if(A[2*i] == A[2*i+1]){
      count ++;
      if(count == 3) ans = true;
    }else count = 0;
  }
  
  if(ans == true ) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 3632
<?php
$n = trim(fgets(STDIN));
$arr = array();

for ($i = 0; $i < $n; $i++) {
  list($pic, $num) = explode(" ", trim(fgets(STDIN)));
  $arr[$pic][$num] = true;
}

for ($i = 1; $i <= 13; $i++)
  if (!isset($arr["S"][$i])) echo "S $i\n";
for ($i = 1; $i <= 13; $i++)
  if (!isset($arr["H"][$i])) echo "H $i\n";
for ($i = 1; $i <= 13; $i++)
  if (!isset($arr["C"][$i])) echo "C $i\n";
for ($i = 1; $i <= 13; $i++)
  if (!isset($arr["D"][$i])) echo "D $i\n";



Measured memory_bytes: 9264
from itertools import accumulate
mod = 10**9 + 7
N, K = map(int, input().split())
a = [i for i in range(N+1)]
b = list(accumulate(a))
#b = [0] + b
# print(b)
# print(a)
ans = 0
for i in range(K, N+2):
    if i == N+1:
        v1 = b[N]
        v2 = b[i-1] - b[0]
    else:
        v1 = b[N] - b[N-i]
        v2 = b[i-1] - b[0]
    # print(v1)
    # print(a[N-i+1:])
    # print(a[:i])
    ans += v1 - v2 + 1
print(ans % mod)


Measured memory_bytes: 85304
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll n,a,b; cin>>n>>a>>b;
	cout<<(b-a)/2+(b-a)%2*min(a,n+1-b)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size();
    int cnt=n;
    rep(i,n-1){
        if(s[i]==s[i+1]){
            cnt--;
            i+=2;
        }
    }
    cout<<cnt;
}

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

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

	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);

	S = a * b;
	if (S < c * d) {
		S = c * d;
	}
	
	printf("%d\n", S);

	return (0);
}

Measured memory_bytes: 128
N,K = map(int,input().split())
p = list(map(int,input().split()))
total = sum(p[0:K])
tmp = total
if N != K:
  for i in range(N-K):
    tmp = tmp - p[i] + p[i+K]
    if tmp > total:
      total = tmp
else:
  total = sum(p)
total = K + total
print(total/2)


Measured memory_bytes: 25060
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;cin>>N;
    if(N<1000)cout<<"ABC"<<endl;
    else cout<<"ABD"<<endl;
}

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

ll sum(ll n){
    
    return n*(n+1)/2;
    
}

int main(void){
    
    ll n, k, ans=0;
    
    cin >> n >> k;
    
    for(ll i=k; i<=n+1; i++){
        
        ans += sum(n) - max(0LL, sum(n-i)) - sum(i-1) + 1;
        ans %= 1000000007;
        
    }
    
    /*
    
    for(ll i=1; i<=10*(sum(n)-sum(k-1)); i++){
        
        ans += 10000000000LL;
        ans %= 1000000007;
        
    }
    
    */
    
    cout << ans << endl;
    
    return 0;
    
}

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

int main() {
  int n;
  cin >> n;
  vector<double> p(n);
  for(int i=0;i<n;i++) {
    cin >> p.at(i);
  }
  vector<vector<double>> dp(n+1,vector<double>(n+1,0));
  dp.at(0).at(0)=1;
  for(int i=0;i<n;i++) {
    for(int j=0;j<i+1;j++) {
      if(j<n) {
        dp.at(i+1).at(j+1)+=dp.at(i).at(j)*p.at(i);
      }
      dp.at(i+1).at(j)+=dp.at(i).at(j)*(1-p.at(i));
    }
  }
  double ans=0;
  for(int i=(n+1)/2;i<n+1;i++) {
    ans += dp.at(n).at(i);
  }
  cout << fixed << setprecision(10) << ans << endl;
}

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


int main(void) {
    using namespace std;

    long n;
    cin >> n;
    
    vector<vector<int>> G(n);
    vector<pair<int,int>> es;

    for(int i=0; i<n-1; i++) {
        long a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
        es.push_back({min(a,b), max(a,b)});
    }

    map<pair<int,int>, int> m;

    auto dfs = [&] (auto dfs, int cur, int prev, int ng) -> void {
        int c = 0;

        for(auto &v: G[cur]) {
            if(v == prev) continue;
            if(c == ng) c++;
            m[{min(cur,v),max(cur,v)}] = c;
            dfs(dfs, v, cur, c++);
        }
    };
    dfs(dfs, 0, -1, -1);

    int mx = 0;
    for(auto &t: m) mx = max(t.second, mx);
    cout << mx+1 << endl;

    for(auto &e: es)
        cout << m[e]+1 << endl;
}


Measured memory_bytes: 13044
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int INT_MAX_SQRT = sqrt(INT_MAX);
int pwi(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    int tmp = pwi(x, p / 2);
    if (tmp > INT_MAX_SQRT) return 0;  // overflow
    if (p % 2 == 0)
        return tmp * tmp;
    else
        return tmp * tmp * x;
}

long LONG_MAX_SQRT = sqrt(LONG_MAX);
long pwl(long x, long p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    long tmp = pwl(x, p / 2);
    if (tmp > LONG_MAX_SQRT) return 0;  // overflow
    if (p % 2 == 0)
        return tmp * tmp;
    else
        return tmp * tmp * x;
}

map<long, long> factorization(long N) {
    map<long, long> res;
    long SQRT_N = ceil(sqrt(N));
    for (long i = 2; i < SQRT_N; i++) {
        while (N % i == 0) {
            if (res.find(i) == res.end()) {
                res[i] = 1;
            } else {
                res[i] += 1;
            }
            N /= i;
        }
    }
    if (N > SQRT_N) res[N] = 1;
    return res;
}

void debug_vec(string name, vector<int> vec) {
    cout << name << endl;
    for (auto e: vec) cout << e << endl;
}

void debug_vec(string name, vector<long> vec) {
    cout << name << endl;
    for (auto e: vec) cout << e << endl;
}

void debug_mat(string name, vector<vector<long>> mat) {
    cout << name << endl;
    for (auto vec: mat) {
        for (auto e: vec) cout << e << "   ";
        cout << endl;
    }
}

int main() {
    int N;
    cin >> N;
    map<int, int> count;
    long sum = 0;
    for (int n = 0; n < N; n++) {
        int A;
        cin >> A;
        sum += A;
        count.try_emplace(A, 0);
        count[A] += 1;
    }

    int Q;
    cin >> Q;

    for (int q = 0; q < Q; q++) {
        int B, C;
        cin >> B >> C;
        sum += (C - B) * count[B];
        count[C] += count[B];
        count[B] = 0;
        cout << sum << endl;
    }




    return 0;
}


Measured memory_bytes: 7956
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N; cin >> N;
    vector<ll> A(N), B(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    ll c = 0;
    REP(i,N) {
        if (A[i] > B[i]) c += A[i]- B[i];
        else c-= (B[i]- A[i]) / 2;
    }
    ATYN(c <= 0)
    

    return 0;
}

Measured memory_bytes: 384
import java.io.PrintWriter

fun main() {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val ans = readIntegerList().indexOf(0) + 1
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 36460
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll N = 3e5 + 5; 
const ll MAX = 3e5 + 5; 
const ll M = 1e6 + 5;

int main(){
    string a,r;
    cin >> a;
    if (a == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main() {
    int R;
    cin >> R;
    if (R >= 0 && R < 1200) {
        cout << "ABC";
    }
    if (R >= 1200 &&R < 2800) {
        cout << "ARC";
    }
    if (R >= 2800 && R <= 4208) {
        cout << "AGC";
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <stack> 
#include <set>
#include <map>
using namespace std;

typedef long long ll;
const int mod = 1000000007;

#define N 100010
#define X first
#define Y second

bool Border(int x, int y, int n, int m)
{
	return x == 0 || x == n || y == 0 || y == m;
}

struct node
{
	int x, y, z;
	node(int _x = 0, int _y = 0, int _z = 0)
	{
		x = _x, y = _y, z = _z;
	}
	bool operator < (node &t)const
	{
		if (x == 0 && y == 0) return true;
		if (t.x == 0 && t.y == 0) return false;
		if (y == 0 &&  t.y == 0) return x < t.x;
		if (x == 0 &&  t.x == 0) return y > t.y;
		return 1ll * y * t.x < 1ll * t.y * x;
	}
};

vector<node> lis;
stack<int> st;

int main()
{
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);

	int R, C, n, x1, y1, x2, y2;
	scanf("%d %d %d", &R, &C, &n);

	for (int i = 1; i <= n; ++i)
	{
		scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
		if (Border(x1, y1, R, C) && Border(x2, y2, R, C))
		{
			lis.push_back(node(x1, y1, i));
			lis.push_back(node(x2, y2, i));
		}
	}
	sort(lis.begin(), lis.end());
	for (int i = 0; i < lis.size(); ++i)
	{
		//printf("%d %d\n", lis[i].x, lis[i].y);
		if (!st.empty() && st.top() == lis[i].z) st.pop();
		else st.push(lis[i].z);
	}
	puts(st.empty()? "YES":"NO");


	return 0;
}



Measured memory_bytes: 4724
import sys
sys.setrecursionlimit(10 ** 6)
import sys
def input():
    return sys.stdin.readline()[:-1]
N , Q = map(int,input().split())
graph = [[] for _ in range(N)]
point = [0] * N
for _ in range(N - 1):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
#print(graph)
for _ in range(Q):
    a , b = map(int,input().split())
    a = a - 1
    point[a] += b
# dfsを用いて累積和を計算する
# 初期状態だと前の値がないためデフォルト引数に-1を代入
def dfs(now , prev = -1):
    for next in graph[now]:
        # 次のノードが前に参照した値の時はcontinue
        if next == prev:
            continue
        # 現在の値を次のポイントに加算することで累積和をとる
        point[next] += point[now]
        # 次のノードと現在のノードを引数にdfsを継続する
        dfs(next , now)
 
dfs(0)
print(*point)

Measured memory_bytes: 282840
def main():
    N = int(input())
    A =list(map(int,input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)

main()

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

using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  unordered_map<int, int> cnt;
  cnt[0]++;
  int prev = 0;
  uint64_t ans = 0;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    prev = (prev + tmp) % m;
    ans += cnt[prev]++;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3724
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

	int w;
	int n,sub;
	int ami[31]={0};
	for(int i=1;i<=30;i++){
        ami[i]=i;
	}
	cin>>w>>n;
	/*for(int i=1;i<=w;i++){
        cout<<ami[i]<<endl;
	}*/
	int a;
	int b;
	for(int i=0;i<n;i++){
        scanf("%d,%d",&a,&b);
        sub=ami[a];
        ami[a]=ami[b];
        ami[b]=sub;
	}
	for(int i=1;i<=w;i++){
        cout<<ami[i]<<endl;
	}


	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T1, typename T2>
istream& operator>>(istream& is, pair<T1,T2>& p) {
	is >> p.first >> p.second;
	return is;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

P operator-(const P& p1, const P& p2) {
	return P(p1.first - p2.first, p1.second - p2.second);
}

ll cross(P p1, P p2) {
	return p1.first * p2.second - p1.second * p2.first;
}

struct Polygon {
	vector<int> len;
	vector<bool> isRight;
	Polygon(vector<P> v) {
		int n = v.size();
		len.resize(n-1);
		isRight.resize(n-2);
		REP(i, n-2) {
			P p1 = v[i+1]-v[i], p2 = v[i+2]-v[i+1];
			isRight[i] = cross(p1, p2) < 0;
		}
		REP(i, n-1) {
			P p = v[i+1]-v[i];
			len[i] = abs(p.first+p.second);
		}
	}
	Polygon(vector<int> len, vector<bool> isRight) : len(len), isRight(isRight) {}
	Polygon rev() {
		vector<int> l = len;
		vector<bool> ir = isRight;
		reverse(ALL(l));
		reverse(ALL(ir));
		REP(i,ir.size()) ir[i] = !ir[i];
		return (Polygon){l, ir};
	}
	bool operator==(const Polygon& pol) {
		if (pol.len.size() != len.size()) {
			return false;
		}
		REP(i,len.size()) {
			if (pol.len[i] != len[i]) return false;
		}
		REP(i,isRight.size()) {
			if (pol.isRight[i] != isRight[i]) return false;
		}
		return true;
	}
};

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	while (cin >> N, N) {
		++N;
		vector<Polygon> pol;
		REP(i, N) {
			int M; cin >> M;
			vector<P> v(M); cin >> v;
			pol.pb( Polygon(v) );
		}
//		cout << pol[1].len << endl;
//		cout << pol[1].isRight << endl;
		FOR(i, 1, N) {
			if (pol[0] == pol[i] || pol[0] == pol[i].rev()) {
				cout << i << endl;
			}
		}
		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 3100
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef pair<int, int> P;
typedef long long LL;

const LL INF = 1 << 31;

int main()
{
    string a[4] = {"dream", "erase", "dreamer", "eraser"};
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for (int i = 0; i < 4; ++i)
    {
        reverse(a[i].begin(), a[i].end());
    }
    bool ans = false;
    LL j = 0;
    bool aaa = true;
    while (aaa)
    {
        bool ans2 = false;
        for (int i = 0; i < 4; ++i)
        {
            if (i < 2)
            {
                string d = s.substr(j, 5);
                if (d == a[i])
                {
                    j += 5;
                    ans2 = true;
                }
                continue;
            }
            else if (i == 3)
            {
                string d = s.substr(j, 6);
                if (d == a[i])
                {
                    j += 6;
                    ans2 = true;
                }
                continue;
            }
            else
            {
                string d = s.substr(j, 7);
                if (d == a[i])
                {
                    j += 7;
                    ans2 = true;
                }
                continue;
            }
        }
        LL uuu = s.size();
                if (!ans2)
        {
            aaa = false;
            break;
        }
        else if (j >= uuu - 1)
        {
            ans = true;
            break;
        }
    }
    if (ans)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;

            int n;
            cin>>n;
            int a1;
            vi v1;
            int ans = 0;
            loop(i,0,n)
            {
                cin>>a1;
                v1.pb(a1);
            }
            int k1[n+1] = {0};
            //int ans = 0;
            loop(i,0,n)
            {
              if(v1[i]==v1[i+1])
              {
                  if(k1[i]==0 && k1[i+1]==0)
                  {
                      k1[i]=1;
                      k1[i+1]=1;
                      ans++;
                  }
              }
            }
            cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3596
import sys
import math
def get_array(): return list(map(int,sys.stdin.readline().strip().split()))
def get_ints(): return map(int,sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
a=get_array()
mul=1
flag=0
if 0 in a:
    print(0)
else:
    for i in range(n):
        mul=mul*a[i] 
        if mul>1000000000000000000:
            flag=1 
            break
    if flag==0:
        print(mul)
    else:
        print(-1)

    
    
    
        
        


Measured memory_bytes: 84380
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll n,m,a,b,c;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  ll edge[101][101];
  ll edge2[101][101];
  for(int i = 0; i < n; i++){
        fill(edge[i], edge[i] + n, INF);
        fill(edge2[i], edge2[i] + n, INF);
  }
  std::vector<P> p;
  ll ans = 0;
  rep(i,m) {
    cin>>a>>b>>c;
    a--;b--;
    edge[a][b] = edge[b][a] = c;
    edge2[a][b] = edge2[b][a] = c;
    p.pb(P(a,b));
  }
  rep(k,n)rep(i,n)rep(j,n) minch(edge[i][j],edge[i][k]+edge[k][j]);
  rep(i,m) if(edge[p[i].fi][p[i].se] < edge2[p[i].fi][p[i].se]) ans++;
  cout<<ans<<endl;


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


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define int long long int

using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e18;
const double PI = acos(-1);
const int MOD = 1e9 + 7;

signed main()
{
  int a, b;
  cin >> a >> b;
  if(a <= 0 && 0 <= b){
    cout << "Zero" << endl;
  }
  else if(b < 0 && (a - b + 1) % 2){
    cout << "Negative" << endl;
  }
  else{
    cout << "Positive" << endl;
  }
  return 0;
}


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

int main() {
	string s;cin>>s;
	char dm[6]="dream";
	char dr[8]="dreamer";
	char ee[6]="erase";
	char er[7]="eraser";
	while(s.size()){
		if(s.back()=='m'){
			for(int i=4;i>=0;i--){
				if(s.back()!=dm[i]){
					cout<<"NO"<<endl;
					return 0;
				}
				s.pop_back();
			}
			continue;
		}
		if(s.back()=='e'){
			for(int i=4;i>=0;i--){
				if(s.back()!=ee[i]){
					cout<<"NO"<<endl;
					return 0;
				}
				s.pop_back();
			}
			continue;
		}
		if(s.back()=='r'){
			s.pop_back();
			if(s[s.size()-2]=='m'){
				for(int i=5;i>=0;i--){
					if(s.back()!=dr[i]){
						cout<<"NO"<<endl;
						return 0;
					}
					s.pop_back();
				}
				continue;
			}
			if(s[s.size()-2]=='s'){
				for(int i=4;i>=0;i--){
					if(s.back()!=ee[i]){
						cout<<"NO"<<endl;
						return 0;
					}
					s.pop_back();
				}
				continue;
			}
		}
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
set<string> c;
map<ll,ll> mp;
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
int main(){
int n;
cin>>n;
string s;
cin>>s;
if(n>=3200)cout<<s<<endl;
else cout<<"red"<<endl;
}

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

using namespace std;

int main(){
  int cnt=0,max=0,sum=0;
  cin >> cnt;
  for(int i=0;i<cnt;i++){
    int price=0;
    cin >> price;
    if(price>max){
      max = price;
    }
    sum+=price;
  }
  cout << sum - max/2;
  return 0;
}

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

int a[4][4];
bool vis[233];

int main(){
	for(int i = 1; i <= 3; i++)
		for(int j = 1; j <= 3; j++)
			cin>>a[i][j];
			
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		int x;
		cin>>x;
		vis[x] = true;
	}
	bool flag = false;
	for(int i = 1; i <= 3; i++){
		int Cnt = 0, sb = 0, nb = 0;
		for(int j = 1; j <= 3; j++){
			if( vis[a[i][j]] ) Cnt++;
			if( vis[a[j][i]] ) sb++;
			if( vis[a[j][j]] ) nb++;
		}
		if(Cnt == 3 || sb == 3 || nb == 3){
			flag = true;
			break;
		}
	}
	if(vis[a[1][3]] == true && vis[a[2][2]] == true && vis[a[3][1]] == true) flag = true;
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define re register
#define ll long long
#define itn int
#define gc getchar
#define cs const

int x,y;
int n,m,k;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int re i=0;i<n;++i){
		for(int re j=0;j<m;++j){
			x=(m+i+j)/k%2;
			y=(m+i-j)/k%2;
			printf("%c","RGBY"[2*x+y]);
		}
		putchar('\n');
	}
	return 0;
}

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

int main() {

	ll n; cin >> n;
	ll sum = 0;
	ll tmp = n;
	while (0 < tmp) {
		sum += tmp % 10;
		tmp /= 10;
	}
	if (n % sum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3624
Ss = input().rstrip()

isYYMM = '01' <= Ss[2:] <= '12'
isMMYY = '01' <= Ss[:2] <= '12'

if isYYMM:
    if isMMYY:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if isMMYY:
        print('MMYY')
    else:
        print('NA')


Measured memory_bytes: 2940
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;

const int MAXN = 2e5 + 10;
int a[MAXN];
int vis[MAXN];

int main() {
    memset(vis, -1, sizeof vis);
    int n;
    long long k;
    scanf("%d", &n);// don't forget &
    scanf("%lld", &k);// don't forget &
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);// don't forget &
    }
    queue<int> que;
    que.push(1);
    vis[1] = 0;
    while (que.size() != 0) {
        int cur = que.front();
        que.pop();
        if (k == vis[cur] + 1) {
            printf("%d", a[cur]);
            return 0;
        }
        int nxt = a[cur];
        if (vis[nxt] == -1) {
            vis[nxt] = vis[cur] + 1;
            que.push(nxt);
        } else {
            k -= vis[nxt];
            k %= (vis[cur] - vis[nxt] + 1);
            k += vis[nxt];
            for (int i = 1; i <= n; i++) {
                if (vis[i] == k) {
                    printf("%d", i);
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4796
#include <stdio.h>
#define N 100

int main() {
	char room[N][N+1];
	int passed[N][N];
	int h,w;
	int i,j;
	int end;
	
	while (1) {
		scanf("%d%d",&h,&w);
		if (h == 0 && w == 0) {
			break;
		}
		// default to not passed
		for (i = 0;i != h;++i) {
			for (j = 0;j != w;++j) {
				passed[i][j] = 0;
			}
		}
		// input tiles
		for (i = 0;i != h;++i) {
			scanf("%s",room[i]);
		}
		i = 0;
		j = 0;
		end = 0; // default to not end
		while (1) {
			if (passed[i][j]) {
				printf("LOOP\n");
				break;
			} else {
				passed[i][j] = 1;
			}
			switch (room[i][j]) {
				case '^':
					--i;
					break;
				case 'v':
					++i;
					break;
				case '<':
					--j;
					break;
				case '>':
					++j;
					break;
				default: // room[i][j] is '.'
					end = 1;
			}
			if (end) {
				printf("%d %d\n",j,i);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 664
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

int main(){
	while(1){
		int w,n;
		int x[50010];
		scanf("%d%d",&w,&n); if(w == 0 && n == 0)break;
		rep1(i,n){
			scanf("%d",&x[i]);
			x[i] += x[i-1];
		}
		/*rep(i,n+1){
			printf("%d ",x[i]);
		}
		puts("");*/
		
		int l = 1 , r = w;
		while(l < r){
			int m = (l+r)/2;
			int dp[50010] = {};
			dp[0] = 1; dp[1] = -1;
			int s = 0 , t = 0 , ret = 0;
			//cout << "m = " << m << endl;
			rep(i,n){
				if(i > 0)dp[i] += dp[i-1];
				if(dp[i] == 0)continue;
				while(s < i+2 || x[s]-x[i]+(s-i-1)*m < w)s ++;
				while((t <= n) && (t < s || x[t]-x[i]+(t-i-1) <= w))t ++;
				//cout << t << " " << x[n]-x[i]+(n-i-1) << endl;
				if(t == n+1){ ret = 1; break; }
				dp[s] ++;
				dp[t] --;
				//printf("%d:%d %d %d\n",i,dp[i],s,t);
			}
			//puts("--------");
			if(ret == 1)r = m;
			else l = m+1;
		}
		
		cout << l << endl;
	}
}

Measured memory_bytes: 1596
#include<stdio.h>
#include<string.h>
#define MAX 2000000
#define INFTY (1<<30)
int H,A[MAX +1];
void swap(int a,int b){
		int dmp;
		dmp = A[a];
		A[a] = A[b];
		A[b] = dmp;
	
}
void maxHeapify(int i)
{
	int l,r,largest;
	l = 2 * i;
	r = 2 * i + 1;
	int dmp = 0;
	if(l <= H && A[l] > A[i])
	{
		largest = l;
	}
	else 
	{
		largest = i;
	}
	if(r <= H && A[r] > A[largest])
	{
		largest = r;
	}
	
	if(largest != i)
	{
		swap(i,largest);
		maxHeapify(largest);
	}
}
int extract()
{
	int maxv;
	if(H < 1)
	{
		return  -INFTY;
	}
	maxv = A[1];
	A[1] = A[H--];
	maxHeapify(1);
	return maxv;
}
void increaseKey(int i,int key)
{
	
	if(key < A[i])return;
	A[i] = key;
	while(i > 1&&A[i / 2] < A[i])
	{
		swap(i,i/2);
		i = i/2;
	}
}
void insert(int key)
{
	H++;
	A[H] = -INFTY;
	increaseKey(H,key);	
}
int main ()
{
	int Key;
	char com[10];
	while(1)
	{
		scanf("%s",com);
		if(com[0] == 'e' && com[1] =='n')break;
		if(com[0] == 'i')
		{
			scanf("%d",&Key);
			insert(Key);
		}
		else
		{
			printf("%d\n",extract());
		}
		
	}
	return 0;	
}



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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
    string s,b;
    cin>>s;
    for(int i=0;i<s.size();i=i+2){
      b+=s.at(i);
    }
    cout<<b<<endl;


return 0;

}


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

int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n%2==1){
        cout << "No" << endl;
        return 0;
    }
    string t = s.substr(s.size()/2);
    if(t+t==s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int choose_mod2(vector<pii>& fact, int n, int k);

int main() {
	fast_cin();
	int n; string s;
	cin >> n >> s;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		a[i] = s[i] - '0' - 1;
	}
	vector<pii> fact(n + 1, {1, 0});
	for (int i = 1; i <= n; ++i) {
		int cur = i, cnt = 0;
		while (cur % 2 == 0) {
			cur /= 2;
			++cnt;
		}
		fact[i].first = (fact[i - 1].first * cur) % 4;
		fact[i].second = fact[i - 1].second + cnt;
	}
	bool flag = false;
	if (!count(a.begin(), a.end(), 1)) {
		flag = true;
		for (auto& i : a) {
			if (i == 2) {
				i = 1;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int cur = choose_mod2(fact, n - 1, i) * a[i];
		ans = (ans + cur) % 2;
	}
	if (flag and ans == 1) {
		ans = 2;
	}
	cout << ans << '\n';
}

int choose_mod2(vector<pii>& fact, int n, int k) {
	int ans = (fact[n].first * fact[k].first * fact[n - k].first) % 2;
	int cnt = fact[n].second - fact[k].second - fact[n - k].second;
	cnt = min(cnt, 1);
	ans *= (1 << cnt);
	return ans % 2;
}

Measured memory_bytes: 13084
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  ll ans = 0;
  ll n;
  cin >> n;
  int rem = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    if (a > 0) {
      ans += (rem + a) / 2;
      rem = (rem + a) % 2;
    } else {
      rem = 0;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){

    int N, X, Y;
    cin >> N >> X >> Y;

    vector<int> records(N);
    X--;
    Y--;

    for (int i = 0; i < N; i++)
        for (int j = i+1; j < N; j++) {

            int m1 = j - i;
            int m2 = abs(i-X)+1+abs(Y-j);

            int minimum = min({m1,m2});
            records[minimum]++;
        }

    for (int i = 1; i < N; i++)
        cout << records[i] << " ";
    cout << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	static long now() {
		return System.currentTimeMillis();
	}

	static void trace(Object... objects) {
		assert null != System.out.format("trace:%s\n", Arrays.deepToString(objects));
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;
		int a = cin.nextInt();
		int b = cin.nextInt();
		int c = cin.nextInt();
		int d = cin.nextInt();

		long start = now();

		int ans = solve(a, b, c, d);

		cout.println(ans);
		trace("elapsed", now() - start);
	}

	private static int solve(int a, int b, int c, int d) {
		int s = Math.max(a, c);
		int e = Math.min(b, d);
		int ans = Math.max(0, e - s);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    string abcd;
    cin >> abcd;
    for(int bit=0; bit < (1<<3); ++bit){
        vector<char> sign(3);
        bitset<3> s(bit);
        int ans = (int)(abcd[0]-'0');
        for(int i=0; i<3; ++i){
            if(s.test(i)){
                ans+=(int)(abcd[i+1]-'0');
                sign[i] = '+';
            }
            else{
                ans-=(int)(abcd[i+1]-'0');
                sign[i] = '-';
            }
        }
        if(ans==7){
            for(int i=0; i<3; ++i){
                cout << abcd[i] << sign[i];
            }
            cout << abcd[3] << "=7" << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
	int i,L,M,N,g=0,t=0;
	
	scanf("%d",&L);while(L!=0){
	g=0;
	t=0;
	for(i=1;i<=12;i++){
		scanf("%d %d",&M,&N);
		g+=M-N;
		if(g>=L&&t==0){
			t=i;
			
		}
	
			
	}
	if(t==0){
		printf("NA\n");
	}
	else{
		printf("%d\n",t);
}
	scanf("%d",&L);}
	return 0;
}

		

Measured memory_bytes: 612
// Believe in yourself
#include<bits/stdc++.h>

using namespace std;

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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Pair vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define mo 1000000007
#define decimal(i,n) fixed << setprecision(i) << n
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define show_nl(a) for(auto xyz:a)cout<<xyz<<endl;


void eea(ll a,ll b,ll &x,ll &y)
{
    if (a == 1)
    {
        x = 1; y = 0;
        return;
    }
    ll x1, y1;
    eea(b%a,a,x1,y1);
    x=y1-(b/a)*x1;
    y=x1;
}
ll mi(ll a,ll m)
{
    ll x,y;
    eea(a,m,x,y);
    x= (x%m+m)%m;
    return x;
}

/*
Enter the test case


Some helpful points
1.) Calm yourself
2.) check for semicolon or data type mismatch
*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);    
    ll t=1;
    // cin>>t;
    while(t--)
    {
       int n;
      cin>>n;
      if(n>=30)
        cout<<"Yes\n";
      else
        cout<<"No\n";
    }
}



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

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n;
  cin>>n;
  string s[n];
  int t[n];
  for(i=0;i<n;i++){
    cin>>s[i]>>t[i];
  }
  string u;
  cin>>u;
  int p=0;
  int ans=0;
  for(i=0;i<n;i++){
    if(p==1) ans+=t[i];
    if(s[i]==u) p=1;
  }
  cout<<ans<<endl;
  
  return 0;
}


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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
#define BIG(c) (c)-0x20
#define SMALL(c) (c)+0x20
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int X, A;
      cin >> X >> A;
      cout << ((X<A)?0:10) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
 
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e4+1;
const ll inf = 1e9+7;

int main() {
	fastio;
	ll n;
    cin >> n;
    vi arr(MAX);
    f(x,1,101){
        f(y,1,101){
            f(z,1,101){
                ll ans = x * x + y * y + z * z + x * y + y * z + z * x;
                if (ans <= n) arr[ans]++;
            }
        }
    }
    f(i,1,n+1)
        cout << arr[i] << "\n";
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}

struct SegmentTree{
private:
    int n;
    vector<int> node;
public:
    SegmentTree(vector<int>& v){
        int sz=(int)v.size();
        n=1;
        while(n<sz)n*=2;
        node.resize(2*n-1);
        for(int i=0;i<n;i++){
            if(i<sz)node[i+n-1]=v[i];
            else node[i+n-1]=0;
        }
        for(int i=n-2;i>=0;i--){
            node[i]=gcd(node[2*i+1],node[2*i+2]);
        }
    }
    void update(int a,int x){
        a+=n-1;
        node[a]=x;
        while(a>0){
            a=(a-1)/2;
            node[a]=gcd(node[2*a+1],node[2*a+2]);
        }
    }
    int get(int a=0,int b=-1,int k=0,int l=0,int r=-1){
        if(b==-1)b=n;
        if(r==-1)r=n;
        if(b<=l||r<=a)return 0;
        if(a<=l&&r<=b){
            return node[k];
        }
        else{
            return gcd(node[2*k+1],node[2*k+2]);
        }
    }
};

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    SegmentTree segtree(a);
    int ans=-1;
    for(int i=0;i<n;i++){
        segtree.update(i,0);
        ans=max(ans,segtree.get());
        segtree.update(i,a[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1664
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
const ll mod=1000000007;
// const ll mod=998244353;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}
int main(){
  int i,N,bft=0,bfx=0,bfy=0,t,x,y;
  cin>>N;
  rep(i,N){
    cin>>t>>x>>y;
    if(t-bft<abs(x-bfx)+abs(y-bfy)||(t+bft+x+y+bfx+bfy)&1)break;
    bft=t;
    bfx=x;
    bfy=y;
  }
  if(i==N)printyes;
  else printno;
}

Measured memory_bytes: 256
import Control.Applicative

main = do
    getLine
    tx <- map words . lines <$> getContents
    let (n, m) = foldr step (0, 0) tx
    putStrLn $ (show n) ++ " " ++ (show m)

step :: [String] -> (Int, Int) -> (Int, Int)
step [l, r] (n, m)
    | l < r     = (n, m + 3)
    | l > r     = (n + 3, m)
    | otherwise = (n + 1, m + 1)


Measured memory_bytes: 4160
// Last Change: 02/27/2019 00:11:31.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

bool Check(vector<ll>& target) {
  for (int i = 0; i < 3; ++i) {
    if (target[i] == 0) {
      return false;
    }
  }
  return true;
}

ll N, ans, keta;
void Cal(ll depth, ll curNum, vector<ll> eachNum) {
  if (N < curNum) {
    return;
  }

  if (Check(eachNum)) {
    ++ans;
  }
  ++depth;
  ++eachNum[0];
  Cal(depth, curNum * 10 + 3, eachNum);
  --eachNum[0];
  ++eachNum[1];
  Cal(depth, curNum * 10 + 5, eachNum);
  --eachNum[1];
  ++eachNum[2];
  Cal(depth, curNum * 10 + 7, eachNum);
  --eachNum[2];
}

int main() {
  cin >> N;
  keta = N / 10 + 1;
  ans = 0;
  vector<ll> eachNum(3, 0); // 0:3, 1:5, 2:7
  eachNum[0] = 1;
  Cal(0, 3, eachNum);
  eachNum[0] = 0;
  eachNum[1] = 1;
  Cal(0, 5, eachNum);
  eachNum[1] = 0;
  eachNum[2] = 1;
  Cal(0, 7, eachNum);

  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256