akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Main
{
    public static class Program
    {
        static void Main(string[] args)
        {
            Double x = Double.Parse(Console.ReadLine());
            var answer = 0.0;

            answer = (Math.Log10(x) - 2.0) / (Math.Log10(101) - 2.0);

            double k = 100;
            int i = 0;
            while(k < x){
                k = Math.Floor(k * 1.01);
                i++;
            }


            Console.WriteLine(i);

 
        }
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();
 
        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();
 
        }
        private static ulong[] GetUlongList(string line)
        {
            return line.Split(' ').Select(x => ulong.Parse(x)).ToArray();
        }
        private static long[] GetLongList(string line)
        {
            return line.Split(' ').Select(x => long.Parse(x)).ToArray();
        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static bool IsOdd(int i)
        {
            return i % 2 == 1 ? true : false;
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion libraries
    }
}

Measured memory_bytes: 27564
#include <stdio.h>
void swap(int *t,int *s)
{
    int temp=*t;
        *t=*s;
        *s=temp;
}
void sort3(int *a,int *b,int *c)
{
    if(*a > *b) swap(a,b);
    if(*b > *c) swap(b,c);
    if(*a > *b) swap(a,b);
}
int main(void)
{
    int x,y,z;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
    
    sort3(&x,&y,&z);
    
    printf("%d %d %d\n",x,y,z);
    return 0;
}



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

static int compare_ll (const void *a, const void *b) {
    long long *a_ = (long long*)a;
    long long *b_ = (long long*)b;
    if ( *a_ > *b_ )
        return 1;
    else if ( *a_ < *b_ )
        return -1;
    return 0;
}

int main (void) {
    int n;
    scanf("%d", &n);
    long long x[n], sorted[n];
    for ( int i=0; i<n; i++ ) {
        scanf("%lld", &x[i]);
        sorted[i] = x[i];
    }

    qsort(sorted, n, sizeof(long long), compare_ll);

    long long ans_cand_max = sorted[n / 2];
    long long ans_cand_min = sorted[n / 2 - 1];

    for ( int i=0; i<n; i++ ) {
        if ( x[i] >= ans_cand_max )
            printf("%lld\n", ans_cand_min);
        else
            printf("%lld\n", ans_cand_max);
    }

    return EXIT_SUCCESS;
}


Measured memory_bytes: 5216
#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
struct bridge{
	vector<int>ord,low;
	vector<bool>art;
	vector<pair<int,int> >bridges;
	vector<vector<int> >G;
	bridge(int n_=0):ord(n_,-1),low(n_),art(n_,false),G(n_){}
	void add_edge(int u,int v)
	{
		G[u].push_back(v);
		G[v].push_back(u);
	}
	bool operator[](int a){return art[a];}
	void dfs(int u,int p,int&cnt)
	{
		low[u]=ord[u]=cnt++;
		for(int&v:G[u])
		{
			if(ord[v]==-1)
			{
				dfs(v,u,cnt);
				low[u]=min(low[u],low[v]);
				art[u]=art[u]|ord[u]<=low[v];
				if(ord[u]<low[v])bridges.push_back(u<v?make_pair(u,v):make_pair(v,u));
			}
			else if(v!=p)
			{
				low[u]=min(low[u],ord[v]);
			}
		}
	}
	void build()
	{
		int k=1,cnt=0;
		low[0]=ord[0]=0;
		for(int&v:G[0])if(ord[v]==-1)
		{
			dfs(v,0,k);
			if(ord[0]<low[v])bridges.push_back(make_pair(0,v));
			cnt++;
		}
		if(cnt>=2)art[0]=true;
	}
};

main()
{
	int n,m;cin>>n>>m;
	bridge P(n);
	for(int i=0;i<m;i++)
	{
		int a,b;cin>>a>>b;
		P.add_edge(a,b);
	}
	P.build();
	sort(P.bridges.begin(),P.bridges.end());
	for(int i=0;i<P.bridges.size();i++)cout<<P.bridges[i].first<<" "<<P.bridges[i].second<<endl;
}



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

using namespace std;

int r, g, b, n, ans;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> r >> g >> b >> n;
    for (int i = 0; i * r <= n; ++i) {
        for (int j = 0; i * r + j * g <= n; ++j) {
            int x = n - i * r - j * g;
            if (x % b == 0) {
                ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
	int n, k, x, y;
  	int res;
  
  	std::cin >> n >> k >> x >> y;
  
  	if (k < n) {
      res = k * x + (n - k) * y;
    } else {
      res = n * x;
    }
  
  	std::cout << res << std::endl;
}

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

int main() {
  int n,s;
  string p;
  cin >> n;
  vector<tuple<string,int,int>> l(n);
  for (int i = 0; i < n; i++) {
    cin >> get<0>(l[i]) >> get<1>(l[i]);
    get<1>(l[i])=0-(get<1>(l[i]));
    get<2>(l[i])=i+1;
  };
  sort(l.begin(),l.end());
  for (int i = 0; i < n; i++) {
    cout << get<2>(l[i]) << endl;
  }
}

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

int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  
  for(int i=0;i<n;i++) cin >> a[i];
   for(int i=0;i<n;i++) a[i]--;
  for(int i=0;i<n;i++) cin >> b[i];
  for(int i=0;i<n-1;i++) cin >> c[i];
  
  int sum =0;
  
  for(int i=0;i<n;i++){
    sum +=b[a[i]];
  }
  for(int i=0;i<n-1;i++){
    if(a[i]+1==a[i+1]) sum += c[a[i]];
  }
  
  cout << sum << endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sidha(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int> 
#define pb push_back
#define st string
#define pairi pair<int,int>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,x,t;cin>>n>>x>>t;
		ll y;
		if(n%x==0){
			y=n/x;
		}
		else{
			y=(n/x)+1;
		}
    cout<<y*t<<endl;
}

Measured memory_bytes: 3636
fun main(args :Array<String>) {
    val (x, y) = readIntegerList()
    val prizes = arrayListOf(0, 300000, 200000, 100000, 0)
    var ans = prizes[Math.min(x, 4)] + prizes[Math.min(y, 4)]
    if (x == 1 && y == 1) {
        ans += 400000
    }

    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)


Measured memory_bytes: 37876
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a>>b;
    string ans="a == b";
    if(a>b){
        ans="a > b";
    }
    else if(a<b){
        ans="a < b";
    }
    cout <<ans<< endl;
 //   system("pause");
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
	
		Scanner scan = new Scanner(System.in);

		
		int x = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int sum = Math.abs(x - a);
		int ave = Math.abs(x - b);
		
		if(sum < ave) {
			System.out.println("A");
		}else {
			System.out.println("B");
		}
		
		
		/*for(int i = 0; i <= A; i++) {
			for(int j = 0; j < A; j++) {
				System.out.print("☆");
				
			}
			System.out.println("");
		}*/
		
	}

}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

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

int a[1000005];

bool check(int n, int x) {
	int cnt = 0;
	int k = n-x;
	while (n) {
		cnt+=n/2;
		n/=2;
	}
	while (x) {
		cnt-=x/2;
		x/=2;
	}
	while (k) {
		cnt-=k/2;
		k/=2;
	}
	return cnt == 0;
}

int main() {
	int n;
	scanf("%d", &n);
	bool ima = false;
	for (int i=0 ; i<n ; i++) {
		char c;
		scanf(" %c", &c);
		a[i] = c - '0';
		if (a[i] == 2) ima = true;
	}
	if (ima) {
		for (int i=0 ; i<n ; i++) {
			if (a[i] == 3) a[i] = 1;
		}
		int cnt = 0;
		for (int i=0 ; i<n-1 ; i++) {
			if (a[i] != a[i+1] and check(n-2, i)) cnt++;
		}
		cout <<cnt%2<<endl;
	} else {
		int cnt = 0;
		for (int i=0 ; i<n-1 ; i++) {
			if (a[i] != a[i+1] and check(n-2, i)) cnt++;
		}
		if (cnt%2) cout <<2<<endl;
		else cout <<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string w="abcdefghijklmnopqrstuvwxyz";
    int size=w.size();
  for(int i=0;i<size;i++){
    if(s.find(w[i])==string::npos){
      cout << w[i] << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


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

int main(){
	


	int a,b,c,t;

	cin>>a>>b>>c;


	if(a>b){
		swap(a,b);
	}
	if(a>c){
		swap(a,c);
	}
	if(b>c){
		swap(b,c);
	}

	cout<<a<<" "<<b<<" "<<c<<endl;

	return 0;
}

Measured memory_bytes: 3088
def fanction(n):
    listIn = []
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            cnt_in = 0
            while tmp % i ==0:
                cnt_in += 1
                tmp //= i
            listIn.append([i, cnt_in])

    if tmp != 1:
        listIn.append([tmp, 1])

    if listIn == []:
        listIn.append([n, 1])

    return listIn

N = int(input())

arr = fanction(N)

tmp = 1
count = 0
for a, b in arr:
    if a <= 1:
        continue
    while 'true':
        if b >= tmp:
            b -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break

print(count)
        

Measured memory_bytes: 9484
a,b,c=map(int,input().split())
count=0
if a==b and b==c and a%2==0:
  print(-1)
else:
  while a%2==0 and b%2==0 and c%2==0:
    x=a
    y=b
    z=c
    a=(y+z)//2
    b=(x+z)//2
    c=(x+y)//2
    count+=1
  print(count)

Measured memory_bytes: 3064
use proconio::input;

fn main() {
    input! {
        r: u32,
    }

    let ans = match r % 10 {
        2| 4| 5| 7 | 9 => "hon",
        0| 1| 6| 8 => "pon",
        _ => "bon"
    };

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

Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,l;
    cin>>N>>l;
    vector < string > s;
    for(int i=0;i<N;i++)
    {
        string si;
        cin>>si;
        s.push_back(si);
    }
    sort(s.begin(),s.end());
    string ans;
    for(int i=0;i<N;i++)
    {
       ans+=s[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100000000
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < n; ++i)
#define out(x) cout << x << endl;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;


int main() {
	ll N, K;;
	cin >> N >> K;
	
	vector<ll> h(N);
	for (ll i = 0; i < N; i++)
	{
		cin >> h[i];
	}
	sort(all(h));

	//out("---");
	//rep(i, N) out(h[i]);
	//out("---");

	ll ans = 1LL<<60;
	for (ll i = 0; i <= N - K; i++)
	{
		ans = min(ans, h[i+K-1] - h[i]);
		//out(h[i + K - 1]);
		//out(h[i]);
		//out("---");
	}

	out(ans);
	return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict

MOD = 1000000007
iist = lambda: map(int,input().split())

N,M = iist()
Q = defaultdict(list)
for i in range(M):
  l,r,x = iist()
  Q[r].append((l,x))

if any(x != 1 for l,x in Q[1]):
  print(0)
  exit(0)

dp = defaultdict(int)
dp[0,0] = 3

x_sum = [3]
y_sum = [3]
s = 3

for pk in range(1,N):
  k = pk+1

  for i,(a,b) in enumerate(zip(x_sum,y_sum)):
    c = (a+b)%MOD
    dp[i,pk] = c
    x_sum[i] += c

  x_sum.append(0)
  y_sum.append((2*s)%MOD)
  s *= 3
  subQ = Q[k]

  for i,j in list(dp.keys()):
    for l,x in subQ:
      if x != (l<=i)+(l<=j)+1:
        c = dp[i,j]
        x_sum[i] -= c
        y_sum[j] -= c
        s -= c
        del dp[i,j]
        break

  for i in range(pk):
    x_sum[i] %= MOD
    y_sum[i] %= MOD
  s %= MOD

print(s)

Measured memory_bytes: 12524
import bisect
import collections
import functools
import heapq
import math
from collections import deque
from collections import defaultdict
MOD = 10**9+7

K = int(input())
S = list(input())
if len(S) > K:
    ans = "".join(S[:K])
    print(ans+"...")
else:
    ans = "".join(S)
    print(ans)

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    char c; cin >> c;
    vector<char> v{'a','i','u','e','o'};
    REP(i,5){
        if(c==v[i]){
            cout << "vowel" << endl;
            return 0;
        }
    }
    cout << "consonant" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);

    
        if(n <= 111)
            printf("111 ");
        
        else if(n > 111 && n <= 222)
            printf("222");
        
        else if(n > 222 && n <= 333)
            printf("333");

        else if(n > 333 && n <= 444)
            printf("444");
        
        else if(n > 444 && n <= 555)
            printf("555");
        
        else if(n > 555 && n <= 666)
            printf("666");

        else if(n > 666 && n <= 777)
            printf("777");
        
        else if( n > 777 && n <= 888)
            printf("888");

        else if(n > 888 && n <= 999)
            printf("999");
        
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
const ll INF = 4e18;
const ll MOD = 1e9+7;

ll n, m;
vector<int> G[100010];
map<int,bool> mp;
int cnt;

bool f (int k, bool g) {
  if (mp.count(k)) return !(mp[k]^g);

  mp[k] = g;
  if (g) cnt++;
  bool ff = 1;
  for (int i = 0; i < G[k].size(); i++) {
    ff &= f(G[k][i], !g);
  }
  return ff;
}

bool ok() {
  return !f(1, 0);
}

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

  cin >> n >> m;
  for (ll i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  if (ok()) {
    cout << (n - 1) * n / 2 - m << endl;
  } else {
    cout << cnt * (n-cnt) - m << endl;
  }
  return 0;
}


Measured memory_bytes: 11520
import java.util.*;

public class Main{
	//1110 start
	private void doit(){
		Scanner sc = new Scanner(System.in);
		int mapsize = 9;
		while(sc.hasNext()){
			int [][] pass = new int[mapsize][mapsize];
			for(int i = 0; i < mapsize; i++){
				String s = sc.next();
				if(i % 2 == 0){
					Arrays.fill(pass[i], 1);
					for(int j = 0; j < 4; j++){
						int c = s.charAt(j) - '0';
						pass[i][j * 2 + 1] = c;
					}
				}
				else{
					for(int j = 0; j < 5; j++){
						int c = s.charAt(j) - '0';
						pass[i][j * 2] = c;
					}
				}
			}
			
			int [] vx = {-1,0,1,0};
			int [] vy = {0,-1,0,1};
			String [] word = {"L", "U", "R", "D"};
			int nowx = 0, nowy = 0;
			int dir = 2;
			StringBuilder sb = new StringBuilder();
			while(true){
				for(int i = 3; i < 7; i++){
					int xx = nowx + vx[(i + dir) % 4];
					int yy = nowy + vy[(i + dir) % 4];
					int xxx = xx + vx[(i + dir) % 4];
					int yyy = yy + vy[(i + dir) % 4];
					if(! isOK(xx, yy, mapsize)) continue;
					if(! isOK(xxx, yyy, mapsize)) continue;
					if(pass[yy][xx] == 0) continue;
					if(pass[yyy][xxx] == 0) continue;
					nowx = xxx;
					nowy = yyy;
					dir = (i + dir) % 4;
					sb.append(word[(dir)]);
					break;
				}
				if(nowx == 0 && nowy == 0){
					break;
				}
			}
			System.out.println(sb.toString());
		}
	}
	
	private boolean isOK(int x,int y,int mapsize){
		if(0 <= x && x < mapsize && 0 <= y && y < mapsize){
			return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 10000
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


def solve():
    N, M = map(int, input().split())
    
    divs = make_divisors(M)
    ans = 0
    for div in divs:
        if div <= M / N:
            ans = max(ans, div)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
import java.util.Scanner;
import java.util.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		HashMap<String,Integer> h = new HashMap<String,Integer>();
		String a[] = new String[1000];
		int I = 0;
		int maxlength = 0;
		String maxleng = "";
		while(sc.hasNext()){
			String str = sc.next();
			if(h.containsKey(str)){
				int c = h.get(str).intValue();
				h.put(str,Integer.valueOf(c+1));
			}
			else{
				h.put(str,Integer.valueOf(1));
				a[I++] = str;
			}
		}
		int maxval = 0;
		String maxVal = "";
		for(int i=0;i<I;i++){
			if(h.get(a[i]).intValue() > maxval){
				maxval = h.get(a[i]).intValue();
				maxVal = a[i];
			}
			if(maxlength < a[i].length()){
				maxlength = a[i].length();
				maxleng = a[i];
			}
		}
		System.out.println(maxVal+" "+maxleng);
	}
}


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

int con[5],cnt[5];
int a,b;
int main() {

	int i;
	for(i=1;i<=3;++i)
	  cin>>a>>b,++con[a],++con[b];
	
	for(i=1;i<=4;++i)
	  ++cnt[con[i]];
	
	if(cnt[3]) puts("NO");
	  else if(cnt[2]==3) puts("NO");
	    else puts("YES");	
	
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  int m;

  REP(i,n){
    cin >> a[i];
    if(a[i] == 1) m = i;
  }
  
  m++;
  while(1){
    if((n - m) % (k-1)== 0){
      break;
    }
    m++;
  }
  int ans = 0;

  int i = 0;
  int p1 = m;
  while(1){
    if(p1 <= 1) break;
    p1 -= k-1;
    i++;
  }
  ans += i;
  i = 0;
  p1 = m;
  while(1){
    if(p1 >= n) break;
    p1 += k-1;
    i++;
  }
  ans += i;  
  
  cout << ans << endl;
  
}


Measured memory_bytes: 3756
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    N := nextInt()
    K := nextInt()
    h := make([]bool, 10)
	for i := 0; i < K; i++ {
		di := nextInt()
		h[di] = true
	}
 
	for {
		flag := true
		t := N
 
		for t > 0 && flag {
			if h[t%10] {
				flag = false
			}
			t /= 10
		}
 
		if flag {
			fmt.Println(N)
			break
		}
		N++
	}
 
 }
 
/* templates */
 
func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;

int A[50];
ll ans=0;

void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
    int indexes[k];
    recursive_comb(indexes, n - 1, k, f);
}

int main() {
    int a;
    cin>>a;
    rep(i,a){
        cin>>A[i];
    }
    foreach_comb(a, 2, [](int *indexes) {
         ans+=A[indexes[0]]*A[indexes[1]];
    });
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    long long a,b;
    cin>>a>>b;
    vector<long long> vec(a);
    long long sum=0;
    rep(i,a){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    if(a<=b){
        cout<<0<<endl;
    }
    else{
        rep(i,a-b){
            sum+=vec.at(i);
        }
        cout<<sum<<endl;
    }
}



Measured memory_bytes: 1792
#include<stdio.h>

int main(){
	int i,j,n;
	char s[200100];
	scanf("%s",s);
	for(i=0;s[i]!=0;i++);
	n=i;
	long long ans=0;
	int coa=0,cobc=0;
	long long anss[200001]={0};
	for(i=n-1;i>=0;i--){
		int cb=cobc;
		if(s[i-1]=='B'&&s[i]=='C'){
		while(s[i-1]=='B'&&s[i]=='C'){
			i-=2;
			cb++;
		}
		while(s[i]=='A'){
			anss[i]=cb;
			i--;
		}
		cobc=cb;
		i++;
		}else cobc=0;
	}
	for(i=0;i<n;i++){
		ans+=anss[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int BinarySearch(int key,int n,int S[]){
  int l=0,r=n;
  while(r-l>1){
    int mid=(l+r)/2;
    if(S[mid]>key)r=mid;
    else l=mid;
  }
  return S[l]==(key?1:0);
}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8


int main(){
    ll H,W;cin >> H >> W;
    char S[107][107];
    rep(i,H){
        cin >> S[i];
    }
    rep(i,H+2){
        if(i==0 || i==H+1){
            rep(j,W+2){
                cout << "#" ;
            }
        }
        else{
            cout << "#" << S[i-1] << "#" ;
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define SORT(x) sort((x).begin(),(x).end(),greater<int>())
using LL=long long;
using ULL=unsigned long long;
using PII=pair<int,int>;
const int INF = numeric_limits<int>::max();
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int N;
    cin >> N;
    vector<int> A( N );
    for( auto &x : A )
    {
        cin >> x;
    }
    multiset<int> st;
    REP( i, N )
    {
        st.emplace( A[ i ] );
        st.emplace( A[ i ] + 1 );
        st.emplace( A[ i ] - 1 );
    }
    int cnt{};
    REP( i, N * 3 )
    {
        int tmp = st.count( i );
        if( cnt < tmp )
        {
            cnt = tmp;
        }
    }
    cout << ( cnt == 0 ? N : cnt ) << endl;
    return 0;
}

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

const int N = 505;

int n, m, q;
vector<int> V[N];

int main() {
	scanf("%d %d %d", &n, &m, &q);
	for(int i = 0, a, b; i < m; ++i) {
		scanf("%d %d", &a, &b);
		V[a].emplace_back(b);
	}
	for(int i = 500; i; --i) {
		sort(V[i].begin(), V[i].end());
	}
	for(int i = 0, a, b; i < q; ++i) {
		scanf("%d %d", &a, &b);
		int sum = 0;
		for(int i = a; i <= 500; ++i) sum += upper_bound(V[i].begin(), V[i].end(), b) - V[i].begin();
		printf("%d\n", sum);	
	}
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main ()
{
	ll a, b;
	cin>>a>>b ;
	if(b>=a)
	{
		cout<<"unsafe"<<endl;
	}
	else
	{
		cout<<"safe"<<endl;
	}
	return 0;
}

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

int a;

int main() {
  cin >> a;
  cout << a+a*a+a*a*a << endl;
  return 0;
}


Measured memory_bytes: 3624
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
max = float("inf")
idx =1
s = 1
for i in h:
  if abs(t-i*0.006-a) < max:
    max = abs(t-i*0.006-a) 
    idx = s
  s += 1
print(idx)
  

Measured memory_bytes: 3060
import Control.Monad (replicateM)

f :: (Int, Int) -> Int -> (Int, Int)
f (m, r) x =
  (min m x, max r (x-m))

main :: IO ()
main =
  readLn >>=
    flip replicateM readLn >>=
      \(x:xs) -> print $ snd $ foldl f (x, -1000000007) xs


Measured memory_bytes: 133824
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if (dup(c,b) <= dup(a,d)) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3632
let () = Scanf.scanf "%s\n%d\n" @@ fun n k ->
  let same = Array.make_matrix (String.length n + 1) (k + 1) 0 in
  let small = Array.make_matrix (String.length n + 1) (k + 1) 0 in
  same.(0).(0) <- 1;
  for i = 0 to String.length n - 1 do
    for j = 0 to k do
      same.(i + 1).(j) <- 
        if n.[i] = '0'
        then same.(i).(j)
        else if 0 < j then same.(i).(j - 1) else 0;
      small.(i + 1).(j) <- small.(i).(j)
        + 9 * (if j > 0 then small.(i).(j - 1) else 0)
        + max 0 (Char.code n.[i] - Char.code '1')
          * (if j > 0 then same.(i).(j - 1) else 0)
        + (if n.[i] > '0' then same.(i).(j) else 0)
    done
  done;
  Printf.printf "%d\n" @@
  same.(String.length n).(k) + small.(String.length n).(k)

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

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n);
    for (int i = 0; i < q; i++) {
        int x;
        cin >> x;
        a[x - 1]++;
    }
    for (int i = 0; i < n; i++) {
        if (k - q + a[i] > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <map>

using namespace std;

#define int long long

signed main(){
    string str;
    cin >> str;
    map<char,int> data;
    for(int i=0;i<str.length();i++){
        data[str[i]]++;
    }
    int res=0;
    for(auto itr=data.begin();itr!=data.end();itr++){
        for(auto itr1=itr;itr1!=data.end();itr1++){
            if(itr==itr1){
                continue;
            }
            res+=(itr->second)*(itr1->second);
        }
    }
    cout << res+1 << endl;
    return 0;
}


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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

int main()
{

   ll n,k;
   cin >> n >> k;
   vector<ll> v(n+1);
   for(ll i=1;i<=n;i++) cin >> v[i];

   map<ll,ll> m;
   m[1]=1;
   ll dis[n+5];
   mset(dis,0);
   ll u=1;
   ll trv=0;
   ll dd;
   ll vv=1;
   ll i;
   while(1)
   {
       i=vv;
       vv=v[vv];
       if(m[vv]==1)
       {
           u=vv;
           //cout << "VV " << vv << endl;
           trv++;
           dd =  dis[i]-dis[vv]+1;
           //cout << "aa " << dis[u] << " " << trv << " " << dis[i] << endl;
           break;
       }
       trv++;
       dis[vv]=dis[i]+1;
       m[vv]=1;
   }
   ll ans;
   if(k <= trv)
   {

       if(k==trv) ans=u;
       else
       {

           for(ll i=1;i<=n;i++)
           {

               if(dis[i]==k) ans=i;
           }
       }
   }
   else
   {
       //aise;
       k-=trv;
       ll vs=k%dd;
       //cout << "VS " << vs << endl;
       ans=u;
       for(ll i=0;i<vs;i++) ans=v[ans];
   }
   cout << ans << endl;
}


Measured memory_bytes: 18656
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int dp[N],vis[N];
vector<int>e[N],p;
void dfs(int v)
{
	vis[v]=1;
	for(int i=0;i<e[v].size();i++)	
		if(!vis[e[v][i]])
			dfs(e[v][i]);
	p.push_back(v);
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			dfs(i);
	reverse(p.begin(),p.end());
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int v=p[i];
		for(int j=0;j<e[v].size();j++)
			dp[e[v][j]]=max(dp[e[v][j]],dp[p[i]]+1);
		ans=max(ans,dp[v]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8312
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, q; rd(n, q);
  auto tree=new SquareRootDecomposition(n);
  while(q--){
    auto args=readln.split.to!(int[]);
    if(args[0]==0){
      tree.add(args[1]-1, args[2], args[3]);
    }else{
      writeln(tree.sum(args[1]-1, args[2]));
    }
  }
}

class SquareRootDecomposition{ // starry
  import std.algorithm;
  int D=1, nil=-1;
  long[] val, buc, star;
  this(int n){
    while(D*D<n) D++;
    val.length=D*D;
    buc.length=star.length=D;
  }

  void add(int ql, int qr, long x){
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        star[k]+=x;
      }else{
        // push(k);
        foreach(i; max(l, ql)..min(r, qr)){
          buc[k]+=x;
          val[i]+=x;
        }
      }
    }
  }

  long sum(int ql, int qr){
    long ret=0;
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        ret+=(buc[k]+star[k]*D);
      }else{
        int s=max(l, ql), t=min(r, qr);
        ret+=star[k]*(t-s);
        foreach(i; s..t) ret+=val[i];
      }
    }
    return ret;
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


Measured memory_bytes: 3952
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
    
    char string[10001];
    char *pstr;
    int num;
    int moji;
    scanf("%d",&num);
    scanf("%s",string);
    
    pstr=string;
    
    while('\0' != *pstr) {
        if(((int)(*pstr) + num)>(int)'Z'){
            moji = (int)(*pstr) + num - 26;
        }else{
            moji = (int)(*pstr) + num;
        }
        printf("%c",(char)moji);
        pstr++;
    }
    
    return 0;
}

Measured memory_bytes: 128
#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];
	vector<int> dp(n);
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min((dp[i-2]+abs(a[i]-a[i-2])),(dp[i-1]+abs(a[i]-a[i-1])));
    }
    cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n, k;

  cin >> n >> k;

  if((n + 1) / 2 >= k)
    puts("YES");
  else
    puts("NO");

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if(a>0)cout<<"Positive"<<endl;
	else if(b<0){
		if ((b-a+1)%2==0)cout<<"Positive"<<endl;
		else cout<<"Negative"<<endl;
	}
	else cout<<"Zero"<<endl;
	
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long m = (long)(Math.pow(10,9))+7;
        long ans = 1;
        for(int i=1; i<=N; i++){
            ans*=i;
            ans%=m;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main(){
    ll n,m;
    cin >> n >> m;
    //ll k[m];
    ll k,temp;
    ll s[m][n];
    ll p[m];
    ll hoge[m];
  ll ans = 0;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            s[i][j] = 0;
        }
    }
    for(int i = 0; i < m;i++){
        cin >> k;
        for(int j = 0; j < k; j++){
            cin >> temp;
            s[i][temp-1] = 1;
        }
    }
    for(int i = 0; i < m; i++){
        cin >> temp;
        p[i] = temp;
    }
    ll sum = 0; // 部分集合の和
    for (ll bit = 0; bit < (1<<n); ++bit){
        bool can = true;
        for(int d = 0; d < m; d++){
            hoge[d] = 0;
        }
        for (ll i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が S に入っているなら足す
            for(int j = 0; j < m; j++){
                if(s[j][i] == 1){
                    hoge[j] += 1;
                }
            }
            }
        }
        for(int d =0 ; d < m; d++){
            if(hoge[d] % 2 != p[d]) can = false;
        }
        if(can) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> s(100020);
	long long int sum = 0;
	priority_queue<int> q;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		if (a > M) {
			continue;
		}
		s[a].push_back(b);
	}
	for (int i = 1; i <= M; i++) {
		int max = 0;
			for (int j = 0; j < s[i].size();j++) {
				if (s[i][j] > max) {
					q.push(max);
					max = s[i][j];
				}
				else {
					q.push(s[i][j]);
				}
			}
		if (!q.empty()) {
			if (q.top() > max) {
				q.push(max);
				max = q.top();
				q.pop();
			}
		}
		sum = max + sum;
	}
	cout << sum;
}

Measured memory_bytes: 6268
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

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

int main() 
{
    int n; cin >> n;
    cout << n*n << endl;
    return 0;
}



Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class SuffixArray {
	void CEB(vector<int> &v, vector<int> &b) {
		int vs = v.size(), bs = b.size();
		fill(b.begin(), b.end(), 0);
		for (int i = 0; i < vs; i++) b[v[i]]++;
		for (int i = 1; i < bs; i++) b[i] += b[i - 1];
	}
	void ISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) {
		int vs = v.size(), bs = b.size();
		fill(b.begin(), b.end(), 0);
		for (int i = 0; i < vs; i++) b[v[i]]++;
		int sum = 0;
		for (int i = 0; i < bs; i++) b[i] += sum, swap(sum, b[i]);
		for (int i = 0; i < vs; i++) {
			if (SA[i] > 0 && isL[SA[i] - 1]) SA[b[v[SA[i] - 1]]++] = SA[i] - 1;
		}
	}
	void IISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) {
		CEB(v, b);
		for (int i = v.size() - 1; i >= 0; i--) {
			if (SA[i] > 0 && !isL[SA[i] - 1]) SA[--b[v[SA[i] - 1]]] = SA[i] - 1;
		}
	}
	vector<int>SA_IS(vector<int> v, int mv) {
		int vs = v.size();
		if (vs == 1) return vector<int>(1, 0);
		vector<int> isL(vs), b(mv + 1), SA(vs, -1), ord(vs);
		auto isLMS = [&](int x)->bool { return x > 0 && isL[x - 1] && !isL[x]; };
		for (int i = vs - 2; i >= 0; i--) isL[i] = (v[i] > v[i + 1]) || (v[i] == v[i + 1] && isL[i + 1]);
		CEB(v, b);
		for (int i = 0; i < vs; i++) {
			if (isLMS(i)) SA[--b[v[i]]] = i;
		}
		ISort(v, SA, mv, b, isL);
		IISort(v, SA, mv, b, isL);
		int cur = 0;
		for (int i = 0; i < vs; i++) {
			if (isLMS(i)) ord[i] = cur++;
		}
		vector<int> nxv(cur);
		cur = -1;
		int prev = -1;
		for (int i = 0; i < vs; i++) {
			if (!isLMS(SA[i])) continue;
			bool diff = false;
			for (int d = 0; d < vs; d++) {
				if (prev == -1 || v[SA[i] + d] != v[prev + d] || isL[SA[i] + d] != isL[prev + d]) {
					diff = true;
					break;
				}
				else if (d && isLMS(SA[i] + d))break;
			}
			if (diff) cur++, prev = SA[i];
			nxv[ord[SA[i]]] = cur;
		}
		vector<int> reord(nxv.size());
		for (int i = 0; i < vs; i++) {
			if (isLMS(i)) reord[ord[i]] = i;
		}
		vector<int> nxSA = SA_IS(nxv, cur);
		CEB(v, b);
		for (int i = 0; i < SA.size(); i++) SA[i] = -1;
		for (int i = nxSA.size() - 1; i >= 0; i--) {
			SA[--b[v[reord[nxSA[i]]]]] = reord[nxSA[i]];
		}
		ISort(v, SA, mv, b, isL);
		IISort(v, SA, mv, b, isL);
		return SA;
	}
	vector<int>SA_IS(string s) {
		vector<int> v(s.size() + 1);
		for (int i = 0; i < s.size(); i++) v[i] = s[i] + 1;
		return SA_IS(v, *max_element(v.begin(), v.end()));
	}
public:
	string s;
	vector<int> sa;
	void init(string &T) {
		s = T;
		sa = SA_IS(s);
	}
	SuffixArray(string &t) { init(t); }
	SuffixArray() {}
	bool contain(string &t) {
		int a = 0, b = s.size();
		while (b - a > 1) {
			int c = (a + b) / 2;
			if (s.compare(sa[c], t.size(), t) < 0) a = c;
			else b = c;
		}
		return s.compare(sa[b], t.size(), t) == 0;
	}
};
int q; string s, t;
int main() {
	cin >> s >> q;
	SuffixArray v(s);
	for(int i = 0; i < q; i++) {
		cin >> t;
		cout << (v.contain(t) ? 1 : 0) << endl;
	}
}

Measured memory_bytes: 37060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
vvl matmul(vvl f1, vvl f2, ll m){
    ll a=f1.size(), b=f2[0].size(), c=f2.size();
    vvl ret(a, vl(b, 0));
    rep(i,a)rep(j,b)rep(k,c){
        ret[i][j] = (ret[i][j] + f1[i][k] * f2[k][j]) % m;
    }
    return ret;
}

vvl matpow(vvl f, ll t, ll m){
    if(t<=1) return f;

    if(t%2){
        return matmul(f, matpow(f, t-1, m), m);
    }else{
        auto half = matpow(f, t/2, m);
        return matmul(half, half, m);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,a,b,c,t;
    while(cin>>n>>m>>a>>b>>c>>t, n){
        vl s(n);
        cin>>s;
        vvl f(n,vl(n,0));
        vvl f2(n,vl(1,0));
        if(t==0){a=c=0,b=1;}
        rep(i,n){
            f2[i][0]=s[i];
            if(i-1>=0)f[i][i-1]=a;
            f[i][i]=b;
            if(i+1<n)f[i][i+1]=c;
        }
        f2 = matmul(matpow(f, t, m),f2,m);
        puta(f2);
        
    }
    return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  long long N, A, B;
  cin >> N >> A >> B;
  vector<int> city(N);
  for(int i = 0; i < N; i++) cin >> city[i];
  long long ans = 0;
  for(int i = 0; i < N-1; i++){
    ans += min((city[i+1] - city[i]) * A, B);
  }
  cout << ans <<endl;
}

Measured memory_bytes: 3732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   cout << min(a,b) + min(c,d) << endl;
   return 0;
}



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>;

int INF = 1001001001;


int main() {
    ll h;
    cin >> h;
    ll ans = 0, x = 1;
    while (h > 1) {
        ans += x;
        h /= 2;
        x *= 2;
    }
    ans += x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616