akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define lo long
const int lmax=1999999999;
const long long lmx=1999999999999999999;
int n,a,b;
int main(){std::ios::sync_with_stdio(false);
cin>>n;
if(n==1)
{
	cout<<"Hello World"<<endl;
}
else
{
	cin>>a>>b;
	cout<<a+b<<endl;
}
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





Measured memory_bytes: 256
n = int(input())
X = list(map(int, input().split()))
x = sorted(X)

res1 = x[n//2]
res2 = x[n//2 -1]

for i in range(n):
  if X[i] >= res1:
    print(res2)
  elif X[i] <= res2:
    print(res1)

Measured memory_bytes: 30644
from collections import deque
import sys
sys.setrecursionlimit(1000000)
n,m =map(int,input().split())
pas = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    pas[a].append(b)
    pas[b].append(a)

seen = [False for i in range(n)]
que = deque()
def bfn(i,j):
    for x in pas[i]:
        if seen[x-1]!=False:
            continue
        seen[x-1]=i
        que.append([x,i])
    if que:
        now,pre =que.popleft()
        bfn(now,pre)
    else:
        return

bfn(1,1)

if False in seen:
    print("No")
else:
    print("Yes")
    for i in range(n-1):
        print(seen[i+1])


Measured memory_bytes: 119096
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int total = n - a*2;
    
    if(total > 0){
      System.out.println(total);
    }else{
      System.out.println(0);
    }
  }
}


Measured memory_bytes: 21972
# -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())

i = 0
while True:
    i += 1
    if A%2:
         A -= 1
    A /= 2
    B += A
    if i == K:
        break
    i += 1
    if B%2:
        B -= 1
    B /= 2
    A += B
    if i == K:
        break
print(int(A),int(B))

Measured memory_bytes: 3060
import heapq

X, Y, Z, K = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)

heap = []
heapq.heappush(heap, (-(a_list[0] + b_list[0] + c_list[0]), 0, 0, 0))
searched = []
result = [0] * K

for k in range(K):
    elem = heapq.heappop(heap)
    result[k] = - elem[0]

    if elem[1] + 1 <= X - 1:
        a_next = (-(a_list[elem[1] + 1] + b_list[elem[2]] + c_list[elem[3]]), elem[1] + 1, elem[2], elem[3])
        if not a_next in searched:
            heapq.heappush(heap, a_next)
            searched.append(a_next)

    if elem[2] + 1 <= Y - 1:
        b_next = (-(a_list[elem[1]] + b_list[elem[2] + 1] + c_list[elem[3]]), elem[1], elem[2] + 1, elem[3])
        if not b_next in searched:
            heapq.heappush(heap, b_next)
            searched.append(b_next)

    if elem[3] + 1 <= Z - 1:
        c_next = (-(a_list[elem[1]] + b_list[elem[2]] + c_list[elem[3] + 1]), elem[1], elem[2], elem[3] + 1)
        if not c_next in searched:
            heapq.heappush(heap, c_next)
            searched.append(c_next)

[print(k) for k in result]


Measured memory_bytes: 4468
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int solve( int K, int x, int y, vector<pair<int,int> >& ans )
{
    int xflag=0, yflag=0, swapflag=0;
    if(x<0) {
        x=-x; xflag=1;
    }
    if(y<0) {
        y=-y; yflag=1;
    }
    if(y>x) {
        swap(x,y); swapflag=1;
    }
    assert(x>=0);
    assert(y>=0);
    assert(x>=y);

    if(K%2==0) {
        if((x+y)%2) {
            return -1;
        }
    }

    while(x+y>=K*2) {
        int diffy = MIN(y, K);
        y -= diffy;
        x -= (K-diffy);
        ans.push_back( make_pair(K-diffy, diffy) );
    }
    assert(x>=0);
    assert(y>=0);
    assert(x>=y);

    if(x+y==0) {
        // OK
    }
    else if(x+y==K) {
        ans.push_back( make_pair(x, y) );
        x=y=0;
    }
    else {
        if((x+y)%2) {
            assert(K%2==1);
            if(x+y>K) {
                int diffy = MIN(y, K);
                y -= diffy;
                x -= (K-diffy);
                ans.push_back( make_pair(K-diffy, diffy) );
            }
            else {
                x += K;
                ans.push_back( make_pair(-K, 0) );
            }
        }
        assert((x+y)%2==0);
        assert(x+y>0 && x+y<K*2);

        int d=(x+y)/2;
        ans.push_back(make_pair(x-d, y+(K-d)));
        ans.push_back(make_pair(d, -(K-d)));  
    }

    if(swapflag) {
        int i;
        for(i=0; i<(int)ans.size(); i++) {
            swap(ans[i].first, ans[i].second);
        }
    }
    if(xflag || yflag) {
        int i;
        for(i=0; i<(int)ans.size(); i++) {
            if(xflag) ans[i].first=-ans[i].first;
            if(yflag) ans[i].second=-ans[i].second;
        }
    }

    return 0;
}

int main(int argc, char* argv[])
{
    int K,x,y;
    scanf("%d%d%d", &K, &x, &y);

    vector<pair<int, int> > ans;
    int rc = solve(K, x, y, ans);
    if(rc) {
        printf("-1\n"); return 0;
    }

    int sumx=0, sumy=0;
    int i;
    printf("%d\n", (int)ans.size());
    for(i=0; i<(int)ans.size(); i++) {
        sumx+=ans[i].first;
        sumy+=ans[i].second;
        printf("%d %d\n", sumx, sumy);
    }

    return 0;
}


Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18,MOD=1e9+7;
int main(){
   string s;
   cin>>s;
   bool flag=true;
   for(int i=0;i<3;i++){
       if(s[i]==s[i+1])flag=false;
   }
   if(flag)cout<<"Good"<<endl;
   else cout<<"Bad"<<endl;
}

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

