akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    int ans = 0;
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(),l.end());
    for(int i = 0; i < n-2; i++){
        for(int j = i; j < n-1; j++){
            for(int k = j; k < n; k++){
                if(l[i] == l[j] || l[i] == l[k] || l[j] == l[k]) continue;
                if(l[k] > l[j]-l[i] && l[k] < l[j]+l[i]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int m, d;
  cin >> m >> d;
  int ans = 0;
  for (int i = 22; i <= d; i++) {
    int d1 = i % 10, d10 = i / 10;
    if (d1 < 2) continue;
    if (d1 * d10 <= m) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//#include "stdc++.h"
#include <bits/stdc++.h>
#include<iostream>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
//#define sz(x) (int)(x.size())
#define ff first
#define ss second
#define endl "\n"
inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p*p)%m;if(n%2) return (p*a)%m;else return p;}
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
#define pi 3.141592653589793238462
#define int  long long
bool visited[1001][1001];
int32_t main()
{
    int h,w;
    cin>>h>>w;
    string s[h];queue<pair<int,int> >q;pair<int,int>p;int i1,j1;
    for(int i=0;i<h;i++)
    cin>>s[i];
    int tm[h][w];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
            if(s[i][j]=='#')
            {q.push(m1(i,j));
                visited[i][j]=1;
                tm[i][j]=0;
            }
    }
    while(!q.empty())
    {
        p=q.front();
        q.pop();
        i1=p.first;
        j1=p.second;
        if(i1>=1&&(!visited[i1-1][j1]))
        {
            q.push(m1(i1-1,j1));
            visited[i1-1][j1]=1;
            tm[i1-1][j1]=1+tm[i1][j1];
        }
        if(j1>=1&&(!visited[i1][j1-1]))
        {
            q.push(m1(i1,j1-1));
            visited[i1][j1-1]=1;
            tm[i1][j1-1]=1+tm[i1][j1];
        }
        if(i1<h-1&&(!visited[i1+1][j1]))
        {
            q.push(m1(i1+1,j1));
            visited[i1+1][j1]=1;
            tm[i1+1][j1]=1+tm[i1][j1];
        }
        if(j1<w-1&&(!visited[i1][j1+1]))
        {
            q.push(m1(i1,j1+1));
            visited[i1][j1+1]=1;
            tm[i1][j1+1]=1+tm[i1][j1];
        }
        
    }
    int ans=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            ans=max(ans,tm[i][j]);
    cout<<ans<<endl;
    return 0;
}








Measured memory_bytes: 26420
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n+1); rep(i,n) cin >> a[i];
    a[n] = 0;

    rep(_,k){

        vector<ll> b(n+1,0);

        rep(i,n){
            b[max(0ll,i - a[i])]++;
            b[min(n, i + a[i] + 1)]--;
        }

        rep(i,n){
            b[i+1] += b[i];
        }

        if(a == b) break;

        rep(i,n){
            a[i] = b[i];
        }

    }

    rep(i,n){
        cout << a[i] << " ";
    }

    cout << endl;


}

Measured memory_bytes: 6428
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
	let mut vec = vec!();
	let N = read_line().parse::<i32>().unwrap();
	for i in 0..N {
		vec.push(read_line().parse::<i32>().unwrap());
	}
	vec.sort();
	vec.dedup();
	//vec.sort_by(|a,b|b.cmp(a));
	let mut c = 0;
	for i in 0..(vec.len()-1) {
		if vec[i] < vec[i+1] {
			c+=1;
		}
	}
	println!("{}",c+1);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
using namespace std;
//  =========     /\       /|    |====/|
//      |        /  \       |    |   / |
//      |       /____\      |    |  /  |
//      |      /      \     |    | /   |
//  ========= /        \  =====  |/====|  
//  code

int main(){
    init;
    int n,i,j,k,l;
    cin>>n;
    vector<int>h(n);
    for(i=0;i<n;i++)
        cin>>h[i];
    int dp[n+1];
    dp[1] = 0;
    dp[2] = abs(h[1]-h[0]);
    for(i=3;i<=n;i++)
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i-2]), dp[i-2] + abs(h[i-1] - h[i-3]));
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, m = map(int, input().split())

