akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
int max;

Node root,NIL;

/*Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}
*/
Node treeSearch(Node u, int k){
  while( u != NIL && k != u ->key){
    if(k < u->key)u = u->left;
    else u = u->right;
  }
  return u;

}
/*
Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}*/

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  int H;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }

  z->parent = y;

  if( y == NIL){
    root = z;
  }
  else{
    if(z->key < y->key){
      y->left = z;
    }
    else{
      y->right = z;
    }
  }
}





void inorder( Node u){
  if( u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder( Node u){
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
 }


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  max = 0;
  /* for(i = 0; i < n; i++){
    scanf("%s",com);
    if( strcmp(com, "insert") == 0){
      scanf("%d",&x);
      insert(x);
    }
    else if( strcmp(com, "print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    }*/
   for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
   }

  return 0;
}



Measured memory_bytes: 20448
from itertools import combinations

n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0

for i in comb:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
    
print(count)

Measured memory_bytes: 9044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
  public static void main (String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(br.readLine());
    int[] s = new int[n];
    String[] tmpS = br.readLine().split(" ");
    for(int i = 0; i < n; i++) {
      s[i] = Integer.parseInt(tmpS[i]);
    }
    tmpS = null;

    int q = Integer.parseInt(br.readLine());
    int[] t = new int[q];
    String[] tmpT = br.readLine().split(" ");
    for (int i = 0; i < q; i++) {
      t[i] = Integer.parseInt(tmpT[i]);
    }
    tmpT = null;

    int count = 0;
    for(int i : t) {
      if (binarySearch(s, i)) {
        count++;
      }
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] array, int target) {
    int left = 0;
    int right = array.length;
    while (left < right) {
      int mid = (left + right) / 2;
      int temp = array[mid];
      if (target < temp) {
        right = mid;
        continue;
      }
      if (temp < target) {
        left = mid + 1;
        continue;
      }
      return true;
    }
    return false;
  }
}

Measured memory_bytes: 47292
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i=0;i<(n); ++i)
#define log(i,n) log(n)/log(i);
using namespace std;
typedef long long ll;


int main()
{
	ll n, T, sum=0,tmp=0;
	cin >> n >> T;
	vector<ll>t(n);
	rep(i, n)cin >> t[i];
	t.push_back(pow(10, 10));
	tmp = t[0];
	for (ll i = 0; i < n; i++) {
		if (t[i] + T >= t[i + 1])continue;
		sum += t[i] + T - tmp;
		tmp = t[i + 1];
	}
	cout << sum << endl;
}



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

int main () 
{
    int A, B, C;
    std::cin >> A >> B >> C;
    
    int K;
    std::cin >> K;
    
    int S[3] = {A, B, C};
    sort(S, S+3);
    
    int fact = pow(2, K);
    
    std::cout << S[0] + S[1] + S[2]*fact << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 int n,m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n){
	cin >> a.at(i) >> b.at(i);
  }
  vector<pair<ll ,ll>> set(n);
  rep(i,n){
	set.at(i)=make_pair(a.at(i),b.at(i));
  }
  sort(set.begin(),set.end());
  int i=0;
  ll cost=0;
   while(m>0){
     ll x,y;
     tie(x,y)=set.at(i);
     if(y<=m){
	   m-=y;
       cost+=x*y;
     }
     else if(y>m){
       cost+=m*x;
       m=0;
       break;
     }
     i++;
   }
  cout << cost << endl;
}

Measured memory_bytes: 3328
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			
			if(h == 0 && w == 0) {
				break;
			}else {
				for(int i = 0; i < w; i++) {
					System.out.print("#");
				}
				System.out.println();
				
				for(int i1 = 0; i1 < h-2; i1++) {
					System.out.print("#");
					for(int i2 = 0; i2 < w-2; i2++) {
						System.out.print(".");
					}
					System.out.println("#");
				}
				
				for(int i = 0; i < w; i++) {
					System.out.print("#");
				}
				System.out.println("\r\n");
			}
		}
	}
}



Measured memory_bytes: 34216
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#pragma warning(disable:4996)
#define SIZE 101
using namespace std;

