akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

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

    int A[N + 1], B[N];

    for(int i = 0; i < N + 1; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
    }

    long counter = 0;

    for(int i = 0; i < N + 1; i++) {
        if(A[i] > B[i] && B[i] > 0) {
            counter += B[i];
            A[i] -= B[i];
            B[i] = 0;
        } else if(A[i] <= B[i] && A[i] > 0) {
            counter += A[i];
            B[i] -= A[i];
            A[i] = 0;
        }

        if(A[i + 1] > B[i] && B[i] > 0) {
            counter += B[i];
            A[i + 1] -= B[i];
            B[i] = 0;
        } else if(A[i + 1] <= B[i] && A[i + 1] > 0) {
            counter += A[i + 1];
            B[i] -= A[i + 1];
            A[i + 1] = 0;
        }

    }

    cout << counter << endl;

    return 0;
}

Measured memory_bytes: 1024
n=int(input())
a=list(map(float,input().split()))

dp=[[0 for j in range (n+1)] for i in range (n+1)]

for i in range (n):
    if i>0:
        dp[i][0]=dp[i-1][0]*(1-a[i])
    else:
        dp[i][0]=(1-a[i])
    for j in range (1,i+2):
        if i>0:
            dp[i][j]=dp[i-1][j]*(1-a[i])+dp[i-1][j-1]*a[i]
        else:
            dp[i][j]=a[i]

x=int(n/2)
x=n-x
ans=0

for i in range (x,n+1):
   # print(x)
    ans+=dp[n-1][i]


print(ans)

Measured memory_bytes: 206096
import java.util.*;

class Main{           
    
   public static void main(String[] args){
     
       Scanner sc = new Scanner(System.in);                                                          
       
       int n = sc.nextInt();
       
       List<List<Edge>> edges = new ArrayList<>(n);
       
       for(int i = 0 ;i < n;i++){
           edges.add(new ArrayList<>());
       }
       
       for(int i = 0;i < n-1;i++){
           int a = sc.nextInt()-1;
           int b = sc.nextInt()-1;
           int c = sc.nextInt();
           
           edges.get(a).add(new Edge(a,b,c));
           edges.get(b).add(new Edge(b,a,c));
       }
       
       int q = sc.nextInt();
       int k = sc.nextInt() - 1;

       int x[]=  new int[q];
       int y[] = new int[q];
              
       for(int i = 0;i < q;i++){
          x[i] = sc.nextInt() - 1;
          y[i] = sc.nextInt() - 1;           
       }
       
       
       long d[] = new long[n];
       
       boolean used[] = new boolean[n];
       
       Deque<Integer> st = new ArrayDeque<>();
       
       st.addLast(k);
       
       while(!st.isEmpty()){
           int e = st.pop();
           
           used[e] = true;
           
           for(Edge next:edges.get(e)){
               if(used[next.v]){
                   continue;
               }
               
               d[next.v]= d[e] + next.w;
               
               st.addLast(next.v);
           }
           
       }
       
       
       for(int i = 0;i < q;i++){
           System.out.println(d[x[i]] + d[y[i]]);
       }
       
       
   }
   
   static class Edge{
       int u;
       int v;
       int w;
       
       Edge(int u,int v,int w){
           this.u = u;
           this.v = v;
           this.w = w;
       }       
   }
   
 }

Measured memory_bytes: 179620
n = int(input())
ls = [int(input()) for _ in range(n)]
ls2 = list(filter(lambda x: x % 10 > 0, ls))
s = sum(ls)
if s % 10 > 0:
    print(s)
elif len(ls2) > 0:
    print(s - min(ls2))
else:
    print(0)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  cin >> s;

  ok = true;
  if (s[0] != 'A') ok = false;
  FOR(i, 2, s.length() - 1) {
	if (s[i] == 'C') cnt++;
  }
  if (cnt != 1) ok = false;
  flag = true;
  FOR(i, 1, s.length()) {
	if (s[i] == 'C') continue;
	if (!(s[i] >= 'a' &&s[i] <= 'z')) flag = false;
  }
  if (!flag) ok = false;
  if (ok) cout << "AC" << endl;
  else cout << "WA" << endl;

  return 0;
}

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

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

  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    B[i] = A[i];
  }

  sort(B.rbegin(), B.rend());
  int first = B[0], second = B[1];

  for(int i = 0; i < N; i++) {
    if(A[i] == first) {
      cout << second << endl;
    }
    else {
      cout << first << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 4776
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
 
        if((a+b)==c || (b+c)==a || (a+c)==b){
            // 出力
	        System.out.println("Yes");
        }else{
            // 出力
	        System.out.println("No");
        }
	}
}


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

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(int i = f; i < (int)l; ++i)
#define repit(it, t) for(__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++)
#define endl "\n"
#define pb emplace_back
#define lb lower_bound
#define int long long
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second
#define DBG0(x) { cout << #x << ": " << x << "\t"; }
#define DBG(x) {DBG0(x); cout << endl;}
#define DBG2(x, y) {DBG0(x); DBG(y);}
#define DBG3(x, y, z) {DBG0(x); DBG2(y, z);}
#define DBG4(w, x, y, z) {DBG0(w); DBG3(x, y, z);}

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

