akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const int inf = 1e9;
int main(){
    int h,w; cin >> h >> w;
    vector<vector<int>> c(10, vector<int>(10));
    vector<vector<int>> a(h, vector<int>(w));
    rep(i,10){
        rep(j,10){
            cin >> c[i][j];
        }
    }
    
    rep(k,10){
        rep(i,10){
            rep(j,10){
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    
    int ans = 0;
    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
            if(a[i][j] == -1) continue;
            ans += c[a[i][j]][1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
from collections import deque

h, w = map(int, input().split())

s = []
cnt = 0
for _ in range(h):
    tmp = list(input())
    cnt += tmp.count("#")
    s.append(tmp)

pos = [0, 0]
ans = 1
direction = [[0, 1], [0, -1], [1, 0], [-1, 0]]
queue = deque()
queue.append(pos)
queue.append(ans)
check = [[False for _ in range(w)] for _ in range(h)]
check[0][0] = True
while queue:
    pos = queue.popleft()
    ans = queue.popleft()
    ans += 1
    for dy, dx in direction:
        y = pos[0] + dy
        x = pos[1] + dx
        if x == -1 or x == w or y == -1 or y == h:
            continue
        if check[y][x]:
            continue
        if s[y][x] == "#":
            check[y][x] = True
            continue
        if y == h - 1 and x == w - 1:
            print(h * w - cnt - ans)
            exit()
        check[y][x] = True
        queue.append([y, x])
        queue.append(ans)
    
else:
    print(-1)
    exit()


Measured memory_bytes: 3316
import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			Dice d = new Dice(br.readLine());
			d.sim(br.readLine());
			System.out.println(d.getTop());
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
}
class Dice{
	private int top;
	private int forth;
	private int right;
	private int left;
	private int back;
	private int bottom;
	Dice(String label){
		String lab[] = label.split(" ", 0);
		top    = Integer.parseInt(lab[0]);
		forth  = Integer.parseInt(lab[1]);
		right  = Integer.parseInt(lab[2]);
		left   = Integer.parseInt(lab[3]);
		back   = Integer.parseInt(lab[4]);
		bottom = Integer.parseInt(lab[5]);
	}
	public void sim(String order){
		int work;
		for(int i=0; i<order.length(); i++){
			switch(order.charAt(i)){
			case 'N':
				work   = top;
				top    = forth;
				forth  = bottom;
				bottom = back;
				back   = work;
				break;
			case 'E':
				work   = top;
				top    = left;
				left   = bottom;
				bottom = right;
				right  = work;
				break;
			case 'W':
				work   = top;
				top    = right;
				right  = bottom;
				bottom = left;
				left   = work;
				break;
			case 'S':
				work   = top;
				top    = back;
				back   = bottom;
				bottom = forth;
				forth  = work;
				break;
			}
		}
	}
	public int getTop(){
		return top;
	}
}

Measured memory_bytes: 17064
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void diverta2019_a(vector<vector<int>> v) {

    int n = v[0][0];
    int k = v[0][1];

    cout << n-k+1<<endl;

}

int main() {

    //    vector<vector < string>> vec_arr_result;
    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    diverta2019_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll calc(int x, int y) {
    if (y == 0 || x == 0)
        return 0;
    int r = x / y + (x % y > 0);
    return r;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int idx = 0;
    for (int i = 0; i < n; i++) {
        int in;
        cin >> in;
        if (in == 1)
            idx = i;
    }
    ll res = 1e18;
    for (int i = 0; i < n; i++) {
        int l = i, r = min(n - 1, i + k - 1);
        if (idx < l || idx > r)
            continue;
        int cl = l, cr = n - r - 1;
        res = min(res, calc(cl, k - 1) + calc(cr, k - 1));
    }
    cout << ++res;
    return 0;
}

Measured memory_bytes: 256
use std::thread;

/// ローカル環境なら _in.txt から入力を受ける
fn read_input() -> String {
    use std::fs::File;
    use std::io::Read;
    let mut s = String::new();
    match option_env!("LOCAL") {
        Some(_) => File::open("src/_in.txt")
            .expect("File not found")
            .read_to_string(&mut s)
            .unwrap(),
        None => std::io::stdin().read_to_string(&mut s).unwrap(),
    };
    s
}

static mut MEMO: [i32; 100010] = [-1; 100010];

unsafe fn solve(n: i32) -> i32 {
    if n <= 0 {
        return 0;
    }
    if MEMO[n as usize] >= 0 {
        return MEMO[n as usize];
    }

    let mut ret = vec![];

    ret.push(solve(n - 1) + 1);
    let mut d = 9;
    while n - d >= 0 {
        ret.push(solve(n - d) + 1);
        d *= 9
    }
    let mut d = 6;
    while n - d >= 0 {
        ret.push(solve(n - d) + 1);
        d *= 6
    }

    MEMO[n as usize] = *ret.iter().min().unwrap();
    MEMO[n as usize]
}

fn main() {
    thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let s = read_input();
            let mut ws = s.split_whitespace();
            let in_n: i32 = ws.next().unwrap().parse().unwrap();
            let ans = unsafe { solve(in_n) };
            println!("{:?}", ans);
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 17148
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
if a % 2 != 0 and b % 2 != 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <deque>
#include <bitset>

using namespace std;
#define rep(i,n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

bool ok(deque<int> v,ll x){
	bitset<32000> cur;
	cur[16000] = 1;
	for(int i = 0 ; i < v.size() ; i++){
		cur = (cur << v[i]) | (cur >> v[i]);
	}
	return cur[16000 + x];
}
void solve(string s, ll x, ll y){
	s += "T";
	deque<int> v[2];
	int c = 0;
	int t = 0;
	for(int i = 0 ; i < s.size() ; i++){
		if( s[i] == 'T' ) v[t].push_back(c), c = 0, t ^= 1;
		else if( s[i] == 'F' ) c++;
	}
	x -= v[0][0];
	v[0].pop_front();

	cout << (ok(v[0], x) && ok(v[1], y) ? "Yes" : "No") << endl;
}

int main(){	
	ll y;
	string s;
	ll x;
	cin >> s;
	scanf("%lld",&x);
	scanf("%lld",&y);
	solve(s, x, y);
	return 0;
}



Measured memory_bytes: 888
# ABC 49 C

def resolve():
    s = input()
    while (len(s) != 0):
        if s.rfind('eraser') == len(s) - len('eraser') and len(s) - len('eraser') >= 0:
            s = s[:len(s) - len('eraser')]
        elif s.rfind('erase') == len(s) - len('erase') and len(s) - len('erase') >= 0:
            s = s[:len(s) - len('erase')]
        elif s.rfind('dreamer') == len(s) - len('dreamer') and len(s) - len('dreamer') >= 0:
            s = s[:len(s) - len('dreamer')]
        elif s.rfind('dream') == len(s) - len('dream') and len(s) - len('dream') >= 0:
            s = s[:len(s) - len('dream')]
        else:
            print('NO')
            return

    if len(s) == 0:
        print('YES')
    else:
        print("NO")


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
	
	int A;
	int B;
	int C;
	scanf("%d %d %d",&A,&B,&C);
	if(A==B && B==C ||A!=B && B!=C && A!=C)
	{
		printf("No");
	}
	else
	{
		printf("Yes");
	}
	
	return 0;	
}

Measured memory_bytes: 1672
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

#if 1

// MODの素数以外でも使えるバージョン。階乗の逆元を求める。
ll extgcd(ll a, ll b, ll& x, ll& y)
{
	ll d = a;
	if (b != 0)
	{
		d = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	else
	{
		x = 1;
		y = 0;
	}
	return d;
}

// 逆元を求める
ll mod_inverse(ll a, ll m)
{
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x%m) % m;
}

enum { NUM_FACTORIAL = 100005 };
ll f[NUM_FACTORIAL];
ll f_inv[NUM_FACTORIAL];
ll MOD = (ll)1e9 + 7LL;

void mod_factorial_init()
{
	f[0] = 1;
	for (int i = 1; i < NUM_FACTORIAL; ++i)
	{
		f[i] = f[i - 1] * i;
		f[i] %= MOD;
	}

	for (int i = 0; i < NUM_FACTORIAL; ++i)
	{
		f_inv[i] = mod_inverse(f[i], MOD);
	}
}

ll factorial_comb(int n,int r)
{
	if (r > n)
	{
		return 0;
	}

	ll ret = f[n];
	ret *= f_inv[r];
	ret %= MOD;
	ret *= f_inv[n-r];
	ret %= MOD;
	return ret;
}


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

	vector <int> place(N+1, NG);

	int haji = 0;
	for (int i = 0; i < N+1; ++i)
	{
		int tmp;
		cin >> tmp;
		if (place[tmp] == NG)
		{
			place[tmp] = i;
		}
		else
		{
			int st = i;
			int ed = place[tmp];
			if(st>ed) swap(st,ed);

			haji = st + (N-ed);
		}
	}

	for(int k=1;k<=N+1;k++)
	{
		ll a = factorial_comb(N+1, k);
		ll b = factorial_comb(haji, k-1);
		ll ans = a - b;

		ans = ((ans%MOD)+MOD) % MOD;
		printf("%lld\n",ans);
	}

	return 0;
}


#else

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



	vector <int> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
//		a[i] = i;
	}

	vector <int> b;
	for (int i = N-1; i >= 0; i-=2)
	{
		b.push_back(a[i]);
	}

	for (int i = N%2; i < N; i += 2)
	{
		b.push_back(a[i]);
	}

	for (int i = 0; i < N; ++i)
	{
		printf("%d ",b[i]);
	}
	printf("\n");

	return 0;
}

#endif

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

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

  ll N; cin >> N;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];

  string ans = "APPROVED";
  for (ll i = 0; i < N; i++) {
    if (A[i] % 2 == 0) {
      if (A[i] % 3 != 0 && A[i] % 5 != 0) {
        ans = "DENIED";
      }
    }
  }
  cout << ans << '\n';
  return 0;
}

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

