akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int h,w,m; cin >>h >>w >>m;
  vector<int>cnth(h,0),cntw(w,0),hh,ww;
  map<pii,int>mp; int maxh=0,maxw=0;
  for(int i=0; i<m; i++){
    int x,y; cin >>x >>y;
    cnth[x-1]++; cntw[y-1]++;
    mp[{x-1,y-1}]++;
  }
  for(int i=0; i<h; i++) maxh=max(maxh,cnth[i]);
  for(int i=0; i<w; i++) maxw=max(maxw,cntw[i]);
  for(int i=0; i<h; i++) if(cnth[i]==maxh) hh.push_back(i);
  for(int i=0; i<w; i++) if(cntw[i]==maxw) ww.push_back(i);
  for(auto i:hh) for(auto j:ww) if(!mp[{i,j}]){cout <<maxh+maxw; return;}
  cout <<maxh+maxw-1;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 28488
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );
	final int n = Integer.parseInt( stdin.nextLine() );
	for ( int i = 0; i < n; i++ ) {
	    final String[] input = stdin.nextLine().split( ":" );
	    final int h = Integer.parseInt( input[ 0 ] );
	    final int m = Integer.parseInt( input[ 1 ] );
	    final int dh = 60 * h + m;
	    final int dm = 12 * m;
	    final int mind = min( dh, dm );
	    final int maxd = max( dh, dm );
	    final int diff = min( abs( mind - maxd ), abs( mind + 720 - maxd ) );
	    if ( diff < 60 ) {
		System.out.println( "alert" );
	    } else if ( 60 <= diff && diff < 180 ) {
		System.out.println( "warning" );
	    } else {
		System.out.println( "safe" );
	    }
	}
    }    
}

Measured memory_bytes: 23364
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            int count = Integer.parseInt(scan.nextLine());
            String[] nums = scan.nextLine().split(" ");

            for (int i = (count - 1); i > 0; i--) {
                System.out.print(nums[i] + " ");
            }
            System.out.println(nums[0]);
        }
    }
}



Measured memory_bytes: 26208
#include "bits/stdc++.h"
using namespace std;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define mod 998244353
#define ff first
#define ss second
#define pi pair<lli,lli>
#define pii pair<lli,pi>
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 1e5 + 5;
vector<int> g[N];
int vis[N];
int h[N];
int ans = 0;

void dfs(int x)
{
	vis[x] = 1;
	int init = h[x], f = 1;
	for(int i=0;i<g[x].size();i++)
	{
		int y = g[x][i];
		if(h[y] >= init) f = 0;
		if(vis[y]) continue;
		dfs(y);
	}

	if(f) ans++;
}

int main() {
	IOS
	int T = 1;
	// cin >> T;
	while(T--) 
	{
		int n, m;
		cin >> n >> m;
		for(int i=1;i<=n;i++)
			cin >> h[i];
		for(int i=1;i<=m;i++)
		{
			int x,y;
			cin >> x>>y;
			g[x].pb(y);
			g[y].pb(x);
		}
		for(int i=1;i<=n;i++)
		{
			if(vis[i]) continue;
			dfs(i);
		}
		cout << ans << endl;
		
	}
	return 0;
}

Measured memory_bytes: 11620
n,m=map(int,input().split())
ml=0
mr=100000
for i in range(m):
  l,r=map(int,input().split())
  ml=max(ml,l)
  mr=min(mr,r)
  if ml>mr:
    break
if ml<=mr:
  print(mr-ml+1)
else:
  print(0)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const long long MAXN=100005;
long long n,m,k,top;
long long a[MAXN],id[MAXN],st[MAXN],ans[MAXN];
bool vis[MAXN];
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		id[i]=i;
	}
	for(long long i=n;i>=1;i--)
		a[i]-=a[i-1];
	scanf("%lld %lld",&m,&k);
	for(long long i=1;i<=m;i++)
	{
		long long x;
		scanf("%lld",&x);
		swap(id[x],id[x+1]);
	}
	for(long long i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			top=0;
			for(long long j=i;!vis[j];j=id[j])
			{
				st[++top]=j;
				vis[j]=1;
			}
			for(long long j=1;j<=top;j++)
			{
				ans[st[j]]=a[st[(k+j-1)%top+1]];
			}
		}
	}
	for(long long i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%lld\n",ans[i]);
	}
}

Measured memory_bytes: 4352
n = int(input())
A = []
B = []

