akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		List<Integer> list = new ArrayList<Integer>();
		int num;
		double weight, height;
		while(stdIn.hasNext())
		{
			String[] s = stdIn.next().split(",");
			num = Integer.parseInt(s[0]);
			weight = Double.parseDouble(s[1]);
			height = Double.parseDouble(s[2]);
			if(weight / height / height >= 25)
			{
				list.add(num);
			}
		}
		if(list.size() > 0)
		{
			for(int i = 0; i < list.size(); ++i)
			{
				System.out.println(list.get(i));
			}
		}
		else
		{
			System.out.println("該当なし");
		}
	}
}

Measured memory_bytes: 12000
PROGRAM ATCODER

implicit none
integer(16) :: n,i,count=0,min=10**9,ans=0
integer(16),allocatable :: a(:)

read*, n
allocate(a(n))
read*, a(1:n)

do i = 1, n, 1
  if ( a(i) < 0 ) then
    count = count + 1
  end if
  call chmin(min,abs(a(i)))
  ans = ans + abs(a(i))
end do

if ( mod(count,2) == 0 ) then
  print'(i0)', ans
else
  print'(i0)', ans - 2*min
end if


contains
  
  subroutine chmin(dp,x)
    
  implicit none
  integer(16) :: dp, x

  if (dp > x) then
  	dp = x
  	return
  end if

  end subroutine

END PROGRAM ATCODER

Measured memory_bytes: 2304
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	public char change(char ch){
		switch (ch){
		case '{':
			return'}';
		case '[':
			return']';
		case '(':
			return')';
		case ')':
			return'(';
		case ']':
			return'[';
		case '}':
			return'{';
		}
		return 0;
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		String in = sc.next();
		int length = in.length();
		int end = in.indexOf("iwi");
		char[] buffer = in.toCharArray();
		char[] a = new char[end];
		char[] b = new char[length - end - 3];
		for (int i = 0, j = end-1; i < end; i++,j--) {
			a[j] = buffer[i];
		}
		{
			int j = 0;
			for (int i = end+3; i < length; i++) {
				b[j] = change(buffer[i]);
				j++;
			}
		}
//		System.out.println(Arrays.toString(a));
//		System.out.println(Arrays.toString(b));
		int al = a.length;
		int bl = b.length;
		int[][] dp = new int[al + 1][bl + 1];
		for(int i = 0 ; i < al+1;i++){
			for(int j = 0 ; j < bl + 1 ; j++){
				if(i == 0 && j == 0){
					continue;
				}
				if(i == 0 ){
					dp[i][j] = dp[i][j-1]+1;
					continue;
				}
				if(j == 0){
					dp[i][j] = dp[i-1][j]+1;
					continue;
				}
				dp[i][j] = Math.min(dp[i-1][j]+1, dp[i][j-1] + 1);				
				if(a[i-1] == b[j-1]){
					dp[i][j] = Math.min(dp[i][j], dp[i-1][j-1]);
				}
//				System.out.print(dp[i][j]+" ");
			}
//			System.out.println();
		}
//		System.out.println(dp[al][bl]);
		int ret = 3 + al+ bl - dp[al][bl];

		System.out.println(ret);
	}

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

Measured memory_bytes: 12000
n = int(input())
A = [int(input()) for i in range(n)]
T = {}
k = 1
cnt = 0
while True:
    if k == 2:
        print(cnt)
        exit()
    if k not in T: T[k]=1
    else:
        print(-1)
        exit()
    k = A[k-1]
    cnt+=1

Measured memory_bytes: 20516
def dfs(i,sumnum,sums):
    global ans
    if i == 4:
        if sumnum == 7:
            print(sums + "=7")
            exit()
    else:
        dfs(i+1,sumnum + int(s[i]),sums + "+" + s[i])
        dfs(i+1,sumnum - int(s[i]),sums + "-" + s[i])
s = input()
ans = ""
dfs(1,int(s[0]),s[0])

Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define Maxn 100010
#define INF 10010
inline int read()
{
	char c=getchar();re ll f=1,s=0;
	while(!isdigit(c)){if(c=='-')f=-1,c=getchar();}
	while(isdigit(c)){s=s*10+c-48;c=getchar();}
	return f*s;
}
int main()
{
	string s[101];
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++) cin>>s[i];
	sort(s,s+n);
    for(int i=0;i<n;i++) cout<<s[i]; 
	return 0;
}

