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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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

int n;
map< int, int > p;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    vi a(n);
    REP(i,n){
        cin>>a[i];
        p[a[i]]++;
    }

    if(p[1]>1){
      if(p[1]==1){
        cout << "1" << endl;
      }else{
        cout << "0" << endl;
      }
      return 0;
    }

    sort(ALL(a));
    a.erase(unique(ALL(a)), a.end());

    //DEBUG_VEC(a);

    int sz = a.size();
    int mx = a[sz-1];
    vector<bool> dp(mx+1, true);
    int ans = 0;
    
    REP(i,sz){
      for(int j=a[i]; j<=mx; j+=a[i]){
        if(j==a[i] && p[a[i]]==1) continue;
        dp[j]=false;
      }
    }

    //DEBUG_VEC(dp);
    for(auto e:p){
      if(e.second>0 && dp[e.first]){
        ans++;
      }
    }

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

Measured memory_bytes: 13552
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int n;
	vector<int> v;

	cin >> n;
	for (int i=0; i < n; i++) {
		int t;
		cin >> t;
		v.push_back(t);
	}

	int p = 0;
	for (int i = 1; i <= v.size() * 2; i++) {
		p = v[p]-1;
		if (p == 1) {
			cout << i << endl;
			break;
		}
	}

	if (p != 1)cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 892
sx, sy, tx, ty = map(int, input().split())

s = ''
dx = tx - sx
dy = ty - sy
for i in range(dx):
    s += 'R'

for i in range(dy):
    s += 'U'

for i in range(dx):
    s += 'L'

for i in range(dy+1):
    s += 'D'

for i in range(dx+1):
    s += 'R'

for i in range(dy+1):
    s += 'U'

s += 'LU'

for i in range(dx+1):
    s += 'L'

for i in range(dy+1):
    s += 'D'

s += 'R'

print(s)


Measured memory_bytes: 3064
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>n;
  s = to_string(n);
  ll ans  = 0;
  if(n/10<1) {
    cout<<n<<endl;
  } else {
    // cout<<pow(10,(s.size()-1))<<endl;
    if(n - pow(10,(s.size()-1))== 0) cout<<10<<endl;
    else {
      rep(i,s.size()) ans+=s[i]-'0';
      cout<<ans<<endl;
    }
  }

}

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


Measured memory_bytes: 512
import math
from decimal import Decimal
from sys import stdin


def get_result(data):
    A, B = data
    return math.floor(A * B)


if __name__ == '__main__':
    data = stdin.readline().rstrip().split(' ')
    data = [int(data[0]), Decimal(data[1])]
    result = get_result(data)
    print(result)


Measured memory_bytes: 9980
#include<iostream>
using namespace std;
#include<string>
#include<algorithm>
#include<unordered_map>
unordered_map<string,long long int>m;
int main(){
  long long int i,j,n,k,l,count=0;
  cin>>n;
  string s;
  //sort(s[0].begin(),s[0].end());
  for(i=0;i<n;i++){
    cin>>s;
    sort(s.begin(),s.end());
    count=count+m[s];
    m[s]++;
  }
 
  /*int count=0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(s[i]==s[j])
        count++;
    }
  }*/
  cout<<count;    
  return 0;
}

Measured memory_bytes: 10660
my $power = [];
my $wall = [];
my ($h, $w) = map { $_ - 0 } split / /, <STDIN>;
for(my $i = 0; $i < 10; $i++) {
    my @pws = map { $_ - 0 } split / /, <STDIN>;
    $power->[$i] = \@pws;
}

for(my $i = 0; $i < 3; $i++) {
    foreach my $from (0 ... 9) {
        foreach my $to (0 ... 9) {
            next if $from == $to;
            foreach my $px (0 ... 9) {
                next if $from == $px;
                if($power->[$from]->[$to] > $power->[$from]->[$px] + $power->[$px]->[$to]) {
                    $power->[$from]->[$to] = $power->[$from]->[$px] + $power->[$px]->[$to];
                }
            }
        }
    }
}

my $total = 0;
for(my $i = 0; $i < $h; $i++) {
    my @line = map { $_ - 0 } split / /, <STDIN>;
    foreach my $num (@line) {
        next if $num < 0 || $num == 1;
        $total += $power->[$num]->[1];
    }
}

print $total;

