akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline


class SegTree:
    def __init__(self, v, op, e) -> None:
        self._n = len(v)
        self.log = (self._n - 1).bit_length()
        self.size = 1 << self.log
        self.d = [e() for _ in range(2 * self.size)]
        self.op = op
        self.e = e
        for i in range(self._n):
            self.d[self.size + i] = v[i]
        for i in reversed(range(1, self.size)):
            self.__update__(i)

    @classmethod
    def init_e(cls, n: int, op, e) -> 'SegTree':
        return cls([e for _ in range(n)], op, e)

    def set(self, p: int, x) -> None:
        p += self.size
        self.d[p] = x
        for i in range(1, self.log + 1):
            self.__update__(p >> i)

    def get(self, p: int):
        return self.d[p + self.size]

    def prod(self, l: int, r: int):
        sml = self.e()
        smr = self.e()
        l += self.size
        r += self.size

        while l < r:
            if l & 1:
                sml = self.op(sml, self.d[l])
                l += 1
            if r & 1:
                r -= 1
                smr = self.op(self.d[r], smr)
            l >>= 1
            r >>= 1
        return self.op(sml, smr)

    def all_prod(self):
        return self.d[1]

    def max_right(self, l: int, f):
        if l == self._n:
            return self._n
        l += self.size
        sm = self.e()
        while True:
            while l & 1 == 0:
                l >>= 1
            if not f(self.op(sm, self.d[l])):
                while l < self.size:
                    l <<= 1
                    if f(self.op(sm, self.d[l])):
                        sm = self.op(sm, self.d[l])
                        l += 1
                return l - self.size
            sm = self.op(sm, self.d[l])
            l += 1
            if (l & -l) == l:
                return self._n

    def min_left(self, r: int, f):
        if r == 0:
            return 0
        r += self.size
        sm = self.e()
        while True:
            r -= 1
            while r > 1 and r & 1:
                r >>= 1
            if not f(self.op(self.d[r], sm)):
                while r < self.size:
                    r = (r << 1) + 1
                    if f(self.op(self.d[r], sm)):
                        sm = self.op(self.d[r], sm)
                        r -= 1
                return r + 1 - self.size
            sm = self.op(self.d[r], sm)
            if (r & -r) == r:
                return 0

    def __update__(self, k: int) -> None:
        self.d[k] = self.op(self.d[k << 1], self.d[(k << 1) + 1])


n, q = map(int, input().split())
a = list(map(int, input().split()))
seg = SegTree(a, max, lambda: -1)

for _ in range(q):
    t, x, y = map(int, input().split())
    if t == 1:
        seg.set(x - 1, y)
    elif t == 2:
        print(seg.prod(x - 1, y))
    else:
        print(seg.max_right(x - 1, lambda v: v < y) + 1)


Measured memory_bytes: 123320
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=2e5+5;
const double PI=acos(-1);
const double e=2.718281828459;

map<string,int>MP;
string s[maxn];
map<string,bool>p;
int main()
{
    int n,mx=-1;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        cin>>s[i];
        MP[s[i]]++;
        mx=max(mx,MP[s[i]]);
    }
    sort(s+1,s+n+1);
    for(int i=1;i<=n;i++){
        if(MP[s[i]]==mx&&p[s[i]]==false){
            cout<<s[i]<<endl;p[s[i]]=true;
        }
    }
    return 0;
}


Measured memory_bytes: 40448
#include<stdio.h>
int main(){
  int a,b,c,d;
  int e,f,g;
  scanf("%d\n %d\n %d\n %d",&a,&b,&c,&d);
  e=a+b+c+d;
  f=e/60;
  g=e%60;
  printf("%d\n%d\n",f,g);
  return(0);
}

