akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int N,H,W;
char field[1010][1010];
bool usd[1010][1010];
const int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};

struct state {
  int y,x,dis;

  state(int a, int b, int c){
    y = a;
    x = b;
    dis = c;
  }
};

state bfs(state arg, int obj){
  int i,j;
  queue<state> q;

  rep(i,H) rep(j,W) usd[i][j] = false;

  q.push(arg);
  while(!q.empty()){
    state t = q.front(); q.pop();

    if(field[t.y][t.x] == (char)(obj + '0')) return t;
    rep(i,4){
      int my = t.y + dy[i];
      int mx = t.x + dx[i];
      if(my < 0 || mx < 0 || H <= my || W <= mx) continue;
      if(field[my][mx] != 'X' && !usd[my][mx]){
        q.push(state(my,mx,t.dis+1));
        usd[my][mx] = true;
      }
    }
  }
}

int main(){
  int i,j;

  scanf("%d %d %d",&H,&W,&N);
  rep(i,H) scanf("%s",&field[i]);

  int res = 0;
  state tmp(0,0,0);
  rep(i,H) rep(j,W) if(field[i][j] == 'S'){ tmp.y = i; tmp.x = j; }// cout << field[tmp.y][tmp.x] << endl;
  for(i = 1; i <= N; i++) tmp = bfs(tmp,i);

  printf("%d\n",tmp.dis);

  return 0;
}

Measured memory_bytes: 2864
#include <iostream>

int main() {
    int N;
    std::cin >> N;
    
    switch (N) {
        case 25:
            std::cout << "Christmas" << std::endl;
            break;
        case 24:
            std::cout << "Christmas Eve" << std::endl;
            break;
        case 23:
            std::cout << "Christmas Eve Eve" << std::endl;
            break;
        case 22:
            std::cout << "Christmas Eve Eve Eve" << std::endl;
            break;
        default:
            break;
    }
}

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

int main(){
    set<string> SET;
    int N;
    cin >> N;
    string tmp;
    for(int i = 0; i < N ; i++){
        cin >> tmp;
        SET.insert(tmp);
    }
    int siz;
    siz = size(SET);
    printf("%d\n", siz);
    
    
}

Measured memory_bytes: 19356
from collections import deque
from sys import stdin
data = list(stdin.readline().rstrip())
i_stack, a_stack, b_stack = deque(), deque(), deque()
ans = 0
for i, c in enumerate(data):
    if c == '\\':
        i_stack.append(i)
    elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff)
print(ans)
print(len(a_stack), *b_stack)


Measured memory_bytes: 6748
N,K,C = map(int,input().split())
S = input()

l = [0]*K
r = [0]*K
ld = 0
rd = N-1
for i in range(K) :
    j = K - i - 1
    while S[ld] == 'x' :
        ld += 1
    while S[rd] == 'x' :
        rd -= 1
    l[i] = ld
    ld += 1+C
    r[j] = rd
    rd -= 1+C

for i in range(K) :
    if l[i] == r[i] :
        print(l[i]+1)


Measured memory_bytes: 20628
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,a,b;
    cin>>n>>a>>b;
    
    if((a+b)==3||(b-a)%2){
        cout1("Borys")
    }else{
        cout1("Alice")
    }
}

Measured memory_bytes: 256
a, b, c, x, y = gets.split(" ").map{|v| v.to_i}
cs_a = [a, 2 * c].min
cs_b = [b, 2 * c].min
cs_ab = [a + b, 2 * c].min
to_a = [cs_a, cs_ab].min
to_b = [cs_b, cs_ab].min
to_ab = [to_a + to_b, cs_ab].min
cn = [x, y].min
total = cn * to_ab + (x - cn) * to_a + (y - cn) * to_b
puts total


Measured memory_bytes: 1788
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

int n, k;
vector<int> a;

bool check(int x) {
    vector<int> b(n);
    int l = 0, r = 0;
    for (int i = 0; i < n; i++) {
        b[i] = a[i] % x;
        r += x - b[i];
    }
    sort(all(b));
    int ans = INF;
    for (int i = 0; i < n; i++) {
        r -= x - b[i];
        l += b[i];
        if (l == r) ans = l;
    }
    if (ans <= k) return 1;
    return 0;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    cin >> n >> k;
    a.resize(n);
    int s = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s += a[i];
    }
//    dbg(check(7))
    int ans = 1;
    for (int i = 1; i * i <= s; i++) {
        if (s % i == 0) {
            if (check(i)) ans = max(ans, i);
            if (check(s / i)) ans = max(ans, s / i);
        }
    }
    cout << ans;
}
/*

*/


Measured memory_bytes: 256
#!/usr/bin/env python
#-*- coding: utf-8 -*-

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D

if __name__ == '__main__':
    a, b, c = map(int, raw_input().split())
    cnt = 0
    for i in range(a, b + 1):
        if c % i == 0:
            cnt += 1
    print cnt


