akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict

n, m = map(int, input().split())
PY = [tuple(map(int, input().split())) for _ in range(m)]
sorted_PY = sorted(PY)
cnt = 1
now = sorted_PY[0][0]
d = defaultdict(int)
for p, y in sorted_PY:
    if now != p:
        cnt = 1
        now = p
    d[y] = (p, cnt)
    cnt += 1

for p, y in PY:
    l, r = map(str, d[y])
    if len(l) < 6:
        light = '0'*(6-len(l)) + str(l)
    else:
        light = str(l)
    if len(r) < 6:
        right = '0'*(6-len(r)) + str(r)
    else:
        right = str(r)
    print(light+right)


Measured memory_bytes: 35288
import java.util.Scanner;
class Main {

    
    public static void main(String[] args) {
        Scanner x = new Scanner(System.in);
        int a, b;
        a = x.nextInt(); b = x.nextInt();
        if(a <= 1000 && a>= -1000){
            if(b <= 1000 && b>= -1000){
                if(a<b){
                    System.out.println("a < b");
                }else if (a>b){
                    System.out.println("a > b");
            }else{
                    System.out.println("a == b");
                }
            }
        }
        
    }
}

Measured memory_bytes: 26080
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):
    x = 0
    a = 0
    b = 0
    for i in s:
        if(i[0] == 'B' and i[-1] == 'A'):
            x += 1
        elif(i[-1] == 'A'):
            a += 1
        elif(i[0] == 'B'):
            b += 1

    # ans1 = max(0,x-1) + (min(a,b) if a==b else min(a,b)+1)    
    
    if(x == 0):
        ans1 = min(a,b)
    else:
        ans1 = max(0,x-1)+min(a,b)
        if(a > 0 or b > 0):
            ans1 += 1

    
    # ans1 = max(0,x-1) 
    # if(a == b):
    #     ans1 += min(a,b)
    # else:
    #     if(x == 0):
    #         ans1 += min(a,b)
    #     else:
    #         ans1 += min(a,b)+1 
    

    ans2 = 0
    for i in s:
        ans2 += i.count('AB')

    print(ans1+ans2)
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ next(tokens) for _ in range(N) ]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    ll A, B, K;
    in3(A, B, K);

    ll M = min(A, K);
    A -= M;
    K -= M;

    M = min(B, K);
    B -= M;
    K -= M;

    out2l(A, B);

    return 0;
}

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