signed main(void){

    int x, t;
    cin >> t >> x;
    printf("%.10lf\n", (double) t / x);
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.algorithm, std.array, std.conv, std.range;

class Process {
  static int cpuTime = 0;
  string name;
  int time;

  this(string name, int time) {
    this.name = name;
    this.time = time;
  }
}

void main() {
  int n, q;

  readf("%d %d\n", &n, &q);

  auto process = new Process[n];

  for (int i = 0; i < n; i++) {
    auto input = readln.chomp.split;
    process[i] = new Process(input[0], input[1].to!int);
  }

  while (!process.empty) {
    auto currentP = process.front;
    process.popFront;

    if (currentP.time <= q) {
      Process.cpuTime += currentP.time;
      writefln("%s %d", currentP.name, Process.cpuTime);
    } else {
      currentP.time -= q;
      Process.cpuTime += q;
      process ~= currentP;
    }
  }
}

Measured memory_bytes: 8316
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int N, K;
  int x[100];
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> x[i];

  int result = 0;
  for (int i = 0; i < N; i++) {
    result += min(x[i], abs(x[i] - K)) * 2;
  }
  cout << result << endl;
}


Measured memory_bytes: 256
arr = []

h, w = [int(i) for i in input().split()]
for _ in range(h):
    arr.append(input())

result = []
for ar in arr:
    if not '#' in ar:
        continue
    result.append(ar)

h = len(result)
w = len(result[0])


# print(result)
# print(h, w)

result2 = []
for j in range(w):
    flag = True
    for i in range(h):
        if result[i][j] == '#':
            flag = False
    if flag:
        result2.append(j)

if result2:

    result3 = []
    for s in result:
        line = ''
        for i, c in enumerate(s):
            if i in result2:
                continue
            line += c
        result3.append(line)
else:
    result3 = result


# print()
# print(result)
# print(result2)
for line in result3:
    print(line)

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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



const int MOD = 1E9 + 7;
ll dp[200][2][10009];
ll solve(int sum, bool border, int pos, const string& s, const int& d) {
        auto& DP = dp[sum][border][pos];
        if (DP >= 0) return DP;
        if (pos == s.size()) return !sum;
        ll cnt = 0;
        int lim = 9;
        if (border) lim = s[pos] - '0';
        for (int dig = 0; dig <= lim; dig++) {
                cnt += solve((sum  + dig) % d, border && dig == lim, pos + 1, s, d);
                cnt %= MOD;
        }

        return DP = cnt;
}



