akhauriyash/Code-Regression huggingface dataset:
I = [int(_) for _ in open(0).read().split()]
N, Q = I[:2]
A = I[2:2 + N]
XYZ = I[2 + N:]
X, Y, Z = XYZ[::3], XYZ[1::3], XYZ[2::3]


class BinaryIndexedTree():
    def __init__(self, n):
        """
        constructs binary indexed tree

        Parameters
        ----------
        n : int
            maximum index value
        """
        self.n = n
        self.dat = [0] * (n + 1)

    def sum(self, i):
        """
        returns the sum of [1, i]

        Parameters
        ----------
        i : int
            right end of the interval
        """
        s = 0
        while i:
            s += self.dat[i]
            i -= i & -i
        return s

    def add(self, i, x):
        """
        adds x to i-th element

        Parameters
        ----------
        i : int
            index
        x : int
            additional value
        """
        while i <= self.n:
            self.dat[i] += x
            i += i & -i


BIT = BinaryIndexedTree(500010)
for idx, val in enumerate(A):
    BIT.add(idx + 1, val)
for x, y, z in zip(X, Y, Z):
    if x:
        print(BIT.sum(z) - BIT.sum(y))
    else:
        BIT.add(y + 1, z)


Measured memory_bytes: 293692
def card_count(n):
    card_dict={}
    for i in range(n):
        s = input()
        card_dict.setdefault(s,0)
        card_dict[s]+=1
    return card_dict        

N=int(input())
blue=card_count(N)
M=int(input())
red=card_count(M)
for k,v in blue.items():
    v-=red.get(k,0)
    if v<0:
        v=0
    blue[k]=v
print(max(blue.values()))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using ll = long long;
using ull = unsigned long long;
ull mod = 1e9 + 7;
using namespace std;


int main(){

    int N; cin >> N;
    vector<int> L(N); rep(i, N)cin >> L[i];
    sort(begin(L), end(L));
    int ans = 0;

    for(int i = 0; i < N - 1; ++i){
        for(int j = i + 1; j < N; ++j){
            int sum = L[i] + L[j];
            int l = j + 1;
            int r = lower_bound(begin(L), end(L), sum) - begin(L);
            ans += (r - l);
        }
    }

    cout << ans;

}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
  char a,b;
  scanf("%c %c",&a,&b);
  if(a=='H') printf("%c",b);
  else if(a=='D'){
    if(b=='H') printf("D");
    else if(b=='D') printf("H");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#define llint long long
#define mod 1000000007
using namespace std;

llint n, m;
llint x[100005], y[100005];

llint calc(llint p[], llint N)
{
	llint sum = 0, ret = 0, tmp;
	for(int i = 0; i < N; i++){
		tmp = (i*p[i]) % mod;
		tmp -= sum;
		tmp = (tmp + mod) % mod;
		sum += p[i];
		sum %= mod;
		ret += tmp;
		ret %= mod;
	}
	return ret;
}

int main(void)
{
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> x[i];
	for(int i = 0; i < m; i++) cin >> y[i];
	
	for(int i = 1; i < n; i++) x[i] -= x[0];
	for(int i = 1; i < m; i++) y[i] -= y[0];
	x[0] = y[0] = 0;
	
	cout << (calc(x, n) * calc(y, m)) % mod << endl;
	return 0;
}

Measured memory_bytes: 1792
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/04/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  cout << n*n*n << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int n,i,sum=0;
	int a[21];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=1;i<n-1; i++)
	{
		if(a[i]>a[i-1] && a[i]<a[i+1])
			sum=sum+1;
		if(a[i]<a[i-1] && a[i]>a[i+1])
			sum=sum+1;
	} 
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define F(type, i, a, b) for(type i = a; i <= b; i ++)
#define RF(type, i, a, b) for(type i = a; i >= b;i --)
#define sz(a) sizeof(a)
#define deb(a) cerr<<" ["<<#a<<"->"<<a<<"] "
#define next_line cerr<<'\n'
#define all(a) a.begin(), a.end()
#define iter(it, s) for(auto it = s.begin(); it != s.end(); it ++)

using namespace std;

typedef pair<ll,ll> pii;
typedef pair<ll,ll> pll;

ll n, MaxBen = 0LL;
vector<ll> dp(2e5 + 1, -1);
ll Maxval(ll st, vector<ll> &h, vector<ll> &a){
    ll val = a[st], maxIncr = 0LL;
    if(dp[st ] != -1LL)
        return dp[st];
    F(ll, i, 0, st - 1){
        if(h[i] <= h[st]){
            maxIncr = max(maxIncr, Maxval(i, h, a));
        }
    }
    val += maxIncr;
    dp[st] = val;
    MaxBen = max(MaxBen, val);
    return val;
}

