akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    vector<int> data(5);
    cin >> data.at(0) >> data.at(1) >> data.at(2) >> data.at(3) >> data.at(4);
    vector<int> p = {0,1,2,3,4};
    int f_ans = INF;
    do{
        int ans = 0;
        rep(i,5){
            while (ans%10 != 0)ans++;
            ans += data[p[i]];
        }
        f_ans = min(f_ans,ans);
    }while(next_permutation(p.begin(),p.end()));
    cout << f_ans << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(lambda c: int(c)-1, input().split()))
V = [-1] * N
i = 0
l = 0
while True:
	if V[i] != -1: break
	V[i] = l
	i = A[i]
	l += 1
	if l == K:
		print(i + 1)
		raise SystemExit
cyc = l - V[i]
K -= V[i]
K %= cyc
for _ in range(K):
	i = A[i]
print(i + 1)


Measured memory_bytes: 91960
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  int X=0;
 cin>>a;
  for(int i=0;i<4;i++){
    if(a[i] == a[i+1]) {
      X++;
    }
  }
 if(X != 0) cout<<"Bad"<<endl;
 else cout<<"Good"<<endl;
  }
  

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
    int m[8],i,n,s,a[4],j;
	while(1){
	    scanf("%d",&n);
		if(n==0) break;
		s=n;
	    for(j=0;j<n;j++){
			for(i=0;i<8;i++){
				scanf("%d",&m[i]);
			}
			a[0]=m[0]*m[4]-m[1]*m[5]-m[2]*m[6]-m[3]*m[7];
			a[1]=m[1]*m[4]+m[0]*m[5]-m[3]*m[6]+m[2]*m[7];
			a[2]=m[2]*m[4]+m[3]*m[5]+m[0]*m[6]-m[1]*m[7];
			a[3]=m[3]*m[4]-m[2]*m[5]+m[1]*m[6]+m[0]*m[7];
			for(i=0;i<4;i++){
				if(i==3) printf("%d\n",a[i]);
				else if(i!=3) printf("%d ",a[i]);
			}
		}
	}
	return 0;
}

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

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

    sort(a , a + n) ;
    ll c , b ;
    c = 0 ;
    b = 0 ;
    ll count = 1 ;
    for(ll j = 0 ; j < n - 1 ; j++ ){
        if(a[j] == a[j + 1] ){
            count ++ ;
            if(count % 2 == 0){
           if(c <= b){
               if(c < a[j]){
               c = a[j] ;
               }
           }else{
               if(b < a[j]){
               b = a[j] ;
               }
           }
            }
        }else{
            count = 1 ;
        }
    }


    cout << b * c << endl;
    return 0 ;
}

 


Measured memory_bytes: 1024
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;
const int SIZE=105;
const double EPS=1e-6;

int w[SIZE],v[SIZE];
long long dp[SIZE][100005];

int main(){
	/*main function start*/
	int n,W;
	scanf("%d%d",&n,&W);
	for(int i=1;i<=n;i++){
		scanf("%d%d",w+i,v+i);
	}
	for(int i=1;i<100005;i++) dp[0][i]=1e12;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=100000;j++){
			dp[i][j]=dp[i-1][j];
			if(j-v[i]>=0) dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
		}
	}
	long long ans=0;
	for(int i=100000;i>=0;i--){
		if(dp[n][i]<=W){
			ans=i;
			break;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 80128
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        t,p,R = LI()
        if t == 0 and p == 0 and R == 0:
            break
        a = [LS() for _ in range(R)]
        r = [[0,0,i] for i in range(1,t+1)]
        gt = collections.defaultdict(int)
        for k in a:
            ti = int(k[0])
            pi = int(k[1])
            time = int(k[2])
            if k[3] == 'WRONG':
                gt[(ti,pi)] += 1
            else:
                r[ti-1][0] += 1
                r[ti-1][1] += gt[(ti,pi)] * 1200 + time

        r.sort(key=lambda x: [-x[0],x[1],x[2]])
        for s,t,ti in r:
            rr.append('{} {} {}'.format(ti, s, t))

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9372
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = unsigned long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

        int n;
    cin >> n;
    ll a[100100];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << "\n";
            return 0;
        }
    }

    ll res = 1;

    for (int i=0; i< n; i++) {

        if (res > (ll)1e18/a[i]) {
            cout << -1 << "\n";
            return 0;
        }
      	res *= a[i];

    }
    cout << res << endl;
}


