akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication2
{
    class Point
    {
        public double X
        {
            set; get;
        }

        public double Y
        {
            set; get;
        }

        public double Distance(Point p2)
        {
            double x = Math.Pow(X - p2.X, 2);
            double y = Math.Pow(Y - p2.Y, 2);
            return Math.Sqrt(x + y);
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            double[] datas = Console.ReadLine()
                             .Split(' ')
                             .Select(x => double.Parse(x))
                             .ToArray();
            var p1 = new Point()
            {
                X = datas[0],
                Y = datas[1],
            };

            var p2 = new Point()
            {
                X = datas[2],
                Y = datas[3],
            };

            Console.WriteLine(p1.Distance(p2));
        }
    }
}

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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    int k;
    scanf("%d %d %d" , &n , &m, &k);

    printf("%d %d %d\n" , k , n , m);

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 256
#define scanf_s scanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 30
int main(void)
{
	int w, n, a, b, x;
	int list[MAX] = { 0 };
	scanf_s("%d", &w);
	scanf_s("%d", &n);
	for (int i = 0; i < w;++i) {
		list[i] = i + 1;
	}
	for (int i = 0; i < n; ++i) {
		scanf_s("%d,%d", &a, &b);
		x = list[a - 1]; list[a - 1] = list[b - 1]; list[b - 1] = x;
	}
	for (int i = 0; i < w; ++i) {
		printf("%d\n", list[i]);
	}

}

Measured memory_bytes: 1188
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String alp[] = {"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"};
    boolean check = false;
    for(String aa: alp){
      if(aa.equals(s)){
        check = true;
        break;
      }
    }
    if(check){
      System.out.println("a");
    }else{
      System.out.println("A");
    }
  }
}


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

int main(){
  int N,a,count;
  cin >> N;
 for(int i=1;i<N+1;i++){ 
  cin >> a;
  if(a!=i){
  count++;
  }
 }
  if(count>2){
  cout<<"NO"<<endl;
  }
  else{
  cout<< "YES"<<endl;
  }

}


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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair
#define int long long
using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)3e5 + 7;

int n,m;
int p[N],sz[N];
int eq,up;
int e[1001][1001];
ll x,w,S,d,t[N];

vector <pair<ll,pair<int,int> > > vec;
vector <pair<ll,ll> > g[N];

int get (int v) {
      return (v == p[v] ? v : (p[v] = get(p[v])));
}
void unite (int a,int b) {
      a = get(a);
      b = get(b);

      if (a != b) {
            if (sz[a] < sz[b])
                  swap(a,b);
            p[b] = a;
            sz[a] += sz[b];
      }
}
void dfs (int v,int p = -1) {
      for (auto to : g[v]) {
            if (to.fr != p) {
                  t[to.fr] = max(t[v],to.sc);
                  dfs(to.fr,v);
            }
      }
}
int binpow (int a,int b) {
      int res = 1;
      while (b) {
            if (b & 1)
                  res *= a;
            a *= a;
            b /= 2;
            res %= inf;
            a %= inf;
      }
      return (res % inf);
}
main () {
      cin >> n >> m;
      cin >> x;

      for (int i = 1; i <= m; i ++) {
            int u,v;
            cin >> u >> v >> w;
            vec.pb({w,{u,v}});
      }
      sort (vec.begin(),vec.end());

      for (int i = 1; i <= n; i ++)
            p[i] = i,sz[i] = 1;

      for (int i = 0; i < vec.size(); i ++) {
            int a = vec[i].sc.fr;
            int b = vec[i].sc.sc;
            if (get(a) != get(b)) {
                  unite(a,b);
                  e[a][b] = 1;
                  e[b][a] = 1;
                  g[a].pb(mk(b,vec[i].fr));
                  g[b].pb(mk(a,vec[i].fr));
                  S += vec[i].fr;
            }
      }
      d = x - S;

      if (d < 0) {
            cout << "0";
            return 0;
      }
      for (int i = 0; i < vec.size(); i ++) {
            int u = vec[i].sc.fr;
            int v = vec[i].sc.sc;
            if (e[u][v])
                  continue;

            dfs(u);

            ll o = vec[i].fr - t[v];

            if (o == d)
                  eq ++;
            if (o > d)
                  up ++;

            for (int i = 1; i <= n; i ++)
                  t[i] = 0;
      }
      if (d == 0) {
            cout << (((binpow(2,n - 1) + inf - 2) % inf * 1ll * binpow(2,m - n + 1)) % inf + (((binpow(2,eq + 1) + inf - 2) % inf) * 1ll * binpow(2,up)) % inf) % inf << endl;
      }
      else {
            cout << (((binpow(2,eq + 1) + inf - 2) % inf) * 1ll * binpow(2,up)) % inf << endl;
      }
}


