akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
int npow(int n){
    int ans=1;
    for(int i=0;i<n;i++)ans*=10;
    return ans;
}
int main(){
    int n;
    cin>>n;
    vector<int>V(n);
    for(int i=0;i<n;i++)cin>>V[i];
    sort(V.begin(),V.end());
    vector<int>DV;
    for(int i=0;i<min(n,20);i++){
        for(int j=0;j<min(n,20);j++){
            if(i==j)continue;
            int log=(int)log10(V[j])+1;
            int p=V[i]*npow(log)+V[j];
            DV.push_back(p);
        }
    }
    sort(DV.begin(),DV.end());
    cout<<DV[2]<<endl;
    return 0;
}

Measured memory_bytes: 1296
from collections import Counter as C
N = int(input())
A = C([int(a) for a in input().split()])
L = []
for k in sorted(A.keys())[::-1]:
    if A[k] >= 2:
        if len(L) <= 1:
            L.append(k)
    if A[k] >= 4:
        if len(L) <= 1:
            L.append(k)

if len(L) == 2:
    print(L[0] * L[1])
else:
    print(0)

Measured memory_bytes: 18600
import math
h, w = map(int, input().split())
if (h * w) % 3 == 0:
    print(0)
    exit()
if h % 3 == 1:
    k = h + 2
if h % 3 == 2:
    k = h + 1
if w % 3 == 1:
    v = w + 2
if w % 3 == 2:
    v = w + 1

if h % 2 == 0:
    m = h
if h % 2 == 1:
    m = h + 1
if w % 2 == 0:
    u = w
if w % 2 == 1:
    u = w + 1

