akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll n, a;
  cin >> n;
  map<ll, ll> mp;
  for(int i = 0; i < n; ++i)
  {
    cin >> a;
    mp[a]++;
  }
  ll ans = 0;
  for(const auto& m : mp)
  {
    ans += (m.first > m.second ? m.second : m.second - m.first);
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
const int M=10100;
int h[M],n,ans=0;
int main(){
	cin >> n ;
	for ( int i = 0 ; i < n ; i ++ ){
		cin >> h [ i ] ;
	}
	while (1) {
        int tmp = 0;
        for ( int i = 0 ; i < n ; i ++ ) {
            if (h[i] > 0) {
                tmp++;
                while (i < n && h[i] > 0) {
                    h[ i ] --;
                    i ++;
                }
            }
        }
        if (tmp == 0) break;
        ans += tmp;
    }
    
    cout << ans;
    return 0;
}

Measured memory_bytes: 3512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>
#include <typeinfo>
#include <memory>

using namespace std;

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

#define fs first
#define sc second


int main(){
    int N, M, k[12], p[10];
    vector<int> s[12];

    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++) {
            int x;
            cin >> x;
            x--;
            s[i].push_back(x);
        }
    }
    for(int i = 0; i < M; i++){
        cin >> p[i];
    }

    ll res = 0;
    for(int i = 0; i < (1 << N); i++){
        bool check = true;
        for(int j = 0; j < M; j++){
            int tmp = 0;
            for(auto s2: s[j]){
                if((i >> s2) % 2 == 1){
                    tmp++;
                }
            }
            if(tmp % 2 != p[j]){
                check = false;
            }
        }
        if(check){
            res++;
        }
    }

    cout << res << endl;


    return 0;
}


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

