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

int n, m;
vector<int> ans;
bool saw[200001];

int main(){
    cin >> n >> m;
    rep(i,m){
        int x;
        cin >> x;
        ans.push_back(x);
    }
    for(int i = ans.size()-1; i >= 0; i--){
        if(saw[ans[i]]) continue;
        cout << ans[i] << endl;
        saw[ans[i]] = true;
    }
    for(int i = 1; i <= n; i++){
        if(saw[i]) continue;
        cout << i << endl;
    }
}

Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e6;
ll h[MAXN];

priority_queue<ll> bigq;
priority_queue<ll,vector<ll>,greater<ll>> litleq;

ll max=0;
ll min=INF;
ll k,n;


int main()
{
    cin>>n>>k;
    ll sum=0;
    rep(i,n)
    {
        cin>>h[i];
    }
    sort(h,h+n);
    ll ans=INF;
    rep(i,n-k+1)
    {
        ll cand=h[i+k-1]-h[i];
        if(cand<ans)ans=cand;
    }
    cout<<ans;
}

Measured memory_bytes: 1024
#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
#define inf LLONG_MAX

void solve()
{
	ll n,m,i;
	cin>>n>>m;

	string str;
	vector<string> v;

	for(i=0;i<n;i++)	
	{
		cin>>str;
		v.pb(str);
	}

	sort(v.begin(), v.end());

	for(auto j : v)	cout<<j;

}


int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		solve();
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
using namespace std;
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0;i < n;++i) {
		int a[4] = { 0 };
		scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]);
		int b = max(5, a[2]), c = max(2, a[3]);
		int hoge = ((a[0] * b) + (a[1] * c))*0.8;
		if (((a[0] * a[2]) + (a[1] * a[3])) >= hoge) {
			printf("%d\n", hoge);
		}
		else {
			printf("%d\n", ((a[0] * a[2]) + (a[1] * a[3])));
		}
	}
}


Measured memory_bytes: 1028
#include<iostream>

using namespace std;

// 整数配列Aと長さnを受け取り、バブルソートによる整列を行なう.
int bubbleSort(int A[], int n);

// 配列Aと位置i, jを受け取り配列A[i]とA[j]を交換する.
void swap(int A[], int i, int j);

// 配列Aと長さn, 交換回数を受け取り、配列と交換回数を出力する.
void Result(int A[], int n, int chg_count);

int main()
{
    int n;
    int A[100];

    // Input of instance
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    int chg_count = bubbleSort(A, n);
    Result(A, n, chg_count);

    return 0;
}

int bubbleSort(int A[], int n)
{
    bool flag = true;
    int chg_count = 0;
    
    while (flag) {
        flag = false;
        for (int i = n - 1; i > 0; i--){
            if (A[i] < A[i-1]) {
                swap(A, i, i-1);
                chg_count++;
                flag = true;
            }
        }
    }

    return chg_count;
}

void swap(int A[], int i, int j)
{
    int tmp;
    tmp = A[i];
    A[i] = A[j];
    A[j] = tmp;
}

void Result(int A[], int n, int chg_count)
{
    for (int i = 0; i < n - 1; i++){
        cout << A[i] << ' ';
    }

    cout << A[n - 1] << endl;

    cout << chg_count << endl;
}


Measured memory_bytes: 3096
#include <stdio.h>

#define S_MAXLENGTH 27

int search(char *s)
{
  int i, j;

  for (i = 0; s[i] != '\0'; i++) {
    for (j = i + 1; s[j] != '\0'; j++) {
      if (s[i] == s[j])return(1);
    }
  }
  return(0);
}