#define MAX_N 50
#define MAX_M 101
#define MAX_S 5000

long long x[MAX_N][MAX_M][MAX_S + 1], y[MAX_N][MAX_S + 1];
int main() {
	x[0][0][0] = 1; x[1][0][0] = 1;
	for (int i = 1; i < MAX_N; i++) {
		for (int j = 0; j < MAX_M; j++) {
			for (int k = 0; k <= MAX_S; k++) {
				if (x[i - 1][j][k] >= 1) {
					for (int l = j + 1; l < MAX_M; l++) {
						if (k + l > MAX_S) { goto E; }
						x[i][l][k + l] += x[i - 1][j][k];
					}
				E:;
				}
			}
		}
	}
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_M; j++) {
			for (int k = 0; k <= MAX_S; k++) {
				y[i][k] += x[i][j][k];
			}
		}
	}
	int a, b;
	while (true) {
		cin >> a >> b;
		if (!a && !b) { break; }
		cout << y[a][b] << endl;
	}
}

Measured memory_bytes: 42148
#include<stdio.h>

int n,A[50];

int solve (int i,int m){
    if(m==0) return 1;
    if(i>=n) return 0;
    int res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(){
    int q,M,i;
    
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    
    return 0;
}


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

class Main {
	static Scanner sc=new Scanner (System.in);
	static int n;
	static Main app=new Main();
	int array[];
	int temp[];
	static int count;


	void doing(){
		for(int i=1;i<app.array.length;i++){
			//System.err.println(count);
			int temp=0;
			if(app.array[i-1]>app.array[i]){
				temp=app.array[i];
				app.array[i]=app.array[i-1];
				app.array[i-1]=temp;
				count++;
			}
		}
	}

	public static boolean judge(){
		boolean judge=true;
		for(int i=0;i<app.array.length;i++){
			/*System.err.print(judge);
			System.err.print(app.array.length);
			*/
			if(app.array[i]!=app.temp[i]){
				judge=false;
			}
		}
		if(judge){
			return true;
		}
		return false;
	}




	public static void main(String[] args) {
		while(true){
			n=sc.nextInt();
			app.array=new int[n];
			app.temp=new int [n];
			count=0;
			
			if(n==0)break;
			//System.err.println("------");
			for(int i=0;i<n;i++){
				app.array[i]=sc.nextInt();
				app.temp[i]=app.array[i];
				//System.out.print(app.array[i]);
			}
			//System.err.println("------");
			Arrays.sort(app.temp);
			while(!judge()){
				app.doing();
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 20916
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n,k,ans=0;
cin>>n>>k;

while(n--)
{
	int x;
	cin>>x;
	if(x>=k)ans++;
}
ol(ans);

return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt(), a[] = in.readIntArray(n), max = a[0];
            long ans = 0;
            for (int i = 1; i < n; ++i) {
                if (a[i] < max) ans += max - a[i];
                else max = a[i];
            }
            out.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] array = new int[(int) size];
            for (int i = 0; i < size; i++) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 34368
#include <stdio.h>
#define NUMBER 10


int main()
{
	char in[NUMBER];
	int i, temp, len = 0;
	scanf("%s", in);
	
	

	for (i = 0; in[i] != '\0'; ++i)
	{
		if (in[i] == 'A' || in[i] == 'T' || in[i] == 'C' || in[i] == 'G') {
			len++;
			if (len > temp) temp = len;

		}
		else if (len != 0)
		len = 0;

		
		
	}


	printf("%d", temp);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h> 

 
 int main(){ 
     int x, y; 
     while(1){ 
         scanf("%d %d", &x, &y); 
         if(x==0 && y==0)break; 
         if(x<y){ 
             printf("%d %d\n", x, y); 
         }else{ 
             printf("%d %d\n", y, x); 
         } 
     } 
     return 0; 
 } 

Measured memory_bytes: 1028
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x[9];

    for (int j = 0; j < 9; j++) {
      scanf("%x", &x[j]);
      int t = 0;
    }
    
    int ans = 0;
    int c = 0;
    for (int j = 0; j <= 32; j++) {
      int sum = 0;
      for (int k = 0; k < 8; k++) {
        sum += (x[k]^ans);
      }
      if (((sum>>j)&1) != (((x[8]^ans)>>j)&1) ) {
        ans += (1<<j);
      }
    }

    int sum = 0;
    printf("%x\n", ans);
  }
}

Measured memory_bytes: 3228
import java.util.*;
public class Main{
    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);


	while(sc.hasNext()){
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    int x = a*b;
	    
	    if(x%2 == 0){
		System.out.println("Even");
	    }else{
		System.out.println("Odd");
	    }
	}
    }
}


Measured memory_bytes: 21332
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

def f(x):
	return (A*x)//B - A*(x//B)

print(f(min(N, B-1)))

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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define ALLn(s)			s,s+n
#define pii					pair<int, int>
#define pll					pair<ll, ll>
#define si					set<int>
#define mp					make_pair
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL);