int main(){
  int hm[26] = {0};
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
    hm[s[i]-'a']++;
  for(int i=0;i<26;i++){
    if(hm[i]%2 != 0){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		var I = G();
		WriteLine(I[0] + I[2] == 2 * I[1] ? "YES" : "NO");
		Out.Flush();
	}
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

int main() {
  int n, r;
  cin >> n >> r;
  int res;
  if (n >= 10) res = r;
  else res = r + 100*(10-n);
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			int[] ls = new int[N];
			
			for(int i = 0; i < N; i++) {
				ls[i] = sc.nextInt();
			}
			Arrays.sort(ls);
			
			final int MAX = Arrays.stream(ls).max().getAsInt();
			final int SIZE = MAX * 2;
			int[] counts = new int[SIZE + 1];
			for(int i = 0; i < N; i++) {
				counts[ls[i]]++;
			}
			
			for(int i = 1; i <= SIZE; i++) {
				counts[i] += counts[i - 1];
			}
			
			long answer = 0;
			for(int i = 0; i < N; i++) {
				final int fst = ls[i];
				
				for(int j = i + 1; j < N; j++) {
					final int snd = ls[j];
					
					final int count = Math.max(0, counts[fst + snd - 1] - (j + 1));
					//System.out.println(fst + " " + snd + " : " + count);
					
					answer += count;
				}
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 26708
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if(A==B) cout<<C<<endl;
    else if(A==C) cout<<B<<endl;
    else cout<<A<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            vector<string> s(n);
            vector<int> A(n);
            REP(i, n) cin >> s[i];
            REP(i, n) A[i] = s[i].size();
            int ans;
            bool ok = false;
            REP(i, n + 1){
                int a = 0;
                bool tanka =  false;
                int now = 0; 
                FOR(j, i, A.size()){
                    a += A[j];
                    if(a > 7) break;
                    if((now == 0 or now == 2) and a == 5){
                        now++;
                        a = 0;
                    }
                    if((now == 1 or now == 3) and a == 7){
                        now++;
                        a = 0;
                    }
                    if(now == 4 and a == 7){
                        ok = true;
                        ans = i + 1;
                        break;
                    }
                }
                if(ok) break;
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 3140
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


char s[N];
int n;

int main() {
	scanf("%s",s+1);
	n = strlen(s+1);
	REP(i,1,n) {
		if (s[i]=='?') s[i]='D';
	}
	puts(s+1);
}









Measured memory_bytes: 3904
#include <bits/stdc++.h>
    using namespace std;
     
    void swap(int *x,int *y)
    {
      int t;
     
      t=*x;
      *x=*y;
      *y=t;
      
    }
     
    int main()
    {
      int A,B,C;
      cin>>A>>B>>C;
      swap(&A,&B);
      swap(&A,&C);
      cout<<A<<" "<<B<<" "<<C<<endl;
      
      
      
      return 0;
    }

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s, t string
	fmt.Scan(&s)
	fmt.Scan(&t)
	if len(t) > len(s){
		return
	}

	ans := 1001
	for i:=0; i<=len(s)-len(t); i++{
		diff := 0
		for j:=0; j<len(t); j++{
			if t[j] != s[i+j]{
				diff++
			}
		}
		ans = min(ans, diff)
	}
	fmt.Println(ans)
}

func min(a int, b int)int{
	if a > b{
		return b
	}else{
		return a
	}
}

Measured memory_bytes: 1784
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <memory.h>

using namespace std;

const int maxn = 100000 + 10;

int par[maxn];
int find_par(int k) {
	if (-1 == par[k]) {
		return k;
	}
	else {
		return par[k] = find_par(par[k]);
	}
}

void join(int p, int q) {
	int x = find_par(p);
	int y = find_par(q);
	if(x != y)
		par[x] = y;
}

int N, M;
int nums[maxn], a, b;
vector<set<int> > vse;
vector<int> idx[maxn];
vector<int> nu[maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> N >> M;

	memset(par, -1, sizeof(par));
	for (int i = 1; i <= N; i++) {
		cin >> nums[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		join(a, b);
	}

	for (int i = 1; i <= N; i++) {
		idx[find_par(i)].push_back(i);
		nu[find_par(i)].push_back(nums[i]);
	}

	int res = 0;
	for (int i = 1; i <= N; i++) {
		if (idx[i].size() != 0) {
			sort(idx[i].begin(), idx[i].end());
			sort(nu[i].begin(), nu[i].end());
			int x = 0, y = 0;
			while (x < idx[i].size() && y < nu[i].size()) {
				if (idx[i][x] == nu[i][y]) {
					x++;
					y++;
					res++;
				}
				else if (idx[i][x] > nu[i][y]) {
					y++;
				}
				else {
					x++;
				}
			}//while
		}
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 12032
N = int(input())
R = [int(input()) for _ in range(N)]

min_r = 10**10
max_d = -10**10
for i in range(N):
    if i != 0:
        d = R[i] - min_r
        if d > max_d:
            max_d = d
    if R[i] < min_r:
        min_r = R[i]
print(max_d)



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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> ans;
    int N, M, Q; cin >> N >> M >> Q;
    vector<int> train[N+1];
    rep(i, M){
        int l, r; cin >> l >> r;
        train[l].push_back(r);
    }
    rep(i, N+1) sort(train[i].begin(), train[i].end());
    rep(i, Q){
        int p, q; cin >> p >> q;
        int res = 0;
        for(int city = p; city <= q; city++){
            int ok = -1, ng = train[city].size();
            int m = (ok+ng)/2;
            while(abs(ok-ng) > 1){
                if(train[city][m] <= q) ok = m;
                else ng = m;
                m = (ok+ng)/2;
            }
            res += ok+1;
        }
        ans.push_back(res);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 5260
function main(lines) {
  const [sx, sy, tx, ty] = splitN(lines[0]);

  let s = '', cx = sx, cy = sy;
  const passed = [];
  moveTo(tx, ty);
  moveTo(sx, sy);
  moveTo(tx, ty);
  moveTo(sx, sy);

  function moveTo(x, y) {
    // console.log(cx, cy);
    while (cx != x || cy != y) {
      while (cy != y) {
        if (cy < y) {
          if (!isPassed(cx, cy+1)) {
            cy++;
            s += 'U';
          } else {
            cx--;
            s += 'L';
          }
        } else {
          if (!isPassed(cx, cy-1)) {
            cy--;
            s += 'D';
          } else {
            cx++;
            s += 'R';
          }
        }
        passed.push(cx+'_'+cy);
        // console.log(cx, cy);
      }
      while (cx != x) {
        if (cx < x) {
          if (!isPassed(cx+1, cy)) {
            cx++;
            s += 'R';
          } else {
            cy++;
            s += 'U';
          }
        } else {
          if (!isPassed(cx-1, cy)) {
            cx--;
            s += 'L';
          } else {
            cy--;
            s += 'D';
          }
        }
        passed.push(cx+'_'+cy);
        // console.log(cx, cy);
      }
    }
  }

  function isPassed(x, y) {
    if ((x === sx && y === sy) || (x === tx && y === ty)) return false;
    return passed.includes(x+'_'+y);
  }

  return s;
}


const ans = main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
console.log( ans );

function splitN(s) {
  return s.split(' ').map(Number);
}

Measured memory_bytes: 34372
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int maxi = 0;
  cin >> n >> m;
maxi = max(maxi, n+m);
maxi = max(maxi, 2*m -1);
maxi = max(maxi, 2*n -1);
cout << maxi;
return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    string t[4];
    t[0] = "dream", t[1] = "dreamer";
    t[2] = "erase", t[3] = "eraser";
    rep (i, 4) {
      reverse(t[i].begin(), t[i].end());
    }
    int len = s.size();
    bool isIn = true;
    rep (i, s.size()) {
      bool isOk = false;
      rep (j, 4) {
        string op = t[j];
        string tmp = s.substr(i, op.size());
        if (tmp == op) {
          i += op.size() - 1;
          isOk = true;
        }
      }
      if (!isOk) {
        isIn = false;
        break;
      }
    }
    if (isIn) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

    return 0;
}


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

using namespace std;

//const int INF = 1e9 + 5;

int main()
{
    int n;
    scanf("%d\n", &n);
	vector<int> dp(3, 0);
    for (int d = 1; d <= n; d++)
    {
        vector <int> c(3);
		vector <int> new_dp(3, 0);
        for (int i = 0; i < 3; i++)
            scanf("%d", &c[i]);
    	for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (i != j)
					new_dp[i] = max(dp[j] + c[j], new_dp[i]);
			}
		}
		dp = new_dp;
    }
	printf("%d\n", max({dp[0], dp[1], dp[2]}));
}


Measured memory_bytes: 3260
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        l: u16,
        r: u16,
        d: u16,
    }

    let mut ans = 0;
    for i in l..r + 1 {
        if i % d == 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = (to) - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

struct UnionFind {
  V<int> p;

  // make set
  UnionFind(int n) {
    p.resize(n);
    rep(i, n) p[i] = i;
  }

  // union
  void unite(int a, int b) {
    int root_a = root(a);
    int root_b = root(b);

    p[root_a] = root_b;
  }

  // find
  int root(int i) {
    if(p[i] == i) {
      return i;
    }
    return p[i] = root(p[i]);
  }

  bool same(int a, int b) {
    return root(a) == root(b);
  }
};

struct Edge {
  int from, to;
  int cost;

  bool operator <(const Edge &other) const {
    return cost < other.cost;
  }
};

int main() {
  int v, e;

  cin >> v >> e;

  V<Edge> edges(e);
  rep(i, e) {
    int s, t, w;
    cin >> s >> t >> w;
    edges[i] = {s, t, w};
  }

  UnionFind uf(v);

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

  int sum = 0;
  rep(i, e) {
    Edge edge = edges[i];

    if(uf.same(edge.from, edge.to)) {
      continue;
    }
    sum += edge.cost;
    uf.unite(edge.from, edge.to);
  }

  cout << sum << endl;
}



Measured memory_bytes: 4148
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P; /* ツ点 */

#define PI (3.1415926535)
#define EPS (1e-10)

int main(){
  stack<int> s;
  int n;
  while(cin>>n){
    if(n==0){
      cout << s.top() << endl;
      s.pop();
    }else
      s.push(n);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back



ll gcd(ll a , ll b){
    ll bigger=max(a,b);
    ll smaller=min(a,b);
    if (bigger%smaller==0){
        return smaller;
    }
    else {
        return gcd(smaller, bigger%smaller);
    }

}



ll mypower(ll x, ll n){
    ll answer=1;
    rep(i,n){
        answer*=x;
    }
    return answer;
}

    






int main(){

    long long n;
    cin>>n;

    vector<ll> data(n);
    rep(i,n){
        ll tmp;
        cin>>tmp;
        data.at(i)=tmp;
    }

    vector<ll> sumdata(30,0);

    rep(i,n){
        bitset<30> tmp(data.at(i));

        rep(j,30){
            sumdata.at(29-j)+=(tmp.test(j)%2);
        }

    }

    rep(i,n){
        bitset<30> answer;
        bitset<30> mya(data.at(i));

        rep(j,30){
            answer.set(j,(sumdata.at(29-j)-mya.test(j))%2);
        }
      
      cout<<answer.to_ullong()<<" ";

    }
  	cout<<endl;
  
  




}

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

int main(){
	int N;
	cin >> N;
	vector<int> Mt(N);
	for(int i = 0; i < N; i++)	cin >> Mt[i];
	int NowHighest = 0;
	int count = 0;
	
	for(int i = 0; i < N; i++){
		if(NowHighest <= Mt[i]){
			count++;
			NowHighest = Mt[i];
		}
	}
	
	cout << count << endl;
}

Measured memory_bytes: 256
import math

N, Y = map(int, input().split())

max_x = 2001
max_y = 2001

k = 0
flag = 0
ans = []
for i in range(max_x):
    if flag == 1:
        break
    for j in range(max_y):
        rest = Y - (i * 10000 + j * 5000)
        if rest < 0:
            break
        else:
            k = N - i - j
            if rest//1000 == k and k + i + j <= 2000:
                flag = 1
                ans = [i,j,k]
                break
        

if flag == 1:
    print(" ".join(map(str, ans)))
else:
    print("-1 -1 -1")

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

using namespace std;

string s;

int main()
{
    cin >> s;
    for(int i = 0 ; i < s.size() - 1 ; i++)
        for(int j = i + 1 ; j < s.size() ; j++)
            if(s[i] == 'C' && s[j] == 'F')
    {
        cout << "Yes\n";
        return 0;
    }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
def n_numbers(n: int) -> int:
    ret = 0
    while True:
        n = n // 10
        ret += 1
        if n <= 0:
            break
    return ret

def gen_numbers(n: int) -> int:
    if n <= 1:
        yield 3
        yield 5
        yield 7
    else:
        for g in gen_numbers(n-1):
            for m in ["3","5","7"]:
                yield int(m + str(g))

def validate(n: int) -> bool:
    three = False
    five = False
    seven = False
    while True:
        k = n % 10
        if k == 3:
            three = True
        elif k == 5:
            five = True
        elif k == 7:
            seven = True
        n = n // 10
        if three and five and seven:
            return True
        if n <= 1:
            break
    return False


n = int(input())

k = n_numbers(n)

if k < 3:
    print(0)
else:
    ret = 0
    for i in range(3, k+1):
        for target in gen_numbers(i):
            if target <= n and validate(target):
                ret += 1
    print(ret)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,d,x;
	cin >> n >> d >> x;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		x += (d + a - 1) / a;
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

using pll = pair<ll,ll>;
vector<pll> p;


int main() {
  ll N,M;
  cin >> N >> M;
  p.resize(N);
  rep(i,N){
    cin>>p[i].first>>p[i].second;
  }
  sort(all(p));
  ll res = 0;
  for(int i=0; i < N && M > 0; i++) {
    res += p[i].first * min(M,p[i].second);
    M -= min(M,p[i].second);
  }
  cout << res << endl;
  return 0;
}










Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>
#include <deque>
#include <bitset>
using namespace std;
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i)
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();)
#define LL long long
#define int LL
#define inf  (LL)(1 << 30)
#define mod 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
#define lowb lower_bound
#define upb upper_bound
#define ZERO(c,n) memset(&c[0],0,sizeof(int)*n)
#define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n
#define pl(a) cout << ""#a": " << a << endl;
#ifdef _DEBUG
#define debug_io fstream cin("input.txt");ofstream cout("output.txt");
#else
#define debug_io ;
#endif
#define debug_input debug_io
#define pb(a) push_back(a)
template<class T>void scan(vector<T>& a, int n, istream& cin) { T c; REP(i, n) { cin >> c; a.push_back(c); } }
using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>; using psi = pair<string, int>; using vvi = vector<vi>;
template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; }
int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 };
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------

int cou[55][26];
int mins[26];

signed main()
{
	QUICK_CIN;
	debug_input;

	string uni = "";

	vs ss;
	int n;
	cin >> n;

	REP(i, n) {
		string s;
		cin >> s;
		ss.push_back(s);
	}

	REP(i, ss.size()) {
		REP(j, ss[i].size()) {
			cou[i][(int)ss[i][j] - (int)'a']++;
		}
	}
	REP(i, 26) {
		mins[i] = inf;
	}

	REP(i, ss.size()) {
		REP(j, 26) {
			mins[j] = min(mins[j], cou[i][j]);
		}
	}
	string ans = "";
	REP(i, 26) {
		REP(j, mins[i]) {
			ans += char(i + (int)'a');
		}
	}
	cout << ans << endl;
}




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

using namespace std;
int main(void) {
    int n;
    cin >> n;
    
    vector<long> a(n);
    for(auto &x: a) cin >> x;

    std::sort(a.begin(), a.end());

    int k = 0, t = a[0];
    vector<int> b(3), c(3);
    for(auto &x: a) {
        if(t != x) k++, t = x;
        if(k>=3) {
            cout << "No" << endl;
            return 0;
        }
        c[k] = x;
        b[k]++;
    }

    if(k==0) {
        if(c[0] == 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
        return 0;
    }

    if(k==1) {
        if(c[0]==0 && 2*b[0]==b[1])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
        return 0;
    }

    // k==2

    if((c[0]^c[1])!=c[2]) {
        cout << "No" << endl;
        return 0;
    }

    if(b[0]==b[1] && b[1]==b[2]) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 1024
from bisect import *
from collections import defaultdict
def solve():
  T = int(input())
  ans = [0]*T
  for t in range(T):
    N = int(input())
    left = defaultdict(lambda: [])
    right = defaultdict(lambda: [])
    for i in range(N):
      k,l,r = map(int, input().split())
      if k==N:
        ans[t] += l
      else:
        if l>r:
          insort_right(left[k],l-r)
        elif l<r:
          insort_right(right[k+1],r-l)
        ans[t] += min(l,r)
    lis = []
    for i in range(N,0,-1):
      for l in left[i]:
        insort_right(lis,l)
      if len(lis):
        ans[t] += lis.pop(-1)
    lis = []
    for i in range(2,N+1):
      for r in right[i]:
        insort_right(lis,r)
      if len(lis):
        ans[t] += lis.pop(-1)
  return ans
print(*solve(),sep='\n')


Measured memory_bytes: 148028
A, B, K = map(int, input().split())
#A, B, K = 12, 8, 2


if A > B:
	A, B = B, A
	#print(A,B)

d = []

for i in range(1,A+1):
	if A % i == 0 and B % i == 0:
		d.append(i)

d.reverse()
print(d[K-1])

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int64_t dfs(const vector<vector<int64_t>>& links, const vector<int64_t>& colors,
            vector<int64_t>& ans, vector<vector<int64_t>>& stacks, int64_t v,
            int64_t p) {
    int64_t ret = 1;
    for (auto u : links[v]) {
        if (u == p) {
            continue;
        }

        stacks[colors[v]].push_back(0);
        auto mm = dfs(links, colors, ans, stacks, u, v);
        auto tmp = stacks[colors[v]].back();
        stacks[colors[v]].pop_back();
        ans[colors[v]] += (mm - tmp) * (mm - tmp + 1) / 2;

        ret += mm;
    }

    stacks[colors[v]].back() += ret;

    return ret;
}

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

    vector<int64_t> colors(n);
    for (auto&& c : colors) {
        cin >> c;
        --c;
    }
    vector<vector<int64_t>> links(n);
    for (auto i : irange(0L, n - 1)) {
        int64_t a, b;
        cin >> a >> b;
        --a;
        --b;
        links[a].push_back(b);
        links[b].push_back(a);
    }

    vector<int64_t> ans(n);
    vector stacks(n, vector<int64_t>(1));
    dfs(links, colors, ans, stacks, 0, -1);

    for (auto i : irange(0L, n)) {
        ans[i] += (n - stacks[i].back()) * (n - stacks[i].back() + 1) / 2;
    }

    for (auto i : irange(0L, n)) {
        cout << n * (n + 1) / 2 - ans[i] << "\n";
    }
}

Measured memory_bytes: 58372
/*
 * a.cc:
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */
int main(){
  int a,b,c,i,n=0;
  cin>>a>>b>>c;
  for(i=a;i<=b;i++){
    if (c%i==0) n++;

  }
  cout<<n<<endl;
  return 0;


}



Measured memory_bytes: 3132
n=int(input())
aa=list(map(int,input().split()))

def mp(a):
    b=[]
    if len(a)==1:
        b.append(a[0]) 
    elif len(a)%2==0:
        for i in range(0,len(a),2):
            b.append(a[i]*a[i+1]) 
    else:
        for i in range(0,len(a)-1,2):
#            print(i)
            b.append(a[i]*a[i+1]) 
#        print("1",a[len(a)//2+1])
        b.append(a[len(a)-1]) 
    return b

c=aa.copy()
while len(c)>1:
    c=mp(c)   
#    print(c)
    
if c[0]<=10**18:
    print(c[0])
else:
    print(-1)

    

Measured memory_bytes: 145616
#include <iostream>
using namespace std;
int main()
{	
	int a,b,c;
	while(cin>>a>>b>>c)
	{
		bool card[11]={0};
		card[a]=card[b]=card[c]=true;

		int sum=0;
		for(int i=1;i<=10;i++)
			if(!card[i] && i<=20-a-b) sum++;
		if(2*sum>=7) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1156
#include<stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a > b){
		a = a + a - 1;
		printf("%d",a);
	}
	
	else if(a < b){
		b = b + b - 1;
		printf("%d",b);
	}
	
	else{
		printf("%d",(a + b));
	}
	
	return 0;
}

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

int main(){
	int l,r;
	scanf("%2d%2d",&l,&r);
	
	if(1<=l&&l<=12){
		if(1<=r&&r<=12){
			cout<<"AMBIGUOUS"<<endl;
		}else cout<<"MMYY"<<endl;
	}else{
		if(1<=r&&r<=12){
			cout<<"YYMM"<<endl;
		}else cout<<"NA"<<endl;
	}
}//解説参考.


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

int main(void)
{
    long long N;
    cin >> N;
    vector<long long> a(N);
    for (long long i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    long long cnt = 0;
    for (long long i = N-1; i > -1; i--)
    {
        cnt = a[i] - cnt;
    }
    cout << cnt << " ";

    for (long long i = 0; i < N-1; i++)
    {
        cnt = 2 * (a[i] - (cnt / 2));
        cout << cnt << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4012
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <stdlib.h>
#include <functional>
#define ll long long
#define llu unsigned long long
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
using namespace std;
const int N = 1e5 + 10;
ll a, b;

int main() {
	int i;
	scanf("%lld%lld", &a, &b);

	ll num = 0;
	i = 2;
	while (1) {
		num = a*i;
		if (a%b == 0 || num > (ll)1e18) {
			printf("-1\n");
			return 0;
		}
		if (num%b) {
			printf("%lld\n", num);
			return 0;
		}
		++i;
	}

	

}

Measured memory_bytes: 256
{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L

main :: IO ()
main = readInts >>= output . solve

solve :: [Int] -> _
solve [s,w]
  | s <= w    = "unsafe"
  | otherwise = "safe"

output :: _ -> IO ()
output = putStrLn

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

const int LIM = 1000000;

signed main(){
	int n,a[200010],cnt[1000100] = {};
	bool isOK[1000100] = {};
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		cnt[a[i]]++;
	}
	for(int i = 1;i <= LIM;i++){
		isOK[i] = (cnt[i] == 1);
	}
	for(int i = 1;i <= LIM;i++){
		for(int j = i * 2;j <= LIM;j += i){
			if(cnt[i]) isOK[j] = false;
		}
	}
	int ans = 0;
	for(int i = 0;i < n;i++){
		if(isOK[a[i]]) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 13984
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pqb             	priority_queue<int>
#define pqs             	priority_queue<int,vi,greater<int> >
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)  	type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;
    string s;cin>>s;
    if(s.length()<=n){
    	cout<<s;
    	return;
    }
    string t=s.substr(0,n);
    cout<<t<<"...";
}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<"Execution time: "<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3844
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<int> A(3 * n, 0);
    for (int i = 0; i < 3 * n; ++i) {
        cin >> A[i];
        --A[i];
    }

    const int INF = 1 << 20;
    vector<vector<int>> dp(n + 1, vector<int>(n + 1, -INF));
    
    auto update = [&](int i, int j, int x) {
        dp[i][j] = dp[j][i] = max(x, max(dp[j][i], dp[i][j]));
        dp[i][n] = dp[n][i] = max(x, max(dp[i][n], dp[n][i]));
        dp[j][n] = dp[n][j] = max(x, max(dp[j][n], dp[n][j]));
        dp[n][n] = max(dp[n][n], x);
    };

    update(A[0], A[1], 0);

    int base = 0;
    for (int i = 2; i + 3 <= 3 * n; i += 3) {
        vector<int> B{A[i], A[i + 1], A[i + 2]};
        vector<vector<int>> DP{dp[A[i]], dp[A[i + 1]], dp[A[i + 2]]};
        auto dpn = dp[n];

        if (A[i] == A[i + 1] && A[i + 1] == A[i + 2]) {
            ++base;
            continue;
        }

        for (int _ = 0; _ < 3; ++_) {
            {
                //[i, j, a, b, c] - [j, a, b] = [i, c]
                for (int i = 0; i <= n; ++i) {
                    int mx = dpn[i];
                    if (B[0] == B[1]) {
                        mx = max(mx, DP[0][i] + 1);
                    } 
                    update(i, B[2], mx);
                }
            }

            {
                //[i, j, a, b, c] - [i, j, a] = [b, c]
                int mx = dpn[n];
                mx = max(mx, DP[0][B[0]] + 1);
                update(B[1], B[2], mx);
            }
            rotate(B.begin(), B.begin() + 1, B.end());
            rotate(DP.begin(), DP.begin() + 1, DP.end());
        }
    }

    int res = 0;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) {
            int ans = dp[i][j];
            if (i == j && A.back() == i) {
                ++ans;
            }
            res = max(res, ans);
        }
    }

    res += base;

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 19044
#include<iostream>
using std::cin;
using std::cout;
using std::endl;

#include<map>
using std::map;

#include<string>
using std::string;

#include<stdlib.h>
long long int P=1000000007;

int main(void){
int m[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int l;
scanf("%d",&l);
printf("%d",m[l-1]);
}


Measured memory_bytes: 256
#include <map>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

//abbreviations
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define vvi vector<vector<int>>

using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    int N, K;
    cin >> N >> K;
    vi P(N);
    rep(i,N)
        cin>>P[i];

    vl ensum(N+1, 0);
    ll ans = 0;
    rep(i, N)
        ensum[i+1] = ensum[i]+P[i]+1;
    rep(i, N-K+1)
        ans = max(ensum[i+K]-ensum[i], ans);
    cout << fixed << setprecision(6) << (double)(ans)/2.0 << endl;

    return 0;
}

Measured memory_bytes: 2560
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        long x = sc.nextLong();
        long money = 100;

        int cnt = 0;
        while (money < x) {
            money *= 1.01;
            cnt++;
        }

        System.out.println(cnt);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 25392
#include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<cstring>
    #include<cmath>
    using namespace std;
    typedef long long LL;
    const int MaxN = 1e5 + 5;
    int n;
    char s[MaxN];
    int ans[MaxN];
    bool flag;
    void search(int x, int y){
    	int p = 0;
    	ans[++p] = x;
    	ans[++p] = y;
    	for(int i = 2; i <= n; i++){
    		if(ans[i] == 1){
    			if(s[i] == 'o')
    				ans[i + 1] = ans[i - 1];
    			else if(s[i] == 'x')
    				ans[i + 1] = -ans[i - 1];
    		}
    		else if(ans[i] == -1){
    			if(s[i] == 'o')
    				ans[i + 1] = -ans[i - 1];
    			else if(s[i] == 'x')
    				ans[i + 1] = ans[i - 1];
    		}
    	}
    	if(ans[1] == ans[1 + n]){
    		if(ans[1] == 1){
    			if(s[1] == 'o' && ans[2] == ans[n]) flag = true;
    			else if(s[1] == 'x' && ans[2] != ans[n]) flag = true;
    		}
    		else if(ans[1] == -1){
    			if(s[1] == 'o' && ans[2] != ans[n]) flag = true;
    			else if(s[1] == 'x' && ans[2] == ans[n]) flag  = true;
    		}
    	}	
    }
    int main(){
    	while(~scanf("%d", &n)){
    		scanf("%s", s + 1);
    		for(int i = -1; i <= 1; i++){
    			for(int j = -1; j <= 1; j++){
    				if(i == 0 || j == 0) continue;
    				if(!flag) search(i, j);
    			}
    		}
    		if(!flag) printf("-1\n");
    		else{
    			for(int i = 1; i <= n; i++)
    				if(ans[i] == 1) printf("S");
    				else if(ans[i] == -1) printf("W");
    			printf("\n");
    		}
    	memset(ans, 0, sizeof(ans));
    	memset(s, 0, sizeof(s));
    	flag = false;
    	}
    	return 0;
    }
    				

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

int main(void)
{
	string S; cin >> S;
	string::iterator il = S.begin();
	int count_zero = 0;
	int count_one = 0;

	while (il != S.end()) {
		if (*il == '0')count_zero++;
		else count_one++;
		il++;
	}
	int ans = min(count_zero, count_one) * 2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <atcoder/all>

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using namespace atcoder;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 998244353LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */


int main() {
  
  struct T {
    lint cnt0, cnt1, inv;
    T(){}
    T(lint cnt0, lint cnt1, lint inv):cnt0(cnt0),cnt1(cnt1),inv(inv){}
  };
  using E = bool;
  auto f = [](T l, T r){ // return type T value
    return T(l.cnt0 + r.cnt0, l.cnt1 + r.cnt1, l.inv + r.inv + l.cnt1 * r.cnt0);
  };
  auto g = [](E l, T r){ // return type T value
    if (!l) return r;
    return T(r.cnt1, r.cnt0, r.cnt0 * r.cnt1 - r.inv);
  };
  auto h = [](E l, E r){ // return type E value
    return E(l ^ r);
  };
  auto ti = []() {
    return T(0, 0, 0);
  };
  auto ei = []() {
    return E(false);
  };
  

  int n, q; cin >> n >> q;
  vector<T> dat(n);
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    if (x == 0) {
      dat[i] = T(1, 0, 0);
    } else {
      dat[i] = T(0, 1, 0);
    }
  }
  lazy_segtree<T, f, ti, E, g, h, ei> sg(dat);

  for (int i = 0; i < q; i++) {
    int t, l, r; cin >> t >> l >> r;
    l--;
    if (t == 1) {
      sg.apply(l, r, true);
    } else {
      cout << sg.prod(l, r).inv << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 19696
import math
n=int(input())
L=[]

def dist(X,Y):
    return math.sqrt((X[0]-Y[0])**2+(X[1]-Y[1])**2)

for i in range(n):
    a,b=map(int,input().split())
    L.append((a,b))

ans=0

for i in range(n-1):
    for q in range(i+1,n):
        ans+=dist(L[i],L[q])

ans/=n*(n-1)//2
ans*=n-1
print(ans)

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

int main(){
    int k,i;
    char s[100] = {0};

    cin >> k >> s;

    for( i = 0; i < k; i++){
        if( s[i] == 0 )break;
        cout << s[i];
    }
    if( s[i] != 0 ){
        cout << "...";
    }
    cout << "\n";

}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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






int main() {
    ll a, b;
    cin >> a >> b;
    if(a * b & 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import numpy as np
n=1
N=[input() for i in range(n)]
V=list(map(int, input().split()))
C=list(map(int, input().split()))
samu=0

for i in range(len(V)):
  kari=V[i]-C[i]
  if kari>=0:
    samu=samu+kari

print(samu)


Measured memory_bytes: 12404
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}

Measured memory_bytes: 3636
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val cl = IntArray(9)
    A.forEach { a ->
        cl[when (a) {
            in    1.. 399 -> 0
            in  400.. 799 -> 1
            in  800..1199 -> 2
            in 1200..1599 -> 3
            in 1600..1999 -> 4
            in 2000..2399 -> 5
            in 2400..2799 -> 6
            in 2800..3199 -> 7
            else -> 8
        }] += 1
    }
    var min = cl.dropLast(1).count { it > 0 }
    val max = min + cl.last()
    if (min == 0 && cl.last() > 0) min = 1
    println("$min $max")
//System.err.println(cl.joinToString())
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong(offset: Long = 0L) = listOfString().map { it.toLong() + offset}


Measured memory_bytes: 37656