Measured memory_bytes: 20864
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    if n >= 30:
        print('Yes')
    else:
        print('No')
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 77284
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class ARightTriangle {
public:
	void solve(istream& in, ostream& out) {
        int a,b,c; in >> a >> b >> c;
        out << a * b / 2 << endl;
	}
};

int main() {
	ARightTriangle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

public class Main {
    private static class Sord {
        int a, b;

        public Sord(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }

    public void main(Scanner sc) {
        int n = sc.nextInt();
        int h = sc.nextInt();
        Sord s[] = new Sord[n];
        for (int i = 0; i < n; i++) {
            s[i] = new Sord(sc.nextInt(), sc.nextInt());
        }

        Arrays.sort(s, (o1, o2) -> o2.a - o1.a);
        int amax = s[0].a;

        Arrays.sort(s, (o1, o2) -> o2.b - o1.b);
        int cnt = 0;
        for (; cnt < n && s[cnt].b > amax; cnt++) {
            h -= s[cnt].b;
            if (h <= 0) {
                System.out.println(cnt + 1);
                return;
            }
        }

        System.out.println(cnt + (h + amax - 1) / amax);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 93232
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F         first
#define S          second
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define hell        1000000007
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 1e9
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 10000;


using namespace std;
void solve();

void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

bool comp(pair<ll,ll> a,pair<ll,ll> b);
bool comp(pair<ll,ll> a,pair<ll,ll> b){
  if(a.F!=b.F)
  return a.F<b.F;
  else
  return a.S<b.S;
}


void solve(){

  int n;
  cin>>n;
  int b[n-1];
  forn(i,0,n-1)
  cin>>b[i];

  int a[n];
  a[0]=b[0];
  a[n-1]=b[n-2];

  for(int i=1;i<=n-2;i++){
    a[i]=min(b[i-1],b[i]);
  }
  int sum=0;
  forn(i,0,n)
  sum+=a[i];
  cout<<sum;
}



///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1)%hell)*k%hell)%hell;
  else
  return ((pw(k,x/2)%hell)*(pw(k,x/2)%hell))%hell;
}

/*void sieve(){

  for(int i=2;i<=1000000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=1000000;j+=i)
      prime[j]=false;
    }
  }

}*/


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

#define REP(i,n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

 
 
int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n),b(n),c(n);
    
	REP(i, n){
        cin >> a[i] >> b[i] >> c[i];
        //cout << a[i] << b[i] << c[i] << endl;
    }

	ll maxi = 0;
    
    REP(i, 1 << 3) {
        //cout << i << endl;
        
        vector<ll> tmp(n);
        
		for(int j = 0;j < n;j++){

            ll tmp_x = 0;
            
            if(i >> 0 & 1){
                tmp_x += a[j];
             }else{
                tmp_x += -a[j];
             }

            if(i >> 1 & 1){
                tmp_x += b[j];
            }else{
                tmp_x += -b[j];
            }
            
            if(i >> 2 & 1){
                tmp_x += c[j];
            }else{
                tmp_x += -c[j];
            }

            tmp[j] = tmp_x;
            
        }
        
		sort(tmp.begin(), tmp.end(),greater<ll>());
		ll sum = 0;
        REP(j, m){
            sum += tmp[j];
        }
        maxi = max(maxi, sum);
        
	}
	cout << maxi << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int MOD = 1000000007;
const int INF = 1 << 30;

ll dp[105][100005];
int w[105],v[105];

int main(){
  int N,W; cin >> N >> W;
  
  rep(i,N){
    cin >> w[i] >> v[i];
  }
  
  rep(i,N){
    rep(sum_w,W+1){
      //w[i]を選べる時
      if(sum_w - w[i] >= 0){
        chmax(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);
      }
      //w[i]を選ばない時
      chmax(dp[i+1][sum_w],dp[i][sum_w]);
    }
  }
  
  
  cout << dp[N][W] << endl;
  
  return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;++i)
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int inc ;
	cin >> inc;
	string s;
	cin >> s;
	int n = s.length();
	char sen[n];
	rep(i,n){
		char temp = s[i];
		int increase = inc+int(temp)-int('Z');
		if(increase >0){
			sen[i]=char(int('A')+increase-1);
		}else{
			sen[i]=char(int(temp)+inc);
		}
		cout << sen[i];
	}
	cout << endl;	
	return 0;

}


Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
      string input = Console.ReadLine();
      char[] c = input.ToCharArray();
      int len = c.Length;
      if(len == 3)
      {
        if(c[0] == c[2]) Console.WriteLine("Yes");
        else Console.WriteLine("No");
        return;
      }
      
      for(int i = 0; i < (double)(len - 1) / 4; i++)
      {
        if(c[i] != c[len - 1 - i] || c[i] != c[(len - 1)/2 - i - 1] || c[i] != c[(len + 3)/2 + i - 1])
        {
          Console.WriteLine("No");
          return;
        }
      }
      Console.WriteLine("Yes");
	}
}




