akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    string s;
    vector<int> used(26, 0);
    int cnt = 0;
    cin >> s;
    for(char c: s) {
        used[c-'a'] = 1;
        cnt += 1;
    }
    if (accumulate(used.begin(), used.end(), 0) == 26) {
        set<char> lg;
        string s2 = s;
        string ans = "";
        while(s2.size() > 0) {
            auto it = lg.upper_bound(s2.back());
            if (it != lg.end()) {
                string s3 = s2;
                s3.back() = *it;
                if (ans == "")
                    ans = s3;
                else
                    ans = min(ans, s3);
            }

            lg.insert(s2.back());
            s2.pop_back();
        }
        if (ans == "")
            cout << -1 << endl;
        else
            cout << ans << endl;
        return 0;
    } else {
        cout << s;
        for(int i = 0; i < 26; i++)
            if (used[i] == 0) {
                cout << char('a'+i) << endl;
                break;
            }
    }    
    return 0;
}


Measured memory_bytes: 3628
#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        ans += min(a[i], b[i])
        rest = b[i] - a[i]
        if rest > 0:
            ans += min(a[i+1], rest)
            a[i+1] = max(a[i+1] - rest, 0)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 81892
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

ll cnt[100001];

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < 100001; i++){
        cnt[i] = 0;
    }
    ll sum = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        cnt[a]++;
        sum += a;
    }


    int q;
    cin >> q;

    for(int i = 0; i < q; i++){
        int b,c;
        cin >> b >> c;
        ll tmp = cnt[b];
        sum -= tmp*b;
        sum += tmp*c;
        cout << sum << endl;

        cnt[c] += cnt[b];
        cnt[b] = 0;
    }
   
    return 0;
}

Measured memory_bytes: 4572
/*
 * main.cpp
 *
 *  Created on: 2011/04/01
 *      Author: satoki
 *      21:47 ~ 22:08
 */
#include <iostream>
#include <string.h>
using namespace std;

int iN;
int iTra[3];
bool bOutput;

bool input() {
  if (iN > 0)
    scanf("%d %d %d", &iTra[0], &iTra[1], &iTra[2]);
  else
    return false;
  iN--;
  return true;
}

void manage() {
  int i, j, tmp;
  for (i = 0; i < 3; i++) {
    iTra[i] *= iTra[i];
  }
  for (i = 0; i < 3; i++) {
    for (j = 2; j > i; j--) {
      if (iTra[j - 1] > iTra[j]) {
        tmp = iTra[j - 1];
        iTra[j - 1] = iTra[j];
        iTra[j] = tmp;
      }
    }
  }
  if (iTra[0] + iTra[1] == iTra[2])
    bOutput = true;
  else
    bOutput = false;
}

int main() {
  scanf("%d", &iN);
  while (1) {
    if (!input()) break;
    manage();
    if (bOutput)
      printf("YES\n");
    else
      printf("NO\n");
  }
}

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

const int N = 1e5 + 5;

int n, a[N], cc[N], p[5];

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		for (int t = a[i], cnt = 0; t % 2 == 0 && t; cc[i] = ++cnt, t /= 2)
			;
		cc[i] = min(cc[i], 2);
	}
	sort(cc + 1, cc + n + 1);
	for (int i = 1; i <= n; ++i)
		++p[cc[i]];
	if (p[0] <= p[2])
		cout << "Yes" << endl;
	else if (p[0] == p[2] + 1 && !p[1])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1024
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"

  val input: Array[Array[Int]] = Array.ofDim(6, 6000000)
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt

  val qq =
    for {
      i <- 1 to 9
      j <- 1 to 9
    } yield i * j

  val ans = if (qq.contains(n)) Yes else No

  println(ans)

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

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	priority_queue<double, vector<double>, greater<double>> pq;
	for (int i = 0; i < N; i++) {
		double V; cin >> V;
		pq.push(V);
	}
	
	while (pq.size() > 1) {
		double a = pq.top(); pq.pop();
		double b = pq.top(); pq.pop();
		pq.push((a+b)/2);
	}
	cout << pq.top() << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

void PrintTable(const vector<vector<Int> >& table) {
    for (Int i = 0; i < (Int)table.size(); ++i) {
        for (Int j = 0; j < (Int)table[0].size(); ++j) {
            cout << table[i][j] << " ";
        }
        cout << endl;
    }
    return;
}

// ビット演算
namespace Bits {
    // 整数 x を左に i ビットシフトした値を返す
    static Int LeftBitShift(Int x, Int i);
    // 整数 x を右に i ビットシフトした値を返す
    static Int RightBitShift(Int x, Int i);
    // 整数x の 下から i 桁目が1かどうかを返す
    static bool IsFlagUp(Int x, Int i);
    // 整数x の 下から i 桁目が0かどうかを返す
    static bool IsFlagDown(Int x, Int i);