Measured memory_bytes: 256
import sys
from functools import lru_cache
from bisect import bisect_left as lb, bisect_right as ub
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from math import gcd, ceil, sqrt
rd = lambda: int(sys.stdin.readline())
rds = lambda: map(int, sys.stdin.readline().split())
rdl = lambda: list(map(int, sys.stdin.readline().split()))
inf = 2 * 10 ** 18
sys.setrecursionlimit(10 ** 7)
rg = range
pr = print


T = rd()
for i in rg(T):
  n, a, b, c, d = rds()

  @lru_cache(maxsize=10 ** 7)
  def f(m):
    # print(m)
    if m == 1:
      return d
    ret = d * m
    # 2
    q, r = m // 2, m % 2
    if q:
      ret = min(ret, f(q) + d * r + a)
    if r:
      ret = min(ret, f(q + 1) + d * (2 - r) + a)

    q, r = m // 3, m % 3
    if q:
      ret = min(ret, f(q) + d * r + b)
    if r:
      ret = min(ret, f(q + 1) + d * (3 - r) + b)

    q, r = m // 5, m % 5
    if q:
      ret = min(ret, f(q) + d * r + c)
    if r:
      ret = min(ret, f(q + 1) + d * (5 - r) + c)
    return ret

  pr(f(n))


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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



void func(long long N){

    for(lli i=1000;;i+=1000){
        if(i>=N){
            cout<<i-N<<endl;
            return;
        }
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    func(N);
    return 0;
}


Measured memory_bytes: 3760
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int n = sc.nextInt();

        
        BigInteger dMax = BigInteger.valueOf((long)Math.pow(10, 18));

        long[] a = new long[n];
        BigInteger mul = BigInteger.ONE;
        BigInteger tmp = null;
        for(int i=0;i<n;i++){
            a[i] = sc.nextLong();

            if (a[i] == 0) {
                System.out.println("0");
                return ;
            }
        }

        for(int i=0;i<n;i++){

            tmp = BigInteger.valueOf(a[i]);
            if (mul.multiply(tmp).compareTo(dMax) > 0 ) {
                System.out.println("-1");
                return ;
            } else {
                mul = mul.multiply(tmp);
            }
        }

        System.out.println(mul.toString());
    }
}



Measured memory_bytes: 61284
use std::io;
fn main() {
    while true {
        let mut line = String::new();
        io::stdin().read_line(&mut line);

        let n = line.trim().parse::<i32>().unwrap();
        if n == 0 {
            break;
        }
        let mut vec: Vec<i32> = Vec::new();
        for i in 0..n {
            let mut line = String::new();
            io::stdin().read_line(&mut line);
            vec.push(line.trim().parse::<i32>().unwrap());
        }

        let (max, max_index) = vec.iter().enumerate().map(|(x, y)| (y, x)).max().unwrap();
        let (min, min_index) = vec.iter().enumerate().map(|(x, y)| (y, x)).min().unwrap();
        let mut ans = 0;
        for num in vec.iter() {
            ans = ans + num;
        }
        ans = ans - (max + min);
        println!("{}", ans / (vec.len() as i32 - 2));
    }
}


Measured memory_bytes: 5032
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

int main()
{
	LL a, b;
	scanf("%lld %lld", &a, &b);
	LL ans = 0;
	for(int i = b; i <= a; i++)
	{
		ans = ans + (a - i);
	}
	for(int i = b + 1; i <= a - b; i++)
	{
		int t = (a - i) / i;
		int qw = i - b;
		ans = ans + (t * qw);
		if(a % i >= b) {
			ans = ans + a % i - b + 1;
		}
	}
	if(b == 0) ans = ans - a;
	printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    string S;
    cin >> S;
    map<char,int> res;
    rep(i,sz(S)) res[S[i]]++;
    if(max({res['a'],res['b'],res['c']}) - min({res['a'],res['b'],res['c']}) <= 1) pr("YES");
    else pr("NO");
}

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

int main(){
    long long x,y;
    cin >>x>>y;
    for(int i = 1; i <= y; i++){
     if((x * i) % y == 0){
     cout << x * i << endl;
     break;
     }
    }
    return 0;
}


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

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

int main() {
  char c;
  cin >> c;
  if (c != 'a' && c != 'i' && c != 'u' && c != 'e' && c != 'o') cout << "consonant" << endl;
  else cout << "vowel" << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
        "fmt"
)

func main() {
        var A, B int
        fmt.Scanf("%d %d", &A, &B)
        for i := 0; i < 1100; i++ {
                a := i * 8 / 100
                b := i * 10 / 100
                if a == A && b == B {
                        fmt.Println(i)
                        return
                }
        }
        fmt.Println(-1)
}