int c[10009], a[10009];
vector<int> v[10009];
int r;

void dfs(int hn, int p)
{
	r--; a[hn] = c[r];
	for (int i = 0; i < v[hn].size(); i++) {
		int tn = v[hn][i];
		if (tn == p) continue;
		dfs(tn, hn);
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a, b; cin >> a >> b;
		v[a].push_back(b); v[b].push_back(a);
	}
	int s = 0;
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		s += c[i];
	}
	sort(c, c + n);
	s -= c[n - 1]; r = n;
	dfs(1, -1);
	cout << s << '\n';
	for (int i = 1; i <= n; i++)
		cout << a[i] << " ";
	cout << '\n';
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n, k;
    string s;
    while(cin>>k>>s){
        ll ans=0;
        if(k>=s.size()){
        	cout<<s<<endl;
        }
        else{
	        for(int i=0; i<k; ++i){
	        	cout<<s[i];
	        }
	        cout<<"...\n";
    	}
    }
  return 0;
}




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

// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

#define St first
#define Nd second
#define Pb push_back
#define Mp make_pair
#define print_pair(p) cout<<p.St<<" "<<p.Nd
#define endl "\n"

#define REP(i,a,b) for(int i = a; i <= b; i++)
#define REV(i,a,b) for(int i = a; i >= b; i--)

#define AritSum(a,d,n) ((n)*(2*(a)+((n)-1)*(d)))/2
#define Log(base, num) log2(num)/log2(base)


// ************* MAIN *******************

int h1, h2, m1, m2,k;
void solve() {
    cin >> h1>>m1>>h2>>m2>>k;
    cout << (h2*60+m2) - (h1*60 + m1) -k << endl;
}
/*
g++ -std=c++14 -Wall -Wextra -O2 Test.cpp -o Test
*/
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T=1;
    // cin>>T;
    for (int t = 1; t <= T; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int g[50][50];
bool reach[50][50]={0};
int w,h;

void dfs(int x, int y){
 
  reach[x][y] = true;
  
  REP(i,8){
    int nx = x + dx[i], ny = y + dy[i];
    if(0<=nx && nx < h && 0<=ny && ny < w && !reach[nx][ny] && g[nx][ny] == 1) dfs(nx,ny);
  }
  return;
}

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

  while(1){
    cin >> w >> h;
    if(!w && !h) return 0;
    
    REP(i,h){
      REP(j,w){
        reach[i][j] = false;
        cin >> g[i][j];
      }
    }
  
    int ans=0;

    REP(i,h){
      REP(j,w){
        if(g[i][j] == 1 && !reach[i][j]){
          dfs(i,j);
          ans++;
        }
      
      }
    }
    cout << ans << endl;
  }
    return 0;
}




Measured memory_bytes: 3280
#0:initial pos, 1:the number, 2:len of a step
line = list(map(int, input().split( )))
iniabs = abs(line[0])
#原点まであと一歩の回数, その時の原点との距離, 残り歩数の偶奇
lstep = iniabs//line[2]
ldis = iniabs%line[2]
odeven = (line[1] - lstep)%2
if lstep > line[1]:
  print(iniabs - line[2]*line[1])
elif odeven == 0:
  print(ldis)
else:
  print(line[2] - ldis)
  
        
      

  
  

  

Measured memory_bytes: 9120
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<double,pair<int,int> > p[110000];
pair<double,pair<int,int> > q[110000];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int sz=0;
	int s2=0;
	double val=0;
	for(int i=0;i<a;i++){
		int w,v;
		scanf("%d%d",&w,&v);
		if(v>=0&&w<=0){
			val+=v;
			b-=w;
		}else if(v<=0&&w>=0){
			continue;
		}else if(v>0){
			p[sz++]=make_pair((double)w/v,make_pair(w,v));
		}else{
			b-=w;
			val+=v;
			p[sz++]=make_pair((double)w/v,make_pair(-w,-v));
		}
	}
	std::sort(p,p+sz);
	std::sort(q,q+s2);
	int lb=b;
	double tmp=val;
	double ret=0;
	int at=0;
	for(int i=0;i<=s2;i++){
		while(at<sz&&b-p[at].second.first>=0){
			b-=p[at].second.first;
			val+=(double)p[at].second.second;
			at++;
		}
		if(at<sz)ret=max(ret,val+(double)p[at].second.second*b/p[at].second.first);
		else ret=max(ret,val);
		if(i<s2){
			b-=q[i].second.first;
			val+=q[i].second.second;
		}
	}
	at=0;
	val=tmp;
	b=lb;
	for(int i=0;i<sz;i++){
		val+=p[i].second.second;
		b-=p[i].second.first;
		while(at<s2&&b-q[at].second.first<0){
			b-=q[at].second.first;
			val+=(double)q[at].second.second;
			at++;
		}
	//	printf("%f %d %d\n",val,b,at);
		if(at>=s2)break;
		if(b<0)ret=max(ret,val+(double)b/q[at].second.first*q[at].second.second);
		else ret=max(ret,val);
	}
	printf("%.12f\n",ret);
}

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

using namespace std;
using ll = long long;