Measured memory_bytes: 640
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    ll n,m,ans,a,b;
    int i,j;
    ans=0;
    cin>>n>>m;
    priority_queue<ll> q;
    vector<vector<ll> > x(m);
    rep(i,n){
        cin>>a>>b;
        if(a>m){
            continue;
        }else{
        a--;
        x[a].push_back(b);
        }
    }

    rep(i,m){
        if(x[i].size()>0){
            rep(j,x[i].size()){
                q.push(x[i][j]);
            }
        }
        if(!q.empty()){
            ans+=q.top(); 
            q.pop();
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{

    int r, c;
    int row[101], row_max[101];
    for (int i = 0; i < 101; i++)
    {
        row[i] = 0;
        row_max[i] = 0;
    }

    cin >> r >> c;
    for (int i = 0; i < r; i++)
    {
        int tmp = 0;
        for (int j = 0; j < c; j++)
        {
            cin >> row[j];
            tmp += row[j];
        }
        row[c] = tmp;

        for (int j = 0; j <= c; j++)
        {
            cout << row[j];
            if (j != c)
            {
                cout << ' ';
            }
        }
        cout << endl;

        for (int j = 0; j <= c; j++)
        {
            row_max[j] += row[j];
        }
    }

    for (int j = 0; j <= c; j++)
    {
        cout << row_max[j];
        if (j != c)
        {
            cout << ' ';
        }
    }
    cout << endl;
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int dfs(int v, int n, int *visited, int table[n][n]);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);

//main function
int main() {
    int n = iin(), m = iin();
    int lMax = 0, rMin = n, lTmp, rTmp, i;
    REP(i, m) {
        lTmp = iin(), rTmp = iin();
        if (lMax < lTmp) lMax = lTmp;
        if (rMin > rTmp) rMin = rTmp;
        if (lMax > rMin) {
            iout(0);
            return 0;
        }
    }
    iout(rMin - lMax + 1);
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}


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

using namespace std;

int main()
{
    int v;
    int s;
    cin>>v>>s;
    int a[v];
    int o=0;
    for(int u=0;u<v;u++){
        cin>>a[u];
    }
    for(int i=0;i<v;i++){
    if(a[i]>s||a[i]==s){
        o++;
    }
    }
    cout<<o;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int m[200005];
int f(int n){
  if(n==0) return 0;
  if(m[n]>0) return m[n];
  return m[n]=f(n%__builtin_popcount(n))+1;
}
int main() {
  int n; string x;
  cin >> n >> x;
  reverse(x.begin(),x.end());
  int b=0;
  rep(i,n) if(x[i]=='1') ++b;
  vector<int> v0(n),v1(n);
  int d0=1,d1=1;
  ll s0=0,s1=0;
  rep(i,n){
    v0[i]=d0;
    v1[i]=d1;
    d0<<=1;d0%=b+1;
    if(b!=1) d1<<=1, d1%=b-1;
    if(x[i]=='1') s0+=v0[i], s1+=v1[i];
  }
  vector<int> ans(n);
  rep(i,n){
    if(x[i]=='0'){
      ans[i] = f((s0+v0[i])%(b+1))+1;
    }else{
      ans[i] = b==1 ? 0 : f((s1-v1[i])%(b-1))+1;
    }
  }
  reverse(ans.begin(),ans.end());
  rep(i,n) cout << ans[i] << endl;
}

Measured memory_bytes: 6388
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
//int freq[1000000+5];
//vector<int> g[100002];
//bool vis[100002];
//vector<int> clr;
 
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	scanf("%d",&n);
	double sum=0;
	int x[8],y[8];
	for(int i=0;i<n;i++){
		scanf("%d %d",&x[i],&y[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			//printf("%lf\n",sum );
			sum+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
		}
	}
	int fac[9];fac[0]=1;
	for(int i=1;i<=8;i++){
		fac[i]=fac[i-1]*i;
	}
	//printf("%lf\n",sum );
	sum*=2.0;
	sum/=n;
	printf("%lf\n", sum);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <complex>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char moji;
	char a;
	bool f=false;
	cin>>a;

	for(moji ='a';moji<='z';moji++){
		if(a==moji){
			f=true;
		}
	}
	if(f){
		cout<<"a"<<endl;
	}else{
		cout<<"A"<<endl;
	}


	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n;
    ll t;
    cin >> n >> t;
    vector<ll> tt(n);
    vector<ll> tm(n-1);
    for(int i=0;i<n;i++){
        cin >> tt[i];
        if(i!=0)tm[i-1]=tt[i]-tt[i-1];
    }

    ll sum=0;
    for(int i=0;i<tm.size();i++){
        if(tm[i]>t)sum+=t;
        else sum+=tm[i];
    }

    cout << sum+t << endl;

    return 0;
}


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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    vector<int> alphabit(n+1);
    for(int i=0;i<n;i++){
        alphabit[i+1]=alphabit[i]^(1<<(s[i]-'a'));
    }
    
    vector<int> dp(n+1,n);
    dp[0]=0;
    map<int,int> mp;
    mp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<='z'-'a';j++){
            int v=alphabit[i+1]^(1<<j);
            if(mp.count(v)){
                // cerr<<i<<" "<<char(j+'a')<<" "<<mp[v]<<endl;
                dp[i+1]=min(dp[i+1],dp[mp[v]]+1);
            }
        }
        if(mp.count(alphabit[i+1])){
            // cerr<<"#"<<endl;
            dp[i+1]=min(dp[i+1],dp[mp[alphabit[i+1]]]);
        }
        // cerr<<"$"<<dp[i+1]<<endl;
        mp[alphabit[i+1]]=i+1;
    }
    cout<<max(dp[n],1)<<endl;
    return 0;
}