Measured memory_bytes: 512
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n - 1];
        
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n - 1; i++) {
            c[i] = sc.nextInt();
        }
        
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += b[a[i] - 1];
            if (i < n - 1 && a[i + 1] == a[i] + 1) {
                sum += c[a[i] - 1];
            }
            //System.out.println(sum);
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

struct edge{
    int to, cost;
};
vector<vector<edge>> v;
vector<ll> d;

void dfs(int p){
    for(int i = 0; i < v[p].size(); i++){
        if(d[p] + v[p][i].cost < d[v[p][i].to]){
            d[v[p][i].to] = d[p] + v[p][i].cost;
            dfs(v[p][i].to);
        }
    }
}

int main(){
    int n, ans = 0;
    cin >> n;
    v = vector<vector<edge>>(n + 1);
    d = vector<ll>(n + 1, LINF);
    for(int i = 0; i < n - 1; i++){
        int a, b, c;
        cin >> a >> b >> c;
        v[a].push_back({b, c});
        v[b].push_back({a, c});
    }
    d[1] = 0;
    dfs(1);
    for(int i = 1; i <= n; i++){
        cout << (d[i] % 2 == 0? 0 : 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 7808
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int input[5];
  for(int i = 0;i < 5;i++){
    cin >> input[i];
  }
  vector<int> n;
  for(int i = 0;i < 5;i++){
    n.push_back(input[i] % 10);
  }
  int lastDigit = -1;
  int index;
  for(int i = 1;i < 10;i++){
    auto itr = std::find(n.begin(), n.end(), i);
    if( itr != n.end() ) {
      lastDigit = *itr;
      index = itr - n.begin();
      break;
    }
  }
  int ans = 0;
  for(int i = 0;i < 5;i++){
    if(i == index){
      //cout << i << endl << input[i] << endl;
      ans += input[i];
    }else{
      if(n[i] == 0)
        ans += input[i];
      else
        ans += input[i] + 10 - n[i];
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> " " >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(b<=c || d<=a) {
        cout<<0<<endl;
        return 0;
    }

    pii x={a,b},y={c,d};
    if(x>y) swap(x,y);

    if(x.first<=y.first&&y.second<=x.second) {
        cout<<y.second-y.first<<endl;
        return 0;
    }
    cout<<x.second-y.first<<endl;
    return 0;
}


Measured memory_bytes: 384
N = int(input())

lst = input().split()

for i in range(N):
   lst[i] = int(lst[i])

#lst = list(set(lst))

lst.sort()

L = len(lst)

count = 0

if 3 <= L:
   for i in range(L - 2):
      for j in range(i + 1, L - 1):
         if lst[i] != lst[j]:
            for k in range(j + 1, L):
               if lst[i] + lst[j] > lst[k] and lst[i] != lst[k] and lst[j] != lst[k]:
                  count += 1

print(count)

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


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

    vector<long long>v,v1;

    while(m--) cin>>x,v.push_back(x);

    if(v.size()==1) {cout<<0<<endl; return 0;}

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

    for(long long i=1;i<v.size();i++)
    {
        v1.push_back(abs(v[i]-v[i-1]));
    }

    n--;

    long long s = 0;

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

    for(long long i=n;i<v1.size();i++) s+=v1[i];

    cout<<s<<endl;
}



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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> int least_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ffs(n) - 1;
  if (sizeof(T) == 8) return __builtin_ffsll(n) - 1;
}

// n must be greater than 0.
template<typename T> int least_bit_fast(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ctz(n);
  if (sizeof(T) == 8) return __builtin_ctzll(n);
}

template<typename T> int most_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return n ? 31 - __builtin_clz(n) : -1;
  if (sizeof(T) == 8) return n ? 63 - __builtin_clzll(n) : -1;
}

template<typename T> int count_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_popcount(n);
  if (sizeof(T) == 8) return __builtin_popcountll(n);
}

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

template<typename T, typename... S> T gcd(T a, S... s) {
  auto b = gcd(s...);
  if (a == 0 || b == 0) return max(a, b);
  int fa = least_bit_fast(a);
  int fb = least_bit_fast(b);
  a >>= fa;
  b >>= fb;
  while (a != b) {
    auto& c = a > b ? a : b;
    c >>= least_bit_fast(c = abs(a - b));
  }
  return a << min(fa, fb);
}

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

template<typename T, typename... S> T lcm(T t, S... s) {
  T l = lcm(s...);
  return t / gcd(t, l) * l;
}