if not 0 <= n <= 100 and 0 <= m <= 100 and 2 <= n + m:
    print('Unsupported...')  
if n >= 2:
    n_comb = combinations_count(n, 2)
else:
    n_comb = 0
if m >= 2:
    m_comb = combinations_count(m, 2)
else:
    m_comb = 0
    
print(n_comb + m_comb)

Measured memory_bytes: 38384
import java.util.Scanner;

 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int  n= in.nextInt();
        int L= in .nextInt();

        if(L>=0){
            int sum=0;
            for(int i=L,j=1;j<=n;i++,j++){
                sum+=i;
            }

            sum-=L;
            System.out.println(sum);
        }
        else{
            int sum=0;
            if(Math.abs(L)>=n){
                for(int i=L,j=1;j<n;i++,j++){
                    sum+=i;
                }
                System.out.println(sum);
            }
            else {
                for(int i=L,j=1;j<=n;i++,j++){
                    sum+=i;
                }
                System.out.println(sum);
            }
        }
    }
}


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

ll gcd(ll a, ll b) {
  if (a%b == 0) {
    return(b);
  } else {
    return(gcd(b, a%b));
  }
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main() {
  int n,m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i,0,n) cin >> a[i];
  int t = 0;ll p = a[0];
  while(p % 2 == 0) { t++; p /= 2; }
  bool flag = false;
  rep(i,1,n) {
    p = a[i];
    int s = 0;
    while(p % 2 == 0) { s++; p /= 2;}
    if (t != s) {
      flag = true;
      break;
    }
  }
  if (flag) {
    cout << 0 << endl;
    return 0;
  }
  int l = 1;
  rep(i,0,n) {
    l = lcm(l,a[i]);
    if (l > 2*m) {
      cout << 0 << endl;
      return 0;
    }
  }
  ll ans = (m + l/2) / l;
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int n,m;
	int p[10000];
	while(cin >> n >> m){
		if(n == 0 && m == 0)
			break;
		for(int i=0;i<n;i++){
			cin >> p[i];
		}
		int sum = 0;
		int count = 1;
		sort(p,p+n);
		for(int i=n-1;i>=0;i--){
			if(count%m!=0)
				sum += p[i];
			count++;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
def rotation(string, leng):
	return string[-1] + string[0:leng - 1]

def judge(a, b, leng):
	for _ in range(leng):
		if a == b:
			return 1
		else:
			b = rotation(b, leng)
	return 0

def run():
	A = input()
	B = input()
	leng = len(A)

	if leng == len(B) and judge(A, B, leng):
		print('Yes')

	else:
		print('No')

if __name__ == '__main__':
	run()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(){
  int A, B, K;
  cin >> A >> B >> K;
  priority_queue<int, vector<int>, greater<int>> a;
  for(int i = A; i <= B; i++){
    if(i <= A + K - 1) a.push(i);
    else if(i >= B - K + 1) a.push(i);
  }
  while(a.size()){
    cout << a.top() <<endl;;
    a.pop();
  }
}


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

int main() {
	int N;
	cin >> N;
	int X;
	X = N*25/27;
	int ans1, ans2, ans3;
	ans1 = (X-1)*27/25;
	ans2 = X*27/25;
	ans3 = (X+1)*27/25;
	if (N == ans1) cout << X-1 <<endl;
	else if (N == ans2) cout << X <<endl;
	else if (N == ans3) cout << X+1 << endl;
	else cout << ":(" << endl;
	return 0;
}


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

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1; // Initialize result 
  
    // Update x if it is more than or 
    // equal to p 
    x = x % p;  
  
    while (y > 0) { 
        // If y is odd, multiply x with the result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res-y; 
} 


ll fastpower (ll b , ll p){
    ll k= p%2 ? b : 1 ;
    return p==0 ? 1 : k*(fastpower(b*b,p/2));
}

ll n,k;
ll a[maxn];

int check(ll len){
	ll res=0;
	for(int i=0;i<n;i++)
		res+=(a[i]-1)/len;
	return res<=k;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
	//cin>>t;
	while(t--){
		cin>>n>>k;
		ll l=0,r=1;
		for(int i=0;i<n;i++){
			cin>>a[i];
			r=max(r,a[i]);
		}
		while(r-l>1){
			ll mid=(l+r)/2;
			if(check(mid)) r=mid;
			else l=mid;
		}
		cout<<r;
	}
}

Measured memory_bytes: 5092
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int x = tx - sx, y = ty - sy;
    for (int i = 0; i < x; ++i)
        cout << "R";
    for (int i = 0; i < y; ++i)
        cout << "U";
    cout << "L";
    for (int i = 0; i < y - 1; ++i)
        cout << "D";
    for (int i = 0; i < x - 1; ++i)
        cout << "L";
    cout << "D";
    cout << "L";
    for (int i = 0; i < y + 1; ++i)
        cout << "U";
    for (int i = 0; i < x + 1; ++i)
        cout << "R";
    cout << "D";
    cout << "R";
    for (int i = 0; i < y + 1; ++i)
        cout << "D";
    for (int i = 0; i < x + 1; ++i)
        cout << "L";
    cout << "U";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  char str1[4];
  char str2[] = "ARC";
  int n;
  scanf("%s", str1);
  n = strcmp(str1, str2);
  if(n == 0) {printf("ABC\n");}
  else{printf("ARC\n");}
}

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

int main() {
    int a, b;
    int d;
    int r;
    double f;

    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    printf("%d %d %f\n", d, r, f);
}



Measured memory_bytes: 3228
## ABC087B - Coins
import sys
input = sys.stdin.readline

a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

for i in range(min(a, int(x / 500)) + 1):
    for j in range(min(b, int((x - i * 500) / 100)) + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 > x:
                break
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n;
ll a[1000000];
ll sum;

int main(){
  cin>>n;
  rep(i,3*n)
  cin>>a[i];

  sort(a,a+3*n);
  reverse(a,a+3*n);

  for(int i=1;i<=2*n;i+=2)
    sum+=a[i];

  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 4352
n = int(input())
a = list(map(int, input().split()))
c = 0
max_c = 0
for i in range(n-1):
  if a[i] >= a[i+1]:
    c += 1
    if c > max_c:
      max_c = c
  else:
    c = 0
print(max_c)

Measured memory_bytes: 63856
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
//Get the highest value and key from a map.
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;
  });
}
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;

int main() {
  int a, b;
  cin >> a >> b;

  if (a > 12) {
    cout << b << endl;
  } else if (a < 6) {
    cout << 0 << endl;
  } else {
    cout << b / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var str= input.trim();
var cnt=0;
for(var i=0;i<str.length;i++){
   var a=str.slice(0,i)-0;
   var b=str.slice(i);
   if(b[0]==0)continue;
   b=b-0;
   if(a>b)break;
   if(a%2==0 && b%2==0)cnt++;
   if(a%2==1 && b%2==1)cnt++;
}
console.log(cnt);


Measured memory_bytes: 19472
s = list(input())
ods = []
evs = []
ods = s[0::2]
evs = s[1::2]

cnt = 0
cnt2 = 0
youo = len(ods)        
youe = len(evs)
cnt += ods.count('R')
cnt += ods.count('U')         
cnt += ods.count('D')
  
cnt2 += evs.count('L')
cnt2 += evs.count('U')         
cnt2 += evs.count('D') 

if cnt == youo and cnt2 == youe:
  print('Yes')
else:
  print('No')

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    map<int,int> mp;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)mp[a[i]]++;
    ll ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        int fst=itr->first;
        int scd=itr->second;
        if(fst<scd)ans+=scd-fst;
        else if(fst>scd)ans+=scd;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5120
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( (ll)( 1e9 + 7 ) )


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

	string S;
	cin >> S;

	vector<int> v;
	v.eb( 0 );	//	最初の始点
	reps( i, N - 1 )
	{
		if ( S[i] != S[i - 1] )
		{
			v.eb( i );
		}
	}
	v.eb( N );

	vector<int> max;
	rep( i, v.size() )
	{
		if ( S[v[i]] == '0' )
		{
			if ( i + 2 * K > v.size() - 1 )
			{
				// K回も操作をしなくても残り全部1になる場合
				max.eb( N - v[i] );
				break;
			}
			else
			{
				max.eb( v[i + 2 * K] - v[i] );
			}
		}
		else
		{
			if ( i + 2 * K + 1 > v.size() - 1 )
			{
				max.eb( N - v[i] );
				break;
			}
			else
			{
				max.eb( v[i + 2 * K + 1] - v[i] );
			}
		}
	}

	int result = 1;
	for ( auto &&it : max )
	{
		chmax( result, it );
	}

	cout << result << endl;

	return ( 0 );
}


Measured memory_bytes: 1464
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    nitro
    int n;cin>>n;
    int a=ceil(sqrt(n));
    for(int i=a;~i;--i)
    if(i*i<=n) return cout<<i*i,0;
}

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