Measured memory_bytes: 596
void main() {
	auto ip = readAs!(ulong[]), N = ip[0], K = ip[1];
	auto A = readAs!(ulong[]);
	ulong[ulong] bits;
	foreach(i; 0..64) bits[i] = 0;
	foreach(i; A) {
		auto arr = i.bitsSet;
		debug arr.writeln;
		foreach(j; arr) bits[j]++;
	}
	debug bits.writeln;
	debug writefln("k: %b", K);
	debug writefln("%(%.6b %)", A);
	bool[ulong] visited;
	foreach(i; 0..64) visited[i] = false;
	
	ulong k = K;
	while(k != 0) {
		auto a = k.bitsSet.array.back;
		if(!visited[a]) {
			visited[a] = true;
			if(N / 2 >= bits[a]) {
				foreach(ref v; A) v ^= (1.to!ulong << a);
				k -= (1.to!ulong << a);
				debug writefln("k: %d, a: %d", k, a);
				continue;
			}
		}
		k = (1.to!ulong << a) - 1;
		debug writefln("k: %d, here %d", k, a);
	}
	debug writefln("%(%.6b %)", A);
	A.sum.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 4732
#include<iostream>
#include<cstdio>
using namespace std;
const int N=200005,mod=1e9+7;
int n,a[N],f[N],s[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	f[0]=1,s[a[1]]=1;
	for(int i=1;i<=n;i++)
	{
		// for(int j=1;j<=i;j++)
			// if(a[i]==a[j]&&a[j-1]!=a[i])
				// f[i]=(f[i]+f[j-1])%mod;
		f[i]=s[a[i]];
		if(a[i+1]!=a[i])
			s[a[i+1]]=(s[a[i+1]]+f[i])%mod;
	}
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 2560
input = input().split()
A = int(input[0])
B = int(input[1])

i = A*B
min = 10000000000
for i in range(A):
    if (A*B)%1==0:
        if ((A*B)/(i+1))%A==0 and ((A*B)/(i+1))%B==0:
            min = (A*B)/(i+1)
print(int(min))

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

int main()
{
	int h1 = 0, h2 = 0, h3 = 0,n1,n2;
	int hdata[10];
	for (int n = 0; n < 10; n++) {
		cin >> hdata[n];
		if (hdata[n] > h1) {
			h1 = hdata[n];
			n1 = n;
		}
	}
	for (int n = 0; n < 10; n++) {
		if (hdata[n] > h2 && n != n1) {
			h2 = hdata[n];
			n2 = n;
		}
	}
	for (int n = 0; n < 10; n++) {
		if (hdata[n] > h3 && n != n1 && n != n2)
			h3 = hdata[n];
	}

	cout << h1 << endl << h2 << endl << h3 << endl;
}

Measured memory_bytes: 3080
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        int[] cnt = new int[26];
        long ans = (long)(A.length())*(A.length()-1)/2+1;
        for (int i = 0; i < A.length(); i++) {
            int c = A.charAt(i)-'a';
            ans -= cnt[c];
            cnt[c]++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 28004
#include <stdio.h>
#include <string.h>

int search( char* sentence, char* word ) {

	int i, j, hit = 0;

	for ( i = 0; i <= strlen( sentence ) - strlen( word ); i++ ) {

		for ( j = 0; j < strlen( word ); j++ ) {

			if ( sentence[i+j] != word[j] ) {

				hit = 0;
				break;

			} else {

				hit++;

				if ( hit == strlen( word ) && ( sentence[i+j+1] - 'a' < 0 || sentence[i+j+1] - 'z' > 0 ) ) {

					return 1;

				}

			}

		}

	}

	return 0;

}

int bshift( char* str ) {

	int i;

	for ( i = 0; i < strlen( str ); i++ ) {

		if ( str[i] - 'a' > 0 && str[i] - 'z' <= 0 ) {

			str[i] = str[i] - 1;

		} else if ( str[i] - 'a' == 0 ) {

			str[i] = 'z';

		}

	}

	return 0;

}

int main( void ) {

	char target[81], c;
	int i = 0;
	
	while ( gets( target ) != NULL ) {

		while ( search( target, "the" ) + search( target, "this" ) + search( target, "that" ) == 0 ) {

			bshift( target );

		}

		printf( "%s\n", target );

	}

	return 0;

}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> vec(n);
    for(int i=0;i<n;i++){
        string s;int p;
        cin >> s >> p;
        vec[i]=pair<pair<string,int>,int>(pair<string,int>(s,-p),i+1);
    }
    sort(vec.begin(),vec.end());
    for(int i=0;i<n;i++){
        cout<<vec[i].second<<endl;
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

nn = 200200
mod = 10**9+7

fa = [1] * (nn+1)
fainv = [1] * (nn+1)
inv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % mod
for i in range(1, nn)[::-1]:
    inv[i] = fainv[i] * fa[i-1]

C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a-b] % mod if 0 <= b <= a else 0

N = int(input())
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)

BU = [1] * N
TD = [1] * N
SI = [1] * N
for i in R[::-1]:
    a = 1
    s = 1
    for j in X[i]:
        a = a * BU[j] % mod
        s += SI[j]
    SI[i] = s
    BU[i] = inv[s] * a % mod

for i in R:
    c = len(X[i])
    AL = [1] * (c + 1)
    AR = [1] * (c + 1)
    for k, j in enumerate(X[i]):
        AL[k+1] = AL[k] * BU[j] % mod
    for k in range(c-1, 0, -1):
        j = X[i][k]
        AR[k] = AR[k+1] * BU[j] % mod
    for k, j in enumerate(X[i]):
        TD[j] = TD[i] * AL[k] % mod * AR[k+1] % mod * inv[N - SI[j]] % mod

for i in range(N):
    print(BU[i] * fa[SI[i]] % mod * TD[i] % mod * fa[N - SI[i]] % mod * C(N-1, SI[i] - 1) % mod)

Measured memory_bytes: 125900
N = int(input())
a = [input() for i in range(N)]
M = int(input())
b = [input() for i in range(M)]
 
k = [0]
 
for x in a:
  temp = a.count(x)-b.count(x)
  k.append(temp)
for y in b:
  temp = a.count(y)-b.count(y)
  k.append(temp)
print(max(k))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

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

Measured memory_bytes: 3620
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int h = reader.nextInt(), w = reader.nextInt(), targets = reader.nextInt();
//		int[][] grid = new int[h][w];
		HashMap<Integer, HashSet<Integer>> hm = new HashMap<Integer, HashSet<Integer>>();
		
		int[] rowTargets = new int[h], columnTargets = new int[w];
		
		int maxRowTarget = 0, maxColumnTarget = 0;
		ArrayList<Integer> rowMaxes = new ArrayList<Integer>(), columnMaxes = new ArrayList<Integer>();
		for (int i = 0; i < targets; i++) {
			int targetx = reader.nextInt(), targety = reader.nextInt();
			if (!hm.containsKey(targetx - 1)) {
				hm.put(targetx - 1, new HashSet<Integer>());
			}
//			grid[targetx - 1][targety - 1] = 1;
			hm.get(targetx - 1).add(targety - 1);
			
			rowTargets[targetx - 1]++;
			columnTargets[targety - 1]++;
		}
		for (int i = 0; i < rowTargets.length; i++) {
			if (rowTargets[i] > maxRowTarget) {
				rowMaxes.clear();
				rowMaxes.add(i);
				maxRowTarget = rowTargets[i];
			}
			else if (rowTargets[i] == maxRowTarget) {
				rowMaxes.add(i);
			}
		}
		for (int j = 0; j < columnTargets.length; j++) {
			if (columnTargets[j] > maxColumnTarget) {
				columnMaxes.clear();
				columnMaxes.add(j);
				maxColumnTarget = columnTargets[j];
			}
			else if (columnTargets[j] == maxColumnTarget) {
				columnMaxes.add(j);
			}
		}
		
		
		boolean yeet = false;
		for (int row: rowMaxes) {
			for (int col: columnMaxes) {
				if (!hm.get(row).contains(col)) {
					System.out.println(maxRowTarget + maxColumnTarget);
					yeet = true;
					break;
				}
			}
			if (yeet) {
				break;
			}
		}
		if (!yeet) {
			System.out.println(maxRowTarget + maxColumnTarget - 1);
		}
		
		
		reader.close();
	}
	
}