int main() {
/*    scanf("%lld", &N);
    for (int i = 1; i <= N; i++) {
        scanf("%lld", &A[i]);
        if (A[i] <= 100) cnt[A[i]]++;
    }

    long long Answer = 0;
    for (int i = 1; i <= 50; i++) Answer += cnt[i] * cnt[101 - i];
    cout << Answer << endl;
*/
    int N, K = 1;
    scanf("%d %d", &N, &K);
    int d[101];
    int A[101];
    int c[101];
    int count = 0;


    for (int i = 0; i < 100; i++) {
        c[i+1] = 0;
        A[i+1] = 0;
     }
    for (int i = 1; i <= K; i++) {
        scanf("%d", &d[i]);
        for (int j = 1; j <= d[i]; j++) {
            scanf("%d", &A[j]);
            c[A[j]] += 1;
        }

    }

    for (int i = 1; i <= N; i++) {
        if (c[i] == 0) count++;
    }
    
    printf("%d\n", count);
//    scanf("%d %d", &A, &B);
   
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N,M; cin>> N >> M;
    bool a[100005] = {0};
    for (int i = 0;i < M;i++){
        int tmp; cin >> tmp;
        a[tmp] = true;
    }

    ll mod = 1e9+7;

    ll dp[100005];
    memset(dp,0,sizeof(dp));

    dp[0] = 1;

    for (int i = 0;i < N;i++){
        if(!a[i+1]){
            dp[i+1] = (dp[i+1]+dp[i])%mod;
        }
        if(!a[i+2]){
            dp[i+2] = (dp[i+2]+dp[i])%mod;
        }
        //cout << 
    }

    cout << dp[N] << endl;

    return 0;

}

Measured memory_bytes: 1152
//#include <tourist>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//g++ yarudake.cpp -std=c++17 -I .
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    cin>>n>>q;
    fenwick_tree<ll> fw(n);
    rep(i,n){
        ll a;
        cin>>a;
        fw.add(i,a);
    }
    rep(i,q){
        int t;
        cin>>t;
        ll a,b;
        cin>>a>>b;
        if(t==0){
            fw.add(a,b);
        }
        else{
            cout<<fw.sum(a,b)<<"\n";
        }
    }
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

ll dp[51][51];
double ave[51][51];
ll times[51][51];

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	ll n, a, b;
	cin >> n >> a >> b;

	vector<ll> v;
	v.pb(0);
	for(int i=0; i<n; i++){
		ll t;
		cin >> t;
		v.pb(t);
	}

	for(int i=0; i<=n; i++){
		for(int j=0; j<=n; j++){
			times[i][j] = 1;
		}
	}

	for(int i=1; i<=n; i++){
		for(int j=1; j<=i; j++){
			dp[i][j] = max(dp[i-1][j], dp[i-1][j-1] + v[i]);
			if(dp[i-1][j] == dp[i-1][j-1] + v[i]){
				times[i][j] = times[i-1][j] + times[i-1][j-1];
			}else if(dp[i-1][j] > dp[i-1][j-1] + v[i]){
				times[i][j] = times[i-1][j];
			}else{
				times[i][j] = times[i-1][j-1];
			}

			//printf("%lld ", dp[i][j]);
		}
		//puts("");
	}

	for(int i=1; i<=n; i++){
		for(int j=1; j<=i; j++){
			ave[i][j] = 1.0 * dp[i][j] / j;
		}
	}

	double ans_ave = 0.0;
	ll ma = 0;
	ll ma_j = 1;
	for(int i=a; i<=b; i++){
		//ans_ave = max(ans_ave, ave[n][i]);
		if(ma*i < dp[n][i] * ma_j){
			ma = dp[n][i];
			ma_j = i;
			ans_ave = 1.0 * ma / ma_j;
		}
	}

	ll ans_cnt = 0;
	for(int i=a; i<=b; i++){
		if(ma*i == dp[n][i] * ma_j){
			ans_cnt += times[n][i];
		}
		/*
		if(fabs(ans_ave - ave[n][i]) < DBL_EPSILON){
			ans_cnt += times[n][i];
		}
		*/
	}

	printf("%.12f\n", ans_ave);
	cout << ans_cnt << endl;
	
	return 0;
}


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