int main(void)
{
  char s[S_MAXLENGTH];

  scanf("%s", s);
  printf(search(s) ? "no\n" : "yes\n");

  return(0);
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

struct Edge{
	int to, cost;
	Edge(int _to, int _cost){
		to = _to;
		cost = _cost;
	}
};

vector<Edge> ga[100000], gb[100000];
ll da[100000], db[100000];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;
	REP(i, n) da[i] = LLINF, db[i] = LLINF;
	REP(i, m){
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		ga[u].push_back(Edge(v, a));
		ga[v].push_back(Edge(u, a));
		gb[u].push_back(Edge(v, b));
		gb[v].push_back(Edge(u, b));
	}
	
	priority_queue<pii, vector<pii>, greater<pii>> que;
	da[s] = 0;
	que.push({0, s});
	while(!que.empty()){
		pii p = que.top(); que.pop();
		int v = p.second;
		if(da[v] < p.first) continue;
		for(const auto &e : ga[v]){
			if(da[e.to] > da[v] + e.cost){
				da[e.to] = da[v] + e.cost;
				que.push({da[e.to], e.to});
			}
		}
	}
	
	db[t] = 0;
	que.push({0, t});
	while(!que.empty()){
		pii p = que.top(); que.pop();
		int v = p.second;
		if(db[v] < p.first) continue;
		for(const auto &e : gb[v]){
			if(db[e.to] > db[v] + e.cost){
				db[e.to] = db[v] + e.cost;
				que.push({db[e.to], e.to});
			}
		}
	}
	
	vector<ll> ans(n + 1);
	ans[n] = 0;
	RREP(i, n){
		ans[i] = max(ans[i + 1], 1000000000000000 - da[i] - db[i]);
	}
	REP(i, n) cout << ans[i] << "\n";
	return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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 MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

void solve() {
    double h, w, x, y;
    cin >> h >> w >> x >> y;
    cout << h * w / 2.0 << " " << (h == 2 * x && w == 2 * y ? 1 : 0) << EOL;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, m, x, y, tmp, res = 0;
    string s;
    in(n, m);
    int cnt[n + 1];
    bool flag[n + 1] = {};
    rep(i, n + 1){
        cnt[i] = 1;
    }
    flag[1] = true;
    rep(i, m){
        in(x, y);
        cnt[x]--;
        cnt[y]++;
        if(flag[x]){
            flag[y] = true;
        }
        if(flag[x] && !cnt[x]){
            flag[x] = false;
        }
    }
    rep(i, n + 1){
        if(flag[i]){
            res++;
        }
    }
    print(res);
}

Measured memory_bytes: 1152
#include <iostream>
#include <stack>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    stack<int> s;
    while (cin >> n) {
        if (n == 0) {
            cout << s.top() << "\n";
            s.pop();
        } else {
            s.push(n);
        }
    }
    return 0;
}

Measured memory_bytes: 1204
a,b = map(int,input().split())

cnt = 0
hole = a
if b==1:
    cnt = 0

elif b!=1 and a>=b:
    cnt = 1
else:
    for i in range(pow(2,10)):
            hole +=(a-1)
            
            if b<=hole:
                cnt = i+2
                break
            else:
                pass
print(cnt)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int size = n;
		int [][]graph = new int[size][size];
		
		while(n-- > 0) {
			int u = sc.nextInt() - 1;
			int k = sc.nextInt();
			while(k-- > 0) {
				graph[u][sc.nextInt() - 1] = 1;
			}
		}
			
		for(int i = 0; i < size; i++) {
			for(int j = 0; j < size; j++) {
				System.out.print(graph[i][j]);
				System.out.print(j < size - 1 ?" ":"");
			}
			System.out.println();
		}
	}
}


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


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

    int N;
    cin >> N;

    int c[N][3];
    for (int i = 0; i < N; ++i) {
        cin >> c[i][0] >> c[i][1] >> c[i][2];
        if (c[i][2] > 0) {
            swap(c[i], c[0]);
        }
    }

    int tmp_h;
    int res[3] = {};
    for (int X = 0; X <= 100; ++X) {
        for (int Y = 0; Y <= 100; ++Y) {
            tmp_h = 0;
            // bool plus = false;
            for (int k = 0; k < N; ++k) {
                int dis = abs(X - c[k][0]) + abs(Y - c[k][1]);
                // if (c[k][2] == 0 && tmp_h <= dis) continue;
                // if (!plus && dis > tmp_h && tmp_h > 0) {
                //     break;
                // }
                if (tmp_h == 0) {
                // if (tmp_h == 0 || !plus) {
                    tmp_h = c[k][2] > 0? c[k][2] + dis : 0;
                    // tmp_h = c[k][2] + dis;
                    // plus = (c[k][2] > 0);
                }

                // else if (tmp_h == c[k][2] + dis || )
                // if (tmp_h != c[k][2] + dis) break;
                // if (tmp_h != c[k][2] + dis || (tmp_h > dis && c[k][2] == 0) ) break;
                // ok: tmp_h == c[k][2] + dis || 
                if (c[k][2] != max(tmp_h - dis, 0)) break;
                if (k == N - 1 && res[2] < tmp_h) {
                    res[0] = X;
                    res[1] = Y;
                    res[2] = tmp_h;
                }
            }
        }
    }

    cout << res[0] << ' ' << res[1] << ' ' << res[2] << '\n';

    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
d={}
B=sorted(A)
for i in range(N):
    d[B[i]]=i
cnt=0
for i in range(N):
    if abs(i-d[A[i]])%2==1:
        cnt+=1