Measured memory_bytes: 4372
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int[] a = new int[3];
		for(int i = 0 ; i < 3 ; i++) a[i] = Integer.parseInt(sc.next());
		sc.close();
		Arrays.sort(a);
		int yono = 3;
		if(a[0] == a[1]) yono--;
		if(a[1] == a[2]) yono--;
		ou.println(yono);
		ou.flush();
	}
}

Measured memory_bytes: 35644
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <algorithm>
using namespace std;

const int INF = 1 << 30;
const int V = 100000;
const int E = 500000;
struct Edge{ int to, cost; };
vector<Edge> list[E];
typedef pair<int, int> P;
int d[V];

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int v, e, r;
	cin >> v >> e >> r;
	
	int a, b, c;
	for(int i = 0; i < e; ++i){
		cin >> a >> b >> c;
		list[a].push_back(Edge{b, c});
	}
	
	priority_queue<P, vector<P>, greater<P>> pque;
	pque.push(P(0, r));
	fill(d, d + v, INF);
	d[r] = 0;
	
	while(!pque.empty()){
		P p = pque.top();
		pque.pop();
		int v1 = p.second;
		if(d[v1] < p.first) continue;
		
		for(int i = 0; i < list[v1].size(); ++i){
			Edge e1 = list[v1][i];
			if(d[e1.to] > d[v1] + e1.cost){
				d[e1.to] = d[v1] + e1.cost;
				pque.push(P(d[e1.to], e1.to));
			}
		}
	}
	
	for(int i = 0; i < v; ++i){
		if(d[i] != INF)
			cout << d[i] << endl;
		else
			cout << "INF" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 20684
#include <stdio.h>

int main()
{
  int h, m, s;

  scanf("%d",&s);

  m = s / 60;
  h = m / 60;
  m = m % 60;
  s = s % 60;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
} 

Measured memory_bytes: 1828
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <math.h>
#include <iomanip>
#define int long long
//#define int unsigned long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	//char n;
	int a, b, c;
	//int m;
	int h, w;
	int k;
	//string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	//int x, y;

	//string s[111111];
	//string s[100000];
	//string c[7];
	//int a[200000];
	//int b[200000];
	//int a[2000000] = { 0 };
	//int b[2000000] = { 0 };
	//int a[20000] = { 0 };
	//int b[20000] = { 0 };
	//vector<int>a(2000000);
	//vector<int>b(2000000);

	//int aaa = 0;
	//int bbb = 0;

	//int box[1000000000000000000];
	//int box = 0;
	int box[7][7] = { 0 };
	//int box2;
	//int p[1111];

	//long double aaa;

	int count = 0;
	//int k, d;
	//int a = 0;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	bool flag = true;
	//bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	//cin >> n;
	cin >> a >> b >> c;
	cin >> k;
	//cin >> h >> w >> k;
	//cin >> x;
	/*for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> c[i][j];
		}
	}*/

	for (int i = 0; i < k; i++)
	{
		if (a >= b)
		{
			b = b * 2;
		}
		else if (b >= c)
		{
			c = c * 2;
		}
	}

	if (a >= b)
	{
		flag = false;
	}
	if (b >= c)
	{
		flag = false;
	}

	//n = s.length();

	//sort(p, p + n);
	//n = n - 'Z';

	//for (int i = 0; i < 1000; i++)
	//{
	//	if (n < 1000)
	//	{
	//		all = 1000 - n;
	//		break;
	//	}
	//	n -= 1000;
	//	if (n == 0)
	//	{
	//		all = 0;
	//		break;
	//	}
	//}

	//box = n % 26;

	//for (int i = 0; i < k; i++)
	//{
	//	all += p[i];
	//}

	//all = n + (n * n) + (n * n * n);

	/*if (n > 0)
	{
		cout << "a\n";
	}
	else
	{
		cout << "A\n";
	}*/
	//n = t.length();

	/*cout << "AC x " << ac << "\n";
	cout << "WA x " << wa << "\n";
	cout << "TLE x " << tle << "\n";
	cout << "RE x " << re << "\n";*/

	//cout << all << "\n";
	//cout << box << "\n";
	//cout << a << b << c << "\n";

	if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

	//cout << fixed << setprecision(111) << all;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

int main() {
    while(true) {
        static char s1[5000], s2[5000];
        if(scanf("%s %s ", s1, s2) < 2) break;
        //printf("%s, %s\n", s1, s2);
        int s1l = strlen(s1);
        int s2l = strlen(s2);
        int max_len = 0;
        for(int off = -s2l; off <= s1l; off++) {
            int cur_len = 0;
            for(int i = max(0,-off); i < min(s1l,s2l-off); i++) {
                //printf("[%2d,%2d] ", i, i+off);
                //if(s1[i]==s2[i+off]) printf("%c==%c\n",s1[i],s2[i+off]);
                if(s1[i] == s2[i+off])
                    cur_len++;
                else
                    cur_len = 0;
                max_len = max(max_len, cur_len);
            }
            //printf("\n");
        }
        printf("%d\n", max_len);
    }
    return 0;
}

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

char *ptoa(char *p){
  strncpy(p,"apple",5);
  return p+5;
}

char *atop(char *a){
  strncpy(a,"peach",5);
  return a+5;
}

int main(){
  char *p,*q,*r,s[1001];
  int n,i,j;

  fgets(s,1000,stdin);
  r=s;
  while(1){
    p=strstr(r,"apple");
    q=strstr(r,"peach");
    if(p!=NULL && q!=NULL)
      if(p<q) r=atop(p); else r=ptoa(q);
    else if(p!=NULL) r=atop(p);
    else if(q!=NULL) r=ptoa(q);
    else break;
  }
  printf("%s",s);

  return 0;
}

Measured memory_bytes: 524
n = int(input())

ans = 'No'
count = 0

for _ in range(n):
  a,b = list(map(int, input().split()))
  if a == b:
    count += 1
    if count >= 3:
      ans = 'Yes'
      break
  else:
    count = 0
      
print(ans)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define x             first
#define y             second
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define PI            3.14159265358979
#define N             200005

#define lim 10000001
int d[10000001];
void modsieve(){
    for (int i = 2; i <= lim; ++i)
    {
        for (int j = i; j <= lim; j+=i)
        {
            d[j]++;
        }
    }
}
int solve(){
    modsieve();
    int n; cin>>n; int ans=0;
    for(int i=1; i<=n; i++){
        ans+=i*(d[i]+1);
    }
    cout<<ans;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 81732
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

h,w = list(map(int, input().split()))
s = [None]*h
for i in range(h):
    s[i] = input()
start = (0,0)
# 高さh, 幅w
from queue import deque
vals = [None] * (w*h)
q = deque([(0, start)]) # (距離, ノード番号)
vals[start[0]*w+start[1]] = 0
dx = [0,1,0,-1]
dy = [1,0,-1,0]
while q:
    val, (x,y) = q.popleft()
    for i, j in zip(dx,dy):
        xx, yy = x+i, y+j
        if xx<0 or xx>=h or yy<0 or yy>=w or s[xx][yy]=="#":
            continue
        if vals[xx*w+yy] is None:
            vals[xx*w+yy] = val+1
            q.append((vals[xx*w+yy], (xx,yy)))

dist = vals[-1]
if dist is None:
    ans = -1
else:
    ans = (h*w) - (dist+1) - sum(sum(item=="#" for item in ss) for ss in s)
print(ans)

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

vector<vector<bool>> g(10, vector<bool>(10, 0));

int n, m;

int dfs(int v, vector<bool> visit) {
  bool allv = true;
  for (int i = 0; i < n; i++) {
    if (!visit[i]) {
      allv = false;
      break;
    }
  }

  if (allv) {
    return 1;
  }

  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (g[v][i] && !visit[i]) {
      visit[i] = 1;
      sum += dfs(i, visit);
      visit[i] = 0;
    }
  }

  return sum;
}

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

  cin >> n >> m;

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a][b] = 1;
    g[b][a] = 1;
  }

  vector<bool> visit(n);
  visit[0] = 1;
  int ans = dfs(0, visit);

  cout << ans << endl;

  return 0;
}

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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int k;
  cin >> k;
  priority_queue< ul, vector< ul >, greater< ul > > q;
  for (int i=1; i<=9; ++i) {
    q.push(i);
  }
  for (int i=1; i<k; ++i) {
    ul t = q.top();
    q.pop();
    ul l = t%10;
    if (l!=0) q.push(t*10+l-1);
    q.push(t*10+l);
    if (l!=9) q.push(t*10+l+1);
  }
  cout << q.top() << endl;
  return 0;
}