Measured memory_bytes: 4812
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <functional>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void Main();

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(10);
#ifdef LOCAL
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  Main();
#ifdef LOCAL
  cout << "\nTime: " << (int)ceil((double)1000 * clock() / CLOCKS_PER_SEC) << " ms";
#endif
}

const int MOD = 1'000'000'007;
int n;
vector<ll> a, b;
int cnt00 = 0, cnt01 = 0, cnt10 = 0;
map<pair<ll, ll>, int> cnt11;
int ans = 0;

inline int mult(int a, int b) {
  return 1ll * a * b % MOD;
}

inline int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}

inline int sub(int a, int b) {
  a -= b;
  if (a < 0) {
    a += MOD;
  }
  return a;
}

inline pair<ll, ll> to_norm(pair<ll, ll> cur) {
  if (cur.first < 0) {
    cur.first *= -1;
    cur.second *= -1;
  }
  ll g = __gcd(cur.first, abs(cur.second));
  cur.first /= g;
  cur.second /= g;
  return cur;
}

void Main() {
  cin >> n;
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      (b[i] == 0 ? cnt00 : cnt01)++;
    } else if (b[i] == 0) {
      cnt10++;
    } else {
      cnt11[to_norm(make_pair(a[i], b[i]))]++;
    }
  }
  vector<pair<int, int>> can;
  can.emplace_back(cnt10, cnt01);
  for (auto el : cnt11) {
    pair<ll, ll> par = el.first;
    swap(par.first, par.second);
    par.first *= -1;
    par = to_norm(par);
    assert(par != el.first);
    auto it = cnt11.find(par);
    if (it == cnt11.end()) {
      can.emplace_back(el.second, 0);
    } else if (par > el.first) {
      can.emplace_back(el.second, it->second);
    }
  }
  // cout << "can =";
  // for (auto [left, right] : can) {
  //   cout << " (" << left << ' ' << right << ')';
  // }
  // cout << '\n';
  vector<int> p2(n + 1);
  p2[0] = 1;
  for (int i = 1; i <= n; i++) {
    p2[i] = mult(p2[i - 1], 2);
  }
  ans = 1;
  for (auto [left, right] : can) {
    ans = mult(ans, sub(add(p2[left], p2[right]), 1));
  }
  ans--;
  if (ans == -1) {
    ans += MOD;
  }
  ans = add(ans, cnt00);
  cout << ans << '\n';
}

Measured memory_bytes: 21132
#include <iostream>
#include <cmath>

int n;
int limit;
unsigned long long int dp[101][100001];
int temp;