print(cnt//2)

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

int main(){
  int n;
  cin>>n;
  if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
    cout<<"pon"<<endl;
  }else if(n%10==3){
    cout<<"bon"<<endl;
  }else{
    cout<<"hon"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <string>

typedef long long ll;

int main(int argc, char* argv[])
{
  ll N, M;
  std::cin >> N >> M;

  std::vector<ll> ball_num(N, 1LL);
  std::vector<bool> is_red(N, false);
  is_red[0] = true;

  //std::vector< std::pair<ll, ll> > vp(M, std::make_pair(0LL, 0LL));
  for (ll i = 0; i < M; i++) {
    ll x, y;
    std::cin >> x >> y;
    x--; y--;
    ball_num[x]--;
    ball_num[y]++;
    if (is_red[x]) {
      is_red[y] = true;
    }
    if (ball_num[x] == 0) {
      is_red[x] = false;
    }
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    if (is_red[i] == true) ans++;
  }

  std::cout << ans << std::endl;
  return 0;
}


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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<end
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  ll a,b;
  cin>>a>>b;
  ll res=0;
  while(a<=b){
    a*=2;
    res++;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
while True:
    height, width = [int(x) for x in input().split(" ")]
    if height == 0 and width ==0:
        break

    #start line
    print("{0}".format("#" * width))
    for h in range(0, (height - 2)):
        for w in range(width):
            if w == 0 or w == (width - 1):
                print ("#", end="")
            else:
                print (".", end="")
        print("\n", end="")


    #end line
    print("{0}".format("#" * width))

    print("\n", end="")

Measured memory_bytes: 9000
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func sumDigit(n int) int {
	sumv := 0
	for n > 0 {
		sumv += n % 10
		n /= 10
	}
	return sumv
}

func main() {
	n, _ := strconv.Atoi(input())
	ans := 9 * 10
	for a := 1; a <= n-1; a++ {
		sumv := sumDigit(a) + sumDigit(n-a)
		ans = min(ans, sumv)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
  long long int i,j,k,n,a,b,c;
   scanf("%lld %lld %lld",&a,&b,&c);
   k=a+b+c;
   if(k==17){
    printf("YES\n");
   }
   else{
    printf("NO\n");
   }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include<limits>
#include<numeric>
#include<type_traits>

using namespace std;

int main()
{
	int N;
	cin >> N;
	while (N > 0)
	{
		if (N % 10 == 7)
		{
			cout << "Yes";
			return 0;
		}
		N /= 10;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 3624
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int N;
	static String s;
	static String[] sw;
	static String first;
	static String second;

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		s=sc.next();
		sw=new String[N];
		//0羊,1羊
		sw[0]="S"; first="S";
		sw[1]="S"; second="S";
		for(int i=1;i<N;i++){
			solve(i);
		}
		solve(0);
		if(first==sw[0] && second==sw[1]){
			for(int i=0;i<N;i++){
				System.out.print(sw[i]);
			}
			return;
		}
		Arrays.fill(sw, null);
		//0羊、1狼
		sw[0]="S"; first="S";
		sw[1]="W"; second="W";
		for(int i=1;i<N;i++){
			solve(i);
		}
		solve(0);
		if(first==sw[0] && second==sw[1]){
			for(int i=0;i<N;i++){
				System.out.print(sw[i]);
			}
			return;
		}
		Arrays.fill(sw, null);
		//0狼、1羊
		sw[0]="W"; first="W";
		sw[1]="S"; second="S";
		for(int i=1;i<N;i++){
			solve(i);
		}
		solve(0);
		if(first==sw[0] && second==sw[1]){
			for(int i=0;i<N;i++){
				System.out.print(sw[i]);
			}
			return;
		}
		Arrays.fill(sw, null);
		//0狼、1狼
		sw[0]="W"; first="W";
		sw[1]="W"; second="W";
		for(int i=1;i<N;i++){
			solve(i);
		}
		solve(0);
		if(first==sw[0] && second==sw[1]){
			for(int i=0;i<N;i++){
				System.out.print(sw[i]);
			}
			return;
		}
		
		System.out.println(-1);
	}
	static void solve(int i){
		if((sw[i]=="S" && s.charAt(i)=='o')||(sw[i]=="W" && s.charAt(i)=='x')){
			if(i==N-1)sw[0]=sw[N-2];
			else if(i==0)sw[1]=sw[N-1];
			else sw[i+1]=sw[i-1];
		}else{
			if(i==N-1){
				if(sw[N-2]=="S")sw[0]="W";
				else sw[0]="S";
			}else if(i==0){					
				if(sw[N-1]=="S")sw[1]="W";
				else sw[1]="S";
			}else{
				if(sw[i-1]=="S")sw[i+1]="W";
				else sw[i+1]="S";
			}
		}
	}
}


Measured memory_bytes: 32632
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define txti freopen("input.txt", "r", stdin);
#define txto freopen("output.txt", "w", stdout);
//#define mod 100000007

#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 

bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
 
    return false;
 }
//me
ll const mod = 1e9+7;
ll const inf = 1e8+2;
ll fact[inf];
void factfill()
{
    fact[0]=1;
    for(ll i=1; i<inf; i++)
        fact[i] = ( fact[i-1]*i ) % mod;
}

ll powmod(ll a, ll b)
{
    ll res = 1;
    while(b){
        if(b%2) res = ( res*a )%mod;
        a = (a*a)%mod;
        b/=2;
    }
    return res;
}

ll inv(ll x)
{
    return powmod(x,mod-2) % mod;
}

ll choose(ll n, ll r)
{
    return ( (fact[n]* inv(fact[n-r] ) )%mod *inv(fact[r]))%mod;
}

void solve()
{   

   ll n; cin >> n;
   
   ll p = 0;

    f(i,0,inf)
    {
        p = p*10+7;

        p = p%n;

        if(p==0)
        {
            cout << i+1;
            return;
        }
        
    }
    cout << -1 << endl;
     
}

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/


        //factfill();
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        f(testcases,0,t){
            solve();
        }
 
 
 
 
    return 0;
}

Measured memory_bytes: 3652
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

function mul(){for(var a=arguments,r=a[0],i=a.length;--i;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i])%mod;return r;}
var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var s = next(1);
  return s[2] === s[3] && s[4] === s[5] ? "Yes" : "No";
}

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong a, b, c;

int main(){
    cin >> a >> b >> c;
    llong mx = max(a, max(b, c));
    llong m1 = (mx + 1) / 2, m2 = mx / 2;
    if(mx == a){
        cout << b * c * m1 - b * c * m2;
    }else if(mx == b){
        cout << a * c * m1 - a * c * m2;
    }else{
        cout << a * b * m1 - a * b * m2;
    }
    return 0;
}


Measured memory_bytes: 256
def prime_list(n):
    # n以下の自然数で素数か否かのリストを作成
    ans = [True for _ in range(n+1)]
    ans[0] = False
    ans[1] = False
    for i in range(2,n+1):
        if ans[i]:
            for j in range(2*i,n+1,i):
                ans[j] = False
    return ans

x = int(input())
d = prime_list(2*x+1)
for i in range(x,len(d)):
    if d[i]:
        print(i)
        exit()

Measured memory_bytes: 4632
#include <bits/stdc++.h>
//#include "atcoder/all"
typedef long long int ll;
using namespace std;
// using namespace atcoder;
#define MAXN 100001
vector<ll> vec;
ll sum[MAXN];
int main() {
    ll n, m;
    cin >> n >> m;
    sum[0] = 0;
    for (int i = 1; i <= n; i++) {
        ll a;
        cin >> a;
        vec.push_back(a);
    }
    sort(vec.begin(), vec.end());
    for (int i = 1; i <= n; i++) {
        sum[i] = sum[i - 1] + vec[n - i];
    }
    ll Ma = 200001;
    ll Mi = 1;
    // k以上の幸福が m パターンある
    while (Ma - Mi > 1) {
        ll med = (Ma + Mi) / 2;
        ll count = 0;
        // cout << "med " << med << endl;
        for (int i = 0; i < n; i++) {
            auto it = lower_bound(vec.begin(), vec.end(), med - vec[i]);
            int ok;
            if (it == vec.end()) {
                ok = 0;
            }
            else {
                ok = n - (it - vec.begin());
            }
            // cout << "i " << i << ok  << endl;
            count += ok;
        }
        // cout << count << endl;
        if (count < m) {
            Ma = med;
        }
        else {
            Mi = med;
        }
    }
    // cout << Mi << endl;
    ll ret = 0;
    ll co = 0;
    for (int i = 0; i < n; i++) {
        auto it = lower_bound(vec.begin(), vec.end(), Mi - vec[i] + 1);
        int ok;
        if (it == vec.end()) {
            ok = 0;
        }
        else {
            ok = n - (it - vec.begin());
        }
        co += ok;
        ret += sum[ok] + vec[i] * ok;
    }
    ret += Mi * (m - co);
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4772
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var L = cin.ReadInt;

            double l = (double)L / 3;

            double ans = l * l * l;

            WriteLine(ans);
        }

    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }


        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x;
  cin>>x;
  cout<<(x>=30?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 3596
def submit():
    x, n = map(int, input().split())
    p = set(map(int, input().split()))

    ans = -1
    ans_d = 10000
    for c in range(102):
        if c in p:
            continue

        if abs(x - c) < ans_d:
            ans_d = abs(x - c)
            ans = c
    
    print(ans)
    

if __name__ == "__main__":
    submit()

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

using namespace std;
#define int64 long long

void outerInit() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto fi = new ifstream("test.inp");
    if (*fi) {
        cin.rdbuf(fi->rdbuf());
    }
}