Measured memory_bytes: 11396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
	
		int count = 0;
		for(int i = 0; i < n.length(); i++) {
			count += Character.getNumericValue(n.charAt(i));
		}
		
		if(count % 9 == 0) System.out.println("Yes");
		else System.out.println("No");
		
	}

}


Measured memory_bytes: 39840
import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

n, k = map(int, input().split())
mod = 10**9 + 7
red = n - k

for i in range(k):
    if red - i < 0:
        print(0)
        continue
    bluemod = k - (i + 1)
    if i == 0:
        bluemod = 0
    ans = comb(2 + i, red - i, mod)*comb(i + 1, bluemod, mod)
    print(ans%mod)

Measured memory_bytes: 9308
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,T,*t=map(int,open(0).read().split());print(T+sum(min(j-i,T)for i,j in zip(t,t[1:])))\n"
"\"";
  system(s);
  return 0;
}            

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

// Caution: 1-indexed
struct BIT {
    vector<ll> bit;
    int N;

    BIT(int N) : bit(vector<ll>(N + 1, 0)), N(N) {}

    // return sum in [0, `i`] in log(n)
    ll sum(int i) {
        if (!i) return 0;
        return bit[i] + sum(i - (i & -i));
    }

    // add `x` at `i`
    void add(int i, ll x) {
        if (i > N) return;
        bit[i] += x;
        add(i + (i & -i), x);
    }
};

const int maxn = 2e5;
ll b[maxn + 1], c[maxn + 1];

int main() {
    int n, k;
    cin >> n >> k;
    rep(i, n) {
        int a;
        cin >> a;
        b[i + 1] = b[i] + a - k;
        c[i + 1] = b[i + 1];
    }

    // 座標圧縮
    sort(c, c + n + 1);
    for (int i = 0; i <= n; i++) {  //b[i] <- index of b[i] in c
        int inf = 0, sup = n + 1;
        while (sup - inf > 1) {
            int mid = (inf + sup) / 2;
            if (c[mid] <= b[i])
                inf = mid;
            else
                sup = mid;
        }
        b[i] = sup;
    }

    BIT fwt(n + 10);
    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ans += fwt.sum(b[i] + 1);
        fwt.add(b[i] + 1, 1);
    }
    cout << ans << endl;
}

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

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

int main() {
    ll a, b; cin >> a;
    string bb; cin >> bb;
    b = (bb[0]-'0') * 100 + (bb[2]-'0') * 10 + (bb[3]-'0');
    a *= b;
    cout << a / 100 << endl;
    return 0;
}


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

int main() {
    string W, s;
    int count = 0;
    cin >> W;
    for (int i = 0; i < W.size(); i++) {
        if (W.at(i) >= 'A') {
            W.at(i) = tolower(W.at(i));
        }
    }
    
    while (1) {
        cin >> s;
        if (s == "END_OF_TEXT") break;
        for (int i = 0; i < s.size(); i++) {
            if (s.at(i) >= 'A') {
                s.at(i) = tolower(s.at(i));
            }
        }
        
        if (s == W) count++;
    }
    
    cout << count << endl;
}


