akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
    
    string s;
    cin >> s;
    int n = s.length();
    for(int i=0; i<n; i++){
        if(i == n-1){
            if(s[i] == 's'){
                cout << s[i] << "es";
            }
            else{
                cout << s[i] << "s";
            }
        }
        else cout << s[i];
    }
    return 0;
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORS(i, a, b, c) for(int i = a; i < b; i += c)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

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

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;


int main(){
  IO; ll N; cin >> N;
  ll ans = 0;
  for(ll i = 2; i*i <= N; i ++){
    int c = 0;
    while(N%i == 0) c ++, N /= i;
    int j = 0;
    while((j+1)*(j+2)/2 <= c) j ++;
    ans += j;
  }
  if(N > 1) ans ++;
  cout << ans << endl;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  double a, b, xa;
  cin >> a >> b >> xa;

  // 簡単のため平面で考える
  double x = xa / a;
  double ans = 0.0;

  // 半分のとき
  if (x * 2 == a * b) {
    ans = 45.0;
  }

  // 半分より少ないとき
  if (x * 2 < a * b) {
    double l = x * 2 / b;
    double rad = atan2(b, l);
    ans = rad * 180 / M_PI;
  }

  // 半分より多いとき
  if (x * 2 > a * b) {
    double l2 = (a * b - x) / a * 2;
    double rad = atan2(l2, a);
    ans = rad * 180 / M_PI;
  }

  printf("%.10f\n", ans);
}


Measured memory_bytes: 256
import sys
import heapq 

input = sys.stdin.readline

n = int(input())

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

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

mainasu_a_b = 0

plus_a_b_list = []
ans = 0
for i in range(n):
    if a_list[i] - b_list[i] < 0:
        mainasu_a_b += a_list[i] - b_list[i]
        ans += 1
    else:
        plus_a_b_list.append(a_list[i] - b_list[i])

if ans == 0:
    print(0)
    exit(0)

plus_a_b_list = list(map(lambda x: x*(-1), plus_a_b_list))
heapq.heapify(plus_a_b_list)
while mainasu_a_b < 0:
    if len(plus_a_b_list) == 0 and mainasu_a_b < 0:
        print(-1)
        exit(0)
    max_plus = heapq.heappop(plus_a_b_list)*(-1)
    mainasu_a_b += max_plus
    ans += 1

print(ans)

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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

#include <iostream>
using namespace std;

long long comb2(long long n) {
  return n * (n - 1) / 2;  // int*intだとオーバーフローする
}

int main() {
  int N;
  cin >> N;

  vector<int> A(N);
  unordered_map<int, int> M;

  REP(i, N) {
    cin >> A[i];
    M[A[i]]++;
  }

  ll sum = 0;
  for (auto pair : M) {
    sum += comb2(pair.second);
  }

  for (int i = 0; i < N; i++) {
    ll tsum = sum;
    tsum -= comb2(M[A[i]]);
    tsum += comb2(M[A[i]] - 1);
    cout << tsum << endl;
  }

  return 0;
}


Measured memory_bytes: 8392
H, N = map(int, input().split())
AB = []
INF = 10**8 + 1

dp = [INF]*(H+1)
dp[0] = 0

for _ in range(N):
  a, b = map(int, input().split())
  AB.append((a, b))

for i in range(1, H+1):
  for j in range(N):
    dp[i] = min(dp[i], dp[max(0, i - AB[j][0])] + AB[j][1])

print(dp[-1])

Measured memory_bytes: 73872
import sys
def decode(s):
    result=""
    for c in s:
        if not (c==" " or c=="."):
            result+=chr(ord(c)+1)
        else:
            result+=c
    return result.replace(chr(ord("z")+1),"a")
for line in sys.stdin.readlines():
    s=line.strip()
    for i in xrange(ord("z")-ord("a")+1):
        if "the" in s or "that" in s or "this" in s:
            print s
            break
        s=decode(s)

Measured memory_bytes: 5336
#include<stdio.h>
int main(void) {
	int n, a,b;
	scanf("%d %d %d", &n, &a,&b);
	int i, j;

	int ans = 0;

	if (n * a > b) {
		printf("%d\n", b);
	}
	else {
		printf("%d\n", n * a);
	}

	return 0;

}

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

using namespace std;