int main() {
    outerInit();

    string str;
    cin >> str;

    int64 res = 0;
    int cntWhite = 0;
    for (int i = str.size() - 1; i >= 0; --i) {
        if (str[i] == 'W') {
            cntWhite++;
        } else {
            res += cntWhite;
        }
    }
    cout << res;
}

Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int h, w;

typedef struct edge_ {
		int from, to, cost;
		edge_(int f, int t, int c): from(f), to(t), cost(c){};
} edge;

vector<P> vec[10];

int d[10];

void dijkstra(){
		fill(d, d + 10, inf);
		pq<P, vector<P>, greater<P> > q;
		q.push(mk(0, 1));
		d[1] = 0;
		while(!q.empty()){
				P p = q.top(); q.pop();
				int dis = p.first;
				int at = p.second;
				if(d[at] < dis)continue;
				for(auto itr = vec[at].begin(); itr != vec[at].end(); ++itr){
						int to = (*itr).first;
						int cost = (*itr).second;
						if(d[to] > dis + cost){
								d[to] = dis + cost;
								q.push(mk(dis + cost, to));
						}
				}
		}
}

int main(int argc, char const* argv[])
{
	cin >> h >> w;
	for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
					int a;
					cin >> a;
					vec[j].pb(mk(i, a));
			}
	}
	dijkstra();
	ll res = 0;
	for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
					int a;
					cin >> a;
					if(a != -1)res += d[a];
			}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		@SuppressWarnings("unchecked") ArrayList<Integer>[] jobs = new ArrayList[m + 1]; // 遅延日数ごとに仕事をグルーピングする
		for ( int i = 0; i <= m; i++ ) {
			ArrayList<Integer> a = new ArrayList<>();
			a.add(0); // ダミー要素
			jobs[i] = a;
		}

		for ( int i = 0; i < n; i++ ) {
			int d = in.nextInt();
			int f = in.nextInt();
			if ( d > m ) continue; // 遅延日数的に候補になりえない仕事は除外
			jobs[d].add(f);
		}

		long total = 0;
		
		PriorityQueue<Integer> pool = new PriorityQueue<Integer>(
			new Comparator<Integer>() {

				@Override
				public int compare(Integer o1, Integer o2) {
					return o2 - o1;
				}
			}); // job候補のプール

		// m日目をゼロとして考え後退していく days:残り日数
		for ( int today = 0; today <= m; today++ ) {
			pool.addAll(jobs[today]);
			total += (long) pool.poll();
		}

		System.out.println(total);
		in.close();
	}
}