int main() {
	for (int i = 0; i < 100001; i++) {
		dp[0][i] = 18000000000000000000;
	}
	dp[0][0] = 0;
	std::cin >> n>>limit;
	for (int i = 0; i < 100001; i++) {
		dp[n][i] = 18000000000000000000;
	}
	int w, v;
	for (int i = 1; i <= n; i++) {
		std::cin >> w >> v;
		for (int j = 0; j <= 100000; j++) {
			if (j-v>=0&& dp[i - 1][j - v] + w <dp[i - 1][j]) {
				dp[i][j] = dp[i - 1][j - v] + w;
			}
			else{
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	/*for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= 100; j++) {
			std::cout << dp[i][j] << std::endl;
		}
	}*/
	int ans = 100000;
	for(;dp[n][ans]>limit;ans--){}
	std::cout << ans << std::endl;
}


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

ll knapsack(int val[],int wt[],int w,int n){
	ll dp[n+1][w+1]={0};

	for(int i=0;i<=n;i++){
		for(int j=0;j<=w;j++){

			if(i==0 || j==0){
				dp[i][j]=0;
              
			}else if(j < wt[i-1]){
				dp[i][j] = dp[i-1][j];
			}else {
				dp[i][j] = max(dp[i-1][j],val[i-1]+dp[i-1][j-wt[i-1]]);
			}
		}
	}

	return dp[n][w];
}


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

	int val[n],weight[n];

	for(int i =0;i<n;i++){
		cin >>weight[i] >> val[i];
	}

	cout << knapsack(val,weight,w,n)<<endl;


	return 0;
 		
 	
}

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

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

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

  int n; cin >> n;
  vector<ll> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];

  // 後ろから貪欲
  ll ans = 0;
  for(int i = n-1; i >= 0; i--) {
    a[i] += ans;
    if(a[i]%b[i] == 0) continue;
    ans += b[i]-(a[i]%b[i]);
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double inf = 1e20;
inline double sqr (double k) {return k * k;}
inline int sgn (double p) {
    if (fabs (p) < eps) return 0;
    if (p < 0) return -1;
    return 1;
}
struct point {
    double x, y;
    point (){}
    point (double _x, double _y) {
        x = _x, y = _y;
    }
    void input () {
        scanf ("%lf %lf", &x, &y);
    }
    bool operator == (point b) const {
        return sgn (x - b.x) == 0 && sgn (y - b.y) == 0;
    }
    point operator - (const point &b) const {
        return point (x - b.x, y - b.y);
    }
    double operator * (const point &b) const {
        return x * b.x + y * b.y;
    }
    double operator ^ (const point &b) const {
        return x * b.y - y * b.x;
    }
    double len () {
        return hypot (x, y);
    }
    double len2 () {
        return x * x + y * y;
    }
    double distance (point p) {
        return hypot (x - p.x, y - p.y);
    }
    point operator + (const point &b) const{
        return point (x + b.x, y + b.y);
    }
    point operator * (const double &b) const {
        return point (x * b, y * b);
    }
    point operator / (const double &b) const {
        return point (x / b, y / b);
    }
    double cross (point a, point b) {
        return (a - *this) ^ (b - *this);
    }
    double dot (point a, point b) {
        return (a - *this) * (b - *this);
    }
    bool on_seg (point a, point b) {
        return sgn (cross (a, b)) == 0 && dot (a, b) <= 0;
    }
};
bool seg (point a, point b, point c, point d) {
    if (a.on_seg (c, d) || b.on_seg (c, d) || c.on_seg (a, b) || d.on_seg (a, b)) return true;
    if (a.cross (b, d) * a.cross (b, c) < 0 && c.cross (d, b) * c.cross (d, a) < 0) return true;
    return false;
}
bool check (point p, point a, point b) {
    point x = b - a;
    double k = x.len ();
    double u = a.dot (p, b) / k;
    x = (x / k) * u;
    x = x + a;
//    cout << x.x << ' ' << x.y << endl;
    if (x.on_seg (a, b)) return true;
    return false;
//        return true;
}
int main () {
//    freopen ("in.txt", "r", stdin);
    int Q;
    cin >> Q;
    while (Q --) {
        double ans = inf, x, y;
        point s1, e1, s2, e2, a, b, c;
        s1.input (), e1.input ();
        s2.input (), e2.input ();
        if (seg (s1, e1, s2, e2)) ans = 0;
        else {
            a = e1 - s1;
            b = e2 - s2;
            x = a.len ();
            y = b.len ();
            ans = min (ans, hypot (s1.x - s2.x, s1.y - s2.y));
            ans = min (ans, hypot (s1.x - e2.x, s1.y - e2.y));
            ans = min (ans, hypot (e1.x - s2.x, e1.y - s2.y));
            ans = min (ans, hypot (e1.x - e2.x, e1.y - e2.y));
            if (check (s1, s2, e2)) ans = min (ans, fabs (s2.cross (e2, s1)) / y);
            if (check (e1, s2, e2)) ans = min (ans, fabs (s2.cross (e2, e1)) / y);
            if (check (s2, s1, e1)) ans = min (ans, fabs (s1.cross (e1, s2)) / x);
            if (check (e2, s1, e1)) ans = min (ans, fabs (s1.cross (e1, e2)) / x);
        }
        printf ("%.10f\n", ans);
    }
    return 0;
}



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

int n, q, cnt[100001];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	long long sum = 0;
	for(int i = 1; i <= n; i++){
		long long val;
		cin >> val;
		cnt[val]++;
		sum += val;
	}
	cin >> q;
	for(int i = 0; i < q; i++){
		int b, c;
		cin >> b >> c;
		sum += (long long)cnt[b] * c - (long long)cnt[b] * b;
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << sum << "\n";
	}
	return 0;
}


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

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var d = new Dictionary<string, int>(n);
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var c = int.Parse(line[0]);
            var c2 = line[1];
            if (c == 0) d[c2] = int.Parse(line[2]);
            else Console.WriteLine(d[c2]);
        }
    }
}


Measured memory_bytes: 30396
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;


