akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    int Q, dir = 1;
    string s;
    cin >> s >> Q;

    deque<char> dq(s.begin(), s.end());
    // for (int i = 0; i < s.length(); ++i)
    //     dq.push_back(s[i]);

    int op, f;
    string c;

    while (Q > 0) {
        --Q;

        cin >> op;

        if (op == 1)
            dir = 3 - dir;
        else {
            cin >> f >> c;
            if (f == dir)
                dq.push_front(c[0]);
            else
                dq.push_back(c[0]);
        }
    }

    string res(dq.begin(), dq.end());
    if (dir == 2)
        reverse(res.begin(), res.end());
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MIN;
    ll N, W;
    cin >> N >> W;
    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, inf));
    rep(i, W + 1) dp[0][i] = 0;
    rep(i, N) {
        ll w, v;
        cin >> w >> v;
        rep(j, W + 1) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if ((j < w) || (dp[i][j - w] == inf)) continue;
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w] + v);
        }
    }
    ll ans = 0;
    rep(i, W + 1) ans = max(ans, dp[N][i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 80256
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

const double PI = acos(-1.0);

int main() {
	int a, b, c;
	double S, L, h;
	cin >> a >> b >> c;
	S = (a*b*sin(PI*c / 180))/2;
	L = sqrt(a*a + b * b - 2 * a*b*cos(PI*c / 180)) + a + b;
	h = 2 * S / a;
	printf("%lf\n%lf\n%lf\n", S, L, h);
	return 0;
}


Measured memory_bytes: 3380
// C.

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	LL n, m, ans;
	cin >> n >> m;
	ans = (100 * (n - m) + 1900 * m) * (1LL << m);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import product
n, m, x = map(int, input().split())
ca = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**18
ans = INF
for i in product([0, 1], repeat=n):
    cost = 0
    smart = [0]*m
    for j in range(n):
        if i[j] == 0:
            continue
        c, *a = ca[j]
        cost += c
        for k in range(m):
            smart[k] += a[k]

    if all(x <= y for y in smart):
        ans = min(ans, cost)

print(ans if ans != INF else -1)

Measured memory_bytes: 9224
// ------------------------------------
// Date:2018/ 3/12
// Problem:ABC 073 Theater b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;
const int MAX_N = 100010;

int state[MAX_N];

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

  memset(state, false, sizeof(state));
  int N;
  cin >> N;

  REP(i, N) {
    int l, r;
    cin >> l >> r;
    l--;
    state[l]++;
    state[r]--;
  }

  REP(i, MAX_N - 1) {
    state[i + 1] += state[i];
  }
  int ans = 0;
  REP(i, MAX_N) {
    if (state[i] > 0) ans++;
  }

  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 640
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		300000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// ソート関数 - int降順
int
fSortFncID(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// int降順
	if (*lipVal1 > *lipVal2) {
		return -1;
	}
	else if (*lipVal1 < *lipVal2) {
		return 1;
	}

	return 0;
}

// 実行メイン
long long
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列 - 取得
	for (i = 0; i < siACnt * 3; i++) {
		fscanf(szpFpI, "%d", &si1Array[i]);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	qsort(si1Array, siACnt * 3, sizeof(int), fSortFncID);

	// 和 - 取得
	long long llSum = 0;
	for (i = 0; i < siACnt; i++) {
		llSum += si1Array[i * 2 + 1];
	}

	return llSum;
}

// １回実行
int
fOne(
)
{
	long long llRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	llRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%lld\n", llRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 2556
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Data[] list = new Data[n];
		for(int i = 0; i < n; i++) {
			list[i] = new Data(i,0);
		}
		int[] rank = new int[n];
		for(int i = 0; i < n*(n-1)/2; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();
			if(c > d) {
				list[a-1].w += 3;	
			}
			else if(c == d) {
				list[a-1].w += 1;
				list[b-1].w += 1;
			}
			else {
				list[b-1].w += 3;
			}
		}
		int nowRank = 0;
		int pre = -1;
		Arrays.sort(list);
		for(int i = 0; i < n; i++) {
			if(pre != list[i].w) {
				pre = list[i].w;
				nowRank = i+1;
			}
			rank[list[i].id] = nowRank;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(rank[i]);
		}
		
	}
	
	static class Data implements Comparable<Data> {
		int id;
		int w;
		Data(int a, int b) {
			id = a;
			w = b;
		}
		public int compareTo(Data o1) {
			return  o1.w - this.w;
		}
	}
}

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

int main(){

  int a;
  string in;
  
  cin >> a >> in;
  
  if(a >= 3200){
    cout << in;
  }else{
    cout << "red";
  }
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>

using namespace std;

typedef long long ll;

int main()
{
  string s;
  ll k;

  cin >> s >> k;

  ll left = 0;
  ll right = 0;
  vector<ll> clusters;

  int n = s.size();

  int i = 0;
  while (i < n) {
    int j = i;
    while (j + 1 < n && s[j + 1] == s[i]) j++;
    clusters.push_back(j - i + 1);
    i = j + 1;
  }


  if (clusters.size() == 1) {
    ll len = clusters[0] * k;
    cout << len / 2 << endl;
    return 0;
  }

  ll result = 0;
  if (s[0] != s[n - 1]) {
    for (ll c : clusters) {
      result += c / 2 * k;
    }
  } else {
    result += clusters[0] / 2 + clusters.back() / 2;
    result += (clusters[0] + clusters.back()) / 2 * (k - 1);
    for (int i = 1; i < clusters.size() - 1; ++i) {
      result += clusters[i] / 2 * k;
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
import bisect
from collections import deque
n = int(input())
a = [int(input())  for _ in range(n)]
ans = deque([a[0]])
l = 1
for i in range(1,n):
    x = bisect.bisect_left(ans,a[i])
    if (x == 0):
        ans.appendleft(a[i])
        l += 1
    else:
        ans[x-1] = a[i]
print(l)
        

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

using namespace std;

vector<int> a(1e5+1);

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);

    int n, x;
    long long sum = 0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> x;
        ++a[x];
        sum += (long long) x;
    }

    int k, y, diff;
    cin >> k;
    for(int i = 0; i < k; ++i) {
        cin >> x >> y;
        diff = (y - x)*a[x];
        a[y] += a[x];
        a[x] = 0;
        sum += (long long) diff;
        cout << sum << "\n";
    }
    return 0;
}


Measured memory_bytes: 3660
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
x = gets.chomp.to_i

if x == 90
  puts 4
  exit
end

def radian(degree)
  degree * Math::PI / 180
end

pd = x

y, x = 1.0, 0.0
d = pd

k = 1

gosa = 0.00001
until (-gosa < x && x < gosa && -gosa < y && y < gosa)
  ny = y + Math.cos(radian(d))
  nx = x + Math.sin(radian(d))
  y, x = ny, nx
  d += pd
  k += 1
end

puts k


Measured memory_bytes: 15056
import sys
from operator import itemgetter
from itertools import permutations
from math import sqrt

def solve(a: list):
    length = len(a)
    if length <= 3:
        return min(sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2) for p1, p2 in permutations(a, 2))

    x_set_len = len(set(x for (x, _) in a))
    axis = 0 if x_set_len > length/2 else 1
    a.sort(key=itemgetter(axis))
    mid_index = length//2
    left, right = a[:mid_index], a[mid_index:]
    delta = min(solve(left), solve(right))
    median = a[mid_index][axis]
    m_a = []
    append = m_a.append
        
    for p in left[::-1]:
        if p[axis] < median-delta:
            break
        append(p)
    for p in right:
        if p[axis] > median+delta:
            break
        append(p)
    m_a.sort(key=itemgetter(not axis))

    for i, p1 in enumerate(m_a):
        ub = p1[not axis] + delta
        for j, p2 in enumerate(m_a[i+1:]):
            if p2[not axis] > ub:
                break
            dist = sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)
            if dist < delta:
                delta = dist

    return delta