    // 整数 x を左に i ビットシフトした値を返す
    Int LeftBitShift(Int x, Int i) {
        return (x << i);
    }
    // 整数 x を右に i ビットシフトした値を返す
    Int RightBitShift(Int x, Int i) {
        return (x >> i);
    }
    // 整数x の 下から i 桁目が1かどうかを返す
    bool IsFlagUp(Int x, Int i) {
        return ((x & (1 << i)) != 0);
    }
    // 整数x の 下から i 桁目が0かどうかを返す
    bool IsFlagDown(Int x, Int i) {
        return ((x & (1 << i)) == 0);
    }
}
using namespace Bits;

int main(void) {
    Int n, m;
    cin >> n >> m;
    VVI table(m, VI(n, 0));
    for (Int i = 0; i < m; ++i) {
        Int k;
        cin >> k;
        for (Int j = 0; j < k; ++j) {
            Int s;
            cin >> s;
            --s;
            table[i][s] = 1;
        }
    }
    VI lightOn(m);
    for (Int i = 0; i < m; ++i) {
        cin >> lightOn[i];
    }
    Int loop = pow(2, n);
    Int result = 0;
    for (Int i = 0; i < loop; ++i) {
        bool lightFlag = true;
        for (Int j = 0; j < m; ++j) {
            // 点灯に関係するスイッチのうち，何個のスイッチがonになっているかを数える
            Int count = 0;
            for (Int k = 0; k < n; ++k) {
                if (table[j][k] == 1 && IsFlagUp(i, k)) {
                    ++count;
                }
            }
            if ((count % 2) == lightOn[j]) {
                // 点灯してる
            } else {
                // 点灯してない
                lightFlag = false;
            }
        }
        if (lightFlag) {
            result++;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 4084
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

int main()
{
	int n;
	int t,x,y;
	cin>>n;
	int x1=0,y1=0,t1=0;
	bool b=1;
	while(n)
	{
		cin>>t>>x>>y;
		if(abs(x-x1)+abs(y-y1)>t-t1||(abs(x-x1)+abs(y-y1))%2!=(t-t1)%2){b=0; }	
		x1=x; y1=y; t1=t;
		n--;
	}
	if(b==0)cout<<"No\n";
	else cout<<"Yes\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a,b;
		String op;

		Scanner sc = new Scanner(System.in);

		while(true) {
			a = sc.nextInt();
			op = sc.next();
			b = sc.nextInt();

			if(op.equals("?")) break;

			switch (op) {
	    		case "+":
	    			System.out.println(a+b);
	    			break;
	    		case "-":
	    			System.out.println(a-b);
	    			break;
	    		case "*":
	    			System.out.println(a*b);
	    			break;
	    		case "/":
	    			System.out.println(a/b);
	    			break;
			}
		}
	}
}


Measured memory_bytes: 26136
#include<bits/stdc++.h>
using namespace std;
#define MAX 300000
#define int long long
struct Pair{
	int x,y, id;
};
int n;
Pair a[MAX+1];
typedef Pair PP;
typedef pair<int,int> pp;
vector<pair<int,int> > G[MAX+1];
bool cmp(PP a,PP b){return a.x<b.x;};
bool CMP(PP a,PP b){return a.y<b.y;};
bool visited[MAX+1];
int ans;
#define fi first
#define se second
void DJK(int x){
	ans = 0;
	priority_queue<pp,vector<pp> ,greater<pp> >pq;
	pq.push({0,x});
	while(!pq.empty()){
		int u = pq.top().se;
		int w = pq.top().fi;
		pq.pop();
		if(visited[u]) continue;
		ans+=w;
		visited[u] = 1;
		for(pp ii : G[u]){
			int v = ii.se;
			pq.push({ii.fi,v});
		}
	}
}
signed main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i].x >> a[i].y;
		a[i].id = i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=2;i<=n;i++){
		G[a[i].id].push_back({a[i].x-a[i-1].x,a[i-1].id});
		G[a[i-1].id].push_back({a[i].x-a[i-1].x,a[i].id});
	}
	sort(a+1,a+n+1,CMP);
	for(int i=2;i<=n;i++){
		G[a[i].id].push_back({a[i].y-a[i-1].y,a[i-1].id});
		G[a[i-1].id].push_back({a[i].y-a[i-1].y,a[i].id});
	}
	DJK(1);
	cout << ans;
}

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

using namespace std;

