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

int main() {
    
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    bool add = true;
    int ans = 0;
    for (int i = v.size()-1; i >= 0; i--) {
        if (add) {
            ans += v[i];
        } else {
            ans -= v[i];
        }
        add = !add;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define Pi pair<int,int>
#define IINF 1e9
#define LINF 1e18
#define vi vector<int>
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 0, 1,0,-1 };
int dy[] = { 1, 0,-1,0 };
int dx8[] = { -1,-1,-1,0,0,1,1,1 };
int dy8[] = { -1,0,1,-1,1,-1,0,1 };

unsigned long long sttoi(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

int comb(int n, int k) {
	int ans = 1;
	for (int i = 0; i < min(k, n - k); i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

ll mod_pow(ll n, ll p, ll mod) {
	if (p == 0) return 1 % mod;
	if (p < 2) {
		return n % mod;
	}
	else {
		ll d = 2, value = (n%mod)*(n%mod) % mod;
		while (d * 2 < p) { d *= 2;	value *= value;	value %= mod; }
		value %= mod;
		return ((value%mod) * (mod_pow(n, p - d, mod) % mod)) % mod;
	}
}

bool isPrime(int n) {
	if (n <= 1)return false;
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i*i <= n; i += 2) {
		if (n%i == 0)return false;
	}
	return true;
}

void solve() {
	string st;
	cin >> st;
	bool e = 0, w = 0, n = 0, s = 0;
	rep(i, st.length()) {
		switch (st[i]) {
		case 'S':s = 1; break;
		case 'E':e = 1; break;
		case 'N':n = 1; break;
		case 'W':w = 1; break;
		}
	}
	if (s==n && e==w) {
		P("Yes");
	}
	else {
		P("No");
	}
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll a, b;
  cin >> a >> b;
  a += b;
  a %= 24;
  COUT(a);
  return 0;
}

Measured memory_bytes: 3604
N=int(input())
A=list(map(int,input().split()))
element=[0]*(10**5)
total=sum(A)
for a in A:
    element[a-1]+=1
Q=int(input())
for q in range(Q):
    B,C=map(int,input().split())
    total+=element[B-1]*(C-B)
    if element[B-1]!=0:
        element[C-1]+=element[B-1]
        element[B-1]=0
    print(total)

Measured memory_bytes: 20880
#include<stdio.h>
main(){
  int n;
  int a[100];
  int i;
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  i--;
  for(;i>=0;i--){
    if(i!=n-1)
      printf(" ");
    printf("%d",a[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  vector<string> cards(3);
  rep(i,3) cin >> cards[i];

  int cur = 0;
  while (true) {
    string s = cards[cur];
    if(s.size() == 0) { cout << (char)(cur+65) << endl; return 0; }
    cards[cur] = s.substr(1,s.size()-1);
    cur = (int)(s[0]-97);
  }
  return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	x := make([]int, n)
	y := make([]int, n)

	x[0] = a[0]
	y[n-1] = a[n-1]

	for i := 1; i < n; i++ {
		x[i] = gcd(x[i-1], a[i])
	}

	for i := n - 2; i >= 0; i-- {
		y[i] = gcd(y[i+1], a[i])
	}

	ans := max(x[n-2], y[1])

	for i := 1; i < n-1; i++ {
		r := gcd(x[i-1], y[i+1])
		ans = max(ans, r)
	}

	fmt.Println(ans)
}

func gcd(a int, b int) int {
	for {
		r := a % b
		if r == 0 {
			return b
		}
		a, b = b, r
	}
}


Measured memory_bytes: 6124
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n,l,i,cnt=0;
    string s;
    cin >> n;
    cin >> s;
    l=s.length();
    if(l>=3) {
    	for(i=0;i<=l-3;i++) {
    		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') cnt++;
    	}
    } 
    cout << cnt << "\n";
    return 0;
}



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

using namespace std;

typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;
    set<ll> prime;
    for(int i = int(sqrt(m))+1; i; i--){
        if(m%i == 0 && m/i >= n){
            prime.insert(i);
            prime.insert(m/i);
        }
    }
    for(auto && var:prime){
        if(n <= var){
            cout << m/var << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string word;
    int m,h;
    while(1){
        cin >> word;
        if (word == "-") break;
        else{
            int len = word.size();
            cin >> m;
            for(int i = 1; i <= m; i++){
                cin >> h;
                word += word;
                word = word.substr(h,len);
                
            }
        }
        cout << word << endl;
        
    }
    return 0;
}


Measured memory_bytes: 3196
def solve():
    A,B,C,X,Y = map(int, input().split())
    ans = X*A + Y*B
    for i in range(max(X,Y)+1):
        aandb = A * max(0, X-i) + B * max(0, Y-i)
        ab = 2*C*i
        ans = min(ans, aandb + ab)
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3060
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define mod 1000000007
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	ll x,y,z;
	cin >> x >> y >> z;
	cout << z << sp << x << sp << y;
    return ;
}

int32_t main()
{
    fastio
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


Measured memory_bytes: 3588
def pintarr(arr):
    arr = [str(c) for c in arr]
    print(' '.join(arr))


def selecsort(arr, total):
    count = 0
    for i in range(total):
        minj = i
        for j in range(i, total):
            if arr[j] < arr[minj]:
                minj = j
        arr[i], arr[minj] = arr[minj], arr[i]
        if i != minj:
            count += 1
    pintarr(arr)
    print(count)


if __name__ == '__main__':
    t = int(input())
    a = input()
    a = [int(c) for c in a.split(' ')]
    selecsort(a, t)


Measured memory_bytes: 5600
A, B = map(int, input().split())

i = min(int(A/0.08), int(B/0.1)) * 1.0
while(True):
  if int(i * 0.08) == A and int(i*0.1) == B:
    print(int(i))
    break
  i = 1.0 + i
  if int(i * 0.08) > A or int(i*0.1) > B:
    print('-1')
    break

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    loop {
        let h: u32 = sc.read();
        let w: u32 = sc.read();
        if h == 0 { break }
        for i in 0..h {
            for j in 0..w {
                let c = if (i + j) % 2 == 0 {
                    '#'
                } else {
                    '.'
                };
                print!("{}", c);
            }
            println!("");
        }
        println!("");
    }
}



Measured memory_bytes: 5024
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    int m;
    cin >> n >> m;

    vector<int> A(m);
    vector<int> B(m);
    vector<long long> W(m);

    vector<vector<pair<int, long long>>> graph(n);
    for (int i = 0; i < m; ++i) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        A[i] = a, B[i] = b, W[i] = w;
        graph[a].emplace_back(b, w);
    }

    const long long INF = 1LL << 50;
    vector<long long> dis(n, -INF);
    dis[0] = 0;

    const int LIMIT = 2 * n + 10;
    int rnd = -1;
    for (int i = 0; i < LIMIT; ++i) {
        for (int u = 0; u < n; ++u) {
            for (auto& e : graph[u]) {
                int v = e.first;
                long long w = e.second;
                if (v == n - 1 && dis[v] < dis[u] + w) {
                    rnd = i;
                }
                dis[v] = max(dis[v], dis[u] + w);
            }
        }
    }

    if (rnd > n) {
        cout << "inf\n";
    } else {
        cout << dis[n - 1] << '\n';
    }
    return 0;
}

Measured memory_bytes: 3756
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    A, B, C = input().split()
    ok = A[-1] == B[0] and B[-1] == C[0]
    print("YES" if ok else "NO")

if __name__ == "__main__": main()


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

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

int main(){
    int k;
    cin >> k;
    long long sum = 0;
    for(int a=1;a<=k;++a){
        for(int b=a;b<=k;++b){
            int gcd_ab = gcd(a,b);
            for(int c=b;c<=k;++c){
                int gcd_abc = gcd(gcd_ab, c);
                if(a==b and b==c)
                    sum += gcd_abc;
                else if(a!=b and b!=c and c!=a)
                    sum += gcd_abc*6;
                else
                    sum += gcd_abc*3;
            }
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rg register
using namespace std;

const int N = 300+10;
char str[N];
int k,n;
int f[N][N][N];


int ck(int x,int y){
	if(x!=y && str[x]==str[y]) return 2;
	if(x==y) return 1;
	return 0;
}

int main(){
	//freopen("d.in","r",stdin);
	//freopen("d.out","w",stdout);
	scanf("%s",str+1);		
	n=strlen(str+1);
	scanf("%d",&k);

	int ans=0;
	for(int i=1; i<=n; ++i)
		for(int j=n; j>=i; --j)
			for(int t=0; t<=k; ++t){
				int x=i+1,y=j-1,c=(bool)(str[i]!=str[j]);
					if(x<=y&&t+c<=k) f[t+c][x][y]=max(f[t+c][x][y],f[t][i][j]+2);
					if(x-1==y){
						if(t+c<=k) ans=max(ans,f[t][i][j]+2);
					}
					if(x-2==y){
						if(t+c<=k) ans=max(ans,f[t][i][j]+1);
					}

					f[t][x][y]=max(f[t][x][y],f[t][i][j]);
					f[t][i][y]=max(f[t][i][y],f[t][i][j]);
					f[t][x][j]=max(f[t][x][j],f[t][i][j]);
					ans=max(ans,f[t][i][j]);
			}

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

Measured memory_bytes: 114944
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(998244353)
#define PI 3.14159265358979323846264338327950L
// ------------------ Debugging ------------------
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "[ " << *it << " = " << a << " ] ";
    err(++it, args...);
}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
// -----------------------------------------------

signed main(){

    fastIO

    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1)/x * t<< endl;
    
    return 0;
}

Measured memory_bytes: 3644
from itertools import product
H, W, K = map(int, input().split())
mod = 10 ** 9 + 7

if W == 1:
    print(1)
    exit()

up = [0] * W
right = [0] * W
left = [0] * W

for b in range(1 << (W - 1)):
    bridge = bin(b)[2:].zfill(W - 1)
    if "11" in bridge:
        continue

    # 左の棒
    if bridge[0] == "0":
        up[0] += 1
    else:
        right[0] += 1

    # 右の棒
    if bridge[-1] == "0":
        up[W - 1] += 1
    else:
        left[W - 1] += 1

    # 真ん中
    for i in range(1, W - 1):
        if bridge[i - 1] == "0" and bridge[i] == "1":
            right[i] += 1
        elif bridge[i - 1] == "1" and bridge[i] == "0":
            left[i] += 1
        else:
            up[i] += 1

up = [0] + up + [0]
right = [0] + right + [0]
left = [0] + left + [0]

dp = [0] * (W + 2)
dp[K] = 1
for _ in range(H):
    newDP = [0] * (W + 2)
    for i in range(1, W + 1):
        newDP[i] += dp[i - 1] * right[i - 1]
        newDP[i] += dp[i] * up[i]
        newDP[i] += dp[i + 1] * left[i + 1]
        newDP[i] %= mod
    dp = newDP

ans = dp[1]
print(ans)


Measured memory_bytes: 3188
n = int(input())
p = [int(s) - 1 for s in input().split()]

ans = 0
for i in range(n):
    if p[i] != i: continue
    
    j = i - 1 if i + 1 == n else i + 1
    p[i], p[j] = p[j], p[i]
    ans += 1

print(ans)

Measured memory_bytes: 13880
#include<bits/stdc++.h>
#include<unordered_map>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(int i=int(intial);i<n;i++)
#define loopn(j,n) for(int j=int(n);j>=0;j--)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 1e13;
const double EPS = 1e-4;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");

int main()
{
	afify();
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=a;i<=10000000;i+=a){
		if(i%b==c%b){
			cout<<"YES"<<endl;return 0;}
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <map>
#include <vector>

using namespace std;

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

	int N, K;
	cin >> N >> K;

	map<int, int> cnt;

	for (int i = 0; i < N; i++)
	{
		int A;
		cin >> A;

		cnt[A]++;
	}

	if (cnt.size() > K)
	{
		vector<pair<int, int>> cnt_list;
		for (auto e : cnt)
		{
			cnt_list.push_back(make_pair(e.second, e.first));
		}

		sort(cnt_list.begin(), cnt_list.end());

		int result = 0;
		for (int i = 0; i < cnt.size() - K; i++)
		{
			result += cnt_list[i].first;
		}

		cout << result;
	}
	else
	{
		cout << 0;
	}

	return 0;
}


Measured memory_bytes: 11764
#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()





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

  string A;
  vector<string> ans;

  map<string, int> memo;
  
  rep(i, 0, N){
    cin >> A;
    memo[A] += 1; 
  }

  int max = 0;
  for (auto itr = memo.begin(); itr != memo.end(); ++itr){
    if(max < itr->second){
      max = itr->second;
      ans.clear();
      ans.push_back(itr->first);
    }else if(max == itr->second){
      ans.push_back(itr->first);
    }
  }

  rep(i, 0, ans.size()){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 26868
n = int(input())
d_list = [list(map(int,input().split(" "))) for i in range(n)]

cnt = 0
flag = False
for d in d_list:
    if d[0] == d[1]:
        cnt+=1
        if cnt >= 3:
            print("Yes")
            flag = True
            break
    else :
        cnt = 0

if flag==False :    
    print("No")

Measured memory_bytes: 9132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		sc.nextLine();
		String[] img = new String[H];
		char sp = '#';

		for(int h = 0; h < H; h++){
			img[h] = sc.nextLine();
		}
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int w = 0; w < W+2; w++){
			sb.append(sp);
		}
		String sharpLine = sb.toString();
		System.out.println(sharpLine);
		for(int h = 0; h < H; h++){
			System.out.print(sp);
			System.out.print(img[h]);
			System.out.println(sp);
		}
		System.out.println(sharpLine);
	}

}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    int x;
    cin >> x;
    int a[2][4];
    string s = "+-";

    for (int i = 0; i < 4; i++) {
        a[0][3-i] = x%10;
        x /= 10;
    }

    for (int i = 0; i < 4; i++) {
        a[1][i] = -a[0][i];
    }

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                if (a[0][0] + a[i][1] + a[j][2] + a[k][3] == 7) {
                    cout << a[0][0];
                    cout << s[i] << abs(a[i][1]);
                    cout << s[j] << abs(a[j][2]);
                    cout << s[k] << abs(a[k][3]);
                    cout << "=7" << endl;
                    return 0;
                }
            }
        }
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int A,B,K; cin >> A >> B >> K;
	V<int> v;
	for(int i = 100; 1 <= i; --i){
		if(A%i==0&&B%i==0) v.push_back(i);
	}
	cout << v[K-1] << endl;
	return 0;
}


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

