akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
public class Main
{
	final long mod=(long)(1e9+7);
	final int maxn=(int)(1e6);
	
	private void solve()throws IOException
	{
		HashMap<String,Integer> map=new HashMap<>();
		int n=nextInt();
		for(int i=1;i<=n;i++)
		{
			String s=nextLine();
			map.put(s,map.getOrDefault(s,0)+1);
		}
		int max=0;
		ArrayList<String> list=new ArrayList<>();
		for(String s:map.keySet())
		{
			int x=map.get(s);
			if(x>max)
			{
				list=new ArrayList<String>();
				list.add(s);
				max=x;
			}
			else if(x==max)
				list.add(s);
		}
		Collections.sort(list);
		for(String s:list)
			out.println(s);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();

		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 54744
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  int b[N][3];
  for (int i = 0; i < N; i++) {
    b[i][0] = a[i] - 1;
    b[i][1] = a[i];
    b[i][2] = a[i] + 1;
  }

  int ans = pow(3, N);
  int odd = 1;
  for (int i = 0; i < N; i++) {
    int cnt = 0;
    for (int j = 0; j < 3; j++) {
      if (b[i][j] & 1) cnt++;
    }
    odd *= cnt;
  }

  // 解答
  cout << ans - odd << endl;

  return 0;
}


Measured memory_bytes: 640
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		char[] s1 = scan.next().toCharArray();
		char[] s2 = scan.next().toCharArray();

		char[] arr = new char[n*2];
		for(int i = 0; i < s1.length; i++) {
			arr[i] = s1[i];
		}
		LABEL:for(int i = 0; i < n*2; i++) {
			if(arr[i] == s2[0]) {
				for(int j = 1; i < s2.length && i+j < n; j++) {
					if(arr[i+j] != s2[j]) {
						continue LABEL;
					}
				}
				System.out.println(n+i);
				return;
			}
		}

		System.out.println(2*n);
	}
}


Measured memory_bytes: 9044
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}


double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	double d, t, s;
	scanf("%lf%lf%lf", &d, &t, &s);
	printyn(d / s <= t);

	Please AC;
}


Measured memory_bytes: 3844
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 60, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N >> M;
  cout << max(0LL, N - 2 * M) << endl;
}
void solve() {
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    vector<int> C(N), S(N), F(N);
    for (int i = 0; i < N-1; i++) cin >> C[i] >> S[i] >> F[i];

    for (int n = 0; n < N; n++) {
        int ans = 0;
        for (int i = n; i < N-1; i++) {
            if (ans <= S[i]) ans = S[i];
            else ans = (ans - S[i] + F[i] - 1) / F[i] * F[i] + S[i];
            ans += C[i];
        }
        cout << ans << '\n';
    }

}

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

    solve();

    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}