template <typename Iter>
size_t index_of(Iter first, Iter last, int x)
{
    size_t i = 0;
    while (first != last && *first != x) ++first, ++i;
    return i;
}

const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N = 1e6 + 7;


void solve() {
	ll n,k;
	cin >> n >> k;

	ll ans = n%k;
	ans = min(ans, k -ans);

	cout << ans << "\n";
}

int main() {_
	
		solve();
	

}


Measured memory_bytes: 256
main=do
 s<-getLine
 getLine
 q<-lines<$>getContents
 let (t,l,r)=f q 0 s""
 let ans=if t==0 then l++(reverse r) else r++(reverse l)
 putStrLn ans
f[]t l r=(t,l,r)
f(q:qs)t l r
 |q=="1"=f qs(1-t)l r
 |(q!!2=='1')/=(t==1)=f qs t(q!!4:l)r
 |otherwise=f qs t l(q!!4:r)


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

using ll = long long;
using namespace std;

int main () {
    long a = 0;
    long K;
    cin >> K;
    if (K % 7 == 0)
        K /= 7;
    if (K % 2 == 0 || K % 5 == 0){cout << -1; exit(0);}
    long n = 1;
    long r = 1 % K;
    while (r != 0){
        r = (10*r+1) % K;
        n += 1;
    }
    cout << n;
    return 0;
}