def solve(A: "List[int]"):
    if sum(A) >= 22:
        print("bust")
    else:
        print("win")


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [int(next(tokens)) for _ in range(3)]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
N = int(input())
X = []
Y = []
Nex = 1

for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)


L = 0

for i in range(N):
    for j in range(N):
        L += ((X[i] - X[j])**2 + (Y[i] - Y[j])**2)**(0.5)
        
L = L / 2

if N == 2:
    print(L)
else:
    ans = 2*L/N
    print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
using namespace std;

int main() {
	int X, A; cin >> X >> A;
	cout << (X<A ? 0 : 10) << endl;
	return 0;
}


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

int main(void){
	int n;
	float x1,x2,x3;
	float y1,y2,y3;
	float dx,dy;
	float tx,ty,r;
	float a1,b1,c1,a2,b2,c2;
	
	scanf("%d",&n);
	while(n>0){
		n--;
		scanf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3);
		dx=x1;
		dy=y1;
		
		//SÀWðßé
		a1=2*(x2-x1);
		b1=2*(y2-y1);
		a2=2*(x3-x1);
		b2=2*(y3-y1);
		x1*=x1;
		x2*=x2;
		x3*=x3;
		y1*=y1;
		y2*=y2;
		y3*=y3;
		c1=x1-x2+y1-y2;
		c2=x1-x3+y1-y3;
		tx=(b1*c2-b2*c1)/(a1*b2-a2*b1);
		ty=(c1*a2-c2*a1)/(a1*b2-a2*b1);
		
		//¼aðßé
		dx=dx-tx;
		dx*=dx;
		dy=dy-ty;
		dy*=dy;
		r=sqrt(dx+dy);
		
		printf("%.3f %.3f %.3f\n",tx,ty,r);
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
public class  Main{ 
    public static void main(String[] args) { 
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a < b) { 
            System.out.println("a < b");
        } else if (a > b){
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
        sc.close();
    }
}   


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

int32_t main()
{
    
    int t;
    cin >> t;
    if(t%1000)
     cout <<  1000 - t%1000 << "\n";
    else
     cout << 0 << "\n";
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    String t = sc.next();

    for (int i = 0; i < n; i++) {
      System.out.print(s.charAt(i));
      System.out.print(t.charAt(i));
    }
    System.out.println();
  }
}