int main(){
    int n, candy = 0, maxim, p1 = 0, p2;
    cin >> n;
    int a[2][n];
    for (int i = 0; i < 2; i++){
        for (int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    for (int i = 1; i < n; i++){
        p1 += a[0][i];
    }
    maxim = p1;
    for (int i = 0; i < n-1; i++){
        p2 = 0;
        for (int j = 1; j <= i; j++){
            p2 += a[0][j];
        }
        for (int j = i; j < n-1; j++){
            p2 += a[1][j];
        }
        maxim = max(maxim, p2);
    }
    cout << maxim + a[0][0] + a[1][n-1] << '\n';
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

signed main(){
	ll a,b;
	cin >> a >> b;
	cout << ceil((double)a/b) << endl;;
    return 0;
}

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

n = int(input())
a = list(map(int, input().split()))
q = int(input())


sum_a = sum(a)
a_dict = {i: 0 for i in set(a)}
for i in a:
    a_dict[i] += 1

for i in range(q):
    b, c = list(map(int, input().split()))
    if not b in a_dict:
        print(sum_a)
        continue
    num = a_dict[b]
    sum_a -= num*b
    sum_a += num*c
    print(sum_a)
    a_dict[b] = 0
    if c in a_dict:
        a_dict[c] += num
    else:
        a_dict[c] = num


Measured memory_bytes: 21372
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

float metric(vector<int>& a, vector<int>& b) {
  float sum = 0;

  rep(i, a.size()) { sum += (a[i] - b[i]) * (a[i] - b[i]); }
  return sqrt(sum);
}

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  rep(i, N) cin >> p[i];
  int count = 0;
  for (int i = 1; i < N - 1; i++) {
    int min_a = min(p[i + 1], min(p[i], p[i - 1]));

    int max_a = max(p[i + 1], max(p[i], p[i - 1]));

    if ((min_a != p[i]) && (max_a != p[i])) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,p;
    cin >> a  >> p;
    p+=a*3;
    cout << p/2 << endl;

    return 0;
}

Measured memory_bytes: 256
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)

#入力
s = input()
#解答
state = 0
if s[2] == s[3]:
    state = 1
else:
    print("No")
    sys.exit()
if s[4] == s[5]:
    state = 1
else:
    state = 0
    print("No")
    sys.exit()
if state == 1:
    print("Yes")
#出力


Measured memory_bytes: 22288
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define vi vector<int>
#define pb push_back
#define p push
#define sll stack<long long>
#define qll queue<long long>
#define vll vector<long long>
#define fori(n) for(int i=0;i<n;i++)
#define forj(n) for(int j=0;j<n;j++)
#define fork(n) for(int k=0;k<n;k++)
#define fori1(n) for(int i=1;i<n;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define pi 3.14159265358979323
#include <math.h>
#define yn(n) if(n)cout<<"yes\n";else cout<<"no\n";
#define Yn(n) if(n)cout<<"Yes\n";else cout<<"No\n";
#define YN(n) if(n)cout<<"YES\n";else cout<<"NO\n";
#define mp   make_pair 
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}

vll r,b,g;ll ans=0;

ll md(ll n){
	if(n>0)return n;
	else return -n;
}



string str,str2;
void solve(){
    ll sum=0;
	fori(5){
	    ll a;cin>>a;
	    sum+=a;
	}
	cout<<15-sum;
}


int main(){

 
    	
	int t;
	t=1;
	//cin >> t;
	while(t--){
		solve();
		
	}
	
	
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

}

Measured memory_bytes: 3620
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265359
using namespace std;



int main()
{
    SYNC
    //clock_t tStart = clock();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,x,t; in(n)>>x>>t;
    ll temp = ceil(n*1.0/x);
    o(temp*t);








    //printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);   
}


Measured memory_bytes: 3580
fn main() {
    let mode = "b";
    if mode == "a" {
        a::solve();
    } else if mode == "b" {
        b::solve();
    }
}

mod b {
    use std;
    use std::io::Read;

    pub fn solve() {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();

        let mut text = buf.split_whitespace();
        text.next();

        let input: Vec<i32> = text.map(|x| x.parse().unwrap()).collect();
        let res = if calc(input) { "YES" } else { "NO" };
        println!("{}", res);
    }
    fn calc(mut p: Vec<i32>) -> bool {
        let ng_point = match search_ng(&p) {
            Some(x) => x,
            None => return true,
        };
        let min_point = match search_min(&p, ng_point + 1) {
            Some(x) => x,
            None => return true,
        };
        p.swap(ng_point, min_point);
        is_sorted(p)
    }
    fn is_sorted(p: Vec<i32>) -> bool {
        for i in 0..(p.len() - 1) {
            if p[i] > p[i + 1] {
                return false;
            }
        }
        true
    }

    fn search_ng(p: &Vec<i32>) -> Option<usize> {
        for i in 0..(p.len() - 1) {
            if p[i] > p[i + 1] {
                return Some(i);
            }
        }
        None
    }

    fn search_min(p: &Vec<i32>, start: usize) -> Option<usize> {
        let mut min = std::i32::MAX;
        let mut point = None;
        for i in start..p.len() {
            if p[i] < min {
                min = p[i];
                point = Some(i);
            }
        }
        point
    }
}

mod a {
    use std;
    use std::io::Read;

    pub fn solve() {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();

        let mut text = buf.split_whitespace();
        let a = text.next().unwrap().parse().unwrap();
        let b = text.next().unwrap().parse().unwrap();
        match calc(a, b) {
            None => println!("IMPOSSIBLE"),
            Some(x) => println!("{}", x),
        }
    }

    fn calc(a: i32, b: i32) -> Option<i32> {
        let total = a + b;
        if total & 0x1 == 0x1 {
            return None;
        }
        Some(total / 2)
    }

    #[cfg(test)]
    mod tests {
        use super::*;

        #[test]
        fn test1() {
            assert_eq!(calc(2, 16), Some(9));
        }
    }
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  ll N;
  cin>>N;
  vector<ll> v(N);
  for(ll i = 0; i < N; i++) cin>>v[i];
  sort(v.begin(),v.end());
  ll ans = 0LL;
  if(N%2==0){
    for(ll i = 0; i < N/2; i++){
      if(i==N/2-1) ans-=v[i];
      else ans-=2LL*v[i];
    }
    for(ll i = N/2; i < N; i++){
      if(i==N/2) ans+=v[i];
      else ans+=2LL*v[i];
    }
  }
  if(N%2==1){
    ll ansa = 0LL, ansb = 0LL;
    for(ll i = 0; i < N;i++){
      if(i<N/2) ansa-=2LL*v[i];
      else if(i==N/2||i==N/2+1) ansa += v[i];
      else ansa+=2LL*v[i];
    }
    for(ll i = 0; i < N; i++){
      if(i==N/2-1||i==N/2) ansb-=v[i];
      else if(i<N/2+1) ansb-=2LL*v[i];
      else ansb+=2LL*v[i];
    }
    ans=max(ansa,ansb);
  }
  cout<<ans<<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n,vector<int>(n-1));

    for(int i=0;i<n;i++){
        for(int j=n-2; j>=0; j--){
            cin >> a[i][j];
        }
    }

    int falnum=0;
    int _out=1;
    //vector<int> ord(n,0);
    vector<bool> check(n,false);
    vector<int> current,next;
    for(int i=0; i<n; i++){
        if(check[i]){
            continue;
        }
        if(a[a[i].back()-1].back()==i+1){
            check[i]=true;
            check[a[i].back()-1]=true;
            next.push_back(i);
            next.push_back(a[i].back()-1);
        }
    }
    for(int i=0; i<next.size(); i++){
        a[next[i]].pop_back();
    }
    while(true){
        _out++;
        bool all=true;
        vector<bool> isgame(n,false);
        current = next;
        next.clear();
        for(int i=0; i<current.size(); i++){
            if(a[current[i]].empty() || isgame[current[i]]){
                continue;
            }
            if(a[a[current[i]].back()-1].back()==current[i]+1){
                next.push_back(current[i]);
                next.push_back(a[current[i]].back()-1);
                isgame[current[i]] = true;
                isgame[a[current[i]].back()-1] = true;
            }
        }
        for(int i=0; i<next.size(); i++){
            a[next[i]].pop_back();
            all = false;
        }
        if(all){
            falnum++;
            if(falnum==2){
                for(int i=0;i<n;i++){
                    if(!a[i].empty()){
                        _out = -1;
                    }
                }
                if(_out>0){
                    _out -= 2;
                }
                break;
            }
        }
    }
    cout << _out << endl;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void solve(){
	ll x, y;
	cin >> x >> y;
	if(x == 1) x = 14;
	if(y == 1) y = 14;
	cout << (x > y ? ("Alice") : (x == y) ? ("Draw") : "Bob");
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 256
//=========================================c++
/* ===========================================
// 20.04.15 AtCoder Beginner Contest 160. E - Red and Green Apples
// https://atcoder.jp/contests/abc160/tasks/abc160_e
// 
=========================================== */
/* ===========================================
問題文
あなたは、X個の赤色のリンゴとY個の緑色のリンゴを食べようとしています。
あなたはA個の赤色のリンゴを持っており、美味しさはそれぞれp1,p2,…,pAです。
あなたはB個の緑色のリンゴを持っており、美味しさはそれぞれq1,q2,…,qBです。
あなたはC個の無色のリンゴを持っており、美味しさはそれぞれr1,r2,…,rCです。
無色のリンゴは食べる前に着色することで、赤色のリンゴもしくは緑色のリンゴと
見なすことができます。
以上のリンゴの中から、できるだけ美味しさの総和が大きくなるように食べるリンゴ
を選びます。0個以上の無色のリンゴに適切に着色したとき、食べるX+Y個のリンゴの
美味しさの総和が最大でいくつになるか求めてください。

::test input::
1 2 2 2 1
2 4
5 1
3

=========================================== */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=1;(i)<=(n);i++)
#define rez(i,n) for(int (i)=0;(i)<(n);i++)
#define ET "\n"

class CRun{
private:
    struct {
        int X = 0;
        int Y = 0;
        int A; vector<int> p;
        int B; vector<int> q;
        int C; vector<int> r;
        
    }gv;
public:
    CRun(){}; ~CRun(){};
    void build(); void solve();
};


void CRun::build(){
    
    cin >> gv.X >> gv.Y >> gv.A >> gv.B >> gv.C;
    rez (i, gv.A) {
        int k; cin >> k;
        gv.p.push_back(k);
    }
    rez (i, gv.B) {
        int k; cin >> k;
        gv.q.push_back(k);
    }
    rez (i, gv.C) {
        int k; cin >> k;
        gv.r.push_back(k);
    }
}

void CRun::solve(){
    
    sort(gv.p.begin(), gv.p.end(), greater<int>());
    sort(gv.q.begin(), gv.q.end(), greater<int>());
    sort(gv.r.begin(), gv.r.end(), greater<int>());
    
    int pCnt = 0, qCnt = 0, rCnt = 0;
    ll ans = 0;
    int cntDown = gv.X + gv.Y;
    
    while (1) {
        
        if (--cntDown < 0) break;
        
        int pNow = (pCnt < gv.X ? gv.p[pCnt] : -1 );
        int qNow = (qCnt < gv.Y ? gv.q[qCnt] : -1 );
        int rNow = (rCnt < gv.r.size() ? gv.r[rCnt] : -1 );
        
        if (rNow >= pNow && rNow >= qNow) {
            ans += rNow;
            rCnt++;
        }
        else if (pNow >= qNow) {
            ans += pNow;
            pCnt++;
        }
        else {
            ans += qNow;
            qCnt++;
        }
    }
    
    cout << ans;
    
}


int main(){
    CRun run;
    run.build();
    run.solve();
}


Measured memory_bytes: 1912
import sys
input=sys.stdin.readline
sys.setrecursionlimit(2*10**5)
n,q=map(int,input().split())
graph=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
counter=[0]*n
for _ in range(q):
  p,x=map(int,input().split())
  counter[p-1]+=x
score=[0]*(n+1)
stack=[(0,-1)]
while stack!=[]:
  node,prev=stack.pop()
  score[node]=score[prev]+counter[node]
  for i in graph[node]:
    if i!=prev:
      stack.append((i,node))
print(*score[:-1])


Measured memory_bytes: 64260
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,sum=0,p=100;
    cin>>n;
    while(1)
    {
        p=p*1.01;
        sum++;
        if(p>=n)
            break;
    }
    cout<<sum;


    return 0;
}