Measured memory_bytes: 3564
#include <iostream>
    #include <cstdio>
    #include <algorithm>
    using namespace std;
    struct num
    {
        int x;
        int sum;
    };
    num nums[100000+10];
    bool cmp(const num& a,const num& b)
    {
        if(a.x!=b.x)
        return a.x<b.x;
        else
        return a.sum>b.sum;
    }
    int main()
    {
        unsigned long long int n,k;
        cin>>n>>k;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&nums[i].x,&nums[i].sum);
        }
        sort(nums,nums+n,cmp);
        unsigned long long int  add=0;
        unsigned long long int  res=0;
        for(int i=0;i<n;i++)
        {
            res+=nums[i].sum;
            if(res>=k)
            {
                cout<<nums[i].x<<endl;;
                break;
            }
            else
            add=res;
        }
        return 0;
    }

Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int K = Integer.parseInt(S[1]);
    int[] num = new int[N];
    Set<Integer> set = new HashSet<>();
    String[] T = sc.nextLine().split(" "); 
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(T[i]);
      num[n-1]++;
      set.add(n);
    }
   
    if(set.size() <= K){
      System.out.println(0);
      return;
    }
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(num[i]);
    }
    
    Collections.sort(list, Collections.reverseOrder());
    int ans = 0;
    int sum = 0;
    for(int i = 0; i < K; i++){
      sum += list.get(i);
    }
    ans = N - sum;
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 60744
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const mod = int(1e+9) + 7

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	H, W := sc.nextInt(), sc.nextInt()
	G := make([][]rune, H)
	for i := 0; i < H; i++ {
		G[i] = sc.nextRuneSlice()
	}
	dp := make([][]int, H)
	for i := 0; i < H; i++ {
		dp[i] = make([]int, W)
	}
	dp[0][0] = 1
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if G[i][j] == '#' {
				continue
			}
			if i-1 >= 0 {
				dp[i][j] += dp[i-1][j]
				dp[i][j] %= mod
			}
			if j-1 >= 0 {
				dp[i][j] += dp[i][j-1]
				dp[i][j] %= mod
			}
		}
	}

	fmt.Fprintln(wtr, dp[H-1][W-1])
	wtr.Flush()
}