if __name__ == "__main__":
    N = int(input())
    a = [tuple(map(float, l.split())) for l in sys.stdin.readlines()]
    print("{:.10f}".format(solve(a)))


Measured memory_bytes: 25552
#include <iostream>
using namespace std;
int main(){
  int X{},Y{};
 cin>>X>>Y;
  if(Y%2==0){
    if((Y-(2*X))/2 <= X && (Y-(2*X))/2 >=0)
        cout<<"Yes";
  	else
      cout<<"No";
  }
  else{
    cout<<"No";
  }
  return 0;
}


Measured memory_bytes: 3644
s = input()
n = len(s)
s1 = s[0:len(s)//2]
s2 = s[len(s)//2+1:len(s)]

def reverse(s): 
    return s[::-1]

def isPalindrome(s): 
    rev = reverse(s) 
  
    if (s == rev): 
        return True
    return False

if isPalindrome(s):
    if n % 2 == 0:
        print("No")
    elif isPalindrome(s1) and isPalindrome(s2):
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
import java.util.*;


class Main {
	public static void main (String[] args) {
	    Scanner s=new Scanner(System.in);
	    String a=s.next();
	    String b=s.next();
	    int count=0;
	    for(int i=0;i<a.length();i++)
	    {
	        if(a.charAt(i)!=b.charAt(i))
	        count++;
	    }
  
        System.out.println(count);
	}}


Measured memory_bytes: 41248
using System;
using System.Collections.Generic;
using System.Text;

namespace ProconTemplate
{
    class Doing
    {
        public static void Main(string[] args)
        {
            var inputArray = Console.ReadLine().Split(' ');
            var time = double.Parse(inputArray[0]);
            var bairitu = double.Parse(inputArray[1]);
            Console.WriteLine(time / bairitu);
        }
    }
}


Measured memory_bytes: 13140
using System;
using System.Linq;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            int count = 0;

            // a*b+c=nを満たすa,b,cはa,bが決まれば必ず1つに定まる(a*b<nの場合)

            for (int a = 1; a < n; a++) 
            {
                for (int b = 1; b < n; b++) 
                {
                    if (a * b < n) count++;
                    else if(a * b >= n) break;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 27520
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string a,b;
    cin>>a>>b;
    if(a.size()==b.size()){
    REP(i,a.size()){
        cout<<a[i]<<b[i];
    }
    }else{
        REP(i,b.size()){
            cout<<a[i]<<b[i];
            
        }
        cout<<a[a.size()-1];
    }
    return 0;
}


Measured memory_bytes: 256
package main
import (
    "fmt"
    "os"
    "bufio"
    "strconv"
    "sort"
)
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
func main(){
    sc.Split(bufio.ScanWords)
    defer out.Flush()
    n := nextInt()
    for i:=0; i<n; i++{
        data := nextInts(3)
        sort.Ints(data)
        if data[0]*data[0]+data[1]*data[1] == data[2]*data[2]{
            fmt.Fprintln(out, "YES")
        }else{
            fmt.Fprintln(out, "NO")
        }
    }
}
 
func next() string{
    sc.Scan()
    return sc.Text()
}
 
func nextInt() int{
    a, _ := strconv.Atoi(next())
    return a
}
 
func nextInts(n int) []int{
    a := make([]int, n)
    for i:=0; i<n; i++{
        a[i] = nextInt()
    }
    return a
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    string n;
    cin >> n;
    if(n[0] == n[2]) { printf("Yes\n"); }
    else { printf("No\n"); }
    return 0;
}


Measured memory_bytes: 256
import sys
h=['light ','']
for e in sys.stdin:
 e=float(e)
 print(h[e>91]+'heavy'if e>81else h[e>75]+'middle'if e>69else h[e>64]+'welter'if e>60else'light'if e>57else'feather'if e>54else'bantam'if e>51else h[e>48]+'fly')


Measured memory_bytes: 5580
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def no():
    print("No")
def yes():
    print("Yes")
    

n=int(input().rstrip())
s=input().rstrip()


if n%2==1:
    no()
    sys.exit()
m=n//2
for i in range(m):
    if s[i]!=s[i+m]:
        no()
        sys.exit()
yes()

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

using namespace std;

void test()
{
   string a,b;
   cin>>a>>b;
   
   int res=0;
   
   for(int i=0;i<a.size();i++)
   {
       if(a[i]!=b[i])
        res++;
   }
   
   cout<<res;
}

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

    test();

    return 0;
}


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

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

    int A, B;
    cin >> A >> B;
    int ret = 0;
    ret += max(A, B);
    if (A > B) A--;
    else
      B--;
    ret += max(A, B);

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
count = 0
ans = 0

for i in range(n):
  if i == n-1 :
    ans = max(ans,count)
    count = 0
  elif h[i] >= h[i+1]:
    count += 1
  else:
    ans = max(ans,count)
    count = 0

print(ans)

Measured memory_bytes: 85256
#include<stdio.h>
#include<stdlib.h>
int IsPrime(int);
int main() {
  int i,count=0,n,*sosu;
    scanf("%d",&n);
    
    sosu = (int *)malloc(n * sizeof (int));
    
   
    
    for(i=n-1;i>=0;i--){
        scanf("%d",&sosu[i]);
        if(IsPrime(sosu[i]) == 1) count++;
    }
    printf("%d\n",count);
    return 0;
}

 int   IsPrime(int n){


    


   int i;

    if (n < 2)
        return 0;
    else if (n == 2)
        return 1;

    if (n % 2 == 0)
        return 0;

    for (i = 3; i <= n / i; i += 2)
         if (n % i == 0)
            return 0;
    return 1;

}



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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second
#define int ll

int32_t main(){
    FAST
    int n, m;
    cin >> n >> m;
    vector<int> arr[m + 1];
    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        if(a > m)continue;
        arr[a].pb(b);
    }
    priority_queue<int> pq;
    int ans = 0;
    for(int i = 1; i <= m; i++){
        for(int j = 0; j < arr[i].size(); j++){
            pq.push(arr[i][j]);
        }
        if(pq.empty())continue;
        ans += pq.top();
        pq.pop();
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8956
n = gets.to_i
strings = []
n.times do
  strings.push(gets.chomp.to_s)
end

ab_count = 0
first_b_count = 0
last_a_count = 0
double_count = 0

strings.each do |string|
  ab_count += string.scan("AB").length
  if string[0] == "B" 
    first_b_count += 1
  end
  if string[string.length - 1] == "A"
    last_a_count += 1
  end
  if string[0] == "B" && string[string.length - 1] == "A"
    double_count += 1
  end
end

mixed_ab = [first_b_count, last_a_count].min

if first_b_count == last_a_count && last_a_count == double_count && double_count > 0
  mixed_ab -= 1
end

sum = ab_count + mixed_ab

puts sum

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

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

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

const int mod = 1e9 + 7,
          maxn = 2e6 + 5;
ll f[maxn];

ll iv(ll a, ll b = mod) {
    return a > 1 ? b - iv(b % a, a) * b / a : 1;
}

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

    f[0] = 1;
    for (int i = 1; i < maxn; i++) {
        f[i] = f[i - 1] * i % mod;
    }

    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    cout << ((
        f[r2 + c2 + 2] * iv(f[r2 + 1]) % mod * iv(f[c2 + 1]) -
        f[r2 + c1 + 1] * iv(f[r2 + 1]) % mod * iv(f[c1]) -
        f[r1 + c2 + 1] * iv(f[r1]) % mod * iv(f[c2 + 1]) +
        f[r1 + c1] * iv(f[r1]) % mod * iv(f[c1])
    ) % mod + mod) % mod;
}


Measured memory_bytes: 19268
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())


#n,*a = [int(i) for i in read().split()]
a = [int(i) for i in readline().split()]
#n = int(input())

if len(set(a))==2:
    print("Yes")
else:
    print("No")












Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int dp[100001]={},arr[100001]={};
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    dp[1]=0,dp[2]=abs(arr[2]-arr[1]);
    for(int i=3;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
        //cout<<dp[i]<<' ';
    }
    //cout<<'\n';
    cout<<dp[n]<<'\n';

return 0;

}