Measured memory_bytes: 151540
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s = readline().decode().strip()
q = int(readline())
is_reversed = False
qs = read().decode().split("\n")
left = ""
right = ""
for i in range(q):
    query = qs[i].split()
    t = int(query[0])
    if t == 1:
        is_reversed = not is_reversed
    elif t == 2:
        f = int(query[1])
        c = query[2]
        if f == 1:
            if is_reversed:
                right += c
            else:
                left += c
        elif f == 2:
            if is_reversed:
                left += c
            else:
                right += c
s = left[::-1] + s + right
if is_reversed:
    print(s[::-1])
else:
    print(s)

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

using namespace std;

void paint(int node, vector<vector<pair<int, int>>> &next, vector<int> &color){
  for(int i = 0; i < next[node].size(); i++){
    int v = next[node][i].first;
    int w = next[node][i].second;
    int c = color[node];
    if(w % 2 == 0){
      color[v] = c;
    }else{
      color[v] = -1 * c + 1;
    }
    for(int j = 0; j < next[v].size(); j++){
      if(next[v][j].first == node){
        next[v].erase(next[v].begin() + j);
        break;
      }
    }
    paint(v, next, color);
  }
}

int main(){
  int n;
  cin >> n;
  
  vector<vector<pair<int, int>>> next(n, vector<pair<int, int>>());
  vector<int> color(n, -1);
  for(int i = 0; i < n - 1; i++){
    int u, v, w;
    cin >> u >> v >> w;
    next[u - 1].push_back(make_pair(v - 1, w));
    next[v - 1].push_back(make_pair(u - 1, w));
  }
  color[0] = 0;
  
  paint(0, next, color);
  
  for(int i = 0; i < n; i++){
    cout << color[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 8960
import sys
n = int(input())
s = [int(input()) for i in range(n)]
ans = sum(s)
s.sort()
if ans%10 != 0:
    print(ans)
else:
    for i in range(len(s)):
        if s[i]%10 != 0:
            ans -= s[i]
            break
    if ans%10 != 0:
        print(ans)
    else:
        print(0)


Measured memory_bytes: 3060
import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;



 class Main{
     static int charN(char c){
         if(c=='I') return 1;
         if(c=='V') return 5;
         if(c=='X')return 10;if(c=='L')return 50;if(c=='C')return 100;
         if(c=='D')return 500; if(c=='M')return 1000;
         return 0;
     }
     public static void main(String args[]){
         Scanner sc = new Scanner(System.in);
         String line;
         while(sc.hasNext()){
             line=sc.nextLine();
             if(line.isEmpty())break;
             int len=line.length(); int num=0;
             for(int i=0; i<len; i++){
                 if(i!=len-1){if(charN(line.charAt(i))< charN(line.charAt(i+1))){
                 num+=charN(line.charAt(i+1))-charN(line.charAt(i));i++;continue;}}
                 num+=charN(line.charAt(i));
             }
             System.out.println(num);
             
                
         }
         
         
     }
 }

Measured memory_bytes: 17188
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

const INI: i64 = 1_000_000_000_000;
use std::cmp::*;

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [i64;n],
    }

    let mut cost = vec![INI; n];

    cost[0] = 0;
    cost[1] = (h[0] - h[1]).abs();

    for i in 0..n {
        for j in 1..k + 1 {
            if i + j < n {
                cost[i + j] = min(cost[i + j], cost[i] + (h[i] - h[i + j]).abs());
            }
        }
    }

    println!("{}", cost[n - 1]);
}

Measured memory_bytes: 6524
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a[100005], b[100005];
    map<int, int> mp;
    int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) {
		scanf("%d", &a[i]);
		mp[a[i]] ++;
	}
	sort(a + 1, a + n + 1, greater<int>());
	int m = unique(a + 1, a + n + 1) - (a + 1);
	long long x = 0, y = 0;
	for(int i = 1; i <= m; i ++) 
	{
		int t = mp[a[i]];
		if( t == 2 || t == 3) 
		{
			if( x == 0)  x = a[i];
			else y = a[i];
		}
		else if( t >= 4) 
		{
			if( x == 0)	x = y = a[i];
			else y = a[i];
		}
		if( x && y)  break;
	}
	printf("%lld\n", (long long) x * y);
    return 0;
}


