akhauriyash/Code-Regression huggingface dataset:
def binarySearch(S, key):   
    left = 0
    right = len(S)
    while left < right:
        mid = (left + right) // 2
        if key == S[mid]:
            return True
        elif key < S[mid]:
            right = mid
        elif key > S[mid]:
            left = mid + 1
    return False

def main():             
    n = int(input())
    S = list(map(int, input().split()))
    q = int(input())
    T = list(map(int, input().split()))

    cnt = 0
    for key in T:
        if binarySearch(S,key):
            cnt +=1
    print(cnt)

if __name__ == "__main__":
    main()        


Measured memory_bytes: 16708
a, b, c = map(int, input().split(' '))
k = int(input())

def Base_to_3(X):
    if(int(X/3)):
        return Base_to_3(int(X/3))+str(X%3)
    return str(X%3)

for i in range(3**k):
    comb = Base_to_3(i)
    red = a*(2**comb.count('0'))
    green = b*(2**comb.count('1'))
    blue = c*(2**comb.count('2'))
    if red < green and green < blue:
        print('Yes')
        exit()

print('No')

Measured memory_bytes: 9200
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){


    char word;
    int alpha[26];
    for(int i=0;i<26;i++){
        alpha[i] = 0;
    }

    while((word = getchar()) != EOF){

        if('a' <= word && word <= 'z'){
            alpha[word - 97] ++;
        }else if('A' <= word && word <= 'Z'){
            alpha[word - 65] ++;
        }
    }

    for(int i=0;i<26;i++){
        printf("%c : %d\n",'a'+i,alpha[i]);
    }

    return 0;
}



Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	int X;
	cin >> X;
	int a,b;
	a = (int)(X/500);
	b = (int)((X-a*500)/5);
	cout << 1000*a+ 5*b << endl;
	return 0;
}

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

