akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main( void )
{
	int n, m, l, i, j, k;
	int a[100][100] = { 0 };
	int b[100][100] = { 0 };
	long c[100][100] = { 0 };
	
	scanf("%d %d %d", &n, &m, &l);
	
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			scanf("%d", &a[i][j]);
		}
	}
	
	for(i = 0; i < m; i++){
		for(j = 0; j < l; j++){
			scanf("%d", &b[i][j]);
		}
	}
	
	for(i = 0; i < n; i++){
		for(j = 0; j < l; j++){
			for(k = 0; k < m; k++){
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	
	for(i = 0; i < n; i++){
		for(j = 0; j < l-1; j++){
			printf("%ld ", c[i][j]);
		}
		printf("%ld\n", c[i][l-1]);
	}
	
	return 0;
}

Measured memory_bytes: 764
import sys
N = int(input())
B1 = []
B2 = []

def change(S):
    MIN = 0
    SUM = 0
    for i in S:
        if i == ')':
            SUM -= 1
            MIN = min(MIN, SUM)
        else:
            SUM += 1
    MIN *= -1
    return (MIN, SUM)

for _ in range(N):
    b = change(input())
    if b[1] > 0:
        B1.append(b)
    else:
        B2.append((b[0] + b[1], b[0], b[1]))

B1.sort()
B2.sort(reverse = True)

cnt = 0
for b in B1:
    if cnt < b[0]:
        print('No')
        sys.exit()
    cnt += b[1]

for b in B2:
    if cnt < b[1]:
        print('No')
        sys.exit()
    cnt += b[2]

if cnt == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 173028
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = 8
grid = list2d(N, N, '.')
# 横襲撃済
row = [False] * N
# 縦襲撃済
col = [False] * N
# 左下・右上襲撃済
dpos = [False] * (N*2-1)
# 左上・右下襲撃済
dneg = [False] * (N*2-1)

# クイーンを置く
def putQ(i, j):
    row[i] = True
    col[j] = True
    dpos[i+j] = True
    dneg[i-j+N-1] = True
    grid[i][j] = 'Q'

# クイーンを取り除く
def delQ(i, j):
    row[i] = False
    col[j] = False
    dpos[i+j] = False
    dneg[i-j+N-1] = False
    grid[i][j] = '.'

# 置ける状態か確認
def check(i, j):
    return not (row[i] or col[j] or dpos[i+j] or dneg[i-j+N-1])

qcnt = INT()
for i in range(qcnt):
    r, c = MAP()
    putQ(r, c)

def rec(i, j, cnt):
    if cnt == 8:
        return True
    for k in range(8):
        for l in range(8):
            if check(k, l):
                putQ(k, l)
                if rec(k, l, cnt+1):
                    return True
                else:
                    # うまくいかなかったら状態を元に戻す
                    delQ(k, l)
    return False

for i in range(8):
    for j in range(8):
        if rec(i, j, qcnt):
            [print(''.join(row)) for row in grid]
            exit()



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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)
#define EPS 1e-9

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5, M = 109, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


void go(int tc){
    int l, r, d;    cin >> l >> r >> d;
    cout << (r / d) - (l - 1) / d;

}

int main(){
    init();

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

    int t = 1, tc = 1;
//    cin >> t;
    while(t--)  go(tc++);
}

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}

int n;

vector<pair<int, int> > vx;
vector<pair<int, int> > vy;

vector<tuple<ll, int, int> > ed;
int p[120000];

int get(int a) {
    if (p[a] == a)
        return a;
    return p[a] = get(p[a]);
}

int un(int a, int b) {
    a = get(a);
    b = get(b);
    if (a == b)
        return 0;
    p[a] = b;
    return 1;
}


int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        vx.push_back(make_pair(x, i));
        vy.push_back(make_pair(y, i));
    }
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    for (int i = 0; i < n; ++i)
        p[i] = i;
    for (int i = 0; i < vx.size() - 1; ++i) {
        ll d = abs(vx[i].first - vx[i + 1].first);
        ed.push_back(make_tuple(d, vx[i].second, vx[i + 1].second));
    }
    for (int i = 0; i < vy.size() - 1; ++i) {
        ll d = abs(vy[i].first - vy[i + 1].first);
        ed.push_back(make_tuple(d, vy[i].second, vy[i + 1].second));
    }
    sort(ed.begin(), ed.end());
    ll ans = 0;
    for (int i = 0; i < ed.size(); ++i) {
        ll d;
        int a, b;
        tie(d, a, b) = ed[i];
        if (un(a, b))
            ans += d;
    }
    cout << ans << "\n";
    return 0;
}




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

int ans[10000];

signed main() {
  int n;
  cin >> n;

  for(int x = 1; x*x + 2 * x <= n; x++)
    for(int y = 1; x*x + y *y + x * y + x + y <= n; y++)
      for(int z = 1; x*x + y *y + z*z + x*y + y*z + z*x <= n; z++) 
        ans[x*x + y *y + z*z + x*y + y*z + z*x]++;

  for(int i=1; i<=n; i++) cout << ans[i] << endl;
}




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

typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
template<class T> inline bool is_overlap(const T& as, const T& ae, const T& bs, const T& be)
{ return bs <=ae && as <= be; }
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N, x = 0; cin >>N;
    string S; cin >> S;
    
    int ans = 0;
    for (char c: S) {
        if (c == 'I') {
            x++;
            chmax(ans, x);
        } else {
            x--;
        }
    }
    cout << ans << endl;
}


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

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

    long long sum=0;
    for (int i=1; i<=n; ++i) {
        if (i%3!=0 && i%5!=0) {
            sum+=i;
        }
    }

    cout << sum;

    return 0;
}


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

int main(){
    ll n, a, b; cin >> n >> a >> b;
    ll ans = (b-a)/2;
    if(a%2 != b%2)
        ans = min(a-1, n-b)+1+(b-a-1)/2;
    
    cout << ans << endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("outp.txt","w",stdout);
    #endif
    ll i,j,n;
    cin>>n;
    vector<ll> v(n),z(n+1);
    map<ll,ll>m;
    ll sum=0;
    for(i=0;i<n;i++)
    {
        cin>>v[i]; 
        sum=sum+v[i];
    }
    z[n-1]=0;
    for(i=n-2;i>=0;i--)
    {
        z[i]=z[i+1]+v[i+1];
    }
    ll prod=0;
    for(i=0;i<n;i++)
    {
        prod=(prod+ v[i]*(z[i]%mod)%mod)%mod;
    }
    cout<<prod;
}

    


Measured memory_bytes: 6344
#include <iostream>
#include <stack>
#include <unordered_map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <functional>
#include <iterator>
#include <tuple>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> as(n, vector<int>(n, 0));
  vector<vector<int>> game(n, vector<int>(n, 0));
  vector<int> days(n, 0); // 最後に試合した日
  vector<int> next(n, 0); // 次の試合相手(のasの2番目のインデックス)
  int game_count = 0;
  int max_day = -1;
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n-1; j++) {
      int k;
      cin >> k;
      as[i][j] = k-1;
    }
  }

  queue<pair<int, int>> queue;
  for (int i = 0; i < n; i++) {
    queue.push({i,0});
  }

  while(!queue.empty()){
    int i,j;
    tie(i, j) = queue.front();
    queue.pop();

    int a = i;
    int b = as[i][j];
    if (a>b) {swap(a,b);}
    game[a][b]++;

    if (game[a][b] == 2) {
      //cout << a << " " << b << endl;
      int day = max(days[a], days[b])+1;
      days[a] = day;
      days[b] = day;
      next[a]++;
      next[b]++;
      game_count++;
      max_day = max(max_day, day);

      queue.push({a,next[a]});
      //cout << "push " << a << " " << next[a] << endl;
      queue.push({b,next[b]});
      //cout << "push " << b << " " << next[b] << endl;
    }
  }

  if (game_count == n*(n-1)/2) {
    // 全試合できた
    cout << max_day << endl;
  } else {
    cout << -1 << endl;
  }
}


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


int main()
{
	int N;
	cin >> N;
	for(int i = 0;i < N;i++){
		int K,P;
		cin >> K >> P;
		if(K%P == 0){
			cout << P << endl;
		}else{
			cout << K%P << endl;
		}
	}
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1, 1000);
  long long ans = 1000;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i - 1] < a[i]) ans += (ans / a[i - 1]) * (a[i] - a[i - 1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
import java.lang.Math;
public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int quant = input.nextInt();
		String[] seqs = new String[2*quant];
		for(int i = 0; i < 2 * quant; i++) {
			String sequence = input.next();
			seqs[i] = sequence;
		}
		int x = 0;
		while(x < seqs.length - 1) {
			System.out.println(lcs(seqs[x], seqs[x+1]));
			x += 2;
		}
	}
	public static int lcs(String str, String str1) {
		int n = str.length();
		int m = str1.length();		
		int[][] table = new int[n + 1][m + 1];
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= m; j++) {
				if(i == 0 || j == 0)
					table[i][j] = 0;
				else if(str.charAt(i-1) == str1.charAt(j - 1))
					table[i][j] = 1 + table[i-1][j-1];
				else
					table[i][j] = Math.max(table[i-1][j], table[i][j-1]);
			}
		}
		return table[n][m];	
	}
}



Measured memory_bytes: 64632
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
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; }
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl

int LIS(vector<int> A){
    int N=A.size();
    vector<int> D;
    for(int i=0;i<N;i++){
        int pos=distance(D.begin(),lower_bound(D.begin(), D.end(),A[i]));
        if(pos==D.size()){
            D.push_back(A[i]);
        }else{
            D[pos]=A[i];
        }
    }
    return D.size();
}

