akhauriyash/Code-Regression huggingface dataset:
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

public class Main {
	static Scanner sc;
	static char[][] map;
	static int H, W;

	public static void main(String[] args) throws Exception {
		//InputStream in = new FileInputStream("src/input.txt");
		InputStream in = System.in;

		sc = new Scanner(in);

		H = sc.nextInt();
		W = sc.nextInt();

		map = new char[H][W];
		for(int h = 0; h < H; h++){
			String line = sc.next();
			for(int w = 0; w < W; w++){
				map[h][w] = line.charAt(w);
			}
		}

		for(int h = 0; h < H; h++){
			for(int w = 0; w < W; w++){
				if(map[h][w] == '#'){
					System.out.print("#");
				}else{
					System.out.print(count(h, w));
				}
			}
			System.out.println();
		}
	}

	public static int count(int h, int w){
		int answer = 0;

		for(int i = -1; i <= 1; i++){
			for(int j = -1; j <= 1; j++){
				try{
					if(map[h+i][w+j] == '#'){
						answer++;
					}
				}catch (Exception e) {
					// TODO: handle exception
				}
			}
		}

		return answer;
	}
}

Measured memory_bytes: 22740
package main

import "fmt"

func foo(m map[uint64]uint64, n, a, b, c, d uint64) uint64 {
	if n == 0 {return 0}
	if n == 1 {return d}
	if m[n] > 0 {return m[n]}

	res := n * d
	f2 := n / 2
	c2 := (n + 1) / 2
	f3 := n / 3
	c3 := (n + 2) / 3
	f5 := n / 5
	c5 := (n + 4) / 5

	res = min(res, (n - f2 * 2) * d + a + foo(m, f2, a, b, c, d))
	res = min(res, (c2 * 2 - n) * d + a + foo(m, c2, a, b, c, d))

	res = min(res, (n - f3 * 3) * d + b + foo(m, f3, a, b, c, d))
	res = min(res, (c3 * 3 - n) * d + b + foo(m, c3, a, b, c, d))

	res = min(res, (n - f5 * 5) * d + c + foo(m, f5, a, b, c, d))
	res = min(res, (c5 * 5 - n) * d + c + foo(m, c5, a, b, c, d))

	m[n] = res
	return res
}

func min(a, b uint64) uint64 {
	if a < b {return a}
	return b
}
 
func main() {
	var t int
	fmt.Scanf("%d", &t)
 
	for i := 0; i < t; i++ {
		var n, a, b, c, d uint64
		fmt.Scanf("%d %d %d %d %d", &n, &a, &b, &c, &d)
		res := foo(make(map[uint64]uint64), n, a, b, c, d)
		fmt.Println(res)
	}
}

Measured memory_bytes: 6324
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

class Node {
public:
  int to;
  int dist;
  Node() {}
  Node(int _t,int _d) : to(_t),dist(_d){}
};

bool is_LPG[6001];
bool dp[6001][2001]; //dp[city_id][remaining_LPG] = dist;

int get_city_id(map<string,int>& cities,const string& city){
  if(cities.find(city) == cities.end()){
    int idx = cities.size();
    cities[city] = idx;
  }
  return cities[city];
}

class State {
public:
  int city_id;
  int dist;
  int remaining_LPG;
  State(int _city_id,int _dist,int _con){
    city_id = _city_id;
    dist = _dist;
    remaining_LPG = _con;
  }

  bool operator <(const State& s) const{
    return (dist < s.dist);
  }

  bool operator >(const State& s) const{
    return (dist > s.dist);
  }
};

int main(){
  int total_roads;
  int total_LPG_stations;
  int capacity;
  while(cin >> total_roads >> total_LPG_stations >>capacity){
    if(total_roads == 0
       && total_LPG_stations == 0
       && capacity == 0) break;

    map<string,int> cities;
    memset(is_LPG,false,sizeof(is_LPG));
    memset(dp,false,sizeof(dp));

    string src,dst;
    cin >> src >> dst;
    get_city_id(cities,src);
    get_city_id(cities,dst);

    vector<vector<Node> > nodes(total_roads*2);
    for(int road_idx = 0; road_idx < total_roads; road_idx++){
      string from_str,to_str;
      int dist;

      cin >> from_str >> to_str >> dist;
      int from_num = get_city_id(cities,from_str);
      int to_num = get_city_id(cities,to_str);

      nodes[from_num].push_back(Node(to_num,dist));
      nodes[to_num].push_back(Node(from_num,dist));
    }

    for(int LPG_idx = 0; LPG_idx < total_LPG_stations; LPG_idx++){
      string city;
      cin >> city;
      is_LPG[get_city_id(cities,city)] = true;
    }

    priority_queue<State,vector<State>, greater<State> > que;
    que.push(State(get_city_id(cities,src),0,10*capacity));

    int dst_id = get_city_id(cities,dst);

    int res = INF;

    while(!que.empty()){
      State s = que.top();
      que.pop();

      if(dp[s.city_id][s.remaining_LPG]) continue;
      dp[s.city_id][s.remaining_LPG] = true;

      if(s.city_id == dst_id){
	res = s.dist;
	goto found;
      }


      for(int to_idx=0;to_idx<nodes[s.city_id].size();to_idx++){
	int to = nodes[s.city_id][to_idx].to;
	int dist = nodes[s.city_id][to_idx].dist;
	if(s.remaining_LPG < dist) continue;

	int next_remaining_LPG = (is_LPG[to] ? 10 * capacity : s.remaining_LPG - dist);

	que.push(State(to,s.dist + dist,next_remaining_LPG));
      }
    }
  found:;
    printf("%d\n",res >= INF ? -1 : res);
  }
  return 0;
}