Measured memory_bytes: 11092
fn entrance_examination() -> Result<f32, &'static str> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input)
        .map_err(|_| "input error")?;
    let tx: Vec<f32> = input.trim_right().split_whitespace()
        .filter_map(|s| s.parse::<f32>().ok())
        .collect();
    Ok(tx[0] / tx[1])
}

fn main() {
    println!("{}", entrance_examination().unwrap());
}

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

int main() {
    int A, B, C, N;
    cin >> A >> B >> C >> N;

    int count = 0;
    for (int a = A; a >= 0; a--){
        int n = N - 500 * a;
        if (n < 0) {
            continue;
        } else {
            for (int b = B; b >= 0; b--){
                n = N - 500 * a - 100 * b;
                if (n < 0 || n % 50 != 0 || n / 50 > C) {
                    continue;
                } else {
                    count++;
                }
            }
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
void ABC162B()
{
	int N;
	cin >> N;
	ll sum = 0;
	for (int i = 1; i <= N; ++i)
	{
		if (i % 5 != 0 && i % 3 != 0)
		{
			sum += (ll)i;
		}
	}
	cout << sum << endl;
}
int main()
{
	ABC162B();
	return 0;
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;



int main() {

    double L; cin >> L;
    L /= 3;
    printf("%.9f\n", L * L * L);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n;
  cin>>n;
  double cnt=0.00;
  rep(i,n) {
    double a;
    string s;
    cin>>a>>s;
    if(s=="JPY") cnt+=a;
    else cnt+=380000.0*a;
  }
  cout<<(double)cnt<<endl;
}

Measured memory_bytes: 256
import sys
from collections import Counter

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
cnt = Counter(input() for _ in range(n))
macnt = max(cnt.values())
names = [k for k, v in cnt.items() if v == macnt]
names.sort()
print(*names, sep='\n')


Measured memory_bytes: 36796
n = int(input())
a = [int(x) for x in input().split()]
MOD = 10**9 + 7

suma = [0]

for aa in a:
    suma.append((suma[-1] + aa)%MOD)

ans = 0
for i, aa in enumerate(a[:-1]):
    ans += (aa % MOD) * ((suma[-1] - suma[i+1])%MOD)
    ans %= MOD
print(ans)

Measured memory_bytes: 31668
import sys

class UFT(): #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b: return
        if self.rank[a] < self.rank[b]: self.tree[a] = b
        else:
            self.tree[b] = a
            if self.rank[a] == self.rank[b]: self.rank[a] += 1



def solve():
    input = sys.stdin.readline
    N, M, K = map(int, input().split())
    parent = UFT(N)
    connect = dict()
    NG = [0] * N
    friend = [0] * N
    for _ in range(M):
        x, y = map(int, input().split())
        parent.unite(x-1, y-1)
        friend[x-1] += 1
        friend[y-1] += 1
    for i in range(N):
        key = parent.find(i)
        if key in connect: connect[key] += 1
        else: connect[key] = 1
    for _ in range(K):
        c, d = map(int, input().split())
        if parent.find(c-1) == parent.find(d-1):
            NG[c-1] += 1
            NG[d-1] += 1
    Ans = [0] * N
    for i in range(N):
        Ans[i] = connect[parent.find(i)] - friend[i] - NG[i] - 1
    print(" ".join(map(str, Ans)))

    return 0

if __name__ =="__main__":
    solve()

Measured memory_bytes: 26032
#include <bits/stdc++.h>
	
using namespace std;
inline void FAST_IO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

template<class F, class S> ostream& operator<<(ostream& os, pair<F, S> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template<class T, class S> ostream& operator<<(ostream& os, map<T, S> &v) {
	os << "{";
	for(auto &i : v) cout << "{" << i.first << "," << i.second << "}";
	os << "}";
	return os;
}

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

/*----------------------------------------------------------------------------*/


long long tb[11][10][2];
vector<int> num;

long long dp(int i, int last, bool check) {
	if (i == -1) return 1;

	long long resp = 0;
	if (!check) {
		resp += (last + 1 <= 9) ? dp(i - 1, last + 1, check) : 0;
		resp += dp(i-1, last, check && (last == num[i]));
		resp += (last - 1 >= 0) ? dp(i - 1, last - 1, check) : 0;
	} else {
		resp += (last + 1 <= num[i]) ? dp(i - 1, last + 1, check && (num[i] == last + 1) ) : 0;
		resp += (last <= num[i]) ? dp(i-1, last, check && (last == num[i])) : 0;
		resp += (last - 1 >= 0 && last - 1 <= num[i]) ? dp(i - 1, last - 1, check && (num[i] == last - 1) ) : 0;
	}

	return resp;	
}

int main (){
	// FAST_IO();

	long long k ;
	cin >> k;

	auto check = [&](long long j) {
		if (j == 0) return 0LL;
		num.clear();
		while(j) {
			num.push_back(j%10);
			j /= 10;
		}
		long long resp = 0;
		for (int j = num.size() - 1; j >= 0; --j) {
			bool init = j == num.size() - 1;
			for (int i = 1; i <= (init ? num.back() : 9); ++i) {
				resp += dp(j-1, i, init && i == num.back());
			}
		}

		return resp;
	};

	long long lo = 0;
	long long hi = 3234566667LL;
	while(lo < hi) {
		long long mid = (lo + hi)/2;
		if (check(mid) < k) lo = mid + 1;
		else hi = mid;
	}

	cout << lo << endl;

	return 0;
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int in_max = max(a, max(b, c));
    int in_min = min(a, min(b, c));
    cout << in_max - in_min << endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int n;
	cin >> n;
	ll a[n];
	FOR(i,n) cin >> a[i];
	sort(a,a+n);
	int ans=1;
	ll sum[n];
	
	FOR(i,n-1){
		sum[i]=(i>0) ? sum[i-1]+a[i] : a[i];
	}
	int i=n-2;
	while(i>-1 && 2*sum[i]>=a[i+1])i--;
	cout << n-i-1;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;


class Main { //クラス名はMain
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
      int a = s.nextInt();
      int b = s.nextInt();
      if(a%3==0 || b%3==0 || (a+b)%3==0){
        System.out.println("Possible");
      }else{
        System.out.println("Impossible");

      }
    }
}


Measured memory_bytes: 22996
def main():
    word = list(input())
    dp = [0] * len(word)
    dp[0] = 1
    dp[1] = 1
    if word[0] != word[1]:
        dp[1] = 2
    for i in range(2, len(word)):
        if word[i] != word[i - 1]:
            dp[i] = dp[i - 1] + 1
        else:
            dp[i] = dp[i - 3] + 2
    print(dp[len(word) - 1])


if __name__ == '__main__':
    main()



Measured memory_bytes: 12580
// A. 

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
	string s;
	cin >> s;
	int cnt[256] = {};
	for (char c : s) {
		cnt[c] += 1;
	}
	bool ans = (cnt['N'] > 0 == cnt['S'] > 0) && (cnt['W'] > 0 == cnt['E'] > 0);
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, b[2 * 100000 + 1] = {};
    cin >> n;
    for (int i = 2; i <= n; ++i) {
        int a;
        cin >> a;
        b[a] += 1;
    }
    for (int i = 1; i <= n; ++i) cout << b[i] << '\n';
    return 0;
}


Measured memory_bytes: 4440
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    int N;
    string s, t;
    int ans = 0;
    
    cin >> N;
    cin >> s;
    cin >> t;
    
    for ( int i = 0; i < N; i++ ) {
        // cout << s.substr( N-1-i, i+1 )  << endl;
        // cout << t.substr( 0, i+1 )  << endl;
        
        if ( s.substr( N-1-i, i+1 ) == t.substr( 0, i+1 ) ) {
            ans = i+1;
        }
    }
    
    cout << 2*N-ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int q[6][3];
int main()
{
	int i,j,n,s,m,a,b,p=1;
	while(cin>>s)
	{
		a=0;b=0;
		if(s==0)break;
	for(i=1;i<=s;i++)
	{
		cin>>n>>m;
		if(n>m)a=a+n+m;
		else if(n<m)b=b+n+m;
		else
		{
			a=a+n;
			b=b+m;
		}
	}
	q[p][1]=a;
	q[p][2]=b;
	p++;
    }
    for(i=1;i<p;i++)cout<<q[i][1]<<" "<<q[i][2]<<endl;
	return 0;
}

Measured memory_bytes: 3052
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
 
   int x = sc.nextInt();
   if(x<1200) {
	   System.out.println("ABC");
   }
   else {
	   System.out.println("ARC");
   }
  }
}

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

bool ans = true;
bool fs[256],ft[256];
unsigned char g[256];
unsigned char x, y;
string s, t;

int main()
{
	for (size_t i = 0; i < 256; i++)
	{
		fs[i] = false;
		ft[i] = false;
	}
	cin >> s;
	cin >> t;
	while (!s.empty())
	{
		x = s.back();
		y = t.back();
		s.pop_back();
		t.pop_back();
		if (fs[x] || ft[y])
		{
			if (fs[x] && ft[y])
			{
				if (g[x] != y)
				{
					ans = false;
				}
			}
			else
			{
				ans = false;
			}
		}
		else
		{
			fs[x] = true;
			ft[y] = true;
			g[x] = y;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
}

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

using namespace std;

int main()
{
    ll n;
    scanf("%lld",&n);
    ll ac=0,tle=0,wa=0,re=0;
    
    while(n--){
        string s;
        cin>>s;
        if(s[0]=='W') wa++;
        else if(s[0]=='T') tle++;
        else if(s[0]=='R') re++;
        else if(s[0]=='A') ac++;
    }
    
    printf("AC x %lld\nWA x %lld\nTLE x %lld\nRE x %lld\n",ac,wa,tle,re);

    return 0;
}

Measured memory_bytes: 3764
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

N = int(input())
A = list(map(int, input().split()))
S, s = sum(A), (N+1)*N//2
if S % s:
    print('NO')
else:
    k = S//s
    B = [A[i+1]-A[i]-k for i in range(N-1)]+[A[0]-A[N-1]-k]
    for b in B:
        if b > 0 or b % N:
            print('NO')
            exit()
    print('YES')


Measured memory_bytes: 14644
// ______________________________Hello man,I hope you enjoy this shit_________________________
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<complex>
#include<cstring>
#include<string>
#include<algorithm>
#include<assert.h>
#include<vector>
#include<stack>
#include <utility>
#include<set>
#include<bitset>
#include<queue>
#include<map>
#include<valarray>
#include<numeric>
using namespace std;
const int OO = 1 << 24;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> point;
#define all(v) ((v).begin()),((v).end())
#define rep(i,n) for(int(i)=0;(i)<(int)n;(i)++)
#define clr(v,idx) memset(v,idx,sizeof(v));
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pis pair<int,string>
#define scl(x) scanf("%lld",&x)
#define sc(x)  scanf("%d",&x)
# define mark  cout << fixed<<setprecision(15);
#define max3(a,b,c) max(a,max(b,c));
#define min3(a,b,c) min(a,min(b,c));
#define MOD 1000000007;
//const int dx[] = {1,-1,0,0,1,-1,1,-1};
//const int dy[] = {0,0,1,-1,1,-1,-1,1};
//const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
//const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}
struct unionFind {
	vi rank, parent;
	int forests;
	unionFind(int nodes) {
		rank = vi(nodes + 1), parent = vi(nodes + 1);
		forests = nodes;
		for (int i = 0; i <= nodes; i++)parent[i] = i, rank[i] = 1;
	}
	int find_parent(int x) {
		if (x == parent[x])return x;
		return parent[x] = find_parent(parent[x]);
	}
	void merge(int x, int y) {
		if (rank[x] > rank[y])swap(x, y);
		parent[x] = y;
		if (rank[x] == rank[y])rank[y]++;
	}
	bool union_sets(int x, int y) {
		x = find_parent(x), y = find_parent(y);
		if (x != y) {
			merge(x, y);
			forests--;
		}
		return x != y;
	}
};

struct edge {
	int from, to, w;
	edge(int from, int to, int w) :from(from), to(to), w(w) {};
	bool operator < (const edge & e)const {
		return w > e.w;
	}
};
bool comp(edge a, edge b) {
	return a.w < b.w;
}
pair<int, vector<edge> > MST_kruskal(vector<edge>list, int nodes) {
	unionFind uf(nodes);
	vector<edge>edges;
	int mstCost = 0;
	rep(i, list.size()) {
		edge e = list[i];
		if (uf.union_sets(e.from, e.to))
			mstCost += e.w, edges.push_back(e);
	}
	//if (uf.forests != 1)return make_pair(-OO, vector<edge>());
	return{ mstCost,edges };
}
int second(vector<edge>list, int nodes, int skip) {
	unionFind u(nodes);
	int cost = 0, taken = 0;
	rep(i, list.size()) {
		if (i != skip && u.union_sets(list[i].from, list[i].to))
			cost += list[i].w, taken++;
	}
	if (u.forests != 1)return OO;
	return cost;
}

int main()
{
	ll x, t; cin >> x >> t;
	cout << max(0LL, x - t);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
const int N=105;
int hx[N<<1];
 
inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}
 
int main(){
#ifndef ONLINE_JUDGE
//	freopen("a.in","r",stdin);
#endif
	int n=nxi(),ans=0;
	for(int i=1;i<=n<<1;++i){
		hx[i]=nxi();
	}
	std::sort(hx+1,hx+(n<<1)+1);
	for(int i=1;i<n<<1;i+=2){
		ans+=hx[i];
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3704
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
r = 0
# while r < N:
ans = 0
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        ans += 1
print(ans)



Measured memory_bytes: 5684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    string s, t;
    cin >> s >> t;

    int ssize = s.size();
    int tsize = s.size();

    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<int>());

    if(s < t) p("Yes")
    else p("No");
}


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

long long A[100010];

int main(){
  int N;
  cin >> N;
  bool zero = 0;
  for(int i =0; i < N; i++){
    cin>> A[i];
    if(A[i] == 0) zero = 1;//boolがtrue
  }
  if(zero){
    cout << 0 << endl;
    return 0;
  }
  
  long long prod = 1;
  for(int i=0; i<N; i++){
    if(A[i] <= 1000000000000000000 / prod){
      //A[i]が10^18以下の時。書き換えるとprod * A[i] <= 100000000000000000
      prod *= A[i];
    }
    else{
      cout << -1 <<endl;
      return 0;
    }
  }
  
  cout << prod << endl;
    
  
  
}

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

class Fraction {
public:
    long long a, b;
    Fraction(int a, int b) : a(a), b(b) {};
    Fraction operator-(const Fraction f) {
        return Fraction(a * f.b - f.a * b, b * f.b);
    }
    bool operator==(const Fraction f) {
        return a * f.b == f.a * b;
    }
    bool operator<(const Fraction f) {
        return a * f.b < f.a * b;
    }
};

Fraction abs(Fraction f) {
    f.a = abs(f.a);
    f.b = abs(f.b);
    return f;
}

int main() {
    int n;
    while (cin >> n, n) {
        int best = -1, i, h, w;
        Fraction mn(10000, 1);
        for (int k=0; k<n; ++k) {
            cin >> i >> h >> w;
            Fraction dif = abs(Fraction(22, 1) - Fraction(w*10000, h*h));
            if (dif < mn || (dif == mn && i < best)) {
                mn = dif;
                best = i;
            }
        }
        cout << best << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
    set<int> s;
    int n;
     cin>>n;
    rep(i,n){
        int a;
        cin >> a;
        s.insert(a);
    }
    cout<<s.size()<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>


using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;

void div(vi&p, int x)
{
	for(int i=2;i<=x;i++)
	{
		if(x%i==0)
		{
			x/=i;
			p[i]++;
			i--;
		}
	}
	return;


	for(int i=2;i*i<=x;i++)
	{
		if(x%i==0)
		{
			for(;x%i==0;x/=i)
			{
				p[i]++;
			}
		}
	}
	if(x>1) p[x]++;
}


int nCr(int n, int r)
{
	int ret=1;

	if(r>n) return 0;

	for(int i=0;i<r;i++)
	{
		ret=ret*(n-i)/(i+1);
	}
	return ret;
}


int main(void)
{
	int n;
	vvi pat={{4,4,2},{14,4},{24,2},{74}};

	while(scanf("%d", &n)==1)
	{
		vi p(n+1);

		for(int i=2;i<=n;i++)
		{
			div(p, i);
		}

		int ans=0;

		{
			int m2=0;
			int m4=0;
			for(int i=p.size()-1;i>=0;i--)
			{
				if(p[i]>=4) m4++;
				else if(p[i]>=2) m2++;
			}
			ans+=nCr(m4, 2)*m2+nCr(m4, 3)*3;
		}
		{
			int m14=0, m4=0;
			for(int i=p.size()-1;i>=0;i--)
			{
				if(p[i]>=14) m14++;
				else if(p[i]>=4) m4++;
			}
			ans+=m14*m4+nCr(m14, 2)*2;
		}
		{
			int m24=0, m2=0;
			for(int i=p.size()-1;i>=0;i--)
			{
				if(p[i]>=24) m24++;
				else if(p[i]>=2) m2++;
			}
			ans+=m24*m2+nCr(m24, 2)*2;
		}
		{
			int m74=0;
			for(int i=p.size()-1;i>=0;i--)
			{
				if(p[i]>=74) m74++;
			}
			ans+=m74;
		}
		
		printf("%d\n", ans);
if(0)
{
		for(int i=0;i<p.size();i++)
		{
			if(p[i]>0) printf("%d:%d ", i, p[i]);
		}
		printf("\n");
}
	}
	return 0;
}


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

int main(){
  long long int n,i,j,k,base=1,kotae=0;
  cin>>n;
  long long int c0[61],c1[61];
  for(i=0;i<61;i++){
    c0[i]=0;
    c1[i]=0;
  }
  for(i=0;i<n;i++){
    cin>>k;
    for(j=0;k>0;j++){
      if(k%2==1){
        c1[j]++;
      }else{
        c0[j]++;
      }
      k/=2;
    }
    for(;j<61;j++){
      c0[j]++;
    }
  }
  for(i=0;i<61;i++){
    kotae=(kotae+c0[i]*(c1[i]*(base%1000000007)%1000000007))%1000000007;
    base*=2;
  }
   cout<<kotae; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
int dp[100000][3]={};
ll dp2[300000][60]={};
int main() {
	int n;
	int kai[8]={5040,720,120,24,6,2,1,0};
	cin>>n;
	int a=1;
	int b=1;
	int p[8],q[8];
	rep(i,n){
		cin>>p[i];
		int a1=p[i];
		rep(j,i+1){
			if(p[j]<p[i])a1--;
		}
		a+=(a1-1)*kai[i+8-n];
	}
	rep(i,n){
		cin>>q[i];
		int b1=q[i];
		rep(j,i){
			if(q[j]<q[i])b1--;
		}
		b+=(b1-1)*kai[i+8-n];
	}
	printf("%d",abs(b-a));
	return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>

using namespace std;
typedef long long ll;
typedef double db;
#define inf 0x3f3f3f3f
vector<string>te;
int a[8][8];
int b[8][8];
vector<vector<int>>x;
vector<vector<int>>y;
vector<int>t;
int n, m, k;
string s;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
void cp() {
	int i, j;
	for (i = 0; i < n; ++i)for (j = 0; j < m; ++j)b[i][j] = a[i][j];
}
bool solve() {
	int i, j, ans = 0;
	for (i = 0; i < n; ++i)for (j = 0; j < m; ++j)ans += b[i][j];
	if (ans == k)return 1;
	return 0;
}
int main() {
	cin >> n >> m >> k;
	int i, j;
	for (i = 0; i < n; ++i) {
		cin >> s;
		te.push_back(s);
	}
	for (i = 0; i < n; ++i) {
		for (j = 0; j < m; ++j) {
			if (te[i][j] == '#')a[i][j] = 1;
		}
	}
	for (i = 0; i < n; ++i)t.push_back(0);
	int nn = pow(2, n);
	x.push_back(t);
	for (i = 1; i < nn; ++i) {
		++t[0];
		int cnt = 0;
		while (t[cnt] > 1) {
			t[cnt] -= 2;
			t[++cnt] += 1;
		}
		x.push_back(t);
	}
	t.clear();
	for (i = 0; i < m; ++i)t.push_back(0);
	int mm = pow(2, m);
	y.push_back(t);
	for (i = 1; i < mm; ++i) {
		++t[0];
		int cnt = 0;
		while (t[cnt] > 1) {
			t[cnt] -= 2;
			t[++cnt] += 1;
		}
		y.push_back(t);
	}
	int ii, jj, tt, ans = 0;
	for (i = 0; i < nn; ++i) {
		for (j = 0; j < mm; ++j) {
			cp();
			for (ii = 0; ii < n; ++ii) {
				if (x[i][ii] == 1) {
					for (tt = 0; tt < m; ++tt) {
						b[ii][tt] = 0;
					}
				}
			}
			for (ii = 0; ii < m; ++ii) {
				if (y[j][ii] == 1) {
					for (tt = 0; tt < n; ++tt) {
						b[tt][ii] = 0;
					}
				}
			}
			if (solve())++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4116
#include <stdio.h>
int main(void)
{
	int H,W,i,j;
	while(1)
	{
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)
		{
			break;
		}
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				if (i%2!=0&&j%2!=0)
				{
					printf("#");
				}
				else if (i % 2 == 0 && j % 2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	} 

	return 0;
}

Measured memory_bytes: 572
#include<cstdio>
#include<iostream>

using namespace std;

int num[10]={0};

int solve(int a,int b){
	int cnt=0;
	if(b==0&&a==0) return 1;
	if(b<0||a<0) return 0;

	for(int i=0;i<10;i++){
		if(num[i]==0){
			num[i]=1;
			cnt+=solve(a-1,b-i);
			num[i]=0;
		}
	}
	return cnt;
}

int kaizyo(int a){
	if(a==0) return 1;
	return kaizyo(a-1)*a;
}

int main(void){

	int n,s;

	while(1){
		cin>>n>>s;
		if(n==0&&s==0) break;
		cout<<solve(n,s)/kaizyo(n)<<endl;;
	}

	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    int j=1;
    for(int i=0; i<n; i++)
        if(a[i]==j) j++;
    if(j==1) cout<<-1<<endl;
    else if(j==n+1) cout<<0<<endl;
    else cout<<n-j+1<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int A[1000];
  for(int i = 0; i< n;i++){
      cin >>A[i] ;
    cout << A[i];
         if(i!=n-1)cout << ' ';
  }
  cout << endl;
  for(int j=1; j<n;j++){
      int v, k;
      v = A[j];
      k = j-1;
      while(k>=0 && A[k] > v){
          A[k+1]= A[k];
          k--;
      }
      A[k+1] = v;
      for(int i = 0; i<n;i++){
          cout << A[i];
                if(i!=n-1)cout << ' ';
      }
      cout << endl;
  }
}


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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L, R;
  L = A + B;
  R = C + D;
  
  if (L > R)
    cout << "Left" << endl;
  else if (L < R)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; i++) {
        cin >> d.at(i);
    }
    sort(d.begin(), d.end(), greater<int>());

    int cnt = 1;
    int current = d.at(0);
    for(int i = 1; i < N; i++) {
        if(d.at(i) < current) {
            cnt++;
            current = d.at(i);
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#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>;

// 0-1BFS o(H*W)

const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
  int h, w;
  cin >> h >> w;
  int si, sj;
  cin >> si >> sj;
  int ti, tj;
  cin >> ti >> tj;
  --si;
  --sj;
  --ti;
  --tj;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  const int INF = 1e9;
  vector<vector<int>> dist(h, vector<int>(w, INF));
  deque<P> q;
  dist[si][sj] = 0;
  q.emplace_back(si, sj);
  while (!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop_front();
    int d = dist[i][j];
    rep(v, 4) {
      int ni = i + di[v], nj = j + dj[v];
      if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      if (s[ni][nj] == '#') continue;
      if (dist[ni][nj] <= d) continue;
      dist[ni][nj] = d;
      q.emplace_front(ni, nj);
    }
    for (int ei = -2; ei <= 2; ++ei) {
      for (int ej = -2; ej <= 2; ++ej) {
        int ni = i + ei, nj = j + ej;
        if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
        if (s[ni][nj] == '#') continue;
        if (dist[ni][nj] <= d + 1) continue;
        dist[ni][nj] = d + 1;
        q.emplace_back(ni, nj);
      }
    }
  }
  int ans = dist[ti][tj];
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9528
n,m=map(int,input().split())

import sys
sys.setrecursionlimit(10**9) #再帰の上限をあげる

root=[-1 for i in range(n+1)] #自分が親ならグループの人数のマイナス倍を、そうでないなら（元）親の番号を示す
dep=[1]*(n+1)
def r(x):   #親は誰？
    if root[x]<0:
        return x
    else:
        root[x]=r(root[x])
        return root[x]

def unite(x,y):
    x=r(x)
    y=r(y)
    if x==y:
        return
    if dep[x]==dep[y]:
        dep[x]+=1
    if dep[x]<dep[y]:
        x,y=y,x
    root[x]+=root[y]
    root[y]=x

for i in range(m):
    x,y,z=map(int,input().split())
    unite(x,y)


g=[0]*(n+1)
for i in range(1,n+1):
    g[r(i)]+=1
ans=0
for i in range(n+1):
    if g[i]>0:
        ans+=1
print(ans)



Measured memory_bytes: 81564
#include<bits/stdc++.h>
#define mod 1000000007
//#define mx 300005
//#define y 3
using namespace std;
typedef  long long int ll;
#define  f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back

void input(){
  int n; cin >>n;cout<< (n - 2) * 180 <<endl;
}
int main(){
    input();
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;

    cin >> s;

    int i;

    rep(i, 3) {
        if (s[i] == '1') cout << '9';
        else cout << '1';
    }

    cout << End;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long k,x,n,t,i;
  cin>>k>>x;
  n=k;
  t=x;
  long long a[2*k-1];
  a[0]=x;
for(i=1;i<n;i++)
{
  a[i]=x+i;
}
  for(i=n;i<((2*k)-1);i++)
  {
    t--;
    a[i]=t;
  }
  sort(a,a+((2*k)-1));
  for(i=0;i<(2*k)-1;i++)
  {
    cout<<a[i]<<" ";
  }
}

Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val x = in.readLine().toLong

    var current = 100L
    var years = 0

    while (current < x) {
      current = (current * 1.01).toLong
      years += 1
    }

    out.println(years)
    out.flush()
  }
}


Measured memory_bytes: 54648
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void a_abc_arc(void) {
	int x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

int main()
{
    a_abc_arc();
    return 0;
}

Measured memory_bytes: 3508
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  ll N;
  cin>>N;
  cout<<N*N*N<<endl;

  return 0;
}


Measured memory_bytes: 256