Measured memory_bytes: 13184
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
    int n, l;
    scanf("%d%d", &n, &l);
    int s = n * l + n * (n - 1) / 2;
    if (l <= 0 && n + l - 1 >= 0) printf("%d\n", s);
    else printf("%d\n", abs(l) > abs(n + l - 1) ? s - (n + l - 1) : s - l);
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(n, m);
    string st;
    cin >> st;
    
    vector<pair<char, int>> data(m);
    rep(i, m) {
        string a;
        cin >> a;
        data[i].fir = a[0];
        string b;
        cin >> b;
        if (b == "R") {
            data[i].sec = 0;
        } else {
            data[i].sec = 1;
        }
    }

    reverse(all(data));

    int p0 = -1, pn = n;
    rep(i, data.size()) {
        if (data[i].sec) {
            if (in(p0 + 1, 0, n) && st[p0+1] == data[i].fir) {
                p0++;
            }
            if (in(pn, 0, n) && st[pn] == data[i].fir) {
                pn++;
            }
        } else {
            if (in(p0, 0, n) && st[p0] == data[i].fir) {
                p0--;
            }
            if (in(pn - 1, 0, n) && st[pn-1] == data[i].fir) {
                pn--;
            }
        }
    }

    std::cout << pn - p0 - 1 << std::endl;

    return 0;
}

Measured memory_bytes: 3732
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
        int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
        
        int xa = Math.abs(x - a);
        int xb = Math.abs(x - b);

		// 出力
		System.out.println(xa > xb ? "B" : "A");
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
long int pow107 = (int)pow(10, 9) + 7;

bool comp(pair<int, string> a, pair<int, string> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % pow107;
    }
    return f;
}

bool pn(long int x){
    if(x != 2 && x % 2 == 0)
        return false;
    for(int i = 3; i < x; ++i){
        if(x != i && x % i == 0)
            return false;
    }
    return true;
}

long int factorial(long int n){
    long int f = 1;
    for(long int i = 1; i <= n; ++i){
        f = f * i % pow107;
    }
    return f;
}