int main() {
    int d, n;
    cin >> d >> n;
    if (d == 0) {
        if (n == 100) cout << 1 * (n + 1) << endl;
        else cout << 1 * n << endl;
    } else if (d == 1) {
        if (n == 100) cout << 100 * (n + 1) << endl;
        else cout << 100 * n << endl;
    } else if (d == 2) {
        if (n == 100) cout << 10000 * (n + 1) << endl;
        else cout << 10000 * n << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b) = in.readLine().split("\\s+").map(_.toInt)

    val a1 = Math.ceil(100.0 * a / 8).toInt
    val a2 = Math.ceil(100.0 * (a + 1) / 8).toInt - 1
    val b1 = 10 * b
    val b2 = 10 * b + 9

    @tailrec
    def and(a1: Int, a2: Int, b1: Int, b2: Int): Option[(Int, Int)] = {
      if (a1 > a2 || b1 > b2) {
        None
      } else if(a1 > b1) {
        and(b1, b2, a1, a2)
      } else {
        if (a2 < b1) {
          None
        } else if (a2 < b2) {
          Some((b1, a2))
        } else {
          Some((b1, b2))
        }
      }
    }

    out.println(
      and(a1, a2, b1, b2) match {
        case Some((c1, _)) => c1
        case None => -1
      }
    )
    out.flush()
  }
}


Measured memory_bytes: 27320
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int x;
  cin >> x;
  int max_pow = 1;
  if (x == 1) max_pow = 1;
  else{
    for (int i = 2; i <= x/2; i++) {
      int temp = i;
      while(temp <= x){
        if (temp * i <= x) temp*=i;
        else break;
      }
      if (temp > max_pow) {
        max_pow = temp;
      }
    }
  }

  cout << max_pow << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);

		while(stdIn.hasNext()) {
			double x1, y1, x2, y2, x3, y3, px, py;
			x1 = stdIn.nextDouble();
			y1 = stdIn.nextDouble();
			x2 = stdIn.nextDouble();
			y2 = stdIn.nextDouble();
			x3 = stdIn.nextDouble();
			y3 = stdIn.nextDouble();
			px = stdIn.nextDouble();
			py = stdIn.nextDouble();

			double a = (x3 - x2) * (py - y2) - (y3 - y2) * (px - x2);
			double b = (x1 - x3) * (py - y3) - (y1 - y3) * (px - x3);
			double c = (x2 - x1) * (py - y1) - (y2 - y1) * (px - x1);

			if((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 23488
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

const double PI=3.14159265358979323846;

int main() {
  int N;
  cin >> N;
  
  cout << N*PI*2 << endl;

}


Measured memory_bytes: 3792
#include <iostream>
#include <string>

int main() {
  size_t N;
  std::string S;

  std::cin >> N >> S;

  size_t R = 0;
  size_t B = 0;

  for (auto const c: S) {
    if (c == 'R')
      R++;
    else
      B++;
  }

  std::cout << (R > B ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 256
use std::io::{self, Read};

fn read_stdin() -> String {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).unwrap();
    buffer
}

fn parse_params(s: &str) -> Vec<i32> {
    let mut it = s.split_whitespace();
    let n = it.next().unwrap().parse().unwrap();

    let mut ret = Vec::with_capacity(n);

    for _ in 0..n {
        let l = it.next().unwrap().parse().unwrap();
        ret.push(l);
    }

    ret.sort();

    ret
}

fn count(v: &[i32], boundary: i32) -> usize {
    if v.is_empty() {
        return 0;
    }

    if boundary <= *v.first().unwrap() {
        return 0;
    }

    if *v.last().unwrap() < boundary {
        return v.len();
    }

    let half = v.len() / 2;
    let fst = &v[..half];
    let snd = &v[half..];

    count(fst, boundary) + count(snd, boundary)
}

fn main() {
    let buffer = read_stdin();
    let ls = parse_params(&buffer);

    let mut sum = 0;

    for i in 0..(ls.len() - 2) {
        for j in (i + 1)..(ls.len() - 1) {
            let boundary = ls[i] + ls[j];
            let ls = &ls[(j + 1)..];
            sum += count(ls, boundary);
        }
    }

    println!("{}", sum);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long
#define maxn 3005
using namespace std;

ll dp[maxn][maxn][4], grid[maxn][maxn];

int main(){ 
    ll r, c, k, ri, ci, vi;

    cin >> r >> c >> k;
    for(int i=0;i<k;i++){
        cin >> ri >> ci >> vi;
        grid[ri][ci] = vi;
    }

    for(int i=1;i<=r;i++){
        for(int j=1;j<=c;j++){
            for(int k=0;k<=3;k++){ 
                if(k<3){
                    dp[i][j+1][k+1] = max(dp[i][j+1][k+1],dp[i][j][k]+grid[i][j]);
                    dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][k]+grid[i][j]);
                }
                dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][k]);
                dp[i][j+1][k] = max(dp[i][j+1][k],dp[i][j][k]);
            }
        }
    }

    ll answ = dp[r][c][3];
    for(int i=0;i<3;i++){
        answ = max(answ,dp[r][c][i]+grid[r][c]);
    }

    cout << answ <<'\n';

    return 0;
}

Measured memory_bytes: 355740
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N=51;

ll x[MAX_N];
int N;

ll div_floor(ll a,ll b){
  return (a+b-1)/b;
}

ll judge(ll k){
  ll sum = 0;
  rep(i,N){
      ll _temp = x[i]+k+1-N;
      sum += div_floor(_temp,N+1);
  }
  return sum;
}

int main(){
  cin >> N ;
  rep(i,N) scanf("%lld",&x[i]);
  ll ok,ng,mid;
  ok = 50*1e16;
  ng = -1;
  int cnt = 0;
  rep(i,500){
    mid = (ok+ng)/2;
    bool flag;
    rep(i,N+1){
      flag=false;
      if(mid-i<0) break;
      ll a = judge(mid-i);
      if(a<=mid-i){
        ok = mid-i;
        flag = true;
      }
    }
    if(!flag) ng = mid;
    //cout << ok << endl;
  }
  cout << ok << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  ll n,k;
  cin >> n >> k;
  vector<ll> v(n);
  vector<ll> cnt(2020,0);
  rep(i,n)cin >> v[i],cnt[v[i]]++;
  ll res = 0;
  ll sum = 0;
  for(int i = 1;i <= 2000;i++)(res += ((cnt[i]*sum)%MOD)*(((k-1)*k/2)%MOD)%MOD)%=MOD,sum += cnt[i];
  rep(i,n)for(int j = i+1;j < n;j++)if(v[i] > v[j])res = (res+k)%MOD;
  cout << res << endl;

  

  





  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String S = sc.next();
    char[] alpha ={'A','B','C','D','E','F','G','H','I','J'
      ,'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
   	Map<Character , Integer> map = new HashMap<>();
    StringBuilder sb =  new StringBuilder();
    for(int i=0;i<alpha.length;i++){
      map.put(alpha[i],i);
    }
	int idx;
    for(int i=0;i<S.length();i++){
      idx = map.get(S.charAt(i));
      sb.append(alpha[(idx+N)%26]);
    }
    System.out.print(sb.toString());
    
    System.out.flush();
  }
}


Measured memory_bytes: 22100
(let ((a (read))
	(b (read))
	(c (read))
	(ans "YES"))
	
	(if (char= (char (string a) (- (length (string a)) 1)) (char (string b) 0))
		(if (not (char= (char (string b) (- (length (string b)) 1)) (char (string c) 0)))
			(setq ans "NO")
		)
		(setq ans "NO")
	)
	(format t "~A~%" ans)
)

Measured memory_bytes: 23668
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#define Sq(x,y) (s[x+(y)*n])
using namespace std;

int main() {
	int n;
	int *s;
	int x,y;
	
	while(cin>>n,n){
		
		s=new int[n*n];
		for(int i=0;i<n*n;++i)s[i]=0;
		
		x=n/2,y=n/2+1;
		Sq(x,y) = 1;
		
		for(int i=2;i<=n*n;++i){
			++x;++y;
			while(true){
				if(x>=n)x=0;
				else if(x<0)x=n-1;
				if(y>=n)y=0;
				
				if(Sq(x,y)==0){Sq(x,y)=i;break;}
				else --x,++y;
			}
		}
		
		for(int i=0;i<n;++i){
		for(int j=0;j<n;++j)
			printf("%4d",Sq(j,i));
		puts("");
		}
		
		delete[]s;
	}
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>

#define MAXN 200000

using namespace std;

int D[MAXN+1];

int main()
{
  int K,N;
  int pre = 0;
  int max;
  int first;

  cin >> K >> N;

  scanf("%d", &pre);
  first = pre;
  for ( int i = 1; i < N; ++i ) {
    int tmp;
    scanf("%d", &tmp);
    D[i] = tmp-pre;
    pre = tmp;
  }

  D[N] = K-pre+first;

  max = D[1];
  for ( int i = 2; i <= N; ++i ) {
    if ( max < D[i] ) max = D[i];
  }

  cout << K-max << "\n";
}


Measured memory_bytes: 1024
def resolve():
    N,K = map(int,input().split())

    cuptable = list(range(N+1))
    rcuptable = list(range(N+1))
    rcuptable.reverse()
    for i in range(1,len(cuptable)):
        rcuptable[i]+=rcuptable[i-1]
        cuptable[i]+=cuptable[i-1]
    mod=10**9+7
    ans = 0
    for i in range(K-1,len(cuptable)):
        mn = cuptable[i]
        mx = rcuptable[i]
        ans += mx-mn +1
        ans %= mod
    
    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 30120
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int A[N];
  int B[N];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
    B[A[i]]=i;
  }
  for(int i=1;i<=N;i++){
    printf("%d ",B[i]+1);
  }
  return 0;
}