Measured memory_bytes: 2420
n,k=map(int,input().split())
l=list(map(int,input().split()))
l1=[0]*(k+1)
l1[0]=2
for i in l:
    l1[i]=1
for i in range(1,k+1):
    if l1[i]==0:
        for j in l:
            if l1[i-j]==2 and i-j>=0:
                l1[i]=1
                break
            else:
                l1[i]=2
if l1[k]==1:
    print("First")
else:
    print("Second")


Measured memory_bytes: 41964
import math
INF, MOD = float("inf"), 10 ** 9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

def mins(x, y):
    x = min(x, y)

def maxs(x, y):
    x = max(x, y)

def fact(n):
    tmp = 1
    for i in range(2, n + 1):
        tmp = int(tmp * i % MOD)
    return tmp

while(True):
    try:
        n, m = get_int_list()
        if(n == m):
            print(int(fact(n) ** 2 * 2 % MOD))
        elif(abs(n - m) == 1):
            print(int(fact(n) * fact(m) % MOD))
        else:
            print(0)
    except EOFError:
        exit()


Measured memory_bytes: 3064
#include "iostream"
#include "string"
#include "algorithm"
using namespace std;

int main() {
	int n, a[200000];
	int max = 0, subMax = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > max) {
			max = a[i];
		}
		else if (a[i] > subMax) {
			subMax = a[i];
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] == max) {
			cout << subMax << endl;
		}
		else {
			cout << max << endl;
		}
	}
}