ll Query(ll st, ll end, ll node, ll l, ll r, vector<ll> &Tree){
    if(st > end)
        return 0LL;
    if((r < st) || (end < l))
        return 0LL;
    if((l <= st) && (end <= r))
        return Tree[node];
    ll mid = (st + end) >> 1;
    return max( Query(st, mid, (node << 1), l, r, Tree), 
                Query(1LL + mid, end, (node << 1) + 1LL, l, r, Tree)); 
}

void update(ll st, ll end, ll node, ll indx, ll val, vector<ll> &Tree){
    if((indx < st) || (indx > end))
        return;
    if(st == end){
        Tree[node] = val;
        return;
    }
    ll mid = (st + end) >> 1LL;
    update(st, mid, (node << 1), indx, val, Tree);
    update(mid + 1LL, end, (node << 1) + 1LL, indx, val, Tree);
    Tree[node] = max(Tree[(node << 1)],
                     Tree[(node << 1) + 1LL]);
}

void solve()
{
    cin>>n;
    vector<ll> Height(n), Beauty(n), Tree(4LL * n + 1LL, 0LL);
    F(ll, i, 0, n - 1){
        cin>>Height[i];
    }
    F(ll, i, 0, n - 1){
        cin>>Beauty[i];
    }
    // RF(ll, i, n - 1, 0){
    //     Maxval(i, Height, Beauty);
    // }
    //We need to find the maximum value of dp 
    //in heights less than our height
    //For this we need that the heights are in increasing 
    //order ,so that we can query over a range easily and find the
    //maximum of them. For this we can use segment tree .For heights
    //That we don't wanna involve ,we can simply initialize them as 0
    F(ll, st, 0, n - 1){
        ll Maxincr = Query(0, n - 1, 1, 0, Height[st] - 2, Tree);
        dp[st] = Maxincr + Beauty[st];
        update(0, n - 1, 1, Height[st] - 1, dp[st], Tree);
        MaxBen = max(MaxBen, dp[st]);
    }
    cout<<MaxBen<<'\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        //freopen("Debug.txt", "w", stderr);
    #else
    #endif
    solve();
}