int main() {
  
  int n;
  cin >> n;
  
  int t,x,y,p,a,b,dt,dx,dy,hantei;
  
  p = 0;
  a = 0;
  b = 0;
  hantei = 1;
  
  for ( int i = 0; i < n; i++){
    cin >> t >> x >> y;
    dt = t - p;
    dx = abs(x - a);
    dy = abs(y - b);
    if ( dt < dx + dy ){
      hantei = 0;
    }else if ( dt > dx + dy && ( dt - dx - dy ) % 2 != 0 ){
      hantei = 0;
    }
    if ( hantei == 1 ){
      p = t;
      a = x;
      b = y;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;

}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>


using namespace std;
#define MAX 100000

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

    if (0 == N % 2){
        printf("%d", N);
    }
    else{
        printf("%d", N * 2);
    }

    return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000
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; }


int main(){
  ios::sync_with_stdio(false);
  
  int R;
  cin>>R;
  
  cout<<fixed<<setprecision(5)<<2*R*M_PI;
  
}

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

int main(){
  double w,h,x,y;
  cin >> w >> h >> x >> y;
  
  double ans = (w*h)/2;
  
  int num = (2*x==w) && (2*y==h) ? 1 : 0;
  
  printf("%.10f %d\n",ans,num);
}

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

/**
 * Gluttony
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            long K = sc.nextLong();
            sc.nextLine();

            long[] A = new long[N];
            long[] F = new long[N];

            String[] a = sc.nextLine().split(" ");
            for (int i = 0; i < N; i++) {
                A[i] = Long.parseLong(a[i]);
            }
            a = sc.nextLine().split(" ");
            for (int i = 0; i < N; i++) {
                F[i] = Long.parseLong(a[i]);
            }

            long sum = Arrays.stream(A).sum();
            if (sum <= K) {
                System.out.println(0);
                return;
            }

            Arrays.sort(A);
            Arrays.sort(F);

            long min = 0;
            long max = 0;
            for (int i = 0; i < N; i++) {
                max = Math.max(max, A[i] * F[N - 1 - i]);
            }

            while (max - min > 1) {
                long mid = (min + max) / 2;

                long need = 0;
                for (int i = 0; i < N; i++) {
                    need += Math.max(0, A[i] - mid / F[N - 1 - i]);
                }

                if (need > K) {
                    min = mid;
                } else {
                    max = mid;
                }
            }

            System.out.println(max);
        }

    }

}


Measured memory_bytes: 84540
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	int count=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(i>0&&i<s.size()-1)
		count++;
	}
	cout<<s[0]<<count<<s[s.size()-1]<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        new Main().solve(System.in, System.out);
    }

    public void solve(InputStream in, PrintStream out) {
        Scanner sc = new Scanner(in);

        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();

        long ra = Math.max(0, a-k);
        long rb = Math.max(Math.min(b, a + b - k), 0);
        out.println(ra + " " + rb);
    }

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define int long long
using namespace std;

int it[800005];
int itl[800005], itr[800005];
int n, q, fi, se;
void update(int id, int l, int r, int pos, int val)
{
	it[id]=min(it[id], val);
	itl[id]=min(itl[id], val+pos);
	itr[id]=min(itr[id], val-pos);
	if(l==r) return;
	int mid=(l+r)/2;
	if(pos<=mid)
	{
		update(id*2, l, mid, pos, val);
	}
	else
	{
		update(id*2+1, mid+1, r, pos, val);
	}
}

int get(int id, int l, int r, int pos)
{
	if(r<pos)
	{
		return itr[id]+pos;	
	}
	if(l>pos)
	{
		return itl[id]-pos;
	}
	if(l==r)
	{
		return it[id];
	}
	int mid=(l+r)/2;
	return min(get(id*2, l, mid, pos), get(id*2+1, mid+1, r, pos));
}

signed main()
{
	for(int i=1; i<=800000; i++)
	{
		it[i]=1000000000000;
		itl[i]=it[i];
		itr[i]=it[i];
	}
 	cin>>n>>q>>fi>>se;
	update(1, 1, n, fi, 0);
	int ans=0, last=se;
	for(int que=1; que<=q; que++)
	{
	 	int x;
	 	cin>>x;
		int lmao=get(1, 1, n, x)+ans;
		ans+=abs(x-last);
		update(1, 1, n, last, lmao-ans);
		last=x;
	}
	cout<<ans+it[1];
}


Measured memory_bytes: 18944
#include<cstdio>
#include<iostream>
#include<map>
#include<queue>
#include <algorithm>
#include<string>
#include <unordered_map>
using namespace std;

const int N=2e6+5;

int t,n,m;
int a,b,c,d,ans=0;
map<string ,int> mp;
int main(){
    scanf("%d",&t);
    while(t--){
        string s;
        cin>>s;
        if(mp[s]==0){
            mp[s]++;
            ans++;
        }
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 18688
<?php
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));
$a = strlen($s);
$b = array();
$i = 0;
while($i<$a){
  if(!isset($b[$t[$i]])){
    $b += array($t[$i] => $s[$i]);
  }else{
    if($b[$t[$i]] != $s[$i]){
      echo "No";
      exit;
    }
  }
  ++$i;
}
$b = array_count_values($b);
echo (max($b)==1)?"Yes":"No";

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

vector<int> buf;
int sum_gcd;

int gcd(int x,int y){
    if(y > x){
        int tmp = x;
        x = y;
        y = tmp;
    }
    if (y == 0) return x;
    return gcd(y, x%y);
}


void df(int i, const int start, const int end, const int size){
    if(i == size){
        int gcd_num = gcd(buf.at(0), buf.at(1));
        for(int i = 2; i < buf.size(); ++i){
            gcd_num = gcd(buf.at(i), gcd_num);
        }
        sum_gcd += gcd_num;
    }
    else{
        for(int j = start; j <= end; ++j){
            buf[i] = j;
            df(i+1, start, end, size);
        }
    }
}

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

    int size = 3;
    int range_start = 1;
    int range_end = k;

    buf.resize(size);
    df(0, range_start, range_end, size);
    cout << sum_gcd << endl;
}

Measured memory_bytes: 3640
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::cmp::max;
use std::cmp::min;


fn main() {
    input! {
        N: usize,
        K: usize,
    }

    let mut has_candy: Vec<bool> = vec![false; N];

    for _ in 0..K {
        input! {
            d: usize,
            As: [usize; d],
        }

        for &a in As.iter() {
            let a0 = a - 1;
            has_candy[a0] = true;
        }
    }

    let ans = has_candy.iter().filter(|&b| !b).count();
    println!("{}", ans);
}


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

/* Articulation Points (Critical Routers) */
int timer = 0;
void getAP(unordered_map<int,vector<int>*>& adjacencyList, unordered_map<int,int>& d, unordered_map<int,int>& l, unordered_map<int,int>& p, unordered_map<int,bool>& visited, int* ap, int sv){
    visited[sv] = true;
    l[sv] = d[sv] = ++timer;
    int children = 0;
    for(int i=0;i<adjacencyList[sv]->size();i++){
        int n = adjacencyList[sv]->at(i);
        if(visited.count(n)!=0 && p[sv]!=n){
            l[sv] = min(l[sv],d[n]);
        }else if(visited.count(n)==0){
            p[n] = sv;
            children += 1;
            getAP(adjacencyList, d, l, p, visited, ap, n);
            l[sv] = min(l[sv],l[n]);
            if(p[sv]!=-1 && d[sv] <= l[n]){
                ap[sv]=1;
            }
        }
    }
    if(p[sv]==-1 && children>1){
        ap[sv] = 1;
    }
}

void getAP(unordered_map<int,vector<int>*>& adjacencyList){
    int n = adjacencyList.size();
    unordered_map<int,int> discoveryTime;
    unordered_map<int,int> lowestTime;
    unordered_map<int,int> parent;
    int* ap = new int[n];
    unordered_map<int,bool> visited;
    timer = 0;
    for(int i=0;i<n;i++){
        ap[i] = 0;
    }
    parent[0] = -1;
    getAP(adjacencyList,discoveryTime,lowestTime,parent,visited,ap,0);
    for(int i=0;i<n;i++){
        if(ap[i]==1){
            cout << i << endl;
        }
    } 
}

int main() {
    int n, e;
    cin >> n >> e;
    unordered_map<int,vector<int>*> adjacencyList;
    for(int i=0;i<n;i++){
        vector<int>* v = new vector<int>;
        adjacencyList[i] = v;
    }
    for(int i=0;i<e;i++){
        int x,y;
        cin >> x >> y;
        adjacencyList[x]->push_back(y);
        adjacencyList[y]->push_back(x);
    }
    getAP(adjacencyList);
}


Measured memory_bytes: 7112
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final long MOD =  1000000007L;
	public static void main(String[] args) {
		int i,j,k,l;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		sc.close();
		for (i = 0; i < s.length; i++) {
			if(s[i]=='A')break;
		}
		int sta=i;
		for (i = s.length-1; i >= 0; i--) {
			if(s[i]=='Z')break;
		}
		int end=i;
		out.println(end-sta+1);
	}
}


