akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    vector<ll> b(n), c(n);
    rep(i,n){
        b[i] = -a[i] - i;
        c[i] = a[i] - i;
    }
    ll ans = 0;
    unordered_map<ll, ll> cnt;
    rep(i, n) {
        ans += cnt[c[i]];
        cnt[b[i]]++;
    }
    cout << ans << endl;
    return 0;
}

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

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007

const ll INF = 1e18L + 5;

void min_self(ll& a, ll b) {
    a = min(a, b);
}

int main(){
	NINJA;

	ll n,W; cin >> n >> W;

	vector<ll> w(n), val(n);

	fo(i,n) cin >> w[i] >> val[i];

	int sum = 0;

	for(int it : val) sum += it;

	vector<ll> dp(sum+1,INF);
	dp[0] = 0;

	for(int i=0;i<n;i++){
		for(int j = sum-val[i];j>=0;j--){
			min_self(dp[j+val[i]],dp[j]+w[i]);
		}
	}

	ll ans = 0;

	//for(auto it : dp) cout << it << endl;

	for(int i=0;i<=sum;i++){
		if(dp[i]<=W) ans = max(ans,(ll)i);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
n = int(input())
s2 = input()

l = [int(i) for i in s2]
p = sum(l)
s10 = int(s2,2)
if p == 1:
    ans1 = s10%(p+1)
    l1 = [0]*(n+1)
    l1[0] = 1
    for i in range(1,n+1):
        l1[i] = (l1[i-1]*2)%(p+1)
    for i in range(n):
        if l[i]:
            print(0)
        else:
            first = (ans1 + l1[n-i-1])%(p+1)
            ans = 1
            while first:
                mod = 0
                for j in range(len(bin(first))-2):
                    mod += first >> j & 1
                first %= mod
                ans += 1
            print(ans)
    quit()
if p == 0:
    for i in range(n):
        print(1)
    quit()

ans1 = s10%(p+1)
ans2 = s10%(p-1)
l1 = [0]*(n+1)
l2 = [0]*(n+1)
l1[0] = 1
l2[0] = 1
for i in range(1,n+1):
    l1[i] = (l1[i-1]*2)%(p+1)
    l2[i] = (l2[i-1]*2)%(p-1)
first = []
for i in range(n):
    if l[i]:
        first.append((ans2-l2[n-i-1])%(p-1))
    else:
        first.append((ans1+l1[n-i-1])%(p+1))


for i in range(n):
    if first[i] == 0:
        print(1)
        continue
    x = first[i]
    ans = 1
    while x:
        mod = 0
        for j in range(len(bin(x))-2):
            mod += x >> j & 1
        x = x%mod
        ans += 1
    print(ans)

Measured memory_bytes: 110336
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll mod = 1e9+7;

int main(){
    string s, t;
    cin >> s >> t;
    
    ll count = 0;
    rep(i, 3){
        if(s[i] == t[i]){
            count ++;
        }
    }
    
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 4e5 + 5;

ll a[N], cum[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n, m;
    cin >> n >> m;
    map<ll, ll>freq;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    freq[0] = 1;
    for(int i = 1; i <= n; i++){
        cum[i] = cum[i - 1] + a[i];
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ll kam = cum[i]%m;
        ans += freq[kam];
        freq[kam]++;
    }
    cout << ans;


    return 0;
}


Measured memory_bytes: 7040
# -*- coding:utf-8 -*-
import sys
import functools

K, a, b = list(map(int, input().split()))

if a >= b:
    print(K + 1)
else:
    if K >= a + 1:
        k = K - (a - 1)

        # ビスケット A 枚
        if b - a > 2:
            # ひたすら交換する
            print((k // 2) * b - (k // 2 - 1) * a + (k % 2))            
        else:
            # ひたすら叩く
            print(K + 1)
    else:
        print(K + 1)

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

#define int long long

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

int N, M;

signed main() {
    cin >> N >> M;
    if (N >= M / 2) {
        cout << M / 2 << endl;
    } else {
        cout << N + (M - N * 2) / 4 << endl;
    }
    return 0;
}


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

int main(){
    int K, A, B;
    cin >> K >> A >> B;
    bool possible = false;

    for (int i = A; i <= B; i++){
        if(i % K == 0) {
            possible = true;
            break;
        }
    }

    if(possible){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3636
///    Md.ASADUZZAMAN
///    Dept of ICT
///    MBSTU
#include<bits/stdc++.h>
using namespace std;

#define fr(i,a,b) for(int i=(a);i<(b);i++)

#define rfr(i,a,b) for(int i=(b-1);i>=(a);i--)
#define freach(i, c) for( __typeof( (c).begin() ) i = (c).begin(); i != (c).end(); ++i )
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)

#define PINF INT_MAX
#define MINF INT_MIN
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mset(a,c) memset(a,c,sizeof a)
#define clr(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define psi pair<sting,int>
#define pis pair<int,string>
#define ff first
#define ss second
#define vs vector<string>
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pair<int,int> >
#define vpl vector<pair<long long,long long> >

#define qi  queue<int>
#define ql  queue<long>
#define qll queue<long long>
#define PQ priority_queue

#define mpii map<int,int>
#define mpsi map<string,int>
#define mpci map<char,int>

#define bug(x) cout<<#x<<": "<<x<<endl
#define bug1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<endl
#define min(a,b) (a>b?b:a)
#define max(a,b) (a>b?a:b)
#define pi acos(-1.0)
#define rad(x) (((1.0 * x * pi) / 180.0))
#define deg(x) (((x * 180.0) / (1.0 * pi)))
#define sinr(x) (sin(rad(x)))
#define cosr(x) (cos(rad(x)))
#define tanr(x) (tan(rad(x)))
#define asind(x) (deg((asin(x))))
#define acosd(x) (deg((acos(x))))
#define atand(x) (deg((atan(x))))

#define setbiton(x, i) (x |= (1 << i))
#define setbitoff(x, i) (x ^= (1 << i))
#define countbit(x) __builtin_popcountll((ll)x)
#define resetbit(x, i) (x &= (~(1 << i)))

#define LB(a,x) (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x) (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.

#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())


#define input() freopen("in0.txt","r",stdin)
#define output()freopen("out0.txt","w",stdout)
#define fast() ios_base::sync_with_stdio(0);cin.tie();


#define IN scanf
#define OUT printf
//    #define SI(a) scanf("%d",&a)
//    #define SL(a) scanf("%lld",&a)
//    #define SD(a) scanf("%lf",&a)
//   #define OI(a) printf("%d",a)
//    #define OL(a) printf("%lld",a)
//    #define OD(a) printf("%lf",a)
//     #define ON() printf("\n")
#define ll long long
#define ull unsigned long long
#define EPS 1e-9
#define MOD 1000000007
int main()
{
    #ifndef ONLINE_JUDGE
    //input();
    //output();
    #endif
    fast();
    ll n,t,a,b,x,y,z;
    char p,q;
    while(cin>>p>>q)
    {
        if(p=='H')
        {
            cout<<q<<endl;
        }
        else
        {
            if(q=='H')
                cout<<"D"<<endl;
            else cout<<"H"<<endl;
        }

    }


return 0;
}







Measured memory_bytes: 256
//bismillah
//created by anaksoleh
//25 Nov 2019

#include <bits/stdc++.h>
using namespace std;

int const INF = 1e9 + 5;
int const SIZE = 1e5 + 5;
int N,K;
int arr[SIZE];
int ans[SIZE];

void solve()
{
    ans[1] = 0;
    for(int i = 2 ; i <= N ; i++){
        ans[i] = INF;
        for(int j = 1 ; j <= K ; j++){
            if(i - j >= 1){
                ans[i] = min(ans[i],ans[i-j] + abs(arr[i] - arr[i-j]));
            }else break;
        }
    }
}


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

    cin >> N >> K;
    for(int i = 1 ; i <= N ; i++){
        cin >> arr[i];
    }
    solve();
    cout << ans[N] << '\n';
    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
)

func main() {
	sc := NewScanner()

	l := sc.NextInt()
	r := sc.NextInt()
	if r-l >= 2019 {
		fmt.Printf("%+v\n", 0) // output for debug
		return
	}

	min := 2019
	for i := l; i < r; i++ {
		for j := l + 1; j <= r; j++ {
			tmp := (i * j) % 2019
			if tmp < min {
				min = tmp
			}
		}
	}
	fmt.Printf("%v\n", min)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n, m;
	string s, t;
	cin >> n >> m >> s >> t;
	ll l = n * m / __gcd(n, m);
	map<ll, char> mp;
	map<int, int> mp2;
	rep(i, n) {
		mp[i * (l / n)] = s[i];
		mp2[i * (l / n)]++;
	}
	rep(i, m) {
		if (mp2[i * (l / m)] != 0 && mp[i * (l / m)] != t[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << endl;
	return 0;
}

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


int P[100000];
bool has_talker[100000] = {false};

int root(int a){
    if(P[a] == a){
        return a;
    }
    return P[a] = root(P[a]);
}

void unite(int a, int b){
    P[root(a)] = root(b);
}

int main(){
    int N, M;
    int K, L[100000];

    cin >> N >> M;

    for(int i = 0; i < M; i++){
        P[i] = i;
    }

    
    for(int i = 0; i < N; i++){
        cin >> K;
        for(int j = 0; j < K; j++){
            cin >> L[j];
            L[j]--;
            has_talker[L[j]] = true;
        }
        for(int j = 1; j < K; j++){
            unite(L[0], L[j]);
        }
    }

    for(int i = 0; i < M; i++){
        root(i);
    }

    int a = -1;
    for(int i = 0; i < M; i++){
        //cout << has_talker[i] << ", " << root(i) << endl;
        if(a == -1 && has_talker[i] == true){
            a = root(i);
            continue;
        }
        if(has_talker[i] && root(i) != a){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    


}

Measured memory_bytes: 1408
D = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for i in range(D)]

INF = float('inf')
DF = 1800
last = [0] * 26
cur_ans = []
nexts = []
for i,s in enumerate(S):
    best_k = -1
    best_score = -INF
    scores = []
    for k,s in enumerate(s):
        score = s
        for j,c in enumerate(C):
            if j==k: continue
            score -= c * (i+1 - last[j])
        if score > best_score:
            best_score = score
            best_k = k
        scores.append((score,k))
    last[best_k] = i+1
    cur_ans.append(best_k + 1)
    for sc,k in scores:
        if k==best_k: continue
        if sc < best_score - DF: continue
        nexts.append((best_score-sc, i,k))
nexts.sort(key=lambda x:x[0])

def evaluate(ans):
    last = [0] * 26
    score = 0
    for i,(s,a) in enumerate(zip(S,ans)):
        score += s[a-1]
        last[a-1] = i+1
        for j,c in enumerate(C):
            score -= c * (i+1 - last[j])
    return score + 10**6

cur_score = evaluate(cur_ans)
selects = [-1] * D
for _,ni,nk in nexts:
    if selects[ni] >= 0: continue
    last = [0] * 26
    ans = []
    for i,s in enumerate(S):
        if selects[i] >= 0:
            last[selects[i]] = i+1
            ans.append(selects[i] + 1)
            continue
        if i==ni:
            last[nk] = i+1
            ans.append(nk + 1)
            continue
        best_k = -1
        best_score = -INF
        for k,s in enumerate(s):
            score = s
            for j,c in enumerate(C):
                if j==k: continue
                score -= c * (i+1 - last[j])
            if score > best_score:
                best_score = score
                best_k = k
        last[best_k] = i+1
        ans.append(best_k + 1)
    sc = evaluate(ans)
    if sc > cur_score:
        cur_score = sc
        cur_ans = ans
        selects[ni] = nk

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

Measured memory_bytes: 71256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

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

  int X = 2 * D + 1;

  cout << (N + X - 1) / X <<  endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <numeric>
using namespace std;
int gcd(int a,int b){
  if(a<b){
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(b==0){
    return a;
  }
  else{
    return gcd(b,a%b);
  }
}
int main() {
  int N;
  cin >> N;
  int x;
  int sum=0;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){
      for(int k=1;k<=N;k++){
        x=gcd(i,j);
        sum+=gcd(x,k);
        //cout << i << j << k << endl;
      }
    }
  }
  cout << sum;
  cout << endl;
  return 0;
}


Measured memory_bytes: 3596
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))

c0 = c[0][0] + c[0][1] + c[0][2]
c1 = c[1][0] + c[1][1] + c[1][2]
c2 = c[2][0] + c[2][1] + c[2][2]

# a0 + b0 = c00
# a0 + b1 = c01
# a0 + b2 = c02
# 3*a2 + b0 + b1 + b2 = c20 + c21 + c22
# 3*a2 - 3*a0 = c20 + c21 + c22 - (c00 + c01 + c02)
for a0 in range(101):
    b0 = c[0][0] - a0
    b1 = c[0][1] - a0
    b2 = c[0][2] - a0
    for a1 in range(101):
        a2 = (c2 - c0 + 3 * a0) / 3
        if (
            c[1][0] - a1 == b0
            and c[1][1] - a1 == b1
            and c[1][2] - a1 == b2
            and c[2][0] - a2 == b0
            and c[2][1] - a2 == b1
            and c[2][2] - a2 == b2
        ):
            print("Yes")
            exit(0)
print("No")


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

int main(){
  string s;
  int count= 0,maxatcg=0;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i] == 'A' ||s[i] == 'C' ||s[i] == 'G' ||s[i] == 'T'){
      count++;
      if(s[i+1] == 'A' ||s[i+1] == 'C' ||s[i+1] == 'G' ||s[i+1] == 'T'){
      }else{
        maxatcg = max(maxatcg,count);
        count = 0;
      }
    }
  }
  maxatcg = max(maxatcg,count);

  cout << maxatcg << endl;
}


Measured memory_bytes: 256
PROGRAM piyo
      IMPLICIT NONE
      character(11) :: s,t
      integer :: len
      
      read*,s
      read*,t
      
      len = len_trim( s )
      
      if( s(1:len)==t(1:len) )then
        print*,'Yes'
      else
        print*,'No'
      end if
      
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 2856
n = gets.to_i
x = gets.chomp
xs = x.to_i(2)
xc = x.count('1')
def mpow(n, p, mod)
  r = 1
  while p > 0
    r = r * n % mod if p & 1 == 1
    n = n * n % mod
    p >>= 1
  end
  r
end
def popcount(u)
  return 0 if u.zero?
  a = u % u.to_s(2).count('1')
  1 + popcount(a)
end
xsp = xs % (xc + 1)
xsm = xs % (xc - 1) if xc > 1
n.times do |i|
  if x[i] == '0'
    y = xsp + mpow(2, n - i - 1, xc + 1)
    y = mpow(y, 1, xc + 1)
  elsif xc == 1
    puts '0'
    next
  else
    y = xsm - mpow(2, n - i - 1, xc - 1)
    y = mpow(y, 1, xc - 1)
  end
  puts popcount(y) + 1
end

Measured memory_bytes: 14792
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
	
{	
	int x, y;

	for (int i = 0; i < 3000; i++)
	{
		cin >> x >> y;

		if (x == 0 && y == 0) break;

		cout << min(x, y) << " " << max(x, y) << endl;
	}
	

	return 0;
}



Measured memory_bytes: 3072
#include <stdio.h>

#define HOUR    3600
#define MINUTES 60

int main(void)
{
  int h, m, s;

  h = 0;
  m = 0;

  scanf("%d", &s);

  if ( s >= HOUR ) {
    h = s / HOUR;
    s -= h * HOUR;
  }

  if ( s >= MINUTES ) {
    m = s / MINUTES;
    s -= m * MINUTES;
  }

  printf("%d:%d:%d\n", h, m, s);
  
  return 0;
}

Measured memory_bytes: 592
program beda;
var

a,b,c : longint;
begin
  
  readln(a,b);
   if ((a = 1) and ( b <> 1)) then
   writeln('Alice')
   else if (a = b) then
   writeln('Draw')
   else if (a <> 1) and (b = 1) then
   writeln('Bob')
   else if (a > b) then
   writeln('Alice')
   else if (b > a) then
   writeln('Bob');
end.


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll s,k;
  cin >> k >> s;
  ll c = 0;
  rep(i,k+1){
    rep(j,k+1){
      if(s - (i + j) <= k && s - (i + j) >= 0){
        ++c;
        /* std::cout << i << ' ' << j << ' '<< s - (i+j) << std::endl; */
      }
    }
  }
  std::cout << c << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

	double r,l;
	int va[2][4]={0};

	while(cin>>l>>r){
		if(r>=1.1) va[0][0]++;
		else if(r>=0.6) va[0][1]++;
		else if(r>=0.2) va[0][2]++;
		else va[0][3]++;
		if(l>=1.1) va[1][0]++;
		else if(l>=0.6) va[1][1]++;
		else if(l>=0.2) va[1][2]++;
		else va[1][3]++;
	}
	for(int i=0;i<4;i++){
		cout<<va[1][i]<<" "<<va[0][i]<<endl;
	}
}

Measured memory_bytes: 1224
N,U,V = map(int,input().split())
U,V = U-1, V-1

adj = [list() for _ in range(N)]

for _ in range(N-1):
    a,b = map(int,input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)



dist_u = [None]*N
dist_u[U] = 0
stack = [U]

while stack:
    x = stack.pop()
    d = dist_u[x]+1
    for y in adj[x]:
        if dist_u[y] is None:
            dist_u[y] = d
            stack.append(y)


dist_v = [None]*N
dist_v[V] = 0
stack = [V]

while stack:
    x = stack.pop()
    d = dist_v[x]+1
    for y in adj[x]:
        if dist_v[y] is None:
            dist_v[y] = d
            stack.append(y)

n = max(b for a,b in zip(dist_u, dist_v) if a < b)
m = min((b for a,b in zip(dist_u, dist_v) if a <= b), default=n)

print(max(n,m)-1)

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

int main()
{
  list<int> ltiNumber;
  list<int>::iterator itlti;
  list<int>::iterator itltEND = ltiNumber.end();
  string sCommand;
  int iMaxCommand, iNumber;

  cin.tie(0);
  ios::sync_with_stdio(false);
 
  cin >> iMaxCommand;
  for (int i = 0; i < iMaxCommand; i++)
  {
    cin >> sCommand;
    if (sCommand == "insert")
    {
      cin >> iNumber;
      ltiNumber.push_front(iNumber);
    }
    else if (sCommand == "deleteFirst")
      ltiNumber.pop_front();
    else if (sCommand == "deleteLast")
      ltiNumber.pop_back();
    else if (sCommand == "delete")
    {
      cin >> iNumber;
      for (itlti = ltiNumber.begin(); itlti != itltEND; ++itlti)
        if (*itlti == iNumber)
        {
          ltiNumber.erase(itlti);
          break;
        }
    }
  }

  int i = 0;
  for (itlti = ltiNumber.begin(); itlti != itltEND; ++itlti)
  {
    if (i++) cout << " ";
    cout << *itlti;
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 32476
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const ll is_query = -(1LL<<62);
struct Line {
    ll m, b;
    mutable function<const Line*()> succ;
    bool operator<(const Line& rhs) const {
        if (rhs.b != is_query) return m < rhs.m;
        const Line* s = succ();
        if (!s) return 0;
        ll x = rhs.m;
        return 1.0L * b - s->b < 1.0L *(s->m - m) * x;
    }
};
struct ConvexHullDynamic : public multiset<Line> { // will maintain upper hull for maximum
    bool bad(iterator y) {
        auto z = next(y);
        if (y == begin()) {
            if (z == end()) return 0;
            return y->m == z->m && y->b <= z->b;
        }
        auto x = prev(y);
        if (z == end()) return y->m == x->m && y->b <= x->b;
        return (x->b - y->b)*1.0L*(z->m - y->m) >= (y->b - z->b)*1.0L*(y->m - x->m);
    }
    void insert_line(ll m, ll b) {
        auto y = insert({ m, b });
        y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
        if (bad(y)) { erase(y); return; }
        while (next(y) != end() && bad(next(y))) erase(next(y));
        while (y != begin() && bad(prev(y))) erase(prev(y));
    }
    ll eval(ll x) {
        auto l = *lower_bound((Line) { x, is_query });
        return l.m * x + l.b;
    }
};

ll a[222222];
ll dp[222222];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; ll c; cin>>n>>c;
	for(int i=0;i<n;i++) cin>>a[i];
	dp[0]=0;
	ConvexHullDynamic ch;
	ch.insert_line(2LL*a[0],-a[0]*a[0]);
	for(int i=1;i<n;i++)
	{
		dp[i] = -ch.eval(a[i])+a[i]*a[i]+c;
		ch.insert_line(2LL*a[i],-(dp[i]+a[i]*a[i]));
	}
	cout<<dp[n-1]<<'\n';
}


Measured memory_bytes: 22144
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n,k;
llong T[MAX];

int check (llong P) {
  int i=0;
  for (int j=0;j<k;j++) {
    llong s = 0;
    while(s+T[i] <= P) {
      s += T[i];
      i++;
      if (i==n) return n;
    }
  }
  return i;
}

int solve () {
  llong left=0;
  llong right=10000*100000;
  llong mid;
  while (right - left > 1) {
    mid = (left + right) /2;
    int v = check(mid);
    if (v >= n) {
      right = mid;
    }else{
      left = mid;
    }
  }
  return right;
}

main () {
  cin>>n>>k;
  for (int i=0;i<n;i++) {
    cin>>T[i];
  }
  llong ans = solve();
  cout<<ans<<endl;
}



Measured memory_bytes: 3880
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int people;
	cin>>people;
	vector<int> vi;
	for(int i=0;i<people;i++)
	{
		int a;
		cin>>a;
		vi.push_back(a);
	}
	sort(vi.begin(),vi.end());
	vector<int> vii;
	for(int i=vi[0];i<=vi[vi.size()-1];i++)
	{
		int sum = 0;
		for(int j=0;j<vi.size();j++)
		{
			sum+=(vi[j]-i)*(vi[j]-i);
		}
		vii.push_back(sum);
	}
	sort(vii.begin(),vii.end());
	cout<<vii[0]<<endl;
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N, M;
string s, t;

int main() {
	cin >> N >> M >> s >> t;
	int d = __gcd(N, M);

	bool ok = 1;

	int n = N / d;
	int m = M / d;

	rep(i, N) {
		if (i % n == 0) {
			int j = i / n * m;
			if (s[i] != t[j]) {
				ok = 0;
			}
		}
	}

	if (ok) cout << (ll)N * M / d << endl;
	else puts("-1");

	return 0;
}

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

typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
    FAST;
    int a,b,l,r;
    cin>>a>>b;
    int tax=1;
    while(1)
    {
        l=tax*0.08;
        r=tax*0.1;
        if(l==a&&r==b)
        {
            cout<<tax<<endl;
            break;
        }
        else if((l>a)||(r>b))
        {
            cout<<-1<<endl;
            break;
        }
        tax++;
    }
    return 0;
}

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

int main(void) {
    int N;
    cin >> N;
    vector<long long> A(N);
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    long long ans = __LONG_LONG_MAX__;
    long long left_sum = 0;
    for (int i = 0; i < N - 1; i++) {
        left_sum += A[i];
        long long l = left_sum;
        long long r = sum - l;
        ans = min(abs(l - r), ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "YES"
#define N "NO"
using namespace std;

const ll mod = 1e9+7;
int n;
ll ans;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	//freopen("in.txt", "r", stdin);
	
	cin >> n;
	ll a[n], sum[n];
	cin >> a[0];
	sum[0] = a[0];
	REP(i, 1, n) {
		cin >> a[i];
		sum[i] = sum[i-1] + a[i];
	}
	REP(i, 1, n)
		ans = (ans + ( (a[i] % mod) * (sum[i-1] % mod) ) % mod) % mod;
	
	cout << ans;
}

Measured memory_bytes: 6708
n, k = gets.chomp.split(' ').map(&:to_i)
strs = gets.chomp.split(' ').map(&:to_i)

max_num = sum = strs[0...k].inject(:+)
[*k...n].each do |i|
  sum = sum - strs[i - k] + strs[i]
  max_num = sum if max_num < sum
end
puts (max_num+k).to_f/2

Measured memory_bytes: 18748
/*input
1
*/
#include <bits/stdc++.h>
using namespace std;
 
#define all(a) (a).begin(), (a).end()
#define pb push_back
 
using ll = long long;
using pii = pair<int, int>;

int main() {
  ios::sync_with_stdio(false);cin.tie(nullptr);
  int n; cin >> n;
  int odd = 0;
  for (int i = 1; i <= n; i += 2) ++odd;
  cout << (double)odd / n;
}

Measured memory_bytes: 256
h,w,m=map(int,input().split())
h_=[0]*(h+1)
w_=[0]*(w+1)
plot=set()
for _ in range(m):
    x,y=map(int,input().split())
    h_[x]+=1
    w_[y]+=1
    plot.add((x,y))
x=max(h_)
y=max(w_)
a=[i for i,v in enumerate(h_) if v==x]
b=[j for j,q in enumerate(w_) if q==y]
ans=x+y-1
c=False
for i in a:
    for j in b:
        if (i,j) not in plot:
          c=True
          break
    if c:
      break
if c:
  print(ans+1)
else:
  print(ans)
          
        
        


Measured memory_bytes: 83496
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        while(true) {
            String s = scan.nextLine();
            if(s.charAt(0) == '0')break;
            int sum = 0;
            for(int i = 0;i < s.length();i++){
                sum += s.charAt(i) - '0';
            }
            System.out.println(sum);
        
        }


        scan.close();
    }
}


Measured memory_bytes: 26636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
    
    ll a,b,c,d; cin>>a>>b>>c>>d;

    ll c_count=0,d_count=0;

    c_count = (b)/c - (a-1)/c;

    d_count = (b)/d - (a-1)/d;

    ll gcd = d%c,kioku = c * d;

    while(gcd != 0){
        d = c;
        c = gcd;
        gcd = d % c;
    }

    ll lcm = kioku / c;

    ll ans = b - a + 1 + (  ((b) / lcm) -( (a-1) / lcm) ) - (c_count + d_count);

    cout<<ans<<endl;

    return 0;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll x,y,n,m,c;
    cin>>x>>y>>n>>m>>c;
    vector<ll>red(n);
    vector<ll>green(m);
    vector<ll>white(c);
    for(int i=0;i<n;i++) cin>>red[i];
    for(int i=0;i<m;i++) cin>>green[i];
    for(int i=0;i<c;i++) cin>>white[i];
    sort(red.begin(),red.end());
    sort(green.begin(),green.end());
    sort(white.begin(),white.end());
    vector<ll>ans;
    ll i=n-1;
    while(x--)
    {
        ans.push_back(red[i]);
        i--;
    }
    i=m-1;
    while(y--)
    {
        ans.push_back(green[i]);
        i--;
    }
    sort(ans.begin(),ans.end());
    i=c-1;
    ll  j=0;

    while(i>=0 && j<=ans.size()-1  && white[i]>ans[j])
    {
        ans[j]=white[i];
        i--;
        j++;
    }
    ll sum=0;
    for(int i=0;i<ans.size();i++)
    {
        sum+=ans[i];
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 4724
N, C = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]

mod = [[], [], []]

for i in range(N):
    for j in range(N):
        mod[(i+j)%3].append(c[i][j])

from collections import Counter

c = []
for i in range(3):
    c.append(Counter(mod[i]))

ans = float("inf")
for c_i in range(C):
    for c_j in range(C):
        if c_j == c_i:
            continue
        for c_k in range(C):
            if c_k == c_i or c_k == c_j:
                continue
            li = [c_i, c_j, c_k]
            sm = 0
            for i in range(3):
                counter = c[i]
                for k, v in counter.items():
                    sm += d[k-1][li[i]] * v

            ans = min(ans, sm)

print(ans)


Measured memory_bytes: 7824
#include"bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
typedef pair<int, int> P;
typedef long long ll;

lint N;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	FOR(n, 1, 3501) {
		FOR(w, 1, 3501) {
			if ((4 * n * w - N * (n + w)) <= 0) continue;
			if ((N * n * w) % (4 * n * w - N * (n + w)) == 0) {
				cout << n << " " << w << " " << (N * n * w) / (4 * n * w - N * (n + w));
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

// Least Common Multiple 最小公倍数
ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{
  ll H1, M1, H2, M2, K, time1, time2, time;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  ll ans = 0;
  time1 = H1 * 60 + M1;
  time2 = H2 * 60 + M2;
  time = time2 - time1;

  cout << time - K << endl;
  return 0;
}


Measured memory_bytes: 3720
import math
import itertools
import statistics
#n = int(input())
n = int(input())
c = []
s = []
f = []
for i in range(n-1):
    x,y,z = [int(j) for j in input().split()]
    c.append(x)
    s.append(y)
    f.append(z)

total = 0
for i in range(n-1):
    total = 0
    total += s[i]
    total += c[i]
    for j in range(i+1, n-1):
        if total < s[j]:
            total = s[j]
        elif total%f[j]!=0:
            total = total+f[j]-(total%f[j])   
        total += c[j]
    print(total)

print(0)

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

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

    string S, T;
    cin >> S >> T;

    for(int i = S.length() - T.length(); i >= 0; i--) {
        bool checker = false;

        for(int j = 0; j < T.length(); j++) {
            if(S[i + j] == '?') continue;
            if(S[i + j] != T[j]) {
                cerr << S[i + j] << endl;
                checker = true;
                break;
            }
        }

        if(checker) continue;
        for(int j = 0; j < T.length(); j++) {
            S[i + j] = T[j];
        }

        for(int j = 0; j < S.length(); j++) {
            if(S[j] == '?') S[j] = 'a';
        }

        cout << S << endl;
        return 0;
    }

    cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
import qualified Data.Vector as V
import Control.Monad
import Data.Bits

type Hint = V.Vector (Int, Int)
type Status = V.Vector (Bool, Int)

toBitV :: Int -> Int -> V.Vector Int
toBitV n l
    | l == 0 = V.empty 
    | otherwise = V.snoc (toBitV (shiftR n 1) (l - 1)) (n .&. 1)

solve :: V.Vector Hint -> Int -> Int -> Int
solve xss n i
  | cond = len
  | otherwise = 0
  where
    len = V.length $ V.filter (==1) $ V.map snd res
    cond = V.and $ V.map fst res
    res = step xss' status

    bs = toBitV i n
    status = V.zip (V.replicate n True) bs
    xss' = V.zip bs xss

    step :: V.Vector (Int, Hint) -> Status -> Status
    step xss status 
      | V.null xss = status
      | bit == 0 = step tss status -- 0と仮定しているなら無視
      | bit == 1 = step tss status'-- 1と仮定しているなら検証
        where
          (bit, hint) = V.head xss
          status' = V.accumulate step' status hint
          step' (branch, b) x = (branch && (b==x),b)
          tss = V.tail xss

main = do
  n <- readLn :: IO Int
  vec <- V.replicateM n $ do
    a <- readLn :: IO Int
    xs <- V.replicateM a $ do
      [x,y] <- map read . words <$> getLine :: IO [Int]
      return (x-1,y)
    return xs
  let res = [solve vec n i | i <- [0..2^n-1]] 
  print $ maximum res


Measured memory_bytes: 1020
#include<stdio.h>
#include<ctype.h>
int main(){
  char str[100000];
  int i=0;
  gets(str);
  for(i=0;str[i]!='\0';){
    str[i]=toupper(str[i]);
  i++;
 }
  printf("%s\n",str);
  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l,r,d;
  cin>>l>>r>>d;
  int count=0;
  for(int i=l;i<=r;)
  {
    if(i%d==0)count++;
    i++;
  }
  cout<<count;
  return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 998244353;

int main() {
    ll n; cin >> n;
    ll ans = 0;
    ll m = n-1;
    ll i = 1;
    while (i * i <= m) {
        if (m % i == 0) {
            if (i == m/i) ans++;
            else ans += 2;
        }
        i++;
    }
    ans--;

    i = 1;
    ll num;
    while (i * i <= n) {
        num = n;
        if (num % i == 0) {
            if (i == num / i) {
                while (num % i == 0) {
                    num /= i;
                }
                if (num % i == 1) ans++;
            } else {
                ll j = num / i;
                while (num % j == 0) {
                    num /= j;
                }
                if (num % j == 1) ans++;
                num = n;
                if (i != 1) {
                    while (num % i == 0) {
                        num /= i;
                    }
                    if (num % i == 1) ans++;
                }
            }
        }
        i++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ConsoleApplicationABC98D_ {
    class Program {
        static void Main(string[] args) {
            String line;
            line = Console.ReadLine();
            String[] var = line.Split(new char[] { ' ' });
            int N = int.Parse(var[0]);
            int K = int.Parse(var[1]);
            int Q = int.Parse(var[2]);
            line = Console.ReadLine();
            String[] Astr = line.Split(new char[] { ' ' });
            int[] A = new int[N];
            for (int i = 0; i < N; i++) { A[i] = int.Parse(Astr[i]); }


            int minXmY = -1;
            int[] A0 = (int[])A.Clone();
            Array.Sort(A0);
            for (int i = 0; i <= N - Q; i++) {
                int Y = A0[i];

                var A3 = new List<int>();
                var A2 = new List<int>();
                for (int j = 0; j < N; j++) {
                    if (A[j] >= Y) {
                        A2.Add(A[j]);
                    } else {
                        if (A2.Count - K + 1 > 0) {
                            int c = A2.Count - K + 1;
                            A2.Sort();
                            A3.AddRange(A2.GetRange(0, c));
                        }
                        A2.Clear();
                    }
                }
                if (A2.Count - K + 1 > 0) {
                    int c = A2.Count - K + 1;
                    A2.Sort();
                    A3.AddRange(A2.GetRange(0, c));
                }
                A3.Sort();
                if (A3.Count >= Q) {
                    int XmY = A3[Q - 1] - Y;
                    if (minXmY > XmY || minXmY < 0) { minXmY = XmY; }
                }
            }

            Console.WriteLine(minXmY.ToString());
        }
    }
}


Measured memory_bytes: 35008
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

 int main(){

	 int N;
	 scanf("%d",&N);

	 int* power = new int[N+1];
	 int* weight = new int[N+1];
	 bool** table = new bool*[N+1];
	 int** dp = new int*[N+1];
	 for(int i = 0; i <= N; i++){
		 table[i] = new bool[N+1];
		 dp[i] = new int[N+1];
		 for(int k = 0; k <= N; k++){
			 table[i][k] = false;
			 dp[i][k] = BIG_NUM;
		 }
	 }

	 for(int i = 1; i <= N; i++){
		 scanf("%d %d",&power[i],&weight[i]);
     }

	 weight[0] = 0;
	 for(int i = 1; i <= N; i++){
		 weight[i] += weight[i-1];
		 table[i][1] = true;
		 dp[i][i] = 1;
	 }

	 for(int length=2; length <= N; length++){
		  for(int left = 1; left + length -1 <= N;left++){
			  if((power[left] >= (weight[left+length-1]-weight[left]) && table[left+1][length-1]  == true) ||
					 (power[left+length-1] >= (weight[left+length-2]-weight[left-1]) && table[left][length-1]) == true){
				table[left][length] = true;
				dp[left][left+length-1] = 1;
			 }else{
				  for(int i = left; i <= left+length-2; i++){
					 dp[left][left+length-1] = min(dp[left][left+length-1],dp[left][i]+dp[i+1][left+length-1]);
				 }
			 }
		 }
	 }

	 printf("%d\n",dp[1][N]);

	return 0;
}

Measured memory_bytes: 7692
import java.util.Scanner
import kotlin.system.exitProcess

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val arr = IntArray(3) {scanner.nextInt()}
	var s = false
	for (a in arr) {
		if (!s && a==7) s=true
		else if (a!=5) {
			println("NO")
			exitProcess(0)
		}
	}
	println( if(s) "YES" else "NO")
}

Measured memory_bytes: 29476
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  ll n,t;
  cin>>n>>t;
  vector<pii> p(n);
  rep(i,n)cin>>p[i].X>>p[i].Y;
  sort(all(p));
  for(pii x:p){
    t-=x.Y;
    if(t<=0){
      cout<<x.X<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int main() {
    int n; cin >> n;
    double t, a; cin >> t >> a;
    double mel = 1000000010;
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        int h; cin >> h;
        double tmp = t - h * 0.006;
        if (chmin(mel, abs(tmp - a))) ans = i;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

ll N;
int ans = 0;
void dfs(ll x,int a,int b,int c){
	if(x>N) return;
	if(a&b&c)ans++;
	dfs(10*x+3,1,b,c);
	dfs(10*x+5,a,1,c);
	dfs(10*x+7,a,b,1);
}

int main() {
	cin>>N;
	dfs(0,0,0,0);
	cout<<ans<<endl;
}

Measured memory_bytes: 256