int main(){
	int n; cin >> n;
	int AC = 0;
	int WA = 0;
	int TLE = 0;
	int RE = 0;
	while(n--){
		string s; cin >> s;
		if(s == "AC"){
			AC++;
		}
		else if(s == "WA"){
			WA++;
		}
		else if(s == "TLE"){
			TLE++;
		}
		else{
			RE++;
		}
	}
	cout << "AC x " << AC << endl; 
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;   
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

typedef pair<int, int> point;

int H, W;
vector<vector<int>> board;

vector<pair<point, point>> ans;

int main(void) {
    cin >> H >> W;

    board.resize(H, vector<int>(W, 0));
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            cin >> board[h][w];
        }
    }

    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W - 1; w++) {
            if (board[h][w] % 2 == 1) {
                ans.push_back({{h, w}, {h, w + 1}});
                board[h][w]--;
                board[h][w + 1]++;
            }
        }
    }
    for (int h = 0; h < H - 1; h++) {
        if (board[h][W - 1] % 2 == 1) {
            ans.push_back({{h, W - 1}, {h + 1, W - 1}});
            board[h][W - 1]--;
            board[h + 1][W - 1]++;
        }
    }

    printf("%d\n", (int) ans.size());
    for (auto &path : ans) {
        auto from = path.first;
        auto to = path.second;
        printf("%d %d %d %d\n", from.first + 1, from.second + 1, to.first + 1, to.second + 1);
    }

    return 0;
}


Measured memory_bytes: 5232
#include <stdio.h>
int main (void)
{
    int n,m,c;
    scanf("%d %d %d",&n,&m,&c);
    int i,j;    //for文用//
    int b[m];
    int a[n][m];
    for (i=0; i < m; i++)   {
        scanf("%d",&b[i]);
    }
    for (i=0;i<n;i++)  {
        for (j=0;j<m;j++)   {
            scanf("%d",&a[i][j]);
        }
    }
    //ここから出力//
    int key[n];
    for (i=0; i<n;i++)  {
                key[i] = c;
    }
    //全てのkeyの成分をcに統一//
    for (i=0; i<n; i++) {
        for (j=0; j<m;j++)  {
            key[i] = key[i] + a[i][j] * b[j];
        }
    }
    //全てのkeyは不等式の左辺の部分になる．//
    int count = 0;
    for (i = 0; i < n; i++) {
        if (key[i]>0)   count++;
    }
    printf("%d",count);
    puts("");
    return 0;
}

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

int main(){
    for (;;) {
        int x,y;
        scanf("%d %d",&x,&y);
        if (x==y && x==0) break;
        printf("%d %d\n",min(x,y),max(x,y));
    }
    return 0;
}



Measured memory_bytes: 3092
#include<iostream>
#include<cmath>

using namespace std;

int main() {
	const double Pi = 3.14159265358979323846;
	// 初期値は北なので、９０度
	int angle = 90;
	double x = 0, y = 0;
	while (true) {
		// r:距離 a回転角
		int r, a;

		cin >> r;
		cin.ignore();
		cin	>> a;
		if (r == 0 && a == 0) {
			break;
		}

		double dx = r * cos(angle / 180.0 * Pi);
		double dy = r * sin(angle / 180.0 * Pi);

		x += dx;
		y += dy;

		angle -= a;
		if (angle >= 360) {
			angle %= 360;
		}
		else if (angle < 0) {
			angle += 360;
		}

	}
	cout << static_cast<int>(x) << endl << static_cast<int>(y) << endl;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int x,h;
	double s;
	double k;

	while(1) {
		cin >> x;
		cin >> h;
		if (x == 0 && h == 0) {
			break;
		}
		k = sqrt(pow((double)x/2.0,2) + pow((double)h,2));
		s = pow((double)x,2) + (double)x * k * 2;
		printf("%f\n",s);
	}

	return 0;
}

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

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

using namespace std;
typedef long long ll;