Measured memory_bytes: 14292
#include <bits/stdc++.h>
using namespace std;
int main(){
	vector<string> pick = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string s; cin >> s;
	int p = find(pick.begin(), pick.end(), s) - pick.begin();
	int ans = 0;
	do {
		p = (p + 1) % pick.size();
		ans++;
	} while(p);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N,K;
    cin >> N >> K;
    
    vi A(N);
    in(N,A);
    
    int s = 0;
    
    reps(i,K,N){
        if(A[i] > A[s]) cyes;
        else cno;
        
        s++;
    }
    
    
    
    

    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;

int main() {
    int m;
    cin>>m;
    ll k=0,s=0;
    //桁数と桁和
    rep(i,m){
        ll d,c;
        cin>>d>>c;
        k+=c;
        s+=d*c;
    }
    ll ans=k-1+(s-1)/9;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ins insert
#define F first
#define S second
#define var auto
#define mp make_pair
using namespace std;
typedef long long ll;
const int Max = 1e6 + 10;
const int Log = 20;
const int Mod = 1e9 + 7;
const ll INF = 1e18;

int n;

pair<int,int> P[Max];int X[Max];int Y[Max];
int par[Max];
int sz[Max];
int ytoi[Max];

set<int> fen[Max];

void insert(int y)
{
	int x = y;
	while(y <= n)
	{
		fen[y].ins(x);
		y += y & -y;
	}
}
void erase(int y)
{
	int x = y;
	while(y <= n)
	{
		fen[y].erase(x);
		y += y & -y;
	}
}
vector<int> get(int y)
{
	vector<int> res;
	while(y >= 1)
	{
		for(var u : fen[y])
			res.pb(u);

		y -= y & -y;
	}
	return res;
}



int Get(int v)
{
	if(par[v] == v)
		return v;
	return par[v] = Get(par[v]);
}
void Uni(int v , int u)
{
	v = Get(v);
	u = Get(u);
	if(v == u)
		return;
	if(sz[u] < sz[v])
		swap(u , v);
	par[v] = u;
	sz[u] += sz[v];
}



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	for(int i = 0 ; i < n; i++)
	{
		par[i + 1] = i + 1;
		sz[i + 1] = 1;
		int x , y;
		cin >> x >> y;
		X[i + 1] = x;
		Y[i + 1] = y;
		P[i + 1].F = x;
		P[i + 1].S = y;
		ytoi[y] = i + 1;
	}

	sort(P + 1, P + n + 1);

	for(int i = 1; i <= n ; i++)
	{
		int y = P[i].S;
		vector<int> V = get(y);

		int mn = y;
		for(int u : V)
		{
			mn = min(mn , u);
			erase(u);
			Uni(ytoi[u] , ytoi[y]);
		}
		insert(mn);
	}
	
	for(int i = 1; i <= n ; i++)
	{
		int y = Y[i];
		cout << sz[Get(ytoi[y])] << '\n';;
	}
}



Measured memory_bytes: 105468
#include<iostream>
#include<vector>
int main() {
	int n,A=0,N=1;
	std::vector<int> a;
	std::cin >> n;
	if (n == 1) {
		std::cout << "Yes" << std::endl;
	}
	else {
		for (int i = 0; i < 8; i++) {
			if (n > N) {
				a.push_back((n % (N * 10)) / N);
			}
			N *= 10;
		}
		for (int i = 0; i < a.size(); i++) {
			A += a[i];
		}
		if (n%A == 0) {
			std::cout << "Yes" << std::endl;
		}
		else {
			std::cout << "No" << std::endl;
		}
	}
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

map< int , int > mp[nax];
int main()
{
	int n;
	cin >> n;
	int cnt = 0 , cnt2 = 0;
	for(int i = 0 ; i < n ;i++){
		int x;
		cin >> x;
		if(x % 4 == 0)
			cnt++;
		else if(x % 2 == 0)
			cnt2++;
	}
	int rem = n - cnt - cnt2 + cnt2%2;
	if(cnt >= rem - 1)
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
	return 0;
} 




Measured memory_bytes: 93952
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;
const int MAX = 2e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A;
    cin >> A;
    if(A == "SAT")
        cout << 1;
    else if(A == "FRI")
        cout << 2;
    else if(A == "THU")
        cout << 3;
    else if(A == "WED")
        cout << 4;
    else if(A == "TUE")
        cout << 5;
    else if(A == "MON")
        cout << 6;
    else
        cout << 7;
}

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

lis = []
num = {}
for i in xrange(n):
	a,b = map(int,raw_input().split())
	num[a] = b
	lis.append(b)

lis.sort(reverse = True)
list = []
for var in num:
	if lis[0] == num[var]:
		list.append(var)

list.sort()

print list[0],lis[0]

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

int x;

int main(){	
	scanf("%d", &x);
	
	int y = 0;
	for(int i = 1; ; i++){
		y = (y + x) % 360;
		if(y == 0){
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3828
"use strict";

function Main(input) {
  input = input.split("\n");
  const tmp = input[0].split(" ")
  var N = parseInt(tmp[0]);
  var L = parseInt(tmp[1]);
  input.shift();
  var S = input;
  S.sort();
  console.log(S.join(''));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [x,y,w,h]=arr.shift().split(" ").map(Number);
var [xx,yy,ww,hh]=arr.shift().split(" ").map(Number);
var yx=[];
for(var i=0;i<=2000;i++){
   yx[i]=[];
   for(var j=0;j<=2000;j++)yx[i][j]=0;
}
for(var i=y;i<y+h;i++)for(var j=x;j<x+w;j++)yx[i][j]=1;
for(var i=yy;i<yy+hh;i++)for(var j=xx;j<xx+ww;j++){
   if(yx[i][j]==1)yx[i][j]=0;
   else yx[i][j]=1;
}
var cnt=0;
for(var i=0;i<=2000;i++)for(var j=0;j<=2000;j++){
   if(yx[i][j]==1)cnt++;
}
console.log(cnt);


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

struct Problem {

    void Solve() {
        UL N, A[3]; scanf("%d%d%d%d", &N, A, A + 1, A + 2);
        string ans;
        bool Q[100001][3] = {};
        rep(i, N) {
            char c[2];
            scanf(" %c%c", c, c + 1);
            Q[i][c[0] - 'A'] = Q[i][c[1] - 'A'] = true;
        }
        rep(i, N) {
            UL j, k;
            if (!Q[i][0]) { j = 1; k = 2; }
            else if (!Q[i][1]) { j = 0; k = 2; }
            else { j = 0; k = 1; }
            if (A[j] == 0 && A[k] == 0) { cout << "No" << endl; return; }
            else if (A[j] == 0) { ans.push_back('A' + j); A[j]++; A[k]--; }
            else if(A[k] == 0) { ans.push_back('A' + k); A[k]++; A[j]--; }
            else if (A[j] == 1 && A[k] == 1) {
                if(Q[i+1][j]) { ans.push_back('A' + j); A[j]++; A[k]--; }
                else { ans.push_back('A' + k); A[k]++; A[j]--; }
            }
            else if (A[j] < A[k]) { ans.push_back('A' + j); A[j]++; A[k]--; }
            else { ans.push_back('A' + k); A[k]++; A[j]--; }
        }
        cout << "Yes" << endl;
        rep(i, ans.size()) cout << ans[i] << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    p->Solve();
    return 0;
}


Measured memory_bytes: 4136
def ncr(n, r, p):
    # initialize numerator
    # and denominator
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den,
                      p - 2, p)) % p


def power(x, y, p):
    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 result
        if ((y & 1) == 1):
            res = (res * x) % p

            # y must be even now
        y = y >> 1  # y = y/2
        x = (x * x) % p

    return res
p=1000000007
n,a,b=map(int,input().split())
t=pow(2,n,p)-1-ncr(n,a,p)-ncr(n,b,p)
print(t%p)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N;
  cin >> N;
  vector<ll> T(N+2), A(N+2);
  ll ans = 1;
  rep(i, N) cin >> T[i+1];
  rep(i, N) cin >> A[i+1];
  T[0] = 0;    T[N+1] = T[N];
  A[0] = A[1]; A[N+1] = 0;
  REP(i, 1, N+1) {
    if(T[i] != T[i-1] &&
       A[i] != A[i+1] &&
       T[i] != A[i]) {
      ans = 0;
    } else if(T[i] != T[i-1]) {
      if(T[i] > A[i]) ans = 0;
    } else if(A[i] != A[i+1]) {
      if(A[i] > T[i]) ans = 0;
    } else {
      (ans *= min(T[i], A[i])) %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
from collections import deque
from bisect import bisect_left

n=int(input())
d=deque()
for i in range(n):
  a=int(input())
  b=bisect_left(d,a)
  if b==0:
    d.appendleft(a)
  else:
    d[b-1]=a 
print(len(d))


Measured memory_bytes: 12960
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	ll a,b,n,x;
	cin>>a>>b>>n;
	if(n >= b -1)
		x = b-1;
	else
		x = n;
	ll ans = floor((a*1.0*x)/(1.0*b)) - a*1.0*floor((1.0*x)/(1.0*b));
	cout<<ans;
	return 0;
}


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

bool f(int x){
	string s;
	do{
		s.push_back((x % 10) + '0');
		x /= 10;
	}while( x != 0 );
	string t = s;
	reverse(t.begin(), t.end());
	return s == t;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; true ; i++){
		int a = n - i, b = n + i;
		if( 0 <= a && f(a) ){
			cout << a << endl;
			return 0;
		}
		if( f(b) ){
			cout << b << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace kangaroo
{
    class Program
    {
        static void Main(string[] args)
        {
            int S = int.Parse(Console.ReadLine());
            int h = S / 3600;
            int a = S % 3600;
            int m = a / 60;
            int s = a % 60;

            Console.WriteLine(h+":"+m+":"+s);
            Console.ReadLine();
        }
    }
}




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

int x, y, a[505][505];

bool chk(int x, int y) {
    return !a[x][y] && !a[x - 1][y] && !a[x][y - 1] && !a[x - 1][y - 1];
}

int main() {
    scanf("%d%d", &x, &y);
    int n = 99;
    x--;
    if (x) y--;
    rep(i, 2, n) rep(j, 2, n) {
        if (!x) break;
        if (chk(i, j)) a[i][j] = a[i - 1][j] = a[i][j - 1] = 1, x--;
    }
    rep(i, 2, n) rep(j, 2, n) {
        if (!y) break;
        if (chk(i, j)) a[i][j] = 1, y--;
    }
    printf("%d %d\n", n, n);
    rep(i, 1, n) {
        rep(j, 1, n) printf("%c", a[i][j] ? '#' : '.');
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use List::Util qw/max/;

sub normalize {
    my ($n, $r) = @_;
    if ($n - $n / 2 < $r) {
        $n - $r;
    } else {
        $r;
    }
}

my $n = <STDIN>;
my @a = sort {$a <=> $b} (split /\s+/, <STDIN>);
my $max = pop @a;
my $center = $max - $max / 2;
my $cnearest = 0;
for (@a) {
    if (normalize $max, $cnearest < normalize $max, $_) {
        $cnearest = $_;
    }
}
print "$max $cnearest\n";


Measured memory_bytes: 23060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
template <typename T>
inline void w(T x) {
	if (x > 9) w(x / 10);
	putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x, char c) {
	w(x);
	putchar(c);
}
template <typename T>
inline void read(T &x) {
	x = 0;
	T f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}
int a[maxn];
int main(){
	int N, n;
	cin >> N >> n;
	for(int i = 1; i <= n; i++)
		scanf("%d",&a[i]);

	int ans = inf;
	for(int i = 1; i <= n; i++){
		int x;
		if(i == 1)x = min(a[i] + N - a[i + 1], a[n] - a[i]);
		else if(i == n)x = min(a[i] - a[1], N - a[i] + a[i - 1]);
		else x = min(a[i] + N - a[i + 1], N - a[i] + a[i - 1]);
		// cout << x << endl;
		ans = min(ans, x);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 10000000
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, p[50];
signed main() {
	cin >> n;
	int cnt = 0;
	rep(i, n) {
		cin >> p[i];
		if (p[i] != i + 1)cnt++;
	}
	if (cnt <= 2)puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  vector<int> cc, vv;
  for (int i = 1; i <= n; i++) { int t; cin >> t; vv.push_back(t); }
  for (int i = 1; i <= n; i++) { int t; cin >> t; cc.push_back(t); }
  int ans = 0;
  for (int i = 0; i < n; i++) if (vv[i] > cc[i]) ans += vv[i] - cc[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
program sample
    implicit none
  
    integer(8) :: i,j,m,n,a,b,k
    
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) a,b
    k=int(log10(real(b)))+1
    m=a*10**k+b
    if (int(sqrt(real(m)))**2==m)then
       write(*,*) 'Yes'
    else
        write(*,*)'No'
    end if
  
    stop
end program sample
  



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,k,ans1,ans2,row[300001],col[300001],vis[300001];
vector<int> v1,v2,r[300001];
signed main()
{
	scanf("%lld %lld %lld",&n,&m,&k);
	while(k--)
	{
		int x,y;
		scanf("%lld %lld",&x,&y);
		r[x].push_back(y);
		row[x]++;
		col[y]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(row[i]==ans1)
			v1.push_back(i);
		if(row[i]>ans1)
		{
			ans1=row[i];
			v1.clear();
			v1.push_back(i);
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(col[i]==ans2)
			v2.push_back(i);
		if(col[i]>ans2)
		{
			ans2=col[i];
			v2.clear();
			v2.push_back(i);
		}
	}
	for(int i=0;i<v2.size();i++)
		vis[v2[i]]=1;
//	for(int i=1;i<=3;i++)
//		cout<<vis[i]<<" ";
//	cout<<endl;
	int flag=0;
	for(int i=0;i<v1.size();i++)
		for(int l=0;l<r[v1[i]].size();l++)
			if(vis[r[v1[i]][l]]==1)
				flag++;
	int ans=ans1+ans2;
	if(flag==v1.size()*v2.size())
		ans--; 
	cout<<ans;
	return 0;
}

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

int main(){
	
	int a,b;
	string s;
	cin >> a >> b >> s;
	bool postal = true;
	if (s[a] != '-') postal = false;
	for (int i =0; i<a+b+1;i++){
		if ((s[i] == '0' ||
		s[i] == '1' ||
		s[i] == '2' ||
		s[i] == '3' ||
		s[i] == '4' ||
		s[i] == '5' ||
		s[i] == '6' ||
		s[i] == '7' ||
		s[i] == '8' ||
		s[i] == '9') or i==a) continue;
		else postal = false;
		}
	postal ? cout << "Yes" : cout << "No";
}



Measured memory_bytes: 256
fn main() {
    // loop{ //For test
        solve();
    // }
}

#[allow(dead_code)]
fn solve(){
    let mut u: String = read();

    for i in 0..u.len() {
        print!("x");
    }
}

fn is_even(arr: &Vec<i32>) -> bool {
    return arr.iter().all(|x| x%2==0);
}

/// 標準入力から一行を読み取り、指定の型に変換する関数
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    let _ = std::io::stdin().read_line(&mut s);
    s.trim().parse().ok().unwrap()
}

/// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

/// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


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

int mod=998244353;

int main(){
    int n; 
    cin>>n;
    vector<int> c(100000,0);
    for(int i=0;i<n;i++){
        int d;
        cin>>d;
        if(i==0){
            if(d!=0){
                cout<<0<<endl;
                return 0;
            }
        }
        c[d]++;
    }

    long long ans=0;
    if(c[0]==1) ans=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=c[i];j++){
            ans*=c[i-1];
            ans%=mod;
        }
    }
    cout<<ans<<endl;
}

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

def main():
    n = int(input())
    x = list(map(int, input().split()))
    ans = [0] * n
    x_sort = sorted(x)
    a = x_sort[1:n]
    a_med = a[n // 2 - 1]
    b = x_sort[0:n - 1]
    b_med = b[n // 2 - 1]
    for i in range(n):
        if x[i] < a_med:
            ans[i] = a_med
        else:
            ans[i] = b_med

    print(*ans, sep='\n')


if __name__ == "__main__":
    main()


Measured memory_bytes: 30788
c = []
for _ in range(3):
    c.append([int(i) for i in input().split()])

def validate(a, b, c):
    for i in range(3):
        for j in range(3):
            if c[i][j] != a[i] + b[j]:
                return False
    return True

found = False
min_b1 = min(c[0][0], c[1][0], c[2][0])
for b1 in range(min_b1 + 1):
    a = [c[0][0] - b1, c[1][0] - b1, c[2][0] - b1]
    b2s = [c[0][1] - a[0], c[1][1] - a[1], c[2][1] - a[2]]
    if b2s[0] != b2s[1] or b2s[0] != b2s[2]:
        continue
    b3s = [c[0][2] - a[0], c[1][2] - a[1], c[2][2] - a[2]]
    if b3s[0] != b3s[1] or b3s[0] != b3s[2]:
        continue
    b = [b1, b2s[0], b3s[0]]
    if not validate(a, b, c):
        continue
    found = True
    break

print("Yes" if found else "No")

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
//#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int tenCq(int q) {
	int ret=1;
	for (int i = 0; i < q; i++){
		ret*=(10-i);
		ret %= oku7;
	}
	for (int i = 1; i <= q;i++) {
		ret /= i;
	}
	return ret;
}

int a[10000];
int rui[10000];
map<int, int> mapData;
int bitmap[65];
int bitmapAns[65];
signed main() {
	int N,K, ans = 0, wa = 0;
	vector<int> v;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		wa += a[i];
		rui[i+1] = wa;
	}

	//美しさを全列挙(累積和)
	for (int l = 1; l <= N; l++) {
		for (int r = 1; r <= N; r++) {
			if (l > r) continue;
			mapData[rui[r] - rui[l - 1]]++;
		}
	}

	//立てる最大ビットを決める
	for (auto p : mapData) {
		for (int i = 0; i < 64; i++) {
			if (p.first & 1LL << i) {
				bitmap[i] += p.second;
			}
		}
	}

	int msb=-1;

	for (int i = 63; i >= 0; i--) {
		if (bitmap[i] >= K) {
			msb = i;
			break;
		}
	}

	//最大ビットを立てた時立てられるビットをすべて求める
	ans = 1LL << msb;

	for (int i = msb-1; i >= 0; i--) {
		for (auto p : mapData) {
			//ansのビットが立ってなかったら見ない
			if ((p.first & ans) == ans && p.first & 1LL << i) {
				bitmapAns[i] += p.second;
			}
		}
		if (bitmapAns[i] >= K) {
			ans |= 1LL << i;
		}
	}

	if (msb != -1) {}
	else {
		ans = 0;
	}

	cout << ans << "\n";

	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define NUM_ALPHABET 26
string S;
i64 A[NUM_ALPHABET];

int main() {
  cin >> S;

  REP(i, NUM_ALPHABET) {
    A[i] = 0;
  }

  for(auto it = S.begin(); it != S.end(); it++) {
    A[*it - 'A']++;
  }

  i64 cnt = 0;
  REP(i, NUM_ALPHABET) {
    if (A[i] == 2) cnt++;
  }

  if (cnt == 2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		double a = sc.nextDouble(), b = sc.nextDouble(), h = sc.nextDouble(), m = sc.nextDouble();
		double ap = 30*h + 0.5*m;
		double bp = 6*m;
		double rad = Math.abs(ap-6*m);
		if(rad>180) {
			rad = 360 - rad;
		}
		double c2 = Math.pow(a,2)+Math.pow(b, 2)-2*a*b*Math.cos(Math.toRadians(rad));
		System.out.println(Math.sqrt(c2));
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 33376
#include <bits/stdc++.h>
using namespace std;;
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin >> s;
  bool ok = true;
  if(s.size()%2==0){
    rep(i,s.size()/2){
      if(s[2*i]!='h'|| s[2*i+1]!='i')ok = false;
    }
  }else{
    ok = false;
  }
  if(ok){
    cout <<"Yes" << endl;
  }else{
    cout <<"No" <<endl;
  }
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long a, b, c, d;

//divCeil
long divCeil(long a, long b){
    return (a-1)/b+1;
}

int main(){
    scanf("%ld%ld%ld%ld", &a, &b, &c, &d);
    if(divCeil(c, b) <= divCeil(a, d)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll n;
  cin >> n;

  char c;
  bool y = false;
  REP(i, n) {
    cin >> c;
    if (c == 'Y') {
      y = true;
    }
  }

  cout << (y ? "Four" : "Three") << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
using namespace std;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;

int k;
char s[N];

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>k>>s;

     for(int i=0;i<k && i<strlen(s);++i){
          printf("%c",s[i]);
     }
     if(k<strlen(s)) printf("...");

    return 0;
}

Measured memory_bytes: 3712
ascii_lowercase='abcdefghijklmnopqrstuvwxyz'

s=input()

if(len(s)<26):
    for c in ascii_lowercase:
        if(s.find(c)<0):
            print(s+c)
            break
elif(s==ascii_lowercase[::-1]):
    print(-1)
else:
    for i in range(25):
        if(s[-i-2]<s[-i-1]):
            t=''.join(sorted(s[-i-2:]))
            j=t.find(s[-i-2])+1
            print(s[:-i-2]+t[j])
            break

Measured memory_bytes: 3064
n=int(input())
list=[int(x) for x in input().split()]
count = 0
for i in range(n-2):
	a = min(list[i],list[i+2])
	b = max(list[i],list[i+2])
	if a<list[i+1] and b>list[i+1]:
		count += 1
print(count)

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

    int arr[3];
    for(int i=0; i<3; i++)
        cin>>arr[i];
    sort(arr , arr+3);
    int p=arr[0];
    int j=arr[2]*10+arr[1]+arr[0];
    cout<<j<<endl;

}

Measured memory_bytes: 3624
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
A,B,C=[],[],[]
for i in range(a):
    A.append([p[i],0])
for i in range(b):
    B.append([q[i],1])
for i in range(c):
    C.append([r[i],2])
A=sorted(A,reverse=True)
B=sorted(B,reverse=True)
C=sorted(C,reverse=True)
ABC=A+B+C
AC=A+C
BC=B+C
ABC=sorted(ABC,reverse=True)
AC=sorted(AC,reverse=True)
BC=sorted(BC,reverse=True)
ans=0
numa,numb,numc=0,0,0
for i in  range(x+y): #ABC上位x+yにおけるa,b,cの構成を調べる
    if ABC[i][1]==0:
        numa+=1
    elif ABC[i][1]==1:
        numb+=1
    else:
        numc+=1
    ans+=ABC[i][0]
def delete(ab,over):
    global ans,x,y
    if ab==0: #aが超過
        for i in range(over):
            ans-=A[x+i][0]
    else:
        for i in range(over):
            ans-=B[y+i][0]
def add(ab,over):
    global ans,x,y,numa,numb,numc
    if ab==0: #aが超過
        for i in range(over):
            ans+=BC[numb+numc+i][0]
    else:
        for i in range(over):
            ans+=AC[numa+numc+i][0]
#print(ABC)
if x<numa:
    over=numa-x #本当はaをx個しか選べないのに、aに大きい数字が多いため、aをx+α個選んでしまってる。超過分をb,cで埋め合わせ
    delete(0,over)
    add(0,over)
elif y<numb:
    over=numb-y
    delete(1,over)
    add(1,over)
print(ans)

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

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

	int n, count = 0;
	char c;
	bool P, W, G, Y;
	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> c;
		if (c == 'Y'){
			cout << "Four" << "\n";
			return 0;
		}
	}
	cout << "Three" << "\n";
	return 0;
}

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

int main() {
    string s;
    int N;
    cin >> N >> s;
    int count = 0;
    for (int i = 0; i < N; i++)
    {
       if (s[i] == 'R')
           count++;
       else
           count--;
    }

    if (count > 0)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#define R register
#define rep(i,a,b) for(R int i=a ; i<=b ; ++i)
#define dwn(i,a,b) for(R int i=a ; i>=b ; --i)
#define go(i,u) for(R int i=head[u] ; i ; i=a[i].next)
#define int long long
#define min(a,b) (a<b?a:b)
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=20;

int a[N],n;

int dfs(int l,int r,int x,int y) {
	if(l==r-1) {return a[l]*x+a[r]*y;} 
	int ans=0x3ffffffffffffff;
	rep(i,l+1,r-1) ans=min(ans,dfs(l,i,x,x+y)+dfs(i,r,x+y,y)-a[i]*(x+y));
	return ans; 
}

signed main() {
	n=read();
	rep(i,1,n) a[i]=read();
	printf("%lld",dfs(1,n,1,1));
	return 0;
}

Measured memory_bytes: 128
n = int(input())
s = [int(input()) for _ in range(n)]

ss = sum(s)

def check(l):
	for i in l:
		if i % 10 != 0:
			return False
	return True

if check(s):
	print(0)
else:
	if ss % 10 != 0:
		print(ss)
	else:
		sss = sorted(s)
		for i in sss:
			if i % 10 != 0:
				break
		print(ss - i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

Graph G;
vector<int> ans;
vector<bool> visited;

void dfs(int s) {
  rep(i, G[s].size()) {
    if (visited[G[s][i]]) continue;
    visited[G[s][i]] = true;
    ans[G[s][i]] += ans[s];
    dfs(G[s][i]);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ///////////////////////////////////////
  int n, q;
  cin >> n >> q;
  G.resize(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ans.resize(n);
  visited.resize(n);
  rep(i, n) {
    ans[i] = 0;
    visited[i] = false;
  }
  rep(i, q) {
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  visited[0] = true;
  dfs(0);
  rep(i, n) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 23552
A, B = map(int, input().split())
#print((A + 1) / 0.08)
ans = -1
for i in range(int(B / 0.1), int((A + 1) / 0.08)):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    ans = i
    break
print(ans)

Measured memory_bytes: 3064
import java.util.*;

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

    if(n%2==0){
      System.out.println(n/2);
    } else {
      System.out.println((n+1)/2);
    }
    
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
	int k,t;
	cin >> k >> t;
	vector<int> a(k);
	for(int i = 0; i < t; i++) cin >> a[i];
	sort(a.begin(),a.end(),greater<int>());
	if(k >= 2*a[0]) cout <<  0 << endl;
	else cout << 2*a[0]-k-1 << endl;
	return 0;
}

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


def solve(N: int, M: int):
    print(N * (N-1) // 2 + M * (M-1) // 2)
    return


# 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()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


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

#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define sll set<long long>
#define si set<int>
#define stk stack<int>
#define que queue<int>
#define pb push_back
#define ff first
#define ss second
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

ll power(ll a,ll b){
	if(b==0) return 1;
	if(b&1) return power(a,b/2)*power(a,b/2)*a;
	else return power(a,b/2)*power(a,b/2);
}

int main(){
	int t=1;
	//cin>>t;
	while(t--){
		int n,co=0,c=0;
		cin>>n;
		for(int i=0;i<n;i++){
			int x;
			cin>>x;
			if((x&1)==0){
				co++;
				if(x%3==0||x%5==0)
					c++;
			}
		}
		if(co==c)
			cout<<"APPROVED";
		else
			cout<<"DENIED";
	}
}

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 ;
const int mod=1000000007 ;

void solve(){	

	int n ;
	cin>>n ;

	string s ;
	cin>>s ;

	stack<char> st ;

	for(int i=0;i<n;i++){


		if(st.empty())
			st.push(s[i]) ;
		else{
			char temp=st.top() ;
			if(s[i]==temp){
				continue ;
			}
			else{
				st.push(s[i]) ;
			}
		}
	}

	cout<<st.size() ;
}


int main(){	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

int main(){
  cout << setprecision(9);
  int n; ll h; cin >> n >> h;
  vector<pair<ll, bool>> c;
  rep(i, n) {
    ll a, b; cin >> a >> b;
    c.push_back(make_pair(a, 1));
    c.push_back(make_pair(b, 0));
  }
  sort(all(c));
  reverse(all(c));
  ll cur = 0;
  ll i=0;
  while(h > 0) {
    if(c[i].second) {
      double x = (double) h / (double) c[i].first;
      cur += ceil(x);
      break;
    }
    h -= c[i].first;
    cur++;
    i++;
  }
  cout << cur << endl;
}

Measured memory_bytes: 6512
#pragma warning(disable:4996)
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

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

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int N, M;
	cin >> N >> M;
	vec<int> X(M);
	REP(i, M) {
		cin >> X[i];
	}
	if (M - N <= 0) {
		cout << 0 << endl;
		return 0;
	}
	sort(ALL(X));
	vec<int> Y(M - 1);
	REP(i, M - 1) {
		Y[i] = abs(X[i] - X[i + 1]);
	}
	sort(ALL(Y));
	int sum = 0;
	REP(i, M - N) {
		sum += Y[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024