Measured memory_bytes: 23252
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ll = int64_t; using ld = long double;
 
// -----------------------------------------------------------------------------

const int N = 100;
int x[N];

void solve() {
    int n; cin >> n;
    int sx = 0;
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
        sx += x[i];
    }
    int p = sx / n;
    if (2 * (sx % n) > n) ++p;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int y = x[i] - p;
        ans += y * y;
    }
    cout << ans << '\n';
}


int main() {
    fast_io; cin_exception;
    int t = 1; // cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;





int main()
{

    int n;
    cin >> n;
    int f[16][16] = {};
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)f[i][j] = -1;

    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        for (int j = 0; j < t; j++) {
            int a, b;
            cin >> a >> b;
            a--;
            f[i][a] = b;
        }
    }
    int ans = 0;

    for (int i = 0; i <= 1 << n; i++) {
        int d[16] = {};
        int cnt = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                d[j] = 1; cnt++;
            }
            
        }
        bool F = 1;
        for (int j = 0; j < n; j++) {
            if (!d[j])continue;
            for (int k = 0; k < n; k++) {
                if (f[j][k]==-1)continue;
                if (d[k] != f[j][k])F = 0;
            }

        }
        if (F)ans = max(ans, cnt);

    }
    cout << ans << endl;


   
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int main(void){
    int input;
    scanf("%11d",&input,11);
    int hour = input / 3600;
    int minuite = (input%3600) / 60;
    int second = input %60;

    printf("%d:%d:%d\n",hour,minuite,second);

    return 0;
}


Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll dp[405][405], A[400];
ll cum[401];