template<typename T> T floor(T a, T b) {
  auto d = div(a, b);
  return d.quot - (d.rem && (a < 0) != (b < 0) ? 1 : 0);
}

template<typename T> T ceil(T a, T b) {
  auto d = div(a, b);
  return d.quot + (d.rem && (a > 0) == (b > 0) ? 1 : 0);
}

template<typename T> T round(T a, T b) {return floor(a + b / 2, b);}

template<typename T> T mod(T a, T b) {
  T c = a % b;
  return c < 0 ? c + abs(b) : c;
}

template<typename T> T factorial(T n) {return n <= 1 ? 1 : factorial(n - 1) * n;}

template<typename T> T square(T n) {return n * n;}

template<typename T> T cube(T n) {return n * n * n;}

template<typename T> T norm(T x1, T y1, T x2, T y2) {return square(x1 - x2) + square(y1 - y2);}

template<typename T> bool isSquare(T n) {return square(T(sqrt(n))) == n;}

template<typename T> T clamp(T v, T l, T u) {return v < l ? l : v > u ? u : v;}

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
 
 
ll memo[20001][20001]; //各点の最短距離を記録したもの
 
int main()
{
    ll n;
    ll x;
    ll y;
    cin >> n >> x >> y;
    x--;
    y--;
    
    rep(i, n)
    {
        rep(j, n)
        {
            memo[i][j] = -1;
        }
    }
    rep(i, n - 1)
    {
        
        memo[i][i] = 0;
        memo[i][i + 1] = 1;
        memo[i + 1][i] = 1;
    }
    memo[n - 1][n - 1] = 0;
    memo[x][y] = 1;
    memo[y][x] = 1;
 
     for (ll k = 2; k < n; k++)
    {
        for (ll i = 0; i < n - 2; i++)
        {
          if (memo[i][i+k]!=-1){
          continue;
          }
 
 
            ll p = min(memo[i][i + k-1], memo[i+1][i + k]);
            ll j=labs(i-x)+labs(i+k-y);
            ll h=labs(i-y)+labs(i+k-x);
            ll g=min(p + 1,j+1);
            
          memo[i][i + k] = min(g,h+1);
            memo[i + k][i] = min(g,h+1);
        }
    }
    map<ll, ll> score;
    rep(i, n)
    {
        rep(j, n)
        {
            score[memo[i][j]] += 1;
          
        }
   
    
    }
  
 rep(i, n - 1)
    {
        cout << score[i+1]/2 << endl;
    }
}

Measured memory_bytes: 311936
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
void printv(vector<T> v)
{
    for (T t : v)
    {
        cout << t << " ";
    }
    cout << '\n';
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int x , a;
    cin >> x >> a;

    if(x<a){cout << 0 << endl;}
    else cout << 10 << endl;

    return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

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

using namespace std;

int main() {
  in(int, n, m);
  vector<P> v;
  rep(i, m) {
    in(int, a, b);
    v.push_back({b, a});
  }
  sort(all(v));
  int ans = 0;
  int last = 0;
  for (auto [b, a] : v) {
    if (a < last && last <= b) continue;
    ++ans;
    last = b;
  }
  out(ans);
}


Measured memory_bytes: 4300
//Coded by tzc_wk
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
pii x1[200005];
int x2[200005];
int cnt1=0,cnt2=0;
int dp[32];
int n=read(),t=read();
inline bool cmp(pii i,pii j){
	return i.se*j.fi<j.se*i.fi;
}
signed main(){
	dp[0]=0;
	fz(i,1,31)	dp[i]=t+1;
	fz(i,1,n){
		int a=read(),b=read();
		b++;b+=a;
		if(a==0)	x2[++cnt2]=b;
		else		x1[++cnt1]={a,b};
	}
	sort(x1+1,x1+cnt1+1,cmp);
	sort(x2+1,x2+cnt2+1);
	fz(i,1,cnt1){
		fd(j,30,0){
			if(dp[j]<=t)
				dp[j+1]=min(dp[j+1],dp[j]+x1[i].fi*dp[j]+x1[i].se);
		}
	}
	int ans=0;
	fz(i,0,30){
//		cout<<dp[i]<<endl;
		if(dp[i]<=t){
			int lft=t-dp[i],num=i;
			fz(j,1,cnt2){
				if(lft<x2[j]){
					break;
				}
				lft-=x2[j];
				num++;
			}
			ans=max(ans,num);
		}
	}
	cout<<ans<<endl;
	return 0;
}
/*
t+ai(t+1)+bi+aj(t+ai(t+1)+bi+1)+bj
=t+t*ai+ai+bi+aj*(t+ai*t+t+bi+1)+bj
=t+t*ai+ai+bi+aj*t+aj*ai*t+bi*aj+aj+bj

bi*aj
<
bj*ai
*/

Measured memory_bytes: 4992
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 c = sc.nextInt();
    if (a < b) {
      if (b < c) System.out.printf("%d %d %d\n", a, b, c);
      else System.out.printf("%d %d %d\n", a, c, b);
    }
    else if (a < c) {
      if (b < c) System.out.printf("%d %d %d\n", b, a, c);
      else System.out.printf("%d %d %d\n", c, b, a);
    }
    else {
      if (b < c) System.out.printf("%d %d %d\n", b, c, a);
      else System.out.printf("%d %d %d\n", c, b, a);
    }
  }
}