Measured memory_bytes: 3592
import java.util.*;
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: 22868
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

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

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

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

    ll n, s;
    cin >> n >> s;
    vector<ll> a(n);//aは0-origin
    for (ll i=0; i<n; i++) {
        cin >> a[i];
    }
    vector<vector<ll>> dp(n+1, vector<ll>(s+1, 0)); // dp[i][j] : Aiまで考えたときTとUの積集合の要素を添え字としたaの和がjであるような場合の数 dpのiは1-origin
    dp[0][0] = 1;

    for (int i=0; i<n; i++) {
        for (int j=0; j<s+1; j++) {
            dp[i+1][j] += dp[i][j] * 2;
            dp[i+1][j] %= mod;
            if (a[i] + j  <= s) {
                dp[i+1][j+a[i]] += dp[i][j];
                dp[i+1][j+a[i]] %= mod;
            }
        }
    }
    cout << dp[n][s] << endl;


}


Measured memory_bytes: 73592
#include <iostream>

using namespace std;

int main() {
    int a;
    int b;
    cin>>a>>b;
    int max=a+b;
    if((a*b)>max)
    max=a*b;
    if((a-b)>max)
    max=a-b;
    cout<<max;
    return 0;
    
    
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << ": " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<"| ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e5 + 10;
const int mod = 1e9 + 7;

int a , b , c , d;

int div(int l){
	return (b/l - (a-1)/l);
}

int32_t main(){
    boost;
    
    //code
    
    cin >> a >> b >> c >> d;
    
    int g = __gcd(c,d);
    int lcm = (c*d)/g;

    // trace(lcm);
    int ans = b - (a-1);
    // trace(div(lcm));
    // trace(div(c));
    // trace(div(d));
    cout << ans - div(c) - div(d) + div(lcm);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  string S;
  cin >> S;
  const char* s = S.c_str();
  unordered_set<char> M;
  REP(i, 0, S.size()) {
    M.emplace(s[i]);
  }
  if (S.size() == M.size()) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i , n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
ll a , k[100005] , q , r , l;
string n;
int main() {
    cin >> a >> q >> n;
	for(int s = 0; s < a; s++){
		if(n[s] == 'A' && n[s + 1] == 'C'){
		    k[s + 1] = k[s] + 1;
        }
		else{
            k[s + 1] = k[s];
        }
	}
	for(int s = 0; s < q; s++){
		cin >> r >> l;
		cout << k[l - 1] - k[r - 1] << endl;
	}
}

Measured memory_bytes: 4448
/******
	~site:    atcoder.jp
	~user:    Turkhuu
	~problem: AtCoder Beginner Contest 177 - C (abc177_c)
** **/
 
#include<bits/stdc++.h>
 
#define FFOR(i,s,e,k) for(int i=s;(k==1?i<=e:i>=e);i+=k)
#define FOR(i,n) FFOR(i,0,n-1,1)
#define FORR(i,s,e) FFOR(i,s,e,1)
#define ll long long
#define PQ priority_queue
#define pb push_back
#define ppb pop_back()
#define pp push
#define MIN(v) *min_element(v.begin(),v.end())
#define MAX(v) *max_element(v.begin(),v.end())
#define SORT(v) sort(v.begin(),v.end())
#define TROS(v) sort(v.rbegin(),v.rend())
#define CNT(v,x) count(v.begin(),v.end(),x)
#define MOD 1000000007
using namespace std;
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	ll a[200001];
	FOR(i,n){
		cin>>a[i];
		if(i>0) a[i]+=a[i-1];
	}
	ll sum=0;
	FOR(i,n){
		int k=(i==0?a[i]:a[i]-a[i-1]);
		sum+=(k*((a[n-1]-a[i])%MOD))%MOD;
		sum%=MOD;
	}
	cout<<sum;
}

Measured memory_bytes: 5220
N = int(input())
S = []
for i in range(N):
    S.append(input())
vote = {}
for j in S:
    if j not in vote:
        vote[j] = 1
    else:
        vote[j] += 1
most = set()
highNo = 0
for k in vote:
    if vote[k] > highNo:
        most.clear()
        most.add(k)
        highNo = vote[k]
    elif vote[k] == highNo:
        most.add(k)
most = list(most)


def sortLexo(givenList):
    givenList.sort()
    for i in givenList:
        print(i)
sortLexo(most)


Measured memory_bytes: 43920
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
ll inf = 1e9+7;

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  auto f = [](int x){
    ll tmp = 1;
    while(x >= 1){tmp = (tmp * x) % inf; --x;}
    return tmp;
  };
  if(n == m) cout << (f(n) * f(m) * 2) % inf << "\n";
  else if(abs(n-m) == 1) cout << (f(n) * f(m)) % inf << "\n";
  else cout << 0 << "\n";
  return 0;
}   