int main(){
    int n;cin >> n;
    vector<ll> vec(n);
    rep(i,n) cin >> vec[i];
    ll result = vec.back();
    vec.pop_back();

    vector<ll> p(21);
    p[vec.front()] = 1;
    for(int i=1;i<n-1;i++){
        vector<ll> q(21);
        for(int j=0;j<=20;j++){
            for(int sign=-1;sign<=1;sign+=2){
                int nv = j + sign * vec[i];
                if(0 <= nv and nv <= 20){
                    q[nv] += p[j];
                }
            }
        }
        p.swap(q);
    }
    cout << p[result] << endl;

    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

template <typename T>
T gcd( T a, T b )
{
    if( b == 0 ) return a;
    else return gcd( b, a % b );
}

int main()
{
    long long A, B;
    cin >> A >> B;

    int ans = 1;
    for(long long idx = 2; idx*idx <= min(A, B); ++idx){
        if(A%idx == 0 and B%idx == 0){
            ++ans;
            while(A%idx == 0 and B%idx == 0){
                A /= idx;
                B /= idx;
            }
        }
        // cout << idx << " " << A << " " << B << endl;
    }
    cout << ans + ((gcd<long long>(A, B) == 1)?0 :1) << endl;

    return 0;
}

Measured memory_bytes: 256
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

vector<pair<ll,ll>> factor_arr;

void myfactor(ll num){ 
    ll count = 0;   
    while (!(num % 2)) { 
        num >>= 1; count++; 
    }  
    if (count) factor_arr.push_back({2,count}); 
    for (auto i = 3; i <= sqrt(num); i += 2) { 
        count = 0; 
        while (num % i == 0) { 
            count++; 
            num /= i; 
        } 
        if (count) factor_arr.push_back({i,count}); 
    } 
    if (num > 2) factor_arr.push_back({num,1});
}

void virus(){
    ll pt, d;
    cin>>pt>>d;
    ll ans = 0;
    while(pt--){
        ll x,y;
        cin>>x>>y;
        if(sqrt((x*x)+(y*y)) <= d ) ans++;
    }
    cout<<ans;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3656
//IN THE NAME OF Allah
///////////////////////////////////////////////////////////////////////////////////////
//   HH   HH        AA        SSSSSSS    HH   HH   EEEEEEEE       MM        MM       //
//   HH   HH       AAAA     SSS          HH   HH   EE            MMMM      MMMM      //
//   HHHHHHH      AA  AA     SSSSSSS     HHHHHHH   EEEEE        MM  MM    MM  MM     //
//   HHHHHHH     AAAAAAAA      SSSSSSS   HHHHHHH   EEEEE       MM    MM  MM    MM    //
//   HH   HH    AA      AA          SSS  HH   HH   EE         MM      MMMM      MM   //
//   HH   HH   AA        AA   SSSSSSS    HH   HH   EEEEEEEE  MM        MM        MM  //
///////////////////////////////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
#define NFor(i,a,b) for (ll i = a; i <= b; i++)
#define RFor(i,a,b) for (ll i = a; i >= b; i--)
#define GFor(a,b,x) for(auto a : b[x])
#define Fasting()  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define all(x) x.begin(), x.end()
#define ot(n) cout << fixed << setprecision(9) << n;
#define endl "\n"
#define F first
#define S second
using namespace std;
const ll N=1e3+2;
int main()
{
    ll x; cin >> x;
    ll a = 100;
    ll b = 0;
    while(a<x)
    {
        a+=a/100;
        b++;
    }
    cout << b << endl;
}


Measured memory_bytes: 3588
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.nextLine();
        String strT = sc.nextLine();
        int[] T = Arrays.stream(strT.split(" ")).mapToInt(Integer::valueOf).toArray();
        int M = sc.nextInt();
        for (int i = 0; i < M; i++) {
            int time = 0;
            int P = sc.nextInt() - 1;
            int X = sc.nextInt();
            for (int j = 0; j < N; j++) {
                if (j != P) {
                    time += T[j];
                } else {
                    time += X;
                }
            }
            System.out.println(time);
        }
    }

}


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

#define vi vector<int>
#define INFTY 2000000000;

int partition(vi& A, int p, int r) {
  int x = A[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);

  return i + 1;
}

void printArray(vi& A, int p) {
  for (int i = 0; i < p; i++) {
    cout << A[i] << " ";
  }
  cout << "[" << A[p] << "] ";
  for (int i = p + 1; i < A.size(); i++) {
    cout << A[i];
    if (i < A.size() - 1) {
      cout << " ";
    }
    else {
      cout << endl;
    }
  }
}

int main() {

    int n;
    vi A;
    int tmp;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        A.push_back(tmp);
    }

    int p = partition(A, 0, n-1);
    printArray(A, p);

    return 0;
}



Measured memory_bytes: 3420
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const double inf = 1e9;

const long double eps = 1e-8;



int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    i64 d, t, s;
    cin >> d >> t >> s;

    if (d > t * s) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3656
package main

import "fmt"