int main(){
  int K, X;
  cin >> K >> X;
  int start, end;
  start = max(X - K + 1, -1000000);
  end = min(X + K-1, 1000000);
  for (int i = start; i <= end; i++){
    cout << i;
    if(i != end){
      cout << " ";
    }else{
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	
	int a, b;
	int d = 0;
	int r = 0;
	double f = 0;

	scanf("%d %d", &a, &b);

	d = a / b ;
	r = a%b;
	f = 1.0*a/b;

	printf("%d %d %.6lf\n", d, r, f);
	



	return(0);

}


Measured memory_bytes: 2104
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
        "strings"
)

func InputString() (Input string) {
        var scanner = bufio.NewScanner(os.Stdin)

        scanner.Scan()
        Input = scanner.Text()
        Input = strings.TrimSpace(Input)
        return
}

func InputInt() int {
        var stringInput = InputString()
        var InputNum, err = strconv.Atoi(stringInput)
        if err != nil {
                fmt.Println("error")
        }
        return InputNum
}

func main() {
        Inputs := InputString()
        splited := strings.SplitAfter(Inputs,"1")
        fmt.Println(len(splited)-1)

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

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

Measured memory_bytes: 256
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

//A-Z = 65 - 90
//a-z = 97 - 122

using namespace std;

int main(void) {
    string str;
    int cnt[26] = {0};
    
    //cout
    while( getline(cin, str) ) {
        
        for(auto c : str) {
            //cout << c << " ";
            if( isalpha(c) ) {
                //cout << tolower(c) - 'a' << " ";
                cnt[ tolower(c) - 'a' ]++;
            }
            //cout << isalpha(c) << endl;
        }
    }
    
    //output
    for(int i=0; i<26; i++) {
        cout << (char)('a' + i) << " : " << cnt[i] << endl;
    }
    
    
    return 0;
    
}

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

int main(){
  int n;
  int card[4][13]={};
  
  cin>>n;

  for(int i=0;i<n;i++){
    string suit;
    int num;
	cin>>suit>>num;

    if(suit == "S")card[0][num-1]=1;
    if(suit == "H")card[1][num-1]=1;
    if(suit == "C")card[2][num-1]=1;
    if(suit == "D")card[3][num-1]=1;
  }
  string str[4]={"S","H","C","D"};
  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      if(card[i][j]==1)continue;
      cout<<str[i]<<" "<<j+1<<endl;
    }
  }

  return 0;

  
}


Measured memory_bytes: 3080
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n, i;
            n = int.Parse(str[0]);
            i = int.Parse(str[1]);

            if (n % i != 0)
            {
                Console.WriteLine(1);
            }
            else
            {
                Console.WriteLine(0);
            }

        }

    }
}


Measured memory_bytes: 27500
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

# 入力値を文字列で返却する
def gets_s()
  gets.chomp
end

n = gets_i

wordlist = []

n.times do
  wordlist.push gets_s
end

appearedlist = []
0.upto(n-2) do |i|
  w = wordlist[i]
  if appearedlist.include?(w)
    puts "No"
    exit
  end

  if w.chars.last != wordlist[i+1].chars.first
    puts "No"
    exit
  end
  appearedlist.push w
end

if appearedlist.include?(wordlist.last)
  puts "No"
  exit
end

puts "Yes"

Measured memory_bytes: 14524
# ABC089 D - Practical Skill Test
h,w,d=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
x=[0]*(h*w+1)
y=[0]*(h*w+1)
ans=[0]*(h*w+1)
for i in range(h):
    for j in range(w):
        x[a[i][j]]=i
        y[a[i][j]]=j
for i in range(d+1,h*w+1):
    ans[i]=ans[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d])
q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    print(ans[r]-ans[l])


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

int main() {
  string S; cin >> S;
  int T = S.size();
  for(int k = 0; k < S.size() - 1; k++) {
    if(S[k] != S[k+1]) T = min(T, max(k+1, (int)S.size()-k-1));
  }
  cout << T << endl;

  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

int main(){
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;
  int W=0,S=0;
  double ans = 0;
  for(int a=0; a<=30; a++){
    for(int b=0; b<=30; b++){
      for(int c=0; c<=100; c++){
        for(int d=0; d<=100; d++){
          int w_sum = a*A*100 + b*B*100;
          int s_sum = c*C+d*D;
          if(F < w_sum+s_sum){
            continue;
          }
          if(s_sum > E*w_sum/100){
            continue;
          }
          if(w_sum == 0){
            continue;
          }
          if(ans < (double)100*s_sum/(s_sum+w_sum)){
            ans = (double)100*s_sum/(s_sum+w_sum);
            W = w_sum;
            S = s_sum;
          }
        }
      }
    }
  }
  if(ans == 0){
    W = 100*A;
  }
  cout << W+S << " " << S << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let n: u8 = input();
    let s: String = input();
    let s: Vec<char> = s.chars().collect();
    for c in s {
        let mut m = c as u8 + n;
        if m > 90 {
            m -= 26;
        }
        print!("{}", m as char);
    }
    println!();
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll A,B,C;
    string S;
    cin >> A>>B>>C;
    bool flag = true;

    if(A%2==1||B%2==1||C%2==1){
        cout << 0 << endl;
    }
    else{
        REPS(i, 1000000)
        {
            ll a, b, c;
            a = B / 2 + C / 2;
            b = A / 2 + C / 2;
            c = A / 2 + B / 2;

            if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
                cout << i << endl;
                flag = flase;
                break;
            }
            A = a;
            B = b;
            C = c;
        }

        if(flag){
            cout << -1 << endl;
        }
    }
}