Measured memory_bytes: 26320
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
using vi = vector<int>;
using vl = vector<i64>;
using vd = vector<double>;
using pi = pair<int, int>;
using pl = pair<i64, i64>;
using pd = pair<double, double>;

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

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int main() {
  string s;
  cin >> s;
  auto i = stoi(s);
  auto y = i / 100;
  auto m = i % 100;
  if (1 <= y && y <= 12 && 1 <= m && m <= 12) {
    cout << "AMBIGUOUS";
  } else if (1 <= y && y <= 12) {
    cout << "MMYY";
  } else if (1 <= m && m <= 12) {
    cout << "YYMM";
  } else {
    cout << "NA";
  }
  cout << endl;
}


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

public class Main {
    private static HashMap<Integer, List<Integer>> graph;
    public static void main(String[] args) throws Exception{
        FastScanner scanner = new FastScanner();
        int V = scanner.nextInt();
        int E = scanner.nextInt();

        graph = new HashMap<>(V);
        for(int i = 0; i < V; ++i){
            graph.put(i, new LinkedList<>());
        }

        for(int i = 0; i < E; ++i){
            int u = scanner.nextInt();
            int v = scanner.nextInt();
            graph.get(u).add(v);
        }

        boolean[] visited = new boolean[V];

        for(int i = 0; i < V; ++i){
            boolean[] recStack = new boolean[V];
            if(!visited[i] && cyclicUtil(i, visited, recStack)){
                System.out.println("1");
                return;
            }
        }

        System.out.println("0");
        return;
    }