int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N + 1) fill(dp[i], dp[i] + N + 1, INF);
    rep(i, N) cin >> A[i];
    rep(i, N) cum[i + 1] += cum[i] + A[i];

    rep(i, N) dp[i][1] = 0;
    // dp[i][a] i番目からa個繋げる最小のコスト
    // i:要素数　j:始点index　k:左半分の個数
    repe(i, 2, N + 1) {
        rep(j, N - i + 1) {
            repe(k, 1, i) {
                chmin(dp[j][i], dp[j][k] + dp[j + k][i - k] + cum[j + i] - cum[j]);
            }
        }
    }

    // rep(i, N + 1) verr(dp[i], N + 1);
    cout << dp[0][N] << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

int dp[1111][1111][2];

int solve(int even, int odd, int edge)
{
	if (even + odd == 1) return 1;
	if (dp[even][odd][edge] >= 0) return dp[even][odd][edge];
	int res = 1;
	if (even >= 2) chmin(res, solve(even - 1, odd, 1 - edge));
	if (odd >= 2) chmin(res, solve(even + 1, odd - 2, edge));
	if (even >= 1 && odd >= 1) chmin(res, solve(even - 1, odd, 1 - edge));
	if (edge == 1) chmin(res, solve(even, odd, 0));
	return dp[even][odd][edge] = 1 - res;
}


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int V;
	cin >> V;
	Graph g(V);
	REP(i, V)REP(j, V)
	{
		char a; cin >> a;
		if (a == 'Y') add_edge(g, i, j, 0);
	}
	vector<bool> vis(V);
	int even = 0, odd = 0, edge = 0;
	REP(i, V)
	{
		if (vis[i]) continue;
		vis[i] = true;
		vi v;
		v.push_back(i);
		queue<int> que;
		que.push(i);
		while (!que.empty())
		{
			int t = que.front();
			que.pop();
			for (auto j : g[t])
			{
				int nx = j.to;
				if (vis[nx]) continue;
				vis[nx] = true;
				v.push_back(nx);
				que.push(nx);
			}
		}
		if (v.size() % 2) odd++;
		else even++;
		int cnt = 0;
		REP(j, v.size())
		{
			cnt += v.size() - g[v[j]].size() - 1;
		}
		cnt /= 2;
		if (cnt % 2) edge++;
		edge %= 2;
	}
	MS(dp, -1);
	int ans = solve(even, odd, edge);
	if (ans) cout << "Taro" << endl;
	else cout << "Hanako" << endl;
	return 0;
}

Measured memory_bytes: 12944
n = int(input())

vl = [int(x) for x in input().split()]

v1 = [v for i,v in enumerate(vl) if i%2 ==0]
v2 = [v for i,v in enumerate(vl) if i%2 ==1]

table1 = {}
table2 = {}