for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if n % 2 == 0:
    minimum = (A[n//2 - 1] + A[n//2]) // 2
    mini_minus = (A[n//2 - 1] + A[n//2]) % 2
    maximum = (B[n//2 - 1] + B[n//2]) // 2
    maxim_add = (B[n//2 - 1] + B[n//2]) % 2

    ans = (maximum - minimum) * 2 + 1 - mini_minus + maxim_add

else:
    minimum = A[n//2]
    maximum = B[n//2]
    ans = maximum - minimum + 1

print(ans)


Measured memory_bytes: 25432
#include<stdio.h>
int main(void){
	int n,t[4][13]={0},i,j,k;
	char e;

	scanf("%d",&n);
	for(k=1;k<=n;k++){
		scanf("%s %d",&e,&j);
		switch (e){
			case 'S':
				i=0;
				break;
			case 'H':
				i=1;
				break;
			case 'C':
				i=2;
				break;
			case 'D':
				i=3;
				break;
		}
		t[i][j-1]=1;
	}
	for(i=0;i<=3;i++){
		for(j=0;j<=12;j++){
			if(t[i][j]==0){
				switch (i){
					case 0:
						printf("S %d\n",j+1);
						break;
					case 1:
						printf("H %d\n",j+1);
						break;
					case 2:
						printf("C %d\n",j+1);
						break;
					case 3:
						printf("D %d\n",j+1);
						break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#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;
int main(){
    string s;
    int k;
    cin >> k >> s;
    int n = k;
    int m = s.size();
    if(m<=n)cout << s << endl;
    else {
        cout << s.substr(0,k) << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
//#include <bits/stdc++.h>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <map>
#include <iterator>
#include <iomanip>
#include <queue>
#include <utility>

using namespace std;
#define ll long long int
#define c(x) ll x;cin>>x
#define cc(x,y) ll x,y;cin>>x>>y
#define ccc(x,y,z) ll x,y,z; cin>>x>>y>>z
#define db long double
#define fast cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define inf 200000000000000
#define mod 1000000007
#define eps 1e-7
#define PI 3.1415926535897932385
#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (ll)(x).size()
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define print(arr,n) rep(i,n) cout<<arr[i]<<" "; cout<<endl
#define print2(arr,n,m) rep(i,n){ rep(j,m) cout<<arr[i][j]<<" "; cout<<endl; }
#define dyn1(arr,n) ll* arr=new ll[n]; rep(i,n) arr[i]=0;
#define dyn2(arr,n,m) ll** arr=new ll*[(n)]; rep(i,n) arr[i]=new ll[m]; rep(i,n) rep(j,m) arr[i][j]=0
#define carr(arr,n) rep(i,n) cin>>arr[i]
#define carr2(arr,n,m) rep(i,n) rep(j,m) cin>>arr[i][j]
#define debug(a) cout<<" :: "<<#a<<" == "<<a<<endl
#define debug2(a,b) cout<<" :: "<<#a<<" == "<<a<<" :: "<<#b<<" == "<<b<<endl
typedef pair<int,int> ii;
typedef vector<ii> vii;

inline ll maxim(ll a,ll b) {if(a>b) return a; else return b;}
inline ll minim(ll a,ll b) {if(a<b) return a; else return b;}
inline bool equals(double a, double b){ return fabs(a - b) < 1e-9; }
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }


ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1) res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res;
}
/*
ll ncr(ll n,ll r)
{
  if(r>n) return 0;
  if((n==r)||(r==0))
  {
    return 1;
  }
  if(r==1) return n;
  if(r>n-r)
  {
    r=n-r;
  }

  string key=to_string(n)+"|"+to_string(r);
  if(m.find(key)==m.end())
  {
    ll answer=ncr(n-1,r-1)+ncr(n-1,r);
    m[key]=answer;
  }
  //cout<<key<<" "<<m[key]<<endl;
  return m[key];
}
*/

int modInverse(int a, int m)
{
    int m0 = m;
    int y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        // q is quotient
        int q = a / m;
        int t = m;
        // m is remainder now, process same as
        // Euclid's algo
        m = a % m, a = t;
        t = y;
        // Update y and x
        y = x - q * y;
        x = t;
    }
    // Make x positive
    if (x < 0)
       x += m0;
    return x;
}

ll arr[200001];

int main()
{
  fast;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cout<<setprecision(10)<<fixed;
  cc(n,k);
  db a=log(n);
  db b=log(k);
  a=a/b;
  ll h=(ll)a+1;
  cout<<h<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,r;
    while(cin>>n>>r,n||r){
        vector<int>V[2];
        V[0].resize(n);
        for(int i=0;i<n;i++)V[0][i]=n-i;
        int p,c;
        for(int i=0;i<r;i++){
            cin>>p>>c;
            V[(i+1)&1].clear();
            for(int j=p-1;j<p+c-1;j++)
                V[(i+1)&1].push_back(V[i&1][j]);

            for(int j=0;j<p-1;j++)
                V[(i+1)&1].push_back(V[i&1][j]);
            for(int j=p+c-1;j<n;j++)
                V[(i+1)&1].push_back(V[i&1][j]);
           ///for(int j=0;j<n;j++)cout<<V[(i+1)&1][j]<<" ";
           // cout<<endl;
        }
        cout<<V[r&1][0]<<endl;
    }
}

Measured memory_bytes: 1220
#include<iostream>
#include<algorithm>
#include<climits>
#include<queue>
#include<utility>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int NMAX=1<<17;
const int INF=100000;
int h,w;
int c[11][11];
int a[210][210];
struct edge{
  int to,cost;
};
vector<edge> g[11];//グラフの情報
int d[11];
int dijk(int s){
  priority_queue<pi,vector<pi>,greater<pi> > que;//pair(コスト,頂点)としてコストの小さい順に並ぶ
  rep(i,10) d[i]=INF;
  d[s]=0;
  que.push(pi(0,s));
  while(que.size()){
    pi p=que.top();que.pop();
    int v=p.second;//取り出した頂点
    if(v==1) break;
    if(d[v]<p.first) continue;
    rep(i,g[v].size()){
      int t=g[v][i].to,c=g[v][i].cost;
      if(d[v]+c<d[t]){
	d[t]=d[v]+c;
	que.push(pi(d[t],t));
      }
    }
  }
  return d[1];
}
int main(){
  scan(h);scan(w);
  rep(i,10){
    rep(j,10){
      scan(c[i][j]);
    }
  }
  rep(i,h){
    rep(j,w){
      scan(a[i][j]);
    }
  }
  rep(i,10){
    rep(j,10){
      if(i!=j){
	edge e;e.to=j;e.cost=c[i][j];
	g[i].push_back(e);
      }
    }
  }
  int dres[11];
  rep(i,10){
    dres[i]=dijk(i);
  }
  //  rep(i,10) prin(dres[i]);
  int cnt[11];
  rep(i,10) cnt[i]=0;
  rep(i,h){
    rep(j,w){
      if(a[i][j]!=-1){
	cnt[a[i][j]]++;
      }
    }
  }
  int res=0;
  rep(i,10){
    res+=cnt[i]*dres[i];
  }
  prin(res);
  
  
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int sx,sy,tx,ty,cox=0,coy=0;
  vector<string> ans;
  cin>>sx>>sy>>tx>>ty;
  if(tx-sx>0){
    for(int i=0;i<tx-sx;i++){
      ans.push_back("R");
    }
    cox=1;
  }
  else{
    for(int i=0;i<sx-tx;i++){
      ans.push_back("L");
    }
  }
  if(ty-sy>0){
    for(int i=0;i<ty-sy;i++){
      ans.push_back("U");
    }
    coy=1;
  }
  else{
    for(int i=0;i<sy-ty;i++){
      ans.push_back("D");
    }
  }

  if(cox==1){
    for(int i=0;i<tx-sx;i++){
      ans.push_back("L");
    }
  }
  else{
    for(int i=0;i<sx-tx;i++){
      ans.push_back("R");
    }
  }
  if(coy==1){
    for(int i=0;i<ty-sy+1;i++){
      ans.push_back("D");
    }
  }
  else{
    for(int i=0;i<sy-ty+1;i++){
      ans.push_back("U");
    }
  }
  if(cox==1){
    for(int i=0;i<tx-sx+1;i++){
      ans.push_back("R");
    }
  }
  else{
    for(int i=0;i<sx-tx+1;i++){
      ans.push_back("L");
    }
  }
  if(coy==1){
    for(int i=0;i<ty-sy+1;i++){
      ans.push_back("U");
    }
    if(cox==1)ans.push_back("L");
    else ans.push_back("R");
    ans.push_back("U");
  }
  else{
    for(int i=0;i<sy-ty+1;i++){
      ans.push_back("D");
    }
    if(cox==1)ans.push_back("L");
    else ans.push_back("R");
    ans.push_back("D");
  }
  if(cox==1){
    for(int i=0;i<tx-sx+1;i++){
      ans.push_back("L");
    }
  }
  else{
    for(int i=0;i<sx-tx+1;i++){
      ans.push_back("R");
    }
  }
  if(coy==1){
    for(int i=0;i<ty-sy+1;i++){
      ans.push_back("D");
    }
    if(cox==1)ans.push_back("R");
    else ans.push_back("L");
  }
  else{
    for(int i=0;i<sy-ty+1;i++){
      ans.push_back("U");
    }
    if(cox==1)ans.push_back("R");
    else ans.push_back("L");
  }
  for(int i=0;i<ans.size();i++){
    cout<<ans.at(i);
  }
  cout<<endl;

  
  return 0;
}


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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;


#define MAX 100000+10
#define MOD 1000000007

ll fac[MAX],caf[MAX]; //factorial e inverso

ll deg(ll x,ll d){
	d %= MOD - 1;
    	if(d < 0)d += MOD - 1;
    	ll y = 1;
    	while (d) {
        	if (d & 1) y *= x, y %= MOD;
        	x *= x, x %= MOD;
        	d /= 2;
    	}
    	return y;
}
ll coeff(int n,int k){
	return fac[n] * caf[k] % MOD * caf[n - k] % MOD;
}


int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	fac[0] = caf[0] = 1;
	forn(i,1,MAX)fac[i] = i * fac[i - 1] % MOD, caf[i] = deg(fac[i], -1);
	int S; cin >> S;
	ll res = 0;
	
	forn(i,1,2000){
		int Sp = S-3*i;
		if(Sp < 0)break;
		ll add = coeff(i+Sp-1,i-1);
		res = ((res%MOD)+(add%MOD))%MOD;
	}
	if(res < 0)res += MOD;
	cout << res << '\n';
	
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

int main( void )
{
	char a;
	cin >> a;

	if ( 'a' <= a && a <= 'z' ) {
		cout << 'a' << endl;
	}
	else {
		cout << 'A' << endl;
	}

	return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            int[] B = new int[N];
            int[] C = new int[N-1];
            string[] A_in = Console.ReadLine().Split(' ');
            string[] B_in = Console.ReadLine().Split(' ');
            string[] C_in = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(A_in[i]);
                B[i] = int.Parse(B_in[i]);
                if (i < N-1) C[i] = int.Parse(C_in[i]);
            }
            int result = 0;
            for (int i = 0; i < N; i++)
            {
                result += B[A[i] - 1];
                if (i > 0 && (A[i] - A[i - 1]) == 1) result += C[A[i] - 2];
            }
            Console.WriteLine(result.ToString());
//            Console.Read();
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, a, b) for (long long int i = (a); i < (b); i++)

using namespace std;
using ll = long long int;
using ld = long double;

auto p = [](auto s){
    cout << s << endl;
};

int main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
    return 0;
}

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


int main(){
    int K,A,B;
    cin >> K >> A>> B;
    
    if(A%K!=0 && B%K!=0 && A/K==B/K)
    cout << "NG" << endl;
    else
        cout << "OK" << endl;
    return 0;
}











Measured memory_bytes: 3636
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
from decimal import *

def main():
    a, b = map(Decimal, input().split())

    # getcontext().prec = 2

    print(floor(a*b))
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 73080
#include<iostream>
#include<utility>

const int MAX_N=100;

int b_sort(int A[],int N){
    int cnt=0;
    for(int i=0;i<N;i++){
        for(int j=N-1;j>i;j--){
            if(A[j-1]>A[j]){
                std::swap(A[j-1],A[j]);
                cnt++;
            }
        }
    }
    return cnt;
}


int main(void){
    int N;
    int A[MAX_N];
    std::cin>>N;
    for(int i=0;i<N;i++)
        std::cin>>A[i];
    int cnt_swap=b_sort(A,N);
    for(int i=0;i<N;i++){
        if(i) std::cout<<" ";
        std::cout<<A[i];
    }
    std::cout<<std::endl;
    std::cout<<cnt_swap<<std::endl;
    return 0;
}


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

using namespace std;

int k;
vector<int> h;
vector<int> dp;
int cost(int i, int j) {
	return abs(h[i] - h[j]);
}
// bottom up
// int main() {
// 	int n;
// 	cin>>n;
// 	h.resize(n);
// 	for(int i=0; i<n; i++) {
// 		cin>>h[i];
// 	}
// 	dp.resize(n);
// 	dp[0] = 0;
// 	dp[1] = abs(h[0]-h[1]);
// 	for(int i=2; i<n; i++) {
// 		dp[i] = min(dp[i-1] + cost(i,i-1), dp[i-2] + cost(i,i-2));
// 	}
// 	cout<<dp[n-1]<<endl;
// 	return 0;
// }

//top down
int func(int idx) {
	if(idx>=dp.size() || idx<0)
		return INT_MAX;
	if(dp[idx]!=-1)
		return dp[idx];
	if(idx==0)
		return dp[0] = 0;
	int temp = func(idx-1) + cost(idx,idx-1);
	for(int i=2; i<=k && idx-i>=0; i++)
		temp = min(temp, func(idx-i) + cost(idx,idx-i));
	return dp[idx] = temp;
}

int main() {
	int n;
	cin>>n>>k;
	h.resize(n);
	for(int i=0; i<n; i++) {
		cin>>h[i];
	}
	dp.resize(n,-1);
	cout<<func(n-1)<<endl;
	return 0;
}



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

#define N 100

int main(){
  int n,i,j,k,l,mt[N],a[N][N],q,mt1[N];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d%d",&mt1[i],&mt[i]);
  }

  mt[0]=mt1[1];

  for(i=1;i<=n;i++){
    a[i][i]=0;
  }

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      a[i][j]=2147483645;
      for(k=i;k<j;k++){
	q=a[i][k]+a[k+1][j]+mt[i-1]*mt[k]*mt[j];
	if(q<a[i][j]) a[i][j]=q;
      }
    }
  }

  printf("%d\n",a[1][j]);

  return 0;
}



Measured memory_bytes: 2112
ans = []*10000000
count = 0
while True:
    m,f,r = map(int, input().split())
    if(m == -1 and  f == -1 and r == -1):
        break
    if(m == -1 or f == -1):
        ans.append("F")
    elif(m+f >= 80):
        ans.append("A")
    elif(m+f >=65):
        ans.append("B")
    elif(m+f >= 50):
        ans.append("C")
    elif(m+f >= 30):
        if(r >= 50):
            ans.append("C")
        else:
            ans.append("D")
    else:
        ans.append("F")
    count += 1


for i in range(0,count):
    print(ans[i])



Measured memory_bytes: 5596
from collections import Counter
N = int(input())
counter = [Counter(input()) for _ in range(N)]
c = counter[0]
for i in range(1,N):
  for k,v in c.items():
    c[k] = min(counter[i][k], c[k])
c = sorted(c.items())
answer = ''
for k,v in c:
  answer += k*v
print(answer)


Measured memory_bytes: 3316
#include <stdio.h>

int main() {
	
	int N, K, X, Y;
	int ans = 0;

	scanf("%d%d%d%d", &N, &K, &X, &Y);

	for (int i = 1; i <= N; i++) {
		if (i <= K)ans += X;
		else { ans += Y; }
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define f first
#define s second

#define T long double

struct PT{
	T x, y;
	PT() {}
	PT(T x, T y) : x(x), y(y) {}
	PT(const PT& p) : x(p.x), y(p.y) {}
	bool operator < (const PT& rhs) const{
		return make_pair(y, x) < make_pair(rhs.y, rhs.x);
	}
	bool operator == (const PT& rhs) const{
		return make_pair(y, x) == make_pair(rhs.y, rhs.x);
	}
	PT operator + (const PT& p) const {
		return PT(x+p.x, y+p.y);
	}
	PT operator - (const PT& p) const {
		return PT(x-p.x, y-p.y);
	}
	PT operator * (T c) const {
		return PT(x*c, y*c);
	}
	PT operator / (T c) const {
		return PT(x/c, y/c);
	}
};

T dot(PT p, PT q){
	return p.x*q.x + p.y*q.y;
}

T dist2(PT p, PT q){
	return dot(p-q, p-q);
}

PT RotateCCW90(PT p){
	return PT(-p.y, p.x);
}

vector<PT> CCI(PT a, PT b, T r, T R){
	vector<PT>ret;
	T d=sqrt(dist2(a, b));
	if(d>r+R || d+min(r, R)<max(r, R))
		return ret;
	T x = (d*d-R*R+r*r)/(2*d);
	T y = sqrt(r*r-x*x);
	PT v = (b-a)/d;
	ret.pb(a+v*x+RotateCCW90(v)*y);
	if(y>0){
		ret.pb(a+v*x-RotateCCW90(v)*y);
	}
	return ret;
}
vector<pair<T, T>>v;
int n;

bool f(T r){
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			PT a;
			PT b;
			a.x=v[i].f;
			a.y=v[i].s;
			b.x=v[j].f;
			b.y=v[j].s;
			vector<PT>ret=CCI(a, b, r, r);
			for(auto u:ret){
				bool che=1;
				for(int k=0; k<n; k++){
					if(k==i || k==j){
						continue;
					}
					T xx=u.x;
					T yy=u.y;
					if(r<sqrt((xx-v[k].f)*(xx-v[k].f)+(yy-v[k].s)*(yy-v[k].s))){
						che=0;
					}
				}
				if(che){
					return 1;
				}
			}
		}
	}
	return 0;
}


main() {
	
	cin>>n;
	
	for(int i=0; i<n; i++){
		T x, y;
		cin>>x>>y;
		v.pb({x, y});
	}
	double hi=3000;
	double lo=0;
	double ans=-1;
	for(int i=0; i<100; i++){
		double mid=(lo+hi)/2;
		if(f(mid)){
			ans=mid;
			hi=mid;
		}
		else{
			lo=mid;
		}
	}
	cout<<fixed<<setprecision(10)<<ans;
	return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);
 
int main() {
	int n;
	cin >> n;
	ll sum = 0;
	for(int i = 1; i <= n; i++){
		if(i%3!=0 && i%5!=0) sum += i;
	}
	cout << sum << endl;
	return 0;
}

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

int main(){

	ll N;

	cin >> N;

	ll a[N+1] = {} , dpf[N+1][N+1] = {} , dps[N+1][N+1] = {};
	// dpf[i][j] := [i,j]の区間でゲームを行った際の先攻の人の得点
	// dps[i][j] := [i,j]の区間でゲームを行った際の後攻の人の得点


	for(int i=1 ; i<=N ; i++ ){
		cin >> a[i];
		dpf[i][i] = a[i];
	}

	for(int i=1 ; i<=N ; i++ ){ // i := 幅 -> 幅が小さい区間から決まっていくから
		for(int j=1 ; j+i<=N ; j++ ){ // [j,j+i]の計算

			dpf[j][i+j] = max( dps[j+1][i+j]+a[j] , dps[j][i+j-1]+a[i+j] );
			// 区間[j,i+j]で先攻の人の得点は 
			//( a[j]+区間[j+1,i+j]で後攻の人の得点 )　または　( a[j+i]+区間[j,i+j-1]で後攻の人の得点 )


			dps[j][i+j] = dps[j+1][i+j]+a[j] > dps[j][i+j-1]+a[i+j] ? dpf[j+1][i+j] : dpf[j][i+j-1];
			// 区間[j,i+j]で後攻の人の得点は 
			// 先攻の人がa[j]を取った場合 -> 区間[j+1,i+j]の先攻の人の得点
			// 先攻の人がa[i+j]を取った場合 -> 区間[j,i+j-1]の先攻の人の得点
		}
	}

	cout << dpf[1][N] - dps[1][N] << endl;
	
}

Measured memory_bytes: 140928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

// 

const int INF = 987654321;
int n;
int adj[201][201];
int color[201];
bool visited[201];
bool isValid = true;

void dfs(int here, int c) {
	if(visited[here]) return;
	visited[here] = true;
	color[here] = c;
	rep(there,0,n) {
		if(here == there) continue;
		if(!adj[here][there]) continue;
		if(!visited[there]) {
			dfs(there, -c);
		} else {
			if(color[there] == color[here]) {
				isValid = false;
			}
		}
	}
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	cin >> n;
	rep(i,0,n) {
		rep(j,0,n) {
			scanf("%1d", &(adj[i][j]));
		}
	}
	memset(visited, false, sizeof(visited));
	dfs(0, 1);
	if(!isValid) {
		cout << -1 << endl;
		return 0;
	}
	vector<vi> dist(n, vi(n, INF));
	rep(i,0,n) rep(j,0,n) {
		if(adj[i][j]) 
			dist[i][j] = 1;
	}
	rep(i,0,n) 
		dist[i][i] = 0;
	rep(k,0,n) rep(i,0,n) rep(j,0,n) {
		dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	}
	int ret = 0;
	rep(i,0,n) rep(j,0,n) {
		ret = max(ret, dist[i][j]);
	}
	cout << ret + 1 << endl;
	return 0;
}


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

#define ll long long

int main()
{
  ll k,n,num,i,min=1000000000;

  cin>>k>>n;

  vector<ll> vec;

  for(i=0;i<n;i++)
  {
    cin>>num;
    vec.push_back(num);
  }

  for(i=1;i<n;i++)
  {
    if(k-vec[i]+vec[i-1]<min)
      min=k-vec[i]+vec[i-1];
  }

  if(vec[n-1]-vec[0]<min)
    min=vec[n-1]-vec[0];

  cout<<min<<endl;

}

Measured memory_bytes: 2420
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    string S;cin >> S;
    string T;cin >> T;
    int ans = 0;
    for(int i = 0;i<S.size();i++){
        if(S.at(i) != T.at(i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3840
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    ll N;
    string S;
    cin >> N;
    cin >> S;
    ll count = 0;
    for (ll i = 0; i < S.size() - 2; i++)
    {
        if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')
        {
            count++;
        }
    }

    cout << count << endl;

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(H==0&&W==0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 34576
N,M,Q = map(int,input().split())
A = []
for i in range(Q):
    b = list(map(int,input().split()))
    A.append(b)

ans = 0
def dfs(x,y,combi):
    global ans
    for i in range(x,M+1):
        if y + 1 == N:
            c = 0
            T = combi[:]
            T.append(i)
            for line in A:
                if T[line[1]-1] - T[line[0]-1] == line[2]:
                    c += line[3]
            ans = max(c,ans)
        else:
            K = combi[:]
            K.append(i)
            dfs(i,len(K),K)

dfs(1,0,[])
print(ans)

Measured memory_bytes: 71928
r=99,n=98,t,s;
int c(int i,int j,int k){printf("< %d %d %d ",i,j,k);}
int a(int i,int j,int k){printf("+ %d %d %d ",i,j,k);}
int b(int i,int j,int k){a(i,j,r);c(n,r,r+1);a(k,r+1,k);}
int m(int i,int l,int j,int p,int k){for(t=0;t<l+p-1;++t){if(t)a(k,k,k);for(s=0;s<=t;++s)if(s<p&&s+l>t)b(i+t-s,j+s,k);}}
int d(int x,int i,int l,int j){for(t=0;t<l;++t){if(t)a(j+t-1,j+t-1,j+t);a(j+t,n,j+t);for(s=t;s+1<l;++s)a(j+s,j+s,j+s+1);c(j+l-1,x,i+t);a(j+t-1,j+t-1,j+t);a(j+t,i+t,j+t);}}
main(){puts("3930");a(0,1,n);c(2,n,n);a(0,n,3);a(1,n,4);d(3,5,30,36);d(4,36,30,67);m(5,30,36,30,2);}

Measured memory_bytes: 1596
import Data.List
import qualified Data.Map as M

makeTable = M.fromList . map (\xs -> (head xs, length xs)) . groupBy (==) . sort
getValue = (maybe 0 id .) . M.lookup

main :: IO ()
main = do
  n <- readLn :: IO Int
  xs <- map read . words <$> getLine
  let t = makeTable xs
  let ys = map (\k -> getValue k t) [1..n]
  putStr $ unlines . map show $ ys

Measured memory_bytes: 81664
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=1000005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar(),rev=0;
	while(ch>'9'||ch<'0') rev=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	x=rev?-x:x;
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,fa[N],ans;
struct node{int x,num;}a[N],b[N];
struct edge{int x,y,val;}p[N];
bool cmp(node a,node b){return a.x<b.x;}
bool cmp2(edge a,edge b){return a.val<b.val;}
inline int find(int x){
	if(fa[x]!=x) fa[x]=find(fa[x]);
	return fa[x];
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x,y;scanf("%d%d",&x,&y);
		a[i]=(node){x,i};b[i]=(node){y,i};
		fa[i]=i;
	}
	sort(a+1,a+n+1,cmp);
	sort(b+1,b+n+1,cmp);
	for(int i=1;i<n;i++)
		p[i]=(edge){a[i].num,a[i+1].num,a[i+1].x-a[i].x},p[i+n-1]=(edge){b[i].num,b[i+1].num,b[i+1].x-b[i].x};
	sort(p+1,p+n*2-1,cmp2);
	for(int i=1;i<=n*2-2;i++){
		int x=find(p[i].x),y=find(p[i].y);
		if(x!=y){
			fa[x]=y;
			ans+=p[i].val;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    double N;
    cin>>N;

    int ans=N/1.08;
    if(N/1.08-ans==0){
        cout<<ans<<endl;
        return 0;
    }else if((int)((ans+1)*1.08)-N==0){
        cout<<ans+1<<endl;
        return 0;
    }else cout<<":("<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

//https://atcoder.jp/contests/keyence2019/submissions/4011139
//https://betrue12.hateblo.jp/entry/2019/01/14/023707
//最大の数字から入れていくと上手くいく

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> A(N),B(M);
    for(int i=0;i<N;i++) cin>>A[i];
    for(int i=0;i<M;i++) cin>>B[i];
    sort(A.begin(),A.end(),greater<int>());
    sort(B.begin(),B.end(),greater<int>());
    A.push_back(-1);
    B.push_back(-1);
    int apt=0,bpt=0,num=N*M;
    ll ans=1;
    while(num>0){
        if(A[apt]==num && B[bpt]==num){
            apt++;
            bpt++;
        }else if(A[apt]==num){
            apt++;
            ans*=bpt;
        }else if(B[bpt]==num){
            bpt++;
            ans*=apt;
        }else{
            ans=ans*(apt*bpt-(N*M-num));
        }
        ans%=MOD;
        num--;
    }
    cout<<ans<<endl;
}



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

using namespace std;

int N,M,L;
vector<int> A,B,C;
int Q;
vector<int>s, t;


class Next {
public:
	int town;
	int cost;
	Next(int _town=0,int _cost =0)
		:town(_town),cost(_cost)
	{}
};

class Node {
public:
	int town;
	int fuel_revocer;
	int fuel_rest;

	Node(int _tonw=0,int _fuel_recover=0,int _fuel_rest=0)
		:town(_tonw),fuel_revocer(_fuel_recover),fuel_rest(_fuel_rest)
	{}
};

int main()
{


	cin >> N;
	cin >> M;
	cin >> L;

	A = vector<int>(M);
	B = vector<int>(M);
	C = vector<int>(M);

	auto cost_tbl = vector<vector<Next>>(N+1);

	for (int i = 0; i < M; i++) {
		cin >> A.at(i);
		cin >> B.at(i); 
		cin >> C.at(i);

		cost_tbl.at(A.at(i)).push_back(Next(B.at(i), C.at(i)));
		cost_tbl.at(B.at(i)).push_back(Next(A.at(i), C.at(i)));
	}
	
	cin >> Q;

	s = vector<int>(Q);
	t = vector<int>(Q);

	auto q_tbl = vector<vector<int>>(N + 1, vector<int>(N+1,0));
	auto ans = vector<int>(Q,-1);

	for (int i = 0; i < Q; i++) {
		cin >> s.at(i);
		cin >> t.at(i);

		q_tbl.at(s.at(i)).at(t.at(i)) = i+1;
		q_tbl.at(s.at(i)).at(0)++;
	}

	

	auto comp = [](Node l, Node r) { 
		if (l.fuel_revocer == r.fuel_revocer) {
			return l.fuel_rest < r.fuel_rest;
		}

		return l.fuel_revocer > r.fuel_revocer;
	};

	for (int i = 1; i < N+1; i++) {

		if (q_tbl.at(i).at(0) == 0) { continue; }

		int ans_count = 0;

		vector<bool> close = vector<bool>(N+1,false);

		priority_queue<Node, vector<Node>, decltype(comp)> que(comp);

		que.push(Node(i, 0, L));

		while (!que.empty()) {
			Node tgt = que.top();
			que.pop();

			if (close.at(tgt.town)) {
				continue;
			}
			close.at(tgt.town) = true;


			if (q_tbl.at(i).at(tgt.town)>0 ) {
				ans_count++;
				ans.at(q_tbl.at(i).at(tgt.town)-1) = tgt.fuel_revocer;

				if (ans_count >= q_tbl.at(i).at(0)) { break; }
			}
			vector<Next>& n = cost_tbl.at(tgt.town);
			for (unsigned j = 0; j < n.size(); j++) {
				if (close.at(n.at(j).town)) {
					continue;
				}

				if (tgt.fuel_rest >= n.at(j).cost) {
					que.push(Node(n.at(j).town,tgt.fuel_revocer, tgt.fuel_rest - n.at(j).cost));
				}
				else if (L >= n.at(j).cost) {
					que.push(Node(n.at(j).town, tgt.fuel_revocer+1, L - n.at(j).cost));
				}
				
			}
		
		}
	}

	for (int i = 0; i < Q; i++) {
		cout << ans.at(i) << endl;
	}

	return 0;
}


Measured memory_bytes: 4764
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if (x-r<0 || y-r<0){
        printf("No\n");
    }else{
        if(x+r>W || y+r>H){
            printf("No\n");
        }else{
            printf("Yes\n");
        }
    }
    
    return 0;
}



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

int main()
{
	int i, j, num, key;
	int *A;
	
	scanf("%d", &num);
	A = (int*)malloc(num * sizeof(int));
	if (NULL == A) {
		return 1;
	}
	
	for (i = 0; i < num; i++) {
		scanf("%d", &A[i]);
		if (i != num -1) {
			printf("%d ", A[i]);
		}
		else {
			printf("%d\n", A[i]);
		}
	}
	
	for (i = 1; i < num; i++) {
        key = A[i];
        for (j = i - 1; j >= 0 && A[j] > key; j--) {
			A[j+1] = A[j];
        }
		A[j+1]=key;
        for (j = 0; j < num; j++) {
			if (j != num -1) {
				printf("%d ", A[j]);
			}
			else {
				printf("%d\n", A[j]);
			}
		}
    }
	
  return 0;
}

	



Measured memory_bytes: 2056
#include<iostream>

using namespace std;

int x,a,b;

int main(){
	cin>>x>>a>>b;
	if(-a+b<=0) cout<<"delicious"<<endl;
	else if(-a+b>0&&x>=(-a+b)) cout<<"safe"<<endl; 
	else cout<<"dangerous"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;


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

        List<Long> list = new ArrayList<Long>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }

        Collections.sort(list, Collections.<Long>reverseOrder());

        long sum = 0;
        for (int i = 0; i < list.size(); i++) {
            if(i % 2 == 0){
                sum += list.get(i);
            }else{
                sum -= list.get(i);
            }
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {

  string S;
  cin >> S;

  vector<string> s{"SUN","MON","TUE","WED","THU","FRI","SAT"};

  for(int i = 0;i < 7;i++) {
    if(S == s.at(i)) {
      cout << 7 - i << endl;
      return 0;
    }
  }

}


Measured memory_bytes: 256
# include <bits/stdc++.h>
  typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second
#define all v.begin(),v.end()
#define fio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef unsigned long long ulll;
 
using namespace std ;
int main () {

   int a,b;
   cin>>a>>b;
   
   if(a==1&&b!=1)
     cout<<"Alice";
     else if(b==1&&a!=1)
         cout<<"Bob";
         
         else{
             if(a>b)
             cout<<"Alice";
             
              else if(b>a)
         cout<<"Bob";
            
            else
            cout<<"Draw";
         }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    int a, b;
    int road[N];

    for(int i = 0; i < N; i++){
        road[i] = 0;
    }
    
    for(int i = 0; i < M; i++){
        cin >> a >> b;
        road[a-1]++;
        road[b-1]++;
    }
    
    for(int i = 0; i < N; i++){
        cout << road[i] << endl;
    }

}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.util.*
import kotlin.math.min

fun main() = abc175c()

@OptIn(ExperimentalStdlibApi::class)
fun abc175c() = SimpleFastIOWithToken_abc175c().exec {
    val (x, count, moveDist) = List(3) { readLong() }

    var remainDist = if (x >= 0) x else x * -1
    var remainCount = count

    if (remainDist > moveDist) {
        val moveCount = min(remainDist / moveDist, count)
        remainDist -= moveCount * moveDist
        remainCount -= moveCount
    }

    if (remainCount == 0L) return@exec println(remainDist)

    val answer = if (remainCount % 2 == 0L) remainDist else moveDist - remainDist

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_abc175c(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_abc175c.() -> Unit) {
        var t: Throwable? = null
        Thread(null, { action() }, "solve", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, t1 -> t = t1 } }
            .apply { start() }.join()
        t?.let { throw it }
        kotlin.io.print(sb)
    }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 34648
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int M=305,N=605;
const ll p=1000000007ll;
ll d[M][M],D[M][M];
int v[N];
inline void upd(ll &a,ll b){if((a+=b)>=p)a-=p;}
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,m,i,a,b;ll t,f=1ll;
    scanf("%d",&m);n=0;
    rep(i,1,m){
		scanf("%d%d",&a,&b);
		if(~b)swap(a,b);
		if(~b)v[a]=v[b]=1;else if(~a)v[a]=2;else f=f*(++n)%p;
	}
    n=m<<1;
    d[0][0]=1ll;
    per(i,n,1)if(v[i]!=1){
        if(v[i]){
            rep(a,0,m)rep(b,0,m)if(t=d[a][b]){
                     upd(D[a  ][b+1], t  )   ;
                if(a)upd(D[a-1][b  ], t  )   ;
            }
        }else{
            rep(a,0,m)rep(b,0,m)if(t=d[a][b]){
                     upd(D[a+1][b  ], t  )   ;
                if(a)upd(D[a-1][b  ], t  )   ;
                if(b)   (D[a  ][b-1]+=t*b)%=p;
            }
        }
        rep(a,0,m)rep(b,0,m){d[a][b]=D[a][b];D[a][b]=0ll;}
        //rep(a,0,m)rep(b,0,m)if(t=d[a][b])printf("dp[%d][%d][%d]=%lld\n",i,a,b,t);
        //puts("");
    }
    printf("%lld",d[0][0]*f%p);
    return 0;
}

Measured memory_bytes: 1664
import math
A,B,C = map(int,input().split())
ns = sorted([A,B,C])
diff32 = ns[2]-ns[1]
diff21 = ns[1]-ns[0]
ans = diff32+math.ceil(diff21/2)
if diff21 % 2 == 1:
    ans += 1
print(ans)


Measured memory_bytes: 61992