Measured memory_bytes: 63276
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
  ll n,k;
  cin>>n>>k;
  ll a[n];
  ll i;
   ll dp[n]={0};
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    dp[i]=INT_MAX;
  }
 
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(i=2;i<n;i++)
  {
      for(ll j=i-1;j>=i-k&&j>=0;j--)
    dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
  }
  cout<<dp[n-1];
  
  
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		int n = sc.nextInt();
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(0);
		int s;
		for(int i=0;i<n;i++){
			s = sc.nextInt();
			if(!map.containsKey(s)){
				map.put(s, 0);
			}
			map.put(s,map.get(s)+1);
		}
		int q = sc.nextInt();
		int t;
		int ans = 0;
		for(int i=0;i<q;i++){
			t = sc.nextInt();
			if(map.containsKey(t)) ans++;
		}
		cout(ans);
	}
	
	
	
	public static boolean isPrime(int n){
		for(int i=2;i<=n*n;i++){
			if(n%i==0) return true;
		}
		return false;
	}
	public static int gcd(int a,int b){
		if(a%b==0) return b;
		else return gcd(b,a%b);
	}
	public static void showary(int[] ary){
		for(int i=0;i<ary.length-1;i++){
			System.out.print(ary[i]+" ");
		}
		cout(ary[ary.length-1]);
	}
	public static void cout(String n){
		System.out.println(n);
	}
	
	public static void cout(int n){
		System.out.println(n);
	}
	public static void cout(boolean n){
		if(n==true){
			cout("true");
		}else{
			cout("false");
		}
	}
}

Measured memory_bytes: 40400
fun main(args: Array<String>) {
    readLine()
    var A = readLine()!!.split(" ").map { it.toInt() }
    var cnt = 0
    while (A.filter { it % 2 != 0 }.size == 0) {
        cnt++
        A = A.map { it / 2 }
    }
    println(cnt)
}


Measured memory_bytes: 36088
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const ll INF = LLONG_MAX / 3;
int A[5001];
ll dp[5001][5001];
int no[5001][5001], sub[5001];
vi G[5001];

void f(int u, int p) {
    int &num = sub[u];
    num = 1;
    each(v, G[u])if (v != p)f(v, u);

    vll cur(5001, INF), nex(5001);
    vector<bool> cc(5001, false), nn(5001);
    cur[0] = A[u];
    if (A[u] > 0)cc[0] = true;
    
    each(v, G[u]) if (v != p) {
        rep(i, num + sub[v]) {
            nex[i] = INF;
            nn[i] = false;
        }
        rep(i, num) {
            rep(j, sub[v]) {
                // 切断
                if (dp[v][j] < 0 || no[v][j]) {
                    smin(nex[i + j + 1], cur[i]);
                    if (cc[i]) {
                        nn[i + j + 1] = true;
                    }
                }
                //切断しない
                if (cc[i] && no[v][j])nn[i + j] = true;
                smin(nex[i + j], cur[i] + dp[v][j]);
            }
        }

        num += sub[v];
        swap(cur, nex);
        swap(cc, nn);
    }

    rep(i, num) {
        dp[u][i] = cur[i];
        no[u][i] = cc[i];
    }
}