Measured memory_bytes: 101972
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

# 再帰呼出し
def dfs (cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print (dfs(0, 0, 0, 0))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define fi first
#define se second
#define mod 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
vector<ll> vec;
vector<ll> arr;
bool ans[200005];
int main()
{
	ios;
	memset(ans,false,sizeof(ans));
	ll n,k,c,i,prev,f,len,l,d;
	char ch;
	cin>>n>>k>>c;
	arr.push_back(-c-1);
	for(i=1;i<=n;i++)
	{
		cin>>ch;
		if(ch=='o')
			vec.push_back(i);
	}
	prev=-c-1;f=0;
	for(i=0;i<vec.size();i++)
	{
		if(f==k)
			break;
		if(vec[i]-prev>c)
		{
			//cout<<vec[i]<<endl;
			arr.push_back(vec[i]);
			prev=vec[i];
			f++;
		}
	}
	len=vec.size();
	d=len-1;prev=n+c+1;
	l=arr.size();
	for(i=l-1;i>=1;i--)
	{
		while(d>=0&&vec[d]>arr[i]&&(prev-vec[d])<=c)
			d--;
		if(d>=0&&vec[d]!=arr[i])
			prev=vec[d];
		else
		{
			prev=arr[i];
			//cout<<arr[i]<<" "<<vec[d]<<endl;
			ans[arr[i]]=true;
		}
		//cout<<arr[i]<<" "<<vec[d]<<endl;
	}
	for(i=1;i<=n;i++)
	{
		if(ans[i])
			cout<<i<<endl;
	}
}


Measured memory_bytes: 5104
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int sum = 0;
        while(scan.hasNext()){
        	char[] ch = scan.next().toCharArray();
        	String ns = "";
        	for(int i = 0;i < ch.length;i++){
        		if(Character.isDigit(ch[i])){
        			ns += ch[i];
        			continue;
        		}
        		if(!ns.equals("")){
        			sum += Integer.parseInt(ns);
        			ns = "";
        		}
        	}
        	if(!ns.equals("")){
        		sum += Integer.parseInt(ns);
        	}
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 17172
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
int a,b;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	cout<<6-a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
#n = int(input())
#a = int(input())
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
a,b,c = list(map(int,input().split(" ")))
#a,b,c = list(input().split())
#string = input()

if b - a == c - b:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            char[] S = in.next().toCharArray();
            if (S[2] == S[3] && S[4] == S[5]) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

    }
}



Measured memory_bytes: 23380
#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,l;
  scanf("%d%d",&n,&l);
  int ans,sum;
  int max = l+n-1;
  int min = l;
  
  if(min>0)ans=min;
  else if(max<0)ans=max;
  else ans=0;
  
  sum=n*(min+max)/2;
  sum -= ans;
  
  printf("%d\n",sum);
}