for x in v1:
    table1.setdefault(x,0)
    table1[x] += 1

for x in v2:
    table2.setdefault(x,0)
    table2[x] += 1

v1 = [(k,table1[k]) for k in table1]
v2 = [(k,table2[k]) for k in table2]

v1 = sorted(v1,key= lambda v: v[1],reverse=True)
v2 = sorted(v2,key= lambda v: v[1],reverse=True)

size= int(n/2)
ans=0
if v1[0][0] != v2[0][0]:
    ans += size - v1[0][1]
    ans += size - v2[0][1]
else:
    if len(v1) == 1 and len(v2) == 1:
        print(size)
        exit()
    elif len(v1) == 1 and len(v2) != 1:
        print(size - v2[1][1])
        exit()
    elif len(v1) != 1 and len(v2) == 1:
        print(size - v1[1][1])
        exit()   


    if v1[1][1] == v1[0][1] or v2[1][1] == v2[0][1]:
        ans += size - v1[0][1]
        ans += size - v2[0][1]
    elif v1[1][1] < v2[1][1]:
        ans += size - v1[0][1]
        ans += size - v2[1][1]
    else:
        ans += size - v1[1][1]
        ans += size - v2[0][1]

print(ans)


Measured memory_bytes: 21412
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

S = list(str(input()))
S.reverse()
extra = 0
each_extras = [[] for i in range(S.count("?"))]
cnt = 0
mul = 1
for i in range(len(S)):
    if S[i] == "?":
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * mul % 13)
        cnt += 1
    else:
        extra += int(S[i]) * mul % 13
        extra %= 13

    mul = mul * 10 % 13

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
            dp[i+1][(extras + j)%13] %= mod

# print(dp)
print(dp[-1][5] % mod)

"""
S = list(str(input()))

dp = [[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0] = 1
S.reverse()
mul = 1
for i in range(len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(mul*j+k)%13] += dp[i][k]
                dp[i+1][(mul*j+k)%13] %= mod
    else:
        for k in range(13):
            dp[i+1][(int(S[i])*mul+k)%13] += dp[i][k]
            dp[i+1][(int(S[i])*mul+k)%13] %= mod
    mul *= 10
    mul %= 13

# print(dp)
print(dp[-1][5])
"""


Measured memory_bytes: 119428
// https://atcoder.jp/contests/arc069/tasks/arc069_b
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
const int MAXN = 1e5 + 4;

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    s[n] = s[0], s[n + 1] = s[1];
    bitset<100005> a;
    REP(i, 4) {
        a[0] = i & 1, a[1] = (i >> 1) & 1;
        FOR(j, 2, n + 2) a[j] = (s[j - 1] == 'x') ^ a[j - 1] ^ a[j - 2];
        if (a[0] == a[n] && a[1] == a[n + 1]) {
            REP(j, n) { cout << (a[j] ? "W" : "S"); }
            cout << "\n";
            return 0;
        }
    }
    cout << "-1\n";
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
class UnionFind
{
public:
  int par[100005];
  int depth[100005];
  int nGroup[100005];
 
  UnionFind(int n) {
    init(n);
  }
 
  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }
 
  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }
 
  bool same(int x, int y) {
    return root(x) == root(y);
  }
 
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;
 
    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
int main(){
ll n,m; cin>>n>>m;
ll a = 0, b = n - 2;
ll k;
if(n%2==1){
rep(i,m)cout << i+1 << " " << n - i << endl;}
else{
rep(i,m){
if(a < b ){
cout << i+1 << " " << n - i << endl;
a+=2;
b-=2;}
else{
k = i;
break;}}
repl(i,k,m){
cout << i+1 << " " << n - i - 1 << endl;}
}}


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

using namespace std;

using ll=long long;