Measured memory_bytes: 8792
while True:
    try:
        m,f,r = map(int,raw_input().split())
        if all(k == -1 for k in [m,f,r]):
            break
    except EOFError:
        break
    
    if m == -1 or f == -1:
        print 'F'
    elif m + f >= 80:
        print 'A'
    elif 65 <= m + f <80:
        print 'B'
    elif 50 <= m + f < 65:
        print 'C'
    elif 30 <= m + f < 50:
        if r >= 50:
            print 'C'
        else:
            print 'D'
    elif m + f < 30:
        print 'F'

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

int ng(){
  cout << "UNRESTORABLE" << endl;
  return 0;
}

int main(){
  //int n, m; cin >> n >> m;
  string sp, t; cin >> sp >> t;
  int spl = sp.size(); int tl = t.size();
  if(spl < tl) return ng();
  
  bool mat = true;
  for(int i = spl - tl; i >= 0; i--) {
    string ss = sp.substr(i, tl);
    for(int j = 0; j < tl; j++) {
      mat = true;
      if(ss[j] != t[j] && ss[j] != '?') {
        mat = false;
        break;
      }
    }
    
    if(mat){
      sp.replace(i, tl, t);
      break;
    }
  }
  
  if(!mat) return ng();

  for(int i = 0; i < spl; i++) {
    if (sp[i] == '?') sp[i] = 'a';
  }
  
  cout << sp << endl;
}