void solve() {
    int N;
    cin >> N;
    rep(i, N)cin >> A[i];
    rep(i, N - 1) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    f(0, -1);
    int ans = N;
    rep(i, N) {
        if (dp[0][i] < 0 || no[0][i])smin(ans, i);
    }
    cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 293888
n,k = map(int,input().split())
A=[int(i) for i in input().split()]
MOD = 10**9 + 7

def tent(a):
    t = len(a)
    res = 0
    for i in range(t-1):
        for j in range(i+1,t):
            if(a[i]>a[j]):
                res+=1
    return res
t1 = tent(A)
t2 = tent(A+A)-2*t1
ans = (t1*k%MOD + t2*(k*(k-1))//2%MOD)%MOD
print(ans)


Measured memory_bytes: 9252
import java.util.*;
public class Main {
	static String S;
	static int p;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int m = sc.nextInt();
			int w = sc.nextInt();
			if(m == 0 && w == 0) break;
			long[] bm = new long[m];
			long[] bw = new long[w];
			
			for (int i = 0; i < m; i++) {
				bm[i] = sc.nextLong();
			}
			for (int i = 0; i < w; i++) {
				bw[i] = sc.nextLong();
			}
			long[][] dp = new long[m+1][1 << w];
			for(int i = 0; i < m+1; i++) {
				Arrays.fill(dp[i], -1);
			}
			dp[0][0] = 0L;
			for(int i = 0; i < m; i++) {
				for(int j = 0; j < (1 << w); j++) {
					if(dp[i][j] == -1) continue;
					dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j]);
					for(int k = 0; k < w; k++) {
						if((j & (1 << k)) != 0) continue;
						dp[i+1][j | (1 << k)] = Math.max(dp[i+1][j | (1 << k)], dp[i][j] + Math.abs(bm[i] - bw[k]) * ((Math.abs(bm[i] - bw[k])-30) * (Math.abs(bm[i] - bw[k])-30)));
					}
				}
			}
			long max = 0;
			for(int i = 0; i < (1 << w); i++) {
				max = Math.max(dp[m][i], max);
			}

			System.out.println(max);
		}




	}

}

Measured memory_bytes: 25148
import sys

N = int(input())
a_list = list(map(int, input().split()))

def inZero(nums):
  return 0 in nums

def isOverDigits(nums):
  digits = 0

  for i in range(len(nums)):
    digits += len(str(nums[i])) - 1

  if digits > 18:
    return True
  else:
    return False

def calcAns(nums):
  ans = 1
  for i in range(len(nums)):
    ans = ans * nums[i]
    if ans > 10**18 :
      return False
  return ans

if inZero(a_list):
  print(0)
  sys.exit()

ans = calcAns(a_list) 

if ans :
  print(ans)
else :
  print(-1)





Measured memory_bytes: 84756
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let l = get!(usize);
    println!("{}", (l*l*l) as f64 / 27.0);
}


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

int main(void) {
    int n, l, left, right, eat;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> l;
    left = l;
    right = l + n - 1;
    if (right <= 0) {
        eat = right;
    } else if (left >= 0) {
        eat = left;
    } else {
        eat = 0;
    }

    cout << (right + left) * (right - left + 1) / 2 - eat << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    int n,q; cin>>n>>q;
    string s; cin>>s;
    vector<pair<int,int>> a(q);
    rep(i,q) cin>>a[i].first>>a[i].second;
    vector<int> box(n,0);
    for(int i=1; i<=n-1; i++){
        if(s[i-1]=='A'&&s[i]=='C') box[i]++;
    }
    for(int i=1; i<=n-1; i++){
        box[i]+=box[i-1];
    }
    rep(i,q){
        cout<<box[a[i].second-1]-box[a[i].first-1]<<endl;
    }
}

Measured memory_bytes: 2176
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define MAX_N	(1120)
#define MAX_K	(14)
#define MAX_NP	(200)

/* typedef */

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

/* global variables */

bool primes[MAX_N + 1];
vi pnums;
int np;

int cache[MAX_N + 1][MAX_K + 1][MAX_NP];

/* subroutines */

void calc_prime(int max_p) {
  primes[0] = primes[1] = false;
  for (int p = 2; p <= max_p; p++) primes[p] = true;

  for (int p = 2; p * p <= max_p; p++)
    if (primes[p])
      for (int q = p * p; q <= max_p; q += p) primes[q] = false;

  for (int p = 2; p <= max_p; p++)
    if (primes[p]) pnums.push_back(p);

  np = pnums.size();
}

int count_rec(int n, int k, int pi) {
  if (cache[n][k][pi] >= 0) return cache[n][k][pi]; 
  
  int count = 0;

  for (int i = pi; i < np; i++) {
    int pni = pnums[i];
    if (n < pni) break;

    count += count_rec(n - pni, k - 1, i + 1);
  }

  return (cache[n][k][pi] = count);
}

/* main */