Measured memory_bytes: 2432
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> L;
  rep(i, N) {
    int l;
    cin >> l;
    L.push_back(l);
  }

  int D = 0;
  int result = 1;
  rep(i, N) {
    D += L[i];
    if (D > X) {
      break;
    } else {
      result++;
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
//its very good question i think binary search conceptual.................................................................................
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
int n;
ll k, a[202020];
ll st = -2e18, en = 2e18;

int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	while (st + 1 != en)
	{
		ll mid = (st + en) / 2, cnt = 0;
		for (int i = 0; i < n; i++)
		{
			if (a[i] < 0)
			{
				int l = i, r = n;
				while (l + 1 != r)
				{
					int m = (l + r) / 2;
					if (a[i]*a[m] <= mid) r = m;
					else l = m;
				}
				cnt += n - r;
			}
			else
			{
				int l = i, r = n;
				while (l + 1 != r)
				{
					int m = (l + r) / 2;
					if (a[i]*a[m] <= mid) l = m;
					else r = m;
				}
				cnt += l - i;
			}
		}
		if (cnt < k) st = mid;
		else      en = mid;
	}
	cout << en << endl;
	return 0;
}


Measured memory_bytes: 1792
x,k,d = map(int,input().split())
max_d = k*d
if( abs(x) < abs(max_d) ):
    tmp = x%d
    min_move = (x-tmp)//d
    if( (k-min_move) % 2 == 0 ):
        ans = tmp
    else:
        ans = abs(d-tmp)
else:
    ans = abs(x) - max_d
print(ans)

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll x,y,z; cin>>x>>y>>z;
  swap(x,y);
  swap(x,z);
  cout<<x<<' '<<y<<" "<<z<<endl;
  
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=305;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	ll A[SIZE][SIZE]={};
	ll ans=0;
	for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		cin>>A[i][j];
	}
	for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		bool flag=0;
		for(int k=0;k<N;k++){
			if(A[i][j]>A[i][k]+A[k][j]){
				cout<<-1<<endl;
				return 0;
			}
			else if(A[i][j]==A[i][k]+A[k][j]){
				//cout<<i<<" "<<j<<endl;
				if(i!=k && j!=k)
					flag=1;
			}
			else{
				//flag=1;
			}
		}
		if(!flag)
			ans+=A[i][j];
	}
	cout<<ans/2<<endl;
    return 0;
}

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

a_list = [int(e) for e in input().split()]
b_list = [int(e) for e in input().split()]

min_price = min(a_list)+min(b_list)

for i in range(M):
    x,y,c = map(int, input().split())
    min_price = min(min_price,a_list[x-1] + b_list[y-1] - c)
    
print(min_price)