Measured memory_bytes: 384
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*
import kotlin.math.*

fun main() {
    var fs = Atcoder.FastReader()
    var n = fs.nextInt()
    var a = fs.readIntArray(n)
    var sum:Long = 0
    for (i in 1 until a.size) {
        if(a[i] < a[i-1]){
            sum += a[i-1] - a[i]
            a[i] += a[i-1] -a[i]
        }
    }
    println(sum)
}

class Atcoder {
    internal class FastReader {
        private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))
        private var st: StringTokenizer? = null

        operator fun next(): String {
            while (st == null || !st!!.hasMoreElements()) {
                try {
                    st = StringTokenizer(br.readLine())
                } catch (e: IOException) {
                    e.printStackTrace()
                }

            }
            return st!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }

        fun nextDouble(): Double {
            return java.lang.Double.parseDouble(next())
        }

        fun nextLine(): String {
            var str = ""
            try {
                str = br.readLine()
            } catch (e: IOException) {
                e.printStackTrace()
            }
            return str
        }

        fun readIntArray(n: Int): IntArray {
            val a = IntArray(n)
            for (i in 0 until n) a[i] = nextInt()
            return a
        }

        fun readLongArray(n: Int): LongArray {
            val a = LongArray(n)
            for (i in 0 until n) a[i] = nextLong()
            return a
        }

        fun readDoubleArray(n: Int): DoubleArray {
            val a = DoubleArray(n)
            for (i in 0 until n) a[i] = nextDouble()
            return a
        }
    }
}