int main(){
    ll N,W;
    cin >> N >> W;
    vector<ll> w(N);
    vector<ll> v(N);
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
    }
    ll dp[1000000];
    for(int i=0;i<1000000;i++){
        dp[i]=0;
    }
    for(int i=0;i<N;i++){
        for(int j=W;j>=0;j--){
            dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
        }
    }
    ll ans=0;
    for(int i=0;i<=W;i++){
        ans=max(ans,dp[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repk(i,k,n) for (int i = k; i <= (int)(n); i++)
#define MAX 10000
typedef long long ll;

using namespace std;

int cnt;

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

    for(int i=0; i<s.length();i++){
        if(s[i]==t[i]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 11;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int N;
	scanf("%d", &N);
	return !printf("ABC%d\n", N);
}

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

int main(){
	int N, K;
	cin >> N >> K;
	vector<int> vec (N);
	for(int i = 0;i < N;i++){
		cin >> vec.at(i);
	}
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	int fa = 0;
	for(int i = 0;i < K;i++){
		fa += vec.at(i);
	}
	cout << fa << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
	cin >> N;
	int L, R;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		ans += (R - L + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
S = str(input())

listS = S.split('/')

if int(listS[0]) < 2019:
    print('Heisei')
elif int(listS[0]) == 2019:
    if int(listS[1]) < 5:
        print('Heisei')
    else:
        print('TBD')
else:
    print('TBD')

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

#define MAX_V 1000
int V;
VI G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v) {
  G[u].PB(v);
  G[v].PB(u);
}

bool dfs(int v) {
  used[v] = true;
  REP(i, G[v].size()) {
    int u = G[v][i], w = match[u];
    if(w < 0 || !used[w] && dfs(w)) {
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching() {
  int res = 0;
  memset(match, -1, sizeof(match));
  REP(v, V) {
    if(match[v] < 0) {
      memset(used, 0, sizeof(used));
      if(dfs(v)) res++;
    }
  }
  return res;
}

signed main(void)
{
  int n, m;
  cin >> n >> m;
  REP(i, n) {
    int k;
    cin >> k;
    REP(j, k) {
      int b;
      cin >> b;
      b--;
      add_edge(i, n+b);
      // cout << i << " " << n+b << endl;
    }
  }

  V = n+m;
  // cout << bipartite_matching() << endl;
  if(bipartite_matching() == m) cout << "Bob" << endl;
  else cout << "Alice" << endl;

  return 0;
}

Measured memory_bytes: 5008
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string S;
  cin >> S;

  int cnt = 0;
  REP(i , S.length()) {
    if (S[i] == '1') {
      cnt++;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

//#include <set>
//#include <unordered_map>
//#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

#define max_n 100

int A[3];

int main() {

	rep(i, 3)cin >> A[i];

	if (A[0] + A[1] + A[2] >= 22)cout << "bust" << endl;
	else cout << "win" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int S, h, m, s;
	scanf("%d", &S);
	if (S >= 0 && S <= 86400) {
		h = S / 3600;
		m = (S % 3600) / 60;
		s = (S % 3600) % 60;
		printf("%d:%d:%d\n", h, m, s);
	}
	
	return 0;
}



Measured memory_bytes: 2040
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
using namespace std;


int main(void){
	int N,M,Lm = 0,Rm = 100000;

	cin >>N>>M;
  
  while(M--) {
    int L,R;
    cin >>L>>R;
    Lm = max(Lm,L);
    Rm = min(Rm,R);
  }
  cout<<max(Rm-Lm+1, 0)<<endl;
	return 0;
}


Measured memory_bytes: 256
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLine >>= main'
    where
        main' [n, m] = readContents m >>= main'' n m
        main'' n m kss = readLine >>= print . solve n m kss

solve :: Int -> Int -> [[Int]] -> [Int] -> Int
solve n m kss ps = length $ filter ff cnds
    where
        cnds = replicateM n [0, 1] 
        vs = zip ps $ map (sort . tail) kss

        ff xs = all check vs
            where
                check (p, ss) = (p == ) . count 0 ss $ zip [1..] xs
                count acc (s : ts) ((i, y) : ys)
                    | s == i = count (acc + y) ts ys
                    | otherwise = count acc (s : ts) ys
                count acc _ _ = acc `mod` 2 

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 1020
#include<iostream>

int main(){
  int n;
  std::cin>>n;
  if(n<5)
    std::cout<<0<<std::endl;
  else if(n>=5 && n<500){
    int k = n/5;
    std::cout<<k*5<<std::endl;
  }
  else{
    int k = n/500;
    int res=k*1000;
    int l = n%500;
    res += (l/5)*5;
    std::cout<<res<<std::endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
using namespace std;
inline int read()
{
    int x=0,t=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-') t=-1,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return x*t;
}
int main() {
    int N; cin >> N;
    multiset<int, greater<int> > Targets;
    vector<int> Slimes;
    for (int i = 0; i < 1 << N; i++) {
        int s; cin >> s;
        Targets.insert(s);
    }
    Slimes.push_back(*Targets.begin());
    Targets.erase(Targets.begin());
 
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 1 << i; j++) {
            multiset<int,greater<int> >::iterator x=Targets.upper_bound(Slimes[j]);
            if (x == Targets.end()) {
                puts("No");
                return 0;
            }
            Slimes.push_back(*x);
            Targets.erase(x);
        }
    }
    puts("Yes");
    return 0;
}

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

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

    long count = 0;
    for(int i = 0; i < n; i++)
    {
        char si = s[i];
        char s1, s2;
        if(si == 'R')
        {
            s1 = 'G';
            s2 = 'B';
        }
        else if(si == 'G')
        {
            s1 = 'R';
            s2 = 'B';
        }
        else if(si == 'B')
        {
            s1 = 'R';
            s2 = 'G';
        }

        int s1count = 0;
        int s2count = 0;
        for(int j = i + 1; j < n; j++)
        {
            if(s[j] == s1)
            {
                s1count++;
            }
            else if(s[j] == s2)
            {
                s2count++;
            }
        }
        count += s1count * s2count;
    }

    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            int k = 2 * j - i;
            if(k >= n)
            {
                break;
            }
            if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k])
            {
                count--;
            }
        }
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;



const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,m,d;

int main() {
	cout << fixed << setprecision(18);
	cin>>n;
	for(int i=1;i<=60000;i++){
		if((i*108)/100==n){
			cout<<i;
			return 0;
		}
	}
	cout<<":(";
} 


Measured memory_bytes: 256
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
#include<bits/extc++.h>
using namespace __gnu_pbds;
using oset = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxn = 404, mod = (119<<23)+1, lg = 19;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, ans = 1;
	char c, p; cin >> n >> p;
	while(--n) cin >> c, ans += c!=p,p=c;
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
s = input()
 
if s == 'SUN':
    s = 7
if s == 'MON':
    s = 6
if s == 'TUE':
    s = 5
if s == 'WED':
    s = 4
if s == 'THU':
    s = 3
if s == 'FRI':
    s = 2
if s == 'SAT':
    s = 1
 
print(s)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<long double> vld;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
#define sqr(a) ((a) * (a))
#define len(V) (int)V.size()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define fix(a) fixed << setprecision(a)
#define readv(x) for(auto &_ : (x)) {cin >> _;}
#define printv(x) for(auto &_ : (x)) {cout << _ << ' ';} cout << endl
#define EPS 1e-6
#define MAXN 100047

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n; cin >> n;
	vi a(n); readv(a);
	ll mn = 1e18;
	
	FOR(i, 0, 100){
		ll s = 0;
		for (auto el : a) s += (el - i)*(el - i);
		if (s < mn) mn = s;
	}
	
	cout << mn << endl;
	
	return 0;
}


Measured memory_bytes: 3588
#include <stdio.h>

#define BUF_SIZE 100

int main(void) {
    char station[BUF_SIZE];

    scanf("%s", station);
    int flag_a = 0, flag_b = 0;
    for (int i = 0; i < 3; i++) {
        if (station[i] == 'A') {
            flag_a = 1;
        } else if (station[i] == 'B') {
            flag_b = 1;
        }
    }

    if (flag_a && flag_b) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 128