Measured memory_bytes: 27960
from math import cos, pi
def calcAngle(h,m): 
        
          
        if (h == 12): 
            h = 0
        if (m == 60): 
            m = 0

        hour_angle = 0.5 * (h * 60 + m) 
        minute_angle = 6 * m 
          
        angle = abs(hour_angle - minute_angle) 
          
        angle = min(360 - angle, angle) 
          
        return angle 


a,b,h,m = [int(x) for x in input().strip().split()]

theta = calcAngle(h,m)*(pi/180)
# print(theta, cos(theta))
d = abs(a**2+b**2-2*a*b*cos(theta))
d = pow(d,1/2)
print(d)

Measured memory_bytes: 62548
#include <iostream>
using namespace std;
 
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a>=b&&b>=c){
		cout<<10*a+b+c<<endl;
	}
	else if(a>=c&&c>=b){
		cout<<10*a+b+c<<endl;
	}
	else if(b>=c&&c>=a){
		cout<<10*b+a+c<<endl;
	}
	else if(b>=a&&a>=c){
		cout<<10*b+a+c<<endl;
	}
	else if(c>=a&&a>=b){
		cout<<10*c+b+a<<endl;
	}
	else if(c>=b&&b>=a){
		cout<<10*c+b+a<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <stack>
#include <functional>
#include <ctime>
#include <queue>
#include <string>
#include <map>
#include <utility>
#include <sstream>
#include <cmath>
#define MAX_U   10
#define MIN_U   0
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define form(i,a,b) for(int i=(a);i<(b);i++)
#define sz(x) ((int)(x).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
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();}
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<char> vc;
typedef vector<string> vs;
typedef queue<int> qi;
const int INF=numeric_limits<int>::infinity();
void printa(){cout<<"\n";}
template<class T, class... A>void printa(const T&first,const A&... rest){cout<<first;printa(rest...);}
template<class... A>void printa(const A&... rest){printa(rest...);}
void prints(){cout<<" ";}
template<class T, class... A>void prints(const T&first,const A&... rest){cout<<first;prints(rest...);}
template<class... A>void prints(const A&... rest){prints(rest...);}
int factorial(int x){int f=1;for(int i=1;i<x+1;i++)f=f*i;return f;}
int sigma(int x){int s;for(int i=1;i<x+1;i++)s=s+i;return s;}
int middle(int x){if(x%2==0)return x/2;else return x/2+1;}
double heron(int a,int b,int c){double s;s=(a+b+c)/2;return sqrt(s*(s-a)*(s-b)*(s-c));}
double trapezium(int a,int b,int h){return (a+b)*h/2;}
double triangle(int a,int h){return a*h/2;}
void sorm(vector<int> vec){sort(vec.begin(),vec.end());}
void sorg(vector<int> vec){sort(vec.begin(),vec.end(),greater<int>());}
int cmp( const void *p, const void *q ) {if( *(double*)p > *(double*)q ) return 1;if( *(double*)p < *(double*)q ) return -1;return 0;}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    //vi ad,bd,cd,dd;
    //vs as,bs,cs,ds;
    cin>>a>>b;
    if(a-b>=0)printa(a-b);
    else printa("0");
    return 0;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 