int main(){
    llong n,a[200001];
    map<llong, llong> mp;
    cin >> n;
    rep(i,n-1){
        cin >> a[i];
        mp[a[i]]++;
    }
    for(int i=1;i<=n;i++){
        cout << mp[i] << endl;
    }
}


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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int N  = cin.nextInt();
		while(N--!=0){
			int[][][] field = new int[10][10][2];
			for(int i = 1;i<10;i++){
				for(int j = 1;j<10;j++){
					field[i][j][0]=cin.nextInt();
				}
			}
			for(int i = 1;i<10;i++){
				
				int[] already = new int[10]; 
				for(int j = 1;j<10;j++){
					if(already[field[i][j][0]]>0){
						field[i][j][1]=1;
						already[field[i][j][0]]++;
					}
					else{
						already[field[i][j][0]]++;
					}
				}
				for(int j = 1;j<10;j++){
					if(already[field[i][j][0]]>1){
						field[i][j][1]=1;
					}
				}
			}
			for(int i = 1;i<10;i++){
				int[] already = new int[10]; 
				for(int j = 1;j<10;j++){
					if(already[field[j][i][0]]>0){
						field[j][i][1]=1;
						already[field[j][i][0]]++;
					}
					else{
						already[field[j][i][0]]++;
					}
				}
				for(int j = 1;j<10;j++){
					if(already[field[j][i][0]]>1){
						field[j][i][1]=1;
					}
				}
			}
			for(int k = 1;k<10;k+=3){
				for(int h = 1;h<10;h+=3){
					int[] already = new int[10];
					for(int i = 0;i<3;i++){
						for(int j = 0;j<3;j++){
							if(already[field[i+k][j+h][0]]>0){
								field[i+k][j+h][1]=1;
								already[field[i+k][j+h][0]]++;
							}
							else{
								already[field[i+k][j+h][0]]++;
							}
						}
					}
					for(int i = 0;i<3;i++){
						for(int j = 0;j<3;j++){
							if(already[field[i+k][j+h][0]]>1){
								field[i+k][j+h][1]=1;
							}
						}
					}
				}
			}
			for(int i = 1;i<10;i++){
				for(int j = 1;j<10;j++){
					if(field[i][j][1]==1){
						System.out.print("*" + field[i][j][0]);
					}
					else{
						System.out.print(" " + field[i][j][0]);
					}
				}
				System.out.println();
			}
			if(N!=0){
				System.out.println();
			}
		}
	}

}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));

    vector<int> v[100001];


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

    int n,m;
    cin >> n >> m;
    rep(i,m){
        int x,y;
        cin >> x >> y;
        --x;--y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    queue<int> q;
    vector<int> ans(n,-1);
    q.push(0);
    while(!q.empty()){
        int x = q.front(); q.pop();
        for(int u : v[x]){
            if(ans[u] != -1) continue;
            ans[u] = x;
            q.push(u);
        }
    }
    cout << "Yes" << endl;
    for(int i = 1;i < n;++i){
        cout << ans[i]+1 << endl;
    }


    cout << endl;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define rep(i, a, b) for (auto i = (a); i < (b); i++)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

long long a[200100], b[200100], asum[200100], bsum[200100];
main() {
  long long n, m, k;
  cin >> n >> m >> k;
  repi(n) cin >> a[i];
  repi(m) cin >> b[i];
  repi(n) asum[i + 1] = asum[i] + a[i];
  repi(m) bsum[i + 1] = bsum[i] + b[i];
  int re = -1;
  repi(n + 1) {
    int an = i;
    long long rest = k - asum[an];
    if (rest < 0) continue;
    int bn = upper_bound(bsum, bsum + m + 1, rest) - bsum - 1;
    updatemax(re, an + bn);
  }
  cout << re << endl;
}


Measured memory_bytes: 9892
#include<stdio.h>
#define MAX 100000
typedef long long L;
int n,k;
L T[MAX];
int check(L P){
  int i=0,j;
  L s;
  for(j=0;j<k;j++){
     s=0;
    while(s+T[i]<=P){
      s+=T[i];
      i++;
      if(i==n)return n;
    }
  }
  return i;
}

int solve(){
  L left=0,right=MAX*10000,mid;
  int v;
  while(right>left+1){
    mid=(right+left)/2;
    v=check(mid);
    if(v>=n)right=mid;
    else left=mid;
  }
  return right;
}
int main(){
  int i;
  L ans;
  scanf("%d %d",&n,&k);
  for(i=0;i<n;i++)scanf("%d",&T[i]);
  // ans=solve();
  printf("%llu\n",solve());
  return 0;
}

Measured memory_bytes: 1380
#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 int long long

signed main(){
    int N,x;
    int ans=0;
    cin>>N>>x;
    vector<int>a(N);
    REP(i,N){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    REP(i,N){
        if(x>=a[i]&&i!=N-1){
            x-=a[i];
            ans++;
        }
      	if(i==N-1&&x==a[i])ans++;
    }
    cout<<ans<<endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

int f(int x, int y, int z){
   return x*x + y*y + z*z + x*y + y*z + z*x;     
}

void Main(){
    int n; cin >> n;
    int m = sqrt(n+1);
    vi ans(n+1, 0);
    
    rep3(i, 1, m) rep3(j, 1, m) rep3(k, 1, m){
        int now = f(i, j, k);
        if(0 < now && now <= n) ans[now]++;
    }
    
    rep3(i, 1, n) cout << ans[i] << endl;
    return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    IOS
    int n;
    cin>>n;
    int o,e;
    e = n/2;
    o = e + (n%2 == 1);
    cout<<o*e;
    return 0;
}

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

using namespace std;

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

    vector<int> k(m);
    vector<vector<int>> s(m, vector<int>(0));
    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            int sij;
            cin >> sij;
            s[i].push_back(sij - 1);
        }
    }

    vector<int> p(m);
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }

    int cnt = 0;
    for (int i = 0; i < (1 << n); i++) {
        vector<int> light(m, 0);
        for (int j = 0; j < m; j++) {
            for (int kk = 0; kk < k[j]; kk++) {
                if (((1 << s[j][kk]) & i) > 0) {
                    light[j]++;
                }
            }
        }

        bool flag = true;
        for (int j = 0; j < m; j++) {
            if (p[j] != light[j] % 2) {
                flag = false;
            }
        }

        if (flag) {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string disp(bool x){
    return x ? "Yes" : "No";
}

int main(){
    string p,s;
    cin >> p >> s;
    
    p += p;
    
    bool ans = 0;
    rep(i,p.size()-s.size()){
        if(p.substr(i,s.size()) == s) ans = true;
    }
    
    cout << disp(ans) << endl;
}






Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vll vector<long long>
#define pll pair<long long, long long>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1e18

typedef long long ll;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> o_tree;

// if we convert that bound day to x ,then person cant work for k days in any possilbe way
// bound day is o

void solve()
{
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    ll i, j;
    // eat x and y apples
    ll red[a], green[b];
    vll cless(c);
    for (i = 0; i < a; i++)
    {
        cin >> red[i];
    }
    for (i = 0; i < b; i++)
    {
        cin >> green[i];
    }
    for (i = 0; i < c; i++)
    {
        cin >> cless[i];
    }
    sort(red, red + a);
    reverse(red, red + a);
    sort(green, green + b);
    reverse(green, green + b);
    sort(cless.begin(), cless.end());
    vll xx(x), yy(y);
    for (i = 0; i < x; i++)
    {
        xx[i] = red[i];
    }
    for (i = 0; i < y; i++)
    {
        yy[i] = green[i];
    }
    ll res = 0;
    while (!xx.empty() && !yy.empty())
    {
        if (cless.empty())
            break;
        ll now = cless.back();
        if (min(xx.back(), yy.back()) > cless.back())
            break;
        if (xx.back() < yy.back())
        {
            xx.pop_back();
            res += now;
            cless.pop_back();
        }
        else
        {
            yy.pop_back();
            cless.pop_back();
            res += now;
        }
    }
    while (!xx.empty())
    {
        if (!cless.empty())
        {
            if (cless.back() > xx.back())
            {
                res += cless.back();
                xx.pop_back();
                cless.pop_back();
            }
            else
            {
                res += xx.back();
                xx.pop_back();
            }
        }
        else
        {
            res += xx.back();
            xx.pop_back();
        }
    }
    while (!yy.empty())
    {
        if (!cless.empty())
        {
            if (cless.back() > yy.back())
            {
                res += cless.back();
                yy.pop_back();
                cless.pop_back();
            }
            else{
                res += yy.back();
            yy.pop_back();        
            }
        }
        else
        {
            res += yy.back();
            yy.pop_back();
        }
    }
    cout << res << "\n";
}

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

    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    cout << setprecision(20);

    ll t = 1;

    // cin>>t;

    while (t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 6876
N=int(input())
H = list(map(int, input().split())) 

count=[0]
count_index=0
index=0

while index < N-1:        #すべての値を調査し終わるまで
    if(H[index] >= H[index+1]):#続いている
        count[count_index]+=1
        index+=1

    else:       #続かなくなったら
        count_index+=1
        count.append(0)
        index+=1

        
ans=0
for i in range(len(count)):
    if(ans<count[i]):
        ans=count[i]

        
print(ans)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
            #define ll long long
            #define f   first
            #define s   second
            #define pb          push_back
            #define mod        1000000007
            #define mod1       1000000009
            #define hell        998244353
            #define inf         1000000000000000000LL
            #define pi          3.14159265358979323
            //#define N           100005 
            const int N=1000005;
            using namespace std;
            ll n,k,sum,q,res,m,val,ans;
            ll x,y;
            double p;
            ll xx[]={1,0,-1,0};
            ll yy[]={0,1,0,-1};
            ll check(string &s1,string &t)
            {   ll m=t.size();
                ll res=0;
                for(int i=0;i<m;i++) if(s1[i]!=t[i]) res++;
                return res;
            }
            void solve()    
            {   ll a,b,c;
                string s,t;
                cin>>s>>t;
                n=s.size();
                m=t.size();
                ll ans=m;
                for(int i=0;i+m-1<n;i++)
                {
                    string s1=s.substr(i,m);
                    //cout<<s1<<" ";
                    ans=min(ans,check(s1,t));
                }
                cout<<ans;


                
                
            }
            int main()  
            {   ios_base::sync_with_stdio(false);
                cin.tie(0);cout.tie(0);
                ll t=1;
                
                //cin>>t;
                 for(ll i=1;i<=t;i++)
                    solve();
                
            }            


Measured memory_bytes: 3644
n=int(input())
lst=[list(map(int,input().split())) for i in range(n)]
lst=[[i[0]-i[1],i[0]+i[1]] for i in lst]

lst.sort(key=lambda x:x[1])

pin=lst[0][1]
ans=1

for i in range(1,n):
  if pin<=lst[i][0]:
    ans+=1
    pin=lst[i][1]

print(ans)

Measured memory_bytes: 42104
use proconio::input;

#[proconio::fastout]
pub fn main() {
    const M: isize = 1000000007;
    input! {
    a:[isize],
    }
    //let a: Vec<isize>;
    let asum = a.iter().sum::<isize>().rem_euclid(M);
    let a2sum = a.iter().map(|&x| (x * x).rem_euclid(M)).sum::<isize>().rem_euclid(M);
    let ans = (asum * asum - a2sum).rem_euclid(M) * 500000004;
    let ans = ans.rem_euclid(M);
    println!("{:}", ans);
}


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	string b;
	cin >> b;
	ll ans = 0;
	FOR(i,0,b.size())FOR(j,i,b.size()){
		bool flag = true;
		FOR(k,i,j+1){
			if(!(b[k] == 'A' || b[k] == 'C' || b[k] == 'G' || b[k] == 'T'))flag = false;
		}
		if(flag)chmax(ans,j-i+1);
	}
	cout << ans << endl;
}


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

int main() {
  int N; bool flg = true;
  cin >> N;
  vector<int> t(N,0), x(N,0), y(N,0);
  for (int i=0; i < N; i++) {
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  for (int i=0; i < N; i++) {
    if ((x.at(i) + y.at(i) + t.at(i)) % 2 != 0 || abs(x.at(i)) + abs(y.at(i)) > t.at(i)) {
      flg = false;
      break;
    }
  }
  cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1408
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

a,b=get_i
puts yn_judge(a+b<10,a+b,"error")

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

void move_N(int D[]){
	int tmp=D[0];
	D[0]=D[1];
	D[1]=D[5];
	D[5]=D[4];
	D[4]=tmp;
}
void move_S(int D[]){
	int tmp=D[0];
	D[0]=D[4];
	D[4]=D[5];
	D[5]=D[1];
	D[1]=tmp;
}
void move_E(int D[]){
	int tmp=D[0];
	D[0]=D[3];
	D[3]=D[5];
	D[5]=D[2];
	D[2]=tmp;
}
void move_W(int D[]){
	int tmp=D[0];
	D[0]=D[2];
	D[2]=D[5];
	D[5]=D[3];
	D[3]=tmp;
}
void move_right(int D[]){//上から見て時計回り
	int tmp=D[1];
	D[1]=D[2];
	D[2]=D[4];
	D[4]=D[3];
	D[3]=tmp;
}

int get_up(int D[]){
	int count[6];
	int min=0;
	for(int i=0;i<6;i++){
		count[i]=0;
		for(int j=0;j<6;j++){
			if(D[i]==D[j]){
				count[i]++;
			}
		}
		if(count[min]>count[i]){
			min=i;
		}
	}

	return min;
}

void set_D(int D[],int up){
	for(int i=0;i<3;i++){
		if(D[0]==up){
			break;
		}
		move_N(D);
	}
	for(int i=0;i<3;i++){
		if(D[0]==up){
			break;
		}
		move_E(D);
	}
}
void show(int D[]){
	for(int i=0;i<6;i++){
		printf("%d ",D[i]);
	}printf("\n");
}
int calc(int D0[],int D1[]){
	//D0を基準に、D1を回し検証
	//D0の上を決定する。
	int up=get_up(D0);
	int flag=0;

	set_D(D0,D0[up]);
	
	//printf("\n\n");
	
	for(int i=0;i<3;i++){
		//show(D1);
		if(D1[0]==D0[0]){
			flag=1;
			break;
		}
		move_N(D1);
	}
	if(flag==0){//printf(".\n");
		for(int i=0;i<3;i++){
			//show(D1);
			if(D1[0]==D0[0]){				
				break;
			}
			move_E(D1);
		}		
	}
	//printf("//\n");
	for(int i=0;i<3;i++){
		//show(D1);
		if(D1[1]==D0[1]){
			break;
		}
		move_right(D1);
	}
	//show(D1);
	for(int i=0;i<6;i++){
		if(D0[i]!=D1[i]){
			return 0;
		}
	}
	return 1;
}

int main(){
	int **D;
	int n;
	int flag=0;

	scanf("%d",&n);
	
	D=(int**)malloc(sizeof(int*)*n);
	for(int i=0;i<n;i++){
		D[i]=(int*)malloc(sizeof(int)*6);
		for(int j=0;j<6;j++){
			scanf("%d",&D[i][j]);
		}
	}

	for(int i=1;i<n;i++){
		if(calc(D[0],D[i])==1){
			printf("No\n");
			flag=1;
			break;
		}
	}

	if(flag==0){
		printf("Yes\n");
	}	

	return 0;
}


Measured memory_bytes: 2104
while True :
    h, w = map(int, input().split())
    if h == 0 and w == 0 : break
    for i in range(h) :
        if i == 0 or i == h - 1: 
            print ('#' * w)
        else :
            print ('#' + '.' * (w - 2) + '#')
    print()



Measured memory_bytes: 5608
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a < b && b < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}




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

int main(){
	string s;
	cin>>s;
	if(s.size()<26){
		for(char c='a';c<='z';c++){
			if(s.find(c)==string::npos){
				s+=c;
				cout<<s<<endl;
				return 0;
			}
		}
	}
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
    	cout<<-1<<endl;
    }
	else{
    	vector<bool> cnt(26,false);
    	for(int i=s.size()-1;i>=0;i--){
        	char c=s[i];
        	for(char d=c+1;d<='z';d++){
        		if(cnt[d-'a']){
        			s=s.substr(0,i);
        			s+=d;
        			cout<<s<<endl;
       		     	return 0;
       		   	}
        	}
        	cnt[c-'a']=true;
    	}
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, X: "List[int]", Y: "List[int]"):
    parities = {(Xi + Yi) % 2 for Xi, Yi in zip(X, Y)}
    if len(parities) > 1:
        print(-1)
        return

    d = [1 << i for i in range(39)]
    if next(iter(parities)) == 0:
        d.append(1)

    print(len(d))
    print(*d)

    x0 = -sum(d)
    for Xi, Yi in zip(X, Y):
        u = (Xi - x0 - Yi) // 2
        v = (Xi - x0 + Yi) // 2
        modes = []
        for i in range(39):
            ui = (u & (1 << i)) != 0
            vi = (v & (1 << i)) != 0
            modes.append({
                (False, False): "L",
                (False, True): "U",
                (True, False): "D",
                (True, True): "R",
            }[ui, vi])
        if len(d) > len(modes):
            modes.append("L")
        print("".join(modes))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = [int()] * (N)  # type: "List[int]"
    Y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, X, Y)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N; cin >> N; ll a[N];
  rep(i, N){
    cin >> a[i];
  }
  ll tmp = 0, ans=0;
  rep(i, N){
    if(a[i]==0){
      ans+=tmp/2; tmp=0;
    }
    else tmp+=a[i];
  }
  ans+=tmp/2;
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    map<int,int> mp;
    rep(i,n){
        cin >> a[i];
        mp[a[i]]++;
    }
    sort(all(a), greater<int>());
    int res = 0;
    rep(i,n){
        if(mp[a[i]] == 0) continue;
        int b = 1;
        rep(k,31){
            b *= 2;
            if(b > a[i]) break;
        }
        mp[a[i]]--;
        if(mp[b-a[i]]){
            mp[b-a[i]]--;
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 19712
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long int ll;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int a[3][3];
  rep (i, 3) rep (j, 3) {
    cin >> a[i][j];
  }
  int n, tmp;
  cin >> n;

  rep (i, n) {
    cin >> tmp;
    rep (i, 3) rep (j, 3) {
      if (a[i][j] == tmp) a[i][j] = -1;
    }
  }

  int flag = false;
  if (
    (a[0][0] == -1 && a[0][1] == -1 && a[0][2] == -1) ||
    (a[0][0] == -1 && a[1][0] == -1 && a[2][0] == -1) ||
    (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) ||
    (a[0][1] == -1 && a[1][1] == -1 && a[2][1] == -1) ||
    (a[0][2] == -1 && a[1][2] == -1 && a[2][2] == -1) ||
    (a[1][0] == -1 && a[1][1] == -1 && a[1][2] == -1) ||
    (a[2][0] == -1 && a[2][1] == -1 && a[2][2] == -1) ||
    (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1)
  ) cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}

Measured memory_bytes: 256
/*
 * Click `Run` to execute the snippet below!
 */
 
import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int total = 0;
    total += 700;
    for(int i = 0; i<3; i++){
      if(s.charAt(i) == 'o'){
        total += 100; 
      }
    }
    System.out.println(total);
  }
}


Measured memory_bytes: 35704
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]
import bisect