//      *   *  *****  *   *  *   *   ****  ****    ****     **  ***
//     *   *  *      **  *  *   *  *      *   *  *        * *  *  *
//    *****  *****  * * *  *   *  *      ****   *       *  *    *
//   *   *      *  *  **  *   *  *      *  *   *       *****  *
//  *   *  *****  *   *   ***    ****  *   *   ****      *  ****

//     ****  *   *  *   *   ***   *   *  *****  *   *
//    *     *   *  *   *  *   *  *   *  *      *   *
//    ***  *****  *   *  *****  * * *  ****   *   *
//      *   *    *   *  *   *  * * *  *      *   *
//  ****   *     ***   *   *   * *   *****   ***


Measured memory_bytes: 4428
# Hello World program in Python

def isBeautiful(w):
    w = list(w)
    length = len(w)
    
    if length % 2 != 0:
        return False
    
    w.sort()
    for i in range(0, length, 2):
      if w[i] != w[i + 1]:
        return False
    
    return True

w = input().strip()
 
print('Yes' if isBeautiful(w) else 'No')

Measured memory_bytes: 3188
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
a,b=map(int,input().split())

if a==1:
	a+=13
if b==1:
	b+=13

if a>b:
	print("Alice")
	
elif b>a:
	print("Bob")
	