Measured memory_bytes: 3204
//Created by Amaxul on 9/13/2020.

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

import static java.lang.Math.max;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        long a = in.nextInt(), b = in.nextInt();
        long c = in.nextInt(), d = in.nextInt();

        long max = getMin(a, b, c, d);
        pw.println(max);

        pw.close();
    }

    static long getMin(long a, long b, long c, long d) {
        long max = a * c;
        max = max(max, a * d);
        max = max(max, b * c);
        max = max(max, b * d);
        if ((a <= 0 && b >= 0) || (c <= 0 && d >= 0)) {
            max = max(max, 0);
        }
        return max;
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

Measured memory_bytes: 35956
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop pop_back()
#define sz size()
using namespace std;
typedef long long ll;
bool isPrime(ll n)
{
    if(n==1)
        return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
        return false;
    return true;
}
unordered_map<ll,ll>mapp;
ll ma=-999,mix=100000000000,my=-999999999999999999,miy=100000000000;
///////////////////////////////////////////
ll cnt=0,n,m,x,y,i,j,k,l,r,d,s,t,in=-1,sum,in1=0;
ll a[1000100],b[10];
int main(){
    ios_base::sync_with_stdio(0);
    for(i=1;i<=3;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    if(b[5]==2 && b[7]==1){
        cout<<"YES";
        return 0;
    }
    cout<<"NO";
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, X, Y, Z);
  print((X - Z) / (Y + Z));
}


Measured memory_bytes: 256
#include <stdio.h>

int arr[200005] = {0};
int main()
{
    int n = 0 , tmp = 0;
    scanf("%d", &n);
    for (int i = 0; i < n - 1; ++i)
    {
        scanf("%d", &tmp);
        ++arr[tmp-1];
    }
    for (int i = 0; i < n; ++i)
    {
        printf("%d", arr[i]);
        if (i != n - 1)
        {
            printf(" ");
        }
    }
    printf("\n");
}

Measured memory_bytes: 4000
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();
    int c = sc.nextInt();
    int k = sc.nextInt();

    int sum = 0;
    for (int i = 0; i < k; i++) {
      if (a != 0) {
        sum += 1;
        a--;
      } else if (b != 0) {
        sum += 0;
        b--;
      } else if (c != 0) {
        sum += -1;
        c--;
      }
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 36180
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int ctoi(const char c)
{
    if ('0' <= c && c <= '9')
        return (c - '0');
    return -1;
}

int main(){
    vector<int> len(3);
    REP(i,3){
        cin >> len[i];
    }

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

    cout << len[0]*len[1]/2 << endl;
    

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<double> V;
typedef greater<double> G;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  double v[n];
  REP(i, n) cin >> v[i];
  priority_queue<double, V, G> que;
  REP(i, n) que.push(v[i]);
  while (1 < que.size()) {
    double tmp1 = que.top();
    que.pop();
    double tmp2 = que.top();
    que.pop();
    que.push((tmp1 + tmp2) / 2.0);
  }
  double ans = que.top();
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7

s = input()
n = len(s)

dp = [[0]* 13 for i in range(n+1)]
dp[0][0] = 1

for i in range(n):
    if s[i] != '?':
        for j in range(13):
            a = s[i]
            a = int(a)
            keta = (j*10 + a) % 13
            dp[i+1][keta] += dp[i][j]
            dp[i+1][keta] %= MOD
    else:
        for j in range(13):
            for k in range(10):
                keta = (j*10 + k) % 13
                dp[i+1][keta] += dp[i][j]
                dp[i+1][keta] %= MOD
                
print(dp[n][5] % MOD)

Measured memory_bytes: 61916
from sys import stdin

n, k, q = [int(x) for x in stdin.readline().rstrip().split()]

points = [0 for _ in range(n)]

a = [int(x) for x in stdin.readlines()]

for i in a:
    points[i-1] += 1

for i in points:
    if i <= q - k:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 14112
#include <bits/stdc++.h>
using namespace std;
int n,i,k,x;
deque<double> d;
double s,maxx;
int main(){
 cin>>n>>k;
 for(i=1;i<=n;i++){
    cin>>x;
    double r=1.0*x*(x+1)/2.0/x;
    s+=r;

    d.push_back(r);
    if(d.size()>k){
        s-=d.front();
        d.pop_front();
    }
        maxx=max(s,maxx);
}
cout<<setprecision(11)<<fixed<<maxx;
}


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

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

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

// ---
// union_find_tree

const int kMaxN = 100000;

int par[kMaxN];
int treerank[kMaxN];

void Init(int n) {
  REP(i, n) {
    par[i] = i;
    treerank[i] = 0;
  }
}

int Find(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = Find(par[x]);
  }
}

void Unite(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x == y) { return; }
  if (treerank[x] < treerank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (treerank[x] == treerank[y]) { ++treerank[x]; }
  }
  return;
}

bool Same(int x, int y) { return Find(x) == Find(y); }

// union_find_tree
// ---

const int kMaxM = 100000;

int N, M, p[kMaxN], x[kMaxM], y[kMaxM];
int ans = 0;

signed main() {
  cin >> N >> M;
  REP(i, N) { cin >> p[i]; }
  REP(i, M) { cin >> x[i] >> y[i]; }

  Init(N);
  REP(i, M) {
    Unite(x[i]-1, y[i]-1);
  }

  REP(i, N) {
    if (Same(i, p[i]-1)) {
      // cout << Find(i) << " " << Find(p[i]-1) << endl;
      ++ans;
    }
  }

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


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

#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define repi(i,a,b) for(int i=a; i<=b; i++) 
#define repd(i,a,b) for(int i=a; i>=b; i--)

const int INF = ~(1<<31);
typedef long long int ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N;
	cin>>N;
	if(N<=9){
		cout<<N;
	}
	else if(N>=10 and N<= 99){
		cout<<9;
	}
	else if(N>=100 and N<=999){
		cout<<9+(N-100+1);
	}
	else if(N>= 1000 and N<= 9999){
		cout<<909;
	}
	else if(N>= 10000 and N<= 99999){
		cout<<909+(N-10000+1);
	}
	else{
		cout<<90909;
	}
	return 0;
}

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

AB = [[i for i in input().split()] for _ in range(n)]
for i in range(n):
    AB[i][1] = int(AB[i][1])
X = input()
flag = False
ans = 0
for i in range(n):
    if flag:
        ans += AB[i][1]
    if AB[i][0] == X:
        flag=True
print(ans)

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

//参照を用いずここで定義
string S;
string res;

//'+'の数, 出力(文字列), 合計(数値)
void dfs(int i, string ans, int n){
    //ベースケース
    if (i == 3) {
        if(n == 7) res = ans;
    }
    //再帰ステップ
    else{
        dfs(i+1, ans + "+" + S[i+1], n+(S[i+1]-'0'));
        dfs(i+1, ans + "-" + S[i+1], n-(S[i+1]-'0'));
    }
    
}



int main()
{
    
    cin >> S;
    
    res = S[0];
    
    dfs(0, res, S[0]-'0');
    
    cout << res + "=7" << endl;
    
    return 0;
}



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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a - b), a * b) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


    int n;
    cin >> n;

    vector<int> v(n);

    int sum = 0;
    int ans = 1000000000000000;

    for(int i = 0; i < n; i++)
    {
      cin >> v[i];
      sum += v[i];
    }

    int presum = 0;

    for(int i = 0; i < n; i++)
    {
      presum += v[i];
     // trace2(presum,sum-presum);
      ans = min(ans,abs(presum-(sum-presum)));
    }

    cout << ans;






    return 0; 
}


