akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int a,s,d=0;
  cin >>a >>s;
  vector<int> q(a);
  
  for(int z=0;z<a;z++){
  cin >>q.at(z);
    if(s<=q.at(z)){
      //cout <<q.at(z);
    d++;}
  }
  cout  <<d <<endl;
}

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

int main(){
    
    int i_x;
    
    cin >> i_x;
    
    if(i_x < 1 && i_x > 100){
        return 1;
    }
    
    i_x = i_x * i_x * i_x;
    
    cout << i_x << endl;
    
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M; //Nは都市の数,Mは道の数
  cin >> N >> M;
  vector<int> count(N);
  
  for(int i=0; i<M; i++){
    int A, B;
    cin >> A >> B;
    count.at(A-1)++;
    count.at(B-1)++;
  }
  for(int i=0; i<N; i++) cout << count.at(i) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		String[] strA = new String[N];
		String[] strB = new String[M];

		for(int i = 0;i < N;i++){
			strA[i] = sc.next();
		}

		for(int i = 0;i < M;i++){
			strB[i] = sc.next();
		}

		int[][] A = new int[N][N];
		int[][] B = new int[M][M];

		for(int i = 0;i < N;i++){
			for(int j = 0;j < N;j++){
				char ch = strA[i].charAt(j);
				if(ch == '#')A[i][j] = 1;
			}
		}
		for(int i = 0;i < M;i++){
			for(int j = 0;j < M;j++){
				char ch = strB[i].charAt(j);
				if(ch == '#')B[i][j] = 1;
			}
		}
		boolean match_flag = false;
		for(int i = 0;i <= N - M;i++){
			for(int j = 0;j <= N - M;j++){

				int k = 0,l = 0;
				for(;k < M;k++){
					boolean flag = false;
					for(l = 0;l < M;l++){
						if(A[i+k][j+l] != B[k][l]){
							flag = true;
							break;
						}
					}
					if(flag)break;
				}
				if(k == M && l == M){
					match_flag = true;
					break;
				}
			}
			if(match_flag)break;
		}
		if(match_flag)System.out.println("Yes");
		else System.out.println("No");

		sc.close();
	}

}


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

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22){
        cout<<"bust"<<endl;
    }
    else
    {
        cout<<"win"<<endl;
    }
    
    }

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
int main() {
	int n;
	int a[105];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	int ans = 1000000000;
	for (int i = -100; i <= 100; i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			sum += (a[j] - i)*(a[j] - i);
		}
		if (ans > sum) ans = sum;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
ans = []
if n % 2 == 0:
    m = n + 1
else:
    m = n
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i + j == m:
            continue
        ans.append('{} {}'.format(i, j))
print(len(ans))
print('\n'.join(ans))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    int n,m; cin >> n >> m;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i,n) cin >> a[i] >> b[i];
    
    vector<ll> c(m);
    vector<ll> d(m);
    rep(i,m) cin >> c[i] >> d[i];

    rep(i,n){
        ll ans_min = INFINITY;
        ll point = 0;
        rep(j,m){
            ll ans = (abs(a[i] - c[j]) + abs(b[i] - d[j]));
            if(ans < ans_min){
                ans_min = ans;
                point = j + 1;
            }
        }
        cout << point << endl;
    }



    /*int n; cin >> n;
    string s; cin >> s;
    vector<int> white(n, 0);
    vector<int> white_sum(n + 1);
    vector<int> black(n, 0);
    vector<int> black_sum(n + 1);

    
    rep(i,n){
        if(s[i] == '.')white[i] = 1;
        if(s[i] == '#')black[i] = i;
    }
    _rep(i, 1, n + 1){
        white_sum[i] = white[i - 1] + white_sum[i - 1];
        black_sum[i] = black[i - 1] + black_sum[i - 1];
        cout << white_sum[i] << endl;
    }
    int ans_min = N;
    rep(i,n + 1){
        int ans = white_sum[n] - white_sum[i];
        ans_min = min(ans, ans_min);
    }
    cout << ans_min << endl;*/
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  double x0,x1,x2,x3,y0,y1,y2,y3;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x0,&y0,&x1,&y1,&x2,&y2,&x3,&y3)!=-1){
    if((x1-x0)*(x3-x2)+(y1-y0)*(y3-y2)==0)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}