Measured memory_bytes: 128
class Node:
    def __init__(self, key):
        self.right = None
        self.left = None
        self.parent = None
        self.key = key

    def preorder(self):
        ret = [self.key]
        if self.left:
            ret += self.left.preorder()
        if self.right:
            ret += self.right.preorder()
        return ret

    def inorder(self):
        ret = []
        if self.left:
            ret += self.left.inorder()
        ret += [self.key]
        if self.right:
            ret += self.right.inorder()
        return ret

    def find(self, k):
        if self.key == k:
            return self
        elif self.key < k:
            if self.right:
                return self.right.find(k)
            else:
                return None
        else:
            if self.left:
                return self.left.find(k)
            else:
                return None


class Tree:
    def __init__(self):
        self.root = None

    def insert(self, k):
        z = Node(k)
        y = None
        x = self.root
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        if y is None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z

    def print(self):
        print('', ' '.join(map(str, self.root.inorder())))
        print('', ' '.join(map(str, self.root.preorder())))

    def find(self, k):
        if self.root is None:
            return None
        else:
            return self.root.find(k)

    def delete(self, k):
        z = self.find(k)
        if z.left is None:
            self.transparent(z, z.right)
        elif z.right is None:
            self.transparent(z, z.left)
        else:
            y = self.minimum(z.right)
            if y.parent != z:
                self.transparent(y, y.right)
                y.right = z.right
                y.right.parent = y
            self.transparent(z, y)
            y.left = z.left
            y.left.parent = y

    def successor(self, x):
        if x.right:
            return self.minimum(x.right)
        y = x.parent
        while y and x == y.right:
            x = y
            y = y.parent
        return y

    def minimum(self, x):
        while x.left:
            x = x.left
        return x

    def maximum(self, x):
        while x.right:
            x = x.right
        return x

    def transparent(self, u, v):
        if u.parent is None:
            self.root = v
        elif u == u.parent.left:
            u.parent.left = v
        else:
            u.parent.right = v
        if v:
            v.parent = u.parent


m = int(input())
tree = Tree()
for _ in range(m):
    s = input().split()
    if s[0] == "insert":
        tree.insert(int(s[1]))
    elif s[0] == "find":
        if tree.find(int(s[1])):
            print("yes")
        else:
            print("no")
    elif s[0] == "delete":
        tree.delete(int(s[1]))
    else:
        tree.print()


Measured memory_bytes: 116988
#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
	int q=0;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
	return q;
}
typedef long long LL;
const int N=100005,M=200005;
int n,m,tot,js,k1,k2,k3;LL ans;
int h[N],ne[M<<1],to[M<<1],col[N];
void add(int x,int y) {to[++tot]=y,ne[tot]=h[x],h[x]=tot;}
int dfs(int x,int c) {
	col[x]=c;int re=1;++js;
	for(RI i=h[x];i;i=ne[i])
		if(!col[to[i]]) {if(!dfs(to[i],3-c)) re=0;}
		else if(col[to[i]]!=3-c) re=0;
	return re;
}
int main()
{
	int x,y;
	n=read(),m=read();
	for(RI i=1;i<=m;++i) x=read(),y=read(),add(x,y),add(y,x);
	for(RI i=1;i<=n;++i) {
		if(col[i]) continue; js=0;
		if(dfs(i,1)) {
			if(js==1) ++k3;
			else ++k1;
		}
		else ++k2;
	}
	ans=2LL*k3*(n-k3)+1LL*k3*k3+2LL*k1*k1+2LL*k1*k2+1LL*k2*k2;
	printf("%lld\n",ans);
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void dfs(vector<vector<int>> &G, int v, int p, vector<int> &d){
    for (auto &nv : G[v]){
        if (nv == p) continue;
        d[nv] = d[v] + 1;
        dfs(G, nv, v, d);
    }
}

int main(){
    int n, u, v;
    cin >> n >> u >> v;
    u--; v--;
    vector<vector<int>> G(n);
    int a, b;
    for (int i = 0; i < n-1; ++i) {
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> du(n, -1), dv(n, -1);
    du[u] = 0; dv[v] = 0;
    dfs(G, u, -1, du);
    dfs(G, v, -1, dv);

    int res = 0;
    for (int i = 0; i < n; ++i) {
        if (du[i] < dv[i]) chmax(res, dv[i] - 1);
    }
    cout << res << endl;
}

Measured memory_bytes: 15896
n=int(input())
a = list(map(int, input().split()))
b= list(map(int, input().split()))
ans=0
for i in range(n):
  if ans<(sum(a[:i+1])+sum(b[i:])):
    ans=(sum(a[:i+1])+sum(b[i:]))
print(ans)

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


int main()
{
	int A,B;
	cin>>A>>B;
	if(B%A==0)
	{
		cout<<A+B<<endl;
	}
	else
	{
		cout<<B-A<<endl;
	}
	return 0;
}


Measured memory_bytes: 3576
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 123456;
const LL MOD = 1e9 + 7;
char s[MAXN];
LL dp[MAXN];

int main() {
    scanf("%s", s);
    int n = strlen(s);
    LL cnt = 1;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'A') dp[0] += cnt;
        else if (s[i] == 'B') dp[1] += dp[0];
        else if (s[i] == 'C') dp[2] += dp[1];
        else {
             dp[2] = dp[2] * 3 + dp[1];
             dp[1] = dp[1] * 3 + dp[0];
             dp[0] = dp[0] * 3 + cnt;
             cnt = (cnt * 3) % MOD;
        }
        for (int j = 0; j < 3; j++) {
            dp[j] %= MOD;
        }
    }
    printf("%lld\n", dp[2]);
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <map>
#include <algorithm>

using namespace std;

long long a, b, c, d;
map<long long, long long> mp;

long long calc(long long n) {
    int i;
    long long ans = 1e18;
    
    if (mp.count(n)) return mp[n];
    if (n == 0) return mp[n] = 0;
    
    for (i = -1; i <= 1; i++) {
        if (n + i > 0 && (n + i) % 2 == 0 && (n + i) / 2 < n) ans = min(ans, calc((n + i) / 2) + a + abs(i) * d);
    }
    
    for (i = -2; i <= 2; i++) {
        if (n + i > 0 && (n + i) % 3 == 0 && (n + i) / 3 < n) ans = min(ans, calc((n + i) / 3) + b + abs(i) * d);
    }
    
    for (i = -4; i <= 4; i++) {
        if (n + i > 0 && (n + i) % 5 == 0 && (n + i) / 5 < n) ans = min(ans, calc((n + i) / 5) + c + abs(i) * d);
    }
    
    if (n <= ans / d) ans = min(ans, n * d);
    
    return mp[n] = ans;
}

int main() {
    int t, i;
    
    scanf("%d", &t);
    
    for (i = 0; i < t; i++) {
        long long n;
        
        scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &c, &d);
        
        mp.clear();
        
        printf("%lld\n", calc(n));
    }
    
    return 0;
}