int main() {
  string s;
  cin >> s;
  if (s == "AAA" || s == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define DBG 1
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define loop(n) rep(loop,(0),(n))
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

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

  int N; cin >> N;
  vector<int>t(N+1,0),x(N+1,0),y(N+1,0);
  bool f=true;
  rep(i,1,N+1){
    cin>>t[i]>>x[i]>>y[i];
    int diff=t[i]-t[i-1];
    int dist=x[i]-x[i-1]+y[i]-y[i-1];

    if(dist>diff or abs(diff-dist)%2==1)f=false;

  }
  cout<<(f?"Yes":"No")<<endl;



    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

struct Mod
{
	ll num;
	Mod() : num(0) { ; }
	Mod(ll n) : num(n) { ; }
	operator ll() { return num; }
};

ll mod = 1000000007;

Mod operator+(Mod a, Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator-(Mod a, Mod b) { return Mod((mod + a.num - b.num) % mod); }
Mod operator*(Mod a, Mod b) { return Mod(((long long)a.num * b.num) % mod); }
Mod operator+=(Mod &a, Mod b) { return a = a + b; }
Mod operator-=(Mod &a, Mod b) { return a = a - b; }
Mod operator^(Mod a, ll n)
{
	if (n == 0) return Mod(1);
	Mod res = (a * a) ^ (n / 2);
	if (n % 2) res = res * a;
	return res;
}
Mod inv(Mod a) { return a ^ (mod - 2); }
Mod operator/(Mod a, Mod b) { return a * inv(b); }

Mod fact(Mod n)
{
	if (n < 0) assert(false);
	if (n == 0 || n == 1) return 1;
	else return n*fact(n - (Mod)1);
}

Mod nPk(Mod n, Mod k)
{
	if (n < 0 || k < 0 || n < k) assert(false);
	return fact(n) / fact(k);
}

Mod nCk(Mod n, Mod k)
{
	if (n < 0 || k < 0 || n < k) assert(false);
	return nPk(n, k) / fact(n - k);
}

Mod nHk(Mod n, Mod k)
{
	if (n < 0 || k < 0 || n < k) assert(false);
	return nCk(n + k - (Mod)1, k);
}


int main()
{
	ll a, b;
	while (cin >> a >> b >> mod, a)
	{
		Mod dp[111111];
		dp[0] = 1;
		Mod ans = 0;
		for (ll i = a; i <= b; i++)
		{
			if (i > a)
			{
				dp[i - a] += dp[i - a - 1];
			}
			ans += dp[i - a];
			for (ll j = i; j <= b; j *= 10)
			{
				ll t = 1;
				while (t <= j) t *= 10;
				ll l = max(i - a + 1, j - a), r = min(b - a + 1, t - a);
				dp[l] += dp[i - a];
				dp[r] -= dp[i - a];
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3924
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    #[allow(dead_code)]
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    #[allow(dead_code)]
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    #[allow(dead_code)]
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: i32 = sc.read();
    let mut ans = 1;
    while ans * 2 <= n {
        ans *= 2;
    }
    println!("{}", ans);
}

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

int main(){
    
    ll N, M;
    cin >> N >> M;
    char A[55][55];
    char B[55][55];
    for(ll y = 0; y < N; y++){
        for(ll x = 0; x < N; x++){
            cin >> A[y][x];
        }
    }
    for(ll y = 0; y < M; y++){
        for(ll x = 0; x < M; x++){
            cin >> B[y][x];
        }
    }
    for(ll l = 0; ;l++){
        ll r = l + M - 1;
        if(r >= N)break;
        for(ll u = 0; ; u++){
            ll d = u + M - 1;
            if(d >= N)break;
            ll f = 1;
            for(ll y = 0; y < M; y++){
                for(ll x = 0; x < M; x++){
                    if(B[y][x] != A[y + l][x + u])f = 0;
                }
            }
            if(f){
                cout << "Yes" << endl;
                return 0;
            }

        }
    }

    cout << "No" <<endl;
    
    return 0;
}

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

fn main() {
    let _ = scan!(usize);
    let mut vs = scan!(usize;;);
    for (i, v) in vs.iter().enumerate() {
        if i + 1 < *v {
            println!("-1");
            return;
        }
    }

    let mut ans = vec![];
    while !vs.is_empty() {
        for i in 0..vs.len() {
            let n = vs.len();
            if vs[vs.len() - i - 1] == vs.len() - i {
                ans.push(vs.remove(n - i - 1));
                break;
            }
        }
    }

    for a in ans.iter().rev() {
        println!("{}", a)
    }
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int ans = (n - 1 + k - 2) / (k - 1);
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

char buf[110];
char buf2[110];

int main(void) {
  scanf("%s", buf);
  int n = strlen(buf);
  int res = n;
  for(char ch = 'a'; ch <= 'z'; ++ch) {
    strcpy(buf2, buf);
    REP(t, n) {
      bool ok = true;
      REP(i, n-t) {
        if(buf2[i] != ch) {
          ok = false;
          if(buf2[i+1] == ch) {
            buf2[i] = ch;
          }
        }
      }
      if(ok) {
        res = min(res, t);
        break;
      }
    }
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	char trumpMark;
	char dummy;
	int trump[4][14];
	int cards;
	int number;

	for (int i = 0; i < 4; i++) {
		for (int j = 1; j < 14; j++) {
			trump[i][j] = 0;
		}
	}


	scanf("%d", &cards);

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

		scanf("%*c%c", &trumpMark);
		scanf("%d", &number);


		switch (trumpMark) {
		case 'S':
			trump[0][number] = number;
			break;
		case 'H':
			trump[1][number] = number;
			break;
		case 'C':
			trump[2][number] = number;
			break;
		case 'D':
			trump[3][number] = number;
			break;
		}
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 1; j < 14; j++) {
			if (trump[i][j] == 0) {
				switch (i) {
				case 0:
					printf("S %d\n", j);
					break;
				case 1:
					printf("H %d\n", j);
					break;
				case 2:
					printf("C %d\n", j);
					break;
				case 3:
					printf("D %d\n", j);
					break;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 2680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n,k;
	cin>>n>>k;
	ll a[100010];
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll ans=0;
	if(a[0]>k){
		ans+=a[0]-k;
		a[0]=k;
	}
	for(ll i=1;i<n;i++){
		if(a[i-1]+a[i]>k){
			ans+=(a[i-1]+a[i])-k;
			a[i]-=(a[i-1]+a[i]-k);
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(){
  int h,m,s,S;
  scanf("%d",&S);
  h=S/3600;
  m=(S-h*3600)/60;
  s=S-(h*3600+m*60);
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

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

int main() {
 int a ,b,min,max;
 cin >> a;
 cin >> b;
 
  
    if(a-b< -1000000)
         min = 1000000;
    else
        { min = b-a+1;
        }
    if(a+b>1000000)
         max = 1000000;
        else
        {
            max = a+b-1;
        }
    for(int i = min;i<=max;i++)
        cout<< i << endl;    
        
}


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

int main() {
    long long H, W;
    cin >> H >> W;
    if(H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << H * W / 2 + ((H * W) % 2) << endl;
}

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

#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ff first
#define ss second

using namespace std;

const double pi = acos(-1);
const int N = 1e6 + 6, mod = 998244353, M = 1e7 + 7;
const ll MAX = 5e18;

int n, a[N], k, ans;

int main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    for(int i = 0; i < k; i++)
        ans += a[i];
    cout << ans;
    return 0;
}


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

template <typename T>
void print(const T &v);

const int V = 100005;
vector<P> G[V]; // pair<辺の距離, 行き先の頂点> (隣接リスト)
ll dist[V];     // dist[i]はsから頂点iへの最短距離が入る
bool used[V];
void dijkstra(ll s)
{ // s: 始点
    fill_n(dist, V, INT_MAX);
    fill_n(used, V, false);
    priority_queue<P, vector<P>, greater<P>> q; // 値が小さい順に取り出されるpriority_queue
    q.push(P(0, s));
    while (!q.empty())
    {
        ll d, t; // d: sからの距離 t: 行き先
        tie(d, t) = q.top();
        q.pop();
        if (used[t])
            continue; // 既に探索済か
        used[t] = true;
        dist[t] = d;
        for (P e : G[t])
        {
            if (dist[e.second] <= d + e.first)
                continue;
            q.push(P(d + e.first, e.second));
        }
    }
}

int main()
{
    int v, e, r;
    cin >> v >> e >> r;
    for (int i = 0; i < e; i++)
    {
        int s, t, d;
        cin >> s >> t >> d;
        G[s].push_back(make_pair(d, t));
    }
    dijkstra(r);
    for (int i = 0; i < v; i++)
    {
        if (dist[i] == INT_MAX)
        {
            cout << "INF" << endl;
        }
        else
        {
            cout << dist[i] << endl;
        }
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 14544
a,b,c,d=map(int,input().split())

for i in range(1000) :
    c=c-b
    if c>0:
        a=a-d
        if a>0:
            continue
        else: #a<=0
            print('No')
            break
    else: #c<=0
        print('Yes')
        break


Measured memory_bytes: 9032
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String s = scanner.next();
    String sreverse = new StringBuffer(s).reverse().toString();
    String shalf = s.substring(0,(s.length() -1)/2);
    String shalfReverse = new StringBuffer(shalf).reverse().toString();
    String shalf2 = s.substring((s.length() + 1) / 2,s.length());
    String shalf2Reverse = new StringBuffer(shalf2).reverse().toString();
    
    if(s.equals(sreverse) && shalf.equals(shalfReverse) && shalf2.equals(shalf2Reverse)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m, k;
		LinkedList<Integer> list;

		n = 2 * Integer.parseInt(br.readLine());
		list = new LinkedList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(i + 1);
		}
		m = Integer.parseInt(br.readLine());
		for (int i = 0; i < m; i++) {
			k = Integer.parseInt(br.readLine());
			if (k > 0) {
				cut(k, list);
			} else {
				reshuffle(list);
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append(list.get(i) + "\n");
		}
		System.out.print(sb.toString());
	}

	static List<Integer> reshuffle(List<Integer> list) {
		LinkedList<Integer> temp = (LinkedList<Integer>) list;
		int n = temp.size() / 2;
		for (int i = 0; i < n; i++) {
			temp.add(i * 2 + 1, temp.remove(n + i));
		}
		return temp;
	}

	static List<Integer> cut(int k, List<Integer> list) {
		LinkedList<Integer> temp = (LinkedList<Integer>) list;
		for (int i = 0; i < k; i++) {
			temp.addLast(temp.removeFirst());
		}
		return temp;
	}
}

Measured memory_bytes: 23784
#include <stdio.h>

void Judge(int A, int B)
{
	if (A == 1 && B == 1)
	{
		puts("Draw");
	}
	else
	{
		if (A == 1)
		{
			puts("Alice");
		}
		else
		{
			if (B == 1)
			{
				puts("Bob");
			}
			else
			{
				if (A == B)
				{
					puts("Draw");
				}
				else
				{
					if (A < B)
					{
						puts("Bob");
					}
					else
					{
						puts("Alice");
					}
				}
			}
		}
	}
}

int main(void)
{
	int A;
	int B;

	scanf("%d %d", &A, &B);
	Judge(A, B);
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <tuple>
using namespace std;

int A[3];

int main() {
	cin >> A[0] >> A[1] >> A[2];
	sort(A, A + 3);
	cout << A[0] * A[1] / 2 << endl;
	return 0;
}

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

using namespace std;

int main() {

	int n;
	cin >> n;

	int vals[n][3];
	for (int i = 0; i < n; i++) {
		cin >> vals[i][0] >> vals[i][1] >> vals[i][2];
	}

	// Stores the maximum possible points of happiness over the first x days ending with type y
	int result[n][3];
	result[0][0] = vals[0][0];
	result[0][1] = vals[0][1];
	result[0][2] = vals[0][2];

	for (int i = 1; i < n; i++) {
		result[i][0] = max(result[i-1][1], result[i-1][2]) + vals[i][0];
		result[i][1] = max(result[i-1][0], result[i-1][2]) + vals[i][1];
		result[i][2] = max(result[i-1][0], result[i-1][1]) + vals[i][2];
	}

	int finalResult = max(result[n-1][0], result[n-1][1]);
	finalResult = max(finalResult, result[n-1][2]);

	cout << finalResult << endl;

}

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

int main() {
  
  int N; cin >> N; int count = 0;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  for (int i = 0; i < N; i++) {
    
    if (vec[i] - 1 == i) {
      
      if (i != N - 1) {
        swap(vec[i], vec[i + 1]);
        count++;
      }
      
      else {
        count++;
      }
      
    }
    
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 3784
S = gets.chomp.to_s
s = (S[0].to_i)*10000000+(S[1].to_i)*1000000+(S[2].to_i)*100000+(S[3].to_i)*10000+(S[5].to_i)*1000+(S[6].to_i)*100+(S[8].to_i)*10+(S[9].to_i)
if s <= 20190430
    puts "Heisei"
else 
    puts "TBD"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, m;
  cin >> n >> m;
  vector<string> a(n),b(m);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  for(int i=0; i<m; i++){
    cin >> b[i];
  }
  bool yes=true;
  for(int i=0; i+m<=n; i++){
    for(int j=0; j+m<=n; j++){
      for(int k=0; k<m; k++){
        if(!yes) continue;
        if(b[k] != a[k+i].substr(j,m)) yes = false;
      }
      if(yes){
        cout << "Yes" << endl;
        return 0;
      }
      yes = true;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

string s;

int main(){
	getline(cin,s);	
	for(int i=0;i<s.length();i++){
	if(s[i]>='a'&&s[i]<='z') s[i]=s[i]-'a'+'A';
	}
	cout<<s<<endl;
	return 0;
}//a 97 z122

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
struct Edge {
    int to;
};
using Graph = vector<vector<Edge>>;
int N, M, K;
int id;
// 深さ優先探索
vector<int> cc_id;   // どの連結成分か
vector<int> cc_num;  // 連結成分のサイズ
void dfs(const Graph &G, int v, int &cnt) {
    cc_id[v] = id;
    cnt++;
    for (auto e : G[v]) {
        if (cc_id[e.to] == -1) {
            dfs(G, e.to, cnt);
        }
    }
}
int main() {
    cin >> N >> M >> K;
    Graph G(N);  // グラフとして考える
    vector<int> A(M), B(M);
    REP(i, M) {
        cin >> A.at(i) >> B.at(i);
        A[i]--, B[i]--;
        G[A[i]].push_back({B[i]});
        G[B[i]].push_back({A[i]});
    }
    vector<int> C(K), D(K);
    REP(i, K) {
        cin >> C.at(i) >> D.at(i);
        C[i]--, D[i]--;
    }
    // どの連結成分に属し、サイズがいくつなのかを求める
    cc_id.assign(N, -1);  // 初期化
    id = 0;
    REP(i, N) {
        if (cc_id[i] == -1) {
            int cnt = 0;
            dfs(G, i, cnt);
            cc_num.push_back(cnt);
            id++;
        }
    }
    vector<int> ans(N);
    REP(i, N) { ans[i] = cc_num[cc_id[i]] - 1 - (int)G[i].size(); }
    REP(i, K) {  // 同じ連結成分にあるブロック関係を引く
        if (cc_id[C[i]] == cc_id[D[i]]) {
            ans[C[i]]--;
            ans[D[i]]--;
        }
    }
    REP(i, (int)ans.size()) {
        cout << ans[i];
        if (i != (int)ans.size() - 1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 9600
def main():
    N, M = map(int, input().split())
    g = []
    INF = 10 ** 9 * 1000
    d = [INF] * (N + 1)
    d[1] = 0
    for _ in range(M):
        a, b, c = map(int, input().split())
        g.append((a, b, -c))
    for i in range(2 * N):
        for x, y, z in g:
            if d[x] != INF and d[y] > d[x] + z:
                d[y] = d[x] + z
                if y == N and i > N:
                    print("inf")
                    exit()

    print(-d[-1])


main()


Measured memory_bytes: 3420
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B;
    cin >> A >>B;
    if(A<=5){
        cout << "0";
        return 0;
    }
    A>12?cout << B:cout << B/2;

    cout << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    REP(i, n){
        ll a;
        cin >> a;
        v[i] = v[max(0, i-1)] + a;
    }
    ll ans = INF;
    REP(I, 2){
        ll cnt = 0, change = 0;
        vector<ll> u(v);
        REP(i, n){
            u[i] += change;
            if(i%2 == I){
                if(u[i] <= 0){
                    cnt += -u[i] + 1;
                    change += -u[i] + 1;
                }
            }else{
                if(u[i] >= 0){
                    cnt += u[i] + 1;
                    change += -u[i] -1;
                }
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1804
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
typedef long long int ll;

int main()
{
    ll n;
    cin >> n;
    string s;
    double temp = 0, sum = 0;
    for (size_t i = 0; i < n; i++)
    {
        cin >> temp >> s;
        if (s == "JPY")
        {
            sum += (ll)temp;
        }
        else
        {
            sum += temp * 380000.0;
        }
    }

    cout << sum << endl;
}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


struct t
{
    ll a,b,c,d;
};

vector<t> v;
vll A;ll n,m,q;

ll solve(ll cur, ll len)
{
    if(len==n+1)
    {
        ll sum = 0;
        for(int i=0;i<q;++i)
        {
            int f = v[i].a,s = v[i].b;
            if(A[s]-A[f] == v[i].c)
                sum+=v[i].d;
        }
        return sum;
    }
    ll ans = -1;
    for(int i=cur;i<=m;++i)
    {
        A[len]=i;
        ans = max(ans,solve(i,len+1));
    }
    return ans;
}

int main(int argv, char* argc[])
{
    FASTIO

    cin>>n>>m>>q;
    v.resize(q);
    A.resize(n+1);
    rep(i,q)
    {
        cin>>v[i].a>>v[i].b>>v[i].c>>v[i].d;
    }

    cout<<solve(1,1);

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define de(x) cerr << #x << " = " << x << endl;

int main()
{
    string s;
    cin>>s;
    int r=0;
    for(auto x:s)
        r ^= x;
    cout<<(r==0 ? "Yes":"No");
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; ++i) cin >> d[i];

  bool ok = true;
  {
    int jump = 0;
    for(int i = 0; i < n; ++i) {
      if(jump < i * 10) {
        ok = false;
        break;
      }
      jump = max(jump, i * 10 + d[i]);
    }
  }
  reverse(d.begin(), d.end());
  {
    int jump = 0;
    for(int i = 0; i < n; ++i) {
      if(jump < i * 10) {
        ok = false;
        break;
      }
      jump = max(jump, i * 10 + d[i]);
    }
  }
  if(ok) cout << "yes\n";
  else cout << "no\n";
}


Measured memory_bytes: 4148
#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] ;
  sort(a,a+N) ;
  int sum =0 ;
  for(int i =0 ; i <N-1 ;i++) sum+=a[i] ;
  if(a[N-1] < sum ) cout<<"Yes\n" ;
  else cout<<"No\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    int h, w, m;
    read(h,w,m);
    vi b1(h);
    vi b2(w);
    set<pair<int,int>> bomb;
    REP(i,m){
        int x, y;
        read(x,y);
        x--; y--;
        b1[x]++;
        b2[y]++;
        bomb.insert(make_pair(x,y));
    }
    int mxB1 = 0;
    int mxB2 = 0;
    for(int i  = 0 ; i< h; i++){
        if(mxB1 < b1[i]){
            mxB1 = b1[i];
        }
    }
    for(int i = 0 ; i < w ; i++){
        if(mxB2 < b2[i]){
            mxB2 = b2[i];
        }
    }
    vi good_b1_ind;
    for(int i  = 0 ; i< h; i++){
        if(mxB1 == b1[i]){
            good_b1_ind.push_back(i);
        }
    } 
    vi good_b2_ind;
    for(int i = 0 ; i < w; i++){
        if(mxB2 == b2[i]){
            good_b2_ind.push_back(i);
        }
    }
    int ans = mxB1 + mxB2 ;
    for(int i : good_b1_ind){
        for(int j : good_b2_ind){
            if( bomb.find(make_pair(i,j)) == bomb.end()){
                cout << ans << "\n";
                return;
            }
        }
    }
    cout << ans -1 << "\n";
}
int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}


Measured memory_bytes: 23784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;
set<string> ss;
priority_queue<string> q;
string s;
int k;
int main(){
cin>>s;
cin>>k;
rep(i,0,s.length())
{
	rep(j,1,k+1) if(i+j-1<=s.length()) {
	string tmp=string(s,i,j);
	if(ss.find(tmp)==ss.end())
	{
	q.push(tmp);
	ss.insert(tmp);	
	while(q.size()>k){q.pop();}
	}
	}
}
cout<<q.top()<<endl;
    return 0;
}


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

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

    bool f['Z'] = {};
    for (int i = 0; i < s.size(); i++) {
        f[s[i]] = true;
    }

    cout << (f['N'] ^ f['S'] || f['E'] ^ f['W'] ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iterator>
//#include<math.h>

using namespace std;
#define int long long
/*                      */    //#undef int
#define INF 1000000009
#define INFL 1000000000000000018ll
#define mod 1000000007ll
#define pb push_back
#define fi first
#define se second
#define mk(a, b) make_pair(a, b)
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef priority_queue<PA, vector<PA>, greater<PA> >PQG;

int k;
string s;

signed main()
{
    cin >> s;
    cin >> k;
    if(k == 1 && s[0] == '1'){
        cout << '1' << endl;
        return 0;
    }
    if(s[0] != '1'){
        cout << s[0] << endl;
        return 0;
    }
    for(int i = 1; i < s.size(); i++){
        if(!(s[i] == s[i - 1] && s[i] == '1')){
            cout << s[i] << endl;
            return 0;
        }
        else if(i + 1 == k){
            cout << '1' << endl;
            return 0;
        }
    }

    return 0;
}
/*


*/


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;

void pre(){

}
vector<ll> z_function(string s) {
    ll n = (ll) s.length();
    vector<ll> z(n);
    for (ll i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }

    return z;
}

int main()
{
   
  IOS
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll maxi=0;
  for(ll i=1;i<=n-1;i++)
  {
    string s1=s.substr(0,i);
    string s2=s.substr(i,n-i);
    s2=s2+"$"+s1;
    vl z=z_function(s2);
    //cout<<z.size()<<endl;
    for(ll j=0;j<s1.size();j++)
    {
      maxi=max(maxi,z[s2.size()-1-j]);
    }
  }
  cout<<maxi<<endl;


}
  



Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x, y, z;
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			x = a;
			y = b;
		} else {
			x = b;
			y = a;
		}
		int c = sc.nextInt();
		if (y < c) {
			z = c;
		} else if (x < c) {
			z = y;
			y = c;
		} else {
			z = y;
			y = x;
			x = c;
		}
		System.out.println(x + " " + y + " " + z);
		sc.close();
	}
}


Measured memory_bytes: 26256
#include <stdio.h>

int main(void){
	int n;
	scanf("%d", &n);
	int i = 10;
	int count = 0;
	while(n >= i){
		count += i - i / 10;
		i *= 100;
	}
	if(i / 10 <= n)
		count += n - i / 10 + 1;
	printf("%d\n", count);
	return 0;
}


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

int h,w,a,b;
long long  jie[200010],ni[200010],ans;
const long long mod=1e9+7;
inline void exgcd(long long a,long long b,long long &x,long long &y)
{
	if(!b)
	{
		x=1;
		y=0;
	}
	else
	{
		exgcd(b,a%b,y,x);
		y-=a/b*x;
	}
}
int main()
{
	scanf("%d%d%d%d",&h,&w,&a,&b);
	jie[0]=1;
	for(int i=1;i<=h+w;++i)
	jie[i]=jie[i-1]*i%mod;
	long long x,y;
	exgcd(jie[h+w],mod,x,y);
	x=(x%mod+mod)%mod;
	if(!x)
	x+=mod;
	ni[0]=1;
	ni[h+w]=x;
	for(int i=h+w-1;i>=1;--i)
	ni[i]=ni[i+1]*(i+1)%mod;
	for(int i=1;i<=h-a;++i)
	{
		long long ji=ni[b-1]*ni[i-1]%mod*jie[b+i-2]%mod;
		ji=ji*ni[h-i]%mod*ni[w-b-1]%mod*jie[h-i+w-b-1]%mod;
		ans=(ans+ji)%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
int arr[x];
for(int i=0;i<x;i++)
{
    cin>>arr[i];
}
int sam=0;
for(int i=0;i<x;i++){
    if(arr[i]>=y)
        sam++;

}
cout<<sam;
    return 0;
}


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

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int INF = 1e9;
const LL mod = 1e9 + 7;
const int maxn = 2e5 + 7;

int main() {
    int n;
    while(cin >> n) {
        int x1 = n % 10;
        int x2 = (n / 10) % 10;
        int x3 = n / 100;
//        cout << x1 << " " << x2 << " " << x3 << endl;
        if(x1 == 7 || x2 == 7 || x3 == 7) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3132
import java.util.Scanner;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        int num = scan.nextInt();
        int zone = scan.nextInt();
        int pos = 0;
        int count = 1;
        for(int i = 0; i < num; i++){
            pos += scan.nextInt();
            if(pos <= zone){
                count++;
            }
        }

        // answer
        System.out.println(count);

    }
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	string s;
	cin >> s;
	
	int n = sz(s);
	if(n%2){
		cout << "No\n";
		return 0;
	}
	
	for(int i=0 ; i<n ; i+=2)
	{
		if(s[i] != 'h' || s[i+1] != 'i'){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}


Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    y = 0
    for i in range(1, n-1):
        for j in range(i+1, n):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    y += 1    

    print(y)


Measured memory_bytes: 5592
n, k = map(int,input().split())

arr = list(map(int, input().split()))

ans = float('inf')

for i in range(n - k + 1):
	if arr[i] * arr[k + i -1] >= 0:
		tmp = max(abs(arr[i]), abs(arr[k + i -1]))
	else:
		tmp = abs(arr[i]) + abs(arr[k + i -1]) + min(abs(arr[i]), abs(arr[k + i -1]))
	ans = min(ans, tmp)

print(ans)
		

Measured memory_bytes: 14568
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b;

	return 0;
}





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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int[] candy = new int[3];
		int a=sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		candy[0]=a;
		candy[1]=b;
		candy[2]=c;
		Arrays.sort(candy);
		if (candy[2]==candy[0]+candy[1]){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 10320
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
		   int n;
           cin>>n;
           vin a(n);
           rep(i,0,n)cin>>a[i];
           int ans=0;
           rep(i,0,n){
             if(a[i]==i+1){
               ans++;
               if(i+1<n&&a[i+1]==i+2)i++;
             }
           }
           cout<<ans<<endl;
           
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

int main(){
  int n; cin >> n;
  int a[n];
  map<int, int> od, ev;
  REP(i, n){
    cin >> a[i];
    if(i%2) od[a[i]]++;
    else ev[a[i]]++;
  }

  map<int, vector<int>> rev;
  for(auto itr: ev){
    rev[itr.second].push_back(itr.first);
  }

  int ans = INT_MAX;
  for(auto itr: od){
    int t = n - itr.second;
    auto itr2 = rev.rbegin();

    bool f = false;
    for(auto x: itr2->second){
      if(x != itr.first){
        t -= itr2->first;
        f = true;
        break;
      }
    }

    if(!f){
      itr2++;
       if(itr2 != rev.rend()) t -= itr2->first;
    }

    ans = min(ans, t);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define int long long int
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (upper_bound(ALL(c),x)-lower_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *min_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

const int INF = 1e18;
const int MOD_N = 1e9+7;

int gcd(int x, int y) {
   if(x < y) swap(x, y);
   if(x % y == 0) return y;
   else return gcd(y, x % y);
}
int lcm(int x, int y) {
   return x * y / gcd(x,y);
}

signed main()
{
   int n; cin >> n;
   V<int> a(n); REP(i, n) cin >> a[i];

   int l = a[0];
   REP(i, n-1) {
      l = lcm(l, a[i+1]);
   }
   cout << l << endl;

   return 0;
}



Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef pair<int,int>P;
int main(){
    vector<P>V;
    int w,h,n,x,y,ans=0,mx,my;
    cin>>w>>h>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        V.push_back(P(x,y));
    }
    for(int i=0;i<n-1;i++){
        mx=V[i].first-V[i+1].first;
        my=V[i].second-V[i+1].second;
        if(mx>0 && my>0)
            ans-=min(mx,my);
        else if(mx<0 && my<0)
            ans+=max(mx,my);
        if(mx<0)
        ans-=mx;
        else
        ans+=mx;
        if(my<0)
        ans-=my;
        else
        ans+=my;
    }
    cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 1212