// Solve the problem of ABC128 C
func main() {
	var n, m int
	fmt.Scan(&n, &m)
	slist := make([][]int, m)
	for i := 0; i < m; i++ {
		k := 0
		fmt.Scan(&k)
		slist[i] = make([]int, k)
		for j := 0; j < len(slist[i]); j++ {
			fmt.Scan(&slist[i][j])
		}
	}
	plist := make([]int, m)
	for l := 0; l < m; l++ {
		fmt.Scan(&plist[l])
	}

	count := 0
	for bits := 0; bits < (1 << uint64(n)); bits++ {
		ok := true
		for j := 0; j < m; j++ {
			sum := 0
			for _, sNo := range slist[j] {
				sum += bits >> uint64(sNo-1) & 1
			}
			if sum%2 != plist[j] {
				ok = false
				break
			}
		}
		if ok {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
from functools import reduce
n = int(input())
l = list(map(int, input().split()))
if n%3:
  if max(l) == 0:
    print("Yes")
  else:
    print("No")
else:
  if reduce((lambda x, y:x ^ y), l) == 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 14708
N = int(input())
S = input()
alphabet = [
    'A',
    'B',
    'C',
    'D',
    'E',
    'F',
    'G',
    'H',
    'I',
    'J',
    'K',
    'L',
    'M',
    'N',
    'O',
    'P',
    'Q',
    'R',
    'S',
    'T',
    'U',
    'V',
    'W',
    'X',
    'Y',
    'Z'
]
result =''
for s in S:
    target = alphabet.index(s)
    #print(target)
    tmp = (target+N)%26
    result += alphabet[tmp]
print(result)

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

void ng() {
  puts("-1");
  exit(0);
}

int main() {
  int n;
  ll tot = 0;
  cin >> n;
  vector<ll> d(n + 1);
  for (int i = 0; i <= n; i++) {
    cin >> d[i];
    tot += d[i];
  }
  ll now = 1, ans = 0;
  for (int i = 0; i <= n; i++) {
    if (now < d[i]) ng();
    ans += now;
    now -= d[i];
    tot -= d[i];
    now = min(now * 2, tot);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
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;
}
int main() {
    ll N, X;
    cin >> N >> X;

    vector<ll> donut(N);
    ll minValue = INF;
    REP(i, N) {
        cin >> donut[i];
        chmin(minValue, donut[i]);
        X -= donut[i];
    }

    cout << N + X / minValue << endl;

    return 0;
}

Measured memory_bytes: 3568
N,K = map(int,input().split())
n_lis = [0]*N
for i in range(K):
    d = int(input())
    *A, = map(int,input().split())
    for j in range(d):
        a = A[j]
        n_lis[a-1] = 1
print(n_lis.count(0))   

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

S = str(input())
T = str(input())

flag = True

if len(S) + 1 != len(T):
    print("No")

for i in range(len(S)):
    if S[i] != T[i]:
        print("No")
        flag = False
        break

if flag == True:
    print("Yes")


Measured memory_bytes: 9044
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		
		int a = n * (n-1)/2;
		int b = m * (m-1)/2;
		
		int ans = a + b;
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
//#define mp make_pair


int n, a[202020],ans , temp, mp[202020];

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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

cin >> n;

rep(i, 1, n){
cin >> a[i];
mp[a[i]]=i;
}

rep(i, 1, n){

if(mp[i]>mp[i-1])temp++;
else temp = 1;
ans = max(ans, temp);

}


cout << n - ans << endl;

return 0;}


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

int main(){
   int n;
   cin>>n;
   vector<ll> h(n);
   rep(i,n) cin>>h[i];
   h[0]--;
   rep(i,n-1){
       if(h[i]<h[i+1]) h[i+1]--;
       if(h[i]>h[i+1]){
           cout<<"No"<<endl;
           return 0;
       }
   } 
   cout<<"Yes"<<endl;
}

Measured memory_bytes: 4008
import collections
N=int(input())
a=list(map(int,input().split()))
a_counter=collections.Counter(a)
answer = 0
# print(a_counter)
# print(a_counter[0])
# print(a_counter[1])
# print(a_counter[2])
# print(a_counter[3])
for i in a_counter:
    # print(i)
    # print(i == a_counter[i])
    if i != a_counter[i]:
        if i < a_counter[i]:
            answer += a_counter[i] - i
        else:
            answer += a_counter[i]

print(answer)

Measured memory_bytes: 18672
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main(){
    ll a,v;cin>>a>>v;
    ll b,w;cin>>b>>w;
    ll t;cin>>t;
    ll d=abs(a-b);
    if(v<=w) cout<<"NO"<<endl;
    else{
        if(t*(v-w)>=d) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

void solve() {
	ll initial = 100;
	ll x, y = 0; cin >> x;
	//cout << x - 100 << endl;
	while(initial <= x) {
		if (initial >= x) {
			cout << y;
			return;
		}
		initial += (initial/100);
		y++;
	}
	cout << y << endl;

	//cout << "Case #" << t + 1 << ": " << count << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	/*int t; cin >> t;s
	for (int i = 0; i < t; i++) {
		solve();
	}*/

	solve();

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

using P = pair<int, int>;

bool dfs(vector<vector<P>>& edges, vector<ll>& pos, int s, ll y) {
  if (pos[s] != INFLL && pos[s] != y) return false;
  pos[s] = y;
  for (auto& p : edges[s]) {
    if (pos[p.first] == INFLL) {
      bool ret = dfs(edges, pos, p.first, y + p.second);
      if (!ret) return false;
    }
    else if (pos[p.first] != y + p.second) return false;
  }
  return true;
}

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

  int n, m;
  cin >> n >> m;
  vector<vector<P>> edges(n);
  rep(i, m) {
    int l, r, d;
    cin >> l >> r >> d; l--; r--;
    edges[l].emplace_back(r, d);
    edges[r].emplace_back(l, -d);
  }

  vector<ll> pos(n, INFLL);
  rep(i, n) {
    if (pos[i] == INFLL) {
      bool ret = dfs(edges, pos, i, 0LL);
      if (!ret) {
        puts("No");
        return 0;
      }
    }
  }

  puts("Yes");

  return 0;
}


Measured memory_bytes: 13312
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e14;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const ll MN = 200 + 10;
const ll mod = 1e9 + 7;

vector <int> adj[MAXN];
vector <int> e[MAXN];
ll dp[MAXN];

ll solve (int v)
{
	if(dp[v] != -1)
		return dp[v];
	else
	{
		if(e[v].size() == 0)
			return 0;
		for (auto u : e[v])
		{
			dp[v] = max(solve(u) + 1, dp[v]);
		}
		return dp[v];
	}
}

int main()
{
	faster();
	int n , m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		dp[i] = -1;
	for (int i = 0; i < m; i++)
	{
		int v, u;
		cin >> v >> u;
		v--;
		u--;
		adj[v].push_back(u);
		e[u].push_back(v);
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		if(adj[i].size() == 0)
		{
			ans = max(solve(i), ans);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 59008
s = input()
n = len(s) - 1
ans = 0
for i in range(1 << n):
    formula = s[0]
    for j in range(n):
        if ((i >> j) & 1):
            formula += '+' + s[j + 1]
        else:
            formula += s[j + 1]
    ans += eval(formula)
print(ans)


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n := r.nextInt()
	r.Scan(true)
	v := r.nextStringArray().toInts()

	sort.Sort(sort.IntSlice(v))

	ans := float64(v[0])

	for i := 1; i < n; i++ {
		ans = (ans + float64(v[i])) / 2
	}

	fmt.Fprintln(stdout, ans)
}


Measured memory_bytes: 640
n = gets.to_i
s = gets.chomp

alphabets = %w(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)

new_string =
  s.chars.map do |char|
    new_index = alphabets.find_index(char) + n
    new_index -= 26 if new_index > 25
    alphabets[new_index]
  end

puts new_string.join

Measured memory_bytes: 2172
# coding: utf-8
# Your code here!
i1,m1,p1,e1=map(int,input().split())
i2,m2,p2,e2=map(int,input().split())

S=i1+m1+p1+e1
T=i2+m2+p2+e2

S,T=sorted([S,T])

print(T)




Measured memory_bytes: 5596
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
#define ll unsigned long long int
 
int main(){
    ll n, ans=0;
    cin>>n;
    vector<int>sum(n+1);
    
    for(int i=1;i<=n;i++){
        for(int j=1;i*j<=n;j++){
            sum[i*j]++;
        }
    }
    for(int i=1;i<=n;i++){
        ans+=sum[i]*i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 41872
using System;

public class Test
{
	public static void Main()
	{
		string line;//標準入力からの読み込み用
		int gyousuu = 0;

		//標準入力からの読み込み。forループで全ての行を読み込む
		
        for(;(line = Console.ReadLine())!=null;){	
			if(gyousuu!=0){
				Console.WriteLine(line);
				Console.WriteLine(line);
			}
			gyousuu++;
		
		}

	}
}

Measured memory_bytes: 2776
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package here;

/**
 *
 * @author sokumar
 */
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = sc.nextInt();
        int w1 = sc.nextInt();
        long [][]dp = new long[n+1][w1+1];
        
        
        long []val = new long[n+1];
        int []we = new int[n+1];
        for(int i=1;i<=n;i++)
        {
            we[i] = sc.nextInt();
            val[i] = sc.nextInt();
            
        }
        
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=w1;j++)
            {
                if(we[i] > j)
                    dp[i][j] = dp[i-1][j];
                else
                    dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-we[i]]+val[i]);
            }
        }
        w.println(dp[n][w1]);
        
        w.close();
    }
    
}


Measured memory_bytes: 125524
n,m,l=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]
B=[list(map(int,input().split())) for i in range(m)]

C=[]
for i in range(n):
    line=[]
    for j in range(l):
        c=0
        for k in range(m):
            c+=A[i][k]*B[k][j]
        line.append(c)
    C.append(line)

for line in C:
    print(*line)


Measured memory_bytes: 7060
#include <stdio.h>

using namespace std;


int main(){
	int n,a,b,c,A,B,C;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		scanf("%d %d %d",&a,&b,&c);
		A = a*a;
		B = b*b;
		C = c*c;
		if(A+B==C||B+C==A||C+A==B){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

    return 0;
}

Measured memory_bytes: 2592
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a == b){
        printf("No\n");
        return 0;
    }
    if(a > b){
        printf("No\n");
        return 0;
    }
    scanf("%d",&c);
    if(b == c){
        printf("No\n");
    }
    if(b > c){
        printf("No\n");
        return 0;
    }else{
        printf("Yes\n");
    }
    
    return 0;
}

Measured memory_bytes: 580
#include<stdio.h>
int main()
{
    int b,i,j;
    scanf("%d",&b);
    int a[b],c[b];
    for(i=0;i<b;i++)
    {
        scanf("%d",&a[i]);
    }
    for(j=0,i=b-1;j<b;j++,i--)
    {
        c[j]=a[i];
    }
    for(j=0;j<b;j++)
    {if(j==b-1)
    printf("%d\n",c[j]);
    else
        printf("%d ",c[j]);
    }
return 0;
}



Measured memory_bytes: 2040
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> a(m);
  for(int i = 0; i < m; ++i){
    cin >> a[i];
  }
  auto it = lower_bound(a.begin(), a.end(), x);
  int id = it - a.begin();
  int ans = min(id, m-id);
  cout << ans << endl;
}


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