Measured memory_bytes: 4156
import java.io.*;
import java.util.*;

public class Main {


	public static void solver() {
	
		int a = cin.nextInt();

		int h = (int)a/3600;
		
		int m= (int) a%3600 / 60;
		
		int s = (a % 3600) % 60;
		
		cout.printf("%d:%d:%d\n", h, m, s);
		
		
		

	}
		
	
	public static void main(String[] args) throws IOException {

		cin = new Scanner(System.in);
		
		Main.solver();
	}

	static Scanner     cin;
	static PrintStream cout = System.out;//標準出力
	
}

Measured memory_bytes: 17204
n = int(input())
A = [int(i) for i in input().split()]

q = int(input())
m = [int(i) for i in input().split()]


def dfs(idx, s, target):
    if s == target:
        return 1
    if s > target or idx == n:
        return 0
    if s + sum(A[idx:]) < target:
        return 0

    return dfs(idx+1, s, target) or dfs(idx+1, s + A[idx], target)


for i in m:
    ans = 'yes' if dfs(0, 0, i) else 'no'
    print(ans)



Measured memory_bytes: 5624
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, K = MULTIPLE_INT_MAP()
trees = [int(input()) for _ in range(N)]
trees.sort()
ans = float('inf')



print(min([trees[i+K-1]-trees[i] for i in range(N-K+1)]))

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

bool f(vector<int> xs) {
  for (auto x : xs) {
    if (x % 2 != 0)
      return false;
  }
  return true;
}

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

  vector<int> A(N);
  rep(i, N) cin >> A[i];

  int ans = 0;
  while (f(A)) {
    rep(i, N) A[i] /= 2;
    ans++;
  }

  cout << ans << endl;
}

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

/* 文字列を逆順にコピーする (末尾に空文字を付加しない) */
char* strncpyr(char *s1, const char *s2, int n, int reversal) {
	int l2, i;
	l2 = strlen(s2);
	if (reversal == 0) {
		/* strncpy(s1, s2, n); */
		if (l2 > n) l2 = n;
		for (i = 0; i < l2; i++) s1[i] = s2[i];
		/* for (i = l2; i < n; i++) s1[i] = '\0'; */
	} else {
		if (l2 > n) l2 = n;
		for (i = 0; i < l2; i++) s1[i] = s2[l2 - 1 - i];
		/* for (i = l2; i < n; i++) s1[i] = '\0'; */
	}
	return s1;
}

/* 列車を再編成する */
void rearrange(char *s1, const char *s2, int n, int division, int order, int reversal_l, int reversal_r) {
	if (order == 0) {
		/* 順 */
		strncpyr(s1, s2, division, reversal_l); /* 左側 */
		strncpyr(s1 + division, s2 + division, n - division, reversal_r); /* 右側 */
	} else {
		/* 逆順 */
		strncpyr(s1 + n - division, s2, division, reversal_l); /* 左側 */
		strncpyr(s1, s2 + division, n - division, reversal_r); /* 右側 */
	}
	s1[n] = '\0';
}