Measured memory_bytes: 0
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++^) n m = if n < m then List.range n `To (pred m) else []
let (++.) n m = List.map Float.of_int @@ n ++ m

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list sep conv);
  arr

let rec powerset e =
  match Enum.get e with
  | None -> Enum.singleton @@ Enum.empty ()
  | Some v ->
    let f = powerset e in
    let g = Enum.clone f in
    EnumL.map f ~f:(fun x -> let y = Enum.clone x in push y v; y)
    |>  Enum.append g

let permutations l =
  let rec aux l =
    let rec interleave x = function
      | [] -> [[x]]
      | (hd::tl) as lst ->
        (x::lst) ::
        (ListL.map ~f:(List.cons hd)  @@ interleave x tl)
    in
    match l with
    | [] -> [[]]
    | hd::tl -> List.concat @@ List.map (interleave hd) @@ aux tl in
  let l = List.sort (List.compare Int.compare) @@ aux @@ List.of_enum l in
  List.enum % ListL.map ~f:List.enum @@ l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let (a,b,n) = scan "%d %d %d" Tuple3.make

let f x =
  let a = Float.of_int a in
  let b = Float.of_int b in
  let x = Float.of_int x in
  Int.of_float @@ floor (a*. x/.b) -. a *. floor (x/.b)

let () =
  f @@ min (pred b) n
  |> Printf.printf "%d\n"


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n, k, r, s, p;
	cin >> n >> k >> r >> s >> p;
	string t;
	cin >> t;

	int ans = 0;
	for(int i = 0; i < k; ++i)
	{
		if (t[i] == 'r')
		{
			ans += p;
		}
		if (t[i] == 's')
		{
			ans += r;
		}
		if (t[i] == 'p')
		{
			ans += s;
		}
	}
	for(int i = k; i < n; ++i)
	{
		if (t[i] == 'r')
		{
			if (t[i - k] != 'r') ans += p;
			if (t[i - k] == 'r') t[i] = 'o';
		}
		if (t[i] == 's')
		{
			if (t[i - k] != 's') ans += r;
			if (t[i - k] == 's') t[i] = 'o';
		}
		if (t[i] == 'p')
		{
			if (t[i - k] != 'p') ans += s;
			if (t[i - k] == 'p') t[i] = 'o';

		}
	}
	cout << ans;

}

int main()
{
	fastio;
	solve();

	return 0;
}

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

using namespace std;

int main() {
    int m,d,count = 0;
    cin >> m >> d;
    int ten = d%10;
    d = d/10;
    int one = d%10;

    for (int i = 4; i <= m; ++i) {
        for (int n = 2; n <= one; ++n) {
            if (i%n == 0 && i/n > 1 && i/n <= 9) {
                if ((n == one && i/n <= ten) || (n != one))
                    ++count;
            }
        }
    }

    cout << count;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
const double PI=3.14159265358979323846;

int main(){
  double r;
  cin >> r;
  cout << fixed << setprecision(2) << r * 2.0 * M_PI << endl;

}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

struct UnionFind {
  vi32 par;
  UnionFind(int n) {
    par = vi32(n);
    iota(all(par), 0);
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    par[x] = y;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

void solve() {
  int N, K, L; cin >> N >> K >> L;

  auto uf0 = UnionFind(N);
  auto uf1 = UnionFind(N);

  rep(i, K) {
    int p, q; cin >> p >> q;
    p--, q--;
    uf0.unite(p, q);
  }
  rep(i, L) {
    int r, s; cin >> r >> s;
    r--, s--;
    uf1.unite(r, s);
  }

  map<pair<int, int>, int> ma;
  rep(i, N) {
    ma[make_pair(uf0.root(i), uf1.root(i))]++;
  }
  rep(i, N) {
    if (i) cout << ' ';
    cout << ma[make_pair(uf0.root(i), uf1.root(i))];
  }
  cout << '\n';
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7
#define LINF 1e18+10  
using ll = long long; 

using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
using Ps=pair<int,string>;

using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

//const ll mod=998244353;
const ll mod=1e9+7;
const ll MAX=300000;

//////////////////////////////////////


int main(){
    int n;
    cin>>n;
    vi a(n);
    ll cnt=0;
    ll money=1000;
    rep(i,n)cin>>a[i];
    rep(i,n-1){
        if(a[i+1]>a[i]){
            cnt+=money/a[i];
            money%=a[i];
        }
        if(a[i+1]<a[i]){
            money+=a[i]*cnt;
            cnt=0;
        }
    }
    money+=a[n-1]*cnt;
    cout<<money<<endl;
    return 0;
}

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

using namespace std;

int main()
{
  int n, k, q;

  cin >> n >> k >> q;

  vector<int> player(n, 0);

  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    player[a-1]++;
  }

  for (int i = 0; i < n; i++) {
    if (0 < player[i] + k - q) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x[3],r=0;
    cin>>x[0]>>x[1]>>x[2];
    sort(x,x+3);

    while(x[2]!=x[0])
    {
        if(x[2]-x[0]>=2)x[0]+=2;
        else{
            x[0]++;
            x[1]++;
        }
        r++;
        sort(x,x+3);
    }
    cout<<r<<endl;

   return 0;
}


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

int main(void){
    int x;
    cin >> x;
    if(x == 0)cout << 1;
    else cout << 0;
    
    
    
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = Convert.ToInt64(Console.ReadLine());
            int ans = 0;
            double ini = 100;
            while (true)
            {
                if(ini >= x)
                {
                    break;
                }
                ini = Math.Floor(ini * 1.01);
                ans++;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27556
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n, m;
int d[200000];
int t[200000];
std::map<int, int> mp;

signed main(){
	scanf("%ld", &n);
	for(int i = 0; i < n; i++){
		int a;
		scanf("%ld", &a);
		mp[a]++;
	}
	scanf("%ld", &m);
	for(int i = 0; i < m; i++){
		int b;
		scanf("%ld", &b);
		mp[b]--;
	}
	for(auto it = mp.begin(); it != mp.end(); it++){
		if(it->second < 0){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 12800
from sys import stdin
from math import factorial
n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))
b = list(map(int,stdin.readline().rstrip().split()))
c = list(map(int,stdin.readline().rstrip().split()))
point = 0
for i in range(n-1):
    point += b[a[i]-1]
    if a[i] + 1 == a[i+1]:
        point += c[a[i]-1]
point += b[a[n-1]-1]
print(point)

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

#define ll long long

using namespace std;

const int N = 2002;

ll n;
ll z, w;

ll a[N];

main() {
    scanf ("%lld %lld %lld", &n, &z, &w);
    for (int i = 1; i <= n; i++) {
        scanf ("%lld", a + i);
    }
    a[0] = w;
    cout << max(abs(a[n] - a[n - 1]), abs(a[n] - w));
}


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

using namespace std;

int main(int argc, char const *argv[])
{
    long long L, R;
    cin >> L >> R;
    long long ans;
    for (int i = L; i <= R; i++)
    {
        if (i % 2019 == 0)
        {
            ans = 0;
            cout << ans << endl;
            return 0;
        }
        
    }

    long long mod;
    long long modmin = __LONG_LONG_MAX__;
    for (int i = L; i <= R - 1; i++)
    {
        for (int j = i + 1; j <= R; j++)
        {
            mod = ((i % 2019) * (j % 2019)) % 2019;
            if (mod < modmin) modmin = mod;
        }
        
    }

    cout << modmin << endl;
    
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc073/tasks/abc073_b
#include <bits/stdc++.h>
using namespace std;

int main(void)
{
  int N;
  cin >> N;
  int sum=0;

  for (int i = 0; i < N; i++){
    int l, r;
    cin >> l >> r;

    sum += r - l + 1;
  }

  cout << sum << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	//input
	int64_t A, B, N;
	cin >> A >> B >> N;

	//calculation
	int64_t x = min(B - 1, N);
	int64_t left = A * x;
	left /= B;
	int64_t right = x / B;
	right *= A;
	int64_t output = left - right;

	//output
	cout << output << endl;


	return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
int n;
bool mat[25][25];
int dp[(1<<22) + 10];
int solve(int ln,int mask){
    if(dp[mask]!=-1) return dp[mask];
    if(ln==n && mask == (1<<n)-1) return 1;
    if(ln==n) return 0;
    int resp = 0;
    for(int i=0;i<n;i++){
        if(mat[ln][i] && !(mask&(1<<i))){
            resp = mod(resp + solve(ln+1,mask|(1<<i)),M);
        }
    }
    return dp[mask] = resp;
}
int32_t main(){
    fastio;
    cin >> n;
    ms(dp,-1);
    frr(i,n)
        frr(j,n) cin >> mat[i][j];
    cout << solve(0,0) << endl;
}

Measured memory_bytes: 33024
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string s;
cin >> s;
if(s.back() == 's')s = s + "es";
else s = s + 's';
cout << s << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
	int a[100], i, n, count=1;

	cin>>n;

	for(i=0; i<n; i++){
		cin>>a[i];
		if(a[i]%2==0){
			count*=2;
		}
	}
	cout<<(int)pow(3.0, (double)n)-count<<endl;
}

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

 using namespace std;
 typedef long long ll;

 int main() {
   int N, ans = 0;
   string X;

   cin >> N;

   vector<string> s(N);
   vector<int> t(N);
   for (int i = 0; i < N; i++) cin >> s.at(i) >> t.at(i);
   cin >> X;

   for (int i = 0; i < N - 1; i++) {
     if (X == s.at(i)) {
       for (int j = i + 1; j < N; j++) {
         ans += t.at(j);
       }
     }
   }
   cout << ans << endl;
 }


Measured memory_bytes: 256
#include<stdio.h>

int A[1000000],n;

int binarySearch(int key){
	int left=0;
	int right=n;
	int mid;
	while(left<right){
		mid=(left+right)/2;
		if(key==A[mid])return 1;
		if(key>A[mid])left=mid+1;
		else if(key<A[mid])right=mid;
	}
	return 0;
}

int main(){
	int i,q,k,sum=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&k);
		if(binarySearch(k))sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}

Measured memory_bytes: 980
n = int(input())
a = [int(input()) for _ in range(n)]
cnt = 0
i = 0
while True:
    cnt += 1
    if a[i] == 2:
        print(cnt)
        break
    elif cnt == n:
        print(-1)
        break
    else:
        i = a[i] - 1

Measured memory_bytes: 7084
import java.util.Scanner;


public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; ;)
		{
			int n = scanner.nextInt();
			if(n == 0)
			{
				break;
			}
			
			int sum = 0;
			for(int i=1; i<=n; i++)
			{
				if(i%5 == 0)
				{
					for(int j=i; j>0 && j%5==0; j/=5)
					{
						sum ++;
					}
				}
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 26188
while 1:
	x = raw_input().split()
	a,op,b = int(x[0]),x[1],int(x[2])
	if op == "+":
		print a+b
	elif op == "-":
		print a-b
	elif op == "/":
		print a/b
	elif op == "*":
		print a*b
	else:
		break

Measured memory_bytes: 6440
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pii         pair<int,int> 
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F         first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define mem(x)      memset(x,0,sizeof(x));
#define what_is(x)  cerr << #x << " is " << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
 
using namespace std;
 
void solve(){
    
    int n;
    cin>>n;
    int a[n][n];

    rep(i,0,n)rep(j,0,n)cin>>a[i][j];



    ll dp[(ll)pow(2,n)];

    mem(dp);

    dp[0]=1;


    for(int mask=0;mask<(ll)pow(2,n);mask++){
        ll x=0;
        for(int i=0;i<n;i++){
            ll y=mask&(1<<i);
            if(y!=0)x++;
        }
        for(int i=0;i<n;i++){
            ll y=mask&(1<<i);
            if(y==0&&a[x][i]){
                ll z=mask|(1<<i);
                dp[z]=(dp[z]+dp[mask])%hell;
            }
        }
        
    }


    cout<<dp[(ll)pow(2,n)-1];
    

    

}
 
 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
   
 
    int t=1,i=1;
   // cin>>t;
    
 
    while(t--){
       // cout<<"Case #"<<i++<<": ";
        solve();
    
    }
 
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = 0;i < n;i++){
    cin >> l[i];
  }
  int ans = 0;
  sort(l.begin(), l.end());
  
  for (int i = 0;i < n-2;i++){
    int k = i+2;
    for (int j = i+1;j < n-1;j++){
      while (l[i] + l[j] > l[k] && k < n){
        k++;
      }
      ans += (k-j-1);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
    //ll sieve[10000009];
int main()
{

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll x,y;
    cin >> x >> y;
    ll num1=y-2*x;
    ll num2=4*x-y;
    if(num1>=0 && num2>=0 && num1%2==0 && num2%2==0)
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin, (X).rend()
#define DRI(X) int (X); cin >> X
#define DRII(X, Y) int X, Y; cin >> X >> Y
#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z
// #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define readV(X) for(int &ele : (X)) cin >> ele
#define readVI(X) for(int idx = 1; idx < SZ((X)); ++idx) cin >> (X)[idx]
#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MP make_pair
#define PB push_back
#define F first
#define S second
 
using namespace std;
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
// void err(istream_iterator<string> it) {}
// template<typename T, typename... Args>
// void err(istream_iterator<string> it, T a, Args... args) {
//     cerr << *it << " = " << a << endl;
//     err(++it, args...);
// }
// template<typename... Args>
// void read(Args&... args)
// {
//     ((cin >> args), ...);
// }
 
// template<typename... Args>
// void write(Args... args)
// {
//     ((cout << args), ...);
// }
typedef long long LL;
const int INF = 1<<29;
 

int main(){
    FAST_IO
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    long long N,mod = 1e9 + 7; cin >> N;
    int bitC = 0;
    for(int pos = 0; pos <= 60; ++pos){
        if((N >> pos) & 1) bitC = pos + 1;
    }

    LL memo[65][2][2];
    memset(memo, -1, sizeof memo);

    function<LL(int, int, int)> digit;

    digit = [&](int cIdx, int carry, int ok)->LL{
        if(cIdx > bitC) return (ok && !carry);
        LL &ret = memo[cIdx][carry][ok];
        if(ret != -1){
            return ret;
        }
        int bit = (N >> cIdx) & 1;
        ret = 0;
        for(int a : {0, 1}){
            for(int b : {0, 1}){
                if(b > a) continue;
                int curBit = (a + b + carry) % 2;
                int n_carry = (a + b + carry) / 2;
                int n_ok = ok;
                if(curBit > bit) n_ok = false;
                else if(curBit < bit) n_ok = true;
                ret += digit(cIdx + 1, n_carry, n_ok);
                if(ret >= mod) ret -= mod;
            }
        }
        return ret;
    };

    cout << digit(0, 0, true) << "\n";
}    

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""
import math

N = int(input())
a = int(math.ceil(pow(N, 1/2)))
ans = 0
for i in range(1,a):
    if N % i == 0 and (N // i - 1) != i:
        ans += (N - i) // i        
print(ans)


Measured memory_bytes: 3060
//abc133_c.cpp
//Sun Jul  7 20:47:40 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int l,r;
	cin >> l >> r;

	vector<int> nums;
	for (int i=l;i<=r;i++){
		if (i%2019==0){
			cout << 0 << endl;
			return 0;
		}
		nums.push_back(i%2019);
	}
	ll min = 5000000;
	for (int i=0;i<nums.size()-1;i++){
		for (int j=i+1;j<nums.size();j++){
			if ((nums[i]*nums[j])%2019<min){
				min = (nums[i]*nums[j])%2019;
			}
		}
	}
	cout << min << endl;
}


Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<random>
#include<unordered_set>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint big=1e17-10;
const long double pai=3.141592653589793238462643383279;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int n,i,j,bmax,bmin=0;cin>>n;bmax=2*n-1;
	vector<int>num(2*n-1);
	for(i=0;i<2*n-1;i++){cin>>num[i];}
	while(bmax-bmin!=1){
		int gen=(bmax+bmin)/2;
		//genは大判定
		int hid=2*n-1,mig=-1;
		bool hiu,miu,ans;
		//左距離、右距離,左が大=true 右が大=1
		for(i=n-1;i<2*n-2;i++){
			bool a=(gen<=num[i]),b=(gen<=num[i+1]);
			if(a!=b){continue;}
			if(a==b){hid=i;hiu=(gen<=num[i]);break;}
		}
		for(i=n-1;i>0;i--){
			if((gen<=num[i])==(gen<=num[i-1])){mig=i;miu=(gen<=num[i]);break;}
		}
		if(hid==2*n-1&&mig==-1){ans=(gen<=num[0]);}
		else if((n-1)-mig<hid-(n-1)){ans=miu;}else{ans=hiu;}
		//cout<<"de"<<ans<<" "<<gen<<" "<<hid<<" "<<mig<<endl;
		if(ans){bmin=gen;}else{bmax=gen;}
		
	}
	cout<<bmin<<endl;
	return 0;
}

Measured memory_bytes: 1152
def main():
	n = int(input())
	k = n//50
	rem = n%50
	arr = [0 for i in range(50)]
	for i in range(0 , 50):
		arr[i]=i
	for i in range(0 , 50):
		arr[i]=arr[i]+k
	while rem>0:
		for i in range(0 , 50):
			if arr[i]==k:
				arr[i]=arr[i]+50
			else:
				arr[i]=arr[i]-1
		rem=rem-1
	print(50)
	print(*arr)
if __name__ == "__main__":
	main()

Measured memory_bytes: 63344
let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let snuke = Array.make n 0 in
  for i = 1 to k do
    Scanf.scanf "%d\n" @@ fun d ->
      for j = 1 to d do
        Scanf.scanf "%d " @@ fun a ->
          snuke.(a - 1) <- 1 + snuke.(a - 1)
      done
  done;
  Printf.printf "%d\n" @@
  Array.fold_right (fun n -> ( + ) @@ 1 - min 1 n) snuke 0


Measured memory_bytes: 5864
// AOJ 2549 7 Age
// 2018.2.5 bal4u

#include <stdio.h>

#define QMAX 250000
typedef struct { int s, t; } Q;
Q que[QMAX+2]; int top, end;

int lo[501], up[501];
int w[501][501];
int p[501];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

#define MAX(a,b)	((a)>=(b)?(a):(b))

int main()
{
	int n, s, i, j, k, a, b, t, ans;

	n = in(), s = in()-1;
	for (i = 0; i < n; i++) lo[i] = in(), up[i] = in();
	for (i = 0; i < n; i++) for (j = 0; j < n; j++) w[i][j] = in();

	for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++)
		if ((t = w[i][k] + w[k][j]) < w[i][j]) w[i][j] = t;

	top = end = 0;
	for (i = 0; i < n; i++) if (up[i] > w[s][i]) {
		a = MAX(w[s][i], lo[i]);
		que[end].s = i, que[end++].t = up[i];
		p[i] = up[i]-a;
	}

	while (top != end) {
		k = que[top].s, t = que[top++].t;
		for (i = 0; i < n; i++) {
			a = MAX(t + w[k][i], lo[i]);
			b = up[i];
			if (b > a && p[i] < p[k] + b-a) {
				p[i] = p[k] + b-a;
				que[end].s = i, que[end++].t = b;
			}
		}
	}
	ans = 0;
	for (i = 0; i < n; i++) if (p[i] > ans) ans = p[i];
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 4268
while 1:
	W, H = map(int,raw_input().split(" "))
	if W == H == 0: 
		break
	field = [[c for c in raw_input()] for _ in range(H)]
	secret = [0, ""]
	for j in range(H):
		for i in range(W):
			if not field[j][i].isdigit():
				continue
			left = top = ""
			if i > 0 and field[j][i-1].isdigit() and field[j][i-1] != "0":
				left = field[j][i-1]
			if j > 0 and field[j-1][i].isdigit() and field[j-1][i] != "0":
				top = field[j-1][i]
			if len(left) == len(top):
				field[j][i] = (left if left > top else top) + field[j][i]
			else :
				field[j][i] = (left if len(left) > len(top) else top) + field[j][i]
			length = len(field[j][i])
			if length > secret[0]:
				secret[1] = field[j][i]
				secret[0] = length
			elif length == secret[0] and field[j][i] > secret[1]:
				secret[1] = field[j][i]
	print secret[1]

Measured memory_bytes: 4316
#include <ctype.h>
#include <stdio.h>

int main(void)
{
        int N, K;
        char S[55];

        scanf("%d%d%s", &N, &K, S);
        S[K-1] = tolower(S[K-1]);
        printf("%s\n", S);

  		return 0;
}


Measured memory_bytes: 128
use std::io;
use std::collections::BTreeSet;

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {
    
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf.split(' ')
        .map(|s| s.trim().parse().unwrap())
        .collect()
}


fn main() {
    let n = read::<usize>()[0];
    let mochi = (0..n).map(|_| read::<usize>()[0])
        .collect::<BTreeSet<_>>();

    println!("{}", mochi.len());
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
vpint G[1111];
vint rG[1111];

bool re[1111];
int ma[1111];
signed main(){
    cin>>N>>M;
    rep(i,M){
        int a,b,c;
        scanf("%lld%lld%lld",&a,&b,&c);
        a--;b--;
        G[a].pb({b,c});
        rG[b].pb(a);
    }

    queue<int>que;
    que.push(N-1);
    re[N-1]=true;
    while(que.size()){
        int v=que.front();
        que.pop();
        for(auto u:rG[v]){
            if(re[u])continue;
            re[u]=true;
            que.push(u);
        }
    }

    fill_n(ma,N,-(LLONG_MAX/10));
    ma[0]=0;
    rep(i,2*N){
        bool update=false;
        rep(v,N){
            for(auto &e:G[v]){
                int u,c;
            tie(u,c)=e;
                if(!re[v]||!re[u])continue;
                if(ma[u]<ma[v]+c){
                    ma[u]=ma[v]+c;
                    update=true;
                }
            }
        }
        if(update&&i>=N){
            cout<<"inf"<<endl;
            return 0;
        }
    }
    cout<<ma[N-1]<<endl;
    return 0;
}


Measured memory_bytes: 384
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
three_hold_list = [0] *(3*N)
ans = ans = [N] * N
if K >= N :
    print(*ans)
else:
    for i in range(K):
        Accum = [0] *(3*N)
        for j in range(N):
            Accum[N+j-A[j]] += 1
            Accum[N+j+A[j]+1] -= 1
        num = 0
        for l in range(3*N):
            num += Accum[l]
            three_hold_list[l] = num
        if three_hold_list[N:2*N] == ans:
            break
        else:
            A = three_hold_list[N:2*N]
    print(*three_hold_list[N:2*N])

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

int solve(int n, int l, int r) {
    vector<int> A(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    for (int year = l; year <= r; year++) {
        bool flag = false;
        for (int i = 0; i < n; i++) {
            if (year % A[i] == 0) {
                if (i % 2 == 0) ans++;
                flag = true;
                break;
            }
        }
        if (!flag && n % 2 == 0) ans++;
    }
    return ans;
}

int main(void) {
    int n, l, r;
    vector<int> ans;
    while (1) {
        cin >> n >> l >> r;
        if (!n && !l && !r) break;
        ans.push_back(solve(n, l, r));
    }
    for (int i : ans) cout << i << endl;
}



Measured memory_bytes: 3096
#include<iostream>
using namespace std;
int main(){
	int m, f, r;
	cin>>m>>f>>r;
	while(m!=-1 || f!=-1 || r!=-1){
		if(m==-1 || f==-1 || m+f<30) 		cout << "F\n";
		else if(80<=m+f)				cout << "A\n";
		else if(65<=m+f && m+f<80)		cout << "B\n";
		else if(50<=m+f && m+f<65)		cout << "C\n";
		else if(30<=m+f && m+f<50 && 50<=r)	cout << "C\n";
		else if(30<=m+f && m+f<50 && r<50)	cout << "D\n";
		cin>>m>>f>>r;
	}
	return 0;
}

Measured memory_bytes: 1124
s=input()

for i in range(8):
    ans=int(s[0])
    op=[0]*3
    for j in range(3):
        if (i>>j)&1:
            ans+=int(s[j+1])
            op[j]='+'
        else:
            ans-=int(s[j+1])
            op[j]='-'
    if ans==7:
        print(s[0]+op[0]+s[1]+op[1]+s[2]+op[2]+s[3]+'=7')
        break

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

void solve(long long N, long long K, std::vector<long long> h){
    ll c = 0;
    for (ll i: h) {
        if (i >= K) {
            c++;
        }
    }
    cout << c << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


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

map<ll, ll> prime_factor(ll n){
	map<ll, ll> res;
	for(ll i = 2; i*i <= n; i++){
		while(n%i == 0){
			res[i]++;
			n /= i;
		}
	}
	if(n != 1) res[n] = 1;
	return res;
}

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

istream& operator>>(istream& is, const mint& a){return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

// 2^n
mint f(int n){
	if(n == 0) return 1;
	mint x = f(n/2);
	x *= x;
	if(n%2 == 1) x *= 2;
	return x;
}

// nCa
mint choose(int n, int a){
	mint x = 1, y = 1;
	rep(i,a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll m;
	cin >> n >> m;
	map<ll, ll> pf = prime_factor(m);
	mint ans = 1;
	Combination comb(1000000);
	for(auto p : pf){
		ans *= comb(p.second + n - 1, p.second);
		//cout << p.first << " " << p.second << " " << ans.x << endl;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 18768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main()
{
  double l;
  cin >> l;
  cout << fixed << setprecision(15) << pow(l / 3, 3) << endl;
}


Measured memory_bytes: 4132
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;

int main() {
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  if (A == 0 && B == 0) {
    for (int j = 0; j < H; j++) {
      for (int i = 0; i < W; i++) {
        cout << 0;
      }
      cout << endl;
    }
    return 0;
  }
  if (A == 0) {
    for (int j = 0; j < B; j++) {
      for (int i = 0; i < W; i++) {
        cout << 1;
      }
      cout << endl;
    }
    for (int j = B; j < H; j++) {
      for (int i = 0; i < W; i++) {
        cout << 0;
      }
      cout << endl;
    }
    return 0;
  }
  if (B == 0) {
    for (int j = 0; j < H; j++) {
      for (int i = 0; i < A; i++) {
        cout << 1;
      }
      for (int i = A; i < W; i++) {
        cout << 0;
      }
      cout << endl;
    }
    return 0;
  }
  vector<vector<int>> ans(H, vector<int>(W));
  for (int i = 0; i < H - B; i++) {
    for (int j = 0; j < W - A; j++) {
      ans[i][j] = 1;
    }
  }
  for (int i = H - B; i < H; i++) {
    for (int j = W - A; j < W; j++) {
      ans[i][j] = 1;
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 7476
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        if((a+b)>=10){
            System.out.println("error");
        }else{
            System.out.println(a+b);
        }

    }
}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, A[101010];
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
	rrep(i, N - 2, 0) {
		if (A[i] > A[i + 1] + 1) return no;
		else if (A[i] == A[i + 1] + 1) A[i]--;
	}
	return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	cout << solve() << endl;
}







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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	auto n = IN<string>();
	print(n[0] == '9' || n[1] == '9' ? "Yes" : "No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

abs_sum = sum(abs(a) for a in A)
if sum(a < 0 for a in A) %2 == 0:
    print(abs_sum)
    exit(0)
abs_min = min(abs(a) for a in A)

print(abs_sum - 2*abs_min)

Measured memory_bytes: 14412
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;

typedef modint998244353 mint;

const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;

const ll MAX = 1e9 + 5;


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

	scc_graph g(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g.add_edge(a, b);
	}

	auto scc = g.scc();
	cout << scc.size() << endl;
	for (auto si : scc) {
		cout << si.size() << " ";
		for (auto v : si) {
			cout << v << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 40584
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  int n,k,ans=0; cin>>n>>k;
  int p[n];
  rep(i,n){
    cin>>p[i];
  }
  sort(p,p+n);
  rep(i,k){
    ans+=p[i];
  }
  cout<<ans;
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>

int W,H,x,y,r;

int main(){
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x - r < 0 || W < x + r || y - r < 0 || y + r > H){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 3144
g = int(input())
v = [[0] * g for _ in range(g)]
for i in range(g):
    inp = list(map(int, input().split()))
    for j in range(inp[1]):
        v[inp[0]-1][inp[2+j]-1] = 1
for row in range(g):
    for col in range(g):
        if col == g-1:
            print(v[row][col], end="")
        else:
            print(v[row][col], end=" ")
    print()



Measured memory_bytes: 6388