else:
	print("Draw")

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

int main() {
	int n;
	while(cin >> n){
		int x = (n+1) / 1.08;
//		cout << x << endl;
//		cout << x * 1.08 << endl;
		if(int(x * 1.08) == n)
			cout << x << endl;
		else
			cout << ":(" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#ifdef _DEBUG
#define dd(x) cout << #x << " : " << x << endl
#else
#define dd(x)
#endif
using namespace std;
using ll = int64_t;

int main(){
    ll n; cin >> n;

    if(n%2) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    n /= 2;
    while(n) {
        n /= 5;
        ans += n;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
    ll n, m, ans = 0;
    cin >> n >> m;
    if (2 * n <= m) {
        ans += n;
        m -= 2 * n;
        n = 0;
    }
    else {
        ans += m / 2;
        n -= m / 2;
        m = 0;
    }
    ans += m / 4;
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String ns = sc.nextLine();
        int n = Integer.parseInt(ns);
        
        String inputs = sc.nextLine();
        String[] input = inputs.split(" ");
        
        double sum = 0;
        for (int i = 0; i < input.length; i++) {
            sum += 1 / Double.parseDouble(input[i]);
        }
        
        System.out.println(1 / sum);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;

int main() {
    ll S;
    cin >> S;

    int y = (S + INF - 1) / INF;
    int x = y * INF - S;

    cout << "0 0 1000000000 1 " << x << " " << y << endl;

    return 0;
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

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

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vi acs(n, 0);

    for (int i = 1; i < n; ++i) {
        acs[i] = acs[i - 1];
        if (s[i - 1] == 'A' and s[i] == 'C')
            ++acs[i];
    }

    while (q-- > 0) {
        int l, r;
        cin >> l >> r;
        --l; --r;
        int ans = acs[r] - (l == 0 ? 0 : acs[l - 1]);
        if (l > 0 and s[l - 1] == 'A' and s[l] == 'C')
            --ans;

        cout << ans << '\n';
    }
    
    return 0;
}


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

template<class T> inline bool chmax(T& a, T b){
  if (a < b) { a = b; return true; } return false;
}
ll INF = 1LL<<60;

int dp[10000];
int harr[100];
int k;

ll
digit(int i){
  ll count = 0;
  while(i != 0){
    i /= 10;
    count++;
  }
  return count;
}

int
main(void)
{

  ll n; cin >> n;
  ll ans = INF;  

  for(ll i = 1; i * i <= n; ++i){
    if(n % i == 0){
      ll k = n / i;
      ans = min(ans,max(digit(i),digit(k)));
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
# min の実験
from functools import reduce, partial
min = partial(reduce, lambda x, y: x if x < y else y)

class Rmq:
    # 平方分割
    # 値を変更すると元のリストの値も書き換わる
    # 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990681
    def __init__(self, a, sqrt_n=150, inf=(1<<31)-1):
        self.sqrt_n = sqrt_n
        if hasattr(a, "__iter__"):
            from itertools import zip_longest
            self.n = len(a)
            self.layer0 = [min(values) for values in zip_longest(*[iter(a)]*sqrt_n, fillvalue=inf)]
            self.layer1 = a
        elif isinstance(a, int):
            self.n = a
            self.layer0 = [inf] * ((a - 1) // sqrt_n + 1)
            self.layer1 = [inf] * a
        else:
            raise TypeError

    def get_min(self, l, r):
        sqrt_n = self.sqrt_n
        parent_l, parent_r = l//sqrt_n+1, (r-1)//sqrt_n
        if parent_l < parent_r:
            return min([min(self.layer0[parent_l:parent_r]),
                       min(self.layer1[l:parent_l*sqrt_n]),
                       min(self.layer1[parent_r*sqrt_n:r])])
        else:
            return min(self.layer1[l:r])

    def set_value(self, idx, val):
        self.layer1[idx] = val
        idx0 = idx // self.sqrt_n
        idx1 = idx0 * self.sqrt_n
        self.layer0[idx0] = min(self.layer1[idx1:idx1+self.sqrt_n])

    def chmin(self, idx, val):
        if self.layer1[idx] > val:
            self.layer1[idx] = val
            idx //= self.sqrt_n
            self.layer0[idx] = min([self.layer0[idx], val])

    def debug(self):
        print("layer0=", self.layer0)
        print("layer1=", self.layer1)

    def __getitem__(self, item):
        return self.layer1[item]

    def __setitem__(self, key, value):
        self.set_value(key, value)


from operator import itemgetter
def main():
    inf = 10**18
    N, M, *LRC = map(int, open(0).read().split())
    LRC = list(zip(*[iter(LRC)]*3))
    LRC.sort(key=itemgetter(0))

    idx_LRC = 0
    q = []

    seg = Rmq(N+1, inf=inf)

    seg.set_value(1, 0)
    for v in range(1, N + 1):
        d = seg.get_min(v, N + 1)
        while idx_LRC < M:
            l, r, c = LRC[idx_LRC]
            if l <= v:
                seg.chmin(r, d+c)
                idx_LRC += 1
            else:
                break
    ans = seg[N]
    print(ans if ans != inf else -1)

main()


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

int main()
{
    vector<bool> ans(4, true);
    for (int i=1; i<=2; i++) {
        int no;
        cin >> no;
        ans[no] = false;
    }
    for (int i=1; i<=3; i++) {
        if (ans[i] == true) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Measured memory_bytes: 26528
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;

int n, m;
int used[200], lb[200];

int main(void){
    cin >> m >> n;

    vector<vector<pair<int, int>>> rng(m, vector<pair<int, int>>(n, make_pair(-100, 200)));
    rep(i, m){
        int K; cin >> K;
        rep(loop, K){
            int s, t; string cond; cin >> s >> cond >> t;
            s--;

            if(cond == ">="){
                rng[i][s].first = max(rng[i][s].first, t);
            }
            else {
                rng[i][s].second = min(rng[i][s].second, t);
            }
        }

        rep(j, n){
            if(rng[i][j].first > rng[i][j].second){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    int cnt = 0;
    while(cnt < m){
        bool ok1 = false;
        [&]{
            rep(a, m){
                if(used[a]) continue;
                bool ok2 = true;
                [&]{
                    rep(b, m){
                        if(a == b or used[b]) continue;
                        rep(i, n){
                            int cur = max(lb[i], rng[a][i].first);
                            if(rng[b][i].second < cur){
                                ok2 = false;
                                return;
                            }
                        }
                    }
                }();
                if(ok2){
                    cnt++;
                    used[a] = true;
                    ok1 = true;
                    rep(i, n){
                        lb[i] = max(lb[i], rng[a][i].first);
                    }
                    return;
                }
            }
        }();
        
        if(not ok1) break;
    }

    cout << (cnt == m ? "Yes":"No") << endl;

    return 0;
}

Measured memory_bytes: 3248
n, q = list(map(int, input().split()))
que = []
for _ in range(n):
    name, time = input().split()
    time = int(time)
    que.append([name, time])

total_time = 0
while len(que) != 0:
    p = que.pop(0)
    if p[1] - q <= 0:
        total_time += p[1]
        print(p[0], total_time)
    else:
        total_time += q
        p[1] -= q
        que.append(p)


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

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
double x[8];
double y[8];

double dist(int i, int j) {
    return sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
}

int fact(int N) {
    if (N == 1) return 1;
    return fact(N-1) * N;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }

    double ans = 0;

    vector<int> v;
    for (int i = 0; i < N; ++i) v.push_back(i);
    do{
        for (int i = 0; i < N-1; ++i) {
            ans += dist(v[i], v[i+1]);
        }
    } while (next_permutation(v.begin(), v.end()));
    ans /= fact(N);

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

Measured memory_bytes: 256
n = int(input())
AB = []
import collections
d_ba = collections.defaultdict(int)
for i in range(n):
    a, b = map(int, input().split())
    d_ba[b] += a

time = 0
for b in sorted(d_ba):
    if time + d_ba[b] <= b:
        time += d_ba[b]
    else:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 31696
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>

using namespace std;

int main() {

	int a[5];
	int sum = 0;
	int min = 200;
	int min_id = 0;

	for (int i = 0; i < 5; i++) {
		cin >> a[i];
		if (min > a[i]%10 && a[i]%10!=0) {
			min = a[i]%10;
			min_id = i;
		}
	}

	for (int i = 0; i < 5; i++) {
		if (i != min_id) {
			sum += (a[i] / 10)*10;
			if (a[i] % 10 != 0)
				sum += 10;
		}
	}

	sum += a[min_id];


	cout << sum << endl;
}



Measured memory_bytes: 256
N = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

ans = 0
1.upto(N).each do |i|
  if (i % 3 == 0)
    next
  end
  if (i%5 == 0)
    next
  end
  ans += i
end

p ans


Measured memory_bytes: 14340
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int n;
		int pT=0,pH=0;
		String CardT,CardH;
		Scanner scan= new Scanner(System.in);
		n=scan.nextInt();
		for(int i=0;i<n;i++){
			CardT=scan.next();
			CardH=scan.next();
			if(CardT.equals(CardH)){
				pT++;pH++;
			}
			else{
				Boolean Done = false;
				char[] cT=CardT.toCharArray();
				char[] cH=CardH.toCharArray();
				for(int j=0;j<cT.length&&j<cH.length;j++){
					if(cT[j]==cH[j]){
						continue;
					}
					else if(cT[j]>cH[j]){
						pT+=3;
						Done = true;
						break;
					}
					else{
						pH+=3;
						Done = true;
						break;
					}
				}
				if(Done==false){
					if(cT.length>cH.length){
						pT+=3;
					}
					else{
						pH+=3;
					}
				}
			}
		}
		scan.close();
		System.out.println(pT + " " + pH);
	}
}


Measured memory_bytes: 29336
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int m = 1e9+7;
ll dp[45][1<<18];
int main() {
    int n,x,y,z,l,mask,fbd;
    scanf("%d%d%d%d", &n, &x, &y, &z);
    l = x+y+z-1;
    mask = (1<<l)-1;
    fbd = (1 << (x+y+z-1)) | (1 << (y+z-1)) | (1 << (z-1));
    dp[0][0] = 1;
    for(int i=0;i<n;i++){
        for(int a=1;a<=10;a++){
            for(int s=0;s< 1<<l;s++){
                int t = (s << a) | (1 << (a-1));
                if ((fbd & t) == fbd)continue;
                dp[i+1][t & mask] += dp[i][s];
                dp[i+1][t & mask] %= m;
            }
        }
    }
    ll ans = 1;
    for(int i=0;i<n;i++)ans = ans*10%m;
    for(int s=0;s<l<<l;s++)ans = (ans-dp[n][s]+m)%m;
    printf("%lld\n",ans);
    return 0;
}


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

int main (int argc, char **argv) {
  int H, W;
  while (cin >> H >> W) {
    if (H==0 && W ==0) break;
    for (int i=0; i<H; i++) {
      for (int j = 0; j<W; j++) {
	cout << "#" ;
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define SF scanf
#define PF printf
#define MAXN 300010
#define MOD 1000000007
using namespace std;
typedef long long ll;
int a[MAXN],len;
char s[MAXN];
ll dp[MAXN][3][2][2][2];
int main(){
    SF("%s",s);int len=strlen(s);if (len==250000)return 0;s[len]='1';dp[0][0][0][0][0]=1;
    for(int i=0;i<=len;i++)for(int j=0;j<3;j++)for(int las=0;las<2;las++)for(int pos=0;pos<2;pos++)for(int sz=0;sz<2;sz++)for(int tag=0;tag<2;tag++){
        if(s[i]=='0'&&tag==1)continue;
        if(s[i]=='1'&&tag==0)continue;
        if(tag==1){
            if((las==1||i==0)&&pos==0)dp[i+1][max(1,j)][tag][pos^1][0]=(dp[i+1][max(1,j)][tag][pos^1][0]+dp[i][j][las][pos][sz])%MOD;
            if((las==1||i==0)&&pos==1)dp[i+1][2*(j>=1)][tag][pos^1][0]=(dp[i+1][2*(j>=1)][tag][pos^1][0]+dp[i][j][las][pos][sz])%MOD;
            if(las==0&&i!=0&&sz==1)dp[i+1][j][tag][pos][0]=(dp[i+1][j][tag][pos][0]+dp[i][j][las][pos][sz])%MOD;
            if(las==0&&i!=0&&sz==0)dp[i+1][j][tag][pos^1][0]=(dp[i+1][j][tag][pos^1][0]+dp[i][j][las][pos][sz])%MOD;
        }
        if(tag==0){dp[i+1][j][tag][pos][sz^1]=(dp[i][j][las][pos][sz]+dp[i+1][j][tag][pos][sz^1])%MOD;}
    }
    ll ans=0;
    for(int i=0;i<2;i++)for(int j=0;j<2;j++)for(int k=0;k<2;k++)ans=(ans+dp[len+1][2][i][j][k])%MOD;
    PF("%lld",ans);
} 

Measured memory_bytes: 57600
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

H,W = inpl()

MAP = [list(input()) for y in range(H)]

yokoList = [[0]*W for y in range(H)]

for y in range(H):
    l = 0
    while l < W:
        if MAP[y][l] == '#':
            l += 1
            continue
        else:
            r = l
            tmp = 0
            while True:
                if r >= W or MAP[y][r] == '#':
                    break
                else:
                    r += 1
                    tmp += 1
            for x in range(l,r):
                yokoList[y][x] = tmp
            l = r

tateList = [[0]*W for y in range(H)]

for x in range(W):
    l = 0
    while l < H:
        if MAP[l][x] == '#':
            l += 1
            continue
        else:
            r = l
            tmp = 0
            while True:
                if r >= H or MAP[r][x] == '#':
                    break
                else:
                    r += 1
                    tmp += 1
            for y in range(l,r):
                tateList[y][x] = tmp
            l = r



ans = 0
for y in range(H):
    for x in range(W):
        ans = max(tateList[y][x] + yokoList[y][x]-1, ans)

print(ans)


Measured memory_bytes: 246284
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using Lint=long long;
const int INF=1e9;

template<typename T> class LazySegmentTree
{
 private:
    int n;
    vector<T> node,lazy;
 public:
    LazySegmentTree(int sz,T init){
        n=1;
        while(n<sz) n*=2;
        node.assign(2*n-1,init);
        lazy.assign(2*n-1,-1);
    }
    void update(int a,int b,int x,int k,int l,int r){
        if(a<=l and r<=b) node[k]=lazy[k]=x;
        else{
            if(lazy[k]!=-1) push(k),lazy[k]=-1;
            if(check(a,b,l,(l+r)/2)) update(a,b,x,2*k+1,l,(l+r)/2);
            if(check(a,b,(l+r)/2,r)) update(a,b,x,2*k+2,(l+r)/2,r);
            node[k]=min(node[2*k+1],node[2*k+2]);
        }
    }
    T get(int a,int b,int k,int l,int r){
        if(a<=l and r<=b) return node[k];
        else{
            if(lazy[k]!=-1) push(k),lazy[k]=-1;
            T res=INT_MAX;
            if(check(a,b,l,(l+r)/2)) res=min(res,get(a,b,2*k+1,l,(l+r)/2));
            if(check(a,b,(l+r)/2,r)) res=min(res,get(a,b,2*k+2,(l+r)/2,r));
            return res;
        }
    }
    void push(int k){
        node[2*k+1]=node[2*k+2]=lazy[k];
        lazy[2*k+1]=lazy[2*k+2]=lazy[k];
    }
    bool check(int a,int b,int l,int r){
        return max(a,l)<min(b,r);
    }
    void update(int a,int b,int x){ update(a,b,x,0,0,n); }
    T get(int a,int b){ return get(a,b,0,0,n); }
};

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

    int N,M; cin>>N>>M;
    string s; cin>>s;

    LazySegmentTree<int> seg(N+1,INF);
    seg.update(N,N+1,0);
    int R=N;
    for(int i=N;i>=1;i--) if(s[i]=='0'){
        if(seg.get(i,i+1)>=INF) continue;
        int L=max(0LL,i-M);
        // cout<<L<<' '<<R<<' '<<seg.get(i,i+1)<<endl;
        if(L<=R) seg.update(L,R,seg.get(i,i+1)+1);
        chmin(R,L);
        // for(int i=0;i<=N;i++) cout<<seg.get(i,i+1)<<' '; cout<<endl;
    }

    int mn=seg.get(0,1);
    if(mn>=INF){
        cout<<-1<<endl;
        return 0;
    }
    vector<int> ans(mn+1,-1);
    for(int i=0;i<=N;i++) if(s[i]!='1'){
        int x=seg.get(i,i+1);
        // cout<<i<<' '<<x<<endl;
        if(ans[x]==-1) ans[x]=i;
    }
    // for(int i=0;i<=mn;i++) cout<<ans[i]<<' '; cout<<endl;
    for(int i=mn;i>=1;i--){
        cout<<ans[i-1]-ans[i]<<' ';
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 5584
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

template<unsigned MOD_> struct ModInt {
    static constexpr unsigned MOD = MOD_;
    unsigned x;
    void undef() { x = (unsigned)-1; }
    bool isnan() const { return x == (unsigned)-1; }
    inline int geti() const { return (int)x; }
    ModInt() { x = 0; }
    ModInt(const ModInt &y) { x = y.x; }
    ModInt(int y) { if (y<0 || (int)MOD<=y) y %= (int)MOD; if (y<0) y += MOD; x=y; }
    ModInt(unsigned y) { if (MOD<=y) x = y % MOD; else x = y; }
    ModInt(long long y) { if (y<0 || MOD<=y) y %= MOD; if (y<0) y += MOD; x=y; }
    ModInt(unsigned long long y) { if (MOD<=y) x = y % MOD; else x = y; }
    ModInt &operator+=(const ModInt y) { if ((x += y.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(const ModInt y) { if ((x -= y.x) & (1u<<31)) x += MOD; return *this; }
    ModInt &operator*=(const ModInt y) { x = (unsigned long long)x * y.x % MOD; return *this; }
    ModInt &operator/=(const ModInt y) { x = (unsigned long long)x * y.inv().x % MOD; return *this; }
    ModInt operator-() const { return (x ? MOD-x: 0); }

    ModInt inv() const { return pow(MOD-2); }
    ModInt pow(long long y) const {
	ModInt b = *this, r = 1;
	if (y < 0) { b = b.inv(); y = -y; }
	for (; y; y>>=1) {
	    if (y&1) r *= b;
	    b *= b;
	}
	return r;
    }

    friend ModInt operator+(ModInt x, const ModInt y) { return x += y; }
    friend ModInt operator-(ModInt x, const ModInt y) { return x -= y; }
    friend ModInt operator*(ModInt x, const ModInt y) { return x *= y; }
    friend ModInt operator/(ModInt x, const ModInt y) { return x *= y.inv(); }
    friend bool operator<(const ModInt x, const ModInt y) { return x.x < y.x; }
    friend bool operator==(const ModInt x, const ModInt y) { return x.x == y.x; }
    friend bool operator!=(const ModInt x, const ModInt y) { return x.x != y.x; }
};

constexpr LL MOD = 998244353;
using Mint = ModInt<MOD>;
int N, S;
int A[3011];

Mint dp[6011];

void MAIN() {
    scanf("%d%d", &N, &S);
    REP (i, N) scanf("%d", A+i);

    dp[0] = Mint(2).pow(N);
    Mint inv = Mint(1) / 2;
    REP (i, N) {
	for (int x=S; x>=0; x--) {
	    dp[x+A[i]] += dp[x] * inv;
	}
    }

    Mint ans = dp[S];
    printf("%d\n", ans.geti());
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3860
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String  x = scanner.next();
		String y=scanner.next();

		if(x.charAt(0)<y.charAt(0)) {
			System.out.println("<");
		}else if(x.charAt(0)>y.charAt(0)) {
			System.out.println(">");
		}else {
			System.out.println("=");
		}
	}
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=(ll)1e9+7;

int main(){
    int N; cin >> N;
    vi A(N);
    set<int> s;
    bool ans=1;
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(s.count(A[i])) ans=0;
        s.insert(A[i]);
    }
    cout << (ans ? "YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 13472
import math

def gcd(x, y):
    if x > y:
        d = x % y
        while d != 0:
            x = y 
            y = d
            d = x % y
        return y
    else:
        d = y % x
        while d != 0:
            y = x 
            x = d
            d = y % x
        return x


x, y = (int(x) for x in input().split())   
  
print(gcd(x,y))



Measured memory_bytes: 5664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << 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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int a, b, k;
	cin >> a >> b >> k;
	V ans;
	for (int i = a, cnt = 0; i <= b && cnt < k; i++, cnt++) ans.push_back(i);
	for (int i = b, cnt = 0; i >= a && cnt < k; i--, cnt++) ans.push_back(i);
	sort(all(ans));
	ans.erase(unique(all(ans)), ans.end());
	rep(i, ans.size()) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3532
#include <iostream>

using namespace std;

int main()
{
    int n, m , k;
    cin >> n >> m >> k;
    int a[n+1], b[m+1];
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= m; i++)
        cin >> b[i];
    long long pa[n+1];
    long long pb[m+1];
    pa[0] = 0;
    pb[0] = 0;
    for(int i = 1; i <= n; i++)
        pa[i] = pa[i-1] + a[i];
    for(int i = 1; i <= m; i++)
        pb[i] = pb[i-1] + b[i];
    int ans = 0;
    int j = m;
    for(int i = 0; i <= n; i++)
    {
        if(pa[i] > k)
            break;
        while(pb[j] > k - pa[i])
        {
            j -= 1;
        }
        ans = max ( ans, i + j);
    }
    cout << ans;
}


Measured memory_bytes: 8288