int main() {
  calc_prime(MAX_N);

  memset(cache, -1, sizeof(cache));

  for (int n = 0; n <= MAX_N; n++)
    for (int pi = 0; pi <= np; pi++)
      cache[n][1][pi] = 0;

  for (int i = 0; i < np; i++) {
    int pni = pnums[i];
    for (int j = 0; j <= i; j++)
      cache[pni][1][j] = 1;
  }
  
  for (;;) {
    int n, k;
    cin >> n >> k;
    if ((n | k) == 0) break;

    int count = count_rec(n, k, 0);
    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 14360
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

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

	if (N >= B-1)
		cout << floor(A*(B-1) / B) << endl;
	else
		cout << floor(A*N / B) << endl;
}



Measured memory_bytes: 3788
N, M = map(int,input().split())
ans = "IMPOSSIBLE"
links = [[]for _ in range(N+1)]
for _ in range(M):
    a,b = map(int,input().split())
    links[a].append(b)
    links[b].append(a)
for i in links[1]:

    if N in links[i]:
        ans = "POSSIBLE"
        break
print(ans)

Measured memory_bytes: 38320
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;

inline double bmi(double w, double h) {
  return w / (h*h);
}

int main() {
  string s;
  while(cin >> s) {
    replace(s.begin(), s.end(), ',', ' ');
    stringstream ss(s);
    int id;
    double w, h;
    ss >> id >> w >> h;
    if(bmi(w,h) >= 25) cout << id << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
using namespace std;
#include <math.h>
#define ll long long 
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
#define max1 100001

long long int mod=1e9 +7 ;
int n;
double dp[3000][3000];
vector<double> p(3000);
double solve(int i,int cth){
	//cout<<i<<" "<<cth<<endl;
	if(i==n){
		if(cth>=(n+1)/2)
			return 1;
		return 0;
	}
	if(dp[i][cth]!=-1){
		return dp[i][cth];
	}

	double ans=p[i]*solve(i+1,cth+1);
	ans+=(1-p[i])*solve(i+1,cth);
	return dp[i][cth]=ans;
}

int main(){	
	for (int i = 0; i < 3000; ++i)
	{
		for (int j = 0; j < 3000; ++j)
		{
			dp[i][j]=-1;
		}
	}
	cin>>n;
	
	for (int i = 0; i < n; ++i)
	{
		cin>>p[i];
	}
	std::cout<<std::fixed;
	std::cout<<std::setprecision(10)<<solve(0,0);




		
}
	
	
	
	





Measured memory_bytes: 70784
#include <stdio.h>

int main ( ) {
    int a , b , c ;
    int s_1 , s_2 , s_3 ;
    int min ;

    while ( ~scanf ( "%d%d%d" , &a , &b , &c ) ) {
        if ( a == b && a == c && b == c ) {
            printf  ( "%d\n" , a + b ) ;
        }
        else {
            s_1 = a + b , s_2 = a + c , s_3 = b + c ;
            min = s_1 ;
            if ( min > s_2 ) {
                min = s_2 ;
            }
            if ( min > s_3 ) {
                min = s_3 ;
            }

            printf ( "%d\n" , min ) ;

        }


    }
    return 0 ;
}




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

using namespace std;

void meufor() {
    for (int i=0; i<10; i++) {

    }
}

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

    string n;

    cin >> n;

    bool ok = false;
    char ant = n[0];
    for (int i=1; i<n.size(); i++) {
        if (ant == n[i]) {
            ok = true;
            break;
        } else ant = n[i];
    }

    if (ok) printf("Bad\n");
    else printf("Good\n");
}


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

int main(){
	int N;
	cin>>N;
	vector<long>A;
	int tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		A.push_back(tmp);
	}
	sort(A.begin(),A.end(),greater<int>());
	long ans=A[0];
	while(A.size()!=1){
		/*
		for(int i=0;i<A.size();++i){
			cout<<A[i]<<" ";
		}
		cout<<endl;
		*/
		for(int i=1;i<N;++i){
			A[i]%=A[0];
		}
		sort(A.begin(),A.end(),greater<int>());
		while(A[A.size()-1]==0)A.pop_back();
		sort(A.begin(),A.end());
		if(A[0]!=0)ans=A[0];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1524
#include<iostream>
using namespace std;
int main() {
	int K;
	string S;
	cin >> K >> S;
	if (S.length() > K) {
		for (int i = 0; i < K; i++) {
			cout << S[i];
		}
		cout << "..." << endl;
	}
	else {
		cout << S << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <limits>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <array>
#include <tuple>
#include <utility>
#include <cctype>
#include <typeinfo>
using namespace std;

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define ii(n)    ff(i, n)
#define kk(n)    ff(k, n)
#define mm(n)    ff(m, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define iii(a, b) fff(i, a, b)
#define kkk(a, b) fff(k, a, b)
#define mmm(a, b) fff(m, a, b)
#define xx first
#define yy second
#define bb begin()
#define ee end()
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }

using LL = long long;
using pii = pair<int, int>;


const LL INF = 9223372036854775807LL;
//const int INF = 2147483647;
   

const LL MOD = LL(1e9) + 7;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout << '\n';
    

    int N;
    cin >> N;
    vector<int> aa(N);
    ii (N)
        cin >> aa[i];
    sort(all(aa));

    LL rr = 1;
    if (N % 2 == 1 && aa[0] != 0) {
        cout << "0\n";
        return 0;
    }
    int extra = (N % 2);
    ii (N/2) {
        if (aa[extra + 2*i]   != 2*i + 1 + extra
        ||  aa[extra + 2*i+1] != 2*i + 1 + extra) {
            cout << "0\n";
            return 0;
        }

        rr = (rr * 2) % MOD;
    }

    cout << rr << '\n';


    return 0;


}



Measured memory_bytes: 768
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, H, W, N);
    auto vs = makeV<int>(0, H, W);

    rep(i, 0, N) {
        var(int, y, x, v);
        --y, --x;
        vs[y][x] = v;
    }

    auto dp = makeV<i64>(0, H + 1, W + 1, 4);

    rep(y, 0, H) rep(x, 0, W) rep(k, 0, 4) {
        chmax(dp[y + 1][x][0], dp[y][x][k]);
        chmax(dp[y][x + 1][k], dp[y][x][k]);
        if (vs[y][x] && k < 3) {
            chmax(dp[y + 1][x][0], dp[y][x][k] + vs[y][x]);
            chmax(dp[y][x + 1][k + 1], dp[y][x][k] + vs[y][x]);
        }
    }

    print(
        max(*max_element(all(dp[H][W - 1])), *max_element(all(dp[H - 1][W]))));

    return 0;
}


Measured memory_bytes: 672136
#a,b=(int(x) for x in input().split()) #数値の時




#a,b=(x for x in input().split()) 
a=input()
print("\n")
b=input()
t=len(a)
aa=[]
bb=[]
for i in range(t):
    aa.append(a[i])
    bb.append(b[i])
 
if(aa==bb):
  print("Yes")
else:
	print("No")

Measured memory_bytes: 9068
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
    string S;
    cin >> S;
    int N = S.size();
    string T = "keyence";
    int count = 0;
    for(int i = 0; i < 7; i++){
        if(S[i]==T[i]){
            count++;
        }else{
            break;
        }
    }
    string ans = "YES";
    for(int i = count; i < 7; i++){
        if(S[N-7+i]!=T[i]){
            ans = "NO";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
R = [0] * N
for i in range(N):
    R[i] = I()
Min = R[0]
Max = R[1] - R[0]

for i in range(1, N):
    Max = max(Max, R[i] - Min)
    Min = min(Min, R[i])

print(Max)


Measured memory_bytes: 14628
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vi a(n,inf);
		for(int i=0;i<n;i++){
			string s;
			cin>>s;
			if(s!="x") a[i]=atoi(s.c_str());
		}
		int l=-inf,r=inf;
		for(int i=0;i<n;i++){
			if(a[i]==inf){
			if(i+1<n){
				if(a[i+1]==inf){
					l=r;
					break;
				}
				if(i%2==0) r=min(r,a[i+1]);
				else l=max(l,a[i+1]);
			}
			if(i-1>=0){
				if(a[i-1]==inf){
					l=r;
					break;
				}
				if(i%2==0) r=min(r,a[i-1]);
				else l=max(l,a[i-1]);
			}
			}
			else{
			if(i+1<n){
				if(a[i+1]!=inf&&(i%2==0&&a[i+1]<=a[i]||i%2==1&&a[i+1]>=a[i])){
					l=r;
					break;
				}
			}
			if(i-1>=0){
				if(a[i-1]!=inf&&(i%2==0&&a[i-1]<=a[i]||i%2==1&&a[i-1]>=a[i])){
					l=r;
					break;
				}
			}
			}
		}
//		cout<<l<<' '<<r<<endl;
		if((ll)r-l==2) cout<<l+1<<endl;
		else if((ll)r-l>2) cout<<"ambiguous"<<endl;
		else cout<<"none"<<endl;
	}
}


Measured memory_bytes: 3148
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextInt() ) {

	    final int a = stdin.nextInt();
	    final int b = stdin.nextInt();

	    System.out.println( a + b );	    
	}	
    }    
}