int main(){
    long int x,min = 0;
    cin >> x;
    for(int i = 1; i <= x; ++i){
        min += i;
        if(min >= x){
            cout << i << endl;
            break;
        }

    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
    string S;cin >> S;

    S[0] = '2';
    S[1] = '0';
    S[2] = '1';
    S[3] = '8';

    for (auto& s:S){
        cout << s;
    }

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Here your code !

while 1:
    x=int(input())
    if x==0:
        break
    y=0
    for i in range(2,50):
        if x/i - i/2<0.1:
            break
        if i%2==0:
            if x/i-x//i==0.5:
                y+=1
        else:
            if x%i==0:
                y+=1
    print(y)

Measured memory_bytes: 7588
#include<queue>
#include<cstdio>
inline int in();
inline void wr(int);
const int N=(int)1e5+5;
int ju[N][N/100],_in[N],sum[N];
inline int mx(int,int);
int main(int argc,char**argv){
	register int n=in(),m=in();
	for(register int i=1;i<=m;++i){
		register int u=in(),v=in();
		ju[u][++ju[u][0]]=v,++_in[v];
	}
	std::queue<int>queue;
	for(register int i=1;i<=n;++i)
		if(!_in[i])queue.push(i);
	while(!queue.empty()){
		register int u=queue.front();
		queue.pop();
		for(register int i=1;i<=ju[u][0];++i){
			if(sum[ju[u][i]]<sum[u]+1)
				sum[ju[u][i]]=sum[u]+1;
			if(!--_in[ju[u][i]])queue.push(ju[u][i]);
		}
	}
	register int ans=0;
	for(register int i=1;i<=n;++i)
		ans=mx(ans,sum[i]);
	wr(ans);
}
inline int mx(int x,int y){
	return x>y?x:y;
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}

Measured memory_bytes: 391680
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll; 

ll inf =1e9+7;

#define pi 3.14159265358979323846L
bool isprime(ll a)
{
	
	ll cnt=0;	
	for(ll i=1;i*i<a;i++)
	{
		
	 	if(a%i==0)
	 	{
	 		cnt+=2;
		 }
		
		
	}
	
		if(cnt==2)
		return true;
		else
		return false;
		
}
ll mod(ll a)
{
	if(a<inf)return a;
	else
	return a%inf;
}
void solve()
{

ll n,k;
cin>>n>>k;
ll d;
ll snuke[n]={0};
for(ll i=0;i<k;i++)
{
	cin>>d;
	for(ll i=0,a;i<d;i++)
	{
		cin>>a;
		snuke[a-1]+=i+1;
	}
}

ll cnt=0;
for(ll i=0;i<n;i++)
{
	if(snuke[i]==0)cnt++;
}

cout<<cnt;


}

int main()
{


ios::sync_with_stdio(0); 
	cin.tie(0);

		solve();
	
return 0;

		
	}
	
	
	


Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;

typedef long long ll;
const int N = 1e5;

bool cmp(const int& a, const int& b)
{
    return a > b;
}

int main()
{
    //ifstream cin("input.txt");

    int n, H;
    cin >> n >> H;
    int a, b[N], mx = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a >> b[i];
        if (a > mx)
            mx = a;
    }
    sort(b, b + n, cmp);

    int i = 0;
    ll sum = 0;
    while (sum < H && i < n && b[i] > mx)
    {
        sum += b[i];
        ++i;
    }
    H -= sum;
    int ans = i;
    if (H > 0)
        ans += (H + mx - 1) / mx;
    cout << ans;
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

bool comp(const pair<string,int> a, const pair<string,int> b) {
  if (a.first != b.first)
    return a.first < b.first; // 高い順に並べたいので演算子を逆に
  else{
      return a.second > b.second;
  }
}

int Dx[6] = { 0, 0, 1, 1,-1,-1};
int Dy[6] = { 1,-1, 1, 0, 0,-1};

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;
int main(){

   int N,K;

   cin >>N>>K;

   if(K ==1 ){
     cout <<0<<endl;
     return 0;

   }
   cout <<N-K<<endl;
    return 0;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dob double
int main(){
	string arr[14] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string a;
	cin>>a;
	int ans = 0;
	bool ok = false;
	for (int i = 0; i<14; i++){
		if (ok){
			ans++;
		}
		if (ok && arr[i] == "SUN"){
			break;
		}
		if (arr[i] == a){
			ok = true;
		}
	}
	cout<<ans;
	return 0;
}


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

using namespace std;

int main()
{
	int n, m, count = 0;
	scanf("%d", &n);
	
	vector<int> v;
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &m);
		v.push_back(m);
	}
	
	for(int i = 0; i < v.size()-1; i++)
		for(int j = v.size()-1; j > i; j--)
		{
			if(v[j] < v[j-1])
			{
				swap(v[j], v[j-1]);
				count++;
			}
		}
    
 	int i;
 	
	for(i = 0; i < v.size()-1; i++)
		printf("%d ", v[i]);
	printf("%d\n%d\n", v[i], count);
	
	return 0;
}


Measured memory_bytes: 3256
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''

list1=[]
for i in reversed(range(count+1)) :
  c=current//26**i
  current = current % 26 ** i
  list1.append(c)

for i in range(1,count+1) :
  if list1[-i]<=0 :
    list1[-i]+=26
    list1[-i-1]-=1

for  i in range(count+1) :
  mozi+=chr(list1[i]+k)
print(mozi)

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    ll n; cin >> n;
    ll x = n * 800;
    ll y = 200 * (n/15);
    cout << x-y;
}