int main() {
    int n;
    cin>>n;
    cout<<n*n<<endl;



    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

int n,a,b;
signed main(){
  cin>>n>>a>>b;
  if((b-a)%2 == 1){
    int x = (b-a-1)/2+a, y = (n-(a+(n-b+1)))/2+(n-b+1);
    cout << min(x, y) << endl;
  }else{
    cout << (b-a)/2 << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>

typedef long long LL;

#define int LL

const int MAXN = 1e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MAX( const _T a, const _T b )
{
	return a > b ? a : b;
}

template<typename _T>
_T MIN( const _T a, const _T b )
{
	return a < b ? a : b;
}

int BIT[MAXN];
int a[MAXN], s[MAXN];
int N;

int lowbit( const int &x ) { return x & ( -x ); }
void update( int x, const int v ) { for( ; x <= N ; x += lowbit( x ) ) BIT[x] += v; }
int getSum( int x ) { int ret = 0; while( x ) ret += BIT[x], x -= lowbit( x ); return ret; }

bool chk( const int len )
{
	LL ret = 0; int mn = N;
	for( int i = 1 ; i <= N ; i ++ ) s[i] = a[i] >= len ? -1 : 1;
	for( int i = 1 ; i <= N ; i ++ ) s[i] += s[i - 1], ret += s[i] > 0, mn = MIN( mn, s[i] );
	for( int i = 1 ; i <= N ; i ++ ) BIT[i] = 0, s[i] += 1 - mn;
	for( int i = 1 ; i <= N ; i ++ ) ret += getSum( s[i] - 1 ), update( s[i], 1 );
	return ret <= 1ll * N * ( N + 1 ) / 4;
}

signed main()
{
//	freopen( "median.in", "r", stdin );
//	freopen( "median.out", "w", stdout );
	int l = 1e9, r = -1;
	read( N );
	for( int i = 1 ; i <= N ; i ++ ) read( a[i] ), l = MIN( l, a[i] ), r = MAX( r, a[i] );
	int mid;
	while( r - l > 1 )
	{
		if( chk( mid = l + r >> 1 ) ) l = mid;
		else r = mid - 1;
	}
	if( chk( r ) ) write( r );
	else write( l );
	putchar( '\n' );
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <utility>
using namespace std;

#define REP(var,start,end) for(int var=start; var<end; var++)

int main(void) {
	int N, K;
	
	cin >> N >> K;
	
	long long ten[55][2];
	REP(i, 0, N) {
		cin >> ten[i][0] >> ten[i][1];
	}
	
	unsigned long long min = ULLONG_MAX;
	
	REP(a0, 0, N) {
		REP(a1, 0, N) {
			
			if ( ten[a0][0] == ten[a1][0] ) { continue; }
			
			REP(b0, 0, N) {
				REP(b1, 0, N) {
					
					if ( ten[b0][1] == ten[b1][1] ) { continue; }
					
					long long x0 = ten[a0][0];
					long long x1 = ten[a1][0];
					if ( x0 > x1 ) { swap(x0,x1); }
					
					long long y0 = ten[b0][1];
					long long y1 = ten[b1][1];
					if ( y0 > y1 ) { swap(y0,y1); }
					
					int cnt = 0;
					REP(t, 0, N) {
						if ( x0 <= ten[t][0] && ten[t][0] <= x1 &&
						     y0 <= ten[t][1] && ten[t][1] <= y1 ) {
							cnt ++;
							if ( cnt >= K ) { break; }
						}
					}
					
					if ( cnt >= K ) {
						unsigned long long men = (x1-x0) * (y1-y0);
						if ( min > men ) { min = men; }
					}
				}
			}
		}
	}
	
	cout << min << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

//int mod = 1000000007;
int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

int modpow(int x, int n, int m){
    int a = 1;
    IREP(i, 64){
        a = (a * a) % m;
        if(((n >> i) & 1) == 1) a = (a * x) % m;
    }
    return a;
}

signed main(){

    int N; cin >> N;
    vec a(N); readv(a);

    int M = 90000;
    mat dp(N + 1, vec(2 * M + 1, 0));
    dp[0][M] = 1;
    REP(i, N){
        REP(j, 2 * M + 1){
            if(j + a[i] <= 2 * M) Add(dp[i + 1][j + a[i]], dp[i][j]);
            if(j - a[i] >= 0) Add(dp[i + 1][j - a[i]], 2 * dp[i][j]);
        }
    }
    int x = 0;
    FOR(j, M, 2 * M + 1) Add(x, dp[N][j]);

    mat dp2(N + 1, vec(2 * M + 1, 0));
    dp2[0][M] = 1;
    REP(i, N){
        REP(j, 2 * M + 1){
            if(j + a[i] <= 2 * M) Add(dp2[i + 1][j + a[i]], dp2[i][j]);
            if(j - a[i] >= 0) Add(dp2[i + 1][j - a[i]], dp2[i][j]);
        }
    }
    int y = 0;
    FOR(j, M, 2 * M + 1) Add(y, dp2[N][j]);
    Add(x, 2 * (mod - y) + 1);

    int p = modpow(3, N, mod) - 3 * modpow(2, N, mod) + 3;
    int ans = p - 3 * x;
    ans = (ans % mod + mod) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 848768
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MXN = 3005;
double p[MXN];
double dp[MXN][MXN];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> p[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j <= i; j++) {
            dp[i][j] = dp[i - 1][j] * (1 - p[i]);
            if(j - 1 >= 0)
                dp[i][j] += dp[i - 1][j - 1] * p[i];
        }
    }
    double ans = 0;
    for(int i = (n + 1) / 2; i <= n; i++) {
        ans += dp[n][i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 49948
#include <stdio.h>
#include <math.h>

int main()
{
    int a,b;
    int max;
    while (scanf("%d %d",&a,&b)!=EOF)
    {
        int s1,s2,s3;
        s1 = a+b;
        s2 = a-b;
        s3 = a*b;
        max=s1;
        if(s2 > max)max=s2;
        if(s3 > max)max=s3;
    }


    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 128
function Main(input) {
    input = input.split(" ");
    x = parseInt(input[0], 10);
    y = parseInt(input[1], 10);
    
    let res = false;
    for(let i = 0; i <= x; i++){
        if( y === i * 2 + (x - i) * 4){
            res = true;
        }
    }

    if(res){
        console.log("Yes");
    }else{
        console.log("No");
    }
}
 
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30544
A, B, N = map(int, input().split())
Ymax=0
if A*N < B:
  print(0)
elif N<B:
  Ymax = A*N // B
  print(Ymax)
else:
  x = B-1
  Ymax = A*x//B - A*(x//B)
  print(Ymax)

Measured memory_bytes: 9168
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Function (on)
import qualified Data.IntMap as IM

main :: IO ()
main = do
  xs <- getc $ split toDbl
  mapM_ (\(x,y) -> putStrLn $ show x ++ " " ++ show y) $ solve xs

solve :: [[Double]] -> [(Int,Int)]
solve xs = zip (IM.elems lm) (IM.elems rm)
  where
    ls = map (\[x,y] -> (eyetest x, eyetest y)) xs
    (lm,rm) = foldl (\(lmp,rmp) (l,r) -> (IM.insertWith (+) l 1 lmp, IM.insertWith (+) r 1 rmp)) (IM.fromList [(0,0),(1,0),(2,0),(3,0)], IM.fromList [(0,0),(1,0),(2,0),(3,0)]) ls
      
eyetest :: Double -> Int
eyetest x
  | x < 0.2 = 3
  | x < 0.6 = 2
  | x < 1.1 = 1
  | otherwise = 0

toDbl :: String -> Double
toDbl s = read s

split :: (String -> a) -> String -> [a]
split f = map f . words

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents

Measured memory_bytes: 4332
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
	*/
	int n;
	cin >> n;
	int ans = 0;
	ll count = 0;
	int d, x;
	cin >> d >> x;
	vector<int>a(n); rep0(kkk, n - 1)cin >> a[kkk];
	rep0(i, n - 1) {
		int save = 1;
		while (save <= d) {
			count++;
			save += a[i];
		}
	}
	cout << count + x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const ll inf = 1e10;
int main() {
  ll n ,k;
  cin >> n >> k;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  auto ok = [&](ll x){
    ll cnt = 0;
    rep(i,n)cnt+=ceil((long double)a[i]/(long double)x)-1;
    return cnt;
  };
  ll l = -1, r = inf;
  ll ans = inf;
  while (r - l > 1) {
      ll mid = l + (r - l) / 2;
      if (ok(mid) <= k){
        r = mid;
        mins(ans,mid);
      }
      else l = mid;
  }
  cout<< max(1LL,ans) <<endl;
  return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;
    using T = tuple<int, int, int>;
    vector<T> table;
    for(int i = 0; i < n; ++i){
        int x, y, h;
        cin >> x >> y >> h;
        table.emplace_back(h, x, y);
    }
    sort(table.rbegin(), table.rend());

    for(int cx = 0; cx <= 100; ++cx){
        for(int cy = 0; cy <= 100; ++cy){
            int H = get<0>(table[0]) + abs(get<1>(table[0]) - cx) + abs(get<2>(table[0]) - cy);
            bool ok = true;
            for(int i = 1; i < n; ++i){
                int x, y, h;
                tie(h, x, y) = table[i];
                int val = max(0, H - abs(x - cx) - abs(y - cy));
                if(val != h){
                    ok = false;
                    break;
                }
            }
            if(ok){
                cout << cx << ' ' << cy << ' ' << H << '\n';
                return 0;
            }
        }
    }
}

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

bool cmp(pair<int, int> d1, pair<int, int> d2){
    if(d1.first == d2.first){
        return d1.second < d2.second;
    }
    return d1.first > d2.first;
}

int main(){
    int n;
    int cnt = 0;
    while(cin >> n, n){
        if(cnt != 0) cout << endl;
        cnt++;
        string s[10];
        vector<pair<int, int> > d;
        for(int i = 0; i < n; i++){
            int a, b, c;
            cin >> s[i] >> a >> b >> c;
            d.push_back(make_pair(3 * a + c, i));
        }
        sort(d.begin(), d.end(), cmp);
        for(int i = 0; i < n; i++){
            cout << s[d[i].second] << "," << d[i].first << endl;
        }
    }
}

Measured memory_bytes: 3172
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define SIZE 200000
class unionfind
{
public:
	int par[SIZE];
	int ran[SIZE];
	int ren[SIZE];
	void init()
	{
		for (int i = 0; i<SIZE; i++)
		{
			par[i] = i;
			ran[i] = 0;
			ren[i] = 1;
		}
	}
	int find(int a)
	{
		if (a == par[a])return a;
		else return par[a] = find(par[a]);
	}
	void unite(int a, int b)
	{
		a = find(a);
		b = find(b);
		if (a == b)return;
		if (ran[a]>ran[b])
		{
			par[b] = a;
			ren[a] += ren[b];
		}
		else
		{
			par[a] = b;
			ren[b] += ren[a];
		}
		if (ran[a] == ran[b])ran[b]++;
	}
};
unionfind uf;
typedef long long ll;
ll d[202020];
vector<ll>ds[202020];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	if (num - way == 1)
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < num; i++)scanf("%lld", &d[i]);
	uf.init();
	for (int i = 0; i < way; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		uf.unite(za, zb);
	}
	for (int i = 0; i < num; i++)ds[uf.find(i)].push_back(d[i]);
	ll ans = 0;
	vector<ll>z;
	int mok = (num - 1 - way) * 2;
	for (int i = 0; i < num; i++)
	{
		if (i == uf.find(i))
		{
			sort(ds[i].begin(), ds[i].end());
			ans += ds[i][0];
			mok--;
			for (int j = 1; j < ds[i].size(); j++)z.push_back(ds[i][j]);
		}
	}
	sort(z.begin(), z.end());
	if (int(z.size()) < mok)printf("Impossible\n");
	else
	{
		for (int i = 0; i < mok; i++)ans += z[i];
		printf("%lld\n", ans);
	}
}

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

int main() {
	string s = "kstnhmyr";
	string k; cin >> k;
	string ans;
	for (int i = 0; i < k.size(); i += 2) {
		if (k[i] == '0') {
			if (k[i + 1] == 'U')ans += "nn";
			if (k[i + 1] == 'T')ans += "wa";
			if (k[i + 1] == 'D')ans += "wo";
			continue;
		}
		if (k[i] != '1')ans += s[k[i] - '2'];
		switch (k[i + 1]) {
		case 'T':ans += 'a'; break;
		case 'L':ans += 'i'; break;
		case 'U':ans += 'u'; break;
		case 'R':ans += 'e'; break;
		case 'D':ans += 'o'; break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3188
import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    long result = 0;
    Gcd gcd = new Gcd();

    int k = Integer.parseInt(br.readLine());
    for (int i=1; i<=k; i++) {
      for (int j=1; j<=k; j++){
        for (int l=1; l<=k; l++) {
          int temp = gcd.gcd(i, j);
          result += gcd.gcd(temp, l);
        }
      }
    }
    System.out.println(result);
  }
}
class Gcd {
  int[][] array = new int[201][201];

  public int gcd(int a, int b) {
    if (array[a][b] != 0){
      return array[a][b];
    }
    if (array[b][a] != 0) {
      return array[b][a];
    }
    if(a < b) return gcd(b, a);
    if(b == 0) {
      array[a][b] = a;
      return b;
    }
    return array[a][b] = gcd(b, a % b);
  }
}


Measured memory_bytes: 34736
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    arr=zeros(Int,1,n+1)
    for i in 1:n
        if s[i]=='<' && arr[i]>=arr[i+1]
            arr[i+1]=arr[i]+1
        end
    end
    for i in n:-1:1
        if s[i]=='>' && arr[i]<=arr[i+1]
            arr[i]=arr[i+1]+1
        end
    end
    println(sum(arr))
end
main()

Measured memory_bytes: 154072
fun main(args: Array<String>){
    val (s, t) = readLine()!!.split(" ")
    var (a, b) = readLine()!!.split(" ").map(String::toInt)
    val u = readLine()!!
    if(s == u){
        a--
    }else if(t == u){
        b--
    }
    println("$a $b")
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		




int main() {
	
	int n, k;
	cin >> n >> k;
	VLL a(n);
	REP(i, n)cin >> a[i];

	sort(ALL(a));

	int ok = n;
	int ng = -1;

	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;

		

		if (a[mid] >= k) {
			ok = mid;
			continue;
		}

		vector<bool> b(k, false);
		b[0] = true;
		REP(i, mid) {
			for (int j = k - 1; j >= a[i]; j--) {
				if (b[j - a[i]])b[j] = true;
			}
		}
		FOR(i, mid+1, n) {
			for (int j = k - 1; j >= a[i]; j--) {
				if (b[j - a[i]])b[j] = true;
			}
		}
		bool bb = false;
		for (int i = k - 1; i >= max(0LL, k - a[mid]); i--) {
			if (b[i])bb = true;
		}
		if (bb)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	long long sum=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){
			sum+=i;
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
    int h,w,d;
    cin>>h>>w>>d;
    int x[90001];
    int y[90001];
    int a;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>a;
            x[a]=j,y[a]=i;
        }
    }
    int sum[90001];
    for(int i=1;i<=d;i++){
        sum[i]=0;
    }
    for(int i=d+1;i<=h*w;i++){
        sum[i]=sum[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d]);
    }
    int q;
    cin>>q;
    int L[q],R[q];
    for(int i=0;i<q;i++)
    {
        cin>>L[i]>>R[i];
        cout<<sum[R[i]]-sum[L[i]]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2944
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

int main(){
  long long N,A,B;
  cin >> N >> A >> B;
  long long add=A+B;
  if(A==0 && B==0){
    cout << 0 << endl;
    return 0;
  }
  long long loop=N/add;
  long long plus=N%add;
  long long ret=A*loop;

  if(loop==0){
    if(N>=A) ret=A;
    else ret=N;
  }
  else if(loop==1){
    ret=A;
    if(plus>=A) ret+=A;
    else ret+=plus;        
  }
  else{
    ret=A*loop;
    if(plus>=A) ret+=A;
    else ret+=plus;    
  }
  
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC154C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] A = new int[N];
            for(int i = 0; i < N; i++)
            {
                A[i] = int.Parse(input[i]);
            }
            int m = A.Max();
            bool[] seen = new bool[m];
            bool hantei = true;
            for(int i = 0; i < N; i++)
            {
                if (seen[A[i]-1] == true)
                {
                    hantei = false;
                }
                else
                {
                    seen[A[i]-1] = true;
                }
            }
            if (hantei == true)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 587748
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - 1e8;
const ll INFLL = numeric_limits<ll>::max() - 1e17;

int main() {
    int N;
    cin >> N;
    vector<int> P(N + 1);
    for (int i = 1; i <= N; i++) cin >> P[i];
    int left = 0, right = 0;
    vector<int> temp(N + 1);
    copy(P.begin(), P.end(), temp.begin());
    for (int i = 1; i < N; i++) if (temp[i] == i) {
        swap(temp[i], temp[i + 1]);
        left++;
    }
    left += (temp[N] == N);
    copy(P.begin(), P.end(), temp.begin());
    for (int i = N; i > 1; i--) if (temp[i] == i) {
        swap(temp[i - 1], temp[i]);
        right++;
    }
    right += (temp[1] == 1);
    cout << min(left, right) << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define pai 3.1415926535


int main(void) {
	int X;
	scanf("%d", &X);
	int count = 0;

	int a = X / 100;	

	if (a*5<X%100) {
		printf("%d", 0);
	}
	else {
		printf("%d", 1);
	}
	

	return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        StringBuilder other = new StringBuilder();

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != 'x') other.append(s.charAt(i));
        }
        if (!isPalin(other.toString())) System.out.println(-1);
        else {
            System.out.println(additions(s));
        }
    }

    private static boolean isPalin(String s){
        int upto = s.length() % 2 == 0?s.length()/2 - 1:s.length()/2;

        for (int i = 0; i <= upto; i++) {
            if (s.charAt(i) != s.charAt(s.length() - i - 1)) return false;
        }
        return true;
    }

    private static int additions(String s){
        int i = 0;
        int j = s.length() - 1;
        int count = 0;

        while (i < j){
            if(s.charAt(i) == s.charAt(j)){
                i++;
                j--;
            }
            else if (s.charAt(i) == 'x'){
                i++;
                count++;
            }
            else {
                j--;
                count++;
            }
        }

        return count;
    }
}


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

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

    int ans = min(abs(b-c) + abs(a-b), min(abs(c-a) + abs(b-c), abs(a-b) + abs(c-a)));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int x, t;
  cin >> x >> t;
  out(max(0, x - t));
}
int main(void) { solve(); }


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int H, W, h, w;
int main() {
  cin >> H >> W >> h >> w;

  if ((H % h) == 0 && (W % w) == 0) {
    cout << "No" << endl;
    return 0;
  } 

  cout << "Yes" << endl;
  bool rev = false;
  if ((H % h) == 0) {
    swap(W, H);
    swap(w, h);
    rev = true;
  }
  assert(H % h > 0);

  int c1 = 1 + 300000;
  int c2 = -h + (1 - h) * 300000;


  if (rev) {
    for(int j  = 0; j < W; ++j) {
      for(int i = 0; i < H; ++i) {
        if ((i % h) == h - 1) {
          cout << c2 << ' ';
        } else {
          cout << c1 << ' ';
        }
      }

      cout << '\n';
    }

    return 0;
  }

  // else
  for(int i = 0; i < H; ++i) {
    if ((i % h) == h - 1) {
      for(int j = 0; j < W; ++j) {
        cout << c2 << ' ';
      }
    } else {
      for(int j = 0; j < W; ++j) {
        cout << c1 << ' ';
      }
    }

    cout << '\n';
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

const int MAX = 2e5+10;

ll H, W, N, X[MAX], Y[MAX];
vi hol[MAX];
set<ll> obsts;

ll solve() {
    swap(H, W);
    REP (i, N) {
        hol[Y[i]].push_back(X[i]);
        obsts.insert(X[i] * MAX + Y[i]);
    }

    ll ans = W, x = 0;
    FOR (h, 1, H+1) hol[h].push_back(W+1);
    FOR (h, 1, H+1) {
        sort(ALL(hol[h]));
        do { x++; } while (x <= W && obsts.find(x * MAX + h) != obsts.end());
        if (x > W) return ans;
        CHMIN(ans, *upper_bound(ALL(hol[h]), x) - 1);
    }
    return ans;
}

int main() {
    cin >> H >> W >> N;
    REP (i, N) cin >> X[i] >> Y[i];
    cout << solve() << endl;
}

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

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

	int X;
	vector<vector<int>> vec(N, vector<int>(D));

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			cin >> X;
			vec.at(i).at(j) = X;
		}
	}

	int count = 0;

	for (int i = 0; i < N-1; i++) {
		for (int k = i + 1; k < N; k++) {
			double val = 0;

			for (int j = 0; j < D; j++) {

				val += pow((vec.at(i).at(j) - vec.at(k).at(j)), 2);
			}
			val = sqrt(val);
			if (val == int(val)) {
				count++;
			}
		}
	}
		
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i<n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%lld", &v[i]);
#define vstr(v,n) vector<string> v(n); REP(i,n) scanf("%lld", &v[i]);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    cin >> n;
    vint(V, n);
    vint(C, n);
    REP(i,n){
        if(V[i]>C[i])
            ans += V[i] - C[i];
    }
    cout << ans;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
long long n,x,j=1,ans,a[200001],b[200001];
inline long long read()
{
   long long sum=0,x=1;
   char ch=getchar();
   while (ch<'0'||ch>'9')
   {
       if (ch=='-')
	     x=-1;
	   ch=getchar();
   }
   while (ch>='0'&&ch<='9')
   {
   	   sum=sum*10+ch-'0';
	   ch=getchar();
   }
   return sum*x;
}
inline void write(long long x)
{
    if (x<0)
	{
        putchar('-');
        x=-x;
    }
    if (x>9)
      write(x/10);
    putchar(x%10+'0');
    return;
}
int main()
{
	n=read();
	for (register int i=1;i<=n;++i)
	{
		x=read();
		a[i]=a[i-1]^x;
		b[i]=b[i-1]+x;
	}
	for (register int i=1;i<=n;++i)
	{
		while ((a[i]^a[j-1])!=(b[i]-b[j-1]))
		  ++j;
		ans=ans+(i-j+1);
	}
	write(ans);
	return 0;
}

Measured memory_bytes: 6684
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }

        int cnt = 0;
        while (true) {
            int nax = 0;
            for (int i = 0; i < n; i++) {
                nax = Math.max(nax, as[i]);
            }
            // System.err.println(nax);
            if (nax == 0) break;
            int stat = 0;
            for (int i = 0; i < n; i++) {
                if (stat <= 1 && as[i] == nax) {
                    as[i]--;
                    stat =  1;
                } else if (stat == 1 && as[i] != nax) {
                    break;
                }
            }
            cnt++;
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    vector<string> weeks = {"sat", "sun", "mon", "tue",  "wed", "thu", "fri"};
    int X;
    cin >> X;
    int i = ((X - 9) + 14) % 7;
    
    cout << weeks[i] << endl;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  int n,q;
  cin>>n>>q;
  vector<priority_queue<int> > s(n);
  for(int i=0;i<q;i++){
    int t,a;
    cin>>t>>a;
    if(t==0){
      int x;
      cin>>x;
      s[a].emplace(x);
    }
    if(t==1) if(!s[a].empty()) cout<<s[a].top()<<endl;
    if(t==2) if(!s[a].empty()) s[a].pop();
  }
  return 0;
}



Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
#define rll register ll
const int N=45;
char e[N][N];
int n;
ll f[N][N][N],g[N][N][N];
inline void modify(ri i,ri j,ri k){
	for(ri p=j+1;p<n;++p)
		if(e[p][k])
			g[i][j][p]+=f[i][j][k];
}
int main(){
	ri l,i,j,k,p,q,y;
	rll res,ans;
	scanf("%d",&n);
	n<<=1;
	for(i=1;i<=n;++i){
		scanf("%s",e[i]+1);
		for(j=1;j<=n;++j)
			e[i][j]&=15;
	}
	if(n==2) return printf("%d\n",e[1][2]),0;
	for(i=1;i<=n;++i) f[i][i][i]=1,modify(i,i,i);
	for(i=1;i+2<=n;++i)
		if(e[i][i+2])
			f[i][i+2][i+1]=1,modify(i,i+2,i+1);
	for(l=4;l<n;++l)
		for(i=1;(j=i+l-1)<=n;++i){
			for(p=i;p<=j-2;++p)
				for(q=p+2;q<=j;++q){
					res=0;
					for(y=(q!=j);y<=j-(q!=j);++y)
						res+=g[i][p][y]*f[q][j][y];
					for(k=p+1;k<q;++k)
						f[i][j][k]+=res*f[p+1][q-1][k];
				}
			for(k=i+1;k<j;++k)
				modify(i,j,k);
		}
	ans=0;
	for(i=1;i<n;++i)
		if(e[n][i])
			ans+=f[1][n-1][i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1152
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        x:i64,
    }
    pub fn yn(ans: bool) {
        if ans {
            println!("Yes");
        } else {
            println!("No");
        }
    }
    yn(x >= 30);
}


Measured memory_bytes: 2160
S = input()
Q = int(input())
P = [input().split() for i in range(Q)]

count = 0
left = ""
right = ""
for query in P:
    if query[0]=="1":
        count+=1
    else:
        if query[1]=="1":
            if count%2==0:
                left+=query[2]
            else:
                right+=query[2]
        else:
            if count%2==0:
                right+=query[2]
            else:
                left+=query[2]
                
S = left[::-1]+S+right
if count%2==1:
    S=S[::-1]
    
print(S)

Measured memory_bytes: 40436
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;

bool check_like(int i){
  for(int j = 2;j * j <= i;j++){
    if(i % j == 0 || (i+1)/2 % j == 0)return false;
  }
  return true;
}

int main(){
  ll cnt[100010];//cnt[i]:i以下の数で2017-likeなものの個数の総和

  cnt[0] = 0;
  cnt[1] = 0;

  for(int i = 2;i <= 100010;i++){
    if(i % 2 == 1 && check_like(i) == true){
      cnt[i] = cnt[i-1] + 1;
    }
    else cnt[i] = cnt[i-1];
  } 

  int Q;
  cin >> Q;

  vector<int> ans(Q);
  for(int i = 0;i < Q;i++){
    int l,r;
    cin >> l >> r;
    ans[i] = cnt[r] - cnt[l-1]; 
  }

  for(int i = 0;i < Q;i++)cout << ans[i] << endl;
}

Measured memory_bytes: 1792
N=gets.to_i
A=gets.split.map(&:to_i)
A.sort!
temp=0
acc=A.map{|a| temp+=a}
ans=1
(N-2).downto(0) do |i|
	if acc[i]*2>=A[i+1]
		ans+=1
	else
		break
	end
end

puts ans

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

int main(){

    int a,b,c;
    cin >> a;
    c=a%60;
	a-=c;
	a/=60;
    b=a%60;
	a-=b;
	a/=60;

    
    cout << a << ":" << b << ":" << c << endl;

    return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int n, m;
  cin >> n >> m;
  long long int ans;
  if(n*2>=m) ans = m/2;
  else ans = n+(m-n*2)/4;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256