Measured memory_bytes: 56884
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint(), M = getint();
	int S[100001];
	S[0] = 0;
	rep(i, N) {
		S[i + 1] = (S[i] + getint()) % M;
	}
	sort(S, S + N + 1);

	int mae = 0;
	ll k = 1;
	ll kotae = 0;
	rep1(i, N) {
		if (mae == S[i]) k++;
		else {
			kotae += k * (k - 1) / 2;
			mae = S[i];
			k = 1;
		}
	}
	kotae += k * (k - 1) / 2;

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 768
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		sc.close();

		HashMap<String, Integer> map = new HashMap<>();
		int cntmax = 0;
		for ( String s : S ) {
			if ( map.containsKey(s) ) {
				int cnt = map.get(s) + 1;
				map.put(s, cnt);
				cntmax = Math.max(cnt, cntmax);
			} else {
				map.put(s, 1);
				cntmax = Math.max(1, cntmax);
			}
		}

		ArrayList<String> list = new ArrayList<>();
		for (String s : map.keySet()) {
			if ( map.get(s) == cntmax ) {
				list.add(s);
			}
		}
		String[] ans = list.toArray(new String[list.size()]);
		Arrays.sort(ans);

		StringBuilder ret = new StringBuilder();
		for ( String s : ans ) {
			ret.append(s);
			ret.append("\n");
		}
		System.out.println(ret.toString());
	}
}