int main(void) {
	int m; /* データセット数 */
	int l; /* 列車の長さ */
	char t[73]; /* 入場する列車の編成 */
	char u[40896][73]; /* 構成可能な最終編成 */
	int n; /* 構成可能な最終編成の数 */
	int i, j, k, h, g;

	if (scanf("%d", &m) != 1) return 1;

	/* データセット毎の処理 */
	for (i = 0; i < m; i++) {
		/* 初期化する */
		n = 0;
		/* 入場してくる列車の編成を入力する */
		scanf("%72s", t);
		l = strlen(t);

		/* 連結方法を全通り調べ重複を除いた総数を数える */
		for (j = 1; j < l; j++) { /* 分割位置 */
			for (k = 0; k < 2; k++) { /* 連結順 */
				for (h = 0; h < 2 * 2; h++) { /* 左側・右側の前後反転の有無 */
					/* 再編成する */
					rearrange(u[n], t, l, j, k, h / 2, h % 2);
					n++;

					/* これまでに作った編成と重複していないか調べる */
					for (g = 0; g < n - 1; g++) {
						if (strcmp(u[n - 1], u[g]) == 0) {
							n--;
							break;
						}
					}
				}
			}
		}

		/* 再編成の総数を出力する */
		printf("%d\n", n);
	}

    return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

void func(long long N, long long K, long long S){

    REP(i,0,N){
        if(i<K)cout<<S<<" ";
        else{
            if(S==1e9)cout<<S-1<<" ";
            else cout<<S+1<<" ";
        }
    }
    cout<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    func(N, K, S);
    return 0;
}


Measured memory_bytes: 3688
import sys
input = sys.stdin.readline

def main():
    sx,sy,tx,ty = map(int,input().split())
    dx = tx-sx
    dy = ty-sy
    
    ans = ["R"*dx + "U"*dy + "L"*dx + "D"*dy+"D"+"R"*(dx+1)+"U"*(dy+1)+"L"+"U"+"L"*(dx+1)+"D"*(dy+1)+"R"]
    
    print(*ans)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    vector<int>arr;
    for(int i=1000;i<=10000;i+=1000)
        arr.push_back(i);
    int n;
    cin>>n;
    int pos=lower_bound(arr.begin(),arr.end(),n)-arr.begin();
    cout<<arr[pos]-n<<endl;
    return 0;
}



Measured memory_bytes: 3628
#include <stdio.h>
int main(void)
{
    int x, y;
    x = 1, y = 1;
    while (1)
    {
        scanf("%d %d", &x, &y);
        if ((0 <= x)&&(y <= 10000))
        {
            if ((x == 0) && (y == 0))
            {
                break;
            }
            else
            {
                if(x < y)
                {
                    printf("%d %d\n", x, y);
                }
                else
                {
                    printf("%d %d\n", y, x);
                }
            }
             
        }
    }
    return 0;
}


Measured memory_bytes: 1980
#include<bits/stdc++.h>
using namespace std;
const int maxn=53;
int n,m,A,B,C; bool e[maxn][maxn];
void init(){
    scanf("%d%d%d%d%d",&n,&m,&A,&B,&C); memset(e,0,sizeof(e));
    for (int i=1,a,b;i<=m;++i){
        scanf("%d%d",&a,&b); e[a][b]=1;
    }
}
bool Can[maxn][maxn];
struct Tmx{
    bool a[maxn][maxn];
	void clear(){memset(a,0,sizeof(a));}
};
Tmx operator *(Tmx a,Tmx b){
    Tmx c; c.clear();
    for (int k=1;k<=n;++k) for (int i=1;i<=n;++i) for (int j=1;j<=n;++j) c.a[i][j]|=a.a[i][k]&b.a[k][j];
    return c;
}
void work(){
    Tmx a; memcpy(a.a,e,sizeof(e));

    Tmx tmp1=a;
    for (int i=1;i<A;++i) tmp1=tmp1*a;

	Tmx tmp2=a;
    for (int i=1;i<B;++i) tmp2=tmp2*a;

	Tmx tmp3=a;
    for (int i=1;i<C;++i) tmp3=tmp3*a;

    static int ans[maxn]; memset(ans,63,sizeof(ans));
	ans[n]=0;
	for (int i=1;i<=n;++i){
		for (int j=1;j<=n;++j){
            int res1=-1,res2=ans[0];
			for (int k=1;k<=n;++k) if (tmp1.a[j][k]) res2=min(res2,ans[k]+1);
			res1=res2; res2=ans[0];
			for (int k=1;k<=n;++k) if (tmp2.a[j][k]) res2=min(res2,ans[k]+1);
			res1=max(res1,res2); res2=ans[0];
			for (int k=1;k<=n;++k) if (tmp3.a[j][k]) res2=min(res2,ans[k]+1);
			res1=max(res1,res2);
			if (res1<ans[j]) ans[j]=res1;
		}
	}
	if (ans[1]<=n) printf("%d\n",ans[1]);else puts("IMPOSSIBLE");
}
int main(){
    init();
    work();
    return 0;
}

Measured memory_bytes: 1212