int main(){
	string s;
	cin >> s;

	int start = 0;
	int end = s.size() - 1;

	int counter = 0;

	while (start < end) {
		if (s[start] != s[end]) counter++;
		start++;
		end--;
	}

	cout << counter;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    int n, m;
    cin >> n;
    map<string,int>mp;
    vector<string>v;
    rep(i, 0, n){
        string a;
        cin >> a;
        v.push_back(a);
        mp[a]++;
    }
    cin >> m;
    rep(i, 0, m){
        string b;
        cin >> b;
        v.push_back(b);
        mp[b]--;
    }
    int ans=0;
    rep(i, 0, v.size()){
        ans = max(mp[v[i]],ans);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3616
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
const int maxn=200010,inf=0x7fffffff;
int n;
int a[maxn];
int ar[maxn],ct[maxn],nm;
bool vs[maxn],co[maxn];
struct Bridge {
	int v;
	Bridge *ne;
}bl[maxn*60],*fr[maxn],*zl=bl;
struct Edge {
	int v,c;
	Edge *re,*ne;
}el[maxn*60],*la[maxn],*cur[maxn],*cl=el;
int s,t;
int ds[maxn];
int qu[maxn],hd,tl;
int ans;
int In() {
    register char c;
    for(;c=getchar(),c!='-'&&!isdigit(c););
    register bool f=c=='-';
    register int s=f?0:c-'0';
    for(;c=getchar(),isdigit(c);)s=s*10+c-'0';
    return f?-s:s;
}
void ist(register int u,register int v) {
	*++zl=(Bridge){v,fr[u]},fr[u]=zl;
	*++zl=(Bridge){u,fr[v]},fr[v]=zl;
}
void ff(int x) {
	vs[x]=1;
	for(Bridge *i=fr[x];i;i=i->ne)if(!vs[i->v]) co[i->v]=!co[x],ff(i->v);
}
void ins(register int u,register int v,register int c) {
	++cl,*cl=(Edge){v,c,cl+1,la[u]},la[u]=cl;
	++cl,*cl=(Edge){u,0,cl-1,la[v]},la[v]=cl;
}
bool bfs() {
	memset(ds,0,sizeof ds);
	for(ds[qu[hd=tl=1]=t]=1;hd<=tl;++hd)for(register Edge *i=la[qu[hd]];i;i=i->ne)
	if(i->re->c&&!ds[i->v]) ds[i->v]=ds[qu[hd]]+1,qu[++tl]=i->v;
	return ds[s];
}
int dfs(int x,int f) {
	if(x==t) return f;
	int r=0;
	for(Edge *&i=cur[x];i;i=i->ne)if(i->c&&ds[i->v]==ds[x]-1) {
		int t=dfs(i->v,f-r<i->c?f-r:i->c);
		r+=t,i->c-=t,i->re->c+=t;
		if(r==f) return r;
	}
	return r;
}
int main() {
	n=In();
	for(register int i=1;i<=n;++i)a[i]=In();
	std::sort(a+1,a+n+1);
	for(register int i=1;i<=n;++i)ar[i]=a[i];
	nm=std::unique(ar+1,ar+n+1)-ar-1;
	for(register int i=1,j=1;i<=nm;++i)for(;j<=n&&a[j]==ar[i];++j)++ct[i];
	for(register int i=1;i<=nm;++i)for(register int p=1,q=2;p<=30;++p,q<<=1) {
		register int j=std::lower_bound(ar+1,ar+nm+1,q-ar[i])-ar;
		if(i<j&&ar[j]+ar[i]==q) ist(i,j);
	}
	for(register int i=1;i<=nm;++i)if(!vs[i]) ff(i);
	s=nm+1,t=nm+2;
	for(register int i=1;i<=nm;++i) {
		if(co[i]) ins(i,t,ct[i]);
		else {
			ins(s,i,ct[i]);
			for(register Bridge *j=fr[i];j;j=j->ne) ins(i,j->v,inf);
		}
	}
	for(;bfs();ans+=dfs(s,inf))memcpy(cur,la,sizeof la);
	for(register int i=1;i<=nm;++i)for(register int p=0,q=1;p<=30;++p,q<<=1)
	if(ar[i]<<1==q) for(register Edge *j=la[i];j;j=j->ne) {
		if(j->v==s) ans+=j->re->c>>1;
		if(j->v==t) ans+=j->c>>1;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main (){
    int a,b,k;
    cin >> a >> b;
    if(a>b) swap(a,b);
    k=a+b;
    if(k%2==1) cout << "IMPOSSIBLE" << endl;
    else{
        cout << k/2 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N;
    cin >> N;
    map<char,int> mp;
    vector<string> res;
    REP(i,N) {
        string S;
        cin >> S;
        res.push_back(S);
    }
    for(char c:res[0]) {
        if(mp.count(c)) mp[c]++;
        else mp[c] = 1;
    }
    for(int i = 1; i < N; i++) {
        map<char,int> mp2;
        for(char c:res[i]) {
            if(mp2.count(c)) mp2[c]++;
            else mp2[c] = 1;
        }
        for(auto x:mp2) {
            if(mp.count(x.first)) chmin(mp[x.first],mp2[x.first]);
            else mp.erase(x.first);
        }

        for(auto x:mp) {
            if(mp2.count(x.first)) chmin(mp2[x.first],mp[x.first]);
            else mp.erase(x.first);
        }
    }
    for(auto c: mp) {
        REP(i,c.second) cout << c.first;
    }
    cout << endl;
}

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

int solve(int n, int x){
  int count = 0;
  for(int i=1;i<=n-2;i++){
    for(int j=i+1;j<=n-1;j++){
      for(int k=j+1;k<=n;k++){
        if(i+j+k==x){
          ++count;
        }
      }
    }
  }
  return count;
}

int main(void){
  
  int n, x;
  while(true){
    cin >> n >> x;
    if(n==0 && x==0){break;}
    int ans = solve(n,x);
    cout << ans << endl;
  }
}



Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
 
int main(){
  int N,M;
  cin>>N>>M;
  VI A(N);
  rep(i,N) cin>>A[i];
  VI B(M),C(M);
  rep(i,M) cin>>B[i]>>C[i];
  sort(all(A));
  vector<PII> P(M);
  rep(i,M) P[i]=mp(C[i],B[i]);
  sort(all(P),greater<PII>());
  int cnt=0;
  ll ans=0;
  int F=0;
  rep(i,M){
    rep(j,P[i].second){
      if(cnt>=N or A[cnt]>=P[i].first){
        F=1;
        break;
      }else A[cnt]=P[i].first;
      cnt++;
    }
    if(F) break;
  }
  rep(i,N) ans+=A[i];
  cout<<ans<<endl;
}

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

int main(){
  int n, m; cin >> n >> m;
  int M[180000][2];
  vector<vector<int>> to(n);
  rep(i,m){
    int s, t; cin >> s >> t;
    s--; t--;
    to[s].push_back(t);
    M[i][0] = s; M[i][1] = t;
  }
  double A[605];
  A[n-1] = 0;
  for (int i=n-2; i>=0; i--){
    double E = 0;
    for (int j : to[i]) E += A[j] + 1;
    A[i] = E / to[i].size();
  }

  double ans = A[0];
  rep(i, n-1){
    if (to[i].size() <= 1) continue;
    double nextmax = 0;
    int t;
    for(int j: to[i]){
      if (A[j] > nextmax){
        nextmax = A[j];
        t = j;
      }
    }
    double B[605];
    for (int j=n-1; j>=0; j--){
      if (j > i){
        B[j] = A[j];
        continue;
      }
      int size = to[j].size();
      if (size > 1 && j == i) size --;
      double E = 0;
      for (int k: to[j]){
        if (j == i && k == t) continue;
        E += B[k] + 1;
      }
      B[j] = E / size;
    }
    ans = min(ans, B[0]);
  }
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 1408