signed main(void){
    int x1,x2,y1,y2;
    int N;
    vector<pair<int,int>> XY;
    vector<int> Z;
    int x,y;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> N;
    REP(i,N){
        cin >> x >> y;
        if(!((x1<=x&&x<=x2)||(x2<=x&&x<=x1)))continue;
        if(!((y1<=y&&y<=y2)||(y2<=y&&y<=y1)))continue;
        
        if(x1<=x2 && y1<=y2){
            XY.push_back({x,y});
        }else if(x1>x2 && y1>y2){
            XY.push_back({-x,-y});
        }else if(x1<=x2 && y1>y2){
            XY.push_back({x,-y});
        }else{//x1>x2 && y1<=y2
            XY.push_back({-x,y});
        }
    }
    if(x1>x2 && y1>y2){
        x1*=-1;x2*=-1;
        y1*=-1;y2*=-1;
    }else if(x1<=x2 && y1>y2){
        y1*=-1;y2*=-1;
    }else if(x1>x2 && y1<=y2){
        x1*=-1;x2*=-1;
    }
    //cout << x1 MM y1 MM x2 MM y2 << endl;
    int s=(x2-x1)+(y2-y1);
    sort(XY.begin(),XY.end());
    REP(i,XY.size()){
        Z.push_back(XY[i].second);
    }
    int k=LIS(Z);
    //cout << k << endl;
    if(k<min(x2-x1,y2-y1)+1){
        printf("%.12f\n",100*s-(20-5*PI)*k);
    }else{
        printf("%.12f\n",100*s-(20-5*PI)*(k-1)+(10*PI-20));
    }
    return 0;
}


Measured memory_bytes: 11116
#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 2  # type: int


import math
import collections


def solve(N: int, a: "List[int]"):
    b = [0]*N
    for i in range(N-1, -1, -1):
        tmp = 0
        for j in range(2, N//(i+1)+1):
            tmp += b[j*(i+1)-1]
        if tmp % MOD == a[i]:
            b[i] = 0
        else:
            b[i] = 1

    c = [i+1 for i, val in enumerate(b) if val % 2 > 0]
    print(len(c))
    if len(c) != 0:
        print(*c, sep=" ")
    return


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
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 16240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0;i < n;i++)cin >> a[i];

	ll money = 1000;
	for(int i = 0;i < n;i++){
		int st = a[i];
		int now = a[i];
		int j = i;
		while(j < n && now <= a[j]){
			now = a[j];
			j++;
		}
		int end = a[j-1];
		money += (money / st) * end - money / st * st;
		i = j-1;
	}

	cout << money << endl;
}


Measured memory_bytes: 3624
#include <stdio.h>

    int gcd(int x, int y){
    int r = 1;
    while(r!=0){
        r = x%y;
        x = y;
        y = r;
    }
    return x;
}

int main(){
    int n;
    int a, b, c;
    int sum;

    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        a = i;
        for(int j = 1; j <= n; j++){
            b = j;
            for(int k = 1; k <= n; k++){
                c = k;
                sum += gcd(gcd(a, b), c);
            }
        }
    }
    sum = sum - 1;
    printf("%d", sum);

    }

Measured memory_bytes: 2152
#include<bits/stdc++.h>
#define INF 2000000001
using namespace std;

typedef struct node{
  node *p,*l,*r;
  int key;
} Node;

typedef Node* Nodepointer;

Nodepointer T;

void insert(int z){
  Nodepointer t=(Node*)malloc(sizeof(Node));
  t->l=NULL;
  t->r=NULL;
  t->key=z;
  if(T->key==INF){
    T->key=z;
    return;
  }
  Nodepointer y=NULL,x=T;
  while(x!=NULL){
    y=x;
    if(t->key<x->key)x=x->l;
    else x=x->r;
  }
  t->p=y;
  if(y==NULL)T=t;
  else if(t->key<y->key)y->l=t;
  else y->r=t;
}

bool find(int key){
  Nodepointer x=T;
  while(x!=NULL){
    if(x->key==key)return true;
    if(key<x->key)x=x->l;
    else x=x->r;
  }
  return false;
}

void print(Nodepointer x,int y){
  if(y)cout<<' '<<x->key;
  if(x->l!=NULL)print(x->l,y);
  if(!y)cout<<' '<<x->key;
  if(x->r!=NULL)print(x->r,y);
}