Measured memory_bytes: 20372
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    int maxlong(int x){ //最大の木の長さ
      int ans=0;
      int a[x]={};
      rep(i,x){
      a[root(i)]++;
      }
      rep(i,x){chmax(ans,a[i]);}
      return ans;
    }


};

int main() {
  int n;
  cin >>n;
  UnionFind tree(n);
  int m;
  cin >>m;

  rep(i,m){
    int a,b;
    cin >> a >>b;
    a--;b--;
    tree.unite(a,b);
  }

  cout << tree.maxlong(n) << endl;
}

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

int main() {
  int n,count=0;
  cin >> n;
  vector<int> v(n);
  r(i,n)cin >> v[i];
  sort(v.begin(),v.end());
  r(i,n-1)if(v[i]==v[i+1])count++;
  cout<<n-(count+1)/2*2<<endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
  int a,b,c,d;
  int ans = 0;
  scanf("%d %d %d %d",&a,&b,&c,&d);

  if(a < b){
    ans += a;
  }else{
    ans += b;
  }

  if(c < d){
    ans += c;
  }else{
    ans += d;
  }

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

Measured memory_bytes: 128
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;
int main() {
	string s;
	cin >> s;
	if (s == "KIHBR" || s == "KIHBRA" || s == "KIHBAR" || s == "KIHBARA" || s == "KIHABARA" || s == "KIHABAR" || s == "KIHABR" || s == "KIHABRA") {
		cout << "YES" << endl;
		return 0;
	}
	if (s == "AKIHBR" || s == "AKIHBRA" || s == "AKIHBAR" || s == "AKIHBARA" || s == "AKIHABARA" || s == "AKIHABAR" || s == "AKIHABR" || s == "AKIHABRA") {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;



int main(){
	int n, m, i, j;
	cin >> n >> m;
	vector<int>v(n + 5);
	for (i = 0; i < n; i++) cin >> v[i];
	for (i = 1; i <= m; i++) {
		for (j = 0; j < n-1; j++) {
			if (v[j] % i > v[j + 1] % i) swap(v[j], v[j + 1]);
		}
	}
	for (i = 0; i < n; i++) cout << v[i] << endl;
	return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int x, y; cin >> x >> y;
  cout << x + y/2 << endl;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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



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

  ll cnt = 0;
  ll ans = 0;
  REP(i, s.size()) {
    switch(s[i]) {
    case 'B':
      cnt ++;
      break;
    case 'W':
      ans += cnt;
      break;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{   /*
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); /**/
    string s, t;
    cin >> s >> t;
    if (s.size() < t.size())
    {
        cout << "UNRESTORABLE";
        return 0;
    }
    vector<string> ans;
    for (int i = 0; i <= s.size() - t.size(); i++)
    {
        string now = s;
        bool ch = true;
        for (int j = 0; j < t.size(); j++)
        {
            if (s[i + j] == '?')
            {
                now[i + j] = t[j];
                continue;
            }
            if (s[i + j] != t[j])
            {
                ch = false;
                break;
            }
        }
        if (!ch)
            continue;
        for (int j = 0; j < s.size(); j++)
            if (now[j] == '?')
                now[j] = 'a';
        ans.push_back(now);
    }
    if (ans.empty())
    {
        cout << "UNRESTORABLE";
        return 0;
    }
    sort(ans.begin(), ans.end());
    cout << ans[0];
    return 0;
}


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

int main(){

    vector<vector <int>> bingo(3, vector<int>(3));
    vector<vector <int>> ans(3, vector<int>(3));
    int i, j;

    for (i=0; i<3; i++){
        for (j=0; j<3; j++){
            cin >> bingo.at(i).at(j);
        }
    }

    int N, temp, count;
    cin >> N;

    for (count=0; count<N; count++){
        cin >> temp;
        for (i=0; i<3; i++){
            for (j=0; j<3; j++){
                if ( bingo.at(i).at(j) == temp){
                    ans.at(i).at(j) = 1;
                }
            }
        }
    }

    if ( (ans.at(0).at(0) == 1) && (ans.at(0).at(1) == 1) && (ans.at(0).at(2) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(1).at(0) == 1) && (ans.at(1).at(1) == 1) && (ans.at(1).at(2) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(2).at(0) == 1) && (ans.at(2).at(1) == 1) && (ans.at(2).at(2) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(0).at(0) == 1) && (ans.at(1).at(0) == 1) && (ans.at(2).at(0) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(0).at(1) == 1) && (ans.at(1).at(1) == 1) && (ans.at(2).at(1) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(0).at(2) == 1) && (ans.at(1).at(2) == 1) && (ans.at(2).at(2) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(0).at(0) == 1) && (ans.at(1).at(1) == 1) && (ans.at(2).at(2) == 1)){
        cout << "Yes" << endl;
    }
    else if ( (ans.at(0).at(2) == 1) && (ans.at(1).at(1) == 1) && (ans.at(2).at(0) == 1)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << 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;

typedef long long ll;

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    rep(i, N) {
        cin >> A[i];
    }
    vector<ll> C(3001, 1);
    ll MOD = 998244353;
    ll D = mod_pow(2, MOD - 2, MOD);
    rep(i, 3000) C[i + 1] = (C[i] * 2) % MOD;
    vector<vector<ll>> T(N + 1, vector<ll> (3001, 0));
    T[0][0] = C[N];
    rep(i, N) {
        rep(j, 3001) {
            T[i + 1][j] += T[i][j];
            T[i + 1][j] %= MOD;
            if (j + A[i] < 3001) {
                T[i + 1][j + A[i]] += (T[i][j] * D) % MOD;
            }
        }
    }
    cout << T[N][S] << "\n";
}

Measured memory_bytes: 73692
fun main(args: Array<String>) {
    val N = readLine()!!
    var ans = 0
    var next = 0
    var five = false
    N.reversed().toCharArray().map { c -> c - '0' }.forEach { i ->
        var ii = i + next
        if (five && ii >= 5) {
            ii++
        }
        five = false
        if (ii < 5) {
            ans += ii
            next = 0
        } else if (ii == 5) {
            ans += 5
            five = true
            next = 0
        } else {
            ans += (10 - ii)
            next = 1
        }
    }
    if (next == 1) ans++
    println(ans)
}

Measured memory_bytes: 45344
s = input()
    
ans1, ans2 = 0, 0

for i in range(len(s)):
    if i % 2 == 1 and s[i] == "0":
        ans1 += 1
    elif i % 2 == 0 and s[i] == "1":
        ans1 += 1
            
for i in range(len(s)):
    if i % 2 == 1 and s[i] == "1":
        ans2 += 1
    elif i % 2 == 0 and s[i] == "0":
        ans2 += 1

print(min(ans1, ans2))

Measured memory_bytes: 3188
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b, c;
char ch;

int main(){
    INIT;
    int ans1 = 0, ans2 = 0;
    while(cin >> a >> ch >>b >> ch >> c){
        if(a*a + b*b == c*c)ans1++;
        else if(a == b)ans2++;
    }
    cout << ans1 << endl << ans2 << endl;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<string>S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  if(N==1){
    cout<<1<<endl;
  }
  else{
    sort(S.begin(),S.end());
    int count=1;
    string mark=S.at(0);
    for(int i=1;i<N;i++){
      if(S.at(i)==mark){
      }
      else{
        count=count+1;
        mark=S.at(i);
      }
    }
    cout<<count<<endl;
  }
}
    

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

int main(){
  char a[110] = {};
  char b[110] = {};

  scanf("%s%s", a, b);
  int la = strlen(a), lb = strlen(b);

  if(la > lb){
    printf("GREATER\n");
    return 0;
  }else if(la < lb){
    printf("LESS\n");
    return 0;
  }else{
    for(int i = 0; i < la; i++){
      if(a[i] > b[i]){
        printf("GREATER\n");
        return 0;
      }else if(a[i] < b[i]){
        printf("LESS\n");
        return 0;
      }
    }
  }

  printf("EQUAL\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  N=N%10;
  if (N == 2 || N==4 || N==5 || N==7 || N==9 ) {
    cout << "hon";
  }
  else if (N==0 || N==1 || N==6 || N==8) {
    cout << "pon";
  }
  else if (N==3) {
    cout << "bon";
  }
}

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

int main()
{
	int n;
	scanf("%d",&n);
	static int A[10010],ma=0;
	for(int i=0;i<n;i++)
	{
		int t;
		scanf("%d",&t);
		ma=std::max(ma,t);
		A[t]++;
	}
	int tot=0;
	for(int i=0;i<=10000;i++,tot+=A[i])
		for(int j=0;j<A[i];j++)
			printf("%d%c",i,(j+1==A[i]&&i==ma)?'\n':' ');
	return 0;
}

Measured memory_bytes: 3176
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c;
    int i,cnt=0;
    scanf("%d%d%d",&a,&b,&c);
    if(a==5) cnt+=1;
    if(b==5) cnt+=1;
    if(c==5) cnt+=1;
    if(a+b+c==17 && cnt==2)
        printf("YES\n");
    else
        printf("NO\n");
}
#include <stdio.h>

Measured memory_bytes: 128
s = input()
t = input()

d_s2t = dict()
d_t2s = dict()

flg = True
for ss, tt in zip(s, t):
    if d_s2t.get(ss) is None:
        d_s2t[ss] = tt
    else:
        if not d_s2t[ss] == tt:
            flg = False
            break

    if d_t2s.get(tt) is None:
        d_t2s[tt] = ss
    else:
        if not d_t2s[tt] == ss:
            flg = False
            break

if flg:
    if len(set(d_s2t.keys())) != len(set(d_s2t.values())):
        flg = False
    if len(set(d_t2s.keys())) != len(set(d_t2s.values())):
        flg = False

print('Yes' if flg else 'No')


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

int main() {
  int n;
  cin >> n;
  bool r = false;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    r |= a % 2;
  }
  cout << (r ? "first" : "second") << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int h, m, s, d;
	std::cin >> d;
	h = d / 3600;
	m = (d % 3600) / 60;
	s = (d % 60);
	std::cout << h << ":"  << m << ":" << s << std::endl;
	
	return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<cmath>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<stdio.h>
#include<queue>
using namespace std;
int main()
{
  long long n,m;
  cin>>n>>m;
  if(n>m)
  {
    int k=0;
    k=n;
    n=m;
    m=k;
  }
  if(n==1)
  {
    if(m==1)
      cout<<1<<endl;
    else
      cout<<m-2<<endl;
    return 0;
  }
  cout<<(n-2)*(m-2)<<endl;
  return 0;
}


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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	string s; cin >> s;


	for(int i = 1; i < 4; i++){
		if(s[i] == s[i - 1]){
			cout << "Bad" << endl; return 0;
		}
	}

	cout << "Good" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){


	ll N,K;
	scanf("%lld %lld",&N,&K);

	int ans = K;

	for(int i = 1; i < N; i++){

		ans *= (K-1);
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	double r,s=0,d=0;
	
	scanf("%lf",&r);
	
	s = r * r * 3.141592653589;
	d = r * 2 * 3.141592653589;
	
	printf("%f %f\n",s,d);
	
	return 0;
}


Measured memory_bytes: 2104
package main
 
import (
  "fmt"
)
 
func main(){
  var N int
  var count int
  fmt.Scan(&N)
  
  for i:=1;i<N;i++{
    var j = N - i
    if i == j || i > j{
      break
    }
    count++
  }
  fmt.Println(count)
}

Measured memory_bytes: 512
# coding: utf-8
# hello worldと表示する
import sys
#import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
pairs=[LI() for i in range(n)]
def pair_revise(x,y,a,b):
    global p
    global q
    #print(x,y,a,b)
    for i in range(max(x//a,y//b),max(x//a,y//b)+2):
        p,q=a*i,b*i
        if p>=x and q>=y:
            break
    return [p,q]
    #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))]
    #for i in range(max(ceil(x/a),ceil(y/b)),):
u,v=pairs[0]
for i in range(n-1):
    u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])
print(u+v)
    
    
        









'''def pair_revise(x,y,a,b):
    global p
    global q
    i=max(ceil(x/a),ceil(y/b))
    p,q=a*i,b*i
    return p,q
u,v=1,1
for i in range(n):
    u,v=pair_revise(u,v,pairs[i][0],pairs[i][1])
    print(u,v)
print(u+v)'''

    
    
        





Measured memory_bytes: 39024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 1; i <= n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int N; cin >> N;
    int i,j,k;
    vector<int> a(N+1);
    rep(i,150){
        rep(j,150){
            rep(k,150){
                int b = (i+j)*(i+j)+(j+k)*(j+k)+(k+i)*(k+i);
                if(b/2 <= N) a[b/2]++;
            }
        }
    }
    rep(i,N) AA(a[i]);
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    double a,b,h,m,degree,time,out;
    double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
    scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
    time = 60*h+m;
    degree = (int)(6*time)%360-((int)(0.5*time)%360+(0.5*time)-(int)(0.5*time));
    if(degree<0) degree = -degree;
    if((int)degree>=180) degree = 360-degree;
    out = sqrt(a*a+b*b-2*a*b*cos(degree*pi/180));
    printf("%.30lf\n",out);
    return 0;
}


Measured memory_bytes: 2660
s = list(str(input()))

from collections import deque

ans = []
_x = s[0]
l= 1
for x in s[1:]:
    if x == _x:
        l += 1
    else:
        ans.append(l)
        _x = x
        l = 1
ans.append(l)

ans = deque(ans)
# print(ans)
# import math

_ans = 0
if s[0] == '<':
    while len(ans)>1:
        a = ans.popleft()
        b = ans.popleft()
        # print(a,b)
        _ans += (max(a,b)*(max(a,b)+1))//2
        # print(_ans)
        _ans += (min(a,b)-1)*(min(a,b))//2
        # print(_ans)
    if len(ans)==1:
        c = ans.popleft()
        _ans += c*(c+1)//2
        # print(_ans)

else:
    d = ans.popleft()
    _ans += d*(d+1)//2
    # print(_ans)

    while len(ans)>1:
        a = ans.popleft()
        b = ans.popleft()
        # print(a,b)
        _ans += (max(a,b)*(max(a,b)+1))//2
        # print(_ans)
        _ans += (min(a,b)-1)*(min(a,b))//2
        # print(_ans)

    if len(ans)==1:
        c = ans.popleft()
        _ans += c*(c+1)//2
        # print(_ans)

print(_ans)


Measured memory_bytes: 94824