Measured memory_bytes: 1536
N, X = [int(_) for _ in input().split()]
xs = [abs(int(_) - X) for _ in input().split()]

def gcd(p, q):
    while q != 0:
        p, q = q, p % q
    return p

y = xs[0]
for i in range(N):
    if xs[i] % y != 0:
        y = gcd(y, xs[i])

print(y)

Measured memory_bytes: 14252
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? (-(a)) : (a))

typedef long long ll;

using namespace std;

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

	char input[105];

	scanf("%s", input);

	if (input[2] == input[3] && input[4] == input[5]) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;
	int r,c;
	cin>>r>>c;
	char g[r][c];
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			cin>>g[i][j];
		}
	}
	int max_dis=-1;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			if(g[i][j]=='.')
			{
				vector<vector<int> > dis(r,vector<int>(c,0));
				bool vis[r][c];
				memset(vis,false,sizeof(vis));
				queue<pair<int,int> > q;
				q.push({i,j});
				while(!q.empty())
				{
					//debug;
					int u=q.front().first;
					int v=q.front().second;
					vis[u][v]=true;
					q.pop();
					if(u+1<r && v<c && u+1>=0 && v>=0 && g[u+1][v]=='.' && !vis[u+1][v])
					{
						dis[u+1][v]=1+dis[u][v];
						vis[u+1][v]=true;
						max_dis=max(max_dis,dis[u+1][v]);
						q.push({u+1,v});
					}
					if(u-1<r && v<c && u-1>=0 && v>=0 && g[u-1][v]=='.' && !vis[u-1][v])
					{
						dis[u-1][v]=1+dis[u][v];
						
						vis[u-1][v]=true;
						max_dis=max(max_dis,dis[u-1][v]);
						q.push({u-1,v});
					}
					if(u<r && v+1<c && u>=0 && v+1>=0 && g[u][v+1]=='.' && !vis[u][v+1])
					{
						dis[u][v+1]=1+dis[u][v];
						vis[u][v+1]=true;
						
						max_dis=max(max_dis,dis[u][v+1]);
						q.push({u,v+1});
					}
					if(u<r && v-1<c && u>=0 && v-1>=0 && g[u][v-1]=='.' && !vis[u][v-1])
					{
						dis[u][v-1]=1+dis[u][v];
						vis[u][v-1]=true;
						
						max_dis=max(max_dis,dis[u][v-1]);
						q.push({u,v-1});
					}
				}
				
					
					
			}
		}
	}
	cout<<max_dis<<endl;
	
}