Measured memory_bytes: 3480
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var flag = 0;

            for(var c = 1; c <= 3; c++)
            {
                if((str[0] * str[1] * c) % 2 != 0)
                {
                    flag = 1;
                }
            }

            if(flag == 1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

def main():
  n, m = map(int, input().split())
  G = [[] for _ in range(n)]
  for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
  seen = [False]*n
  def dfs(v, rep):
    seen[v] = True
    for nv in G[v]:
      if seen[nv]:
        continue
      rep.append(nv+1)
      dfs(nv, rep)
      break
    else:
      return rep
  L1, L2 = [], []
  dfs(0, L1)
  dfs(0, L2)
  ANS = L2[::-1] + [1] + L1
  print(len(ANS))
  print(*ANS)
if __name__ == "__main__":
  main()

Measured memory_bytes: 126448
// Aizu Vol-3 0347: Maximization of Relational Expression
// 2017.8.27 bal4u@uu

#include <stdio.h>

#define MAX 1000
#define abs(a) ((a)>=0?(a):-(a))
typedef struct { int i, j, v; } T;
T max[MAX+3], min[MAX+3]; int nmax, nmin;
int a[MAX+3], N;

void first_nmax(int v, int i, int j)
{
	int ii, jj;

	for (ii = 0; ii < nmax; ii++) {
		if (v <= max[ii].v) continue;
		for (jj = nmax-1; jj >= ii; jj--) max[jj+1] = max[jj];
		if (nmax < N) nmax++;
		max[ii].i = i, max[ii].j = j, max[ii].v = v;
		return;
	}
	if (ii == nmax && nmax < N)	max[ii].i = i, max[ii].j = j, max[ii].v = v, nmax++;
}

void first_nmin(int v, int i, int j)
{
	int ii, jj;

	for (ii = 0; ii < nmin; ii++) {
		if (v >= min[ii].v) continue;
		for (jj = nmin-1; jj >= ii; jj--) min[jj+1] = min[jj];
		if (nmin < N) nmin++;
		min[ii].i = i, min[ii].j = j, min[ii].v = v;
		return;
	}
	if (ii == nmin && nmin < N)	min[ii].i = i, min[ii].j = j, min[ii].v = v, nmin++;
}

int main()
{
    int i, j;
    double x, y;

	//memset(max, 0, sizeof(max)), memset(min, 0, sizeof(min));
    scanf("%d", &N);
    for (i = 0; i < N; i++) scanf("%d", a + i);
	max[0].i = min[0].i, max[0].j = min[0].j = 1,
    max[0].v = a[0] + a[1], min[0].v = abs(a[0] - a[1]), nmax = nmin = 1;
    for (i = 2; i < N; i++) for (j = 0; j < i; j++) first_nmax(a[i] + a[j], i, j);
    for (i = 2; i < N; i++) for (j = 0; j < i; j++) first_nmin(abs(a[i] - a[j]), i, j);
    for (i = 0; i < N; i++) {
        if ((min[i].i != max[0].i && min[i].j != max[0].i) &&
            (min[i].i != max[0].j && min[i].j != max[0].j)) break;
	}
	x = (double)max[0].v / (double)min[i].v, x = abs(x);
	for (i = 0; i < N; i++) {
		if ((max[i].i != min[0].i && max[i].j != min[0].i) &&
            (max[i].i != min[0].j && max[i].j != min[0].j)) break;
	}
    y = (double)max[i].v / (double)min[0].v; y = abs(y);
	printf("%.8lf\n", x >= y ? x : y);
    return 0;
}

Measured memory_bytes: 664
#include <iostream>
using namespace std;
void A()
{
	int S[10000];
	int T[500];
	int N;
	int Q;
	int C = 0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> S[i];
	}

	cin >> Q;
	for (int i = 0; i < Q; i++)
	{
		cin >> T[i];
	}

	for (int i = 0; i < Q; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (T[i] == S[j])
			{
				C++;
				break;
			}
		}
	}

	cout << C << endl;
}

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

Measured memory_bytes: 1196
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
def calc(d,n)
  s,x = S[d],0
  n = D-d  if n > D-d
  t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    c = t[i]
    1 == n and next c
    l,L[i] = L[i],d
    c += calc(d+1,n-1) >> 5
    L[i] = l
    x < c ? x=c : c
  }
  ((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

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

int main(){
    ll n,a,b,c;
    cin >> n;
    a=n/3;
    b=n/5;
    c=n/15;
  if(n%2==0){
    n=n/2*(n+1);
  }else{
    n=(n+1)/2*n;
  }
    a=a*(a+1)/2;
    b=b*(b+1)/2;
    c=c*(c+1)/2;
    cout << n-a*3-b*5+c*15;

}

Measured memory_bytes: 3644
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   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 (b<a) { a=b; return 1; } return 0; }
    const int MAX =3001;
const int MOD =998244353;


  
signed main(){
  int n,x,m;
  cin>>n>>x>>m;
  int k=1,s[m+1];fill(s,s+m,MOD*MOD);
  s[m]=0;
  while(s[x]==MOD*MOD){
    s[x]=k;
    k++;
    x=x*x%m;
  }
  int sx=s[x];
  for(int i=m-1;i>=0;i--)s[i]=s[i+1]+(s[i]<=n)*i*(1+(sx<=s[i])*(n-s[i])/(k-sx));
cout<<s[0]<<endl;

}


Measured memory_bytes: 4368
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;




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

	vector<int> v(10);
	rep(i, 0, k) {
		int x;
		cin >> x;
		v[x]++;
	}


	for (int i = n; i <= 100000; i++) {
		int k = i;
		while (1) {
			int temp = k % 10;
			if (v[temp] != 0) {
				break;
			}
			k /= 10;
			if (k == 0) {
				cout << i << endl;
				exit(0);
			}
		}
	}



	return 0;
}

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