int main() {
    ll N;
    cin >> N;
    ll ans = -1;
    auto r = sqrt(N);
    for (ll i = 1; i <= r; i++)  {
        if (N%i == 0) {
            ll cand = (i-1) + (N/i - 1);
            if (ans == -1 || ans > cand) ans = cand;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <deque>

using namespace std;

deque<int> q1, q2;
int ans = 0;

void fun(long long n){
	if(n == 1)
		return;
	fun(n >> 1);
	ans++;
	q1.push_front(ans);
	q2.push_front(ans);
	if(n & 1){
		ans++;
		q1.push_front(ans);
		q2.push_back(ans);
	}
	return;
}

int main(){
	long long n;
	scanf("%lld", &n);
	fun(n + 1);
	printf("%d\n", q1.size() + q2.size());
	while(!q1.empty()){
		printf("%d ", q1.front());
		q1.pop_front();
	}
	while(!q2.empty()){
		printf("%d ", q2.front());
		q2.pop_front();
	}
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;

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

  int cnt[11];
  for (int i = 0; i < 11; i++) {
    cnt[i] = 0;
  }

  int j =0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      cnt[j]++;
    } else {
      j++;
    }
  }

  sort(cnt, end(cnt));
  reverse(cnt, end(cnt));

  cout << cnt[0] << endl;
}


Measured memory_bytes: 256
N=int(input())
A=[int(x) for x in input().split()]

n=0
t=0
while 1:
    #すべて偶数かチェック
    for i in range(N):
        if A[i]%2 !=0:
            t=1
    
    if t==1:break

    for i in range(N):
        A[i]=A[i]/2
    n+=1
print(n)


Measured memory_bytes: 3060
n,a,b=map(int,input().split())
chk=0
ans=[]
for i in range(1,n+1):
    chk=i%10
    tmp=10000
    p=i
    for j in range(4):
        chk+=i//tmp
        i%=tmp
        tmp//=10
    if a<=chk<=b: ans.append(p)
    
print(sum(ans))

Measured memory_bytes: 3400
#include <iostream>
using namespace std;
int main(){
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if(r<=x&&W-r>=x&&r<=y&&H-r>=y){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<long long> a(n);
	for(int i = 0; i < n; i++){
        cin >> a.at(i);
    }
	int pm = 0;
    int ans = 1;
	for(int i = 1; i < n; i++){
		int npm;
		if(a[i] > a[i - 1]) npm = 1;
		else if(a[i] == a[i - 1]) npm = 0;
		else npm = -1;
		
        if(pm == -npm && pm != 0){
			ans++;
			pm = 0;
		}
        else if(pm == 0){
			pm = npm;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

for i in range(1, N):
  if A[i] > A[i - 1] * 2:
    ans = 1
  else:
    ans += 1
  A[i] += A[i - 1]

print(ans)

Measured memory_bytes: 84648
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;
int main(int argc, char const *argv[]) {
    string str;
    cin >> str;
    int n;
    cin >> n;
    for(int i=0;i<str.size();i++){
        if(i%n==0){
            cout << str[i];
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a,b,c = map(int,input().split())
        a -= 1
        b -= 1
        G[a].append((b,c))
        G[b].append((a,c))
    
    color = [0] * N
    dist = [-1] * N
    stack = [0]
    dist[0] = 0
    while stack:
        v = stack.pop()
        for e,c in G[v]:
            if dist[e] >= 0:
                continue
            dist[e] = dist[v] + c
            color[e] = dist[e]%2
            stack.append(e)
    print('\n'.join(map(str,color)))
if __name__ == '__main__':
    main()

Measured memory_bytes: 49328
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    int A,B;
    cin >> A >> B;
    if(A > 9 || B > 9){
        cout <<-1<< "\n";
    }else{
        cout <<A*B<< "\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;

int main()
{
    int max_s=100005;
    char S[max_s];
    cin >> S;
    int length=strlen(S);
    char tmp=S[0];
    int ans=0;
    for(int i=0; i<length; i++){
        if(S[i]!=tmp){
            ans++;
            tmp=S[i];
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
const int N = 200000;

char s[N];

int main(){ 
	scanf("%s", s); int ans = 0;
	for(int i = 0; s[i]; ++i) {
		ans = (ans * 10 + s[i] - '0') % 9;
	}
	puts(ans == 0 ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 3848
#include <iostream>
#include <cctype>
#include <cstdio>

using namespace std;

int main() {
    char ch;
    int cnt[26] = {};

    while( cin >> ch ){
        ch = tolower(ch);
        if( isalpha(ch)){
            cnt[ch-'a']++;
        }
    }
    
    for( int i = 0; i < 26; i++ ){
        printf("%c : %d\n", i+'a', cnt[i]);
    }
    return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int P = 1e9 + 7;
int h, w, cnt, s1, s2, f1, f2, k;
char s[2050][2050];
long long quickpow(long long base,long long to)
{
    if(to<=0)return 1;
    if(to==1)return base;
    long long mid=quickpow(base,to>>1);
    if(to&1)return mid*mid%P*base%P;
    else return mid*mid%P;
}
struct Maxtir {
	int a[10][10], n;
	void init(int _n, int x) {n = _n; memset(a, 0, sizeof a); for(int i = 1; i <= n; ++i) a[i][i] = x;}
	Maxtir operator *(const Maxtir &b) const {
		Maxtir c; c.init(n, 0);
		for(int i = 1; i <= n; ++i)
			for(int j = 1; j <= n; ++j)
				for(int k = 1; k <= n; ++k)
					c.a[i][j] = (c.a[i][j] + 1ll * a[i][k] * b.a[k][j] % P) % P;
		return c;
	}
};
int pint(int a, int b) {
	int res = 0;
	for(; b; a = 1ll*a*a%P, b>>=1) if(b&1) res=1ll*res*a%P;
	return res;
}
Maxtir pmax(Maxtir a, int b) {
	Maxtir res; res.init(a.n, 1);
	for(; b; a = a * a, b >>= 1) if(b&1) res = res * a;
	return res;
}
signed main() {
	scanf("%lld%lld%lld", &h, &w, &k);
	for(int i = 1; i <= h; ++i) {
		scanf("%s", s[i]+1);
		for(int j = 1; j <= w; ++j) {
			//while(s[i][j] = getchar(), s[i][j] != '#' && s[i][j] != '.');
			cnt += (s[i][j] == '#');
			s1 += (s[i][j] == '#' && s[i][j-1] == '#');
			s2 += (s[i][j] == '#' && s[i-1][j] == '#');
		}
		f1 += (s[i][1] == '#' && s[i][w] == '#');
	}
	for(int i = 1; i <= w; ++i) f2 += (s[1][i] == '#' && s[h][i] == '#');
	if(f1 && f2) {puts("1"); return 0;}
	if(!f1 && !f2) {printf("%lld\n", quickpow(cnt, k-1)); return 0;}
	if(!f1) swap(f1, f2), swap(s1, s2);
	Maxtir ori; ori.init(2, 0);
	ori.a[1][1]	= cnt; ori.a[2][1] = s1; ori.a[2][2] = f1;
	ori = pmax(ori, k-1);
	printf("%lld\n", (ori.a[1][1] - ori.a[2][1] + P) % P);
} 

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int len;
    string s;
    cin>>len>>s;
    ll cnt1=0,cnt2=0,cnt3=0,sum=0;
    for(int i=0;i<len;i++){//第一个条件 
        if(s[i]=='R') sum+=cnt2*cnt3,cnt1++;
        if(s[i]=='G') sum+=cnt1*cnt3,cnt2++;
        if(s[i]=='B') sum+=cnt1*cnt2,cnt3++;
    }
    for(int i=0;i<len;i++)
    for(int j=i;j<len;j+=2)
    if(s[i]!=s[j]&&s[i]!=s[(i+j)/2]&&s[j]!=s[(i+j)/2]) sum--;//第二个条件 
   printf("%lld\n",sum);
}


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

int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans=0;
    for(int a=0; a<10; a++){
        for(int b=0; b<10; b++){
            for(int c=0; c<10; c++){
                int k=0;
                for(int i=0; i<n; i++){
                    int x = s[i]-'0';
                    if((k==0 & a==x)|(k==1 & b==x)|(k==2 & c==x)) k++;
                    if(k==3){
                        ans++;
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  int x=0;
  int y=N;
  
  while (y>0) {
    x += y%10;
    y = y/10;
  }
  
  if (N%x == 0) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    if(A > B) swap(A, B);
    if(A < B && A < C && C < B) {
        cout << "Yes" << endl;
        return 0;
    } 
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
long long cnt[27];
int main()
{
    long long ans=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
        cnt[s[i]-'a']++;
    for(int i=0;i<s.size();i++)
    {
        for(int j=0;j<26;j++)
        {
            if(j==s[i]-'a') continue;
            ans+=cnt[j];
        }
        cnt[s[i]-'a']--;
    }
    cout<<ans+1ll<<endl;
}


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

x, k, d = [int(i) for i in input().split(' ')]

moves = abs(x) // d

if moves > k:
    print(abs((abs(x) - k*d )))
else:
    rem = abs(x) % d
    if (k - moves) % 2 == 0:
        print(rem)
    else:
        print(d - rem)


Measured memory_bytes: 61924
S = str(input())
T = str(input())
N = len(S)-len(T)+1
M = len(T)
li = []

for i in range(N):
    flag = 0
    for j in range(M):
        if S[i+j]==T[j] or S[i+j] == "?":
            flag += 1
        else:
            break
    if flag == M:
        ans = S[:i]+T+S[i+M:]
        ans = ans.replace('?','a')
        li.append(ans)

if len(li)>0:
    li.sort()
    print(li[0])
else:
    print("UNRESTORABLE")


Measured memory_bytes: 3064
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        for (int i = 1; i <= n; i++) {
            int a = sc.nextInt();
            if (i % 2 == 1 && a % 2 == 1) {
                count++;
            }
        }
        System.out.println(count);
    }
}


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

#define fi first
#define se second

const int N = 180;
const long long mod = 998244353;

using namespace std;

int res[N];

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        int a, b, c;
        cin >> a >> b >> c;
        int res = min(a, c);
        c -= res;
        res += min(c, b + 1) + b;
        cout << res << "\n";
}


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

int main()
{
  int N, K;
  cin >> N >> K;
  int count = 0;
  int h = 0;
  for (int i = 0;i < N; i++) {
    cin >> h;
    if (h >= K) {
      count++;
    }
  }

  cout << count << endl;
}

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

int main()
{
	int e;
	while (cin >> e,e)
	{
		int ans = 1000000;
		for (int z=0; z*z*z<=e; z++)
		for (int y=0; y*y<=e-z*z*z; y++)
		{
			int x = e - y*y -z*z*z;
			ans = min(ans, x+y+z);
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 864
//58
#include<iostream>

using namespace std;

int main(){
  bool cmp[10001]={true,true};
  for(int i=2;i<10001;i++){
    if(!cmp[i]){
      for(int j=2;i*j<10001;j++){
	cmp[i*j]=true;
      }
    }
  }
  for(int n;cin>>n;){
    int ans=0;
    for(int i=1;i<=n;i++){
      ans+=!cmp[i]&&!cmp[n+1-i];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
use proconio::input;

fn main() {
	input!(a: char);
	input!(b: char);

	if a == 'H' {
		if b == 'H' {
			println!("H");
		}
		else {
			println!("D");
		}
	}
	else {
		if b == 'H' {
			println!("D");
		}
		else {
			println!("H");
		}
	}
}



Measured memory_bytes: 2096
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

string s;

bool check() {
    int count = 0;
    for (int i = 2; i < s.length() - 1; i++) {
        if (s[i] == 'C') {
            count++;
        }
    }
    if (count == 1) {
        return true;
    }
    else {
        return false;
    }
}

bool check2() {
    int count = 0;
    for (int i = 0; i < s.length(); i++) {
        if ('A' <= s[i] && s[i] <= 'Z') {
            count++;
        }
    }
    if (count == 2) {
        return true;
    }
    else {
        return false;
    }
}

int main() {
    cin >> s;
    if (s[0] != 'A') {
        cout << "WA" << endl;
    }
    else if (!check()) {
        cout << "WA" << endl;
    }
    else if (!check2()) {
        cout << "WA" << endl;
    }
    else {
        cout << "AC" << endl;
    }
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 40;
const int mod = 1000000007;
//const int mod = 998244353;

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;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};



int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  vector<bool> flag(b, true);
  for(int i = 1;;++i) {
    if(a*i%b == c) {
      cout << "YES" << endl;
      return 0;
    }
    if(flag[a*i%b]) {
      flag[a*i%b] = false;
    }
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#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 pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vector<pii> > vvpii;

#define pb push_back
#define endl '\n'
#define INF (ll)2e18
#define EPS 1e-9
#define gcd __gcd
#define rs resize
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define by(T, x) [](const T& a, const T& b) { return a.x < b.x; } //for struct sorting

void printV(vector<int> v){
	for(int i = 0; i < v.size(); i++){
		cout << v[i] << " " ;
	}
	cout << endl;
}

void print2V(vvi v){
	FOR(i, 0, v.size()){
		FOR(j, 0, v[i].size()){
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
}

ll n, w, dp[200][200000], val[200000], cost[200000];

ll knapsack(int cur, int left){
	if(left < 0){
		return -INF;
	}
	if(cur > n){
		return 0;
	}
	if(dp[cur][left] != -1){
		return dp[cur][left];
	}
	dp[cur][left] = max( knapsack(cur+1, left), knapsack(cur+1, left-cost[cur])+val[cur] );
	return dp[cur][left];
}

int main(){
	cin >> n >> w;
	for(ll i = 1; i <= n+10; i++){
		for(ll j = 0; j < w+10; j++){
			dp[i][j] = -1;
		}
	}
	
	for(ll i = 1; i <= n; i++){
		cin >> cost[i] >> val[i];
	}
	cout << knapsack(1, w);
}

Measured memory_bytes: 172288
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

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

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

signed main(){
	int A,B;
	cin>>A>>B;
	cout<<lcm(A,B)<<endl;
	return 0;
}


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

int main() {
  int N,X,cnt=0;
  cin >> N >> X;
  vector<int> v(N);
  for (int i=0; i<N; i++) {
    cin >> v[i];
    cnt+=v[i];
  }
  sort(v.begin(), v.end());
  cout << N+(X-cnt)/v[0] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
    int n;
    cin >> n;
    string s;
    vector<map<char, int>> m(n);
    FOR(i, n) {
        cin >> s;
        for (char j : s)m[i][j]++;
    }
    map<char, int> c;
    FOR(i, n)for (auto j : m[i])c[j.first] = INF;
    FOR(i, n)for (auto j : c) {
        chmin(c[j.first], m[i][j.first]);
    }
    string ans = "";
    for (auto i : c)FOR(j, i.second)ans += i.first;
    cout << ans << endl;
}

Measured memory_bytes: 256
#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>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する
int N;

int get(int h,int j){
    return N * h + j;
}
void solve(int n,int m,int a){
    N = n;
    vector<int> e(n * 1005 + 5,-1);
    rep(i,0,n){
        rep(j,0,1002){
            e[get(j,i)] = get(j-1,i);
        }
    }
    rep(i,0,m){
        int h,p,q;
        cin >> h >> p >> q;
        p--;
        q--;
        e[get(h,p)] = get(h-1,q);
        e[get(h,q)] = get(h-1,p);
    }
    int cur = get(1001,a-1);
    while(cur >= N){
        cur = e[cur];
    }
    cout << cur + 1 << endl;



}

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

    while(true){
        int n,m,a;
        cin >> n >> m >> a;
        if(n == 0 && m == 0 && a == 0) break;
        solve(n,m,a);

    }


    return 0;
}



Measured memory_bytes: 3488
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>

typedef long double ld;
typedef long long   ll;
using namespace std;
int main (){
    int n,k;
    cin >> n >> k;
    ld p=0.0;
    int m,j;
    for (int i = 1; i <=n; i++){
        m=i;
        j=0;
        while(m<k){
            m*=2;
            j++;
        }
        p+=1.0/pow(2,j);
    }
    cout << setprecision(10) << p/n << "\n";
}

Measured memory_bytes: 256
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        s=0
        for k in range(d):
            s+=(abs(x[i][k]-x[j][k]))**2
        if s**0.5==int(s**0.5):
            cnt+=1
print(cnt)

Measured memory_bytes: 38256
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    x = float(input())
    price = 100.0
    cnt = 0
    while (price < x):
        price *= 1.01
        price = math.floor(price)
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27084
/*
 * @Author: Kaizyn
 * @Date: 2020-08-22 21:16:23
 * @LastEditTime: 2020-08-22 21:19:09
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;

int n, x, t;

inline void solve() {
  cin >> n >> x >> t;
  int y = (n+x-1)/x;
  cout << y*t << endl;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int T = 1;
  // cin >> T;
  for (int t = 1; t <= T; ++t) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#include<math.h>
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

int main()
{
	fastio;
	lli n;
	cin>>n;
	cout<<2*3.14159265358979323846*n;
	return 0;
}


Measured memory_bytes: 3800
#include <stdio.h>
#include <ctype.h>
 
int main(void) {
     
    char c;
    
    int i;
    
    i = 'a'-'A';
     
    for(;;){    
         
        scanf("%c",&c);
        if ('a' <= c && c<= 'z') 
            printf("%c",c-i);
        else if ('A' <= c && c<= 'Z')
            printf("%c",c+i);
        else if (c == '\n') 
            break;
        else
            printf("%c",c);
    }
     
    printf("\n");
    return 0;
}

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

int n, m, x;
vector<int> c(12);
vector<vector<int>> a(12, vector<int>(12));
vector<bool> table(14, false);

const int MX = 1001001001;

int calcPrice(){
	int price = 0;
	for(int i=0; i<n; i++){
		if(table[i]){
			price += c[i];
		}
	}

	for(int i=0; i<m; i++){
		int syujuku = 0;
		for(int j=0; j<n; j++){
			if(table[j]){
				syujuku += a[j][i];
			}
		}

		if(syujuku < x){
			return MX;
		}
	}

	return price;
}

int culc_min(int i){
	int ans = calcPrice();

	if(i < n){
		table[i] = true;
		ans = min(ans, culc_min(i+1));

		table[i] = false;
		ans = min(ans, culc_min(i+1));
	}

	return ans;
}

int main(){
	cin >> n >> m >> x;

	for(int i=0; i<n; i++){
		cin >> c[i];
		for(int j=0; j<m; j++){
			cin >> a[i][j];
		}
	}

	int ans = culc_min(0);
	if(ans == MX){
		ans = -1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
using namespace std;
int a,b,aa,bb;
void go1(int x,int y)
{
    printf("U");
    y++;
    while(x<aa-2)
    {
        printf("R");
        x++;
    }
    while(y!=bb)
    {
        printf("U");
        y++;
    }
    while(x!=aa)
    {
        printf("R");
        x++;
    }
}
void go2(int x,int y)
{
    printf("L");
    x--;
    printf("U");
    y++;
    printf("U");
    y++;
    if(y>bb)
    {
        while(x!=aa)
        {
            printf("R");
            x++;
        }
        printf("D");
        return;
    }
    while(x<aa-3)
    {
        printf("R");
        x++;
    }
    while(y<bb+1)
    {
        printf("U");
        y++;
    }
    while(x<aa)
    {
        printf("R");
        x++;
    }
    printf("D");
}
void back1(int x,int y)
{
    printf("D");
    y--;
    if(aa-a>1)
    {
        printf("L");
        x--;
    }
    while(y!=b)
    {
        printf("D");
        y--;
    }
    while(x!=a)
    {
        printf("L");
        x--;
    }

}
void back2(int x,int y)
{
    printf("R");
    x++;
    printf("D");
    y--;
    printf("D");
    y--;
    if(y<b)
    {
        while(x>a)
        {
            printf("L");
            x--;
        }
        printf("U");
        return;
    }
    if(aa-a>=2)
    {
        printf("L");
        x--;
    }
    while(y!=b-1)
    {
        printf("D");
        y--;
    }
    while(x!=a)
    {
        printf("L");
        x--;
    }
    printf("U");

}
int main()
{
    scanf("%d%d%d%d",&a,&b,&aa,&bb);
    go1(a,b);
    back1(aa,bb);
    go2(a,b);
    back2(aa,bb);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;


//ÂÃ£ÂÃÂÂ©ÂÃÂÂÂÃ°ÂÃÂÂ«ÂÃÂÂ©ÂÃÂÂ½ÂÂÂÃÂÂ´ÂpÂÃ°ÂÃ 
//
//ÂÂ¢ÂÃ«ÂÂ¢ÂÃ«ÂÃ ÂÂ¾ÂÂÂÂ¢ÂÃÂÃÂÂ½ÂÂ¯ÂÃÂÃÂÃªÂÃ ÂÃ­ÂÂ©ÂÃ¨ÂÃÂÂ­ÂÂ©ÂÃÂÂ½ÂÃÂÃÂÃ¢ÂÃÂÃ©
//ÂmÂ[ÂgÂÂ©ÂÃÂÃ±ÂÂ©ÂÃÂÂÂÂ¢ÂÃÂÃ
//ÂÂ¢ÂÃ§ÂÃ±ÂÃÂÂ±ÂÃ¸ÂÂ¢ÂÃ2ÂÃ±ÂÃ¸ÂÂ¢ÂÃÂÂµÂÃÂÃÂÂ½ÂÃÂÂ±ÂÃ°ÂÃÂÂ¦ÂÂ½ÂÂ¾ÂÂ¯


class Main{

    public static void main(String[] args){

	int gyo,retu,n;
	String sc;
	Scanner in = new Scanner(System.in);


	gyo = in.nextInt();
	retu = in.nextInt();
	n = in.nextInt();
	int[][] jm = new int[gyo+1][retu+1];
	int[][] om = new int[gyo+1][retu+1];
	int[][] im = new int[gyo+1][retu+1];
	for(int i=0;i<=gyo;i++){
	    for(int j=0;j<=retu;j++){
		jm[i][j]=0;
		om[i][j]=0;
		im[i][j]=0;
	    }
	}

	//Arrays.fill(jm,0); //memsetÂIÂÃÂÂ¨ÂÂ©memÂÃÂÃÂÃ¡ÂÃÂÃ2ÂÂÂÂ¾ÂÃÂGÂÂÂ[ÂÂ©ÂÃÂÃ§ÂÂ½ÂgÂÂ¦ÂÃÂÂ¢ÂÂ¢ÂÃÂHÂÂ©ÂmÂÃ§ÂÃÂÂ¢ÂÂ©ÂÃ§ÂÂÂÃÂÃÂÂÂ[ÂvÂÃ±ÂÂ·
	//Arrays.fill(om,0);
	//Arrays.fill(im,0);

	for(int i=1;i<=gyo;i++){
	    sc = in.next();
	    for(int j=0;j<retu;j++){
		char cc[] = sc.toCharArray();
		jm[i][j+1]=jm[i-1][j+1]+jm[i][j]-jm[i-1][j];
		om[i][j+1] = om[i-1][j+1]+om[i][j]-om[i-1][j];
		im[i][j+1]=im[i-1][j+1]+im[i][j]-im[i-1][j];
		if(cc[j] == 'J'){
		    jm[i][j+1]++;
		}else if(cc[j] == 'O'){
		    om[i][j+1]++;
		}else if(cc[j] == 'I'){
		    im[i][j+1]++;
		}


	    }
	}

	/*	
		for(int i=0;i<=gyo;i++){
		for(int j=0;j<=retu;j++)System.out.print(jm[i][j] + " ");
		System.out.printf("\n");
		}
	*/
	
	int a,b,c,d;
	for(int i=0;i<n;i++){
	    a = in.nextInt();
	    b = in.nextInt();
	    c = in.nextInt();
	    d = in.nextInt();
	    System.out.print(jm[c][d]-jm[a-1][d]-jm[c][b-1]+jm[a-1][b-1]);
	    System.out.print(" ");
	    System.out.print(om[c][d]-om[a-1][d]-om[c][b-1]+om[a-1][b-1]);
	    System.out.print(" ");
	    System.out.println(im[c][d]-im[a-1][d]-im[c][b-1]+im[a-1][b-1]);

	}
	


    }


}

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

using namespace std;
#define int long long
#define repeat(i, n) for(int i=0;i<(n);i++)

struct SegmentTree{

   static const int N=1<<17;
   static const int Z=0;
   vector<int> seg, lazy;
   SegmentTree(){
      seg.resize(2*N-1, 0);
      lazy.resize(2*N-1, 0);
   }

   void refresh(int i, int l, int r){
      if(lazy[i]){
         seg[i]+=lazy[i]*(r-l);
         if(r-l>1){
            lazy[2*i+1]+=lazy[i];
            lazy[2*i+2]+=lazy[i];
         }
         lazy[i]=0;
      }
   }

   void add(int a, int b, int x, int i=0, int l=0, int r=N){
      refresh(i, l, r);
      if(b<=l or r<=a){
         return;
      }else if(a<=l and r<=b){
         lazy[i]+=x;
         refresh(i, l, r);
      }else{
         int m=(r+l)/2;
         add(a, b, x, 2*i+1, l, m);
         add(a, b, x, 2*i+2, m, r);
         seg[i]=seg[2*i+1]+seg[2*i+2];
      }
   }

   int sum(int a, int b, int i=0, int l=0, int r=N){
      refresh(i, l, r);
      if(b<=l or r<=a){
         return Z;
      }else if(a<=l and r<=b){
         return seg[i];
      }else{
         int m=(r+l)/2;
         int vl=sum(a, b, 2*i+1, l, m);
         int vr=sum(a, b, 2*i+2, m, r);
         return vl+vr;
      }
   }

};

signed main(){

   int N, Q;
   cin>> N>> Q;
   SegmentTree st;
   while(Q--){
      int q; cin>> q;
      if(q==0){
         int s, t, x;
         cin>> s>> t>> x;
         st.add(s-1, t, x);
      }else{
         int s, t;
         cin>> s>> t;
         cout<< st.sum(s-1, t)<< endl;
      }
   }

   return 0;
}

Measured memory_bytes: 7064
#include<bits/stdc++.h>
using namespace std; 
struct ener{
	long long x;
	long long y;
}a[100005];
bool cmp(ener a,ener b)
{
    return a.x<b.x;
}
long long n,m,ans,sum;
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y;
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
    { 
    	if(a[i].y+sum>=m) {ans+=(m-sum)*a[i].x;break;}
    	else ans+=a[i].x*a[i].y,sum+=a[i].y;
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, int> pli;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 1000010;

int main(){
        int h, w, n;
        scanf("%d%d%d", &h, &w, &n);
        int a=max(h, w);
        printf("%d\n", (n-1)/a+1);
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<a+b+c+9*max({a,b,c})<<endl;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	set<int>v;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		v.insert(a[i]);
	}
	if(v.size()!=n)
		cout<<"NO";
	else
		cout<<"YES";

	return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    
    int A,B;
    cin >> A >> B;
    if(A>9|B>9){
        cout << "-1" << endl;
        return 0;
    }
    else{
        cout << A*B << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
 
	char input[10];
	int intput;
	int hours;
	int minutes;
	int seconds;
 
	fgets(input, sizeof(input), stdin);
	intput = atoi(input);
	seconds = intput % 60;
	minutes = (intput / 60) % 60;
	hours = intput / 60 / 60;
	printf("%d:%d:%d\n", hours, minutes, seconds);
 
	return 0;
}

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n, k - q);
    for(int i = 0;i < q;i++){
        int b;
        cin >> b;
        a[b-1]++;
    }
    for(int i = 0;i < n;i++){
        cout << (a[i] > 0 ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<i32>();
    println!("{}",if n==3||n==5||n==7{"YES"}else{"NO"})
}


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

int main(){
	int axx, ayy, n, ax = 0, ay = 0;
	cin >> axx >> ayy >> n;

	for (int i = 0; i < n; ++i) {
		int x, y, a;
		cin >> x >> y >> a;

		if (a == 1) ax = max(ax, x);
		if (a == 2) axx = min(axx, x);
		if (a == 3) ay = max(ay, y);
		if (a == 4) ayy = min(ayy, y);
	}
	cout << ((axx > ax) && (ayy > ay) ? (axx - ax) * (ayy - ay) : 0) << endl;
}


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 int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	map<char, int> cnt;
	cnt['a'] = cnt['b'] = cnt['c'] = 0;
	int mi = 100005, ma = -1;
	rep(i,n){
		cnt[s[i]]++;
	}
	for(auto p : cnt){
		chmin(mi, p.second);
		chmax(ma, p.second);
	}
	if(ma-mi <= 1) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>

int main(){
  int a,b; std::cin >> a >> b;
  int c = [a,b] () -> int { return a*b; }();
  int d = [a,b] () -> int { return 2*(a+b); }();
  std::cout << c << " " << d << std::endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {

	ll N,K;
	cin >> N >> K;
	vector<int> A(N); 
	rep(i,N) {
		cin >> A[i];
		A[i]--;
	}
	vector<int> B(N+10);
	B[0] = 0;
	int cnt=1;
	int s = 0;
	vector<int> v(N,-1);
	v[0] = 0;
	int start;
	while(1) {
		B[cnt] = A[s];
		s = A[s];
		if(v[s] != -1) {
			start = s;
			break;
		}
		v[s] = cnt;
		cnt++;
	}
	/*cout << cnt << " " << start << " " << v[start] << endl;
	rep(i,N) cout << v[i] << " ";
	cout << endl;
	rep(i,N) cout << B[i] << " ";
	cout << endl;*/
	int t = 0;
	if(K < v[start]) {
		rep(i, K) {
			t = A[t];
		}
		cout << t+1 << endl;
		return 0;
	}
	rep(i,v[start]) {
		t = A[t];
	}
	//cout << t << endl;
	ll r = (K-v[start]) % (cnt-v[start]);
	rep(i,r) {
		t = A[t];
	}
	cout << t + 1 << endl;
	//cout << B[(K-v[start])%(cnt-v[start])]+1 << endl;
  return 0;
}


Measured memory_bytes: 5636
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

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

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

// カロリーと位置
ll x[100010], v[100010];

// 初期位置からi番目の寿司を食べるまでに得るカロリー
ll cal_cw[100010]; // 時計回り(clockwise)
ll cal_ccw[100010]; // 反時計回り(counter-clockwise)

// Bの位置を固定したときの最適なAの位置
ll a_ix_oboa[100010],a_ix_oaob[100010];

// 答え
ll ans = 0;

int main() {
	ll N, C;
	cin >> N >> C;

	REP(i, N) {
		cin >> x[i] >> v[i];
	}

	// 時計回り
	REP(i, N) {
		if (i > 0) {
			cal_cw[i] = cal_cw[i - 1] + v[i] - (x[i] - x[i - 1]);
		}
		else {
			cal_cw[0] = v[0] - x[0];
		}
		ans = max(ans, cal_cw[i]);
	}

	// 反時計回り
	for (int i = N - 1; i >= 0; --i) {
		if (i < (N - 1)) {
			cal_ccw[i] = cal_ccw[i + 1] + v[i] - (x[i + 1] - x[i]);
		}
		else {
			cal_ccw[N - 1] = v[N - 1] - (C - x[N - 1]);
		}
		ans = max(ans, cal_ccw[i]);
	}

	//---- Bの位置(b_ix)を固定したときの最適なA:[O,b_ix)の位置(a_ix_best)を求める

	// b_ix = 1のときは強制的に決まる。b_ix = 0のときは定義されない。
	a_ix_oboa[1] = 0;
	a_ix_oaob[1] = 0;

	REPS(b_ix, 2, N) 
	{
		// oboa
		if (cal_cw[b_ix - 1] > cal_cw[a_ix_oboa[b_ix - 1]]) {
			a_ix_oboa[b_ix] = b_ix - 1; // 更新
		}
		else {
			a_ix_oboa[b_ix] = a_ix_oboa[b_ix - 1]; // 引継ぎ
		}
		//cout << a_ix_best[b_ix] << " ";

		// oaob
		if (cal_cw[b_ix - 1] - x[b_ix - 1] > cal_cw[a_ix_oaob[b_ix - 1]] - x[a_ix_oaob[b_ix - 1]]) {
			a_ix_oaob[b_ix] = b_ix - 1; // 更新
		}
		else {
			a_ix_oaob[b_ix] = a_ix_oaob[b_ix - 1]; // 引継ぎ
		}
		//cout << a_ix_best[b_ix] << " ";

	}
	//cout << endl;


	REPS(b_ix, 1, N) {
		ll ans_oaob = 0, ans_oboa = 0;

		//cout << "b_ix: " << b_ix << endl;

		// oboa
		ans_oboa += cal_ccw[b_ix];
		ans_oboa -= (C - x[b_ix]);
		ans_oboa += cal_cw[a_ix_oboa[b_ix]];
		//cout << ans_oboa<<endl;

		// oaob
		ans_oaob += cal_cw[a_ix_oaob[b_ix]];
		ans_oaob -= x[a_ix_oaob[b_ix]];
		ans_oaob += cal_ccw[b_ix]; // O→B
		//cout << ans_oaob << endl;

		ans = max(ans, max(ans_oboa, ans_oaob));
		//cout << ans << endl;
	}
	cout << max((ll)0, ans);
	system("pause");
	return 0;
}

Measured memory_bytes: 5120
R, C, K = map(int, input().split())

I = [[0 for _ in range(C+1)] for _ in range(R+1)]
for i in range(K): 
  r, c, v = map(int, input().split())
  I[r][c] = v 
  
DP1 = [0 for _ in range(C+1)] #c行目までとったとき、c行目で1個以下とったときの最大
DP2 = [0 for _ in range(C+1)] #c行目までとったとき、c行目で2個以下とったときの最大
DP3 = [0 for _ in range(C+1)] #c行目までとったとき、c行目で3個以下とったときの最大
#print(I)

for r in range(1,R+1):
  for c in range(1,C+1): 
    #更新の順番に注意
    #mid = max(DP1[c], DP2[c], DP3[c]) + I[r][c]
    mid = DP3[c] + I[r][c] 
    DP3[c] = max(DP3[c-1], mid, DP2[c-1] + I[r][c]) #3個
    DP2[c] = max(DP2[c-1], mid, DP1[c-1] + I[r][c]) #2個
    DP1[c] = max(DP1[c-1], mid) #1個
  #print(DP3)
    
print(DP3[C])
    
    
    

Measured memory_bytes: 155364