Measured memory_bytes: 3636
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#pragma warning(disable : 4996)
using namespace std;
string a, b;
int main() {
	cin >> a >> b;
	for (int i = 0; i < a.size() + b.size(); i++) {
		if (i % 2 == 0) cout << a[i / 2];
		else cout << b[i / 2];
	}
	cout << endl;
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"     
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

const int N=(1<<16)+5;

int n,a[17][17],cost[N],cache[N];

int dp(int mask)
{
     if(mask==0)
          return 0;
     int &ans=cache[mask];
     if(ans!=-1)
          return ans;
     vector <int> v;     
     for(int i=0;i<n;i++)
     {
          if(mask&(1<<i))
               v.pb(i);
     }
     int num=v.size();
     ans=-1e18;
     for(int i=1;i<(1<<num);i++)
     {
          int submask=0;
          for(int j=0;j<num;j++)
               if(i&(1<<j))
                    submask|=(1<<v[j]);
          ans=max(ans,cost[submask]+dp(mask & (~submask)));     
     }
     return ans;
}

int32_t main()
{
     IOS;
     memset(cache,-1,sizeof cache);
     cin>>n;
     for(int i=0;i<n;i++)
     {
          for(int j=0;j<n;j++)
               cin>>a[i][j];
     }
     int total=(1<<n);
     for(int i=0;i<total;i++)
     {
          vector <int> v;
          for(int j=0;j<n;j++)
               if(i&(1<<j))
                    v.pb(j);
          int num=v.size();
          for(int j=0;j<num;j++)
          {
               for(int k=j;k<num;k++)
                    cost[i]+=a[v[j]][v[k]];
          }
     }
     total--;
     cout<<dp(total);
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back
#define debug(x) cerr << #x << " = " << x << " "

const int N = 2e3+1;
int n, k, q, a[N];
int solve(int mini)
{
  multiset<int> tot;
  int cur = 1;
  while (cur <= n)
    {
      while (cur <= n && a[cur] < mini) ++cur;
      if (cur > n) break;
      multiset<int> tmp;
      while (cur <= n && a[cur] >= mini) tmp.insert(a[cur++]);
      while (tmp.size() >= k)
	{
	  tot.insert(*tmp.begin());
	  tmp.erase(tmp.begin());
	}
    }
  if (tot.size() < q) return INT_MAX;
  int ans = -(*tot.begin());
  for (int i = 1; i < q; ++i) tot.erase(tot.begin());
  ans += *tot.begin();
  return ans;
}
int main()
{
  while (~scanf("%d %d %d", &n, &k, &q))
    {
      set<int> st;
      for (int i = 1; i <= n; ++i) scanf("%d", a+i), st.insert(a[i]);
      int ans = INT_MAX;
      for (int i = 1; i <= n; ++i) ans = min(ans, solve(a[i]));
      printf("%d\n", ans);
    }

}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  repd(i, 1, 10){
    repd(j, 1, 10){
      if(n == i * j){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,m,a,b;
	cin >> n >> m;
	vector<int> v(n,0);
	for (int i = 0; i < m; i++)
	{
		cin >> a >> b;
		v[a - 1]++;
		v[b - 1]++;
	}
	for (int i = 0; i < n; i++)
	{
		cout << v[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

int V;
vector<int> G[NUM];
int in_num[NUM];
bool in_cycle[NUM];


int main(){

	scanf("%d",&V);

	for(int i = 0; i < V; i++){
		in_num[i] = 0;
		in_cycle[i] = true;
	}

	int from,to;

	for(int loop = 0; loop < V; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;
		in_num[from]++;
		in_num[to]++;
		G[from].push_back(to);
		G[to].push_back(from);
	}

	//次数が1のものから、枝を切っていく
	queue<int> Q;

	for(int i = 0; i < V; i++){
		if(in_num[i] == 1){
			in_cycle[i] = false;
			Q.push(i);
		}
	}

	int adj_node;

	while(!Q.empty()){

		for(int i = 0; i < G[Q.front()].size(); i++){

			adj_node = G[Q.front()][i];
			if(!in_cycle[adj_node])continue;

			in_num[adj_node]--;
			if(in_num[adj_node] == 1){
				in_cycle[adj_node] = false;
				Q.push(adj_node);
			}
		}

		Q.pop();
	}

	int num_query;
	scanf("%d",&num_query);

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		if(in_cycle[from] == true && in_cycle[to] == true){

			printf("2\n");

		}else{

			printf("1\n");
		}
	}

	return 0;
}



Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
#define intl long long int 

struct node{
	intl l;
	intl r;
	intl val;
};

node fun(intl l,intl r,intl val){
	node x;
	x.l=l;
	x.r=r;
	x.val=val;
	return x;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	string t;
	cin>>s>>t;
	intl i,j,n,m;
	n=s.length();
	m=t.length();
	vector<vector<node> > arr(n,vector<node>(m));
	for(i=0;i<n;i++){
		j=0;
		if(s[i]==t[j]){
			arr[i][j]=fun(i,j,1);
		}
		else{
			if(i>0){
				arr[i][j]=arr[i-1][j];
			}
			else{
				arr[i][j]=fun(i,j,0);
			}
		}
	}
	i=0;
	for(j=1;j<m;j++){
		if(s[i]==t[j]){
			arr[i][j]=fun(i,j,1);
		}
		else{
			arr[i][j]=arr[i][j-1];
		}
	}
	for(i=1;i<n;i++){
		for(j=1;j<m;j++){
			if(s[i]==t[j]){
				arr[i][j]=fun(i-1,j-1,arr[i-1][j-1].val+1);
			}
			else{
				node x1=arr[i-1][j];
				node x2=arr[i][j-1];
				if(x1.val>=x2.val){
					arr[i][j]=fun(i-1,j,x1.val);
				}
				else{
					arr[i][j]=fun(i,j-1,x2.val);
				}
			}
		}
	}
	// for(i=0;i<n;i++){
	// 	for(j=0;j<m;j++){
	// 		printf("l r val %lld %lld %lld ",arr[i][j].l,arr[i][j].r,arr[i][j].val);
	// 	}
	// 	printf("\n");
	// }
	intl x1=n-1,y1=m-1,x2=-1,y2=-1;
	vector<char> ans;
	while(x1!=x2 || y1!=y2){
		x2=x1;
		y2=y1;
		x1=arr[x2][y2].l;
		y1=arr[x2][y2].r;
		intl l1=arr[x2][y2].val;
		intl l2=arr[x1][y1].val;
		// printf("x1 y1 x2 y2 l1 l2 %lld %lld %lld %lld %lld %lld\n",x1,y1,x2,y2,l1,l2);
		if(l1==l2){
			continue;
		}
		else{
			ans.push_back(s[x2]);
		}
	}
	if(arr[x2][y2].val>0){
		ans.push_back(s[x2]);
	}
	intl n1=ans.size();
	for(i=n1-1;i>=0;i--){
		cout<<ans[i];
	}
	cout<<"\n";
}


Measured memory_bytes: 214232
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int N, s[SIZE];
map<int,ll> suml[SIZE], sumr[SIZE];

int main(){

  scanf("%d", &N);

  for (int i=0; i<N; i++) {
    scanf("%d", s+i);
  }

  for (int i=1; i<=N-1; i++) {
    ll sum = 0;
    for (int j=0; j<=N-1; j+=i) {
      sum += s[j];
      suml[j][i] = sum;
    }
  }

  for (int i=1; i<=N-1; i++) {
    ll sum = 0;
    for (int j=N-1; j>=0; j-=i) {
      sum += s[j];
      sumr[j][i] = sum;
    }
  }

  ll ans = 0;

  for (int A=1; A<N-1; A++) {
    int r = N-1 - A;

    for (auto p : sumr[A]) {
      int d = p.first;
      int B = A - d;
      if (B > 0 && (A % d != 0 || A / d > r / d)) {
        ans = max(ans, sumr[A][d] + suml[r][d]);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 177792
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for(;;)
	{
		c=c-b;
		if(c<=0)
		{
			cout<<"Yes";
			return 0;
		}
		a=a-d;
		if(a<=0)
		{
			cout<<"No";
			return 0;
		}
	}
}

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pe(s): return print(str(s), file=sys.stderr)


def main():
    n = I()
    aa = [LI_() for _ in range(n-1)]
    c = sorted(LI(), reverse=True)
    e = collections.defaultdict(set)
    for a,b in aa:
        e[a].add(b)
        e[b].add(a)

    ci = 0
    q = [0]
    v = set([0])
    r = [0] * n
    while q:
        nq = []
        for t in q:
            r[t] = c[ci]
            ci += 1
            for nt in e[t]:
                if nt in v:
                    continue
                v.add(nt)
                nq.append(nt)
        q = nq

    return '{}\n{}'.format(sum(c[1:]), ' '.join(map(str, r)))


print(main())



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

int main(){
	for(int i = 0; i < 10000; i++) {
		int x;
		scanf("%d", &x);
		if(x != 0)
			printf("Case %d: %d\n", i+1, x);
		else break;
	}
}



Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
    for(ll i : x) {
        cout << i << endl;
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vl A, B;
void input() { cin >> n; }
void solve() {
    A = vl(n, 0);
    rep(a, 100) {
        rep(b, 100) {
            rep(c, 100) {
                if(a * b * c == 0)
                    continue;
                x = a * a + b * b + c * c + a * b + b * c + c * a;
                if(x && x < n + 1) {
                    A[x - 1]++;
                }
            }
        }
    }
    print(A);
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}

Measured memory_bytes: 3732
import java.util.*;
class Main{
	Scanner sc=new Scanner(System.in);
	void to(){
		for(int i=1; i<10; i++){
			for(int j=1; j<10; j++){
				System.out.println(i+"x"+j+"="+i*j);
			}
		}
	}
	
	public static void main(String[]agrs){
		new Main().to();
	}
}

Measured memory_bytes: 17144
H,W,h,w=map(int,input().split())
if H%h==0 and W%w==0:
  print("No")
  exit()
print("Yes")
Base=[[0]*w for i in range(h)]
Base[0][0]=10000000
Base[-1][-1]=-10000001
M=[[0]*W for i in range(H)]
for i in range(H):
  for j in range(W):
    M[i][j]=str(Base[i%h][j%w])
for i in range(H):
  print(" ".join(M[i]))


Measured memory_bytes: 69212
// https://qiita.com/e869120/items/eb50fdaece12be418faa

#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

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

    vector<pair<double, double>> xy(n);
    rep(i, n) {
        cin >> xy[i].first >> xy[i].second;
    }

    double res = 0.0;
    double d = 0.0;

    vector<int> v(n);
    iota(v.begin(), v.end(), 0);
    do {
        d++;
        rep(i, n-1) {
            double dx = xy[v[i+1]].first - xy[v[i]].first;
            double dy = xy[v[i+1]].second - xy[v[i]].second;
            res += pow(dx * dx + dy * dy, 0.5);
        }
    } while(next_permutation(v.begin(), v.end()));

    cout << fixed << setprecision(10) << res / d << endl;

    return 0;
}

Measured memory_bytes: 256
class Dice():

    def __init__(self, d):
        self.d = d
        self.north = [2, 6, 3, 4, 1, 5]
        self.south = [5, 1, 3, 4, 6, 2]
        self.east = [4, 2, 1, 6, 5, 3]
        self.west = [3, 2, 6, 1, 5, 4]
        self.label = {(d[0], d[1]): d[2]}

    def roll(self, direction):
        if direction == 'S':
            self.d = [ self.d[self.south[i]-1] for i in range(6) ]
        elif direction == 'N':
            self.d = [ self.d[self.north[i]-1] for i in range(6) ]
        elif direction == 'E':
            self.d = [ self.d[self.east[i]-1] for i in range(6) ]
        elif direction == 'W':
            self.d = [ self.d[self.west[i]-1] for i in range(6) ]

    def rollAll(self):
        for i in range(4):
            for i in range(4):
                self.roll('E')
                self.label[(self.d[0], self.d[1])] = self.d[2]
            self.roll('S')
        self.roll('E')
        self.roll('S')
        for i in range(4):
            self.roll('E')
            self.label[(self.d[0], self.d[1])] = self.d[2]
        self.roll('S')
        self.roll('S')
        for i in range(4):
            self.roll('E')
            self.label[(self.d[0], self.d[1])] = self.d[2]

    def getLabel(self):
        return self.label

    def getDice(self):
        return self.d

s = [ int(s) for s in input().split() ]
n = int(input())
dice = Dice(s)
dice.rollAll()
l = dice.getLabel()

for i in range(n):
    a,b = [ int(s) for s in input().split() ]
    print(l[(a,b)])



Measured memory_bytes: 5616
// Created by sz
#include <bits/stdc++.h>
using namespace std;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int T,X;
    cin>>T>>X;
    cout<<fixed<<setprecision(4)<<(double)T/X<<endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
	int n;
	std::cin >> n;
	std::vector<int>a(n) ;
	rep(i,n)std::cin >> a[i];
	std::cout << accumulate(all(a),0)-n << std::endl;
	
}

Measured memory_bytes: 256
import java.util.*; 
import java.lang.*; 

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int S = scan.nextInt();
                int W = scan.nextInt();
                
                if(S<=W){
                    System.out.println("unsafe");
                }
                else{
                    System.out.println("safe");
                }
	}
}

Measured memory_bytes: 35780
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    vector<int> h(n),table(n,INT_MAX);
    for(int i=0;i<n;i++)    cin>>h[i];
    table[n-1]=0;
    for(int i=n-2;i>=0;i--){
        for(int j=i+1;j<=i+k;j++){
            if(j<n)
                table[i] = min(table[i],table[j]+abs(h[i]-h[j]));
        }
    }
    cout<<table[0]<<endl;
}


Measured memory_bytes: 1024
"全探索で行うパターン(最後に頼む料理によって合計の時間が変わる)"

original_time = [int(input()) for _ in range(5)]  # 元の時間
next_time = [(i+9)//10 * 10 for i in original_time]  # 次の注文を行えるまでに必要な時間

order_time = []
for i in range(len(original_time)):
    sum = 0
    for j in range(len(original_time)):
        if i == j:
            sum += original_time[j]
        else:
            sum += next_time[j]
    order_time.append(sum)

print(min(order_time))


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
typedef long long ll;
using namespace std;

int main()
{
    string s; cin >> s;
    stack<char> st;
    for (char c : s) {
        if (c == 'S') {
            st.push(c);
        }
        else if (c == 'T') {
            if (st.empty()) {
                st.push(c);
                continue;
            }
            if (st.top() == 'S') {
                st.pop();
            }
            else {
                st.push(c);
            }
        }
    }

    cout << st.size() << endl;
}

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

#define get(a) scanf("%lld", &a);
#define print(a) printf("%lld",a)
#define println(a) printf("%lld\n",a)

#define do(a) for(long long i = 0; i < a; i++)
#define loop() for(;;) 
#define done return 0
string s;
long long n;

int main() {
    cin >> s;
    n = s.length();
    do(n) {
        if (s[i]=='7') {
            printf("Yes\n");
            done;
        }
    }
    printf("No\n");
    done;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define X first
#define Y second
typedef long long ll;
using namespace std;

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

int a[5][5];

int main () {

	for (int i = 0; i < 3; i ++) {
		for (int j = 0; j < 3; j ++) {
			cin >> a[i][j];
		}
	}
	
	for (int i = 0; i < 3; i ++) {
		for (int j = i+1; j < 3; j ++) {
			if (a[i][0]-a[j][0] != a[i][1]-a[j][1] || a[i][0]-a[j][0] != a[i][2]-a[j][2]) {
				cout << "No";
				return 0;
			}
			
			if (a[0][i]-a[0][j] != a[1][i]-a[1][j] || a[0][i]-a[0][j] != a[2][i]-a[2][j]) {
				cout << "No";
				return 0;
			}
		}
	}
	
	
	cout << "Yes";

	return 0;
}

Measured memory_bytes: 256
# - coding : utf-8 -*-
 
n, m = list(map(int, input().split()))
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()

for i in range(n - 1):
    if ys == []:
        break
    else:
        ys.pop()
print(sum(ys))

Measured memory_bytes: 16272
import java.util.*;
class Pair{
	int t;
	String name;
	public Pair(int val,String str){
		t = val;
		name = str; 
	}
}
public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,quantum;
		n = sc.nextInt();
		quantum = sc.nextInt();
		Queue<Pair> queue = new LinkedList<Pair>();
		for(int i=0;i<n;i++){
			String name = sc.next();
			int t = sc.nextInt();
			queue.offer(new Pair(t,name));
		}
		int elapse =0;
		while(!queue.isEmpty()){
			Pair p = queue.poll();
			int c= Math.min(p.t, quantum);
			p.t -=c;
			elapse+=c;
			if(p.t>0){
				queue.offer(p);
			}else{
				System.out.println(p.name+" "+elapse);
			}
		}
		
	}
}

Measured memory_bytes: 73036
#include<stack>
#include<map>
#include<string>
#include<iostream>
#include<set>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
//#define scanf scanf_s
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pub push_back
using namespace std;
typedef long long int llint;
const llint one = 1;
const llint big = (one<<61);
const int mod=1000000007;
inline int gcd(int a,int b) { return b ? gcd(b, a % b) : a; }
string mon;
int it;
int toku(void){
	vector<int> kai;
	int ans=0,su=0;
	while(-1){
		if(mon[it]=='['){ it++;kai.pub(toku()); } else if(mon[it]==']'){
			it++;
			sort(kai.begin(),kai.end());
			for(su=0;su<(kai.size()+1)/2;su++){
				ans+=kai[su];
			}
			return ans;
		} else {
			su=0;
			while(mon[it]!='['&&mon[it]!=']'){ su*=10;su+=mon[it]-'0';it++; }
			kai.pub((su+1)/2);
		}
	}
	return 0;
}
void solve(void){
	mon.clear();
	it=0;
	cin>>mon;
	mon+="]";
	printf("%d\n",toku());
}

int main(void){
	int Q;
	scanf("%d",&Q);
	for(;Q>0;Q--){solve();}
	return 0;
}

Measured memory_bytes: 3372
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,m,a[N],b[N],u,v,x,i,g[N],id[N];
vector<int>e[N];
long long f[N],su[N];
int gfa(int x){return g[x]==x?x:g[x]=gfa(g[x]);}
inline bool cmp(const int&x,const int&y){return a[x]-b[x]<a[y]-b[y];}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;for(i=1;i<=n;++i)cin>>a[i]>>b[i],g[i]=id[i]=i;
	for(i=1;i<=m;++i)cin>>u>>v,e[u].push_back(v),e[v].push_back(u);
	sort(id+1,id+n+1,cmp);
	for(i=1;i<=n;++i){
		u=id[i];su[u]=b[u];f[u]=1ll<<60;
		for(int v:e[u])if(su[v]){
			x=gfa(v);if(x==u)continue;
			f[u]=min(f[u],max(f[x],a[u]-su[x]-b[u]));su[u]+=su[x];g[x]=u;
		}
		if(su[u]==b[u])f[u]=max(a[u]-b[u],0);
	}
	cout<<f[u]+su[u]<<endl;
	return 0;
}

Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,x=0;
	string a[55];
	cin>>h>>w;
	for(int i=0;i<h;i++)
		cin>>a[i];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(a[i][j]=='#')
			{
				if(i!=0)	{if(a[i-1][j]=='#')	continue;}
				if(i!=h-1)	{if(a[i+1][j]=='#')	continue;}
				if(j!=0)	{if(a[i][j-1]=='#')	continue;}
				if(j!=w-1)	{if(a[i][j+1]=='#')	continue;}
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

namespace ABC125C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var acc_left = new int[n];
            var acc_right = new int[n];
            acc_left[0] = a[0];
            acc_right[n - 1] = a[n - 1];
            for(int i = 1; i < n; i++)
            {
                acc_left[i] = (int)Gcd((long)acc_left[i - 1], (long)a[i]);
                acc_right[n - i - 1] = (int)Gcd((long)acc_right[n - i], (long)a[n - i - 1]);
            }
            var maxGcd = Math.Max(acc_right[1],acc_left[n-2]);
            for(int i = 1; i < n - 1; i++)
            {
                var tmpGcd = (int)Gcd((int)acc_left[i - 1], (int)acc_right[i + 1]);
                maxGcd = Math.Max(maxGcd, tmpGcd);
            }
            Console.WriteLine(maxGcd);
        }
        static long Gcd(long a, long b)
        {
            return (a < b) ? Gcd(b, a)
                 : (b > 0) ? Gcd(b, a % b)
                           : a;
        }

        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }
}


Measured memory_bytes: 25052