int main(){
  string s;
  int n,z;
  cin>>n;
  T=(Node*)malloc(sizeof(Node));
  T->p=NULL;
  T->l=NULL;
  T->r=NULL;
  T->key=INF;
  while(n--){
    cin>>s;
    if(s=="insert")cin>>z,insert(z);
    else if(T->key!=INF&&s=="find"){
      cin>>z;
      if(find(z))cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
    else if(T->key!=INF){
      print(T,0);
      cout<<endl;
      print(T,1);
      cout<<endl;
    }
  }
  return 0;
}

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


#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define Yes_RTN s_cout("Yes");return 0
#define No_RTN  s_cout("No");return 0
#define YES_RTN s_cout("YES");return 0
#define NO_RTN  s_cout("NO");return 0


int i_cins(int n, int* A);
int l_cins2(int n, long* A,long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);

int s_asorts(const void* a, const void* b);


int main(void) {
	int N,k,i,j;
	int d[100001];

	i_cin(N); 
	i_cins(N, d);

	qsort(d, N, sizeof(int), s_asort);

	k = N / 2;

	i_cout(d[k] - d[k-1]);

	return 0;
}
	
//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}	
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a -*(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}



Measured memory_bytes: 892
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

struct store {
  int a;
  int b;
};

int struct_asc(const void *x, const void *y){
  struct store *X = (struct store *)x;
  struct store *Y = (struct store *)y;
  return X->a - Y->a;
}

int
main(int argc, char *argv[])
{
  int n, m;
  scanf("%d %d", &n, &m);
  struct store st[100000];
  for(int i = 0; i < n; ++i){
    scanf("%d %d", &st[i].a, &st[i].b);
  }

  qsort(st, n, sizeof(struct store), struct_asc);
 
  int c = 0; ll ans = 0;
  for(int i = 0; i < n; ++i){
    c += st[i].b;
    ans += (ll)st[i].a * (ll)st[i].b;
    if(c > m){
      ans -= (ll)st[i].a * ((ll)c - (ll)m);
      break;
    }
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1788
import math

N = int(input())

X = [0]*N
Y = [0]*N

for i in range(N):
    X[i], Y[i] = map(int, input().split())

ans = 0

for i in range(N-1):
    for j in range(i, N):
        ans += math.sqrt((X[i]-X[j])**2+(Y[i]-Y[j])**2)


print(ans * 2 / N) 

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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

const string YES = "Yes";
const string NO = "No";

void func(long long A, long long B, long long C){
    string ans = YES;
    if (A == B && B == C) ans = NO;
    if (A != B && B != C && C != A) ans = NO;
    cout << ans << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    func(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353;
int f[305][305][305];bool flag[305][305][305];
void add(int &x,int y){
	x=(x+y)%mod;
}
char s[305];
signed main(){
	cin>>(s+1);
	int n=strlen(s+1);
	f[n][0][0]=1;
	for(int i=n;i>=1;--i)
		for(int j=0;j<=i;++j)
			for(int k=0;j+k<=i;++k)
				if(f[i][j][k]){
					add(f[i-1][j][k],f[i][j][k]);
					if(s[i]=='0') add(f[i][j][k+1],f[i][j][k]);
					else add(f[i][j+1][k],f[i][j][k]);
				}
	for(int i=0;i<n;++i){
		flag[i][0][0]=1;
		for(int j=0;j<=i;++j)
			for(int k=0;j+k<=i;++k)
				if(flag[i][j][k]){
					flag[i+1][j][k]=1;
					if(s[i+1]=='0' || s[i+2]=='0') flag[i+2][j+1][k]=1;
					if(s[i+1]=='1' || s[i+2]=='1') flag[i+2][j][k+1]=1;
					if(s[i+1]=='0' && k) flag[i+1][j+1][k-1]=1;
					if(s[i+1]=='1' && j) flag[i+1][j-1][k+1]=1;
				}
	}
	flag[n][0][0]=0;
	int ans=0;
	for(int i=0;i<=n;++i)
		for(int j=0;j<=i;++j)
			for(int k=0;j+k<=i;++k)
				if(flag[i][j][k]) add(ans,f[i][j][k]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 120912
s=input()
a=s[0:4]+s[5:7]+s[8:10]
a=int(a)
#year=int(s[0:4])
#month=int(s[5:7])
#day=int(s[8:10])



if a<=20190430:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
	using namespace std;
	int main() {
		int N;
		cin >> N;
		vector<int> A(N),j(N);
		for (int i = 0; i < N; i++){
			cin >> A[i];
		}
		for (int i = 0; i < N; i++){
			j[A[i]-1] = i+1;
		}
		for (int i = 0; i < N; i++){
			cout << j[i];
			if (i == (N - 1)){
				cout << endl;
			}
			else cout << " ";
		}
		return 0;
	}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int n,m,q;
int sum,a[105],b[105],c[105],d[105],k[105];
void dfs(int x)
{
	if(x>n)
	{
		int res=0;
		for(int i=0;i<q;i++)
		{
			if(k[b[i]]-k[a[i]]==c[i])
				res+=d[i];
		}
		sum=max(sum,res);
		return;
	}
	for(int i=k[x-1];i<=m;++i)
	{
		k[x]=i;
		dfs(x+1);
	}
}
int main()
{
	cin>>n>>m>>q;
	for(int i=0;i<q;i++)
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	k[0]=1;
	dfs(1);
	cout<<sum;

	return 0;
}

Measured memory_bytes: 3648
package main

import (
	"fmt"
)

func main() {
	var a,b string
	fmt.Scan(&a,&b)
	
	if len(a) > len(b) {
		fmt.Println("GREATER")
		return
	}
	if len(a) < len(b) {
		fmt.Println("LESS")
		return
	}
	
	//len(a)==len(b)
	for i := 0; i < len(a); i++ {
		if a[i] > b[i] {
			fmt.Println("GREATER")
			return
		}
		if a[i] < b[i] {
			fmt.Println("LESS")
			return
		}
	}
	fmt.Println("EQUAL")
}

Measured memory_bytes: 512
#include <stdio.h>
int check[100001];
int main(){
	int n, i, cnt=0;
	int r[100001];
	scanf("%d", &n);
	for(i=1; i<=n; i++){
		scanf("%d", &r[i]);	
	}	
	
	for(i=1; i<=n; i++){
		if(r[r[i]]==i && r[i]!=i && check[i]==0){
			cnt++;			
			check[i]=check[r[i]]=1;
		} 
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
using namespace std;
int n,pp,sign,a[200005],g,h;
long long ans=0;
struct tt{
	int id,num;
} b[200005];
bool pd(tt x,tt y)
{
	if ((x.num<y.num)|| (x.num==y.num && x.id<y.id))return true;
	return false;
}
int search1(int t,int i,int j){
	int mid=(i+j)/2;
	if (j<i) return -1;
	if (b[mid].num==t&&b[mid-1].num!=t) return mid;
	if ((b[mid].num>t)||(b[mid].num==t&&b[mid-1].num==t)) return search1(t,i,mid-1);
	if (b[mid].num<t) return search1(t,mid+1,j);
}

int search2(int t,int i,int j){
	int mid=(i+j)/2;
	if (j<i) return -1;
	if (b[mid].num==t&&b[mid+1].num!=t) return mid;
	if (b[mid].num>t) return search2(t,i,mid-1);
	if ((b[mid].num<t)||(b[mid].num==t&&b[mid+1].num==t)) return search2(t,mid+1,j);
}

int main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i].num = a[i]+i;
		b[i].id = i;
	}
	b[0].num = -1;
	b[0].id=0;
	b[n+1].num=-1;
	b[n+1].id=0;
	sort(b,b+n,pd);
	for (int i=2;i<=n;i++)
	{
		pp = i-a[i];
		g = search1(pp,1,n);
		if(g!=-1)
		{
			h = search2(pp,1,n);
			while ((b[h].id>i)&&h>0) h--;
			if (h<g) continue;
			ans+=h-g+1;
		}
		
	}
	cout<<ans;
	return 0;
}
	

Measured memory_bytes: 5968
#! /usr/bin/env python3

# from math import gcd
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = input()

hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]

if int(N[-1]) in hon:
    print("hon")
elif int(N[-1]) in pon:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 10456
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  char c[3];
  rep(i,3)cin>>c[i];
  int res=0;
  rep(i,3)res+=c[i]=='1';
  cout<<res<<endl;


  return 0;

}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n;
  scanf("%d", &n);

  int t, a;
  scanf("%d %d", &t, &a);

  double h;
  vector<double> v(n);
  REP (i, n) {
    scanf("%lf", &h);
    v[i] = t - 0.006 * h;
  }
  
  double dif = pow(10, 9);
  int ans = 0;
  REP (i, n) {
    if (dif > abs(v[i] - a)) {
      dif = abs(v[i] - a);
      ans = i + 1;
    }
  }

  cout << ans << endl;
}


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

int main() {
  int N, A[110];
  cin >> N; for (int i = 0; i < N; i++) cin >> A[i];
  int min = A[0], max = A[0];
  for (int i = 0; i < N; i++) {
    if (A[i] < min) min = A[i];
    else if (A[i] > max) max = A[i];
  }
  int res = max - min;
  cout << res << endl;
}

Measured memory_bytes: 256
#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);
    
    ll N,M;
    cin>>N>>M;
    if(N>M) swap(N,M);
    if(N+M==2){
        cout1(1)
    }else if(N==1){
        cout1(M-2)
    }else{
        cout1((N-2)*(M-2))
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
/*
bool ok (int x){
    bool ok = true;
    for(int i = 2; i*i <= x; ++i){
        if(x%i==0) {ok = false; break;}
    }
    return ok;
}
*/

int main() {
    int q;
    int max = 10101010;
    cin >> q;
    // エラトステネスのふるい
    vector<int> prime(max, 1);
    prime[0] = 0;
    prime[1] = 0;
    for(int i = 2; i < max; i++){
        if(!prime[i]) continue;
        for(int j = i*2; j < max; j+=i){
            prime[j]=0;
        }
    }

    vector<int> x(max, 0);
    rep(i,max){
        if(i%2==0) continue;
        if(prime[i] && prime[(i+1)/2]) x[i]=1;
    }

    vector<int> y(max+1, 0);
    rep(i,max){
        y[i+1] = y[i] + x[i];
    }

    rep(i,q) {
        int l, r;
        cin >> l >> r;
        r++;
        cout << y[r]-y[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 121532
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
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...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n;
    cin>>n;
    if(n%2==1){
         cout<<"0";
         return;
    }
    int ans=0;
    int i=1,d=10;
    int bt=0;
    while(d<=n){
        ans+=(n/d);
        i++;
        if(n==d) break;
        if(bt) d*=2;
        else d*=5;
    }
    cout<<ans<<endl;
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

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

int main() {
  int x, y;
  cin >> x >> y;
  string ans = "No";
  for (int i = 0; i <= x; i ++) {
    if (2*i + 4*(x-i) == y) {
      ans = "Yes";
      break;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> G[5000];
bool p[5000];
vector<int> v;

void dfs(int x){
  if(p[x]++)return;
  for(auto e:G[x]){
    dfs(e);
  }
  v.push_back(x);
}

int main(){
  int n,m;
  cin>>n>>m;
  while(m--){
    int i,j;
    cin>>i>>j;
    G[i-1].push_back(j-1);
  }
  for(int i=0;i<n;i++){
    dfs(i);
  }
  bool f=false;
  for(int i=0;i+1<n;i++){
    f|=find(begin(G[v[i+1]]),end(G[v[i+1]]),v[i])==end(G[v[i+1]]);
  }
  for(auto it=v.rbegin();it!=v.rend();it++){
    cout<<*it+1<<endl;
  }
  cout<<f<<endl;
}

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

string bnf(string s, int& pos){
	string ans = "";
	while(pos < s.length()){
		int temp = 0;
		//printf("%d ", pos);
		if(s[pos] == '+' || s[pos] == '-'){
			while(!((s[pos] >= 'A' && s[pos] <= 'Z') || s[pos] == '?')){
				if(s[pos] == '+') temp++;
				if(s[pos] == '-') temp--;
				pos++;
			}
		}
		if(s[pos] == '?'){
			ans += 'A';
			pos++;
			temp = 0;
		}
		if(s[pos] >= 'A' && s[pos] <= 'Z'){
			ans += (s[pos] - 'A' + temp % 26 + 26) % 26 + 'A';
			pos++;
		}
		if(s[pos] == '['){
			string y = bnf(s,++pos);
			string z(y.rbegin(), y.rend());
			ans += z;
		}
		if(s[pos] == ']'){
			pos++;
			return ans;
		}
	}
	return ans;
}


int main(){
	string s;
	while(1){
		cin >> s;
		if(s==".")break;
		int pos = 0;
		cout << bnf(s,pos) << endl;
	}
	return 0;
}


Measured memory_bytes: 3240
#include<iostream>
#include<string>
using namespace std;
int main(){
long a,b[4]={0};
string bb;
while(cin>>a){
cin>>bb;
if(bb==",A")b[0]++;
else if(bb==",B")b[1]++;
else if(bb==",AB")b[2]++;
else if(bb==",O")b[3]++;
}
cout<<b[0]<<endl;
cout<<b[1]<<endl;
cout<<b[2]<<endl;
cout<<b[3]<<endl;
return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
int i,i0,n,m,ans,a[100005],b[100005],A,B,M;
int main()
{
    scanf("%d %d %d",&A,&B,&M);
	int mini=INT_MAX;
	for(int i=1;i<=A;i++)scanf("%d",&a[i]),mini=min(mini,a[i]);
	ans+=mini;
	mini=INT_MAX;
	for(int i=1;i<=B;i++)scanf("%d",&b[i]),mini=min(mini,b[i]);
	ans+=mini;
	while(M--)
	{
		int x,y,z;
		scanf("%d %d %d",&x,&y,&z);
		ans=min(ans,a[x]+b[y]-z);
	}
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1024
//BY: YASH JAIN, CF: yashjain0333
#include <bits/stdc++.h>
using namespace std;
#define May_the_fork_be_with_you ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define INF 1e18
#define ll long long
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define int long long
#define N 200005

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int res = INT_MIN;
    res = max({a*c,a*d,b*c,b*d});
    cout<<res;
}

int32_t main(){
    May_the_fork_be_with_you
    int t = 1; 
    // cin>>t;
    while (t--) {
        solve();
	}
}

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

int main(void)
{
	string s;
	int n = 0;
	int flag = 0;

	cin >> s;

	n = s.size();

	for (int i = 0; i < ((n - 1) / 2); i++) {
		if (s.at(i) != s.at(i + (n + 1) / 2)) {
			flag++;
		}
	}

	if (flag == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
a,b,c,d = gets.chomp.split(" ").map(&:to_i)
arr = Array.new(101,0)
(a..b).each do |i|
  arr[i] += 1
end
(c..d).each do |i|
  arr[i] += 1
end
count = 0
st = []
arr.each_with_index do |o,j|
  if o == 2
    st << j
  end
end
if st.size >= 2
    puts st.pop - st.shift
else
    puts "0"
end

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

int main()
{
    string S;
    cin >> S;
    int size = S.size();
    vector<int> zeroIndexes(0);
    char prev = '>';
    for(int i = 0; i < size; i++)
    {
        if(prev == '>' && S[i] == '<'){
            zeroIndexes.push_back(i);
        }
        prev = S[i];
    }
    //最後の分
    if(prev == '>'){
        zeroIndexes.push_back(size);
    }
    vector<int> nums(size + 1, -1);
    for(int index: zeroIndexes){
        nums.at(index) = 0;
        int currentIndex = index - 1;
        int currentNum = 1;
        while(currentIndex >= 0 && S[currentIndex] != '<'){
            nums.at(currentIndex) = max(nums.at(currentIndex), currentNum);
            currentNum++;
            currentIndex--;
        }
        currentIndex = index + 1;
        currentNum = 1;
        while(currentIndex - 1 < size && S[currentIndex - 1] != '>'){
            nums.at(currentIndex) = max(nums.at(currentIndex), currentNum);
            currentNum++;
            currentIndex++;
        }
    }
    ll answer = 0;
    for(int num: nums){
        answer += num;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>2);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,k;
  string s;
  cin >> n >> k >> s;
  ll ans = 0;
  for(ll i = 0; i < n-1; ++i){
    if(s[i] == s[i+1]) ++ans;
  }
  cout << min(n-1,ans+2*k);
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;

	vector<pair<int, int>> ns(n);
	FOR_LT(i, 0, n) {
		int m; cin >> m;
		ns[i].first = m;
		ns[i].second = i;
	}

	sort(ns.begin(), ns.end(), [](const auto& lhs, const auto& rhs) {
		return lhs.first < rhs.first;
		});

	FOR_LT(i, 0, n) {
		cout << ns[i].second + 1 << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1664
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='?':
        break
    elif op=='+':
        print(a+b)
    elif op=='-':
        print(a-b)
    elif op=='*':
        print(a*b)
    elif op=='/':
        print(int(a/b))


Measured memory_bytes: 5596
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
count = 0
for i in range(n):
  count += b[i]
for j in range(n-1):
  if a[j] + 1 == a[j+1]:
    count += c[a[j]-1]
print(count)

Measured memory_bytes: 3064
W,H,x,y = map(int, raw_input().split())
S = 0.0 + W*H
S = S/2
t = 0
if(W/2 == x and W%2 == 0 and H%2 == 0 and H/2 ==y):
	t = 1
ans = "{0:.2f}".format(S)+" "+str(t)
print(ans)

Measured memory_bytes: 2568
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

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


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100001

int main( ){
  int i,j,n;
  int A[MAX];

  scanf("%d",&n);
  
  for(i = 1; i <= n; i++){
    scanf("%d",&A[i]);
  }
  for(i = 1; i <= n; i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2 >= 1){
      printf("parent key = %d, ",A[i/2]);
    }
    if(i * 2 <= n){
      printf("left key = %d, ",A[i*2]);
    }
    if(i*2+1 <= n){
      printf("right key = %d, ",A[i*2+1]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
typedef long double ld;
using ll=long long;
using namespace std;
const auto mod=1e9+7;

template <typename T>
using GPQ=priority_queue<T,vector<T>,greater<T>>;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int a,b; cin >> a >> b;
  cout << max(a-2*b,0) << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int X, Y, a, b, maxn, maxx, maxy;
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		X = 0; Y = 0; maxn = 0; maxx = 0; maxy = 0;
		while (true) {
			cin >> a >> b;
			if (a == 0 && b == 0) { break; }
			X += a; Y += b;
			if (X*X + Y*Y>maxn) {
				maxn = X*X + Y*Y;
				maxx = X; maxy = Y;
			}
			else if (X*X + Y*Y == maxn && X > maxx) {
				maxx = X; maxy = Y;
			}
		}
		cout << maxx << ' ' << maxy << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from itertools import combinations
N = int(input())
march = ['M','A','R','C','H']
dic = {}
for i in range(N):
	s = input()
	if s[0] in march:
		if s[0] in dic:
			dic[s[0]] += 1
		else:
			dic[s[0]] = 1

ans = 0
if len(dic.keys()) < 3:
	print(0)
else:
	for tup in combinations(dic.values(),3):
		#print(tup)
		ans += (tup[0] * tup[1] * tup[2])

	print(ans)




	

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
	int n, m, ans, amax, bmax;
	unsigned long k;
	int i, j;

	cin >> n >> m >> k;
	unsigned long *a = new unsigned long[n];
	unsigned long *b = new unsigned long[m];

	ans = 0;
	amax = bmax = 0;
	unsigned long tmptime = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (amax==i && tmptime + a[i] <= k) {
			tmptime += a[i];
			ans++;
			amax++;
		}
	}
	for (i = 0; i < m; i++) {
		cin >> b[i];
		if (bmax==i && tmptime + b[i] <= k) {
			tmptime += b[i];
			ans++;
			bmax++;
		}
	}

	int tmpans = ans;
	for (i = amax - 1; i >= 0; i--) {
		tmptime -= a[i];
		tmpans--;
		for (; bmax < m; bmax++) {
			if (tmptime + b[bmax] <= k) {
				tmptime += b[bmax];
				tmpans++;
			}
			else {
				break;
			}
		}
		if (tmpans > ans) {
			ans = tmpans;
		}
	}

	cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;


template <typename T>
void vecprint(vector<T> &vec) {
    cout<<'[';
    for(T x:vec){
        cout<<x<<',';
    }
    cout<<']'<<endl;
    return;
}

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> lb(h);
    rep(i,h) cin>>lb[i];
    vector<vector<int> > dp(h,vector<int> (w,0));
    if(lb[0][0]=='#') dp[0][0]=1;
    rept(i,1,w){
        if(lb[0][i]=='#' && lb[0][i-1]=='.') dp[0][i]=dp[0][i-1]+1;
        else dp[0][i]=dp[0][i-1];
    }
    rept(i,1,h){
        if(lb[i][0]=='#' && lb[i-1][0]=='.') dp[i][0]=dp[i-1][0]+1;
        else dp[i][0]=dp[i-1][0];
    }
    rept(i,1,h){
        rept(j,1,w){
            if(lb[i][j]=='.') dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
            else dp[i][j]=min(dp[i-1][j]+(lb[i-1][j]=='.'),dp[i][j-1]+(lb[i][j-1]=='.'));
        }
    }
    cout<<dp.back().back()<<endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,a,b; cin>>n>>a>>b;
    if(n==1) cout<<(a==b ? 1 : 0)<<endl;
    else if(a>b) cout<<0<<endl;
    else cout<<(n-2)*(b-a)+1<<endl;
}

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

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

    int n1, n0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (i == n - 1) {
            n0 = a;
        } else if (i == n - 2) {
            n1 = a;
        }
    }

    if (n == 1) {
        cout << abs(n0 - w) << endl;
    } else {
        cout << max(abs(n1 - n0), abs(n0 - w)) << endl;
    }
}


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

using namespace std;

int main()
{
	string str;

	while (getline(cin, str))
	{
		if(str == "END OF INPUT")    break;
		
		int cont = 0;
		for (int i=0; str[i] != '\0'; i++)
		{
			if(str[i] == ' ') {
				cout << cont;
				cont = 0;
			} else {
				cont++;
			}
		}

		cout << cont << endl;
	}

	return 0;
}

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

int main()
{
	int n;
	cin>>n;
	set <string> s;
	int i,j,k;
	string str;
	for(i=0;i<n;i++)
	{
		cin>>str;
		s.insert(str);
	}
	cout<<s.size();
}

Measured memory_bytes: 19204
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc() {
//	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
} 
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
const int maxn = 200000 + 5;
const int maxlog = 25;
int n, k;
int p[maxn];
int bit[maxn];
int lg2[maxn];
int sum[maxn];
namespace rmq {
	int mx[maxlog][maxn];
	int mn[maxlog][maxn];
	void init() {
		bit[0] = 1;
		for(int i = 1; i < maxlog; ++i) bit[i] = bit[i - 1] << 1;
		lg2[0] = -1;
		for(int i = 1; i < maxn; ++i) lg2[i] = lg2[i >> 1] + 1;
		for(int i = 1; i <= n; ++i) {
			mx[0][i] = mn[0][i] = p[i];
		}
		for(int k = 1; bit[k] <= n; ++k) {
			for(int i = 1; i + bit[k] - 1 <= n; ++i) {
				mx[k][i] = max(mx[k - 1][i], mx[k - 1][i + bit[k - 1]]);
				mn[k][i] = min(mn[k - 1][i], mn[k - 1][i + bit[k - 1]]);
			}
		}
	}
	int Qmax(int l, int r) {
		int k = lg2[r - l + 1];
		return max(mx[k][l], mx[k][r - bit[k] + 1]);
	}
	int Qmin(int l, int r) {
		int k = lg2[r - l + 1];
		return min(mn[k][l], mn[k][r - bit[k] + 1]);
	}
}
int solve() {
	rmq :: init();
	int an = 0;
	for(int i = 2; i <= n; ++i) {
		sum[i] = p[i - 1] < p[i];
		sum[i] += sum[i - 1];
	}
	for(int i = n; i >= k; --i) {
		sum[i] -= sum[i - k + 1];
		sum[i] = sum[i] == k - 1;
		if(sum[i]) an = 1;
	}
	if(!sum[k]) ++an;
	for(int i = k + 1, j = 1; i <= n; ++i, ++j) {
		if(sum[i]) continue;
		if(p[i] == rmq :: Qmax(j, i) && p[j] == rmq :: Qmin(j, i)) continue;
		++an;
	}
	return an;
} 
int main() {
	read(n), read(k);
	for(int i = 1; i <= n; ++i) {
		read(p[i]);
	}
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 33920
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int? a = null;
            int? b = null;
            string judgement = "Yes";

            var Input = Console.ReadLine().Split(' ');

            foreach(var data in Input)
            {
                if(a == null)
                {
                    a = int.Parse(data);
                    continue;
                }

                b = int.Parse(data);

                if (CheckSize(a, b) == "Yes")
                {
                    judgement = CheckSize(a, b);
                    a = b;
                    continue;
                }
                else judgement = CheckSize(a, b); break;
            }

            Console.WriteLine(judgement);
        }


        private static string CheckSize(int? a, int? b)
        {
            string judge;

            if (a < b)
            {
                judge = "Yes";
                return judge;
            }
            else return judge = "No";
        }
    }
}

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

using namespace std;

vector <long long > v;

int main()
{
    int n = 0;
    while (cin >> n && n) {
        v.clear();
        long long x = 0;
        for (int i = 0; i < n; i++) {
            cin >> x;
            v.push_back(x);
        }
        int cnt = 0;
        bool loop = true;
        while (loop) {
            for (int i = 0; i < n; i++) {
                if (v[i] & 1) {
                    loop = false;
                    break;
                }
                v[i] >>= 1;
            }
            cnt++;
        }

        cout << cnt - 1<< endl;
    }
    return 0;
}

Measured memory_bytes: 256