akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.rbegin(), a.rend());
  ll ans = 0;
  int t = n-1;
  rep(i,n) {
    int lim = 2;
    if (i == 0) lim = 1;
    rep(j,lim) {
      if (t > 0) {
        ans += a[i];
        t--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3888
import sys
import math as mas

x,y,d=0,0,90
for t in sys.stdin:
	a,b=map(int,t.split(','))
	if a==b==0:break
	x+=a*mas.cos(mas.radians(d))
	y+=a*mas.sin(mas.radians(d))
	d-=b
print(int(x))
print(int(y))
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Measured memory_bytes: 7812
#include <cstdio>
#include <cstring>
#include <iostream>

const int MAXLEN = 20002;

char ground[MAXLEN];
int  height[MAXLEN];
int  mpuddle[MAXLEN];
int  ground_len;
int  height_len;

void get_ground_data()
{
  std::cin >> ground;
}

void init_data(void)
{
  ground_len = strlen(ground) +1;
  height_len = ground_len+1;
  for (int i=0; i<ground_len; i++) mpuddle[i] = 0;
}

void get_maxnmin(int *max, int *min)
{
  int t_max = height[0];
  int t_min = height[0];

  for (int i= 1; i < height_len; i++)
  {
    if ( height[i] > t_max ) t_max = height[i];
    if ( height[i] < t_min ) t_min = height[i];
  }

  *max = t_max;
  *min = t_min;
}

void calc_ground_height(void)
{
  int max, min, i;

  height[0] = 0;
  for (i=0; ground[i] != '\0'; i++)
  {
    int aa = (ground[i] == 47)? 1: (ground[i] == 92)? -1:0;
    height[i+1] = height[i] + aa;
  }

  get_maxnmin(&max,&min);

  for(i=0; i<height_len; i++) height[i] -= min;
  height[height_len] = -1;
}

void print_ground(void)
{
  int max, min,i;
  get_maxnmin(&max, &min);

  char map[max][height_len];

  for (i=0; i<ground_len; i++)
  {
    for (int j=0; j < max; j++) map[j][i] = ' ';
    int j = (height[i] > height[i+1])?height[i+1] : height[i];
    map[j][i] = ground[i];
  }

  for (int i=max-1; i>=0;i--)
  {
    map[i][ground_len] = '\0';
    std::cout<<i<<"\t"<<map[i]<<std::endl;
  }
}

void calc_puddle(void)
{

  for(int i=0; i<ground_len-1; i++)
  {
    int j, sq=0;

    if (mpuddle[i] == -1) continue; //計算済み領域は無視
    if (height[i] <= height[i+1] )  continue;      // いきなり平か上りの場合も無視
    
    for (j = i+1; height[i] >= height[j] ;j++)
    {
      if (j == ground_len-1 && height[i] > height[j])
      { //画面右端の処理
        sq = -2;
        for (int k = i+1; k < ground_len; k++) mpuddle[k] = 0;
        break;
      }
      
      sq += height[i]*2 -height[j] - height[j-1];
      if (height[i] == height[j]) break;
      mpuddle[j] = -1;
    }
    mpuddle[i] = sq/2;

  }
}

void print_result(void)
{
  int i, count=0, total=0;

  for (i=0; i<ground_len; i++)
  {
    if (mpuddle[i] >0){
      count++;
      total += mpuddle[i];
    }
  }
  
  std::cout<<total<<std::endl << count;
  for (i=0; i<ground_len; i++)
    if (mpuddle[i] >0)
      std::cout <<" "<<mpuddle[i];

  std::cout << std::endl;
}

int main(void)
{
  get_ground_data();
  init_data();

  calc_ground_height();

//  print_ground();

  calc_puddle();
  print_result();
}


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

string s;

bool judge()
{
	for(int i=0;i<s.length();i+=2)
		if(s[i]!='h'||s[i+1]!='i') return false;
	return true;
}

int main()
{
	cin >> s;
	if(s.length()%2) cout << "No" << endl;
	else
	{
		if(judge()) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
function main(input){
  const a = input.trim().split(' ');
  const n = parseInt(a[0], 10),
        m = parseInt(a[1], 10);
  let ans = Math.max(n+m, n-m, n*m);
  if(ans==0){
    console.log(0);
  }else{
    console.log(ans);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29480
import math

N = int(input())

result_set = []

for i in range(1, int(pow(N, 0.5)) + 1):
    if N % i == 0:
        result_set.append([i, N // i])

result = pow(10, 10)

for i in result_set:
    result = min(result, int(math.log10(max(i)) + 1))


print(result)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define printd(x) printf("%.12f\n", ans);
#define print(x) cout << (x) << endl;
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(void) {
    ll n, m;
    cin >> n >> m;

    vector<ll> vll = divisor(m);

    
    int use = 1;
    rep (i, vll.size()) {
        if (m / vll[i] >= n) use = vll[i];
    }

    cout << use << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        int time = 0;

        List<int> list = new List<int>();
        int count = 0;
        for(int i = 0; i<5;i++)
        {
            int a = int.Parse(Console.ReadLine());
            list.Add(a);
            if(a % 10 == 0)
            {
                count = count + 1;
            }
        }

        list.Sort((a, b) => a % 10 - b % 10);

        for (int i = 0; i < 5; i++)
        {
            if(i == count)
            {
                time = time + list[i];
            }
            else if (list[i] % 10 != 0)
            {
                time = time + ((list[i] / 10) * 10) + 10;
            }
            else
            {
                time = time + list[i];
            }
        }

            Console.WriteLine(time);

    }
}


Measured memory_bytes: 11220
#include<stdio.h>

int main(){

  int i,j,n,c[50],v[50],sa[50],sum=0;

  scanf("%d",&n);

  for(i=0;i<n;++i){
    scanf("%d",&v[i]);
  }
  for(i=0;i<n;++i){
    scanf("%d",&c[i]);
    sa[i] = v[i] - c[i];
    if(sa[i]>0){
      sum+=sa[i];
    }
  }

  printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    arc080b()
}

fun arc080b() {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val ans = Array<Array<Int>>(h) { Array<Int>(w) { 0 } }
    var color = 1
    var i = 0
    var j = 0
    var toRight = true
    for (nums in a) {
        repeat(nums) {
            ans[i][j] = color
            if (toRight) {
                j++
            } else {
                j--
            }
            if (toRight && j >= w) {
                j--
                i++
                toRight = false
            }
            if (!toRight && j < 0) {
                j++
                i++
                toRight = true
            }
        }
        color++
    }
    for (line in ans) {
        println(line.joinToString(" "))
    }
}

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

using namespace std;
int search_combination(vector<int> int_array,int target,int count,int combination);

int main(){
    double a,b;
    cin >> a >> b;
    int r = int(a)%int(b);
    printf("%d %d %.6lf\n",(int)(a/b),r,a/b);
    return 0;   
}



Measured memory_bytes: 3280
#include <cstdio>
typedef long long LL;

int main() {
	LL x, y;
	scanf("%lld %lld", &x, &y);
	int ans = 1;
	int tmp = 1;
	for(LL i = 2; ; ){
		if(x * i > y) break;
		ans = ++tmp;
		i *= 2;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int a,b,c,n,i;

	scanf("%d",&n);
	
	for(i=0;i<n;i++){
	
		scanf("%d %d %d",&a,&b,&c);

		if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b){
		printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}

	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

vector<ll> G[101010];
ll visited[3][101010];

typedef pair<pll, ll> plll;

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

    ll N, M;
    cin >> N >> M;
    REP(i, M){
    	ll v, u;
    	cin >> v >> u;
    	v--, u--;
    	G[v].push_back(u);
    }
    ll S, T;
    cin >> S >> T;
    S--, T--;

    REP(i, 3)REP(j, 101010) visited[i][j] = -1;
    queue<plll> qu;
    qu.push({{0, S}, 0});
    while(!qu.empty()){
    	auto state = qu.front();qu.pop();
    	ll tri = state.first.first;
    	ll ver = state.first.second;
    	ll dist = state.second;
    	REP(i, G[ver].size()){
    		ll next_ver = G[ver][i];
    		ll next_tri = (tri + 1)%3;
    		ll next_dist = dist + 1;
    		if(visited[next_tri][next_ver] != -1) continue;
    		visited[next_tri][next_ver] = next_dist;
    		qu.push({{next_tri, next_ver}, next_dist});
    	}
    }
    ll val = visited[0][T];
    cout << (val == -1 ? -1 : val/3) << endl;
    return 0;
}

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

string s;
ll ans;

void f(string n) {
    if (n.size() == s.size()) {
        bool th, fv, sv, less, pos = true;
        th = fv = sv = less = false;
        for (int i = 0; i < (int)n.size(); ++i) {
            if (n[i] == '3') th = true;
            if (n[i] == '5') fv = true;
            if (n[i] == '7') sv = true;

            if (n[i] < s[i]) less = true;
            else if (n[i] > s[i] && !less) {
                pos = false;
                break;
            }
        }

        if (th && fv && sv && pos) {
            // cout << n << '\n';
            ans++;
        }
    } else {
        bool pre = true;
        for (auto& i : n) {
            if (i != '0') pre = false;
        }

        if (pre) {
            n.push_back('0');
            f(n);
            n.pop_back();
        }
        for (char a = '3'; a <= '7'; a += 2) {
            n.push_back(a);
            f(n);
            n.pop_back();
        }
    }
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> s;
    f("");
    cout << ans;
}


Measured memory_bytes: 256
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class Main {

	class UnionFind{
		int[] pars;
		UnionFind(int n){
			pars = new int[n];
			for(int i=0; i<n; i++)
				pars[i] = i;
		}
		int getRoot(int x){
			return x==pars[x]?x:(pars[x] = getRoot(pars[x]));
		}
		boolean isSame(int x, int y){
			return getRoot(x) == getRoot(y);
		}
		void merge(int x, int y){
			pars[getRoot(x)] = getRoot(y);
		}
	}

	class Edge{
		int dist, e1, e2;
		Edge(int _e1, int _e2, int _d){
			this.dist = _d;
			this.e1 = _e1;
			this.e2 = _e2;
		}
	}

	class Cmp implements Comparator<Edge>{
		public int compare(Edge a, Edge b){
			return (a.dist < b.dist)?-1:(a.dist > b.dist)?1:0;
		}
	}

	Edge[] edges;
	int N, M;

	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			N = in.nextInt();
			M = in.nextInt();
			if(N==0 && M==0) return ;
			edges = new Edge[M];
			for(int i=0; i<M; i++){
				edges[i] = new Edge(in.nextInt()-1, in.nextInt()-1, in.nextInt());
			}
			System.out.println(solve());
		}
	}

	int solve(){
		int ans = Integer.MAX_VALUE;
		sort(edges, new Cmp());
		for(int i=0; i<M; i++){
			int mi = edges[i].dist, ma = 0, cnt=0;
			UnionFind uf = new UnionFind(N);
			for(int j=i; j<M; j++){
				if(!uf.isSame(edges[j].e1, edges[j].e2)){
					uf.merge(edges[j].e1, edges[j].e2);
					if(++cnt == N-1){
						ma = edges[j].dist;
						break;
					}
				}
			}
			if(cnt==N-1){
				ans = min(ans, ma - mi);
			}
			else{
				break;
			}
		}
		return ans==Integer.MAX_VALUE?-1:ans;
	}

	public static void main(String args[]){
		new Main().run();
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  for(int i=0; i<n+1; i++){
    cin >> a.at(i);
  }
  vector<int> b(n);
  for(int i=0; i<n; i++){
    cin >> b.at(i);
  }
  
  long count = 0;
  for(int i=0; i<n; i++){
    if(b.at(i) > a.at(i)){
      count += a.at(i);
      if(a.at(i+1) > (b.at(i) - a.at(i))){
        count += (b.at(i) - a.at(i));
        a.at(i+1) -= (b.at(i) - a.at(i));
      }
      else if(a.at(i+1) <= (b.at(i) - a.at(i))){
        count += a.at(i+1);
        a.at(i+1) = 0;
      }
    }
    
    else if(b.at(i) <= a.at(i)){
      count += b.at(i);
    }
  }
  cout << count << endl;
}


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, a, b, c, d, e; cin >> n >> a >> b >> c >> d >> e;
    ll mint = min(a, min(b, min(c, min(d, e))));
    cout << 4 + ((n + (mint - 1)) / mint) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int x,a,b,c;
	int ans=0;
	int i, j, k;
	scanf("%d%d%d%d",&a, &b, &c, &x);

	for (i = 0; i <= a; i++){
		for (j = 0; j <= b; j++){
			for (k = 0; k <= c; k++){
				int tmp = i * 500 + j * 100 + k * 50;
				if (tmp == x) ans++;
			}
		}
	}

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


Measured memory_bytes: 128
import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, a, b, c) = in.readLine.split(" ").map(_.toInt)
  val t = Iterator.continually(in.readInt)
    .take(n)
    .toArray

  val w = Array(a,b,c,0)

  val ans = {
    val enum = Array.ofDim[Int](n)
    var min = 10000000

    def evalute():Unit = {
      if(enum.toSet.count(_ != 0) < 3) {
        // println(enum.mkString(" "))
        return
      }
      var res = 0
      for(i <- 0 until 3) {
        var v = 0
        var isFirst = true
        for(j <- 0 until n if enum(j) == w(i)) {
          v += t(j)
          if(isFirst) isFirst = false
          else res += 10
        }
        res += (w(i) - v).abs
      }
      if(min > res) min = res
    }

    def bfs(cnt:Int):Unit = {
      if(cnt == n) evalute
      else {
        for(i <- 0 until 4) {
          enum(cnt) = w(i)
          bfs(cnt+1)
        }
      }
    }
    
    bfs(0)
    min
  }

  println(ans)
}

Measured memory_bytes: 48088
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;



int main(int argc, char* argv[])
{
    int p0[6]={2,1,5,0,4,3};  // E
    int p1[6]={3,1,0,5,4,2};  // W
    int p2[6]={4,0,2,3,5,1};  // N
    int p3[6]={1,5,2,3,0,4};  // S

    int a[6]={0};
    int i;
    for(i=0; i<6; i++) {
        scanf("%d", &a[i]);
    }

    int curr[6]={0,1,2,3,4,5};
    char str[105]={0};
    scanf("%s", str);
    int len=(int)strlen(str);
    for(i=len-1; i>=0; i--) {
        int next[6]={0};
        int k;
        for(k=0; k<6; k++) {
            if(str[i]=='E')      next[k]=p1[curr[k]];
            else if(str[i]=='W') next[k]=p0[curr[k]];
            else if(str[i]=='N') next[k]=p3[curr[k]];
            else                 next[k]=p2[curr[k]];
        }
        for(k=0; k<6; k++) curr[k]=next[k];
    }
    printf("%d\n", a[curr[0]]);

    return 0;
}



Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<vector<int>> a(n,vector<int>(3));
	rep(i,n) rep(j,3) cin >> a[i][j];
	vector<vector<int>> dp(n + 1, vector<int>(3));
	rep(i,n){
		rep(j,3){
			rep(k,3){
				if(j == k) continue;
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + a[i][k]);
			}
		}
	}
	int ans = 0;
	rep(i,3) ans = max(ans, dp[n][i]);
	cout << ans << endl;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pll pair < ll , ll >
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ld long double
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int s,v;
    cin >> s >> v;
    if(s<=v)
    {
        cout << "unsafe";
    }
    else
    {
        cout << "safe";
    }
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    int h,w;
    cin >>h >>w;
    vector<string> s(h);
    rep(i,h) cin >>s[i];

    int ans = 0;
    #define IN(x,y) (0<=x && x<w && 0<=y && y<h)
    for(int i=1; i<h; ++i)rep(j,w)
    {
        if(s[i][j]!='-') continue;

        int add = 1;
        // ??£?????????
        for(const auto &X:vector<int>({1,-1}))
        {
            int nx = j+X;
            if(IN(nx,i) && s[i][nx]!='-') add=0;
        }
        // 8???????????????
        for(int y=-1; y<=1; ++y)for(int x=-1; x<=1; ++x)
        {
            int nx = j+x, ny = i+y;
            if(IN(nx,ny) && s[ny][nx]=='x') add=0;
        }

        ans += add;
    }

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

Measured memory_bytes: 3176
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
}

Measured memory_bytes: 23892
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define vecin(n, a) rep(i, n)scanf("%d", &a[i])

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	char a;
	scanf("%c", &a);
	if (a == 'A') {
		printf("%c\n", 'T');
	}
	else if(a == 'T'){
		printf("%c\n", 'A');
	}
	else if (a == 'G') {
		printf("C\n");
	}
	else {
		printf("G\n");
	}

	Please AC;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<vector>
#include<set>
#define il inline
#define re register
using namespace std;
typedef double db;
const long long N=200010;
struct P{long long x,y;} a[N],s[N];
long long n,top=0,ans=0;
il P operator-(P a,P b){
    return (P){a.x-b.x,a.y-b.y};
}
il long long operator*(P a,P b){
    return a.x*b.y-a.y*b.x;
}
il long long dis(P a){
    return abs(a.x)+abs(a.y);
}
il bool cmp(P x,P y){
    if(abs((x-a[1])*(y-a[1]))>0) return (x-a[1])*(y-a[1])>0;
    return dis(x-a[1])<dis(y-a[1]);
}
il long long S(P a,P b,P c){
    return abs((a-b)*(a-c))/2;
}
int main(){
    scanf("%d",&n);
    for(long long i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    for(long long i=2;i<=n;i++)
        if(a[i].y<a[1].y||(a[i].y==a[1].y&&a[i].x<a[1].x)) 
            swap(a[1],a[i]);
    sort(a+2,a+n+1,cmp);
    top=2;s[1]=a[1];s[2]=a[2];
    for(long long i=3;i<=n;i++){
        while(top>1&&(a[i]-s[top-1])*(s[top]-s[top-1])>=0) top--;
        s[++top]=a[i];
    }
    for(long long i=0;i<top;i++)
        s[i]=s[i+1];
    n=top;
    for(long long i=0,j=2;i<n;i++){
        while(S(s[i],s[(i+1)%n],s[j])<S(s[i],s[(i+1)%n],s[(j+1)%n])) j=(j+1)%n;
        ans=max(dis(s[i]-s[j]),ans);
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 6948
N = int(input())
d = [0 for i in range(31)]
b = 0
if N % 2 == 0:
    for i in range(30):
        x = 30 - i
        y = 5**x
        a = (N//y)//2
        d[x] = a - b
        b = a
    ans = 0
    for i in range(1,31):
        ans += (d[i]*i)
else:
    ans = 0
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

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

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

long long gcd(long long a, long long b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

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

    if ((a == 'H' && b == 'H') || (a == 'D' && b == 'D')) {
        cout << 'H' << endl;
    } else {
        cout << 'D' << endl;
    }
    return 0;
}


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

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

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong W, H;
	char c;

	cin >> W >> H >> c;
	for(int h = 0; h < H; h++){
		for(int w = 0; w < W; w++){
			if(((h == 0 || h == H-1) && (w == 0 || w == W-1)))
				cout << '+';
			else if(h == 0 || h == H-1)
				cout << "-";
			else if(w == 0 || w == W-1)
				cout << "|";
			else if(h == H/2 && w == W/2)
				cout << c;
			else
				cout << ".";
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>
int main(int argc, const char *argv[]){
    int a,b,c=0;
    int x=0;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b){
        x = a;
        a = b;
        b = x;
    }
    if(a>c){
        x = a;
        a = c;
        c = x;
    }
    if(b>c){
        x = b;
        b = c;
        c = x;
    }
//    if(c<a){
//        x = c;
//        c = a;
//        a = x;
//    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

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

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    cout << (b/x-(a+x-1)/x+1) << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int test(char *str) {
    int i, e=0, len=strlen(str);
    for (i=0; i<len; i++) {
        if (str[i] == '(')
            e++;
        else
            e--;
        if (e < 0)
            return -1;
    }
    if (e != 0)
        return 1;
    else
        return 0;
}

void pushfront(char *str) {
    char abc[256];
    strcpy(abc, str);
    str[0] = '(';
    strcpy(str+1, abc);
}
void pushback(char *str) {
    int itr = strlen(str);
    str[itr] = ')';
    str[itr+1] = '\0';
}

int main() {
    int n, ret;
    char str[256];
    scanf("%d\n", &n);
    fgets(str, sizeof(str), stdin);
    str[n] = '\0';
    while ((ret = test(str)) != 0) {
        if (ret > 0)
            pushback(str);
        else
            pushfront(str);
    }
    printf("%s\n", str);
    return 0;
}

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

int main()
{
  double a,b;

  cin >> a >> b;

  if(a>b)
    cout << "GREATER" << endl;
  else if(a<b)
    cout << "LESS" << endl;
  else
    cout << "EQUAL" << endl;

  return 0;
}


Measured memory_bytes: 256
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const main = () => {
  const o = new AtCoder()
  let obj ={}
  let n=o.n()
  for(let i=0;i<n;i++){
    let s=o.s()
    if(obj[s]){
      o.o('NO')
      return
    }
    obj[s]=1;
  }
  o.o('YES')
}
main();

Measured memory_bytes: 65096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int d = a / b;
		int r = a % b;
		double f = (1.0 * a) / (1.0 * b);
		System.out.print(d+" "+r+" ");
		System.out.println(String.format("%.6f", f));
		sc.close();

	}
}


Measured memory_bytes: 26420
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
public class Main
{
	static Scanner sc=new Scanner(System.in);
	static final int MAX=100000+5;
	public static void main(String[] args)
	{
		String s=sc.next();
		int MIN=1000000000;
		for(int i=0;i<s.length()-2;i++)
		{
			int tot=0;
			for(int j=0;j<3;j++)
				tot=tot*10+s.charAt(i+j)-'0';
			MIN=Math.min(Math.abs(tot-753), MIN);
		}
		System.out.println(MIN);
	}
}

Measured memory_bytes: 21712
#include<stdio.h>
#include<string.h>
#define A 100000

typedef struct {
  char name[100];
  int time;
}pro;

pro que[A];
int head,tail,n;

void enter(pro );
pro out(void);
int minimam(int,int);

void enter(pro a)
{
  que[tail] = a;
  tail = (tail + 1) % A;
}

pro out(void)
{
  pro a = que[head];
  head = (head +1) % A;
  return a;
}

int minimam(int a,int b)
{
  return a < b ? a:b;
}

int main()
{
  int i,q,x,timed=0;
  pro cess;

  scanf("%d%d",&n,&q);
  
  head = 1;
  tail = n + 1;

  for(i=1;i<=n;i++) {
    scanf("%s%d",que[i].name,&que[i].time);
  }

  while(head != tail) {
    cess = out();
    x = minimam(q,cess.time);
    cess.time -= x;
    timed += x;
    if(cess.time > 0){
      enter(cess);
    }else{
      printf("%s %d\n",cess.name,timed);
    }
  }

  return 0;
}
      
    
    



Measured memory_bytes: 11852
#include<bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
int n,minn=inf,pos;
inline void read(int &x)
{
	int data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=(data<<3)+(data<<1)+(ch^'0'),ch=getchar();
	x=data*w;
}
int main()
{
	read(n);
	for(register int i=1;i<=n;++i)
	{
		int a,b;
		read(a);read(b);
		if(b<minn)
		{
			minn=b;
			pos=a;
		}
	}
	printf("%d\n",pos+minn);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long ans = Long.MAX_VALUE;
		for (long i=1; i*i<=N; i++) {
			if (N%i == 0) {
				ans = Math.min(ans, (i + N/i -2));
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
from collections import deque
# sts -> start topological sort   
def sts():
    for i in g:
        for j in i:
            incnt[j]+=1 
    for i in range(v):
        if incnt[i]==0:
            q.append(i)
    # Now start deleting elements
    while q:
        e=q.popleft()
        ans.append(e)
        for i in g[e]:
            incnt[i]-=1
            if incnt[i]==0:
                q.append(i)
    if len(ans)==v: print(0)
    else: print(1)

            
v,e=map(int,input().split())
g=[[] for i in range(v)]
# incnt -> no of indirected edges to a vertex
incnt=[0]*v
# q -> queue containing nodes with 0 indirected edges
q=deque()
# ans -> topological sorted array
ans=[]
for i in range(e):
    x,y=map(int,input().split())
    g[x].append(y)
sts()



Measured memory_bytes: 6008
fn main() {

    let v: Vec<i32> = read_vec();

    let ans = if (&v[0] * &v[1]) % 2 == 0 {
        "Even"
    } else {
        "Odd"
    };

    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

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

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

using namespace std;

int main() {
  int N, K; cin >> N >> K;
  map<int, int> mp;
  rep(i, N) {
    int a; cin >> a;
    mp[a]++;
  }
  vector<int> a;
  for (auto e: mp) {
    a.push_back(e.second);
  }
  sort(a.begin(), a.end());
  int U = a.size();
  U -= K;
  if (U <= 0) {
    cout << 0 << "\n";
  } else {
    int ans = 0;
    for (int i=0;i<U;i++) {
      ans += a[i];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 10748
#include <stdio.h>

int main(void)
{
	int rank[3] = {0,0,0};
	int data,i;
	
	for(i=0;i<10;i++){
		scanf("%d",&data);
	
		if(rank[0]<data){
			rank[2]=rank[1];
			rank[1]=rank[0];
			rank[0]=data;
		}else if(rank[1]<data){
			rank[2]=rank[1];
			rank[1]=data;
		}else if(rank[2]<data){
			rank[2]=data;
		}else{}
	}
	printf("%d\n%d\n%d\n",rank[0],rank[1],rank[2]);

	return 0;
}

Measured memory_bytes: 0
N=int(input())
xyh=[list(map(int,input().strip().split())) for _ in range(N)]

dp=[[-1 for i in range(101)] for j in range(101)]
for n in range(N):
    dp[xyh[n][0]][xyh[n][1]]=xyh[n][2]

def find_top(x,y,N,xyh):
    find=True
    prev=-1
    for n in range(N):
        if xyh[n][2]!=0:
            top=xyh[n][2]+abs(xyh[n][0]-x)+abs(xyh[n][1]-y)
            if prev==-1:
                prev=top
            else:
                if prev!=top:
                    find=False
                    break
    return find,top

def check_top(x,y,top,N,xyh):
    check=True
    for n in range(N):
        if xyh[n][2]==0:
            if top-abs(xyh[n][0]-x)-abs(xyh[n][1]-y)>0:
                check=False
                break
    return check

fin=False
for x in range(101):
    if fin==True:
        break
    for y in range(101):
        find=find_top(x,y,N,xyh)[0]
        height=find_top(x,y,N,xyh)[1]
        if find and height>=1 and check_top(x,y,height,N,xyh):
            print("{} {} {}".format(x,y,height))
            fin=True

Measured memory_bytes: 9264
N=int(input())
*A,=map(int,input().split())
*B,=map(int,input().split())
x=0
y=0
for i in range(N):
    if A[i]>B[i]:x+=A[i]-B[i]
    else:y+=B[i]-A[i]-(A[i]-B[i])%2
print('Yes' if x*2<=y else 'No')

Measured memory_bytes: 4596
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  

// type
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;

// define & const valur
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-9;
const double PI = M_PI; 
#define DIV int(1e9+7)
// for debug 
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
// useful func
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
 
/* Coding Space*/
const ll target = ll(1e12) * 2;
int main(){
  int r,g; cin >> r >> g;
  cout << 2*g - r<< endl;
}

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

using namespace std;

int main(){

    string s,t;
    int i=0,j=0,cont=0;

    cin >> s >> t;

    int stam=s.size();
    

    for(i=0;i<stam;i++){
            if(s[i]!=t[i]){
                cont++;
            }
        
    }
    
    cout << cont << endl;
    

    return 0;
}

Measured memory_bytes: 3924
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N;
std::vector<LL>a, ans;
std::map<LL, LL>cou1, cou2;

int main()
{
	in >> N;
	a.resize(N);
	rep(i, N) in >> a[i];
	LL diff = 0;
	rep(i, N)
	{
		if (cou1[a[i]] == cou2[a[i]]) --diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) --diff;
		++cou1[a[i]]; ++cou2[a[N - i - 1]];
		if (cou1[a[i]] == cou2[a[i]]) ++diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) ++diff;
		if (diff == 0) ans.push_back(i + 1);
	}
	rep(i, ans.size() - 1) out << ans[i] << " "; out << ans[ans.size() - 1] << std::endl;
	return 0;
}


Measured memory_bytes: 10008
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


void solve(std::string S){
  REP(i, (ll)S.size()){
    cout << 'x'; 
  } 
  cout << endl;
}

signed main(){
  std::string S;
  std::cin >> S;
  solve(S);
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#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 <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;

    vector< pair<int, string> > elem;
    for(int i=0; i<N; i++) {
        string s; int d; cin >> s >> d;
        elem.emplace_back(d, s);
    }
    sort(elem.begin(), elem.end());

    int M; cin >> M;
    int cur = 0, p = -1;
    for(int i=0; i<M; i++) {
        string s; cin >> s;
        while(cur < N) {
            if(elem[cur].first > p and elem[cur].second == s) {
                p = elem[cur].first;
                break;
            }
            cur++;
        }
        if(cur == N) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 12376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll n;
	cin>>n;
	ll ch[102];
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	ll ans=INF;
	for(ll i=0;i<=100;i++){
		ll cnt=0;
		for(ll j=0;j<n;j++){
			cnt+=(i-ch[j])*(i-ch[j]);
		}
		ans=min(ans,cnt);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);               \
    cout.tie(NULL)
#define int long long
#define endl '\n'
#define all(a)                   (a).begin(),(a).end()

#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))))

using namespace std;

const int N = 2e5 + 77;

int32_t main()
{
    fast;
    int n , mx = 0 , mn = 1e9;
    cin >> n ;
    vector<int> A(n);
    for(int &i : A){
        cin >> i;
        mx = max(mx,i);
    }
    int a = mx/2 , b = (mx+1)/2 , idx = -1;
    for(int &i : A){
        if(i!=mx && mn > min(abs(i-a),abs(i-b))){
            mn = min(abs(i-a),abs(i-b));
            idx = i;
        }
    }
    cout << mx << ' ' << idx << endl;
    return 0;
}

Measured memory_bytes: 3980
i = 0
while True:
    x, y = map(int, input().split())
    if x>0 or y>0 :
        list = [x, y]
        if list[0]>list[1]:
            list[0], list[1] = list[1], list[0]
        print(list[0],list[1])
        i = i + 1
    
    if x==0 and y==0:
        break


Measured memory_bytes: 5612
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a!=1 && b!=1) cout<<1<<endl;
    if(a!=2 && b!=2) cout<<2<<endl;
    if(a!=3 && b!=3) cout<<3<<endl;
    
    return 0;
}

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


vector<int> graph1[200010];
vector<int> graph2[200010];

pair<int, int> p[200010];
int visited[200010] = {};
int visited2[200010] = {};


void dfs1(int i, int num){
    if(visited[i] != 0){
        return;
    }

    visited[i] = num;
    p[i].first = num;

    for(int j = 0;j < graph1[i].size();j++){
        dfs1(graph1[i][j], num);
    }

    return;
}

void dfs2(int i, int num){
    if(visited2[i] != 0){
        return;
    }

    visited2[i] = num;
    p[i].second = num;

    for(int j = 0;j < graph2[i].size();j++){
        dfs2(graph2[i][j], num);
    }

    return;
}

int main(){
    int n;
    int k, l;
    cin >> n >> k >> l;

    map<pair<int, int>, int> mp;

    int s, t;
    for(int i = 0;i < k;i++){
        cin >> s >> t;
        s--; t--;
        graph1[s].push_back(t);
        graph1[t].push_back(s);
    }

    for(int i = 0;i < l;i++){
        cin >> s >> t;
        s--; t--;
        graph2[s].push_back(t);
        graph2[t].push_back(s);
    }

    int num = 1;
    for(int i = 0;i < n;i++){
        dfs1(i, num++);
        num++;
    }

    num = 1;
    for(int i = 0;i < n;i++){
        dfs2(i, num);
        num++;
    }

    for(int i = 0;i < n;i++){
        mp[p[i]]++;
    }

    for(int i = 0;i < n;i++){
        cout << mp[p[i]];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 29440
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
  typedef string str;
  typedef unsigned long long ull;
  ll INF = INT_MAX;
  // ll mod = 998244353;
  lld PI = 3.141592653;
 
// const int N = 2e5 + 5;
 
// int a[N];
// int n,k;
 
 
 
// void solve(){
 
// string s;
// cin>>s;
 
 
// }
 
 
 
  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
      
   int n;
   cin>>n;
   vector<int> a(n);
   // multiset<int> b;
   vector<int> b(1000005);
   for (int i = 0;i<n;i++) {cin>>a[i]; b[a[i]]++;}
    sort(a.begin(), a.end());
 
  vector<bool> dp(a[n-1]+10, true);
  for (int i = 0;i<n;i++){
    int v = a[i];
    if (dp[v]){
      // if (v*v<=a[n-1]+2){
        for (int j = v*2; j<= a[n-1]+2;j+=v) {dp[j] = false; }
      // }
    }
  }
  int ans = 0;
 
  for (int i = 0;i<n;i++){
    if (dp[a[i]] && b[a[i]]==1) {ans++; }
  }
  // cout<<endl;
cout<<ans<<"\n";
 
}
 

Measured memory_bytes: 7532