Measured memory_bytes: 4732
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  const int N = 200005;


const int INF = (1LL << 30) - 1;
const int MOD = 1000000007;
int32_t main()
{


    IOS

    
    int n,m;

    cin >> n >> m;

    vector<int> dp((1<<n));


    vector<int> cost(m);

    // dp[mask] denotes the minimum cost to open 
    //  the treasure box represented by set bits
    //

    vector<set<int>> b;


    for(int i = 0; i< m; i++)
    {
        cin >> cost[i];

        int x;
        cin >> x;

        set<int> v;

        for(int i = 1; i <= x; i++)
        {   
            int y;
            cin >> y;
            v.insert(y);
        }
        b.push_back(v);
    }


    for(int i = 0; i < (1<<n); i++)
    {
        dp[i] = INF;
    }

    dp[0] = 0;


    for(int i = 0; i < b.size(); i++)
    {
        for(int mask = 0; mask < (1<<n); mask++)
        {
            int target = mask;
            for(auto j : b[i])
            {
                target |= (1<<(j-1));
                dp[target] = min(dp[target],dp[mask] + cost[i]);
            }
        }
    }




    cout << ((dp[(1<<n)-1] == INF)?-1 : dp[((1<<n)-1)]) << endl;


    
    return 0;
}



Measured memory_bytes: 896
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.math.*;