    private static boolean cyclicUtil(int cur, boolean[] visited, boolean[] recStack){
        visited[cur] = true;
        recStack[cur] = true;

        for(Integer adj : graph.get(cur)){
            if(recStack[adj]){
                return true;
            }
            else if(!visited[adj] && cyclicUtil(adj, visited, recStack)){
                return true;
            }
        }

        recStack[cur] = false;
        return false;
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 25516
#include <iostream>
#include <algorithm>

using namespace std;
#define MAX 100

int main()
{
    int a[MAX]={0};
    long long int n = 0;
    cin >> n;
    int v, j;

    for(long long int i = 0; i < n; i++) cin >> a[i];

    for(long long int t = 0; t < n; t++){
        cout << a[t];
        if(t < n - 1) cout << " ";
    }
    cout << endl;

    for(long long int i = 1; i < n; i++){
        v = a[i];
        j = i -1;
        while(j >= 0&& a[j] >v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(long long int t = 0; t < n; t++){
            cout << a[t];
            if(t < n - 1) cout << " ";
        }
        cout << endl;
    }

	return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define down(i,l,r) for (int i=l;i>=r;i--)
#define maxn 105000
using namespace std;
typedef long long ll;
const int inf=1e9;
int main(){
	ll x,y;
	scanf("%lld%lld",&x,&y);
	if (x%y) printf("%lld\n",x);
	else puts("-1");
	return 0;
}

Measured memory_bytes: 256
use std::io::{Read, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let mut buf = String::new();
    stdin.read_to_string(&mut buf).unwrap();
    let mut buf = buf.split_whitespace();

    let a: i32 = buf.next().unwrap().parse().unwrap();
    let b: i32 = buf.next().unwrap().parse().unwrap();
    let c: i32 = buf.next().unwrap().parse().unwrap();

    println!("{}",
        if a < b && b < c {
            "Yes"
        } else {
            "No"
        }
    );
}


Measured memory_bytes: 5020
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int N;
int A,B;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>A>>B;
    int cnt=0;
    rep(i,0,N){
        if((A&(1<<i))!=(B&(1<<i))) cnt++;
    }
    if(cnt%2==0){
        cout <<"NO"<<"\n";
        return 0;
    }
    vector<int> v(1<<N);
    v[0]=0;
    v[1]=1;
    rep(i,1,N-1){
        rep(j,0,1<<i){
            v[(1<<i)+j]=v[(1<<i)-1-j]+(1<<i);
        }
    }
    B^=A;
    cnt=0;
    rep(i,0,N){
        if((B&(1<<i))) cnt++;
    }
    vector<int> ans;
    int i=0;
    while(v[i]+(1<<(N-1))!=B&&v[i+1]!=B){
        ans.pb(v[i]);
        ans.pb(v[i]+(1<<(N-1)));
        ans.pb(v[i+1]+(1<<(N-1)));
        ans.pb(v[i+1]);
        i+=2;
    }
    if(B&(1<<(N-1))){
        rep(j,i,1<<(N-1)){
            ans.pb(v[j]);
        }
        rer(j,1<<(N-1),i){
            ans.pb(v[j]+(1<<(N-1)));
        }
    }
    else{
        ans.pb(v[i]);
        ans.pb(v[i]+(1<<(N-1)));
        ans.pb(v[i+1]+(1<<(N-1)));
        i+=2;
        rep(j,i,1<<(N-1)){
            ans.pb(v[j]+(1<<(N-1)));
        }
        rer(j,1<<(N-1),i-1){
            ans.pb(v[j]);
        }
    }
    cout <<"YES"<<"\n";
    rep(i,0,1<<N){
        if(i==(1<<N)-1) cout <<(ans[i]^A)<<"\n";
        else cout <<(ans[i]^A)<<" ";
    }
}

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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int M = min(A,B);
    int m;
    if(A+B>N) m = A+B-N;
    else m = 0;
    cout << M << " " << m << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  string S;
  cin>>S;


  bitset<9> locate_plus;//+の挿入有無を示す。例)[0]=1なら、'+'をS[0]とS[1]の間に入れる。
  int index_offset=0;
  int64_t sum=stoll(S);
  for (int tmp = 0; tmp < (1 << S.size()-1); tmp++) {
    bitset<9> s(tmp);
    int wk =s.count();
    bool flg= ( wk<=S.size()-1 )&&( wk==1||wk==2||wk==3||wk==4||wk==5||wk==6||wk==7||wk==8||wk==9 );
    if(flg){
      //+を挿入した式を計算
      int left=0;
      for(int i=0;i<S.size()-1;i++){
        if(s.test(i)){
          sum+=stoll(S.substr(left,i-left+1));
          left=i+1;
        }
      }
      sum+=stoll(S.substr(left,S.size()-1-left+1));
    }
  }

  cout<<sum<<endl;

  return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int x;
  int c1 = 0, c2 = 0, c4 = 0;
  for (int i = 0; i < N; ++ i) {
    cin >> x;
    if (x & 1) ++ c1;
    else if (x % 4 == 0) ++ c4;
    else ++ c2;
  }
  if (c1 <= c4 || (c1 == c4 + 1 && c2 == 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  bool p = s[0]=='R';
  bool q = s[1]=='R';
  bool r = s[2]=='R';
  
  if(p and q and r){
    cout << 3 << endl;
  }else if((p and q) or (q and r)){
      cout << 2 << endl;
  }else if (p or q or r){
        cout << 1 << endl;
  } else cout <<0 << endl;
     
 
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

void solve()
{
    int k;
    cin >> k;
    
    int odd = (k + 1) / 2;
    cout << odd * (k - odd);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<numeric>

using namespace std;

typedef long long ll;

int main()
{
	while (1) {
		string s;
		cin >> s;
		if (s == "0000")break;
		else if ((s[0] == s[1])&&(s[1]==s[2])&&(s[2]==s[3])) cout << "NA" << endl;
		else if (s == "6174")cout << 0 << endl;
		else {
			ll cnt = 0;
			while (1) {
				int d[4];
				d[0] = s[0]-'0', d[1] = s[1]-'0', d[2] = s[2]-'0', d[3] = s[3]-'0';
				sort(d,d+4);
				int S = d[0] * 1000 + d[1] * 100 + d[2] * 10 + d[3];
				reverse(d,d+4);
				int L = d[0] * 1000 + d[1] * 100 + d[2] * 10 + d[3];
				cnt++;
				int res = L - S;
				if (res == 6174)break;
				s = to_string(res);
				while (s.size() < 4) {
					s = '0' + s;
				}
			}
			cout << cnt << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3204
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  int T, X;
  cin >> T >> X;
  cout << fixed;//小数点を確実に10桁で表示するためのもの
  cout << setprecision(10); 
  cout << (double)T / X << endl;
  return 0;
}


Measured memory_bytes: 3784
/* C++14(GCC5.4.1) */
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(void){
    int n; cin >> n;
    vector<pair<int, int>> st(n);
    for(int i=0; i<n; i++){
        st[i].second = i;
        cin >> st[i].first;
    }
    
    sort(st.begin(),st.end());

    for(int i=0; i<n; i++){
        cout << st[i].second+1 << " ";
    }

    return 0;
}

Measured memory_bytes: 1536
def solve(n, m, p, s):
    accept = {i+1: False for i in range(n)}
    penalty = {i+1: 0 for i in range(n)}
    for i in range(m):
        if s[i] == "WA":
            if not accept[p[i]]:
                penalty[p[i]] += 1
        else:
            accept[p[i]] = True
    a = sum(accept.values())
    b = sum([v for k, v in penalty.items() if accept[k]])
    return "%d %d" % (a, b)

n, m = map(int, input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
print(solve(n, m, p, s))

Measured memory_bytes: 37604
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    vector<int> X(n);
    vector<int> Y(m);
    
    for(int i=0;i<n;i++) cin>>X.at(i);
    for(int i=0;i<m;i++) cin>>Y.at(i);
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    
    if(X.at(X.size()-1)<Y.at(0) && x<Y.at(0) && X.at(X.size()-1)<y) cout<<"No War"<<endl;
    else cout<<"War"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
while True:
    (n, x) =  [int(i) for i in input().split()]
    if n == x == 0: 
        break 

    count = 0 
    for a in range(1, n+1):  
        for b in range(a+1, n+1): 
            for c in range(b+1, n+1):
                if (a + b + c) == x:
                    count += 1
    print(count) 

Measured memory_bytes: 6724
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define mod 1000000007
int main() 
{
   ll s,w;
   cin>>s>>w;
   if(w>=s)
    cout<<"unsafe";
    else
        cout<<"safe";
}


Measured memory_bytes: 3636
N,K = map(int,input().split())
td = [list(map(int,input().split())) for _ in range(N)]
td.sort(key=lambda x:-x[1])
l,r = td[:K],td[K:]
used_l = [0]*N
for i in range(K):
    used_l[l[i][0]-1] += 1

remove = []
for i in range(K-1,-1,-1):
    if used_l[l[i][0]-1] >= 2:
        remove.append(l[i][1])
        used_l[l[i][0]-1] -= 1

used_r = used_l.copy()
add = []
for i in range(N-K):
    if used_r[r[i][0]-1] == 0:
        add.append(r[i][1])
        used_r[r[i][0]-1] += 1

t = sum(used_l)

ans = t**2
for i in range(K):
    ans += l[i][1]

ref = ans
for i in range(min(len(remove),len(add))):
    ref += (t+1)**2-t**2+add[i]-remove[i]
    t += 1
    ans = max(ans,ref)

print(ans)

Measured memory_bytes: 32256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cstdio>

using namespace std;

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

int main(){
    double l;
    cin >> l;
    double ans = (l/3) * (l/3) * (l/3);
    printf("%.10lf\n", ans);
}


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

if n%2 == 0:
    ans1 = [a[i-1] for i in reversed(range(2,n+1,2))]
    ans2 = [a[i-1] for i in range(1,n+1,2)]
    ans = ans1 + ans2
else:
    ans1 = [a[i-1] for i in reversed(range(1,n+1,2))]
    ans2 = [a[i-1] for i in range(2,n+1,2)]
    ans = ans1 + ans2
    
print(*ans, sep=' ')

Measured memory_bytes: 26020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
ll a[200005];
vector<ll>beg[200005],ruib[200005];
vector<ll>en[200005],ruie[200005];
int main(){
	cin>>n;
	rep(i,n) cin>>a[i];
	for(int i=1;i<=n-1;i++){
		for(int j=0;j<n;j+=i){
			beg[i].pb(a[j]);
			if(ruib[i].empty()) ruib[i].pb(a[j]);
			else ruib[i].pb(ruib[i][ruib[i].size()-1]+a[j]);
		}
		for(int j=n-1;j>=0;j-=i){
			en[i].pb(a[j]);
			if(ruie[i].empty()) ruie[i].pb(a[j]);
			else ruie[i].pb(ruie[i][ruie[i].size()-1]+a[j]);
		}
	}
	
	ll ans = 0;
	for(ll p=2;p<n;p++){
		for(ll d=1;d*(p-1)<=(n-1);d++){
			ll A = n-1-d*(p-1);
			if(A<=d) continue;
			ll B = A-d;
			if(A%d == 0 && A<=(p-1)*d) continue;
			ans = max(ans,ruib[d][p-1]+ruie[d][p-1]);
			//cout<<A<<B<<p<<endl;
		}}
		cout<<ans<<endl;
	}

Measured memory_bytes: 75028
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

const int SIZE = 1000001;
int T[SIZE];
bool P[SIZE];

int solve( int p, int m ) {
    int left = max( 1, p - m );
    int right = min( SIZE - 1, p + m );
    int t = T[right] - T[left-1];
    return t == 0 ? -1 : t - 1;
}

int main() {
    for ( int i = 0; i < SIZE; ++ i ) {
        T[i] = 0;
        P[i] = false;
    }
    for ( int i = 3; i < SIZE; i += 2 ) {
        P[i] = true;
    }
    P[2] = true;
    for ( int i = 3; i < SIZE; i += 2 ) {
        if ( ! P[i] ) continue;
        for ( int j = i + i; j < SIZE; j += i ) {
            P[j] = false;
        }
    }
    for ( int i = 1; i < SIZE; ++ i ) {
        T[i] = T[i-1];
        if ( P[i] ) T[i] ++;
    }
    
    int n;
    while ( cin >> n && n ) {
        int res = 0;
        for ( int i = 0; i < n; ++ i ) {
            int p, m;
            cin >> p >> m;
            res += solve( p, m );
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <bitset>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
const int num = 4000010;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int sum = 0;
    rep(i, N) sum += A[i];
    bitset<num> bs(1);
    rep(i, N){
        bs |= (bs << A[i]);
    }
    
    int mi = inf;
    rep(i, num){
        if(bs[i]){
            mi = min(mi, abs(i - sum + i));
        }
    }
    output((sum + mi) / 2);

    return 0;
}


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

int main() {

  int N,K;
  cin >> N >> K;
  
  vector<int> H(N); // int型の配列変数vecを宣言
  for (int i = 0; i < N; i++) {
    	cin >> H.at(i) ;
  }
  
  	sort(H.begin(), H.end());
  
  int64_t ANS = 0;
    for (int j = 0; j < N-K; j++) {
    	ANS = ANS + H.at(j);
  }
  
  if (N < K) {
  	ANS = 0;
  }
  
  cout << ANS << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <cctype>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e5+5;
struct Edge
{
    int next, to;
    Edge(int next = 0, int to = 0):next(next), to(to) {};
}edge[N<<1];
int tot, head[N];
void _add(int x, int y) { edge[++tot] = Edge(head[x], y), head[x] = tot; }
void add(int x, int y) { _add(x, y), _add(y, x); }
int n, m, l, r, f[N<<1], vis[N];
int func(int x)
{
    for(int i = head[x]; i; i = edge[i].next)
        if(!vis[edge[i].to]) return edge[i].to;
    return 0;
}
int main()
{
    n = read(), m = read(), l = n, r = n+1;
    for(int i = 1; i <= m; ++i)
    {
        int x = read(), y = read(); 
        add(x, y); f[l] = x, f[r] = y;
    }
    vis[f[l]] = vis[f[r]] = 1;
    while(f[l-1] = func(f[l])) --l, vis[f[l]] = 1;
    while(f[r+1] = func(f[r])) ++r, vis[f[r]] = 1;
    printf("%d\n", r-l+1);
    for(int i = l; i <= r; ++i) printf("%d ", f[i]); puts("");
    return 0;
}

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

typedef long long int ll;
using namespace std;
int main(){
    ll N;
    ll a, b;
    cin >> N;

    a = (ll)sqrt(N);

    while (true){
        if (N % a == 0){
            b = N / a;
            break;
        }
        a--;
    }
    ll ans = a + b - 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    int debt = 100000;
    double interest = 0.05;
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    for (int i = 0; i < n; i++) {
      debt += debt * interest;
      debt = (int)Math.ceil((double)debt / 1000) * 1000;
    }   
    System.out.println(debt);
  }
}

Measured memory_bytes: 17164
#include<bits/stdc++.h>
using namespace std;
const double pi=atan(1.0)*4;
int main(){
	int n,m,sum=0;
	cin>>n>>m;
	for(int i=1,x;i<=m;i++) cin>>x,sum+=x;
	if(n<sum) puts("-1");
	else cout<<n-sum<<endl;
} 

Measured memory_bytes: 3616