s11 = k // 3 * w
s12 = (h - k // 3) * (math.floor(w / 2))
s13 = (h - k // 3) * (math.ceil(w/ 2))
s1 = max(s11, s12, s13) - min(s11, s12, s13)

t11 = (k // 3 - 1) * w
t12 = (h - k // 3 + 1) * (math.floor(w / 2))
t13 = (h - k // 3 + 1) * (math.ceil(w/ 2))
t1 = max(t11, t12, t13) - min(t11, t12, t13)

s21 = (k // 3) * w
s22 = (k // 3 - 1) * w
if h % 3 == 1:
    s23 = (k // 3 - 1) * w
else:
    s23 = (k // 3) * w
s2 = max(s21, s22, s23) - min(s21, s22, s23)

s31 = v // 3 * h
s32 = (w - v // 3) * (math.floor(h / 2))
s33 = (w - v // 3) * (math.ceil(h / 2))
s3 = max(s31, s32, s33) - min(s31, s32, s33)

t31 = (v // 3 - 1) * h
t32 = (w - v // 3 + 1) * (math.floor(h / 2))
t33 = (w - v // 3 + 1) * (math.ceil(h / 2))
t3 = max(t31, t32, t33) - min(t31, t32, t33)

s41 = (v // 3) * h
s42 = (v // 3 - 1) * h
if h % 3 == 1:
    s43 = (v // 3 - 1) * h
else:
    s43 = (v // 3) * h
s4 = max(s41, s42, s43) - min(s41, s42, s43)

print(min(s1, s2, s3, s4, t1, t3))

Measured memory_bytes: 3192
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long LL;

char s[10000];

int main()
{
	while (~scanf("%s", s)) {
		int n = strlen(s);
		for (int i = 0; i < n - 8; i++) printf("%c", s[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int a, b,i;
	char op;

	while (1) {
		scanf("%d %c %d", &a, &op, &b);
		if (op == '+') {
			i = a + b;
		}
		else if (op == '-'){
			i = a - b;
		}
		else if (op == '*'){
			i = a * b;
		}
		else if (op == '/') {
			i = a / b;
		}
		else if (op == '?') {
			break;
		}
			printf("%d\n", i);
	}
	return 0;
}


Measured memory_bytes: 2044
S = input()
T = input()
s_changed = {}
t_changed = {}
for s, t in zip(S, T):
    if s not in s_changed:
        s_changed[s] = t
    if t not in t_changed:
        t_changed[t] = s
    if not (s_changed[s] == t and t_changed[t] == s):
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 3692
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n";
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

const int maxn=2e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;
int arr[maxn],ar[maxn];
int main(){
	migmig;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		ar[i]=arr[i];
	}
	sort(ar,ar+n,greater<int>());
	for(int i=0;i<n;i++){
		if(ar[0]==arr[i]){
			cout<<ar[1]<<endl;
		}else cout<<ar[0]<<endl;
	}
	return 0;
}



Measured memory_bytes: 3200
N = gets.to_i
H = gets.split.map(&:to_i)

max_index = nil
max = 0
count = 0
H.each_with_index do |n, i|
  if H[i+1].nil?
    puts max
  elsif H[i+1] <= n
     count += 1
    if max < count
      max = count
    end
  else
    count = 0
  end
end

Measured memory_bytes: 8580
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

int dp[1003];
bool check;
int arr[3][3];

void row(int i) {
    int cnt = 0;

    for(int j=0; j<3; j++) {
        cnt+= dp[arr[i][j]];
    }

    if(cnt == 3) {
        check = true;
    }
}

void col(int j) {
    int cnt = 0;

    for(int i=0; i<3; i++) {
        cnt+= dp[arr[i][j]];
    }

    if(cnt == 3) {
        check = true;
    }
}



void test_case() {

    

    rep(i,3) {
        rep(j,3) {
            cin>>arr[i][j];
        }
    }

    int n;
    cin>>n;

    check = false;

    rep(i,n) {
        int x;
        cin>>x;

        dp[x] = 1;
    }


    rep(i,3) {
        row(i);
        col(i);
    }


    int cnt = 0;
    for(int i=0; i<3; i++) {
        cnt+= dp[arr[i][i]];
    }

    if(cnt == 3) {
        check = true;
    }

    cnt=0;
    for(int j=2; j>=0; j--) {
        cnt+= dp[arr[2-j][j]];
    }

    if(cnt == 3) {
        check = true;
    }

    if(check) {
        yes;
    } else {
        no;
    }
    




    



}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

    //    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
   //  cin >> t;
    while(t--)
    {   
        test_case();
    }
}


Measured memory_bytes: 3644
n = int(input())
a = 0
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4*i + 7*j == n:
            a += 1
            break
    else:
        continue
else:
    if a >= 1:
        print('Yes')
    else:
        print('No')




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

int N,K;
int l[60];

int main(){
    cin>>N>>K;
    
    for (int i = 0; i < N; i++)
    {
        cin>>l[i];
    }

    sort(l,l+N,greater<int>());

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

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b;
	char op;
	int answer;
	for(;;){
	cin >> a >> op >> b;
	switch(op){
	case '+':	answer=a+b;	break;
	case '-':	answer=a-b;	break;
	case '*':	answer=a*b;	break;
	case '/':	answer=a/b;	break;
	}
	if(op=='?')break;
	cout<< answer << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ini(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long

int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		ll n,k,i,x,mini;
		cin>>k>>n;
		ll arr[n+1];
		
		for(i=0;i<n;i++)	cin>>arr[i];

			mini=arr[n-1]-arr[0];

		for(i=1;i<n-1;i++)
		{
			x=arr[i]+(k-arr[i+1]);
			mini=min(mini,x);
		}

		cout<<mini;

 	
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}
void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        cout << 2 << " ";  
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            cout << i << " ";  
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        cout << n << " ";  
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
   
    long long int n1,m1,t;
 //  cin>>t;
   t=1;
    while(t--)
    {
   long long int i,j;
 //long long int b[1000000];
 //set<long long int >s;
       long long int f=1,p=0,z,o=0;
       double pie=3.141592653589793238;
    long long int c=0,n,m,l=0,r=0,k,min1=10000000000000,max2=-100;
     // map<long long int,long long int>mp;
 cin>>n;
      m=sqrt(n);
      m=m+1;
      for(i=1;i<=n;i++)
 {
   c=0;
     for(j=1;j<=m;j++)
     {
         for(k=1;k<=m;k++)
         {
             for(l=1;l<=m;l++)
             {
                 p=(j*j)+(k*k)+(l*l)+(j*k)+(k*l)+(l*j);
               
                 if(p==i)
                 c++;
                 if(p>i)
                 break;
             }
             //if(k>=l)
             
         }
     }
 cout<<c<<"\n";
     c=0;
 }
 
 
 
 }
 return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,const P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 101;
ll t1, t2, a1, a2, b1, b2;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if(a1*t1+a2*t2 < b1*t1+b2*t2){
    swap(a1, b1);
    swap(a2, b2);
  }
  a1 -= b1;
  a2 -= b2;
  ll d = a1*t1+a2*t2;
  if(d == 0){
    cout << "infinity" << endl;
    return 0;
  }
  if(a1>=0){
    cout << 0 << endl;
    return 0;
  }
  a1 *= -1;
  ll c = (a1*t1+d-1)/d;
  cout << c*2-1+(c*d==a1*t1) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n ;
  vi a(n),b(n),c(n,-1),d(n,0);
  //aは2の倍数の数
  //bは5の倍数の数
  vvi data(51, vi(21));  // 2の倍数 * 5の倍数 の2次元配列

  vector<string> si(n);
  REP(i,n) cin>>si[i];
  REP(j,n)
  {
    string s=si[j];
    int cnt=9;
    int flag=0;
    for(ll i=0;i<s.length();i++){
      if (s[i]=='.'){
        flag=1;
      }else{
        if (flag==1){
          cnt--;
        }
      }
    }

    for(;cnt>0;cnt--){
      s+="0";
    }

    
    ll rr=1;
    for(ll i=s.length()-1;i>=0;i--){
      if (s[i]!='.'){
        d[j]+=(s[i]-48)*rr;
        rr*=10;
      }
    }

    //
    REP(i,64){
      if (d[j]%2==0){
        d[j]/=2;
        a[j]++;
      }
      if (d[j]%5==0){
        d[j]/=5;
        b[j]++;
      }
    }

    data[a[j]][b[j]]++;
  }





  ans=0;
  REP(j,n)
  {
    
    //ll reqa=9-a[j];
    //if reqb=9-b[j];
    for(ll i=0;i<51;i++){
      if (a[j]+i<18)continue;
      for(ll k=0;k<21;k++){
        if (b[j]+k<18)continue;
        ans+=data[i][k];
        if ((a[j]==i)&(b[j]==k))ans--;
      }
    }
  }







  cout<<(ans/2)<<endl;
  return 0;
}

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

int main()
{
    int M;
    int D;
    cin >> M >> D;
    int ans = 0;
    for (int i = 1; i <= M; i++)
    {
        for (int j = 1; j <= D; j++)
        {
            int d10 = j / 10;
            int d1 = j % 10;
            if (d1 >= 2&&d10 >= 2&&d1*d10 == i)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#define MOD 1000000007LL
using namespace std;

int main(){
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	int max = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'I') ans++;
		else ans--;
		if(max < ans) max = ans;
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main(){
    ll a,b,c;cin >> a >> b >> c;
    ll x=(c-a-b)*(c-a-b);
    if(c-a-b<=0){
        cout << "No" << endl;
        return 0;
    }
    if(x>4*a*b){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

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

using namespace std;

void solve(){
    char s[10]="";
    char s2[10]="";
    cin>>s;
    int index = 0;
    
    for(int i =0; s[i]!=0;i++){
        if(s[i]!='B'){
            s2[index++]=s[i];
        }
        else{
            if(index >0)
            s2[--index] = 0;
        }
    }
    
    cout<<s2;
    
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    int cnt[n];
    memset(cnt, 0, sizeof(cnt));
    rep(_, m){
        int l, r;
        scanf("%d%d", &l, &r);
        ++cnt[l-1];
        --cnt[r];
    }
    partial_sum(cnt, cnt+n, cnt);
    int ans = 0;
    rep(i, n) ans += (cnt[i] >= m);
    printf("%d\n", ans);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=110;

int v[maxn],n,m,q;
vector <pair<int,pair<int,int> > > g[maxn];
int ans=0;

void dfs(int pos,int lst,int tot){
	if(pos==n){
		ans=max(ans,tot);
		return;
	}
	for(int i=lst;i<=m;i++){
		int sum=0;
		for(int j=0;j<g[pos].size();j++){
			int x=g[pos][j].fst,ned=g[pos][j].snd.fst,add=g[pos][j].snd.snd;
			if(i-v[x]==ned) sum+=add;
		}
		v[pos]=i;
		dfs(pos+1,i,tot+sum);
	}
} 

int main(){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=0;i<q;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a--; b--;
		g[b].pb(mp(a,mp(c,d)));
	}
	dfs(0,1,0);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3824
//#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
using namespace std;

#define ios ios::sync_with_stdio(false)
#define ll long long
#define pa pair<int,int>
#define mk make_pair
#define sc(n) scanf("%d",&n)
#define ss(s) scanf("%s",s)
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define of(i,a,b) for(int i=a;i>=b;i--)
#define mem(a,b) memset(a,b,sizeof a)
#define uint unsigned int
#define vr vector<int>
#define pi acos(-1)

const ll inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7.;
const ll N = 1e3 + 7;

int n, m, L;
ll f[N][N];
ll d[N][N];
int cnt[N][N];

void floyd(ll a[N][N])
{
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
			{
				if (a[i][k] + a[k][j] < a[i][j])
				{
					a[i][j] = a[i][k] + a[k][j];
				}
			}
}

int main()
{
	scanf("%d%d%d", &n, &m, &L);
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i != j)
				f[i][j] = d[i][j] = inf;
		}
	}
	while (m--)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		d[x][y] = d[y][x] = z;
	}
	int q;
	scanf("%d", &q);
	floyd(d);
	for(int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
		{
			if (d[i][j] <= L)
				f[i][j] = 1;
		}
	floyd(f);
	while (q--)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		ll ans = -1;
		if (f[x][y] != inf)
		{
			ans = f[x][y] - 1;
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

long count(long head, long th) {
    long tail = head % 10;
    long cnt = 0;
    if (head <= th) cnt += 1;
    if (tail - 1 >= 0 && head * 10 + tail - 1 <= th) {
        cnt += count(head * 10 + tail - 1, th);
    }
    if (tail + 1 <= 9 && head * 10 + tail + 1 <= th) {
        cnt += count(head * 10 + tail + 1, th);
    }
    if (head * 10 + tail <= th) {
        cnt += count(head * 10 + tail, th);
    }
    return cnt;
}

int main() {
    long k;
    cin >> k;

    long ng = 0;
    long ok = 3234566667 + 1;

    while (abs(ok - ng) > 1) {
        long mid = (ok + ng) / 2;
        long cnt = 0;
        for (int i = 1; i < 10; i++) {
            cnt += count(i, mid);
        }
        if (k <= cnt) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;
}


Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    P = LI()

    s = [min(i,N-1-i,j,N-1-j) for j in range(N) for i in range(N)]

    r = [1] * (N*N)

    ans = 0
    q = []
    for p in P:
        p -= 1
        ans += s[p]
        r[p] = 0
        q.append(p)
        while q:
            a = q.pop()
            nc = s[a] + r[a]

            if a >= N:
                if s[a-N] > nc:
                    s[a-N] = nc
                    q.append(a-N)
            if a + N < N*N:
                if s[a+N] > nc:
                    s[a+N] = nc
                    q.append(a+N)
            if a % N:
                if s[a-1] > nc:
                    s[a-1] = nc
                    q.append(a-1)
            if a % N < N -1:
                if s[a+1] > nc:
                    s[a+1] = nc
                    q.append(a+1)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 175432
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>; 

ll N, K;
bool check(ll bit, vl &arr){
    ll seen = 1; //すでに見えているビルのbit列
    ll s = arr[0];
    FOR(i, 1, N){
        if(s < arr[i]){
            seen |= 1<<i;
            s = arr[i];
        }
    }
    if((bit & seen) == seen){
        return true;
    }
    return false; 
}

int main() {
    cin >> N >> K;
    vl a(N);
    rep(i, N){
        cin >> a[i];
    }

    ll ans = LONG_LONG_MAX;
    //見える建物をbit列で管理、1が見える建物
    rep(bit, 1<<N){
        if(__builtin_popcount(bit) >= K && check(bit, a)){
            ll tmp = 0;
            ll s = a[0];
            FOR(i, 1, N){
                if(bit & (1<<i)){
                    if(s < a[i]){
                        s = a[i];
                    }else{
                        s++;
                        tmp += s - a[i];
                    }
                }
            }
            ans = min(ans, tmp);
        }
    }

    cout << ans << endl;
}

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

//pragmas
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

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

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define COUT(n) printf("%d\n", (n))
#define COUTLL(n) printf("%lld\n", (n))
#define CIN(n) scanf("%d", &(n))
#define CINLL(n) scanf("%lld", &(n))
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

void init(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

void infile(){
	freopen("input.in", "r", stdin);
}

void outfile(){
	freopen("output.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
	if(b == 0)
		return 1;
	if(b == 1)
		return a;
	ll tmp = modex(a, b/2, mod);
	tmp = (tmp * tmp) % mod;
	if(b & 1)
		tmp = (tmp * a) % mod;
	return tmp;
}

//End of template

string s, t;
int n, m;
int memo[3000][3000];

int dp(int sid, int tid){
	if(sid == n || tid == m)
		return 0;
	if(memo[sid][tid] != -1)
		return memo[sid][tid];
	if(s[sid] == t[tid]){
		return memo[sid][tid] = 1 + dp(sid+1, tid+1);
	}
	else{
		return memo[sid][tid] = max(dp(sid+1, tid), dp(sid, tid+1));
	}
}

int main(){
	init();

	cin >> s >> t;
	n = s.length();
	m = t.length();
	MEM(memo, -1);
	ll ans = dp(0, 0);
	string res = "";
	int i = 0;
	int j = 0;
	int maks1, maks2;
	while(i < n && j < m){
		if(s[i] == t[j]){
			res += s[i];
			i++;
			j++;
			continue;
		}
		maks1 = maks2 = INT_MIN;
		if(i != n-1 && memo[i+1][j] != -1){
			maks1 = memo[i+1][j];
		}
		if(j != m-1 && memo[i][j+1] != -1){
			maks2 = memo[i][j+1];
		}
		if(maks1 > maks2){
			i++;
		}
		else{
			j++;
		}
	}
	//reverse(res.begin(), res.end());
	cout << res << nl;
	return 0;	
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
long long cnt = 1, ans;
int main() {
	int n;
	cin >> n;
	string s;
	vector<string> v;
	for (int i = 0; i < n; i++) {
		cin >> s;
		sort(s.begin(), s.end());
		v.push_back(s);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < n - 1; i++) {
		if (v[i] == v[i + 1])
			cnt++;
		else {
			ans += cnt * (cnt - 1) / 2;
			cnt = 1;
		}
	}
	ans += cnt * (cnt - 1) / 2;
	cout << ans;
	return 0;
}



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

using namespace std;
//using namespace __gnu_pbds;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

//template<typename temp>using ordered_set = tree<temp, null_type, less<temp>, rb_tree_tag,tree_order_statistics_node_update>;

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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,n,a[22],ans=0;
    cin >> n;
    for(i=1;i<=n;i++)cin >> a[i];
    for(i=2;i<n;i++)
    {
        if(a[i-1] <= a[i]  &&  a[i] <= a[i+1])++ans;
        else if(a[i-1] >= a[i]  &&  a[i] >= a[i+1])++ans;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
const int MOD=1e9+7;
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int a,b,x;
double h;
class DWaterBottle {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> a >> b >> x;
		double y=(2.0*x)/(a*b);
		double ans;
		if(y<=a)
			ans=atan(a*b*b/(2.0*x))*180/3.14159265358979323846;
		else
			ans=atan((b-((double)x/(a*a)))/(a/2.0))*180/3.14159265358979323846;
		out << setprecision(12) << ans << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	DWaterBottle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

bool solve(string &s){
  reverse(all(s));
  vector<string> vec{"maerd", "remaerd", "esare", "resare"};
  int n = s.size();
  int idx=0;
  while(idx < n){
    bool changed=false;
    for(string str : vec){
      if(s.substr(idx,str.size())==str){
        idx += str.size();
        changed=true;
      }
    }
    if(!changed) return false;
  }
  return idx==n;
}

int main(){
  string s; cin>>s;

  if(solve(s)) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
mt19937 rng(high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rngll(high_resolution_clock::now().time_since_epoch().count());
template<typename T> T ctmax(T &x, const T &y){ return x = max(x, y); }
template<typename T> T ctmin(T &x, const T &y){ return x = min(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
 
 
int main(){
	cin.tie(0)->sync_with_stdio(0);
	long long h, w;
	cin >> h >> w;
	if(h != 1 && w != 1) cout << (h * w + 1) / 2;
	else cout << 1;
	return 0;
}
 
/*
 
*/
 
////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
long long MAX(long long a,long long b){return a>b?a:b;}
int main()
{
    int n,k;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    }
    long long dp[100002][3]={0};
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<=n;i++){
        dp[i][0]=MAX(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1]=MAX(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2]=MAX(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
    }
    printf("%lld",MAX(dp[n-1][0],MAX(dp[n-1][1],dp[n-1][2])));
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
ll mem[3005][3005];
int n,s;
int a[3005];
int p[3005];
ll dp(int x, int sum){
    if (x == 0) return (sum == 0);
    if (sum == 0) return x+1;
    if (sum < 0) return 0;
    if (mem[x][sum] != -1) return mem[x][sum];
    ll ans = dp(x-1,sum) + dp(x-1,sum-a[x]);
    return mem[x][sum] = ans%mod;
}
int main(){
    scanf("%d%d",&n,&s);
    for (int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
    }
    memset(mem,-1,sizeof(mem));
    ll ans = 0;
    for (int i = n; i >= 1; i--){
        ans += dp(i,s);
        ans %= mod;
    }
    printf("%lld",ans);
}


Measured memory_bytes: 71040
#include<iostream>
using namespace std;
int main(){
int H,W;
while(1){
cin >>H >>W;
if (H==0&&W==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cout <<'#';
}
cout <<"\n";
}
cout <<endl;
}
return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //const ll p = 1e9 + 7;
    //const ll p = 998244353;
    
    clock_t start = clock();
    
    ll d;
    cin >> d;
    vector<ll> c(26);
    for (ll i = 0; i < 26; i++) cin >> c[i];
    vector<vector<ll>> s(d, vector<ll>(26));
    for (ll i = 0; i < d; i++) {
        for (ll j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    
    vector<ll> w(0);
    for (ll i = 0; i < 26; i++) {
        w.push_back(i);
        for (ll j = 0; j < c[i]; j++) {
            w.push_back(i);
        }
    }
    ll m = w.size();
    
    random_device rand;
    vector<ll> ans(d);
    for (ll i = 0; i < d; i++) ans[i] = w[rand() % m];
    
    auto calc_score = [&] () {
        vector<ll> v(26, -1);
        ll ret = 0;
        for (ll i = 0; i < d; i++) {
            v[ans[i]] = i;
            ret += s[i][ans[i]];
            for (ll j = 0; j < 26; j++) {
                ret -= c[j] * (i - v[j]);
            }
        }
        return ret;
    };
    
    ll score = calc_score();
    while (clock() - start <= 1.95 * CLOCKS_PER_SEC) {
        ll change_at1 = rand() % d, into1 = w[rand() % m];
        ll change_at2 = rand() % d, into2 = w[rand() % m];
        ll memo1 = ans[change_at1], memo2 = ans[change_at2];
        ll memo_score = score;
        ans[change_at1] = into1; ans[change_at2] = into2;
        score = calc_score();
        if ((double)score / memo_score < 0.9) {
            ans[change_at1] = memo1; ans[change_at2] = memo2;
            score = memo_score;
        }
        else if (score < memo_score && clock() - start > CLOCKS_PER_SEC) {
            ans[change_at1] = memo1; ans[change_at2] = memo2;
            score = memo_score;
        }
    }
    
    for (ll i = 0; i < d; i++) cout << ans[i] + 1 << endl;
    xout << score << endl;
}

Measured memory_bytes: 3768
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    if (N == 0) {
        writeln(0);
        return;
    }

    char[] r;
    foreach (i; 0..40) {
        if (N == 0) break;
        if (abs(N) & (1<<i)) {
            r ~= '1';
            N -= (-2)^^i;
        } else {
            r ~= '0';
        }
    }
    r.reverse();
    writeln(r);
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
 
class Program {
    static int[] L;
    static void Main(string[] args) {
        var input = Console.ReadLine();
        string[] S = new string[input.Length];
        for(int i = 0;i < input.Length ;i++){
            S[i] = input[i].ToString();
        }
        Console.WriteLine(LowerBound(S));
    }
    
    public static long LowerBound(string[] S) {
        var N = S.Length;
        var res = 0L;
        for(int i = 0;i < Math.Pow(2,N-1);i++){
            var numst = S[0];
            for(int j = 1;j <　N ;j++){
                int bit = (int) Math.Pow(2,j-1);
                if((i&bit) != 0){
                    res += int.Parse(numst);
                    numst = S[j];
                }else{
                    numst = String.Concat(numst, S[j]);
                }
            }
            res += long.Parse(numst);
        }
        return res;
         }
             
     }


Measured memory_bytes: 13140
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        long a[]=new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextLong();
        }
        long b[]=new long[n+1];
        for(int i=0;i<=n;i++){
            b[i]=0;
        }
        for(int i=0;i<n;i++){
            b[i+1]=b[i];
            b[i+1]+=a[i];
        }
        long ans=2020202030;
        long min=0;
        for(int i=0;i<n;i++){
            min=Math.abs((b[n]-b[i+1])-(b[i+1]-b[0]));
            if(min<ans) ans=min;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 93760
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

string st;
char peach[]={'p','e','a','c','h'},apple[]={'a','p','p','l','e'};

int main() {
	getline(cin,st);
	string sta=st,stp=st;
	int np=0,nq=0;
	for(int i=0;i<201;i++){
		int p=sta.find("apple"),q=stp.find("peach");
		if(p!=string::npos){
			for(int j=0;j<5;j++)st[p+np+j]=peach[j];
			sta=sta.substr(p+5);
			np+=p+5;
		}
		if(q!=string::npos){
			for(int j=0;j<5;j++)st[q+nq+j]=apple[j];
			stp=stp.substr(q+5);
			nq+=q+5;
		}
	}
	cout<<st<<endl;
}

Measured memory_bytes: 0
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = readInts()

ruiseki = [a[-1]]
for i in range(1,n):
	ruiseki.append(ruiseki[i-1]+a[i*-1-1])

ans = 0

for i in range(n-1):
	ans = (ans+(a[i]%(10**9+7)*(ruiseki[-1*i-2]%(10**9+7)))%(10**9+7))%(10**9+7)


print(ans)

Measured memory_bytes: 105772
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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 ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  ll N; cin >> N;
  cout << (N - 1) * N / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 1e3 + 10;

int n, a[N][N];
int32_t main(){_   

   int h, w, a, b;
   cin >> h >> w >> a >> b;

   for (int i = 1; i <= h; ++i)
   {
      for (int j = 1; j <= w; ++j)
      {
         if(i<=b and j <= a){
            cout<<"0";
         }
         else if(i>b and j <= a){
            cout<<"1";
         }
         else if(i<=b and j > a){
            cout<<"1";
         }
         else{
            cout<<"0";
         }
      }
      cout<<endl;
   }

   return 0;
}

Measured memory_bytes: 1280
import java.util.*;

class Main{

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

		int a = hoge.nextInt();

		int s = a % 60;
		int huga = (a - s)/60;
		int m = huga % 60;
		int h = huga / 60;

		System.out.println(h + ":" + m + ":" + s);
	}


}

Measured memory_bytes: 26296
#include <bits/stdc++.h>
using namespace std ;
void Read ( int &x, char c = getchar(), bool f = 0 ) {
	for ( x = 0 ; !isdigit(c) ; c = getchar() ) if (c == '-') f = 1 ;
	for ( ; isdigit(c) ; c = getchar() ) x = 10*x + c - '0' ;
	if (f) x = -x ;
}
const int maxN = 105 ;
int n, m, a[maxN] ;
int main() {
	int i, x, y, tot = 0 ;
	Read(n) ; Read(m) ;
	for ( i = 1 ; i <= m ; i ++ ) Read(a[i]) ;
	x = 1 ; y = m ;
	for ( i = 1 ; i <= m ; i ++ )
		if (a[i]&1) {
			++tot ;
			if (tot == 1) x = i ;
			else y = i ;
		}
	swap(a[1], a[x]) ;
	swap(a[y], a[m]) ;
	if (tot > 2) {
		puts("Impossible") ;
		return 0 ;
	}
	if (m == 1) {
		printf ( "%d\n", a[1] ) ;
		if (a[1] == 1) {
			puts("1\n1") ;
			return 0 ; 
		}
		puts("2") ;
		printf ( "1 %d\n", a[1]-1 ) ;
		return 0 ;
	}
	for ( i = 1 ; i <= m ; i ++ ) printf ( "%d ", a[i] ) ;
	puts("") ;
	a[1] ++ ; a[m] -- ;
	if (a[m] == 0) -- m ;
	printf ( "%d\n", m ) ;
	for ( i = 1 ; i <= m ; i ++ ) printf ( "%d ", a[i] ) ;
	return 0 ;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

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

const int kMaxN = 500;
const int kMaxM = 200000;
const int kMaxQ = 100000;

int N, M, Q;
int L[kMaxM], R[kMaxM];
int p[kMaxQ], q[kMaxQ];

int t[kMaxN+1][kMaxN+2];

signed main() {
  cin >> N >> M >> Q;
  REP(i, M) { cin >> L[i] >> R[i]; }
  REP(i, Q) { cin >> p[i] >> q[i]; }

  REP(i, M) {
    t[L[i]][R[i]] += 1;
  }
  REP(i, N) {
    REP(j, N-1) {
      t[i+1][j+2] += t[i+1][j+1];
    }
  }

  REP(i, Q) {
    int ans = 0;
    FOR(j, p[i], q[i]) {
      ans += t[j][q[i]];
    }
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

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

	printf("%.8f\n", r*2*M_PI);

	return 0;
}




Measured memory_bytes: 3784
#include <cstdio>
#include <cctype>

int main(void){
    char s, a;
    
    while(true){
        scanf("%c", &s);
        if(s == '\n'){
            printf("%c", s);
            break;
        }
        if(isalpha(char (s))){
            if(islower(char (s))){
                a = toupper(char (s));
            }
            else a = tolower(char (s));
        }
        else a = s;
        printf("%c", a);
    }
}


Measured memory_bytes: 2620
#include<stdio.h>
#define SWAP(type,a,b)do{type temp=a;a=b;b=temp;}while(0)
int main(){
  int a,b,i,cnt;
  while(1){
    scanf("%d %d",&a,&b);
    if(a==0&&b==0) return 0;
    if(a<b)SWAP(int,a,b);

    cnt=0;
    while(b!=0){
      a%=b;
      SWAP(int,a,b);
      cnt++;
    }
    printf("%d %d\n",a,cnt);
  }
}

Measured memory_bytes: 600
main :: IO ()
main = do
  [a1, a2, a3] <- map read . words <$> getLine
  putStrLn $ solve a1 a2 a3

solve :: Int -> Int -> Int -> String
solve a1 a2 a3
  | a1 + a2 + a3 >= 22 = "bust"
  | otherwise          = "win"


Measured memory_bytes: 508
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		char[] s = new Scanner(System.in).next().toCharArray();
		int[] arr = {0,0};
		
		for(char c : s){
		if(c == '1')arr[1]++;
		else arr[0]++;
		}
		
		
		System.out.println(2*Math.min(arr[0],arr[1]));
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main(){
    string s;
    cin >> s;

    // (最初の文字)(文字数-2)(最後の文字)の順に出力する
    // いわゆる「1文字目」はs[0]のように、i文字目は[i-1]で指定することに注意
    cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int ab,bc,ac;scanf("%d%d%d",&ab,&bc,&ac);
    int t1,t2,t3;
    t1=ab+bc;t2=bc+ac;t3=ab+ac;
    int minn=t1;
    if(minn>t2) minn=t2;
    if(minn>t3) minn=t3;
    printf("%d\n",minn);
    return 0;
}

Measured memory_bytes: 128