int main(void) {
	ll r,g; cin >>r>>g;

	cout <<g*2-r <<endl;

	
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int N, K;
  //vector<int> A = vector<int>(200001, 0);
  vector<int> A;

  cin >> N >> K;

#if 1
  for (int i = 0; i <= N; i++)
    A.push_back(0);
#else
  A.resize(N + 1);
#endif

  for (int i = 0; i < N; i++)
  {
    int temp;
    cin >> temp;
    A[temp]++;
  }

  int numVal = 0;
  for (int i = 0; i <= N; i++)
  {
    if (A[i]) numVal++;
    else A[i] = 200100;
  }
  
  int modifyCount = 0;

  if (numVal > K)
  {
    sort(A.begin(), A.end()); //sortする
    for (int n = 0; n < numVal - K; n++)
    {
      modifyCount += A[n];
    }
  }

  cout << modifyCount << endl;

}


Measured memory_bytes: 1400
/**
 *      ABC 83 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-02 04:57:00
**/

#include <bits/stdc++.h>
using namespace std;

int sum(int N){
    int x = 0;
    x += N / 10000; N = N % 10000;
    x += N / 1000; N = N % 1000;
    x += N / 100; N = N % 100;
    x += N / 10; N = N % 10;
    x += N;

    return x;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, A, B; cin >> N >> A >> B;

    //int x = sum(N);
    int answer = 0;
    for (int i = 1; i < N + 1; ++i) {
        int x = sum(i);
        if (x >= A && x <= B){
            answer += i;
        }
        
    }
    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
    long N, A, B;
    long cnt;
    cin >> N >> A >> B;

    cnt = N / (A + B) * A;
    if(N % (A + B) > A)
    {
        cnt += A;
    }
    else
    {
        cnt += N % (A + B);
    }
    
    
    cout << cnt << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main(void)
{
	int n, q;
	string s;
	cin >> n >> s >> q;

	set<int> st[26];
	for (int i = 0; i < n; i++) {
		st[s[i] - 'a'].insert(i + 1);
	}

	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (t == 1) {
			int p;
			char c;
			cin >> p >> c;

			st[s[p - 1] - 'a'].erase(p);
			s[p - 1] = c;
			st[c - 'a'].insert(p);
		} else {
			int l, r;
			cin >> l >> r;

			int ans = 0;
			for (int i = 0; i < 26; i++) {
				auto it = st[i].lower_bound(l);
				if (it != st[i].end() && *it <= r) {
					ans++;
				}
			}
			printf("%d\n", ans);
		}
	}

	return 0;
}