int main()
{
	int N;
  
  	cin >> N;
  
  	int *high = new int[N];
  
  for(int i = 0; i < N; i++){
    cin >> high[i];
  }
  
  int count = 0,max = 0;
  
  for(int i = 0; i < N-1;i++){
    if(high[i] >= high[i + 1]){
		count++;    
    }else{
      	if(max < count){
          max = count;
        }
        
        count = 0;
    }
  }
  if(max < count){
          max = count;
        }
  cout << max << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//-------------------------↓↓↓↓↓↓------------------------

int main(void){
        string s;
        bool fl;
        cin >> s;
        for(int i = s.size() - 1; i >= 0; i--){
                fl = false;
                if(i - 4 < 0){
                        cout << "NO\n";
                        return 0;
                }
                if(s[i] == 'm' && s[i - 1] == 'a' && s[i - 2] == 'e' && s[i - 3] == 'r' && s[i - 4] == 'd')i -= 5,fl = true;
                else if(s[i] == 'e' && s[i - 1] == 's' && s[i - 2] == 'a' && s[i - 3] == 'r' && s[i - 4] == 'e')i -= 5,fl = true;
                else{
                        if(i - 5 < 0){
                                cout << "NO\n";
                                return 0;
                        }
                        if(s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e')i -= 6,fl = true;
                        else{
                        if(i - 6 < 0){
                                cout << "NO\n";
                                return 0;
                        }
                        if(s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 'm' && s[i - 3] == 'a' && s[i - 4] == 'e' && s[i - 5] == 'r' && s[i - 6] == 'd')i -= 7,fl = true;
                        }
                }
                if(!fl){
                        cout << "NO\n";
                        return 0;
                }
                i++;
        }
        
        cout << "YES\n";
return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,m,x;
	cin>>n>>m>>x;

	ll c[n+5];
	ll a[n+5][m+5];

	for(ll i=0;i<n;i++)
	{
		cin>>c[i];
		for(ll j=0;j<m;j++)
			cin>>a[i][j];
	}
	bool flg = false;
	ll ans = LONG_LONG_MAX;
	for(ll i=0;i<(1<<n);i++)
	{
		ll p[m+5];
		memset(p,0,sizeof(p));
		ll Ans = 0;
		for(ll j=0;j<n;j++)
		{
			if ((i&(1<<j))>0)
			{
				Ans+=c[j];
				for(ll k=0;k<m;k++)
				{
					p[k]+=a[j][k];
				}
			}
		}

		bool flg2 = true;
		for(ll i=0;i<m;i++)
		{
			if (p[i]<x)
			{
				flg2 = false;
				break;
			}
		}

		if (flg2)
		{
			ans = min(ans,Ans);
			flg = true;
		}
	}

	if (flg)
		cout<<ans;
	else
		cout<<-1;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
const int N=2e3+5;
int n,x,y;
int sum[N];
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for (register int i=1; i<n; ++i)
	for (register int j=i+1; j<=n; ++j)
	{
		int now;
		now=min(j-i,abs(i-x)+abs(j-y)+1);
		sum[now]++;
	}	
	for (register int i=1; i<n; ++i) printf("%d\n",sum[i]);
return 0;	
}


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

using namespace std;

int main (void) {
    int X, N;
    cin >> X >> N;
    vector<int> n(102, 0);
    int p;
    for ( int i = 0; i < N; i++ ) {
        cin >> p;
        n.at(p) = 1;
    }

    int ans = INT_MAX;
    int min_diff = INT_MAX;
    for ( int i = 0; i <=101; i++ ) {
        if ( n.at(i) == 0 ) {
            int diff = abs(X - i);
            if ( diff < min_diff ) {
                min_diff = diff;
                ans = i;
            }
        }
    }

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


Measured memory_bytes: 3628