akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
  int MAX = 100;
  string str1, str2;
  cin >> str1;
  cin >> str2;
  char odd[MAX] = {};
  char even[MAX] = {};

  str1.copy(odd, str1.size());
  str2.copy(even, str2.size());

  for(int i = 0; odd[i] != '\0'; i++)
  {
    cout << odd[i] << flush;
    if(even[i] != '\0')
      cout << even[i] << flush;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
 
int N;
 
int main(void){
  int i;
  long long unsigned Li=1;
  long long unsigned L0 = 2;
  long long unsigned L1 = 1;
  scanf("%d", &N);
 
 
  for(i = 2; i <=N; i++){
    Li = L0 + L1;
    L0 = L1;
    L1 = Li;
    //printf("%d\n", Li);
  }
 
  printf("%lld", Li);
 
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb push_back
#define eb emplace_back
#define fs first
#define sc second
using lint = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vii = vector<pii>;

int n, x, t;

int main(){
  scanf("%d%d%d",&n,&x,&t);

  printf("%d",(n+x-1)/x*t);
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define endl "\n"
#define int long long
using namespace std;

int32_t main()
{
int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    vector<int> dp(n + 1);
    dp[0] = 0;
    for (int i = 1; i < n; i++)
    {
        int temp = INT_MAX;
        for (int j = i - 1; j >= 0 && j >= i - k; j--)
        {
            temp = min(temp, dp[j] + abs(v[i] - v[j]));
        }
        dp[i] = temp;
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1792
import kotlin.system.exitProcess

val dic = mutableMapOf<Long, Char>()

fun main(args: Array<String>) {
	val (n, m) = readLine()!!.split(' ').map { it.toLong() }
	val s = readLine()!!
	val t = readLine()!!

	val l = lcm(n, m)

	judge(s, l, 0)
	judge(t, l, 1)
	println(l)
}

fun judge(s: String, l: Long, k: Int) {
	for ((i, c) in s.withIndex()) {
		val j = l / s.length * i
		if (k != 0 && dic[j] != null && dic[j] != c) {
			println(-1)
			exitProcess(0)
		}
		dic[j] = c
	}
}

fun gcd(a: Long, b: Long): Long {
	return when {
		a < b -> {
			gcd(b, a)
		}
		b == 0L -> {
			a
		}
		else -> {
			gcd(b, a % b)
		}
	}
}

fun lcm(a: Long, b: Long): Long {
	return (a * b) / gcd(a, b)
}


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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

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

    int s1 = (S[0] - 48) * 10 + (S[1] - 48);
    int s2 = (S[2] - 48) * 10 + (S[3] - 48);
    IFD cout << s1 << " " << s2 << endl;

    if(1 <= s1 && s1 <= 12) {
        if(1 <= s2 && s2 <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if(1 <= s2 && s2 <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }

    return 0;
}


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

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    string c[H];
    for (int i = 0; i < H; i++)
    {
        cin >> c[i];
    }
    int ans = 0;
    for (int bitH = 0; bitH < (1 << H); bitH++)
    {
        for (int bitW = 0; bitW < (1 << W); bitW++)
        {
            vector<vector<bool>> red(H,vector<bool>(W,false));
            for (int i = 0; i < H; i++)
            {
                if(bitH & 1<<i)
                {
                    for (int j = 0; j < W; j++)
                    {
                        red[i][j] = true;;
                    }
                    
                }
            }
            for (int i = 0; i < W; i++)
            {
                 if(bitW & 1<<i)
                {
                    for (int j = 0; j < H; j++)
                    {
                        red[j][i] = true;
                    }
                    
                }
            }
            int count = 0;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if(!red[i][j] && c[i][j] == '#')
                    {
                        count++;
                    }
                }
            }
            if(count == K)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ldb long double
//#define base complex<ldb>
const int N=3005;
const ldb PI=acos(-1);
int T[N];
struct base
{
	ldb x,y;
	base(){ x=y=0;}
	base(ldb a, ldb b):x(a),y(b){}
	void operator += (base b){ x+=b.x;y+=b.y;}
	void operator /= (ldb b){ x/=b;y/=b;}
	ldb real(){ return x;}
	ldb imag(){ return y;}
};
int main()
{
	cout<<fixed<<setprecision(15);
    int n,L;
    scanf("%i %i",&n,&L);
	for(int i=1;i<=n;i++) scanf("%i",&T[i]);
	base sum(0,0);
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++)
	{
		ldb S=(ldb)(T[i]+T[j])/2;
		int ways=n-j+i-1;
		sum+=base(cos(2*PI*S/L)*ways,sin(2*PI*S/L)*ways);
		//printf("%i ",ways);
		//cout<<cos(2*PI*S/L)<<" "<<sin(2*PI*S/L)<<"\n";
		ways=j-i-1;
		sum+=base(cos(2*PI*S/L+PI)*ways,sin(2*PI*S/L+PI)*ways);
	}
	sum/=(ldb)n*(n-1)*(n-2)/6;
	cout<<sum.real()<<" "<<sum.imag()<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(void){
    int a, b, c;
    std::cin >> a >> b >> c;
    
    if(a < b && b < c){
        std::cout << "Yes" << std::endl;
        return 0;
    }
    else{
        std::cout << "No" << std::endl;
        return 0;
    }
}


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

int main()
{
    long long n,s=0;
    cin>>n;
    for(long long i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0){
            s+=i;
        }
    }
    cout<<s<<endl;
    return 0;
}

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

template <typename T> class SegmentTree {
private:
  int n;
  function<T(T, T)> f;
  T t;
  vector<T> node;

public:
  SegmentTree() {}
  SegmentTree(function<T(T, T)> f, T t) : f(f), t(t) {}
  void init(int in) {
    n = 1;
    while (n < in) n <<= 1;
    node.assign(n << 1, t);
  }
  void build(const vector<T> &v) {
    int in = v.size();
    init(in);
    for (int i = 0; i < in; i++) node.at(n + i) = v.at(i);
    for (int i = n - 1; i; i--) {
      node.at(i) = f(node.at((i << 1) | 0), node.at((i << 1) | 1));
    }
  }
  void set(int k, T x) {
    node.at(k += n) = x;
    while (k >>= 1) {
      node.at(k) = f(node.at((k << 1) | 0), node.at((k << 1) | 1));
    }
  }
  T query(int a, int b) {
    if (a >= b) return t;
    T vl = t, vr = t;
    for (int l = a + n, r = b + n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) vl = f(vl, node.at(l++));
      if (r & 1) vr = f(node.at(--r), vr);
    }
    return f(vl, vr);
  }
  template <typename C> int find(int st, C &check, T &acc, int k, int l, int r) {
    if (l + 1 == r) {
      acc = f(acc, node.at(k));
      return check(acc) ? k - n : -1;
    }
    int m = (l + r) >> 1;
    if (m <= st) return find(st, check, acc, (k << 1) | 1, m, r);
    if (st <= l && !check(f(acc, node.at(k)))) {
      acc = f(acc, node.at(k));
      return -1;
    }
    int vl = find(st, check, acc, (k << 1) | 0, l, m);
    if (~vl) return vl;
    return find(st, check, acc, (k << 1) | 1, m, r);
  }
  template <typename C> int find(int st, C &check) {
    T acc = t;
    return find(st, check, acc, 1, 0, n);
  }
};

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  long N, Q;
  cin >> N >> Q;
  using pii = pair<long, long>;
  vector<pii> A(N);
  for (long i = 0, a; i < N && cin >> a; i++) A.at(i) = {a, i};

  auto f = [&](pii x, pii y) { return max(x, y); };
  pii ng(-1, -1);
  SegmentTree<pii> ST(f, ng);
  ST.build(A);

  while (Q--) {
    long a, b, c;
    cin >> a >> b >> c, b--;
    if (a == 1) {
      ST.set(b, {c, b});
    } else if (a == 2) {
      cout << ST.query(b, c).first << "\n";
    } else {
      auto f2 = [&](pii p) { return c <= p.first; };
      long ans = ST.find(b, f2);
      if (ans == -1) ans = N; 
      cout << ans + 1 << "\n"; 
    }
  }
}

Measured memory_bytes: 14548
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    dp[i]=min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1])
print(dp[-1])

Measured memory_bytes: 13928
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;

 
void solve(){
	int n;
    cin>>n;
    vector<int>p(n),q(n);
    rep(i,n){
        cin>>p[i];
        q[--p[i]]=i;
    }
    int ans=0,cur=0,cnt=0;
    rep(i,n){
        if(q[i]>cur)++ans;
        else ans=1;
        cur=q[i];
        cnt=max(cnt,ans);
    }
    cout<<n-cnt<<"\n";
}
 
signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
#define int long long 
int d[(int)(1e5)], s[(int)(1e5)];
bool visited[(int)(1e5)];
const int INF = 1e9 + 100;
pair<int,int> dfs(vector< vector< pair<int,int> > > &G, int v){
  int l = 1, r = INF;
  for(int i = 0; i < (int)G[v].size(); ++i){
    int v_ = G[v][i].second, c = G[v][i].first;
    if(!visited[v_]){
      visited[v_] = true;
      d[v_] = c - d[v];
      s[v_] = 1 - s[v];
      if(s[v_]){
        r = min(r,d[v_]-1);
      }else{
        l = max(l, -d[v_]+1);
      }
      pair<int,int> ret_ = dfs(G,v_);
      l = max(l, ret_.first);
      r = min(r, ret_.second);
    }else{
      if(s[v] && s[v_]){
        if((d[v_] + d[v] - c)%2){
          l = max(l,0LL);
          r = min(r,-1LL);
          continue;
        }
        int x = (d[v_] + d[v] - c)/2;
        l = max(l,x);
        r = min(r,x);
      }else if(s[v]||s[v_]){
        if(d[v]+d[v_] != c){
          l = max(l,0LL);
          r = min(r,-1LL);
          continue;
        }
      }else{
        if((c - d[v_] - d[v])%2){
          l = max(l,0LL);
          r = min(r,-1LL);
          continue;
        }
        int x = (c - d[v_] - d[v])/2;
        l = max(l,x);
        r = min(r,x);
      }
    }
  }
  return {l,r};
}

signed main(){
  int n, m;
  cin >> n >> m;
  vector< vector< pair<int,int> > > G(n);
  for(int i = 0; i < m; ++i){
    int u, v, s;
    cin >> u >> v >> s;
    --u,--v;
    G[u].emplace_back(s,v);
    G[v].emplace_back(s,u);
  }
  pair<int,int> ans = dfs(G,0);
  visited[0] = true;
  //cout << ans.first  << " " << ans.second << endl;
  cout << max(0LL,ans.second - ans.first + 1) << endl;
  return 0;
}


Measured memory_bytes: 15744
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define NUM ((long long)1000000007)
#define int long long

using namespace std;

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

    string s;
    int k;
    cin >> s >> k;
    vector<string> substrs;
    for (size_t i = 0; i < k; i++)
    {
        for (size_t j = 0; j < s.size() - i; j++)
        {
            string substr = s.substr(j, i + 1);
            if (find(substrs.begin(), substrs.end(), substr) == substrs.end())
            {
                substrs.emplace_back(substr);
            }
        }
    }
    sort(substrs.begin(), substrs.end());

    cout << substrs[k - 1] << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;

int f[101][101];
int w, h;

int dx_even[] = {0, 1, -1, 1, 0, 1};
int dx_odd[]  = {-1, 0, -1, 1, -1, 0};
int dy[] = {-1, -1, 0, 0, 1, 1};

bool checked[101][101];
bool isFill[101][101];

bool check(int y, int x) {
	checked[y][x] = true;
	if(x==0 || y==0 || x+1==w || y+1==h) return false;
	rep(i, 6) {
		int ny = y + dy[i], nx = x + (y%2 ? dx_odd[i] : dx_even[i]);
		if( !checked[ny][nx] && f[ny][nx] == 0 && !check(ny,nx) ) {
			return false;
		}
	}
	return true;
}

int main() {
	cin >> w >> h;
	rep(y, h) {
		rep(x, w) {
			cin >> f[y][x];
		}
	}
	rep(y, h) {
		rep(x, w) {
			if( !f[y][x] && !checked[y][x] ) {
				memset(checked, 0, sizeof(checked));
				if( check(y,x) ) {
					rep(y, h) {
						rep(x, w) {
							if( checked[y][x] )	isFill[y][x] = true;
						}
					}
				}
			}
		}
	}
	rep(y, h) {
		rep(x, w) {
			if( isFill[y][x] ) f[y][x] = 1;
		}
	}
	ll cnt = 0;
	rep(y, h) {
		rep(x, w) {
			rep(i,6) {
				int ny = y + dy[i];
				int nx = x + (y%2 ? dx_odd[i] : dx_even[i]);
				bool oor = (nx<0 || w<=nx || ny<0 || h<=ny);
				if(f[y][x] && (oor || (!oor && f[ny][nx]==0))) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1444
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  string s; cin>>s;
  rep(i,s.size()){
    if(s[i]==',')
    cout<<" ";
    else
    cout<<s[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,a[1002],k=1;
	scanf("%d",&n);
	for(int i=0;i<n-1;i++)
		scanf("%d ",&a[i]);
	scanf("%d",&a[n-1]);
	for(int i=0;i<n;i++)
	{
		if(a[i]%2==0)
		{
			if(a[i]%3==0||a[i]%5==0);
			else
			{
				printf("DENIED");
				return 0;
			}
		}
	}
	printf("APPROVED");
	return 0;
}

Measured memory_bytes: 128
n,m = map(int,input().split())
 
a = [ int(x) for x in input().split()]
limit = sum(a)/(4*m)
 
count=0
for x in a:
  	if(x>=limit):
      			count+=1
if(count<m):
  	print('No')
else:
  	print('Yes')

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

using namespace std;
using ll = long long;


int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    while(b <= a) {
        b *= 2;
        cnt++;
    }
    while(c <= b) {
        c *= 2;
        cnt++;
    }
    int k; cin >> k;
    cout << (cnt <= k ? "Yes" : "No") << endl;
}

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

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector < vector <int> > g(n + 1);
    for (int i = 0, u, v; i < m; i++)
    {
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector <int> d(n + 1, -1), q;
    q.push_back(1);
    d[1] = 0;
    for (int i = 0; i < q.size(); i++)
    {
        int v = q[i];
        for (int to : g[v])
        {
            if (d[to] == -1)
            {
                d[to] = v;
                q.push_back(to);
            }
        }
    }
    if (q.size() != n)
    {
        puts("No");
        return 0;
    }
    puts("Yes");
    for (int i = 2; i <= n; i++)
    {
        cout << d[i] << endl;
    }
} 

Measured memory_bytes: 10564
key = list(map(int, input().split()))
if 2 in key:
  print("No")
elif (key[0] in [4, 6, 9, 11] and key[1] in [4, 6, 9, 11]) or (key[0] in [1, 3, 5, 7, 8, 10, 12] and key[1] in [1, 3, 5, 7, 8, 10, 12]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
int main()
{
    long long n,k;
    scanf("%lld %lld",&n,&k);
        long long d=n/k +1;
        long long y=k*d -n;
        if(y<(n%k))
           printf("%lld",y);
        else
            printf("%lld",n%k);
}

Measured memory_bytes: 1736
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int n;
vector<int> a;

string solve(int x, int v)
{
    if(v * v > x * (2 * a[n-1]))
        return "crash";

    x *= 2;
    vector<vector<bool> > dp(x+1, vector<bool>(v+1, false));
    dp[x][v] = true;

    for(int i=x; i>=0; --i){
        for(int j=v; j>=0; --j){
            if(!dp[i][j])
                continue;
            for(int k=0; k<n; ++k){
                int i2 = i - 2 * j + a[k];
                int j2 = j - a[k];
                if(i2 >= 0 && j2 >= 0)
                    dp[i2][j2] = true;
            }
        }
    }

    if(dp[0][0])
        return "perfect";

    for(int i=0; i<x; ++i){
        if(dp[i][0]){
            ostringstream oss;
            oss << "good " << (i / 2);
            if(i % 2 == 0)
                oss << ".000";
            else
                oss << ".500";
            return oss.str();
        }
    }

    return "try again";
}

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

    while(--c >= 0){
        cin >> n;
        a.resize(n);
        for(int i=0; i<n; ++i)
            cin >> a[i];
        sort(a.begin(), a.end());

        int q;
        cin >> q;
        while(--q >= 0){
            int x, v;
            cin >> x >> v;
            cout << solve(x, v) << endl;
        }

        if(c > 0)
            cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1268
<?php
$n = array();
$i = 1;
while (true) {
	$x = fgets(STDIN);
	if ($x == 0) {
		break;
	}else {
		$n[$i] = $x;
		$i++;
	}
}
foreach ($n as $key => $val) {
	echo "Case ".$key.": ".$val;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    ll N; cin >> N;
    vector<ll> A(N);
    ll allXor = 0;

    REP(i,N){
        cin >> A[i];
        allXor ^= A[i];
    }

    REP(i,N){
        ll s = allXor ^ A[i];
        cout << s << " ";
    }

    cout << endl;
}

Measured memory_bytes: 4852
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
using namespace std;

int main() {
    int W, H;
    int x, y;
    cin >> W >> H >> x >> y;
    cout << ((double)W * (double)H) / 2.0 << " " << (W % 2  == 0  && H % 2 == 0 && x == W / 2 && y == H /2) ? 1 : 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	arr := make([][]int, 3)
	for i := 0; i < 3; i++ {
		arr[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			var tmp int
			fmt.Scan(&tmp)
			arr[i][j] = tmp
		}
	}
	for i := 0; i < 101; i++ {
		for j := 0; j < 101; j++ {
			for k := 0; k < 101; k++ {
				x1, y1, z1 := arr[0][0] - i, arr[0][1] - i, arr[0][2] - i
				x2, y2, z2 := arr[1][0] - j, arr[1][1] - j, arr[1][2] - j
				x3, y3, z3 := arr[2][0] - k, arr[2][1] - k, arr[2][2] - k
				if x1 == x2 && x2 == x3 && y1 == y2 && y2 == y3 && z1 == z2 && z2 == z3 {
					fmt.Println("Yes")
					return
				}
			}
		}
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
const int ARRAY = 30;

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

  while( N > 0){
    if( N % 4 == 0 || N % 7 == 0) {
      cout << "Yes" << "\n";
      return 0;
    } else {
      N -= 7;
    }
  }
  
  cout << "No" << "\n";
}


Measured memory_bytes: 3556
program main
  implicit none
  character(26) :: s
  integer :: i, j, n
  read(*, *) s
  n = len(trim(s))
  do i = 1, n
    do j = i + 1, n
      if (s(i:i) == s(j:j)) then
        write(*, "(a)") "no"
        stop 0
      end if
    end do
  end do
  write(*, "(a)") "yes"
end program main


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

const int N = 100000;

int n, a[N], aux[N * 2 + 1];

long long count(int median)
{
    memset(aux, 0, sizeof(aux));
    int sum = 0;
    long long res = 0;
    for (int i = 0; i <= n; ++ i) {
        for (int j = n + sum; j >= 0; j -= ~j & j + 1) {
            res += aux[j];
        }
        for (int j = n + sum; j <= n + n; j += ~j & j + 1) {
            aux[j] ++;
        }
        if (i < n) {
            sum += (a[i] >= median ? 1 : -1);
        }
    }
    return res;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%d", a + i);
    }
    auto tot = n * (n + 1LL) / 2;
    int low = 0;
    int high = *std::max_element(a, a + n);
    while (low < high) {
        int mid = low + high + 1 >> 1;
        if (2 * count(mid) >= tot) {
            low = mid;
        } else {
            high = mid - 1;
        }
    }
    printf("%d\n", low);
}

Measured memory_bytes: 1408
N,A,B = list(map(int, input().split(" ")))



ans_list = []
for i in range(1,N+1):
    num = str(i)
    n_sum = 0
    for n in num:
        n_sum += int(n)

    if A<=n_sum<=B:
        ans_list.append(i)


print(sum(ans_list))

Measured memory_bytes: 3296
#include <iostream>
#include <numeric>
#include <algorithm>
using namespace std;

int main(){
    int n;
    while(cin >> n && n > 0){
        int lst[n];
        for(int i=0;i<n;i++){
            cin >> lst[i];
        }
        int max;
        max = lst[0];
        for(int i=1;i<n;i++){
            if(max < lst[i]){
                max = lst[i];
            }
        }
        int min;
        min = lst[0];
        for(int i=1;i<n;i++){
            if(min > lst[i]){
                min = lst[i];
            }
        }
        cout << (accumulate(lst, lst+n, 0) - max - min)/(n-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 3040
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define all(a) (a).begin(), (a).end()
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 

using namespace std;

void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stderr);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
}                         

void solve() {                                                                                         
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; ++i) {
	 	cin >> a[i];
	 	a[i]--;
	}
	for (int i = 0; i < n; ++i) {
	 	cin >> b[i];
	}
	for (int i = 0; i < n; ++i) {
	    cin >> c[i];
	}	

	int ans = b[a[0]];
	for (int i = 1; i < n; ++i) {
	 	ans += b[a[i]];
	 	if (a[i] == a[i - 1] + 1) {
	 	 	ans += c[a[i] - 1];
	 	}
	}

	cout << ans << endl;
}	


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    s = 0
    l = {i:0 for i in range(1,100001)}

    s = sum(A)
    for num in A:
        l[num] += 1



    for _ in range(Q):
        B, C = map(int, input().split())
        num_of_before = l[B]
        l[C] += num_of_before
        s = s + num_of_before * (C-B)
        print(s)
        l[B] = 0


if __name__ == '__main__':
    main()



Measured memory_bytes: 99216
//====== begin of bisma c++ template======================================================================================
#include<bits/stdc++.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define repn(a,b,c) for(int a=b;a>=c;a--)
#define ll long long 
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))


//=======binarysearch===========
int bs(vector<long long>&a,int que){
 auto it=lower_bound(a.begin(),a.end(),que);
 if(*it==que){
    return it-a.begin();
 }
 return -1;
}
//========binarysearch=========



//=======SUBSET WITH BRUTEFORCE=============
void subsets(string S, int n) {
     int nSub = 1<<n; 
     for(int i=0; i<nSub; i++){
     	  cout<<"{ ";//optional
          for(int k=0; k<n; k++){
               //if the k-th bit is set
               if( (1<<k) & i){
                    cout<<S[k]<<" ";
               } 
          }
          cout<<"}\n"; //optional
     }
}
//======SUBSET WITH BRUTE FORCE================

//======permuatate all ===================================
void permutate(){
int n,x;
cin>>n;

vector<int> permutation;
for (int i = 0; i < n; i++) {
	cin>>x;
permutation.push_back(x);
}
do {
 rep(i,0,n-1) cout<<permutation[i];
 cout<<endl;
} while (next_permutation(permutation.begin(),permutation.end()));
}
//====permuatate all=======================


//====check prime =========================

bool isprime(int x)
{
  if ( x == 2 ) return true;
  if ( x  < 2 ) return false;
  for ( int i = 2; i * i <= x; i++ )
    if ( x % i == 0 ) return false;
  return true;
}
//===check prime ========================


//======= the end of bisma c++ template ================================================================================


int main(){

long n;
cin>>n;

if(n%2==1){
  cout<<n*2;
}else{
  cout<<n;
}

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;

signed main(){
    ll n,m;
    cin >> n >> m;
    ll x,y;
    bool flag[n] ={false};
    flag[0] = true;
    ll cnt[n];
    rep(i,0,n) cnt[i] = 1;

    rep(i,0,m){
        cin >> x >> y;
        cnt[x-1]--;
        cnt[y-1]++;
        if(flag[x-1]) flag[y-1] = true;
        if(cnt[x-1] == 0 && flag[x-1]) flag[x-1] = false;
    }

    ll ans = 0;
    rep(i,0,n){
        if(flag[i]) ans++;
    }
    cout <<ans << endl;
    return 0;
}


Measured memory_bytes: 4440
#include <iostream>
using namespace std;
const int maxn = 2e5 + 10;
char t[maxn];
int main()
{
	cin >> t;
	for (int i = 0; t[i]; i++)
	{
		if (t[i] == '?')
			t[i] = 'D';
	}
	cout << t << endl;
	return 0;
}

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

int main(){
    int N,ans = 1;
    cin >> N;
    vector<int> h(N);

    for(int i = 0; i < N; i++){
        cin >> h.at(i);
    }

    for(int i = 0; i < N; i++){
        int count = 0;
        for(int j = 0; j < i; j++){

            if(h.at(i) >= h.at(j)){
                count++;
            }else{
                break;
            }
            if(count == i){
                ans++;
                break;
            }            
            
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, a[60];

int read()
{
	int x = 0,f = 1;
	char ch= getchar();
	while(ch<'0' || ch>'9')
	{
		if(ch == '-')
			f=-1;
		ch = getchar();
	} 
	while(ch>='0' && ch<='9')
	{
		x = (x<<1) + (x<<3) + ch-'0';
		ch = getchar();
	}
	return x*f;
}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n = read();
	for(int i = 1;i <= n;i++)
		a[i] = read();
	int ans = 0;
	for(int i = 1;i <= n;i++)
	{
		for(int j = i + 1;j <= n;j++)
			ans += a[i] * a[j];
	}
	printf("%d", ans);
	return 0;
} 

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

using namespace std;

struct node{
  vector<int> con;
  vector<int> cost;
  vector<int> e_id;
};

typedef vector<node> Graph;

struct State{
  int now;
  int dist;
  int used;
  State(int n, int d, int u):now(n),dist(d),used(u){}
  bool visited(int i){return (bool)(used&(1LL<<i));}
  void setUse(int i){used|=(1LL<<i);}
  vector<int> hist;
  bool operator>(const State &t)const{
    return dist > t.dist;
  }
};

pair<int,vector<int> > solve(int st, Graph &G){
  priority_queue<State,vector<State>,greater<State> > Q;
  State init(st,0,0);
  init.hist.push_back(st+1);
  Q.push(init);
  pair<int, vector<int> > ret;
  while(!Q.empty()){
    State nst = Q.top();
    Q.pop();
    int nowid = nst.now;

    if(ret.first<nst.dist){
      ret=make_pair(nst.dist,nst.hist);
    }else if(ret.first==nst.dist){
      if(nst.hist<ret.second){
	ret.second = nst.hist;
      }
    }

    for(int i = 0; i < (int)G[nowid].con.size(); ++i){
      State next(G[nowid].con[i], nst.dist + G[nowid].cost[i], nst.used);
      if(!nst.visited(G[nowid].e_id[i])){
	next.setUse(G[nowid].e_id[i]);
	next.hist=nst.hist;
	next.hist.push_back(G[nowid].con[i]+1);
	Q.push(next);
      }
    }
  }
  return ret;
}

int main()
{
  while(true){
    int ns,nl;
    cin >> ns >> nl;
    if(ns==0&&nl==0)break;
    Graph G(ns);
    for(int i = 0; i < nl; ++i){
      int src,dst,w;
      cin >> src >> dst >> w;
      G[src-1].con.push_back(dst-1);
      G[src-1].cost.push_back(w);
      G[src-1].e_id.push_back(i);
      G[dst-1].con.push_back(src-1);
      G[dst-1].cost.push_back(w);
      G[dst-1].e_id.push_back(i);
    }
    pair<int, vector<int> > res;
    for(int i = 0; i < ns; ++i){
      pair<int, vector<int> > tmp = solve(i,G);
      if(res.first < tmp.first){
	res = tmp;
      }else if( res.first == tmp.first ){
	if( tmp.second < res.second )
	  res.second = tmp.second;
      }
    }
    cout << res.first << endl;
    for(int i = 0; i < (int)res.second.size(); ++i){
      if(i>0)cout << ' ';
      cout << res.second[i];
    }
    cout << endl;
  }
  return 0;
}

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

int main()
{
	int n, k;

	cin >> n >> k;

	for (int i = 0; i < k; i++) {
		int a, b, c, d, m;

		cin >> a >> b;

		c = a;
		d = b;

		if (a >= n / 2)
			c = n + 1 - a;

		if (b >= n / 2)
			d = n + 1 - b;		

		m = min(c, d) % 3;

		if (m == 0)
			cout << 3 << endl;
		else
			cout << m << endl;
	}

	return 0;
}



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

#define Int register int
#define mod 1000000007

template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}
template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}
template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}

int N,X,Y,Z,dp[41][1 << 17];

int mul (int a,int b){return 1ll * a * b % mod;}
int dec (int a,int b){return a >= b ? a - b : a + mod - b;}
int add (int a,int b){return a + b >= mod ? a + b - mod : a + b;}
void Add (int &a,int b){a = add (a,b);}
int qkpow (int a,int b){
	int res = 1;for (;b;b >>= 1,a = mul (a,a)) if (b & 1) res = mul (res,a);
	return res;
}

signed main(){
	read (N,X,Y,Z),dp[0][0] = 1;
	int ans = 1,up = (1 << X + Y + Z) - 1,st = (1 << X + Y + Z - 1) | (1 << Y + Z - 1) | (1 << Z - 1);
	for (Int i = 1;i <= N;++ i){
		ans = 1ll * ans * 10 % mod;
		for (Int S = 0;S <= up;++ S)
			if (dp[i - 1][S] && (S & st) != st)//(S&st)!=st：如果前面还没有出现过合法解 
				for (Int c = 1;c <= 10;++ c)
					Add (dp[i][((S << c) | (1 << c - 1)) & up],dp[i - 1][S]); 
	}
	for (Int S = 0;S < (1 << X + Y + Z);++ S) if ((S & st) != st) ans = dec (ans,dp[N][S]);
	write (ans),putchar ('\n');
	return 0;
}


Measured memory_bytes: 22308
#include <iostream>

using namespace std;

class B {
	int N, T;
public:
	void solve()
	{
		int c, t;
		int ans{1001};
		for (int i{ 0 }; i < N; i++)
		{
			cin >> c >> t;
			if (t <= T)
			{
				if (c < ans) ans = c;
			}
		}

		if (ans != 1001)
			cout << ans << endl;
		else
			cout << "TLE" << endl;
	}

	B()
	{
		cin >> N >> T;
	}
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>

#define ll long long
#define MOD 1000000007

using namespace std;

int main(){
    int R,G;
    cin >> R >> G;
    cout << 2*G-R << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    LL h, w;
    cin >> h >> w;
    vector<vector<LL>> a(h, vector<LL>(w));
    vector<vector<LL>> b(h, vector<LL>(w));
    for(LL y = 0; y < h; ++y){
        for(LL x = 0; x < w; ++x){
            cin >> a[y][x];
        }
    }
    for(LL y = 0; y < h; ++y){
        for(LL x = 0; x < w; ++x){
            cin >> b[y][x];
        }
    }
    LL l = 80*80+1;
    vector<vector<vector<LL>>> dp(h+1, vector<vector<LL>>(w+1, vector<LL>(l)));
    dp[0][0][0] = 1;
    for(LL y = 0; y < h; ++y){
        for(LL x = 0; x < w; ++x){
            for(LL v = 0; v < l; ++v){
                if(dp[y][x][v] == 0) continue;
                LL v1 = v + a[y][x] - b[y][x];
                if(v1 < 0) v1 *= -1;
                if(v1 < l){
                    dp[y+1][x][v1] = 1;
                    dp[y][x+1][v1] = 1;
                }
                LL v2 = v - a[y][x] + b[y][x];
                if(v2 < 0) v2 *= -1;
                if(v2 < l){
                    dp[y+1][x][v2] = 1;
                    dp[y][x+1][v2] = 1;
                }
            }
        }
    }
    LL ans = 80;
    for(LL v = 0; v < l; ++v){
        if(dp[h-1][w][v] == 0) continue;
        ans = min(ans, v);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 332928
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
var nm = (arr.shift()).split(" ").map(Number);
arr = arr.map(Number);
for (var i = 1; i <= nm[1]; i++) {
   for (var j = 0; j < arr.length - 1; j++) {
      var a = arr[j] % i;
      var b = arr[j + 1] % i;
      if (b < a) {
         var memo = arr[j + 1];
         arr[j + 1] = arr[j];
         arr[j] = memo;
      }
   }
}
console.log(arr.join("\n"));

Measured memory_bytes: 15868
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,50),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(input())
for i in range(n):
  n = int(input())
  if is_prime(n): cnt+=1

print(cnt)

Measured memory_bytes: 7744
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;

  if(k>n*2){
    int x=(k-n*2)/2*2;
    k-=x;
  }
  
  int f=0;
  deque<int> d;

  for(int i=0;i<n;i++) d.emplace_back(s[i]-'A');
  
  while(k--){
    if(d[0]^f){
      d.pop_front();
      f^=1;
      d.push_back(f);      
    }else{
      d[0]=!d[0];
    }
  }

  string ans;
  for(int i=0;i<n;i++) ans.push_back(char('A'+(d[i]^f)));

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


Measured memory_bytes: 1812
#include <cstdio>

int main()
{
	int n;
	int b = 0;
	int f = 0;
	int r = 0;
	int	v = 0;
	int array[4][3][10] = { 0 };
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);

		array[b-1][f-1][r-1] += v;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				printf(" ");
				printf("%d", array[i][j][k]);
			}
			printf("\n");
		}
		if (i != 3) {
			printf("####################");
			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2756
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)
	S := ""
	var s, t string
	fmt.Scanf("%s %s", &s, &t)
	for i := 0; i < N; i++ {
		S += string(s[i]) + string(t[i])
	}
	fmt.Println(S)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    char c;
    cin >> c;
    c++;
    cout << c << endl;
}

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

struct Node {
    int key;
    Node *prev, *next;
};

Node *nil;
void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}
void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node *listSearch(int key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if (t == nil) {
        return;
    }
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() { deleteNode(nil->next); }
void deleteLast() { deleteNode(nil->prev); }
void deleteKey(int key) { deleteNode(listSearch(key)); }

void Main() {
    int n, k;
    string s;
    cin >> n;
    init();
    rep(i, n) {
        cin >> s;
        if (s == "delete" || s == "insert") {
            cin >> k;
            if (s == "delete") {
                deleteKey(k);
            } else {
                insert(k);
            }
        } else if (s == "deleteFirst") {
            deleteFirst();
        } else {
            deleteLast();
        }
    }
    for (Node *x = nil->next; x != nil; x = x->next) {
        cout << x->key << (x->next != nil ? " " : "\n");
    }
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


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

int main(){
 long long int x,h,m,s;
 cin>>x;
 h = x/ (60*60);
 m = (x-(h*60*60))/60;
 s = x-((h*60*60)+m*60);
 printf("%lld:%lld:%lld\n",h,m,s);
}



Measured memory_bytes: 3224
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
const int N=2e5+10;
struct dabt{ int next,to; LL dis; }e[N];
int n,r,c,head[N],k;
bool vis[N];
LL num[N],minr,minc;
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline I mi(const I &a,const I &b){return a<b ? a : b;}
inline void add(int from,int to,LL d){e[++k]=(dabt){head[from],to,d}; head[from]=k;}
bool dfs(int st,LL sum)
{
	if(vis[st]) return num[st]==sum;
	if(st<=r) minr=mi(minr,sum);
	else minc=mi(minc,sum);
	vis[st]=1; num[st]=sum;
	for(RG int i=head[st];i;i=e[i].next) if(!dfs(e[i].to,e[i].dis-sum)) return 0;
	return 1;
}
int main()
{
//	freopen("Grid and Integers.in","r",stdin);
	read(r,c,n);
	for(RG int i=1,x,y,z;i<=n;i++)
	{
		read(x,y,z);
		add(x,y+r,z); add(y+r,x,z);
	}
	for(RG int i=1;i<=r+c;i++)
	 if(!vis[i])
	 {
		minr=3e18, minc=3e18;
		if(!dfs(i,0) || minc+minr<0) { printf("No\n"); return 0; }
	 }
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 9088
// $%U%$ $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	ll n;
	cin>>n;
	long double a = (n/(long double)3);
	cout<<setprecision(32)<<a*a*a<<endl;
	return 0;
}



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

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> m(h);
    for(int i=0; i<h; i++) cin >> m[i];

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(m[i][j] == '.'){
                int cnt = 0;
                for(int x=-1; x<=1; x++){
                    for(int y=-1; y<=1; y++){
                        if(0<=y+i && y+i<h && 0<=x+j && x+j<w && m[i+y][j+x] == '#') cnt++;
                    }
                }
                cout << cnt;
            }
            else{
                cout << "#";
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

n = int(input())
a = [-1 for _ in range(n)]
b = [-1 for _ in range(n)]
c = [-1 for _ in range(n)]

for i in range(n):
    a[i],b[i],c[i] = map(int, input().split())

#dp = [['' for _ in range(n)] for _ in range(3)] 
dp = [['' for _ in range(3)] for _ in range(n)] 
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

for i in range(n-1):
    dp[i+1][0] = max(dp[i][1] + a[i+1], dp[i][2] + a[i+1])
    dp[i+1][1] = max(dp[i][0] + b[i+1], dp[i][2] + b[i+1])
    dp[i+1][2] = max(dp[i][0] + c[i+1], dp[i][1] + c[i+1])

ans = max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])
print(ans)

#print("dp[%d][0] = %d" % (n-1, dp[n-1][0]))
#print("dp[%d][1] = %d" % (n-1, dp[n-1][1]))
#print("dp[%d][2] = %d" % (n-1, dp[n-1][2]))


Measured memory_bytes: 36212
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    int out=0;
    for(int i=0;i<N;i++){
        int l,r; cin >> l >> r;
        out += r-l+1;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S; cin>>S;
  int N=S.size();
  vii dp(N+1,vi(2));
  dp[0][1]=1;
  rep(i,0,N){
    if(S[i]=='0'){
      dp[i+1][0]=dp[i][0]*3;
      dp[i+1][1]=dp[i][1];
    }
    else{
      dp[i+1][0]=dp[i][0]*3+dp[i][1];
      dp[i+1][1]=dp[i][1]*2;
    }
    dp[i+1][0]%=MOD;
    dp[i+1][1]%=MOD;
  }
  cout<<(dp[N][0]+dp[N][1])%MOD<<endl;
  }



Measured memory_bytes: 5760
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int count = 0;
    rep(i, a+1){
        rep(j, b+1){
            rep(k, c+1){
                int res = i * 500 + j * 100 + k * 50;
                if(x == res)        count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 1009
using namespace std;
typedef long long LL;
const LL mod = 1e9+7;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a%3==0||b%3==0||(a+b)%3==0) puts("Possible");
    else puts("Impossible");
    return 0;
}


Measured memory_bytes: 256