Measured memory_bytes: 256
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  																						   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;	
const int mod = 1e9+7;																							   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS//////////////////////////////////////////////////////


///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	double t, x;
	cin >> t >> x;
	
	cout << t / x << endl;
	
	
	
	

						
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

const int MAX=510000;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll x,k,d;
  cin >> x >> k >> d;
  x=abs(x);
  ll ans;
  if(x/d>k){
    ans = x-d*k;
  }
  else{
    ll res = x/d;
    k -= res;
    x -= res*d;
    if(k%2==1)x=abs(x-d);
    ans = x;
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<ll, ll>
#define sz size()

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);} 
#define traceloop(x,a) { cerr<<#a<<": "; for(ll ix=0;ix<x;ix++) cerr<<a[ix]<<" "; cerr<<endl; }

#define INF 1e18+3

int main()
{
	ios::sync_with_stdio(0);
	ll i, n, m, j, W;
	
	string s, t;
	cin >> s >> t;
	s = '-' + s;
	t = '+' + t;
	n = s.sz;
	m = t.sz;
	vector<vector<int> > dp(n, vector<int>(m, 0));


	for(i=1;i<n;++i)
		for(j=1;j<m;++j)
			if(s[i] == t[j])
				dp[i][j] = dp[i-1][j-1] + 1;
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);


	// for(i=1;i<n;++i){
	// 	for(j=1;j<m;++j)
	// 		cout << dp[i][j] <<" "
	// 	;cout <<"\n";
	// }
	stack<char> stk;
	i = n-1;
	j = m-1;
	while(i>0 and j>0)
	{
		if(s[i]==t[j])
		{
			stk.push(t[j]);
			i--;
			j--;
		}
		else if(dp[i-1][j] > dp[i][j-1])
			i--;
		else
			j--;
	}
	if(stk.empty())
		cout << "";
	else
		while(!stk.empty())
		{
			cout << stk.top();
			stk.pop();
		}


	return 0;
}

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