Measured memory_bytes: 27184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e2 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll n, W, w[MAX_N], v[MAX_N], dp[MAX_N][100005];

int main() {
    cin >> n >> W;
    REP(i,n) cin >> w[i] >> v[i];
    REP(i,n){
        REP(j,W+1){
            dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
            if(j>=w[i]) dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 79488
using System;

namespace CodeFestival2016qualC
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int indexOfC = s.IndexOf('C');
            int indexOfF = s.LastIndexOf('F');

            if (indexOfC == -1 || indexOfF == -1)
            {
                Console.WriteLine("No");
            }
            else
            {
                if (indexOfC < indexOfF)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }
    }
}


Measured memory_bytes: 2648
#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define REP(i,k,n) for(ll i=k;i<n;++i)
//const ll MOD=1e9+7;

int main() {
    ll n;
    std::cin >> n;
    std::unordered_map<ll,ll> m;
    
    ll ans=0;
    rep(i,n){
        ll x;
        std::cin >> x;
        ans+=m[i-x];
        m[i+x]++;
    }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 18384
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: i32 = iter.next().unwrap().parse().unwrap();
    let m: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();
    let b: Vec<i32> = (0..m)
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();
    let mut ans = 0;
    for _ in 0..n {
        let a: Vec<i32> = (0..m)
            .map(|_| iter.next().unwrap().parse().unwrap())
            .collect();
        let s: i32 = a.iter().zip(b.iter()).map(|(p, q)| p * q).sum();
        if s + c > 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b,c;cin>>a>>b>>c;
    queue<char> aq, bq, cq;
    for(auto t : a){
        aq.push(t);
    }
    for(auto t : b) bq.push(t);
    for(auto t : c) cq.push(t);
    char t = aq.front(); aq.pop();
    char ans;
    while(1){
        if(t=='a') {
            if(aq.empty()){
                ans = 'A';
                break;
            }
            t = aq.front(); aq.pop();
        }
        else if(t=='b'){
            if(bq.empty()){
                ans = 'B';
                break;
            }
            t=bq.front(); bq.pop();
        }
        else if(t=='c'){
            if(cq.empty()){
                ans = 'C';
                break;
            }
            t=cq.front(); cq.pop();
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<int> v(N);
	REP(i, N) cin >> v[i];

	sort(ALL(v));

	if(accumulate(ALL(v), 0) - 2 * v[N - 1] > 0)
		cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
XY = [list(map(int,input().split())) for _ in range(M)]

C = [1 for _ in range(N)]
R = [1] + [0 for _ in range(N-1)]
for x,y in XY:
  x -= 1
  y -= 1
  if R[x] == 1:
    R[y] = 1
    if C[x] == 1:
      R[x] = 0
  C[x] -= 1
  C[y] += 1
  
print(sum(R))


Measured memory_bytes: 72280