Measured memory_bytes: 78868
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 6 + 3
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    Q = II()
    query = []
    for _ in range(Q):
        query.append(LI())
    fact = [1] * MOD
    for i in range(1, MOD):
        fact[i] = fact[i - 1] * i % MOD
    ifact = [1] * MOD
    ifact[MOD - 1] = pow(fact[MOD - 1], MOD - 2, MOD)
    for i in range(MOD - 1, 0, -1):
        ifact[i - 1] = ifact[i] * i % MOD
    for x, d, n in query:
        if d == 0:
            ans = pow(x, n, MOD)
        else:
            x = x * pow(d, MOD - 2, MOD) % MOD
            if (x + n - 1) // MOD > (x - 1) // MOD:
                ans = 0
            else:
                factor = pow(d, n, MOD)
                start, end = (x - 1) % MOD, (x + n - 1) % MOD
                perm = fact[end] * ifact[start] % MOD
                ans = perm * factor % MOD
        print(ans)
    return

main()

Measured memory_bytes: 105932
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
int h[100000];
int dp[100000];
int main()
{
	memset(dp, 0, sizeof(dp));
	int n,temp,dp1,dp2;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &temp);
		h[i] = temp;
	}
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++)
	{
		dp1 = dp[i - 1] + abs(h[i] - h[i - 1]);
		dp2 = dp[i - 2] + abs(h[i] - h[i - 2]);
		dp[i] = dp1 < dp2 ? dp1 : dp2;
	}
	printf("%d", dp[n - 1]);
}