void _main() {
        string s; cin >> s;
        int d; cin >> d;
        memset(dp, -1, sizeof dp);
        cout << (solve(0, 1, 0, s, d) - 1 + MOD) % MOD  << '\n';
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 35812
from math import gcd

"""
def gcd(x, y, z):
  while y:
    x, y = y, x % y
  while z:
    x, z = z, x % z
  return x
"""

N = int(input())
wa = 0
for i in range (1,N+1):
  for j in range (1,N+1):
    for h in range (1,N+1):
      wa += gcd(gcd(i,j),h) 
print(wa)

Measured memory_bytes: 9156
#include <iostream>
#include <string>
using namespace std;
int a, b;
string s, t, u;
int main()
{
    cin >> s >> t >> a >> b >> u;
    if (u == s)
    {
        cout << a - 1 << " " << b << endl;
        return 0;
    }
    else
    {
        cout << a << " " << b - 1 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
n = int(input())
lis = []
for i in range(n):
    a = int(input())
    tmp = []
    for j in range(a):
        tmp.append(list(map(int,input().split())))
    lis.append(tmp)

mx = 0

#bit探索
bit = 2**n
for i in range(bit):
    muzyun = 0
    dist = [False for i in range(n)]
    for j in range(n):
        if ((i>>j) & 1):
            dist[j] = True
    for j in range(n):
        if ((i>>j) & 1):
            tnt = lis[j]
            for k in tnt:
                if k[1] ==1 and dist[k[0]-1] == False:
                    muzyun = 1
                if k[1] ==0 and dist[k[0]-1] == True:
                    muzyun = 1
    if muzyun ==0:
        mx = max(dist.count(True),mx)

print(mx)

Measured memory_bytes: 45404
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

vector<vector<ll> > table;
vector<P> roads;
vector<P> qs;

int main() {
  string a, b;
  cin >> a >> b;

  string str = a + b;
  int nn = stoi(str);

  string ans = "No";
  for (int i = 0; i * i <= nn; i++) {
    if (i * i == nn) ans = "Yes";
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N+2];
		int total = 0;
		for(int i = 1; i <= N; i++) {
			a[i] = sc.nextInt();
			total += Math.abs(a[i]-a[i-1]);
		}
		total += Math.abs(a[N]);
		StringBuilder ans = new StringBuilder();
		for(int i = 1; i <= N; i++) {
			int dist = total + Math.abs(a[i+1]-a[i-1]) - Math.abs(a[i]-a[i-1]) - Math.abs(a[i+1]-a[i]);
			ans.append(dist + "\n");
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 63732
fun iskaibun(s:String):Boolean = s == s.reversed()
fun main(args:Array<String>) {
    val s:String = readLine()!!
    val n:Int = s.length
    if (iskaibun(s) && iskaibun(s.substring(0, (n-1)/2)) && iskaibun(s.substring((n+3)/2-1, n))) {
        println("Yes")
        return
    }
    println("No")
}

Measured memory_bytes: 31948
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    
    sort(all(A));
    sort(all(B));
    sort(all(C));

    ll ans = 0;
    rep(i, N) {
        ll top = lower_bound(all(A), B[i]) - A.begin();
        ll bottom = C.end() - upper_bound(all(C), B[i]);
        // cout << top << " " << bottom << endl;
        ans += top * bottom;
    }

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

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n, x;
    cin >> n >> x;
    long long a[n], c = 0;
    for (long long i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] > x)
        {
            c += a[i] - x;
            a[i] = x;
        }
    }
    for (long long i = 1; i < n; i++)
    {
        if (a[i] + a[i - 1] > x)
        {
            c += a[i] + a[i - 1] - x;
            a[i] = x - a[i - 1];
        }
    }
    cout << c;
}

Measured memory_bytes: 4304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
typedef long long ll;

int main(void)
{
    int N;
    cin >> N;
    int v[N][3];
    int count[3][101];
    rep(i, 101) rep(j, 3) count[j][i] = 0;
    rep(i, N)
	{
        rep(j, 3)
	    {
        cin >> v[i][j];
        count[j][v[i][j]]++;
        }
    }
  
    rep(i, N)
	{
        int sum = 0;
        rep(j, 3) if(count[j][v[i][j]]==1) sum += v[i][j];
        cout << sum << endl;
    }
  
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int h, w;
	cin >> h >> w;
    vector<string> s(h+2);
    s[0] = string(w+2, '#');
    s[h+1] = string(w+2, '#');
    rep(i,h) {
        string sin;
        cin >> sin;
        s[i+1] = '#' + sin + '#';
    }
    // rep(i,h+2) cout << s[i] << endl;

    vector<vector<int>> yoko(h+2, vector<int>(w+2)), tate(h+2, vector<int>(w+2));
    rep(i,h+2) {
        int start = 0, end = 0;
        rep(j,w+2) {
            if(s[i][j] == '#') {
                int num = end - start;
                if(num) {
                    for (int k = start; k < end; k++) {
                        yoko[i][k] = num;
                    }
                }
                start = j+1; end = j+1;
            }
            else {
                end++;
            }
        }
    }
    rep(j,w+2) {
        int start = 0, end = 0;
        rep(i,h+2) {
            if(s[i][j] == '#') {
                int num = end - start;
                if(num) {
                    for (int k = start; k < end; k++) {
                        tate[k][j] = num;
                    }
                }
                start = i+1; end = i+1;
            }
            else {
                end++;
            }
        }
    }
    // rep(i,h+2) {
    //     rep(j,w+2) {
    //         cout << tate[i][j];
    //     }
    //     cout << endl;
    // }
    // rep(i,h+2) {
    //     rep(j,w+2) {
    //         cout << yoko[i][j];
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    rep(i,h+2) rep(j,w+1){
        ans = max(ans, tate[i][j] + yoko[i][j] - 1);
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 39680
#include<stdio.h>
int main(void)
{
	int x,y,z,cnt,w;
	scanf("%d %d %d",&x,&y,&z);
	cnt=0;
	w=y+z;
	x-=z;
	while(1){
		if(x>=w){
			cnt++;
			x-=w;
		}
		else	break;
	}
	printf("%d\n",cnt);
	return 0;
}


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

vector<ll> dp((1<<16),-1);
vector<vector<ll>> a(16, vector<ll>(16));

ll dfs(ll S){
if (dp[S]!=-1)return dp[S];
  if (__builtin_popcountll(S)==1){
    dp[S]=0;
    return 0;
  }
  ll now=0;
  rep(i,16)for(int j=i+1;j<16;j++){
    if (((1<<i)&S)and ((1<<j)&S)) {
      now+=a[i][j];
    }
  }
  for(ll T=(S-1)&S;T>0;T=(T-1)&S){
//cout<<"F"<<now<<"T"<<T<<"S"<<S<<endl;
    now=max(now,dfs(T)+dfs(T^S));
//    cout<<now<<"T"<<T<<"S"<<S<<endl;
  }
  dp[S]=now;
  return now;
}

int main() {
  ll n;
  cin>>n;
  rep(i,n)rep(j,n)cin>>a[i][j];
  dfs((1<<n)-1);
  cout<<dp[(1<<n)-1];
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 10005
#define MOD 1000000007
using namespace std;
using LL = long long;
char in[M];
int dp[M][102][2], d, n;
int main()
{
    scanf("%s %d", in+1, &d);
    n = strlen(in+1);

    REP(i,0,in[1]-'0'-1) dp[1][i%d][0] += 1;
    dp[1][(in[1]-'0')%d][1] += 1;

    REP(i,1,n-1) REP(j,0,d-1) REP(k,0,1) if (dp[i][j][k]) {

        int cd = in[i+1] - '0';
        REP(nd,0,9) {
            if (k==1 && nd>cd) continue;

            int i2 = i+1;
            int j2 = (j + nd) % d;
            int k2 = k==1 && nd==cd;
            dp[i2][j2][k2] += dp[i][j][k];
            dp[i2][j2][k2] %= MOD;
        }
    }

    int ans = 0;
    ans = (ans + dp[n][0][0]) % MOD;
    ans = (ans + dp[n][0][1]) % MOD;
    printf("%d\n", (ans+MOD-1)%MOD);
    return 0;
}


Measured memory_bytes: 11700
#include <bits/stdc++.h>
using namespace std;
const int N=105;
int n,now,ans;
int a[N];
int main(){
	scanf("%d",&n);
	for (register int i=1; i<=n; ++i) scanf("%d",&a[i]);
	ans=2e9;
	for (register int pos=1; pos<=100; ++pos)
	{
		now=0;
		for (register int i=1; i<=n; ++i) now+=(a[i]-pos)*(a[i]-pos);
		ans=min(ans,now);	
	}
	printf("%d\n",ans);
return 0;	
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  map<char, string> s = {{'a', a}, {'b', b}, {'c', c}};
  char nex = 'a';
  char cur;
  while (true) {
    if (s[nex].empty()) {
      printf("%c\n", toupper(nex));
      return 0;
    }
    cur = nex;
    nex = s[cur][0];
    s[cur] = s[cur].substr(1);
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        String S = sc.next();
        int max = 0;
        
        for (int i=1;i<N;i++){
            
            String str1 = S.substring(0,i);
            String str2 = S.substring(i);
            
            int count = 0;
            
            boolean[] ar1 = new boolean[26];
            boolean[] ar2 = new boolean[26];
            
            for (int j=0;j<str1.length();j++){
                
                ar1[str1.charAt(j)-'a']=true;
                
            }
          	
            for (int j=0;j<str2.length();j++){
                
                ar2[str2.charAt(j)-'a']=true;
                
            }
          	
            for (int j=0;j<26;j++){
                
                if (ar1[j]&&ar2[j]){
                  count++;
                }
                
            }
            max = Math.max(max,count);
        }
        System.out.println(max);
    }
}


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

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

	int array[n] = {};

	for (int i = 1; i < n; i++) {
		cin >> m;
		array[m-1]++;
	}

	for (x = 0; x < n; x++) {
		cout << array[x] << endl;
	}
		
}

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

int main() {
  int M, D;
  cin >> M >> D;

  int ans = 0;
  for ( int m = 1; m <= M; m++ ) {
    for ( int d = 1; d <= D; d++ ) {
      int d1 = d%10;
      int d10 = d/10;
      if ( d1 >= 2 && d10 >= 2 && m == d1 * d10 ) { ans++; }
    }
  }

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


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s;
    cin >> s;
    int n = sz(s);
    if (s[0] != '1' || s[n - 1] != '0') {
        cout << -1 << EOL;
        return;
    }
    REP(i, n / 2) {
        if (s[i] != s[n - 2 - i] ) {
            cout << -1 << EOL;
            return;
        }
    }

    int p = n;
    REPR(i, n - 1) {
        cout << i + 1 << " " << p << EOL;
        if (s[i] == '1') p = i + 1;
    }
}


Measured memory_bytes: 1616
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 100000;

int tt[N], dd[N], ii[N], jj[N];
long long pp[N + 1], qq[N + 1];

int main() {
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> tt[i] >> dd[i];
		ii[i] = i;
	}
	sort(ii, ii + n, [] (int i, int j) { return tt[i] < tt[j] || tt[i] == tt[j] && dd[i] > dd[j]; });
	int n_ = 0, m = 0;
	for (int i = 0; i < n; i++)
		if (i == 0 || tt[ii[i - 1]] != tt[ii[i]])
			jj[m++] = ii[i];
		else
			ii[n_++] = ii[i];
	n = n_;
	sort(ii, ii + n, [] (int i, int j) { return dd[i] > dd[j]; });
	sort(jj, jj + m, [] (int i, int j) { return dd[i] > dd[j]; });
	for (int i = 0; i < n; i++)
		pp[i + 1] = pp[i] + dd[ii[i]];
	for (int j = 0; j < m; j++)
		qq[j + 1] = qq[j] + dd[jj[j]];
	long long ans = 0;
	for (int x = max(k - n, 1); x <= k && x <= m; x++)
		ans = max(ans, qq[x] + pp[k - x] + (long long) x * x);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 5976
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define __ ios_base::sync_with_stdio(false); cin.tie(NULL);
ll mod = 1000 * 1000 * 1000 + 7 ;
int main() {
 //   __

    ll  n , k ;
    cin >> n >> k ;
    if (n==k) {
        ll x , ans = 1;
        for (ll i = 0; i< n; i++) {
            cin >> x ;
            ans = (ans*x)%mod ;
            ans+= mod ;
            ans%=mod ;
        }
        return cout << ans , 0 ;
    }
    vector<ll> v(n) ;
    ll i ;
    ll pos , neg , zr ;
    pos = 0 , neg = 0 , zr = 0 ;
    for (i = 0 ; i< n; i++) {
        cin >> v[i] ;
        if (v[i]==0) zr++ ;
        else if (v[i]<0) neg++ ;
        else pos++ ;
    }
    ll nneg = min(k,neg) ;
    if ( nneg - nneg%2 + pos>=k ) {
        ll ans = 1 ;
        sort(v.begin(),v.end()) ;
        i = 0 ;
        ll j = n-1 ;
        ll rem = k ;
        vector<ll>tmp ;
        while(rem) {
            if (rem>1) {
                if (v[i]*v[i+1]>=v[j]*v[j-1]  or (v[j-2]<0 and rem!=2)) {
                    tmp.pb(v[i]) , tmp.pb(v[i+1]) ;
                    i+=2 ;
                }
                else {
                    tmp.pb(v[j]) , tmp.pb(v[j-1]) ;
                    j-=2 ;
                }
                rem-=2 ;
            }
            else {
                rem-- ;
                tmp.pb(v[j]) ;
            }

        }
        for (i = 0 ; i< k ; i++) ans = (ans * abs(tmp[i]))%mod ;
        cout << ((ans%mod)+mod)%mod<< endl ;
        return 0 ;
    }
    ll ans = 1;
    for (i = 0 ; i< n ; i++) {
        v[i]= abs(v[i]) ;
    }
    sort(v.begin(),v.end()) ;
    for (i = 0 ; i< k ;i++) ans =( (( ans * (-v[i]) )%mod  ) + mod ) %mod ;
    cout << ((ans%mod)+mod)%mod << endl ;
   // cout << ((-ans%mod) + mod ) %mod << endl ;
    return 0 ;
}


Measured memory_bytes: 6924
#include<bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  vector<int> taxA(0), taxB(0);
  for(int i = 0; i < 1010; i++) {
    if(i * 8 / 100 == A) {
      taxA.push_back(i);
      //cout << i << "pushback A" << endl;
    }
    
    if(i / 10 == B) {
      taxB.push_back(i);
      //cout << i << "pushback B" << endl;
    }
    
  }
  bool judge = true;
  for(int i = 0; i < taxA.size(); i++) {
    for(int j = 0; j < taxB.size(); j++) {
      if(taxA.at(i) == taxB.at(j)) {
        cout << taxA.at(i) << endl;
        judge = false;
        break;
      }
      
    }
    if(judge == false) {
      break;
    }
    
  }
  if(judge) {
    cout << -1 << endl;
  }
  
}

Measured memory_bytes: 256
from heapq import heappush, heappop

X, Y, Z, K = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
C = [int(a) for a in input().split()]

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

def total(x, y, z):
    return A[x] + B[y] + C[z]

def expand(p, q, r):
    result = []
    if p + 1 < X:
        result.append((p+1, q, r))
    if q + 1 < Y:
        result.append((p, q+1, r))
    if r + 1 < Z:
        result.append((p, q, r+1))
    return result

k = 0
h = []
ind = None
heappush(h, (-total(0,0,0), (0,0,0)))

while k < K:
    val, _ind = heappop(h)
    
    if not _ind == ind:
        k += 1
        ind = _ind
        print(-val)
        for new_ind in expand(*ind):
            new_val = total(*new_ind)
            heappush(h, (-new_val, new_ind))

Measured memory_bytes: 4084
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


void solve(){
	int r,c,k;
	cin >> r >> c >> k;
	char grid[r][c];
	for(int i =0;i<r;i++)
		for(int j=0;j<c;j++)
			cin >> grid[i][j];
	int ans = 0;
	int rows  = (1<<r)-1;
	int cols = (1<<c) - 1;
	// cout << rows << " " << cols << endl;	
	char cg[r][c];
	for(int i = 0;i<rows;i++){
		for(int j =0;j<cols;j++){
			memcpy(cg,grid,sizeof(cg));
			int bit =0;
			int ci = i;
			vi to_do;
			while(ci>0){
				if(ci&1){
					to_do.pb(bit);
				}
				ci>>=1;
				bit++;
			}
			for(int y =0;y<(int)to_do.size();y++){
				for(int x=0;x<c;x++)
					cg[to_do[y]][x] = 'r';
			}

			int cj = j;
			bit = 0;
			to_do.clear();
			while(cj>0){
				if(cj&1)
					to_do.pb(bit);
				cj>>=1;
				bit++;
			}

			for(int y = 0;y<(int)to_do.size();y++){
				for(int x=0;x<r;x++)
					cg[x][to_do[y]] = 'r';
			}
			int cur =0;
			for(int x = 0;x<r;x++){
				for(int y = 0;y<c;y++){
					if(cg[x][y]=='#')
						cur++;
				}
			}
			if(cur==k)
				ans++;
		}
	}
	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 3652
import sys
a,v=map(int,input().split())
c,w=map(int,input().split())
d=int(input())
if(w>v):
	print("NO")
else:
    x=0
    y=0
    if(a<=c):
        x=a+d*v
        y=c+d*w
        if(x>=y):
            print("YES")
        else:
            print("NO")
    else:
        x=a-d*v
        y=c-d*w
        if(x<=y):
            print("YES")
        else:
            print("NO")

Measured memory_bytes: 9216
#include "bits/stdc++.h"

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v{a,b,c};

    sort(v.begin(), v.end());

    int max_value = v[2];
    int medium_value = v[1];
    int min_value = v[0]; 
    int num_trials = 0;

    
    int diff_max_and_medium = max_value - medium_value;
    
    num_trials += diff_max_and_medium;
    int current_min = min_value + diff_max_and_medium;
    if((max_value - current_min) % 2) { // 奇数だったら
        num_trials += 1 + (max_value - current_min + 1) / 2;
    } else { // 偶数だったら
        num_trials += (max_value - current_min) / 2;
    }

    cout << num_trials << endl; 

    return 0;
}



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

using namespace std;

int n;
string s;

int main(void)
{
	cin >> n;
	cin >> s;
	
	int r = 0, b = 0;
	for(int i = 0;  i< n; i++){
		if(s[i] == 'R') r++;
		else b++;
	}
	if(r > b) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,k,i,j,ans=hell;
	cin>>n>>k;
	ll a[n+1],idx=-1,mn=hell;
	for(i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>mn){
			mn=a[i];idx=i;
		}
	}
	for(i=1;i<=k;i++){
		ll f=(idx-i)/(k-1);
		if((idx-i)%(k-1))f++;
		ll s=(n-(idx+(k-i)))/(k-1);
		if((n-(idx+(k-i)))%(k-1))s++;
		ans=min(ans,f+s);
	}
	cout<<ans+1;
	return 0;
}

Measured memory_bytes: 1024
palindrome = Array.new
for i in 1..10000 do
  digit = i.to_s.chars.map(&:to_i)
  ok = true
  while(digit.size > 1) do
    ok = false if digit.shift != digit.pop
  end
  palindrome.push(i) if ok
end

n = gets.to_i
min = 10000
answer = 0
palindrome.each do |i|
  dif = (n - i).abs
  break if min <= dif
  min = dif
  answer = i
end

p answer

Measured memory_bytes: 6116
#pragma GCC optimize(2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define pii pair<int,int>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007

#define int long long

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);

inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) out(a / 10);
  putchar(a % 10 + '0');
}