inf=10**11

def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2

for i in range(q):
    now = x[i]
    ind,ind2 = tansak(s,t,now)
    if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
    if ind==a:
        two=inf
    else:
        two=s[ind]
    if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
    if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
    tmp1=max(two,fo)-now
    tmp2=2*two-thr-now
    tmp3=2*fo-one-now
    tmp4=now-min(one,thr)
    tmp5=now-thr+two-thr
    tmp6=now-one+fo-one
    print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6))


Measured memory_bytes: 131800
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2) {
		cout << "Borys" << endl;
	}
	else {
		cout << "Alice" << endl;
	}
	endre;
}

Measured memory_bytes: 256
a,b,c,x,y = gets.split.map(&:to_i)

cost_ab = [a+b, c*2].min
cost_a  = [a, c*2].min
cost_b  = [b, c*2].min

cost = 0
cost += cost_ab * [x, y].min

if x == 0
  # noop
elsif x > y
  cost += cost_a * (x - y)
else
  cost += cost_b * (y - x)
end

puts cost

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

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

  int ans = 1;
  rep(i, 0, n) {
    int p = ans * 2;
    if (p - ans < k)
      ans = p;
    else
      ans += k;
  }
  cout << ans << endl;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;

int N;
vector<int> T, A;

int main(){
    cin >> N;
    T.resize(N); A.resize(N);
    for(auto &v: T) cin >> v;
    for(auto &v: A) cin >> v;
    
    vector<ll> t1(N), t2(N);
    vector<ll> a1(N), a2(N);
    
    t1[0] = T[0]; a1[N-1] = A[N-1];
    for(int i=1; i<N; i++) if(T[i-1] != T[i])
        t1[i] = T[i];
    for(int i=0; i<N-1; i++) if(A[i+1] != A[i])
        a1[i] = A[i];
    
    bool ok = true;
    for(int i=0; i<N; i++){
        if(t1[i] && a1[i]){
            ok &= t1[i] == a1[i];
        }else if(t1[i]){
            ok &= t1[i] <= A[i];
        }else if(a1[i]){
            ok &= a1[i] <= T[i];
        }
    }
    if(!ok){
        cout << 0 << endl;
    }else{
        ll ans = 1;
        for(int i=0; i<N; i++) if(a1[i] == 0 && t1[i] == 0){
            ans = (ans * min(A[i], T[i])) % MOD;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main()
{
    int n;
    char s;
    while(cin >> n)
    {
        int x = 0,max1 = 0;
        for(int i = 0;i < n;i++)
        {
            cin >> s;
            if(s == 'I')
            x++;
            else
            x--;
            max1 = max(max1,x);
        }
        cout << max1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define rep(i, s, n) for(int i = s; i < n; i++)
#define ll long long

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

    sort(a.begin(), a.end());
    int count = 1;
    int ans = 0;
    int flag = 0;
    a.push_back(0);
    rep(i, 0, n) {
        
        if(a[i] == a[i+1]) {
            count++;
            flag = 1;
        }
        else {
            flag = 0;
            //count = 1;
        }

        //cout << a[i] << " " << a[i+1] << " " << flag << " " << count  << endl;
        if(flag == 0) {
            if(count % 2 != 0) {
                ans++;
            }
            count = 1;
        }
        
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
(* 解説に基づく *)
let () =
	let _ = read_int () in (* n is not used *)
	let a =
		read_line ()
		|> Str.split (Str.regexp " ")
		|> List.map int_of_string
	in
	let sum = List.fold_left (+) 0 a in
	if sum mod 2 = 0 then
		print_endline "YES"
	else
		print_endline "NO"


Measured memory_bytes: 15872
#include <stdio.h>

int main(void)
{
	int H, W, D, r, i, n;
	
	while (1){
		scanf("%d %d %d", &H, &W, &D);
		
		if (!H || !W || !D)	break;
		
		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d", &r);
			
			if ((4*r*r) > (H*H)+(W*W) || (4*r*r) > (H*H)+(D*D) || (4*r*r) > (W*W)+(D*D)){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 584
n, m = map(int, input().split())

ans = [[0, 0] for _ in range(m)]

import math
M = math.ceil(m / 2)
for i in range(M):
    ans[i][0] = i + 1
    ans[i][1] = ans[i][0] + (M * 2 - 1 - 2 * i)

cur = M * 2

M2 = m // 2
for i in range(M2):
    ans[i + M][0] = cur + i + 1
    ans[i + M][1] = ans[i + M][0] + M2 * 2 - 2 * i


for i in range(m):
    print(ans[i][0], ans[i][1])


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

bool f(double x1,double y1,double x2,double y2,double x,double y);



int main(void){
        double x1,y1,x2,y2,x3,y3,xp,yp;
        double xm,ym;
        while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
            xm=(x1+x2+x3)/3;
            ym=(y1+y2+y3)/3;
            if(f(x1,y1,x2,y2,xp,yp)==f(x1,y1,x2,y2,xm,ym) and f(x1,y1,x3,y3,xp,yp)==f(x1,y1,x3,y3,xm,ym) and f(x3,y3,x2,y2,xp,yp)==f(x3,y3,x2,y2,xm,ym)){
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }

        }
        return 0;
}

bool f(double x1,double y1,double x2,double y2,double x,double y){
    return (y2-y1)*x-(x2-x1)*y-x1*y2+x2*y1 > 0;
}



Measured memory_bytes: 3140