Measured memory_bytes: 3640
#include "omp.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <random>
#include <bitset>
#include <unordered_set>
#include <cassert>
#include <list>
#include <functional>


using namespace std;

typedef long long ll;
typedef long double ld;


const int sze = 1 << 15, INF = 1e9 + 10;
const ll MOD = 1e15;


signed main()
{
	ll n, c;
	cin >> n >> c;

	vector<ll> positions(n), prices(n);
	for (int i = 0; i < n; ++i)
	{
		ll a, b;
		cin >> a >> b;
		positions[i] = a;
		prices[i] = b;
	}

	vector<ll> dp1(n), dp2(n);
	vector<ll> pref(n), suf(n);

	for (int i = 0; i < n; ++i)
	{
		dp1[i] = i ? (dp1[i - 1] - positions[i] + positions[i - 1] + prices[i]) : prices[i] - positions[i];
		dp1[i] %= MOD;
	}

	for (int i = n - 1; i >= 0; --i)
	{
		dp2[i] = (i + 1 == n) ? prices[i] - c + positions[i] : (dp2[i + 1] - positions[i + 1] + positions[i] + prices[i]);
		dp2[i] %= MOD;
	}

	ll ans = 0;

	suf[n - 1] = dp2[n - 1];
	for (int j = n - 2; j >= 0; j--)
		suf[j] = max(suf[j + 1], dp2[j]);

	pref[0] = dp1[0];
	for (int i = 1; i < n; ++i)
		pref[i] = max(pref[i - 1], dp1[i]);

	for (int i = 0; i < n; ++i)
		ans = max(ans, max(dp1[i], dp2[i]));
	
	for (int i = 0; i + 1 < n; ++i)
	{
		ll mx = suf[i + 1];
		ans = max(ans, dp1[i] + mx - positions[i]);
	}
	
	for (int j = n - 1; j; j--)
	{
		ll mx = pref[j - 1];
		ans = max(ans, dp2[j] + mx - (c - positions[j]));
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n + 2];
		int[] places = new int[n + 2];
		for (int i = 1; i <= n; i++) {
			arr[i] = sc.nextInt();
			places[arr[i]] = i;
		}
		TreeSet<Integer> set = new TreeSet<>();
		set.add(0);
		set.add(n + 1);
		set.add(places[n]);
		long total = 0;
		for (int i = n - 1; i >= 1; i--) {
			int x = places[i];
			int left1 = set.lower(x);
			int left2;
			if (left1 == 0) {
				left2 = 0;
			} else {
				left2 = set.lower(left1);
			}
			int right1 = set.higher(x);
			int right2;
			if (right1 == n + 1) {
				right2 = n + 1;
			} else {
				right2 = set.higher(right1);
			}
			total += ((long) i) * ((left1 - left2) * (right1 - x) + (right2 - right1) * (x - left1));
			set.add(x);
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 56460
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(2)]

N = int(s[0])
D = list(map(int, s[1].split()))


# Process
H = 0
for i in range(0,N):
    for j in range(1,N):
        H += D[i-j]*D[i]

H = int(H/2)


# Output
print(H)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
    // 入力
    int a,b,c;
    cin >> a >> b >> c;

    if (a >= b + c) {
        cout << 0 << endl;
    } else {
        cout << b + c - a << endl;
    }

    // 出力
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main { 
    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int o=0;
       int n=sc.nextInt();
       String s=sc.next();
     for(int i=0;i<n-2;i++){
     	if(s.charAt(i)=='A'&&s.charAt(i+1)=='B'&&s.charAt(i+2)=='C')o++;
     }
      System.out.println(o);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;
 
#define INF 1<<21
#define MOD 1000000007
 
int main(){
    int x,y,z;
    int ans=0;
    cin>>x>>y>>z;
    x-=2*z+y;
    ans=x/(y+z);
    cout<<ans+1<<endl;
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> a(N), b(N);
	for(int i=0; i<N; ++i) cin >> a[i];
	for(int i=0; i<N; ++i) cin >> b[i];
	int ans=0;
	for(int d=0; d<29; ++d){
	    vector<int> res(N);
	    int cnt=0;
	    for(int i=0; i<N; ++i){
	        if((a[i])&(1<<d)){
	            cnt += N;
	            cnt %= 2;
	        }
	        res[i]=a[i]%(1<<d);
	    }
	    sort(res.begin(), res.end());
	    for(int i=0; i<N; ++i){
	        if((b[i])&(1<<d)){
	            cnt += N;
	            cnt %= 2;
	        }
	        auto itr=lower_bound(res.begin(), res.end(), (1<<d)-(b[i]%(1<<d)));
	        cnt += res.end()-itr;
	        cnt %= 2;
	    }
	    if(cnt==1) ans |= (1<<d);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(){
    int n,q;
    cin>>n>>q;
    vector<vector<int>> ki(n);
    for (int i = 1; i < n; ++i) {
        int a,b;
        cin>>a>>b;
        --a;--b;
        ki[a].emplace_back(b);
        ki[b].emplace_back(b);
    }
    vector<bool> visited(n,false);
    vector<int> ans(n,0);
    for (int i = 0; i < q; ++i) {
        int p,x;
        cin>>p>>x;
        --p;
        ans[p]+=x;
    }
    queue<int> waku;
    waku.push(0);
    visited[0]=true;
    while(!waku.empty()){
        int pos=waku.front();
        waku.pop();
        int val=ans[pos];
        for(auto i:ki[pos]){
            if(!visited[i]){
                visited[i]=true;
                waku.push(i);
                ans[i]+=val;
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        cout<<ans[i];
        if(i==n-1)cout<<endl;
        else cout<<" ";
    }
    return 0;
}

Measured memory_bytes: 15604
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int w, h, c, wleft, hleft;

vector<PII> costs;

int main() {
    GI(w); GI(h); wleft = w+1; hleft = h+1;

    FORN(i, w) {
        GI(c);
        costs.PB(MP(c, 0));
    }

    FORN(i, h) {
        GI(c);
        costs.PB(MP(c, 1));
    }
    
    sort(costs.begin(), costs.end());

    LL res = 0;

    FORN(i, costs.size()) {
        if (costs[i].SS == 0) {
            res += 1LL * hleft * costs[i].FF;
            wleft--;
        }
        else {
            res += 1LL * wleft * costs[i].FF;
            hleft--;
        }
    }

    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back
#define FILE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);


using namespace std;

typedef long long ll;

int main(){
    inp_out_work
    int n;
    cin>>n;
    ll h[n];
    fr(i,n)cin>>h[i];
    ll dp[n];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; i++){
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout<< dp[n-1] << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin >> t;
    int ans =0;
    int arr[t],arr1[t];
    for (int x=0;x<t;x++) cin >> arr[x];
    for (int x=0;x<t;x++) cin >> arr1[x];
    for (int x=0;x<t;x++){
        int a= arr[x] , b= arr1[x];
        if (a-b>0) ans+= a-b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
using mat = vector<vector<ll>>;

inline void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];

signed main(){
	IOS();
	ll a[7];
	for (int i = 0;i < 7;++i) {
		cin >> a[i];
	}
	ll ans = (a[0] / 2) * 2 + a[1] + (a[3] / 2) * 2 + (a[4] / 2) * 2;
	if(a[0] % 2 + a[3] % 2 + a[4] % 2 == 3)ans += 3;
	else if(a[0] % 2 + a[3] % 2 == 2 && a[4] > 0){
		ans++;
	}
	else if(a[4] % 2 + a[3] % 2 == 2 && a[0] > 0){
		ans++;
	}
	else if(a[0] % 2 + a[4] % 2 == 2 && a[3] > 0){
		ans++;
	}
	cout << ans << endl;
}

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

char a[7][7];
char b[7][7];
int n, m, k;

void init(){
    for(int i=0; i<n; i++){
	for(int j=0; j<m; j++){
	    b[i][j] = a[i][j];
	}
    }
}

void color(int i, int j){
    for(int x=0; x<n; x++){
	if(i & (1 << x)){
	    for(int y=0; y<m; y++){
		b[x][y] = '$';
	    }
	}
    }

    for(int x=0; x<m; x++){
	if(j & (1 << x)){
	    for(int y=0; y<n; y++){
		b[y][x] = '$';
	    }
	}
    }
}

bool is_valid(){
    int cnt = 0;
    for(int i=0; i<n; i++){
	for(int j=0; j<m; j++){
	    if(b[i][j] == '#'){
		cnt++;
	    }
	}
    }

    if(cnt == k)
	return true;
    else
	return false;
}

int main(){
    cin >> n >> m >> k;
    for(int i=0; i<n; i++){
	for(int j=0; j<m; j++){
	    cin >> a[i][j];
	}
    }

    int total = 0;
    for(int i=0; i<(1<<n); i++){
	for(int j=0; j<(1<<m); j++){
	    init();
	    color(i, j);
	    if(is_valid())
		total++;
	    }
	}
    cout << total << "\n";
    return 0;
}


Measured memory_bytes: 3528
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//                       _oo0oo_                         //
//                      o8888888o                        //
//                      88" . "88      ------ hzt1       //
//                      (| -_- |)                        //
//                      0\  =  /0                        //
//                    ___/`---'\___                      //
//                  .' \|     |// '.                     //
//                 / \|||  :  |||// \                    //
//                / _||||| -:- |||||- \                  //
//               |   | \  -  /// |     |                 //
//               | \_|  ''\---/''  |_/ |                 //
//               \  .-\__  '-'  ___/-. /                 //
//             ___'. .'  /--.--\  `. .'___               //
//          ."" '<  `.___\_<|>_/___.' >' "".             //
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |           //
//         \  \ `_.   \_ __\ /__ _/   .-` /  /           //
//     =====`-.____`.___ \_____/___.-`___.-'=====        //
//                       `=---='                         //
//                                                       //
//                                                       //
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       //
//                                                       //
//                 God-He Bless All.                     //
//           This Code Will Never Explode.               //
//                                                       //
//                                                       //
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=Getchar();
    for(;!isdigit(c);c=Getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=Getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
const int maxn=510;
const int maxm=250010;
void GG() {puts("No");exit(0);}
int ans[maxm],n,m;
pair<int,int> A[maxn];
int main() {
	n=read();m=n*n;
	rep(i,1,n) {
		int x=read();
		ans[x]=i;
		A[i]=mp(x,i);
	}
	sort(A+1,A+n+1);
	int cur=1;
	rep(i,1,n) {
		 rep(j,1,A[i].yy-1) {
		 	while(ans[cur]) cur++;
		 	ans[cur]=A[i].yy;
		 }
		 if(cur>A[i].xx) GG();
	}
	cur=m;
	dwn(i,n,1) {
		rep(j,A[i].yy+1,n) {
			while(ans[cur]) cur--;
			ans[cur]=A[i].yy;
		}
		if(cur<A[i].xx) GG();
	}
	puts("Yes");
	rep(i,1,m) printf("%d%c",ans[i],i==m?'\n':' ');
	return 0;
}


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

using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;

static const int MAX_N = 100005;

int n, A[MAX_N * 2];

int binary(int i, int r, int tar) {
  int l = i;
  while (1 <= r - l) {
    int mid = (r + l) / 2, p = A[mid - 1] - A[i - 1], p1 = A[mid - 2] - A[i - 1], p2 = A[mid] - A[i - 1];

    if (abs(tar - p) < abs(tar - p1) && abs(tar - p) < abs(tar - p2)) {
      l = mid;
      break;
    }

    if (tar < p) r = mid;
    else l = mid + 1;
  }

  return l;
}

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

  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    int t;
    cin >> t;
    A[i] = A[i - 1] + t;
  }
  for (int i = 1; i <= n; ++i) {
    A[i + n] = A[i + n - 1] + A[i] - A[i - 1];
  }

  int ans = 0, tar = A[n] / 3;
  for (int i = 1; i < n - 2; ++i) {
    int c2 = binary(i, n + i, tar), tmin = A[c2 - 1] - A[i - 1], c3 = binary(c2, n + i, (A[i + n - 1] - A[c2 - 1]) / 2);
    tmin = min(tmin, A[c3 - 1] - A[c2 - 1]);
    tmin = min(tmin, A[i + n - 1] - A[c3 - 1]);
    ans = max(ans, tmin);

    for (int j = -1; j < 2; ++j) {
      int tc2 = c2 + j, tc3 = c3 + j;
      tmin = A[tc2 - 1] - A[i - 1];
      tmin = min(tmin, A[tc3 - 1] - A[tc2 - 1]);
      tmin = min(tmin, A[i + n - 1] - A[tc3 - 1]);
      ans = max(ans, tmin);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2752
#include <cstdio>
#include <cmath>

int main(){
	double x1, x2, y1, y2;
	
	scanf(" %lf %lf %lf %lf", &x1, &y1, &x2,&y2);
	printf("%lf\n", sqrt( pow(x2-x1, 2.0) + pow(y2- y1, 2.0) ));
	
	return 0;
}

Measured memory_bytes: 1080
def gcd(a, b):
    if not b:
        return a
    return gcd(b, a%b)

a, b = map(int, input().split())
n = gcd(a, b)
i=2
j = 1
while i*i <= n:
    up = True
    while n%i==0:
        if up:
            j+=1
            up=False
        n/=i
    i+=1
if n!=1:j+=1
print(j)    


Measured memory_bytes: 40172
#include <bits/stdc++.h>
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define rep(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;

ll n,k,r,s,p,ans;
string t;
bool ok[100009];

int main(){
    cin>>n>>k>>r>>s>>p>>t;
    rep(i,n){
        if(i<k||t[i-k]!=t[i]||ok[i-k]){
            if(t[i]=='r')ans+=p;
            if(t[i]=='p')ans+=s;
            if(t[i]=='s')ans+=r;
        }
        else ok[i]=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
import math
n,m = map(int, input().split())
a = []
for i in range(m):
  pk,yk = map(int,input().split())
  b = [pk,yk,i]
  a.append(b)
a.sort(key=lambda x:(x[0],x[1]))
b = a[0][0]
c = 0
for i in range(len(a)):
  if a[i][0] != b:
    b = a[i][0]
    c = 1
  else:
    c += 1
  a[i].append(c)
a.sort(key=lambda x:x[2])
for i in range(len(a)):
  a[i].append(math.floor(math.log10(a[i][0])+1.0))
  a[i].append(math.floor(math.log10(a[i][3])+1.0))
  print(str("0"*(6-a[i][4]))+str(a[i][0])+str("0"*(6-a[i][5]))+str(a[i][3]))

  



Measured memory_bytes: 41748
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    cout << 2*b-a;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double value,min_t,just;
	int number;
	while(scanf("%lf",&value) != EOF)
	{
		min_t = value / 9.8;
		just = 4.9*min_t*min_t;
		number = (just+10) /5.0;
		printf("%d\n",number);
	}
	return 0;
}

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

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  if (a >= b) swap(a, b);

  if (a <= c && c <= b) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;

string s;
int ans,dispo;
bool state;
vector<int> Atable,Ztable;

int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'){
            Atable.push_back(i);
        }
        if(s[i]=='Z'){
            Ztable.push_back(i);
        }
    }
    cout<<Ztable.back()-Atable.front()+1<<endl;
}


Measured memory_bytes: 1364
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
/*bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}*/

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<<29;
const double PI = 3.14159265358979323846;


// ***************************CODE**********************//



int main(){


        string s;
        int k;
        cin >> s >> k;

        int cnt = 0;
        for(int i = 0; i < s.size(); i++){
                if(s[i] == '1') cnt++;
                else break;
        }

        if(k <= cnt) cout << 1 << endl;
        else cout << s[cnt] << endl;



}


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

int main ()
{
    int n,d;
    cin>>n;
    cin>>d;
    int a,b;
    a=n/(2*d+1);
    if(n%(2*d+1)!=0)
        a++;
    cout<<a;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){

  long long a[200000],tmp;
  int n,i;

  cin>>n;
  cin>>a[0];
  for(i=1;i<n;i++){
    cin>>tmp;
    a[i]=a[i-1]+tmp;
  }
  long long result=114514191911451419;
  for(i=0;i<n-1;i++) result=min(result,abs((a[n-1]-a[i])-a[i]));
  cout<<result<<endl;
  return 0;
}







Measured memory_bytes: 1792
#include <iostream>
using namespace std;
#define M 100009

int N;
string s;
char ox[M];
char sw[M];

char inv(char c){
	return c == 'S' ? 'W' : 'S';
}
int main(){
	cin >> N >> s;
	for(int i=0; i<N; i++){
		ox[i] = s.at(i);
	}
	ox[N] = ox[0];
	ox[N+1] = ox[1];
	char init[2][4] = {
		{'S', 'S', 'W', 'W'},
		{'S', 'W', 'S', 'W'}
	};
	for(int I=0; I<4; I++){
		sw[0] = init[0][I];
		sw[1] = init[1][I];
		for(int i=2; i<=N+1; i++){
			sw[i] = (sw[i-1] == 'S')?(
					ox[i-1] == 'o' ? sw[i-2] : inv(sw[i-2])
				):(
					ox[i-1] == 'o' ? inv(sw[i-2]) : sw[i-2]
				);
		}
		if(sw[0] == sw[N] && sw[1] == sw[N+1]){
			for(int i=0; i<N; i++){
				cout << sw[i];
			}
			cout << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 768
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


a, b = nm()
if a >= 13:
    print(b)
elif 6 <= a <= 12:
    print(b // 2)
else:
    print(0)


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

int main() {
 	int a, b, cake[16];
  	cin >> a >> b;
  	cake[0] = 1;
  	for (int i = 1; i < 16; i++) {
    	cake[i] = !cake[i - 1];
   	}
  	for (int i = 0; i < 16; i++) {
    	if (cake[i]) a--;
      	else b--;
   	}
  	if (a > 0 || b > 0) cout << ":(";
  	else cout << "Yay!";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

ll pow(ll x, int n){
    ll ret = 1;
    rep(i, n) ret *= x;
    return ret;
}


int main(){
    ll n;
    cin >> n;
    if(n%2 == 1){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0, k = 10;
    while(n >= k){
        ans += (n / k);
        k *= 5;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
K=int(input())

d=[1000000 for x in range(K+1)]
d[1]=0

def bfs(K):
  q=deque()
  q.append(1)
  while q:
    nx=q.popleft()
    if d[(nx*10)%K]>d[nx]:
      d[(nx*10)%K]=d[nx]
      q.appendleft((nx*10)%K)
    if d[(nx+1)%K]>d[nx]+1:
      d[(nx+1)%K]=d[nx]+1
      q.append((nx+1)%K)
  return d[0]+1

print(bfs(K))

Measured memory_bytes: 6084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n,x;
    cin >> n >> x;
    vector<vector<ll>> dp(n + 1, vector<ll>(100001));
    vector<ll> z(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
    }
    sort(z.begin(), z.end());
    reverse(z.begin(), z.end());
    dp[0][x] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 100001; j++) {
            dp[i + 1][j] += dp[i][j] * (n - i-1);
            dp[i+1][j] %= 1000000007;
        }
        for (int j = 0; j < 100001; j++) {
            dp[i + 1][j%z[i]] += dp[i][j];
            dp[i+1][j % z[i]] %= 1000000007;
        }
    }
    ll ans = 0;
    for (int j = 0; j < 100001; j++) {
        ans += dp[n][j] * j;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

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

using namespace std;


int main() {
    int N;
    int A[100000];
    int r = 1;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] == 1) {
            cout << 1;
            return 0;
        }
    }

    for (int i = 0; i < N - 1; i++) {
        if (A[i] < A[i + 1]) {
            r = A[i];
            A[i] = A[i + 1];
            A[i + 1] = r;
        }
        r = A[i] % A[i + 1];
        while (r != 0) {
            A[i] = A[i + 1];
            A[i + 1] = r;
            r = A[i] % A[i + 1];
        }
        if (A[i + 1] == 1) {
            cout << 1;
            return 0;
        }
    }

    cout << A[N-1];

    return 0;
}

Measured memory_bytes: 640
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
	LL N, A, B;
    cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	} else {
		cin >> A;
		cin >> B;
		cout << A + B << endl;
	}

	return 0;
}


Measured memory_bytes: 384
#![allow(non_snake_case)]
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let X:usize = sc.read();
    let t = X/100;
    let Y = X - X/100*100;
    let mut s:usize = 0;
    if Y%5 != 0{
        s = 1;
    }

    if Y/5 + s<= t{
        println!("1");
    }else{
        println!("0");
    }

}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}




Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<int>q[200000];
int color[200000];
int flag[200000];
int n,m;
int v[200000],d[200000],c[200000];
void dfs(int x,int cnt,int c)
{
   if(!color[x])
       color[x]=c;
   if(flag[x]>=cnt)
       return;
   if(cnt==0)
       return;
   flag[x]=cnt;
   for(int i=0;i<q[x].size();i++)
       dfs(q[x][i],cnt-1,c);
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        q[x].push_back(y);
        q[y].push_back(x);
    }
    int q;
    cin>>q;
    for(int i=1;i<=q;i++)
       cin>>v[i]>>d[i]>>c[i];
    for(int i=q;i>=1;i--)
        dfs(v[i],d[i],c[i]);
    for(int i=1;i<=n;i++)
        cout<<color[i]<<endl;
    return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(arg),key)-begin(arg)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

using namespace std;

template<class T>void reg(vector<T> &ary,const T &elem){ary.emplace_back(elem);}
template<class T>bool chmin(T &a, const T &b) {return (b<a)?(a=b,1):0;}
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}

using R=long double; // __float128
const R EPS = 1E-11; // [-1000:1000]->EPS=1e-8 [-10000:10000]->EPS=1e-7
const R INF = 1E40;
constexpr R PI = acos(R(-1));
inline int sgn(const R& r){ return (r > EPS) - (r < -EPS);}
inline int sgn(const R& a, const R &b){ return sgn(a-b); }
inline R sq(R x){return sqrt(max<R>(x,0.0));}

using P=complex<R>;
using VP=vector<P>;
using L=struct{P s,t;};
using VL=vector<L>;
using C=struct{P c;R r;};
using VC=vector<C>;

constexpr P O = P(0,0);
istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

int n,l[15];
P p[15];

//?????? dot ?????? det
inline R dot(P o,P a,P b){a-=o,b-=o; return real(conj(a)*b);}
inline R det(P o,P a,P b){a-=o,b-=o; return imag(conj(a)*b);}
inline P vec(L l){return l.t-l.s;}

P proj(L l,P p){l.t-=l.s,p-=l.s;return l.s+l.t*real(p/l.t);}
P cross(L a,L b){
	R s1=det(a.s,b.s,b.t);
	R s2=s1+det(a.t,b.t,b.s);
	return a.s+s1/s2*(a.t-a.s);
}
enum RCC{IN=1,ON_IN=2,ISC=4,ON_OUT=8,OUT=16,ONS=10};
int rcc(C a,C b){
	R d=abs(a.c-b.c);
	if(sgn(a.r+b.r-d)<0) return OUT;
	if(sgn(a.r+b.r-d)==0) return ON_OUT;
	if(sgn(abs(a.r-b.r)-d)<0) return ISC;
	if(sgn(abs(a.r-b.r)-d)==0) return ON_IN;
	return IN;
}
VP pcl(C c, L l){P h=proj(l,c.c),e=(l.t-l.s)/abs(l.t-l.s)*sq(norm(c.r)-norm(h-c.c));return VP{h-e,h+e};}
VP pcc(C a,C b){P d=b.c-a.c,w=(norm(d)+norm(a.r)-norm(b.r))/(2.0*norm(d))*d,h=a.c+w,e=w*P(0,1);return pcl(a,{h-e,h+e});}


R calc(P point){
	R res=INF;
	rep(i,n) chmin(res,sq(norm(l[i])-norm(p[i]-point)));
	return res;
}

P getpoint(int i,int j){
	L line={O,P(abs(p[j]-p[i]),0.0)};
	C ci={line.s,R(l[i])},cj={line.t,R(l[j])};
	VP res=pcc(ci,cj);
	R len=real(proj(line,res[0]));
	P ret=p[i]+len/abs(p[j]-p[i])*(p[j]-p[i]);
	return ret;
}

L getline(int i,int j){
	P h=getpoint(i,j);
	P e=(p[j]-p[i])*P(0,1);
	return L{h-e,h+e};
}

int main(void){
	while(cin >> n,n){
		rep(i,n) cin >> p[i] >> l[i];
		R ans=calc(O);
		rep(i,n) chmax(ans,calc(p[i]));
		rep(j,n)rep(i,j) chmax(ans,calc(getpoint(i,j)));
		rep(k,n)rep(j,k)rep(i,j){
			L l1=getline(i,j),l2=getline(i,k);
			P candiate=cross(l1,l2);
			chmax(ans,calc(candiate));
		}
		rep(i,n) chmin<R>(ans,l[i]);
		cout.precision(20);
		cout << fixed << ans << endl;
	}
}

Measured memory_bytes: 3276
def inpl(): return list(map(int, input().split()))

N, M = inpl()
A = inpl()
A.sort(reverse = True)

inf = float('inf')
match = (inf, 2, 5, 5, 4, 5, 6, 3, 7, 6)
matnum = set([match[a] for a in A])
dp = [0]+[-inf]*N

for i in range(1, N+1):
    dp[i] = max([10*dp[max(-1,i-match[a])] + a for a in A])

print(''.join(sorted(str(dp[-1]), reverse = True)))


Measured memory_bytes: 14964
N, M = map(int, input().split())
is_good = [True] * N
H = list(map(int, input().split()))
for _ in range(M):
    A, B = map(lambda n: int(n) - 1, input().split())
    if H[A] <= H[B]:
        is_good[A] &= False
    if H[A] >= H[B]:
        is_good[B] &= False

print(sum(is_good))


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


int help(int tmp){
  int ans = 0;
    while(tmp>0){
       ans+=tmp%10;
       tmp/=10;
    }
  return ans ;
}

int main()
{
   int n,a,b ;
   cin >> n >> a >> b ;

  int answer,sum;
  answer = 0;
  for(int i=1;i<=n;++i){
    sum=help(i);
    if(sum<=b && sum>=a) answer+=i;
  }

  cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	int a,b;
	while(~scanf("%d%d",&a,&b))
	{
		char c[200][200]={'\0'};
		getchar();
		for(int i=0;i<a;i++)
		scanf("%s",c[i]);
		for(int u=0;u<a-1;u++)
		for(int i=0;i<a-1;i++)
		{
			if(strcmp(c[i],c[i+1])>0)
			for(int j=0;j<b;j++)
			{
				char s=c[i][j];
				c[i][j]=c[i+1][j];
				c[i+1][j]=s;
			}
		}
		for(int i=0;i<a;i++)
		printf("%s",c[i]);
		printf("\n");
	}
}

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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll a, b, c, d; cin >> a >> b >> c >> d;

    while(true){
        c-=b;
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}

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

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,k,a[100005],ans[100105]={0};
class BFrog2 {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n >> k;
		f(i,0,n)
		{
			in >> a[i];
			ans[i]=(int)1e18;
		}
		ans[0]=0;
		f(i,0,n)
			f(j,1,min(k+1,n-i+1))
				ans[i+j]=min(ans[i+j],ans[i]+abs(a[i+j]-a[i]));
		out << ans[n-1] << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	BFrog2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792