int main() {
  int a[5],mi=10,mi_i;
  for (int i=0; i<5; i++) {
    cin>>a[i];
    if (a[i]%10) {
      if (mi>a[i]%10) {
	mi_i=i;
	mi=a[i]%10;
      }
    }
  }
  int ans=0;
  for (int i=0; i<5; i++) {
    if (i==mi_i) {
      ans+=a[i];
    }
    else {
      ans+=(a[i]+9)/10*10;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    IOS;
    //ll t;cin>>t;while(t--)
    {
        ll a,b,c,d,i,j,k,l,m,n,sum=0,temp=0,f=0,cnt=0;
        cin>>n;
        vector<ll > vec;
        for(i=0;i<n;i++)
        {
            cin>>k;
            vec.pb(k);
        }
        sort(vec.rbegin(),vec.rend());
        sum+=vec[0];
        n-=2;
        a=0;
        for(i=1;i<vec.size();i++)
        {
            if(n==0)
                break;
            if(n==1)
            {
                sum+=vec[i];
                break;
            }
            sum+=vec[i]+vec[i];
            n-=2;

        }
        cout<<sum<<endl;

    }
}


Measured memory_bytes: 5332
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    string s;
    char prev;
    int ans = 0;

    cin >> n >> s;

    prev = s[0];
    ans++;

    for (int i = 1; i < n; i++) {
        if (prev != s[i]) {
            ans++;
            prev = s[i];
        }
    }

    cout << ans << endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct edge {
  int to, s;
  edge(){}
  edge(int to, int s):to(to), s(s){}
};

vector<edge> graph[100010];

int lb, ub;

int cons[100010];
int color[100010];
bool dfs(int u, int col, int sum) {
  //cout<<u<<" "<<col<<" "<<sum<<endl;
  if(~color[u]) {
    if(col == color[u]) return sum == cons[u];
    int t = (col ? sum-cons[u] : cons[u]-sum);
    if(t%2 || t <= 0) return false;
    if(lb == ub && lb != t/2) return false;
    if(t/2 < lb || ub < t/2) return false;
    lb = ub = t/2;
    return true;
  }
  color[u] = col;
  cons[u] = sum;
  if(col) chmin(ub, sum-1);
  else chmax(lb, 1-sum);
  if(lb > ub) return false;
  for(edge& e : graph[u]) {
    if(!dfs(e.to, 1-col, e.s-sum)) return false;
  }
  return true;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  rep(i, m) {
    int u, v, s;
    cin >> u >> v >> s;
    --u, --v;
    graph[u].emplace_back(v, s);
    graph[v].emplace_back(u, s);
  }
  memset(color, -1, sizeof(color));
  lb = -inf, ub = inf;
  if(dfs(0, 0, 0)) cout << ub-lb+1 << endl;
  else cout << 0 << endl;

  return 0;
}


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

int main()
{
    int n;
    string s;

    cin>>n;
    cin>>s;

    for(int i=0; i<s.size(); i++)
    {
        s[i] = (s[i] + n);
        if(s[i]>90)
            s[i] = s[i] - 90 + 65 -1;
    }

    cout<<s;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
#include <utility>
#include <string.h>
#include <math.h>
using namespace std;
typedef long long int ll;
const ll mod = 998244353;
const ll INF = 1e9 + 5;

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

	cout << min(k - n, n) << endl;
}

int main()
{
//	int t;
//	cin >> t;
//	while(t-->0)
	solve();
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  rep(i, N) {
    int b;
    cin >> b;
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (b == A[i][j]) A[i][j] = 0;
      }
    }
  }
  bool OK = false;
  for (int i = 0; i < 3; ++i) {
    if (A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0) OK = true;
    if (A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0) OK = true;
  }
  if (A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) OK = true;
  if (A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0) OK = true;

  if (OK)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

using namespace std;

typedef long long int LL;
typedef unsigned long long int ULL;
typedef pair<int, int> PII;
typedef map<int, int> MII;

const int SZ = 112345;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    s[i] = 'x';
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define mp              make_pair
#define in              insert
#define ff              first
#define ss              second
#define vv              vector
#define vll             vector <ll>
#define pll             pair <ll,ll>
#define vpll            vector <pll>
#define umap            unordered_map
#define uset            unordered_set
#define mset            multiset
#define pqueue          priority_queue
#define stk             stack<ll>
#define que             queue<ll>
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define gcd(a,b)        __gcd(a,b)
#define rev             reverse
#define Y               "YES"
#define N               "NO"
#define br              "\n"
#define sp              " "
#define debug(x)        cout << #x << " : " << x << endl;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ll inf = 1e18;
const ll MAX = 2e5 + 1;


// ====== int_1024t begins ======
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// ====== int_1024t ends ======

inline ll add(ll a, ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a, ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a, ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x, ll n) {
	x = x % mod;
	if (!n) return 1;
	if (n & 1) return mul(x, pwr(mul(x, x), (n - 1) / 2));
	else return pwr(mul(x, x), n / 2);
}
// O(nlogn) for [1,n]
ll modinv(ll n) {
	return pwr(n, mod - 2);
}
// O(logn) for[1,n]
ll inv(ll i) {
	if (i == 1) return 1;
	return (MOD - (MOD / i) * inv(MOD % i) % MOD) % MOD;
}
// =============================

const int INF = 1e9 + 5;
vector<ll> w, profit;
ll n, W, fans = -1;
ll dp[105][100005];
int ans;

void solve()
{


	cin >> n >> W;
	w.resize(n + 1); profit.resize(n + 1);
	int val = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> w[i] >> profit[i];
		val += profit[i];
	}
	//cout << "hello";
	dp[0][0] = 0;
	for (int i = 1; i <= val; i++)
		dp[0][i] = INF;

	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= val; j++)
		{
			if ((j - profit[i]) >= 0)
			{
				dp[i][j] = min(dp[i - 1][j], w[i] + dp[i - 1][j - profit[i]]);
			}
			else
				dp[i][j] =  dp[i - 1][j];


			if ( dp[i][j] <= W )
			{ans = max(ans, j );}
		}
	}

	for (int i = val; i >= 0; i--)
	{

		if (dp[n][i] <= W)
		{
			cout << i << endl;
			return;
		}
	}

}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t;
	// cin >> t;
	// while (t--)
	// {
	solve();
	// }

	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> p(N);
  
  for(int i=0; i<N; i++) cin >> p[i];
  
  int cnt = 0;
  int x, y;
  for(int i=0; i<(N-1); i++){
    if(p[i]>p[i+1]){
      cnt += 1;
      
      if(cnt==1){
        x=i;
      }else if(cnt==2){
        y=i;
      }else if(cnt==3){
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  
  if(cnt==0){
    cout << "YES" << endl;
  }else if(cnt==2 && p[x]>p[y] && p[x+1]>p[y+1]){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  
  
  return 0;
}

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

// Check Examples


//Compiler version g++ 6.3.0

int main()
{
    ull n,ttsum=0,tmsum=0;
    cin >> n;
    vector<ull>w(n,0);
    for(ull i=0;i<n;i++)
    {
    	cin>>w[i];
    	ttsum+=w[i];
    	
    }
    ull mdiff = ttsum;
    
    for(ull i=0;i<n;i++)
    {
    	tmsum+=w[i];
    	ull k=abs(2*tmsum - ttsum);
    	if(k<mdiff)
    	{
    		mdiff=k;
    	}
    }
    cout<<mdiff;
}

Measured memory_bytes: 256
r, c = map(int, input().split())
a = [[0] * c for i in range(r + 1)]
for i in range(r):
   a[i] = list(map(int, input().split()))
for j in range(c):
   for i in range(r):
       a[r][j] += a[i][j]
for i in range(r + 1):
   m = 0
   for j in range(c):
       m += a[i][j]
       print(a[i][j], end=" ")
   print(m)


Measured memory_bytes: 6224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;
#define MAXN 300000 
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
int A[MAXN+5], N, I, D, C, F; vector<vector<int> > Ans;
int main()
{
	N = read(), I = read(), D = read(); if(!I||!D||I+D-1>N||1ll*I*D<N) return puts("-1"),0;
	Ans.resize(D); for(rint i = N-I+1; i <= N; Ans[0].push_back(i), i++); N -= I;
	if(D>1){F = N/(D-1); C = 0; for(rint i = D-1, j; i; N%(D-1)?Ans[i].push_back(++C),--N,0:0, i--) for(j = 1; j <= F; Ans[i].push_back(++C), j++);}
	for(rint i = 0, j; i < D; i++) for(j = 0; j < Ans[i].size(); printf("%d ",Ans[i][j]), j++); putchar('\n'); return 0;
}

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

int main() {
  
  int N, K;
  cin >> N >> K;
  
  int l = 0;
  
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    if (2 * x <= K) l += 2 * x;
    else l += 2 * (K - x);
  }
  
  cout << l << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9 + 7;


ll n, m;
vector<int> G[ARRAY_MAX];
int color[ARRAY_MAX];//各頂点の色(1:黒、2;白,0:まだ塗られていない)
bool ans = true;//二部グラフかどうか


void dfs(int now) {


	for (auto to : G[now])
	{
		if (color[now] == color[to])
		{
			//二部グラフではない
			//ループができている
			ans = false;
			return;
		}
		if (color[to] == 0)
		{
			//まだ塗られていない
			color[to] = 3 - color[now];//color[now]==1なら2が、color[now]==2なら1が入る(隣同士で違う色が塗られる)
			dfs(to);
		}


	}
}



int main() {


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

	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	color[0] = 1;//1は黒を表す
	dfs(0);
	
	if (ans)
	{
		//二部グラフ
		int black = 0, white = 0;
		for (int i = 0; i < n; i++)
		{
			if (color[i] == 1)
			{
				black++;
			}
			else
			{
				white++;
			}
		}
		ll ans = 1LL * black * white - m;
		cout << ans << endl;
	}
	else
	{
		//二部グラフではない
		ll ans = 1LL * n * (n - 1) / 2 - m;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 6912
# X = gets.chomp
n = gets.to_i
# X = gets.split.map &:to_i
ans_rev = []
while n > 0
    digit = n % 26
    digit = 26 if digit == 0
    ans_rev << digit + 96
    n -= digit
    n /= 26
end
puts ans_rev.reverse.inject("") { |result, code| result + code.chr }

Measured memory_bytes: 14300
#include <iostream>
#include <cmath>

using namespace std;

int N;
int a[2][100];

int main(){
    cin >> N;
    for(int j=0;j<2;j++){
        for(int i=0;i<N;i++){
            cin >> a[j][i];
        }
    }
    for(int i=1;i<N;i++){
        a[0][i] += a[0][i-1];
    }
    a[1][0] += a[0][0];
    for(int i=1;i<N;i++){
        a[1][i] += max(a[1][i-1],a[0][i]);
    }
    cout << a[1][N-1] << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef map<int, int> mi;
typedef map<char, int> mc;
typedef set<int> si;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;


#define F first
#define S second
#define comp(x) (x).begin(), (x).end()
#define dbg(x) cout << #x << " " << x << endl
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back(x)
#define fr(i,s,n) for(int (i) = (int)s; (i) < (int)(n); (i)++)

void arr(vi a) {
	for (int i = 0; i < a.size(); i++) {
		dbg(a[i]);
	}
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	cout << a * b;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  int n;
  cin >> n;
  vector<int> per(n);
  rep(i,n){
    per[i] = i; 
  }
  vector<pair<double,double>> v(n);
  rep(i,n){
    int x,y;
    cin >> x >> y;
    v[i] = {x,y};
  }
  int cnt = 0;
  double res = 0;
  do{
    for (int i = 0;i < n-1;i++){
      res += sqrt((v[per[i]].first-v[per[i+1]].first)*(v[per[i]].first-v[per[i+1]].first)+
                   (v[per[i]].second-v[per[i+1]].second)*(v[per[i]].second-v[per[i+1]].second));
    }
    cnt++;
  }while(next_permutation(per.begin(),per.end()));
  printf("%.8f\n",res/double(cnt));
  //cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3812
s = int(input())
l = [s]
i = 0
while 1:
  a = int(l[i]/2) if l[i]%2 == 0 else int(3*l[i]+1)
  if a in l:
    print(i+2)
    quit()
  else:
    l.append(a)
  i += 1

Measured memory_bytes: 3060
//بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;

#define endl "\n"

const int MOD = 1000000007;

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

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

    sort(ara,ara+a);
    for(int i = 0 ; i < (a-1); i++){
        sum += ara[i];

    }
    cout << sum + (ara[a-1]/2) << endl;


    return 0;
}


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

namespace ABC
{
    class ProgramD
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var first = s[0];
            var last = s[s.Length - 1];
            var isSame = first == last;
            var isOdd = s.Length % 2 == 0;

            Console.WriteLine(isSame ^ isOdd ? "Second" : "First");
        }

    }
}


Measured memory_bytes: 26252
#include <iostream>
 
int main()
{
  int N;
  long long result, L0 = 2, L1 = 1;
  std::cin >> N;

  if(N == 0)
  {
    result = L0;
  }
  else if(N == 1)
  {
    result = L1;
  }
  else
  {
    for(int i = 2; i <= N; i++)
    {
      result = L1 + L0;
      L0 = L1;
      L1 = result;
    }
  }

  std::cout << result;
  return 0;
}

Measured memory_bytes: 3192
# 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n = int(sys.stdin.readline().rstrip())
    
    eating_order = [int(x) for x in sys.stdin.readline().split()]
    base_point = sum([int(x) for x in sys.stdin.readline().split()])
    bonus_points = [0] + [int(x) for x in sys.stdin.readline().split()]

    total = base_point
    for i in range(n-1):
        if eating_order[i+1] == eating_order[i] + 1:
            total += bonus_points[eating_order[i]]

    print(total)

if __name__ == "__main__":
    main()


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

using namespace std;

int main(){
    string s, t;
    cin>>s>>t;
    int sz = s.size();
    int tz = t.size();
    int best = tz;
     for(int i = 0; i < sz - tz + 1; ++i){
         int temp = 0;
         for(int j = 0; j < tz; ++j){
               if(s[i + j] != t[j])temp++; 
         }
         best = min(best, temp);
     }

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


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e18
#define EPS 1e-9
#define MAX 200009
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tt, T)
	{
		//cout << "Case #" << tp << ": ";
		int n; cin >> n;
		map<string, int> m;
		FOR1(i, n){
			string s; cin >> s;
			m[s] ++;
		}
		cout << "AC x " << m["AC"] << '\n';
		cout << "WA x " << m["WA"] << '\n';
		cout << "TLE x " << m["TLE"] << '\n';
		cout << "RE x " << m["RE"] << '\n';
		//cout<<'\n';
	}
	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val N = ni()
    val dp = LongArray(N + 1)
    for (x in 1 .. 100) {
      for (y in 1 .. 100) {
        for (z in 1 .. 100) {
          val n = x * x + y * y + z * z + x * y + x * z + y * z
          if (n in 1 .. N) dp[n]++
        }
      }
    }
    for (i in 1 .. N) {
      out.println(dp[i])
    }
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 35572
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto md1 = readln.split.to!(int[]);
    auto md2 = readln.split.to!(int[]);
    writeln(md1[0] == md2[0] ? 0 : 1);
}

Measured memory_bytes: 256