public class Main {

    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        
       List<Integer> list1 = new ArrayList<>();
       List<String>  list2 = new ArrayList<String>();
       List<Integer> list3 = new ArrayList<>();
       
       int count = 0;
       
      while(true){
         
          list1.add(sc.nextInt());
          list2.add(sc.next()); 
          list3.add(sc.nextInt());
          
          if("?".equals(list2.get(count))){
             break;
          }
          
          count++;
          
      }
        
       for(int i=0; i<list1.size(); i++){
           if("+".equals(list2.get(i))){
               System.out.println(list1.get(i)+list3.get(i));
           }else if("-".equals(list2.get(i))){
               System.out.println(list1.get(i)-list3.get(i));
           }else if("*".equals(list2.get(i))){
               System.out.println(list1.get(i)*list3.get(i));
           }else if("/".equals(list2.get(i))){
               System.out.println(list1.get(i)/list3.get(i));
           }else{
               break;
           }
           
       }
    }
}


Measured memory_bytes: 26288
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N,M;
int A[1<<17],B[1<<17];
bool used[2<<17];
int take[1<<17],rgt[1<<17];
int cumsum[1<<17];
pair<int,int>AB[1<<17];
vector<pair<int,int> >E[1<<17];
vector<pair<int,int> >calc;
main()
{
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>AB[i].first>>AB[i].second;
	sort(AB,AB+N);
	for(int i=0;i<N;i++)
	{
		A[i]=AB[i].first;
		B[i]=AB[i].second;
	}
	for(int i=0;i<M;i++)
	{
		int L,R;cin>>L>>R;
		L=lower_bound(A,A+N,L)-A;
		R=upper_bound(A,A+N,R)-A;
		if(L<R)E[L].push_back(make_pair(R,i));
	}
	for(int i=0;i<N;i++)
	{
		sort(E[i].begin(),E[i].end());
		if(!E[i].empty())
		{
			take[i]=E[i][0].second;
			rgt[i]=E[i][0].first;
		}
		else
		{
			take[i]=-1;
		}
		for(int j=(int)E[i].size()-1;j>=1;j--)
		{
			int L=E[i][j-1].first,R=E[i][j].first;
			if(L<R)
			{
				E[L].push_back(make_pair(R,E[i][j].second));
				calc.push_back(make_pair(E[i][j-1].second,E[i][j].second));
			}
		}
	}
	int sum=0;
	for(int i=0;i<N;i++)
	{
		(sum+=B[i]+cumsum[i])%=2;
		if(sum==1)
		{
			if(take[i]<0)
			{
				cout<<-1<<endl;
				return 0;
			}
			used[take[i]]=!used[take[i]];
			sum++;
			cumsum[i]++;
			cumsum[rgt[i]]++;
		}
		(cumsum[i+1]+=cumsum[i])%=2;
	}
	reverse(calc.begin(),calc.end());
	for(pair<int,int>p:calc)used[p.first]^=used[p.second];
	int anscnt=0;
	for(int i=0;i<M;i++)anscnt+=used[i];
	cout<<anscnt<<endl;
	for(int i=0;i<M;i++)
	{
		if(used[i])cout<<i+1<<(!--anscnt?"\n":" ");
	}
}

Measured memory_bytes: 40424
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

void solve(int n, int k, vector<char> &cv) { cv[k-1] = cv[k-1] + 0x20; }