signed main(){
//int main() {
  int n = rd(), x = rd(), t = rd();
  cout << (n/x + (n%x!=0) ) * t << '\n';
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << endl;
  } else if (a < 13 and a >= 6) {
    cout << b / 2 << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, K, T, W, H, M, C;

const int MAX = 5100000;
const ll MOD = 1e9 + 7;

const double PI=3.14159265358979323846;


long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

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

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

  
int main(){
    cin >> N >> M;
    ll tot = 0;
    REP(i, M){int a; cin >> a; tot += a;}
    if(tot <= N) cout << N-tot;
    else cout << -1;
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	string S;
	char first_char = '0';
	char second_char = '0';

	bool is_first_char_twice = false;
	bool is_second_char_twice = false;

	cin >> S;
	for (int i = 0; i < S.length(); i++)
	{
		if (first_char == '0') {
			first_char = S[i];
		}
		else if (first_char == S[i]) {
			is_first_char_twice = true;
		}
		else if (second_char == '0') {
			second_char = S[i];
		}
		else if (second_char == S[i]) {
			is_second_char_twice = true;
		}


	}

	if (is_first_char_twice && is_second_char_twice) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

using ll = long long;
using namespace std;


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

    ll divider = pow(10.0,9.0)+7;

    ll power = 1;
    for(ll j = 0; j < n;++j) {
        power = (power*(j+1))%divider;
    }

    cout << power << endl;

    return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())

S = list(input())

A = [0]

for i in range(1, n+1):
    # if S[i-1:i]:
    if S[i-2:i] == ['A', 'C']:
        A.append(A[-1] + 1)
    else: 
        A.append(A[-1])
# print(A[1:])
A = A[1:]
for i in range(q):
    a, b = map(int, input().split())
    print(A[b-1] - A[a-1])

Measured memory_bytes: 56568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int amida[31];
  for ( int i = 0; i < 31; i++ ) amida[i] = i;
  int w,n; cin >> w >> n;
  for ( int i = 0; i < n; i++ ) {
    int a,b; char ch;
    cin >> a >> ch >> b;
    swap(amida[a],amida[b]);
  }
  for ( int i = 1; i <= w; i++ ) cout << amida[i] << endl;;
  return 0;
}