Measured memory_bytes: 896
#include<iostream>
#include <cstdio>
#include <cmath>
#include <cstring> 
#include <algorithm>
using namespace std;
#include <queue> 
#define ll long long

int main()
{
	int N,a;
	cin>>N;
	a=1000-N%1000;
	if(a==1000)
	{
		printf("0");
	}
	else
	{
		printf("%d",a);
	}
	return 0;
	
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359


ll gcd(ll a, ll b)
{
	ll c;
	while (a != 0) {
		c = a; a = b % a;  b = c;
	}
	return b;
}

int main() {
	string S;
	cin >> S;
	if (S == "abc") {
		cout << "Yes";
	}
	else if (S == "acb") {
		cout << "Yes";
	}
	else if (S == "bac") {
		cout << "Yes";
	}
	else if (S == "bca") {
		cout << "Yes";
	}
	else if (S == "cab") {
		cout << "Yes";
	}
	else if (S == "cba") {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back


///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}
map<ll,ll> mp;
///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
        ++mp[p];
          //cout << p << " ";
}

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

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    for(int i=0;i<n;++i){
        cout<<s[i]<<t[i];
    }
    cout<<'\n';
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

void solve()
{
  string s;
  cin >> s;
  int n = s.length();
  if (n%2!=0)
  {
    cout << "No" << endl;
    re;
  }

  string t = "";
  while (t.length()<n)
  {
    t += "hi";
  }

  if (t==s)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

}

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

  ll t = 1;
  //cin >> t;
  while (t--)
  {
    solve();
  }
}



Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi p(n);
    for(int i=0; i<n; i++){
        cin >> p.at(i);
    }
    int64_t res = 0;
    for(int i=0; i<n-2; i++){
        if(((p.at(i+2) - p.at(i+1) > 0) && (p.at(i+1) - p.at(i) > 0))||
           ((p.at(i+2) - p.at(i+1) < 0) && (p.at(i+1) - p.at(i) < 0))){
            res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b,t;
    cin >> a >> b >> t;
    cout << t/a*b << endl;
    return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    ll n,ans=0;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)    cin>>a[i];
    SORT(a);
    int i=0,counter=0;
    while(i<n){
        if(a[i]==a[i+1]){
            counter++;i++;
        }
        else{
            int num = counter+1;
            if(num>a[i]){
                ans+=num-a[i];
            }
            else if(num<a[i]){
                ans+=num;
            }
            i++;counter=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bits/stdc++.h>
#include <map>
#define lli long long int
#define li long int
#define ld long double
using namespace std;

int main() {
    lli n,p,x,y;
    cin>>n>>p;
    lli cnt=0,sum=0,m;
    while(n--){
        cin>>x>>y;
        if(x*x+y*y<=p*p)
            cnt++;
        
    }
    cout<<cnt<<endl;
}

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

using namespace std;

bool ok(int(&c)[3][3], int a0, int b0)
{
	int a[3], b[3];
	a[0] = a0;
	b[0] = b0;
	a[1] = c[1][0] - b[0];
	b[1] = c[0][1] - a[0];
	a[2] = c[2][0] - b[0];
	b[2] = c[0][2] - a[0];

	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			if (a[i] + b[j] != c[i][j]) {
				return false;
			}
		}
	}

	return true;
}

int main()
{
	int c[3][3];
	for (auto &r : c) {
		for (auto &x : r) {
			cin >> x;
		}
	}

	for (int a0 = -200; a0 <= 200; ++a0) {
		int b0 = c[0][0] - a0;
		if (ok(c, a0, b0)) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;

  double m = 360 / 60 * M;
  double h = 360 / 12 * H + 360 / 12 / 60.0 * M;
  double C;

  double degree = abs(h - m);
  double i = cos(PI * degree / 180);
  C = A * A + B * B - 2 * A * B * cos(PI * abs(h - m) / 180);
  printf("%.10f\n", sqrt(C));
  return 0;
}


Measured memory_bytes: 4160