Measured memory_bytes: 18488
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n;
        cin >> n;
        vector<ll> p(n + 1);
        p[0] = 0;
        repone(i, n) {
            ll a;
            cin >> a;
            p[a] = i;
        }

        ll ans = 0;
        set<ll> s = {0, n + 1};
        repone(a, n) {
            auto itr = s.upper_bound(p[a]);
            ll upper = *itr;
            itr--;
            ll lower = *itr;
            ans += a * (p[a] - lower) * (upper - p[a]);
            s.insert(p[a]);
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 11136
const Main = (input) => {
    d = []
    A = []
    array = input.split('\n')
    NK = array.shift()
    array.pop()
    dA = array.map(item => item.split(' ').map(value => parseInt(value)))
    NK = NK.split(' ').map(item => parseInt(item))
    for (i = 0; i < NK[1]; i++) {
        d.push(dA.shift())
        A.push(dA.shift())
    }
    console.log(F(NK[0], NK[1], d, A))
}

const F = (N, K, d, A) => {
    // console.log('N: ', N)
    // console.log('K: ', K)
    // console.log('d: ', d)
    // console.log('A: ', A)
    nosuke = new Map()
    for (i = 0; i < K; i++) {
        for (k = 0; k < d[i]; k++) {
            nosuke.set(A[i][k], true)
        }
    }
    result = N - nosuke.size
    return result
}

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


Measured memory_bytes: 33116
using System;

namespace B___Golden_Apple
{
    class Program
    {
        static void Main(string[] args)
        {
            var ND = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            Console.WriteLine((int)Math.Ceiling((decimal)ND[0] / (decimal)(2 * ND[1] + 1)));
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;cin>>n;
ll a[n];
ll sum = 0;
for(int i=0;i<n;i++)
    cin>>a[i];
for(int i=0;i<n-1;i++)
    if(a[i]>a[i+1])
        {sum+=(a[i]-a[i+1]);
        a[i+1]+=(a[i]-a[i+1]);}
    else
        continue;
cout<<sum<<endl;
return 0;}


Measured memory_bytes: 5112
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vll a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    vvll dp(6, vll(n + 1, -HIGHINF));
    dp[1][0] = 0;
    for (int i = 0; i < n; i++) {
        dp[0][i + 1] = dp[1][i] + a[i];
        dp[1][i + 1] = dp[0][i];
        dp[2][i + 1] = dp[3][i] + a[i];
        dp[3][i + 1] = max(dp[1][i], dp[2][i]);
        dp[4][i + 1] = dp[5][i] + a[i];
        dp[5][i + 1] = max(dp[3][i], dp[4][i]);
    }

    if (n & 1) cout << max(dp[3][n], dp[4][n]) << '\n';
    else cout << max(dp[1][n], dp[2][n]) << '\n';
    return 0;
}


Measured memory_bytes: 15868
import numpy as np

N, D = map(int, input().split())
X = []
for i in range(N):
    X.append(list(map(int, input().split())))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        dist = 0
        for k in range(D):
            dist += abs(X[i][k] - X[j][k])**2
        dist = np.sqrt(dist)
        if dist % 1 == 0:
            ans += 1
print(ans)


Measured memory_bytes: 27132
# -*- coding: utf-8 -*-

import numpy as np

#input
#[H,W] = list(map(int,input().split()))
#[h,w] = list(map(int,input().split()))
#
#print((H-h)*(W-w))


#[N, M] = list(map(int,input().split()))

[A, B, C] = list(map(int,input().split()))
ans = min(C, B//A)
print(ans)



Measured memory_bytes: 12420
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s;cin >> s;
    int ans = 0;
    int n = s.size();
    for(int i = 0,j;i < n;i = j){
        int now = i;

       //trace(i,j);
        for(;i < n && s[i] == 'W';++i);
        //trace(i,j);
        if(now != i)ans++;
        if(i == n)break;
        for(j = i;j < n && s[j] == 'B';j++);
        //trace(i,j);
        if(j != i)ans++;
    }
    cout << ans-1 << endl;

    
    return 0;
}

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

int main(void){
    int n, a, b;
    cin >> n >> a >> b;
    
    string s = "Hello World";
    
    if(n == 1){
        cout << s << endl;
    } else {
        cout << a+b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2199

#include <iostream>
#include <algorithm>

using namespace std;

long long DP[20010][256]; // DP[i][j] = y_i=jである場合のi文字目までの最小コスト
int C[20];
int X[20010];

const long long infty = 1e12;

int main() {
  int N, M;
  while (cin >> N >> M && N) {
    for (int i=0; i<M; i++) {
      cin >> C[i];
    }
    for (int i=0; i<N; i++) {
      cin >> X[i];
    }
    fill(&DP[0][0], &DP[0][0]+20010*256, infty);
    DP[0][128] = 0;
    for (int i=0; i<N; i++) {
      for (int j=0; j<256; j++) {
	if (DP[i][j] < infty) {
	  for (int k=0; k<M; k++) {
	    int y = j + C[k];
	    if (y > 255) y = 255;
	    if (y < 0) y = 0;
	    long long cost = DP[i][j] + (X[i] - y) * (X[i] - y);
	    if (DP[i+1][y] > cost) {
	      DP[i+1][y] = cost;
	    } 
	  }
	}
      }
    }
    long long ans = infty;
    for (int j=0; j<256; j++) {
      if (ans > DP[N][j]) {
	ans = DP[N][j];
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 41248
#include <cstdio>
#include <climits>
#include <algorithm>

using namespace std;


int main()
{
	int m, n;
	int a[10000];
	int sum[10001];
	
	scanf("%d %d", &m, &n);
	
	for (int i = 0; i < m; i++){
		scanf("%d", a + i);
	}
	
	sort(a, a + m);
	reverse(a, a + m);
	
	sum[0] = 0;
	
	for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i - 1];
	
	int dp[100001];
	fill(dp, dp + 100000, INT_MAX / 2);
	
	dp[0] = 0;
	for (int i = 0; i < n; i++){
		int t, v;
		scanf("%d %d", &t, &v);
		for (int j = 10000; j - t >= 0; j--){
			dp[j] = min(dp[j], dp[j - t] + v);
		}
		for (int j = 10000; j >= 1; j--){
			dp[j - 1] = min(dp[j], dp[j - 1]);
		}
	}
	
	int ans = 0;
	for (int i = 0; i <= m; i++) ans = max(ans, sum[i] - dp[i]);
	printf("%d\n", ans);
	
	return (0);
}

Measured memory_bytes: 1508
#include <iostream>
#include <string.h>
using namespace std;
int main(){
    int i;
    char str[1000];
    cin>>str;
    i=strlen(str);
    for(int j=0;j<i;j++){
        str[j]-=3;
        if(str[j]=='>'){
            str[j]='X';
        }
        if(str[j]=='?'){
            str[j]='Y';
        }
        if(str[j]=='@'){
            str[j]='Z';
        }        cout<<str[j];
    }
    cout<<endl;
}

Measured memory_bytes: 3048
#include<iostream>
#include<cstring>

using namespace std;

int dp[2];
const int mod = 1000000007;

int main(){

string l;
  
  cin >> l;
  
  dp[0]=1;
  dp[1]=0;
  
  int n=l.size();
  
  for(int k=0;k<n;k++){
   (dp[1]+=(dp[1]*2 % mod)) %= mod;   
    if(l[k]=='1'){
   (dp[1]+=(dp[0] % mod)) %= mod;
   (dp[0]=(dp[0]*2 % mod)) %= mod;
   }
  }
  
  
   cout << (dp[0]+dp[1])%mod << endl;
  
}

Measured memory_bytes: 512
import java.util.*;

class Main {

    static void solve (int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(2004, month - 1, day);

        switch (cal.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.SUNDAY:
                System.out.println("Sunday");
                break;
            case Calendar.MONDAY:
                System.out.println("Monday");
                break;
            case Calendar.TUESDAY:
                System.out.println("Tuesday");
                break;
            case Calendar.WEDNESDAY:
                System.out.println("Wednesday");
                break;
            case Calendar.THURSDAY:
                System.out.println("Thursday");
                break;
            case Calendar.FRIDAY:
                System.out.println("Friday");
                break;
            case Calendar.SATURDAY:
                System.out.println("Saturday");
                break;
        }


    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        while(true) {
            int month = sc.nextInt();
            int day = sc.nextInt();

            if (month == 0) break;

            solve(month, day);

        }

    }
}

Measured memory_bytes: 11000
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
int main()
{
//	ifstream cin("testcase.txt");
	//ofstream cout("output.txt");	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		int n;
		cin>>n;
		string a;
		cin>>a;
		vector<int>answer,answer1;
		for(i=0;i<a.size();i++)
		{
			if(a[i]==')')
				answer.push_back(i);
			else
				answer1.push_back(i);
		}
		int v[101]={0};
		int flag=0;
		for(i=0;i<answer1.size();i++)
		{
			int q=lower_bound(answer.begin(),answer.end(),answer1[i])-answer.begin();
			while(1)
			{
				if(q==answer.size())
				{
					flag=1;
					break;
				}
				else if(v[answer[q]]==0 && answer[q]>answer1[i])
					break;
				else
					q++;
				
			}
			if(flag==1)
				break;
			v[answer[q]]=1;
			v[answer1.at(i)]=1;	
		}
		int count1=0;
		int count2=0;
		for(i=0;i<answer.size();i++)
		{
			if(v[answer.at(i)]==0)
				count1++;
		}
		for(i=0;i<answer1.size();i++)
		{
			if(v[answer1[i]]==0)
				count2++;
		}
		for(i=0;i<count1;i++)
			a='('+a;
		for(i=0;i<count2;i++)
			a=a+')';
		cout<<a<<endl;
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


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

typedef struct tnode tnode;

typedef struct{
	tnode *root;
}Tree;

struct tnode {
	int key;
	tnode *left, *right;
	tnode *p;
};

void print_preorder_rec(tnode *node){
	printf(" %d", node->key);
	if(node->left != NULL) print_preorder_rec(node->left);
	if(node->right != NULL) print_preorder_rec(node->right);
}

void print_preorder(Tree *tree) {
	print_preorder_rec(tree->root);
	printf("\n");
}

void print_inorder_rec(tnode *node){
	if(node->left != NULL) print_inorder_rec(node->left);
	printf(" %d", node->key);
	if(node->right != NULL) print_inorder_rec(node->right);
}

void print_inorder(Tree *tree) {
	print_inorder_rec(tree->root);
	printf("\n");
}

void print_postorder_rec(tnode *node){
	if(node->left != NULL) print_postorder_rec(node->left);
	if(node->right != NULL) print_postorder_rec(node->right);
	printf(" %d", node->key);
}

void print_postorder(Tree *tree) {
	print_postorder_rec(tree->root);
	printf("\n");
}

int main(void) {
	int n, i, j, l, r;
	scanf("%d", &n);
	Tree tree;
	tnode *nodes;
	nodes = malloc(n * sizeof(tnode));
	for (i = 0; i < n; i++) nodes[i].p = NULL;
	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &j, &l, &r);
		nodes[j].key = j;
		if (l == -1) {
			nodes[j].left = NULL;
		}
		else {
			nodes[j].left =  &nodes[l];
			nodes[l].p = &nodes[j];
		}
		if (r == -1) {
			nodes[j].right = NULL;
		}
		else {
			nodes[j].right =  &nodes[r];
			nodes[r].p = &nodes[j];
		}
		nodes[j].right = (r == -1) ? NULL : &nodes[r];
	}
	for (i = 0; i < n; i++) {
		if (nodes[i].p == NULL) {
			tree.root = &nodes[i];
			break;
		}
	}
	printf("Preorder\n");
	print_preorder(&tree);
	printf("Inorder\n");
	print_inorder(&tree);
	printf("Postorder\n");
	print_postorder(&tree);
	return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n, m, p;
    cin >> n >> m >> p;

    vector<pair<pair<int64_t, int64_t>, int64_t>> l(m);
    for (auto&& ll : l) {
        cin >> ll.first.first >> ll.first.second >> ll.second;
        --ll.first.first;
        --ll.first.second;
    }

    vector<int64_t> points(n, numeric_limits<int64_t>::min());
    points[0] = 0;
    for (auto i : irange(0L, 2 * m + 1)) {
        for (const auto& ll : l) {
            if (points[ll.first.first] == numeric_limits<int64_t>::min()) {
                continue;
            }

            auto new_point = points[ll.first.first] + ll.second - p;
            if (new_point > points[ll.first.second]) {
                points[ll.first.second] = new_point;

                if (i >= m && ll.first.second == n - 1) {
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }

    cout << max(points[n - 1], 0L) << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 150
void push(int);
int pop(void);
int isFULL(void);
int isEMPTY(void);
int top=0;
int S[N];
int main()
{
  int x,a,b,c;
  char s[N];
  while(scanf("%s",s)!=EOF)
    {
      if(s[0]=='+')
	{
	  a=pop();
	  b=pop();
	  c=b+a;
	  push(c);
	}
      else if(s[0]=='-')
	{
	  a=pop();
	  b=pop();
	  c=b-a;
	  push(c); 
	}
      else if(s[0]=='*')
	{
	  a=pop();
	  b=pop();
	  c=b*a;
	  push(c); 
	}
      else
	{
	  x=atoi(s);
	  push(x);
	}
    }
  printf("%d",S[1]);
  printf("\n");
  return 0;
}
void push(int x)
{
  if(isFULL()==1)
    {
    printf("over flow!\n");
    exit(1);
    }
  top++;
  S[top]=x;
}
int pop(void)
{
  if(isEMPTY()==1)
    {
      printf("under flow!\n");
      exit(2);
    }
  top--;
  return S[top+1];
}
int isFULL(void)
{
  if(top>=N-1)
    return 1;
  else return 0;
}
int isEMPTY(void)
{
  if(top==0)
    return 1;
  else return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree< pair<int,int>, null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 1e5+100;
const int mod = 1e9+7;

int arr[mxn];
map<int,int>Mp;
vector<pair<int,int> >Pi;
vector<long long>pos;
set<int>seet;

int main()
{
    ios::sync_with_stdio(false);

      int t, x;
      cin>>t>>x;

      cout<<setprecision(10)<<t/(x+.0)<<endl;

    return 0;
}


Measured memory_bytes: 256
N, L = map(int, input().split())
if L <= 0 and L + N - 1 >= 0:
	print(int(N * ((N - 1) / 2 + L)))
elif L > 0:
	print(int(N * ((N - 1) / 2 + L) - L))
else:
	print(int(N * ((N - 1) / 2 + L) - L - N + 1))

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

const ll kMod = 998244353;

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// Usage:
//  int N = 100000;
//  int MOD = 1000000007;
//  Comb comb(N, MOD);  // O(N)
//  comb.Calc(N, k);  // O(1)
class Comb {
public:
  Comb(int a_max, int a_mod)
    : max(a_max), mod(a_mod), fac(a_max + 1), finv(a_max + 1), inv(a_max + 1) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i <= max; ++i) {
      fac[i] = fac[i - 1] * i % mod;
      inv[i] = mod - inv[mod % i] * (mod / i ) % mod;
      finv[i] = finv[i - 1] * inv[i] % mod;
    }
  }

  long long Calc(int n, int k) {
    assert(n <= max);
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
  }
  
private:
  int max;
  int mod;
  vector<long long> fac;
  vector<long long> finv;
  vector<long long> inv;
};

int main() {
  ll N, M, K;
  cin >> N >> M >> K;

  Comb comb(N, kMod);
  
  //ll sum = M * pow(M - 1, N - 1);
  ll sum = M * modpow(M - 1, N - 1, kMod) % kMod;
    
  for (int k = 1; k <= K; ++k) {
    //sum += M * pow(M - 1, N - k - 1) * Comb(N - 1, N - k - 1);
    ll tmp = M * modpow(M - 1, N - k - 1, kMod) % kMod;
    tmp = tmp * comb.Calc(N - 1, N - k - 1) % kMod;
    sum = (sum + tmp) % kMod;
  }
  
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 7496
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

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

    int n, a, b;
    cin >> n >> a >> b;
    if( n * a < b ) cout << n * a;
    else cout << b;
    cout << endl;

    return 0;
}


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

using namespace std;

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

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

  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] + a[i + 1] > x) {
      int over = a[i] + a[i + 1] - x;
      if (over <= a[i + 1]) {
        a[i + 1] -= over;
      } else {
        a[i + 1] = 0;
      }
      ans += over;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,K=mint()
if K==0:
    print(N**2)
    exit()
ans=0
for b in range(K+1,N+1):
    ans+=(N//b)*(b-K)+max(0,N%b-(K-1))
print(ans)

Measured memory_bytes: 71656
#[allow(unused_macros)]
macro_rules! p{
    ($($e:expr),*) => {
          $(println!("{:?}", $e);)*
    }
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut _s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = _s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        n: usize,
        m: usize,
        mut ab: [(usize, i32);n]
    }
    ab.sort_by_key(|x|x.0);
    let mut pq = 
    std::collections::BinaryHeap::new();
    let mut q = 0;
    let mut ans = 0;
    for i in 1usize..m+1{
        while q < n && ab[q].0 <= i{
            pq.push(ab[q].1);
            q += 1;
        }
        if let Some(s) = pq.pop() {
        ans += s;
        }
    }
    p!(ans);
}

Measured memory_bytes: 8444
// Q - Problem 17
#include <bits/stdc++.h>
using namespace std;

int main() {
    
	int X{0},length{0};
	scanf("%d %d",&X,&length);
	
	if(length == 0){
	    printf("%d\n",X);
	    return 0;
	}
	
	int diff{0},smallest{200};
	
	bool arr[102] = {0};
	
	while(length--){
	    scanf("%d",&diff);
	    arr[diff] = true;
	}
	
	diff = 200;
	
	for(int i = 0; i <= 101; i++){
	    if(!arr[i] && X >= i && diff > (X - i)){
	        diff = X - i;
	        smallest = i;
	    }
	    if(!arr[i] && X < i && diff > (i - X)){
	        diff = i - X;
	        smallest = i;
	    }
	}
	
	printf("%d\n",smallest);
	
	return 0;
}


Measured memory_bytes: 3728