Measured memory_bytes: 1160
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
  if ans > 10**18:
        print(-1)
  else:
    print(ans)

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int main() {
	llong N, M;
	vector<llong> money;
	vector<llong> key;
	vector<llong> dp;

	cin >> N >> M;
	money.resize(M);
	key.resize(M);
	for (int i = 0; i < M; ++i) {
		llong b, in, k = 0;

		cin >> money[i] >> b;

		for (int j = 0; j < b; ++j) {
			cin >> in;
			k += 1<<(in-1);
		}
		key[i] = k;
	}

	dp.resize(1<<N, inf);
	for (int &&i = 0; i < M; ++i) {
		dp[key[i]] = min(dp[key[i]], money[i]);
		for (int &&j = 0; j < (1<<N); ++j) {
			dp[j|key[i]] = min(dp[j|key[i]], dp[j] + money[i]);
		}
	}

	cout << (dp[(1<<N)-1] == inf ? -1 : dp[(1<<N)-1]) << endl;

	return 0;
}

Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//223
	int n;
	cin>>n;
	unordered_set<int> s;
	while(n--) {
		int val;
		cin>>val;
		if(s.count(val)==1){
			s.erase(val);
		} else {
			s.insert(val);
		}
	}
	cout<<s.size();
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 7200
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int main()
{
    int n;
    cin >> n;
    n%=10;
    if (n == 3)
        cout << "bon" << endl;
    if (n == 0)
        cout << "pon" << endl;
    if (n == 1)
        cout << "pon" << endl;
    if (n == 6)
        cout << "pon" << endl;
    if (n == 8)
        cout << "pon" << endl;

    if (n == 2)
        cout << "hon" << endl;
    if (n == 4)
        cout << "hon" << endl;
    if (n == 5)
        cout << "hon" << endl;
    if (n == 7)
        cout << "hon" << endl;
    if (n == 9)
        cout << "hon" << endl;
    return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  cout << (a+b+1) /2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll P = 1000000007;
struct mint
  {ll v;
  mint() : v(0) {}
  mint(ll a) : v(a) {}
  mint operator*(mint b) {return this->v * b.v % P;}
  mint operator+(mint b) {return (this->v + b.v) % P;}
  mint operator-(mint b) {return *this + (P - b.v);}};
mint f(ll b, ll n) {if (n <= 0) return 1; auto p = f(b, n / 2); return p * p * (n % 2 ? b : 1);}
int main()
  {int N; cin >> N;
  map<pair<ll, ll>, pair<int, int>> m;
  int z = 0;
  for (int i = 0; i < N; ++i)
    {ll A, B; cin >> A >> B;
    if (A == 0 && B == 0) {++z; continue;}
    if (A == 0) {m[{0, 1}].first++; continue;}
    else if (B == 0) {m[{0, 1}].second++; continue;}
    ll a = abs(A), b = abs(B);
    ll g = gcd(a, b); a = a / g; b = b / g;
    if ((A > 0 && B > 0) || (A < 0 && B < 0)) m[{a, b}].first++;
    else m[{b, a}].second++;}
  mint ans = 1;
  for (auto p : m) ans = ans * (f(2, p.second.first) + f(2, p.second.second) - 1);
  ans = ans - 1 + z;
  cout << ans.v << endl;}

Measured memory_bytes: 16016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int n;
    cin >> n;
    pii range[n];
    for (int i = 0; i < n; i++) {
        int x, l;
        cin >> x >> l;
        range[i] = make_pair(x + l, x - l);
    }

    sort(range, range + n);

    int ans = 0;
    
    int end = -2000000000;
    for (int i = 0; i < n; i++) {
        pii p = range[i];
        int s = p.second;
        int e = p.first;
        if (s < end) continue;
        ans++;
        end = e;
    }

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

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

int main(){
	int  N,n,i;
	string S;

	cin>>N;
	cin>>S;

	if(N%2==1){
		cout<<"No"<<endl;
		return 0;
	}

	n=N/2;

	for(i=0;i<n;i++){
		if(S[i]!=S[i+n]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int N,M;
int monster[100000];

int calc(int X){

	int left = 0,right = 0,ret = 0,pre_diff;
	int calc_left = 0,calc_right = N-1,m = (calc_left+calc_right)/2;
	int LEVEL = 1;
	int minimum,min_index;

	while(right < N-1){
		ret++;

		while(calc_left <= calc_right){

			if(monster[m] < LEVEL+X){
				right = m;
				calc_left = m+1;
			}else{
				calc_right = m-1;
			}
			m = (calc_left+calc_right)/2;
		}

		pre_diff = abs(LEVEL-monster[left]);

		minimum = BIG_NUM;
		for(int i = left; i <= right; i++){
			if(minimum > abs(LEVEL-monster[i])){
				minimum = abs(LEVEL-monster[i]);
				min_index = i;
			}
		}
		LEVEL += max(1,X-minimum);
		left = min_index;

		calc_left = right;
		calc_right = N-1;
		m = (calc_left+calc_right)/2;
	}
	return ret;
}

void func(){

	for(int i = 0; i < N; i++)scanf("%d",&monster[i]);

	int ans = -1;

	int left,right,m;

	left = monster[0],right = monster[N-1],m = (left+right)/2;

	while(left <= right){

		if(calc(m) >= M){
			ans = m;
			left = m+1;
		}else{
			right = m-1;
		}
		m = (left+right)/2;
	}

	printf("%d\n",ans);
}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3544
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
vx = [0] * (n-1)
for i in range(n-1):
    vx[i] = x[i+1] - x[i] 

vx.sort()
ans = 0

for i in range(n-1):
    wf = vx[i] * a
    if wf > b:
        ans += b * (n - i - 1)
        break
    ans += wf

print(ans)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, k;
	string s;
	cin>>n>>k>>s;
	int r=0;
	while(r<n && s[r]=='1'){
		++r;
	}
	REP(i, k){
		while(r<n && s[r]=='0'){
			++r;
		}
		while(r<n && s[r]=='1'){
			++r;
		}
	}
	if(r==n){
		cout<<n<<'\n';
		return 0;
	}
	int ans=r, l=0;
	while(l<n){
		while(l<n && s[l]=='1'){
			++l;
		}
		while(l<n && s[l]=='0'){
			++l;
		}
		while(r<n && s[r]=='0'){
			++r;
		}
		while(r<n && s[r]=='1'){
			++r;
		}
		CHMAX(ans, r-l);
		while(l<n && s[l]=='1'){
			++l;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

#define N_MAX 200
#define M_MAX 20000

using namespace std;

void find_shortest_pair(long dist[N_MAX][N_MAX], long edge[N_MAX][N_MAX], long n);

int main(){
    int N, M, R;
    int r[8];
    long A[M_MAX], B[M_MAX], C[M_MAX];
    long edge[N_MAX][N_MAX];
    long dist[N_MAX][N_MAX];
    long ans = __LONG_MAX__;
    long tmp = 0;
    cin >> N >> M >> R;
    vector<int> v(R);
    iota(v.begin(), v.end(), 1); 
    for(int i = 0; i < R; i++){
        cin >> r[i];
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            edge[i][j] = (long)INT32_MAX*1000;
        }
    }

    
    for(int i = 0; i < M; i++){
        cin >> A[i] >> B[i] >> C[i];
        edge[A[i]-1][B[i]-1] = C[i];
        edge[B[i]-1][A[i]-1] = C[i];
    }
    
    find_shortest_pair(dist, edge, N);

    do {
        for(int i = 1; i < R; i++){
            tmp += dist[r[v[i-1]-1]-1][r[v[i]-1]-1];
        }
        ans = min(tmp, ans);
        tmp = 0;
    } while( next_permutation(v.begin(), v.end()) );
    cout << ans << endl;
}

void find_shortest_pair(long dist[N_MAX][N_MAX], long edge[N_MAX][N_MAX], long n){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            dist[i][j] = edge[i][j];
        }
        dist[i][i] = 0;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                long new_len = dist[j][i] + dist[i][k];
                dist[j][k] = min(new_len, dist[j][k]);
            }
        }
    }
}

Measured memory_bytes: 1408