int main(int argc, char const *argv[]) {
  int n, m;

  cin >> n;
  cin >> m;

  int l=0,r=n,lt,rt;
  for (int i = 0; i < m; i++) {
    cin >> lt;
    cin >> rt;
    l = max(l,lt);
    r = min(r,rt);
  }
  cout << max(r-l+1,0);

  

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

vector<pi> g[35];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, gr;
	cin >> n >> gr;
	rep(i, n){
		//for each c do like
		int a, b, c;
		cin >> a >> b >> c;
		g[c].pb(mp(a, b));
	}
	vi cnt1(100005, 0);
	repn(i, 1, gr + 1){
		vi cnt(100005, 0);
		rep(j, g[i].size()){
			cnt[g[i][j].fi]++;
			cnt[g[i][j].se + 1]--;
		}
		partial_sum(all(cnt), cnt.begin());
		rep(j, 100005) cnt1[j] += min(1, cnt[j]);
	}
	int ans = 0;
	rep(i, 100005) ans = max(ans, cnt1[i]);
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

# from abc118_B.py

def solve(n, k, a):
    visited = [-1] * n
    tmp = [0]
    t = 0
    idx = 0
    for i in range(n):
        visited[t] = i
        nex = a[t] - 1
        if visited[nex] >= 0:
            s, e = visited[nex], i + 1
            break
        t = nex
        tmp.append(nex)
    #print(tmp, s, e, k)
    if k < len(tmp):
        ret = tmp[k] + 1
    else:
        k -= s
        k %= (e - s)
        #print(k)
        ret = tmp[s + k] + 1
    print(ret)
    return

def main():
    n, k = map(int, input().split())
    a = (list(map(int, input().split())))
    solve(n, k, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 94936
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}


int main() {

    rep(i, 3) {
        int h1, m1, s1, h2, m2, s2;
        cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2;
        if (s1 > s2) {
            --m2;
            s2 += 60;
        }
        if (m1 > m2) {
            --h2;
            m2 += 60;
        }
        cout << h2 - h1 << " " << m2 - m1 << " " << s2 - s1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3116
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <deque>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
 
map<int,int> mp;
int main(void){
  int n,x;
  ll res=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x;
    if(mp.find(x)==mp.end()){
      mp[x]=1;
      res++;
    }
    else{
      mp[x]=mp[x]+1;
      if(mp[x]%2==0) res--;
      else res++;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define int long long
using namespace std;
 main(){
  char alpha[27]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int n;
  cin>>n;
  if(n<=26)
    cout<<alpha[n-1];
  else
  {
        string result="";
        while(n>0)
        {
            int r=(n%26);
            
            if(r==0)
            {
                result+='z';
                n=n/26-1;
            }
            else
            {
            result+=(r-1)+'a';
            n=n/26;
            }
        }
       reverse(result.begin(),result.end());
        cout<<result;
  }
}

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

#include <bits/stdc++.h>

using namespace std;

class arc093_d {
public:
    void solve(istream& in, ostream& out) {
        int a, b;
        in >> a >> b;
        int h = 100, w = h;
        vector<string> grid(h, string(w, '.'));
        for (int i = h / 2; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                grid[i][j] = '#';
            }
        }
        for (int i = 0; i < h / 2; i += 2) {
            for (int j = 0; j < w; j += 2) {
                if (b > 1) {
                    grid[i][j] = '#';
                    --b;
                }
            }
        }
        for (int i = h / 2 + 1; i < h; i += 2) {
            for (int j = 0; j < w; j += 2) {
                if (a > 1) {
                    grid[i][j] = '.';
                    --a;
                }
            }
        }
        out << h << " " << w << "\n";
        for (const string &s : grid) {
            out << s << "\n";
        }
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc093_d solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
const int maxn = 300010;
const int inf = 0x3f3f3f3f;

LL n, a[maxn];
static LL ans1, ans2;
static LL last1, last2;
static int now1, now2;

int main(){
	scanf("%lld", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%lld", &a[i]);
	std::sort(a + 1,a + n + 1);
	ans1 += abs(a[n] - a[1]) + abs(a[n - 1] - a[1]);
	last1 = a[n], last2 = a[n - 1];
	now1 = 2, now2 = n - 3;
	while(now1 <= now2) {
		int tmp1 = abs(a[now1] - last1);
		int tmp2 = abs(a[now1] - last2);
		int tmp3 = abs(a[now2] - last1);
		int tmp4 = abs(a[now2] - last2);
		if(tmp1 > tmp2) {
			if(tmp3 > tmp4) {
				if(tmp1 > tmp3) {
					ans1 += tmp1;
					last1 = a[now1];
					now1++;
					continue;
				} else{
					ans1 += tmp3;
					last1 = a[now2];
					now2--;
					continue;
				}
			} else{
				if(tmp1 > tmp4) {
					ans1 += tmp1;
					last1 = a[now1];
					now1++;
					continue;
				} else{
					ans1 += tmp4;
					last2 = a[now2];
					now2--;
					continue;
				}
			}
		} else{
			if(tmp3 > tmp4) {
				if(tmp2 > tmp3) {
					ans1 += tmp2;
					last2 = a[now1];
					now1++;
					continue;
				} else{
					ans1 += tmp3;
					last1 = a[now2];
					now2--;
					continue;
				}
			} else{
				if(tmp2 > tmp4) {
					ans1 += tmp2;
					last2 = a[now1];
					now1++;
					continue;
				} else{
					ans1 += tmp4;
					last2 = a[now2];
					now2--;
					continue;
				}
			}
		}
	}
	ans2 += abs(a[n] - a[1]) + abs(a[n] - a[2]);
	last1 = a[1], last2 = a[2];
	now1 = 3, now2 = n - 1;
		while(now1 <= now2) {
		int tmp1 = abs(a[now1] - last1);
		int tmp2 = abs(a[now1] - last2);
		int tmp3 = abs(a[now2] - last1);
		int tmp4 = abs(a[now2] - last2);
		if(tmp1 > tmp2) {
			if(tmp3 > tmp4) {
				if(tmp1 > tmp3) {
					ans2 += tmp1;
					last1 = a[now1];
					now1++;
					continue;
				} else{
					ans2 += tmp3;
					last1 = a[now2];
					now2--;
					continue;
				}
			} else{
				if(tmp1 > tmp4) {
					ans2 += tmp1;
					last1 = a[now1];
					now1++;
					continue;
				} else{
					ans2 += tmp4;
					last2 = a[now2];
					now2--;
					continue;
				}
			}
		} else{
			if(tmp3 > tmp4) {
				if(tmp2 > tmp3) {
					ans2 += tmp2;
					last2 = a[now1];
					now1++;
					continue;
				} else{
					ans2 += tmp3;
					last1 = a[now2];
					now2--;
					continue;
				}
			} else{
				if(tmp2 > tmp4) {
					ans2 += tmp2;
					last2 = a[now1];
					now1++;
					continue;
				} else{
					ans2 += tmp4;
					last2 = a[now2];
					now2--;
					continue;
				}
			}
		}
	}
	printf("%lld\n", std::max(ans1, ans2));
	return 0;
} 

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

using namespace std;

int main() {
    int n;
    cin >> n;
    
    if(n & 1)
    {
        cout << 0 << '\n';
        return 0;
    }
    
    vector <int> a(n);
    for(int & x : a)
        cin >> x;
    sort(a.begin(), a.end());
    
    if(a[n / 2] == a[n / 2 - 1])
        cout << 0 << '\n';
    else
        cout << a[n / 2] - a[n / 2 - 1] << '\n';
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,x,y;
ll d[2*MAX];
int main(){FAST;
cin>>n>>x>>y;
for(ll i=1;i<=n;++i){
  for(ll j=i+1;j<=n;++j){
    if(i<x and j>y){
      d[j-y+x-i+1]++;
    }
    else if(i<x and j<x){
      d[j-i]++;
    }
    else if(i<x and j>=x){
      d[min(j-i,x-i+1+y-j)]++;
    }
    else if(i>=x and i<=y and j<=y){
      d[min(j-i,i-x+1+y-j)]++;
    }
    else if(i>=x and i<=y and j>y){
      d[min(j-i,i-x+1+j-y)]++;
    }
    else if(i>y){
      d[j-i]++;
    }
  }
}
for(ll i=1;i<=n-1;++i){
  cout<<d[i]<<'\n';
}
return 0;
}

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

int main() {

    //int x, y, z;
    //scanf("%d%d%d", &x, &y, &z);

    char s[7];
    scanf("%s",s);
    
    if(s[2]==s[3] && s[4]==s[5]){
        printf("Yes");
    }else{
        printf("No");
    }
 


    return 0;

}


Measured memory_bytes: 128