akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define all(container) container.begin(), container.end()
using namespace std;
typedef pair<int, int> P;
const int INF = 1e9;

int main() {
  int n, a, b, max, min;
  cin >> n >> a >> b;
  if (a + b < n) {
    min = 0;
  } else {
    min = a + b - n;
  }
  max = a < b ? a : b;

  cout << max << " " << min << endl;

  return 0;
}


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

int n;
string s = "####################";
int main(){
	while(cin >> n){
		int H[5][4][11] = {{{0}}};
		for(int i=0;i<n;i++){
			int b,f,r,v;
			cin >> b >> f >> r >> v;
			H[b][f][r] += v;
		}
		for(int i=1;i<=4;i++){
			for(int j=1;j<=3;j++){
				for(int k=1;k<=10;k++){
					if(k!=10) cout << " " << H[i][j][k];
					else cout << " " << H[i][j][k] << endl;
				}
			}
			if(i!=4) cout << s << endl;
		}
	}
}


Measured memory_bytes: 3204
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////
int main(){
    string s;
    cin >> s;
    int S = s.size();
    if (s[S-1] != 's'){
        s = s + 's';
    }
    else {
        s = s + 'e';
        s = s + 's';
    }

    cout<< s << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,0,n) cin >> a[i];
  ll ans = a[0];
  rep(i,1,n) {
    ans = gcd(ans,a[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3964
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()

c = str_inp()
r_amount = c.count("R")
ans = 0
for i in range(r_amount):
    if c[i] == "W":
        ans += 1
print(ans)


Measured memory_bytes: 78332
h, w, d = map(int,input().split())
a = [list(map(int,input().split()))for _ in range(h)]
pos = dict()
for i in range(h):
  for j in range(w):
    pos[a[i][j] - 1] = (i, j)
dis = [[0] for _ in range(d)]
for i in range(d):
  num = i
  while num < h * w - d:
    p = pos[num]
    nextp = pos[num + d]
    dis[i - 1].append(abs(nextp[0] - p[0]) + abs(nextp[1] - p[1]))
    num += d
for i in range(d):
  for j in range(len(dis[i])-1):
    dis[i][j + 1] += dis[i][j]
q = int(input())
for i in range(q):
  l, r = map(lambda x:int(x)-1, input().split())
  print(dis[l % d - 1][r // d] - dis[l % d - 1][l // d])

Measured memory_bytes: 69724
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(H, W, inputs):
    S = inputs
    for _ in range(W+2):
        print('#', end='')
    print('')

    for s in S:
        print('#', end='')
        print(s, end='')
        print('#')

    for _ in range(W+2):
        print('#', end='')
    print('')


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [H, W] = string_to_int(input())
    ret = solve(H, W, inputs(H))
    # print(ret)


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

int main(){
	int x, a, b, c;
	cin >> a >> b >> c >> x;
	int count = 0;
	for(int i = 0; i <= a; i++)
		for(int j = 0; j <= b; j++)
			for(int k = 0; k <= c; k++)
				if(i*500+j*100+k*50==x) count++;
	cout << count;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int x1 = sc.nextInt();
      int y1 = sc.nextInt();
      int x2 = sc.nextInt();
      int y2 = sc.nextInt();
      System.out.println(solve(x1, y1, x2, y2));
    }
  }

  public static String solve(int x1, int y1, int x2, int y2) {
    int[] r = new int[4];
    int d1 = y1 - y2;
    int d2 = x1 - x2;
    r[0] = x2 + d1; 
    r[1] = y2 - d2;
    r[2] = r[0] + d2;
    r[3] = r[1] + d1;
    return String.format("%d %d %d %d\n", r[0], r[1], r[2], r[3]);
  }
}


Measured memory_bytes: 22860
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)

vector<int> graph[200001];
ll ans[200001];

void dfs(int n, int value, int parent) {
  ans[n] += value;
  rep(i, graph[n].size()) {
    if (graph[n][i] != parent) {
      dfs(graph[n][i], ans[n], n);
    }
  }
}

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

  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  rep(i, q) {
    int p, x;
    cin >> p >> x;
    ans[p] += x;
  }

  dfs(1, 0, 0);

  rep(i, n) {
    cout << ans[i+1] << endl;
  }
}



Measured memory_bytes: 30464
function Main(input) {
  input = input.split("\n");
  N=parseInt(input[0]);
  C = new Array(N);
  var b =0;
  for(var i=0;i<N;i++){
    tmp=input[i+1].split(" ");
    C[i]=parseInt(tmp[0])+parseInt(tmp[1]);
    b-=parseInt(tmp[1]);
  }
  C.sort(function(a,b){return b-a});
  for(var i=0;i<N;i++){
    if(i%2==0){
      b+=C[i];
    }
  }
  var ans=b;

  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31100
import Control.Applicative
main = do
    [a,b,c] <- map read . words <$> getLine
    let
        c' = c*pi/180
    print $ a*b*sin c' / 2
    print $ a + b + sqrt (a^2 + b^2 - 2*a*b*cos c')
    print $ b*sin c'

Measured memory_bytes: 4156
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		Dice dice=new Dice(scan.nextInt(),scan.nextInt(),scan.nextInt(),scan.nextInt(),scan.nextInt(),scan.nextInt());
		String str=scan.next();
		for(int i=0;i<str.length();i++) {
		if(str.charAt(i)=='E') {
			dice.TrunE();
		}else if(str.charAt(i)=='W') {
			dice.TrunW();
		}else if(str.charAt(i)=='S') {
			dice.TrunS();
		}else if(str.charAt(i)=='N') {
			dice.TrunN();
		}else {
			System.out.println("入力ミス");
		}
		}
		System.out.println(dice.Top);
}
}

class Dice{
	int Top;
	int E;
	int W;
	int S;
	int N;
	int bottom;
	Dice(int a,int b,int c,int d,int e,int f){
		Top=a;
		E=c;
		W=d;
		S=b;
		N=e;
		bottom=f;
	}
	public void TrunE() {
		int tmp;
		tmp=Top;
		Top=W;
		W=bottom;
		bottom=E;
		E=tmp;
	}public void TrunW() {
		int tmp;
		tmp=Top;
		Top=E;
		E=bottom;
		bottom=W;
		W=tmp;
	}public void TrunS() {
		int tmp;
		tmp=Top;
		Top=N;
		N=bottom;
		bottom=S;
		S=tmp;
	}public void TrunN() {
		int tmp;
		tmp=Top;
		Top=S;
		S=bottom;
		bottom=N;
		N=tmp;
	}
}


Measured memory_bytes: 26396
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cstring>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  Point operator + (Point v) { return Point(x + v.x, y + v.y); }
  Point operator - (Point v) { return Point(x - v.x, y - v.y); }
  bool operator == (const Point &v) const {
    return x == v.x && y == v.y;
  }
  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N, M;
vector<Int> D(3, -1);

bool input() {
  cin >> N >> M;
  Int a, b;
  loop(n,0,M) {
    cin >> a >> b;
    a--;
    if (D.at(a) >= 0 && D.at(a) != b) {
      cout << "-1" << endl;
      return false;
    }

    D.at(a) = b;
  }
  return true;
}

bool ok(int n) {
  string s = to_string(n);
  if (s.size() != N) return false;
  loop(d_i,0,N) {
    int d = D.at(d_i);
    if (d == -1) continue;
    if (s.at(d_i) - '0' != d) return false;
  }
  return true;
}

void solve() {
  Int min_ = 1000;
  loop(n,0,1000) {
    if (ok(n)) min_ = min(min_, n);
  }

  if (min_ == 1000) cout << -1 << endl;
  else cout << min_ << endl;
}

int main() {
  bool r = input();
  if (r) solve();
  return 0;
}


Measured memory_bytes: 256
# C - Many Medians
# https://atcoder.jp/contests/abc094/tasks/arc095_a

n = int(input())
X = list(map(int, input().split()))

sortedX = sorted(X)

l = sortedX[n // 2 - 1]
r = sortedX[n // 2]

for x in X:
  if x <= l:
    print(r)
  else:
    print(l)

Measured memory_bytes: 26016
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int k = sc.nextInt(), n = sc.nextInt();
		int[] p = new int[n], b = new int[n];
		p[0] = sc.nextInt();
		for(int i = 1; i < n; i++) {
			p[i] = sc.nextInt();
			b[i] = p[i] - p[i-1];
		}
		b[0] = k - p[n-1] + p[0];
		Arrays.sort(b);
		System.out.println(k - b[n-1]);
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 56328
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    string s;
    cin>>s;
    
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout<<-1<<endl;
    }
    else if(s.size()==26){
        rrep(i,26,0){
            char c=s.at(i);
            char tmp='{';
            rep(j,i+1,26){
                if(s.at(j)>c && s.at(j)<tmp) tmp=s.at(j);
            }
            if(tmp!='{'){
                string ans;
                rep(j,0,i) ans+=s.at(j);
                ans+=tmp;
                cout<<ans<<endl;
                break;
            }
        }
    }
    else{
        vector<bool> use(26);
        rep(i,0,s.size()) use.at(s.at(i)-'a')=true;
        rep(i,0,26){
            if(use.at(i)==false){
                s+='a'+i;
                break;
            }
        }
        cout<<s<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, y; cin >> x >> y;
    set<int> A[3] = {{1, 3, 5, 7, 8, 10, 12},
                     {4, 6, 9, 11}, {2}};

    string res = "No";
    for(auto& s : A){
        if(s.find(x) != end(s) and
           s.find(y) != end(s)){
            res = "Yes";
        }
    }
    cout << res << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, k, d, a;
  int A[101] = {0};
  cin >> n >> k;
  rep(i, k) {
    cin >> d;
    rep(j, d) cin >> a, A[a]++;
  }

  int ans = 0;
  for (int i = 1; i <= n; ++i)
    if (A[i] == 0) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    auto s = readln.chomp;
    auto t = s.take(s.length - 8);
    writeln(t);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>

using namespace std;

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

  int ans = 0;

  if (K % 2 == 0) {
    ans = (K / 2) * (K / 2);
  } else {
    ans = (K / 2) * (K / 2 + 1);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
#define ALL(a) a.begin(),a.end()
int main(){
  int n;
  while( cin >> n , n ){
    set< int > p[n],L,tmp;
    for(int i = 0, q, d ; i < n ; i++ ){
      cin >> q;
      while(q--) cin >> d, p[i].insert(--d);
    }
    int K, l, ans = -1, i;
    cin >> K;
    while(K--) cin >> l, L.insert(--l);
    for( i = 0 ; i < n ; i++ ){
      if(includes(ALL(p[i]),ALL(L))){
        if(ans == -1) ans = i + 1;
        else break;
      }
    }
    cout << (i == n ? ans : -1) << endl;
  }
}

Measured memory_bytes: 1628
# coding: utf-8

n = int(input())
A = list(map(int, input().split()))
mini = 1
c = 0
for i in range(n):
    mini = i
    for j in range(i, n):
        if A[j] < A[mini]:
            mini = j
    A[i], A[mini] = A[mini], A[i]
    if mini != i:
        c += 1

print(" ".join(map(str, A)))
print(c)

Measured memory_bytes: 7668
#include "bits/stdc++.h"
using namespace std;
const int N=1e2+20;
int n,a[N],b[N],ans;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];

	for(int i=1;i+1<n;i++)
	{
		vector <int> v;
		for(int j=i-1;j<=i+1;j++) v.push_back(a[j]);
		sort(v.begin(),v.end());
		if(a[i]==v[1]) ans++;
	}
	cout<<ans;
}

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

int main()
{

  int n,c=0;
  string s1,s2;
  cin>>n>>s1>>s2;
  //int x=0;
 // reverse(s2.begin();s2.end());
  for(int i=0;i<s1.size();i++){
    //cout<<i<<" "<<c<<"------------>";
   if(s1[i]==s2[c]){
    c++;
   }
   else {
    c=0;
    if(i && s2[0]==s1[i]){
    i--;
    }
   }

//cout<<c<<endl;
  }
  cout<<(n*2)-c;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define MAX 100

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void){

	int n, ans;
	int a[MAX];

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

	ans = 1;
	for(int i = 0 ; i < n ; ++i){
		ans = lcm(ans, a[i]);
	}
	cout << ans << endl;
	
	return 0; 
}

int lcm(int t0, int t1){
	return t0 * t1 / gcd(t0, t1);
}

int gcd(int t0, int t1){

	if(t0 < t1){
		swap(t0, t1);
	}

	while(t1 > 0){
		int temp = t0 % t1;
		t0 = t1;
		t1 = temp;
	}
	return t0;
}

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


int main() {
    long double a,b;
    cin>>a>>b;
    long double ans=a*b;
    long int x;
    x=ans;
    cout<<x<<endl;


}


Measured memory_bytes: 3720
# -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = sorted(list(map(int, input().split(' '))))
count = [0] * 100002

for a in array:
    count[a - 1] += 1
    count[a    ] += 1
    count[a + 1] += 1

print(max(count))

Measured memory_bytes: 13964
using System;
public class Hello
{
    public static void Main()
    {
        int i;
        double bup;
        int n = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Trim().Split(' ');
        double[] x = new double[n];
        for (i = 0; i < n; i++)
            x[i] = double.Parse(s[i]);
        
        for(; ; )
        {
            bup = 0;
            for (i = 0; i < n-1; i++)
            {
                if (x[i] > x[i + 1])
                {
                    bup = x[i + 1];
                    x[i + 1] = x[i];
                    x[i] = bup;
                }
            }
            if (bup == 0)
                break;
        }

        for (i = 0; i < n-1; i++)
        {
            x[i+1]= (x[i]+x[i+1])/2.0;
            //Console.WriteLine(x[i-1]);
        }
        Console.WriteLine(x[n-1]);
    }
}

Measured memory_bytes: 13140
#include<stdio.h>

typedef struct test
{
  int h;
  int w;
}test;

int main()
{
  test a[100];
  int count=0;
  scanf("%d%d", &a[count].h, &a[count].w);
  while(a[count].h != 0 || a[count].w != 0)
    {
      count++;
      scanf("%d%d", &a[count].h, &a[count].w);
    }
  for(int i = 0; i<count; i++)
    {
      for(int j = 0; j<a[i].h; j++)
	{
	  for(int k = 0; k<a[i].w; k++)
	    {
	      if((j>0&&j<a[i].h-1)&&(k>0&&k<a[i].w-1))
		{
		  printf(".");
		}
	      else
		{
		  printf("#");
		}
	    }
	  printf("\n");
	}
      printf("\n");
    }
}



Measured memory_bytes: 2124
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int x, y;
	int t;

	for (;;) {
		scanf("%d%d", &x, &y);
		if (x == 0 && y == 0) break;
		if (x > y) t = x, x = y, y = t;
		printf("%d %d\n", x, y);
	}
	return 0;
}



Measured memory_bytes: 2036
n = int(input())
#n, k = list(map(int, input().split()))
# A = list(map(int, input().split()))
#a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# q = int(input())
a = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
count = 0
for i in range(n):
    if i % 2 == 0 and a[i] % 2 != 0:
        count += 1

print(count)


Measured memory_bytes: 9156
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int n, ans = 0;
  cin >> n;
  int b[n-1];
  for (int i = 0; i < n-1; ++i) {
    cin >> b[i];
    if (i == 0) {
      ans += b[i];
    }
    else {
      ans += min(b[i-1], b[i]);
    }
    if (i == n-2) {
      ans += b[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
typedef struct{
  double x;
  double y;
} Point;
 
void koch(int n,Point a,Point b){
  double rad;
  Point s,t,u;
  if (n == 0) return ;
  rad = M_PI*60.0/180.0;
 
  s.x = (2.0*a.x + 1.0*b.x)/3.0;
  s.y = (2.0*a.y + 1.0*b.y)/3,0;
  t.x = (1.0*a.x + 2.0*b.x)/3.0;
  t.y = (1.0*a.y + 2.0*b.y)/3.0;
  u.x = (t.x - s.x)*cos(rad) - (t.y - s.y)*sin(rad) + s.x;
  u.y = (t.x - s.x)*sin(rad) + (t.y - s.y)*cos(rad) + s.y;
 
  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}
 
int main(){
  Point a,b;
  int n;
  scanf("%d",&n);
 
  a.x = 0.0;
  a.y = 0.0;
  b.x = 100.0;
  b.y = 0.0;
 
  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}

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

int main(void)
{
    int n,ans;
    vector<pair<int, int>> a1(100001), a2(100001);

    cin >> n;
    for (int i=1;i<=n;++i) {
        int m;
        cin >> m;
        if (i % 2 == 1) {
            ++a1[m].first;
            a1[m].second = m;
        }
        else {
            ++a2[m].first;
            a2[m].second = m;
        }
    }
    sort(a1.begin(), a1.end(), greater<pair<int,int>>());
    sort(a2.begin(), a2.end(), greater<pair<int, int>>());
    ans = n / 2 - max(a1[0].first, a2[0].first);
    if (a1[0].second != a2[0].second) {
        ans += n / 2 - min(a1[0].first, a2[0].first);
    }
    else {
        ans += n / 2 - max(a1[1].first, a2[1].first);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4648
#include <stdlib.h>
#include <iostream>
#include <climits>
using namespace std;

long merge_sort(int *array, int left, int right);
long merge(int *array, int left, int mid, int right);
int main(){
	int n;

	cin >> n;

	int* array = (int*)malloc(n * sizeof(int));
	long result = 0;

	if(n < 1){
		return 0;
	}

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

	result = merge_sort(array, 0, n);
	cout << result <<endl;
	return 0;
}

long merge_sort(int *array, int left, int right){
	long swap_num = 0;
	if(left+1 < right){
		int mid = (left + right) >> 1;
		swap_num += merge_sort(array, mid, right);
		swap_num += merge_sort(array, left, mid);
		swap_num += merge(array, left, mid, right);
	}

	return swap_num;
}

long merge(int *array, int left, int mid, int right){
	long swap_num = 0;
	int n1 = mid - left;
	int n2 = right - mid;

	int* L = (int*)malloc((n1+1) * sizeof(int));
	int* R = (int*)malloc((n2+1) * sizeof(int));

	for(int i = 0; i < n1; ++i){
		L[i] = array[left + i];
	}
	L[n1] = INT_MAX;
	for(int i = 0; i < n2; ++i){
		R[i] = array[mid + i];
	}
	R[n2] = INT_MAX;

	int i = 0;
	int j = 0;
	for(int k = left; k < right; ++k){
		if(L[i] <= R[j]){
			array[k] = L[i];
			++i;
		}else{
			array[k] = R[j];
			swap_num += mid + j - k;
			++j;
		}
	}
	return swap_num;
}

Measured memory_bytes: 25388
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    vector<vector<int>> G(N);
    for (int i = 0; i < M; i++) {
        int S, T; cin >> S >> T; S--, T--;
        G[S].push_back(T);
    }
    vector<double> X(N), P(N);
    P[0] = 1.0;
    for (int node = 0; node < N; node++) {
        for (auto next : G[node]) {
            P[next] += P[node] / G[node].size();
        }
    }
    X[N - 1] = 0;
    for (int node = N - 2; node >= 0; node--) {
        double sum = 0;
        for (auto next : G[node]) {
            sum += X[next];
        }
        X[node] = 1 + sum / G[node].size();
    }
    double orig = X[0];
    double ans = orig;
    for (int node = N - 2; node >= 0; node--) {
        if (G[node].size() == 1) continue;
        double sum = 0;
        double maxval = 0;
        for (auto next : G[node]) {
            sum += X[next];
            maxval = max(maxval, X[next]);
        }
        double ans2 = orig + P[node] * (-sum / G[node].size() + (sum - maxval) / (G[node].size() - 1));
        ans = min(ans, ans2);
    }
    cout << fixed << setprecision(9) << ans << endl;
    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a != b && a != c && b != c) {
    cout << 3 << endl;
  } else if (a == b && b == c) {
    cout << 1 << endl;
  } else {
    cout << 2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
T = [line.split() for line in sys.stdin.readlines()]
res = 0
for i, t in enumerate(sorted([(-int(a) - int(b), int(b)) for a, b in T])):
	if i % 2 == 0:
		res -= t[0]
	res -= t[1]

print(res)


Measured memory_bytes: 89308
import sys
N, L = map(int, input().split())
tastes = [ L+x for x in range(N) ] 

if 0 in tastes:
    print(sum(tastes))
    sys.exit(0)
    

if L<0:
    absmin = max(tastes)
    print(sum(tastes)-absmin)
elif L>0:
    absmin = min(tastes)
    print(sum(tastes)-absmin)


Measured memory_bytes: 9104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner cin = new Scanner(System.in);
		
		Double L = cin.nextDouble();
		
		Double w = L/3;
		
		Double ans = w*(w-L)*(w-L)/4;
		
		System.out.println(ans);
		
	}

}


Measured memory_bytes: 23124
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

long long int func(int x){
	int ans=0;
	while(x>0){
		ans+=x%10;
		x/=10;
	}
	return ans;
}

int main(){
	int N;
	cin>>N;
	long long int ans=-1;
	for(int i=1;i<N;i++){
		int A=i;
		int B=N-i;
		if(ans==-1){
			ans=func(A)+func(B);
		}else{
			ans=min(ans,func(A)+func(B));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
using namespace std;
#define ll long long
#define INF 1000000007
using P = pair<int, int>;
int main(){
    int n;
    cin>>n;
    vector<P> a(n);
    vector<int> h(n);
    int dx=0,dy=0,dh=0;
    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second>>h[i];
        if(h[i]>0){
            dx=a[i].first;
            dy=a[i].second;
            dh=h[i];
        }
    }
    bool finish=false;
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            int H=dh+abs(dx-i)+abs(dy-j);
            bool s=true;
            for(int k=0;k<n;k++){
                if(max(H-abs(a[k].first-i)-abs(a[k].second-j),0)!=h[k]){
                    s=false;
                    break;
                }
            }
            if(s==true){
                cout<<i<<" "<<j<<" "<<H<<endl;
                finish=true;
                break;
            }
        }
        if(finish==true)break;
    }
    return 0;
}


Measured memory_bytes: 256
X,Y,A,B,C = map(int, input().split())

p_dat = list(map(int, input().split()))
q_dat = list(map(int, input().split()))
r_dat = list(map(int, input().split()))

p_max_list = sorted(p_dat, reverse=True)
p_max_list = p_max_list[0:X]
q_max_list = sorted(q_dat, reverse=True)
q_max_list = q_max_list[0:Y]

join_list = p_max_list + q_max_list + r_dat
join_list = sorted(join_list, reverse=True)
join_list = join_list[0:(X+Y)]

print(sum(join_list))

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

#define N_MAX 100

int main() {
	int N, K,d[N_MAX],A[N_MAX][N_MAX], sum=0;
	bool flag = false;
	cin >> N >> K;
	for (int i = 0;i < K;i++) {
		cin >> d[i];
		for (int j = 0;j < d[i];j++) {
			cin >> A[i][j];
		}
	}
	for (int t = 1;t <= N;t++) {
		for (int i = 0;i < K;i++) {
			for (int j = 0;j < d[i];j++) {
				if (A[i][j] == t) {
					flag = true;
				}
			}
		}
		if (flag == false) {
			sum++;
		}
		flag = false;
	}
	cout << sum;
}

Measured memory_bytes: 3228
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
#define pai 3.1415926535897932384626433832795028841971693
long long min(long long a, long long b){
    if(a < b) return a;
    else return b;
}
long long max(long long a, long long b){
    if(a < b) return b;
    else return a;
}
int main(){
 int x[5];
  for(int i=0;i<5;i++){
  scanf("%d",&x[i]);
  }
  for(int i=0;i<5;i++){
    if(x[i]==0){
      printf("%d",i+1);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 1680
from collections import deque

n, m = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(m):
    L, R, D = map(int, input().split())
    tree[L - 1].append((R - 1, D))
    tree[R - 1].append((L - 1, -D))
visited = [None for _ in range(n)]


def bfs(u):
    q = deque([[u, 0]])
    visited[u] = 0
    while q:
        u, dist = q.popleft()
        for next_u, d in tree[u]:
            next_x = dist + d
            if visited[next_u] is None:
                visited[next_u] = next_x
                q.append([next_u, next_x])
            elif visited[next_u] == next_x:
                continue
            else:
                print("No")
                exit()


for i in range(n):
    if visited[i] is None:
        bfs(i)
else:
    print('Yes')


Measured memory_bytes: 73764
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

bool is_month(int x){
    return 1<=x && x<=12;
}

int main(){
    int N;
    cin>>N;
    vi color(N,-1);
    vvi nei_odd(N);
    vvi nei_even(N);
    for(int i=0;i<N-1;i++){
        int u,v,w;
        cin>>u>>v>>w;
        u--;v--;
        if(w%2){
            nei_odd[u].push_back(v);
            nei_odd[v].push_back(u);
        }else{
            nei_even[u].push_back(v);
            nei_even[v].push_back(u);
        }
    }
    queue<int> Q;
    Q.push(0);
    color[0]=0;
    while (!Q.empty()){
        int qt=Q.front();
        Q.pop();
        int L=nei_odd[qt].size();
        for(int i=0;i<L;i++){
            if(color[nei_odd[qt][i]]>=0)continue;
            color[nei_odd[qt][i]]=1-color[qt];
            Q.push(nei_odd[qt][i]);
        }
        L=nei_even[qt].size();
        for(int i=0;i<L;i++){
            if(color[nei_even[qt][i]]>=0)continue;
            color[nei_even[qt][i]]=color[qt];
            Q.push(nei_even[qt][i]);
        }
    }
    for(int i=0;i<N;i++){
        cout<<color[i]<<endl;
    }
}


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

int main(){
	int n, x;
	scanf("%d%d", &n, &x);
	if (x == 1 || x == 2 * n - 1){
		puts("No");
		return 0;
	}
	puts("Yes");
	int begin = 1 + (x + n - 1) % (2 * n - 1);
	for (int i = 0; i < 2 * n - 1; ++ i){
		printf("%d\n", begin);
		++ begin;
		begin -= begin > 2 * n - 1 ? 2 * n - 1 : 0;
	}
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;
const int INF = 1 << 29;
int n,m,c,s,g;
string IntToString(int);
int StringToInt(string);

void wf(vector<vector<int> > &dis){
  
  for(int k = 0;k < n;k++){
    for(int i = 0;i < n;i++){
      for(int j = 0;j < n;j++){
	dis[i][j] = min(dis[i][k]+dis[k][j],dis[i][j]);
      }
    }
  }
}
int calc(int p,const vector<int> &q,const vector<int> &r,int dis){
  
  if(dis == INF)return INF;
  if(p == 1)return dis*r[0];
  int cost = 0;
  int keepI = 0;
  for(int i = 1;i < p;i++){
    if(q[i] <= dis){
      cost += (q[i]-q[i-1])*r[i-1];
      keepI = i;
    }
  }
  int current = q[keepI]+1;
  while(dis >= current){
    cost += r[keepI];
    current++;
  }
  return cost;
}
int main(){
  while(1){

    cin >> n >> m >> c >> s >> g;
    
    if(!(n | m | c | s | g)){
      break;
    }
    s--;g--;
    //    vector<vector<int> > dis(n,vector<int>(n,INF));
    //vector<vector<int> > company(n,vector<int>(n,-1));
    vector<vector<vector<int> > > dis(c,vector<vector<int> >(n,vector<int>(n,INF)));
    for(int i = 0;i < m;i++){
      int x,y,dt,ct;
      cin >>x>>y>>dt>>ct;
      dis[ct-1][y-1][x-1] = min(dt,dis[ct-1][y-1][x-1]);
      dis[ct-1][x-1][y-1] = min(dt,dis[ct-1][x-1][y-1]);
      
    }
    vector<int> p(c);
    
    for(int i = 0;i < c;i++){
      cin >> p[i];
    }
    vector<vector<int> > q(c);
    vector<vector<int> > r(c);

    for(int i = 0;i < c;i++){
      q[i].push_back(0);
      for(int j = 0;j < p[i]-1;j++){
	int tmpQ;
	cin >> tmpQ;
	q[i].push_back(tmpQ);
      }

      for(int j = 0;j < p[i];j++){
	int tmpR;
	cin >> tmpR;
	r[i].push_back(tmpR);
      }
    }
    for(int i = 0;i < c;i++){
      wf(dis[i]);
    }/*
    for(int i = 0;i < c;i++){
      cout << "c = " << i <<endl;
      for(int k = 0;k < n;k++){
	for(int l = 0;l < n;l++){
	  cout << dis[i][k][l] <<  " ";
	}
	cout << endl;
	
      }
      }*/

      

  
    vector<vector<int> > cost(n,vector<int>(n,INF));
    for(int i = 0;i < c;i++){
      for(int j = 0;j < n;j++){
	for(int k = 0;k < n;k++){
	  cost[j][k] = min(cost[j][k],calc(p[i],q[i],r[i],dis[i][j][k]));
	}
      }
    }
    /*  for(int k = 0;k < n;k++){
      for(int l = 0;l < n;l++){
	cout << cost[k][l] <<  " ";
      }
      cout << endl;
      
      }*/
    wf(cost);
    if(cost[s][g] == INF)cout << "-1" << endl;
    else cout << cost[s][g] << endl;
  }
  return 0;   
}
string IntToString(int number){
  stringstream ss;
  ss << number;
  return ss.str();
}
int StringToInt(string number){
  stringstream ss;
  ss << number;
  int numInt;
  ss >> numInt;
  return numInt;
  
}

Measured memory_bytes: 2064
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Queue;
import java.util.ArrayDeque;

import static java.lang.System.out;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int n = in.nextInt();
            
            List<Set<Integer>> g = new ArrayList<>();
            for (int i = 0; i < n; i++)
                g.add(new HashSet<>());

            Queue<Integer> q = new ArrayDeque<>();
            Map<Integer, Integer> mm = new HashMap<>();
            for (int i = 0; i < n; i++)
                mm.put(i, 0);
            
            int m = in.nextInt();
            for (int i = 0; i < m; i++) {
                int f = in.nextInt();
                int t = in.nextInt();

                g.get(f).add(t);
                mm.replace(t, mm.get(t)+1);
            }

            for (Map.Entry<Integer, Integer> e : mm.entrySet()) {
                if (e.getValue() == 0)
                    q.add(e.getKey());
            }

            while (!q.isEmpty()) {
                int v = q.remove();
                out.printf("%d\n", v);

                for (int vv : g.get(v)) {
                    int d = mm.get(vv)-1;

                    if (d == 0)
                        q.add(vv);
                    mm.replace(vv, d);
                }
            }
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
}

Measured memory_bytes: 80520
d, g = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for i in range(d)]
def dfs(d_, g_):
    if d_ == 0:
        return float("inf")
    cnt = min(g_ // (d_ * 100), pc[d_][0])
    cur = cnt * 100 * d_
    if cnt == pc[d_][0]:
        cur += pc[d_][1]
    if g_ > cur:
        cnt += dfs(d_ - 1, g_ - cur)
    return min(cnt, dfs(d_ - 1, g_))
print(dfs(d, g))


Measured memory_bytes: 9148
#include <bits/stdc++.h>
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 DEBUG
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
    int n,k;
    cin>>n>>k;
    long long cnt=0;
    for (int b = 1; b <= n; b++)
    {
        if(k!=0){
            cnt+=max(0LL,b-k)*(n/b)+max(n%b-(k-1),0LL);
           // cerr<<max(0LL,b-k)*(n/b)+max(n%b-(k-1),0LL)<<endl;
    }
        else{
            cnt+=n;
        }
    }
    cout<<cnt<<endl;
    
    return 0;
}


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

typedef pair<int,int> P;
typedef vector<P>Vec;

int v,e;
Vec Edge[15];
int memo[1<<16][15];
int solve(int bit,int now);

int main(){
  memset(memo,-1,sizeof(memo));
  int s,t,d;
  cin>>v>>e;
  for(int i=0;i<e;i++){
    cin>>s>>t>>d;
    Edge[s].push_back(P(t,d));
  }
  int ans=solve(0,0);
  if(ans==(1<<30))cout<<"-1"<<endl;
  else cout<<ans<<endl;
}

int solve(int bit,int now){
  int cost=1<<30;
  if(memo[bit][now]!=-1)return memo[bit][now];
  // ->goal
  if(bit== (1<<v)-1)return 0;
  else if(bit & 1)return cost;
  // <-goal
  
  for(int i=0;i<Edge[now].size();i++){
if((bit & 1 << Edge[now][i].first)==0){
      cost=min(cost,solve(bit | 1 << Edge[now][i].first,Edge[now][i].first)+Edge[now][i].second);
    }
  } 
  return memo[bit][now]=cost;
}

Measured memory_bytes: 5044
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int H = sc.nextInt();
        final int W = sc.nextInt();

        final int h = sc.nextInt();
        final int w = sc.nextInt();

        System.out.println((H - h)*(W - w));
        System.out.flush();
        sc.close();
    }
}


Measured memory_bytes: 25556
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

map<string, int> mp;

int main() {
    int n;  int a[100000];
    cin >> n;
    rep(i, n) {
        cin >> a[i];
    }
    int l = 1, c = 0;
    while (l != 2) {
        l = a[l - 1];
        c++;
        if (c >= n) {
            c = -1;
            break;
        }
  }
    cout << c << endl;
}

Measured memory_bytes: 640
/*
My heart’s beating faster
I know what I’m after
 
I’ve been standing here my whole life
Everything I’ve seen twice
Now it’s time I realized
It’s spinning back around now
On this road I’m crawlin’
Save me 'cause I’m fallin’
Now I can’t seem to breathe right
'Cause I keep runnin' runnin' runnin' runnin'
Runnin' runnin' runnin' runnin'
Runnin' from my heart
*/
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define slow_as_snail ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 
 
const ll mod = 1000000007;
#define mx 10000005
const ll mxi = 100005;

int main()
{
    slow_as_snail;
    ll n,k;
    cin>>n>>k;
    ll ar[n+1] = {0};
    while(k--)
    {
        ll d;
        cin>>d;
        while(d--)
        {
            ll x;
            cin>>x;
            ar[x] = 1;
        }
    }
    ll ans = 0;
    for(int i=1;i<=n;i++)
    {
        if(ar[i]==0)
        {
            ans++;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3612
// C++ program to comput n! % p using Wilson's Theorem 
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
int main() 
{ 
  ll n;
  cin>>n;
  ll a[n];
  ll ans[n]={0};
  for(int i=0 ; i<n ; i++)
    cin>>a[i];
  ll x = a[0];
  for(int i=1 ; i<n ; i++)
    x = a[i]-x;
  ans[n-1] = x/2;
  for(int i=0 ; i<n-1 ; i++)
    ans[i] = a[i]-ans[(i-1+n)%n];
  cout<<2*ans[n-1]<<" ";
  for(int i=0 ; i<n-1 ; i++)
    cout<<2*ans[i]<<" ";
} 


Measured memory_bytes: 2816
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s == "SUN") cout<<7<<endl;
    else if(s == "MON")cout<<6<<endl;
    else if(s == "TUE")cout<<5<<endl;
    else if(s == "WED")cout<<4<<endl;
    else if(s == "THU")cout<<3<<endl;
    else if(s == "FRI")cout<<2<<endl;
    else if(s == "SAT")cout<<1<<endl;
    
}

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 YES_NO(bool f) {
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}

template <typename T>
void deb1(T x) {
  cout << x << "\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 n, x, t;
  cin >> n >> x >> t;
  out((n + x - 1) / x * t);
}
int main(void) { solve(); }

Measured memory_bytes: 3632