akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define ii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define output(x) for (auto a:x) cout<<a<<" ";cout<<endl;
#define output2(x) for (auto a:x) cout<<a.fi<<" "<<a.se<<endl;
#define PI 3.14159265

// DEBUG TEMPLATE
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
  *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  
// DEBUG TEMPLATE ENDS

#define MOD 1000000007
int power(int x,int y,int mod = MOD) 
{ 
  int ret = 1;
  x = x % mod;
  while (y){
    if(y&1) ret = (ret*x)%mod;
    y = y>>1;
    x = (x*x)%mod;
    } 
    return ret%mod; 
}

void solve()
{ 
  int a,b,c,d,k;
  cin>>a>>b>>c>>d>>k;
  int tup = 0;
  if (a<=c){
    tup+= (c-a)*60;
    if (b<=d){
      tup+=d-b;
    } else {
      tup+= d-b;
    }
  } else {
    tup+= (24-(a-c))*60;
    if (b<=d){
      tup+= d-b;
    } else {
      tup+= d-b;
    }
  }
  cout<<max(0ll,tup-k)<<endl;

}

signed main(){
  // int t;
  // cin>>t;
  // while (t--)
  solve();
}
// Check MOD values plox :(



Measured memory_bytes: 3636
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int max = -99999;
		if(a+b > max)max=a+b;
		if(a-b > max)max=a-b;
		if(a*b > max)max=a*b;
		System.out.println(max);
	}
}

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

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

#define x first
#define y second
#define pb push_back

using namespace std;

typedef long long ll;

ll n, s;

ll f(ll b) {
  ll ret = 0;
  ll a = n;
  while (a > 0) {
    ret += a % b;
    a /= b;
  }
  return ret;
}

void CheckLow() {
  for (ll b = 2; b < 7500000; ++b) {
    if (f(b) == s) {
      cout << b << endl;
      exit(0);
    }
  }
}

vector<ll> Drops() {
  vector<ll> ret;
  ret.push_back(n);
  FOR(i, 2, 15000) {
    ll nn = n / i;
    if (nn < 100000) break;
    --nn;
    while (f(nn + 1) < f(nn)) ++nn;
    if (nn == ret.back()) continue;
    ret.push_back(nn);
  }
  return ret;
}

int main(void) {
  ios_base::sync_with_stdio(false);
  
  cin >> n >> s;

  if (n == s) {
    cout << n + 1 << endl;
    return 0;
  }

  if (s > n) {
    cout << -1 << endl;
    return 0;
  }
  
  CheckLow();

  vector<ll> vec = Drops();
  
  reverse(vec.begin(), vec.end());
  for (int i = 1; i < (int)vec.size(); ++i) {
    ll lo = vec[i - 1];
    ll hi = vec[i];
    while (lo < hi) {
      ll mid = (lo + hi) / 2;
      if (f(mid) > s) lo = mid + 1;
      else hi = mid;
    }
    for (ll chk = lo - 20; chk <= lo + 20; ++chk) {
      if (chk < 2) continue;
      if (f(chk) == s) {
        cout << chk << endl;
        return 0;
      }
    }
  }

  cout << -1 << endl;

  return 0;
}

Measured memory_bytes: 512
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
	for j in range(i,n):
		for k in range(j,n):
			if l[i] + l[j] > l[k] and l[k] + l[i] > l[j] and l[k] + l[j] > l[i] and l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
				ans += 1
print(ans)

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

int main()
{   
    while(true){
    
    int i, n, k;
    cin >> n >> k;
    if((n==0)&(k==0))break;
    int a[n];
    for(i=0; i<n ;i++){
        cin >> a[i];
    }

    int max_val;
    int S;
    //--init--
    S = 0;
    for(i=0; i<k; i++){
        S += a[i];
    }
    max_val = S;
    for(i=0; i<n-k; i++){
        S += a[i+k];
        S -= a[i];
        if(max_val < S){
            max_val = S;
        }
    }
    std::cout << max_val << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3472
def gcd(x, y):
    if y > x:
        x, y = y, x
    while y:
        x, y = y, x % y
    return x

N=int(input())
a=list(map(int,input().split()))

l=[0]*N
l[0]=a[0]
for i in range(1,N):
    l[i]=gcd(l[i-1],a[i])

r=[0]*N
r[N-1]=a[N-1]
for i in range(N-2,-1,-1):
    r[i]=gcd(r[i+1],a[i])

ans=max(r[1],l[N-2])
for i in range(1,N-1):
    tmp=gcd(l[i-1],r[i+1])
    ans=max(tmp,ans)

print(ans)

Measured memory_bytes: 14400
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int memo[11][100];

int main(){
  int c,n,m,s,d;
  while(scanf("%d%d%d%d%d",&c,&n,&m,&s,&d),c+n+m+s+d){
    int load[100][100] = {{ 0 }};
    priority_queue<pair<int,pair<int,int> > > pq;
    memset(memo, -1, sizeof(memo));
    s--; d--;
    REP(i,m){
      int a,b,f;
      scanf("%d%d%d",&a,&b,&f);
      load[a-1][b-1] = load[b-1][a-1] = f;
    }
    pq.push(mp(0,mp(c,s)));
    while(pq.size()){
      int pos  = pq.top().s.s;
      int dist = -pq.top().f;
      int chk  = pq.top().s.f;
      pq.pop();

      //printf("pq.size=%d, pos=%d, dist=%d, chk=%d\n",pq.size(),pos,dist,chk);
      if(pos == d){
        printf("%d\n",dist);
        break;
      }

      if(memo[chk][pos] != -1)
        continue;

      memo[chk][pos] = dist;

      REP(i,n){
        if(load[pos][i] != 0){
          int cost1 = dist + load[pos][i];
          int cost2 = dist + load[pos][i]/2;
          if(memo[chk][i] == -1)
            pq.push(mp(-cost1,mp(chk,i)));
          if(chk > 0 && memo[chk-1][i] == -1)
            pq.push(mp(-cost2,mp(chk-1,i)));
        }
      }
    }
  }
  return 0;
}

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

using namespace std;

#define ll long long
#define up(i,j,n)		for(int i=j;i<=n;i++)
#define down(i,j,n)	for(int i=j;i>=n;i--)
#define cmax(a,b)		a=max(a,b)
#define cmin(a,b)		a=min(a,b)

const int MAXN=3005;
const int oo=0x3f3f3f3f;

int A,B,C,D,E,F,num[MAXN],top=0,ans0=0,ans1=0;
bool mark[MAXN];

int main(){
//	freopen("input.in","r",stdin);
	scanf("%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F);
	up(i,0,30)up(j,0,30)if(i*A+j*B<=F)
		num[++top]=i*A+j*B;
	int lim=F/100*E;
	up(i,0,3000){
		if(i*C>lim)break;
		up(j,0,3000){
			if(i*C+j*D>lim)break;
			mark[i*C+j*D]=1;
		}
	}
	sort(num+1,num+top+1);
	top=unique(num+1,num+top+1)-(num+1);
	up(i,1,top){
		int a=num[i]*100;
		up(b,0,a)if(mark[b]){
			if(a+b>F)break;
			if(b>E*a/100)break;
			if(!ans1||b*ans0>=a*ans1){
				ans0=a;
				ans1=b;
			}
		}
	}
	printf("%d %d\n",ans0+ans1,ans1);
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i

pos = []
n.times do |i|
  pos << gets.split.map(&:to_i)
end

ans = 0.0
cnt = 0
a = []
n.times do |i|
  a << i
end
aa = a.permutation.to_a
#p aa
aa.each do |t|

  cur = pos[t[0]]
  tans = 0.0
  1.upto(n-1) do |j|
    nxt = pos[t[j]]
    tans += ((cur[0] - nxt[0])**2 + (cur[1] - nxt[1])**2)**0.5
    cur = nxt
  end
  ans += tans
  cnt += 1
end
p ans/cnt

Measured memory_bytes: 6908
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{

	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		int total=0;
		double sum = 0;
		double count=0;
		while(sc.hasNext())
		{
			String str = sc.next();
			StringTokenizer st = new StringTokenizer(str, ",");

			String a = st.nextToken();
			String b = st.nextToken();

			sum += Integer.valueOf(b);
			total += Integer.valueOf(a)*Integer.valueOf(b);
			count++;
		}

		int ave =(int) Math.round(sum/count);

		System.out.println(total);
		System.out.println(ave);
	}

}

Measured memory_bytes: 11000
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int N; cin >> N;
    vector<int> p(N);
    rep(i,N) cin >> p[i];
    vector<int> cp(N);
    rep(i,N) cp[i] = p[i];
    SORT(p);
    int count = 0;
    rep(i,N){
        if (p[i]!=cp[i]) count++;
    }
    if (count >= 3) cout << "NO";
    else cout << "YES";
    rn 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	vector<vector<pair<int, int>>>v(N + 1);
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		v[L].push_back({ R,i });
	}
	vector<string>ans(M);
	for (int i = 0; i <= N; i++) {
		if (v[i].empty())continue;
		sort(v[i].begin(), v[i].end());
		int cnt = 1;
		for (auto j : v[i]) {
			//cout << j.first << " " << j.second << endl;
			string s = to_string(i);
			string t = to_string(cnt);
			for (int k = s.size(); k < 6; k++)ans[j.second].push_back('0');
			ans[j.second] += s;
			for (int k = t.size(); k < 6; k++)ans[j.second].push_back('0');
			ans[j.second] += t;
			cnt++;
		}
	}
	for (auto i : ans)cout << i << endl;
}

Measured memory_bytes: 12416
n, x = map(int, input().split())
l = list(map(int, input().split()))

bound = [0]
ans = 1

for i in range(n):
    bound.append(bound[i] + l[i])
    ans += 1
    if bound[-1] == x:
        break
    elif bound[-1] > x:
        ans -= 1
        break

print(ans)

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

int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans;
	ans=a*c;
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

double BMI(double h, double w) {return w/(h*h);}

int main() {
  int n;
  while(cin >> n && n) {
    vector<vector<int> > v;
    while(n--) {
      vector<int> p(3);
      cin >> p[0] >> p[1] >> p[2];
      v.push_back(p);
    }

    sort(v.begin(), v.end());
    int bestID = v[0][0];
    double bestValue = abs(22.0-BMI(v[0][1]/100.0,v[0][2]));
    for(int i = 1; i < v.size(); ++i) {
      double newValue = abs(22.0-BMI(v[i][1]/100.0,v[i][2]));
      if(newValue < bestValue) {
	bestID = v[i][0];
	bestValue = newValue;
      }
    }
    cout << bestID << endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
class Program
 {
        static void Main(string[] args)
        {
    　　    int N = int.Parse(Console.ReadLine()); //標準入力
            int min = 0;
            int max = N;
            bool minSex = true; //Trueが男
            bool flag = true;
            Console.WriteLine("0");
            switch(Console.ReadLine()){
                case "Vacant":
                    return;
                case "Male":
                    minSex = true;
                    break;
                case "Female":
                    minSex = false;
                    break;
            }
            while(flag){
                int middle = (max + min) / 2;
                int evenMark = (middle - min) % 2;
                Console.WriteLine(middle.ToString()); //minからmiddleまでの方が狭い
                string getSex = Console.ReadLine();
                switch(getSex){
                    case "Vacant":
                        return;
                    case "Male":
                        if((minSex && evenMark == 1)||(!minSex && evenMark == 0)){
                            min = min;
                            max = middle;
                        } else {
                            min = middle;
                            minSex = true;
                            max = max;
                        }
                        break;
                    case "Female":
                        if((!minSex && evenMark == 1)||(minSex && evenMark == 0)){
                            min = min;
                            max = middle;
                        } else {
                            min = middle;
                            minSex = false;
                            max = max;
                        }
                        break;
                }
                if(max - min == 2){
                    Console.WriteLine((min + 1).ToString());
                    return;
                    flag = false;
                }
            }
        }
 }

Measured memory_bytes: 13508
#include <stdio.h>
int main()
{
while(true)
{
int a,b;
scanf("%d %d", &a, &b);
if(0==a&&0==b)
break;
if(a<b)
printf("%d %d\n", a, b);
else
printf("%d %d\n", b, a);
}
return 0;
}

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

int main()
{
    int n;
    cin>>n;
    ll ar[n*2];
    for(int i=0;i<2*n;i++)
    {
        cin>>ar[i];
    }
    ll sum=0;
    sort(ar,ar+(2*n));
    for(int i=0;i<2*n;i+=2)
    {
        sum+=ar[i];
    }
    cout<<sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  
  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(s == "Cloudy"){
    cout << "Rainy" << endl;
  }else if(s == "Rainy"){
    cout << "Sunny" << endl;
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    long long n,k; cin>>n>>k;
    long long ans=min(n%k,abs(n%k-k));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
        public static final int INF = 1<<30;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] dp = new int[200000];
        Arrays.fill(dp,INF);
        int[] damage = new int[10010];
        int[] magic = new int[10010];
        //dp[H] ... 体力Hを減らすために必要な魔力の最小値\
        int H = Integer.parseInt(sc.next());
        int N = Integer.parseInt(sc.next());
        for(int i=0;i<N;i++){
            damage[i] = Integer.parseInt(sc.next());
            magic[i] = Integer.parseInt(sc.next());
        }
        int maxD = 0;
        for(int x : damage){
            maxD = Math.max(maxD,x);
        }
        dp[0] = 0;
        for(int i=1;i<=H+maxD;i++){
            for(int j=0;j<N;j++){
                if(damage[j] - i <= 0){
                    dp[i] = Math.min(dp[i],dp[i-damage[j]] + magic[j]);
                }
            }
        }
        int res = INF;
        for(int i=H;i<H+maxD;i++){
            res = Math.min(res,dp[i]);
        }
      System.out.println(res);
    }
}


Measured memory_bytes: 28092
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    string n;
    cin>>n;
    ll s=0;
    for(ll i=0;n[i];i++)
    {
       s+=(int)n[i]-(int)('0');
    }
    if(s%9)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;




}
//Alhamdulillah






















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

int main()
{
    int alpha[26] = {};
    string str;
    while(getline(cin,str))
    {
        for(int i=0;i<str.size();i++)
        {
            if(str[i]>='a'&&str[i]<='z') alpha[str[i]-'a']++; //小文字ならaからの差分を取る
            else if(str[i]>='A'&&str[i]<='Z') alpha[str[i]-'A']++;
        }
    }
    for(int i=0;i<26;i++)
    {
    cout << (char)('a'+i) << " : " << alpha[i] << endl;
    }
    
    return 0;
}


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

int main()
{
	int a, b;
	int ans = 0;
	cin >> a >> b;

	for (int i = 0; i < 2; i++) {
		if (a > b) {
			ans += a;
			a--;
		}
		else {
			ans += b;
			b--;
		}
	}
	cout << ans << endl;

	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;
typedef pair< int, P > PP;

//-------------------------------------------------


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

    int x;
	cin >> x;
	int ma = 1;
	for (int i = 2; i * i <= x; i++) {
		int num = i * i;
        while (num * i <= x) num *= i;
		ma = max(ma, num);
	}
	cout << ma << endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
	static int n;
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0 ; i < n ; i++) {
			b[i] = sc.nextInt();
		}
		for(int i = 0 ; i < n ; i++) {
			c[i] = sc.nextInt();
		}
		long ans = 0;
		Arrays.sort(a);
		Arrays.sort(c);
		for(int i = 0 ; i < n ; i++) {
			ans += 0L + binary_search(a, b[i]) * (n - binary_search(c, b[i]+1));
		}
		System.out.println(ans);
	}
 
	public static long binary_search(int[] a, int x) {
		int l = -1;
		int r = n;
		while(r - l > 1) {
			int i = (l + r) / 2;
			if(x <= a[i]) r = i;
			else l = i;
		}
		return r;
	}
}

Measured memory_bytes: 95932
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer)
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
#[allow(dead_code)]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
#[allow(dead_code)]
fn solve() {
    input! {
        a: isize,
        b: isize,
    }
    let ans;
    if a * b <= 0{
        ans = "Zero";
    } else if a > 0 && b > 0{
        ans = "Positive";
    } else {
        if (b - a + 1) % 2 == 0 {
            ans = "Positive";
        } else {
            ans = "Negative";
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 8572
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int64_t modpow(int64_t a, int64_t n, int64_t mod) {
  int64_t ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n /= 2;
  }
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  map<pair<int64_t, int64_t>, pair<int, int>> memo;
  int zero = 0;
  rep(i, N) {
    int64_t x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {  // special case.
      ++zero;
      continue;
    }

    int64_t g = gcd(x, y);
    // if x or y == 0, gcd equals another value.
    // so x=0, y=? becomes 0, 1, x=?, y=0 becomes 1, 0.
    x /= g;
    y /= g;

    // consider inner product.
    // (xi, yi) * (xj, yj) * cos = xi * xj + yi * yj.
    // threfore, 90degrees makes xi * xj + yi * yj = 0
    // It means the locations of i & j.
    // if i locates in x <= 0, j must locate in 0 < x.

    if ((y < 0) || (y == 0 && x < 0)) {  // rotate 180degree
      // actually there is no y == 0 && x < 0 case because of gcd spec.
      x = -x;
      y = -y;
    }

    // x == 1 store to .second
    // so x == 0 have to be store .first
    // x=1 y=0 and x=0 y=1 shall conflict.
    if (x <= 0) {  // rotate 90degree and register to s.
      memo[{y, -x}].first++;
    } else {  // register to t.
      memo[{x, y}].second++;
    }
  }

  const int64_t mod = 1e9 + 7;
  int64_t answer = 1;
  for (auto& group : memo) {
    int64_t now = 1;  // not choose s & t.
    // can't choose from both s & t.
    int64_t s = group.second.first;
    // 2^s contains all patterns inluding none case.
    int64_t s_pat = modpow(2, s, mod);
    s_pat = (s_pat - 1 + mod) % mod;
    now = (now + s_pat) % mod;

    int64_t t = group.second.second;
    int64_t t_pat = modpow(2, t, mod);
    t_pat = (t_pat - 1 + mod) % mod;
    now = (now + t_pat) % mod;

    answer = (answer * now) % mod;
  }
  answer = (answer + zero) % mod;     // All zero case
  answer = (answer - 1 + mod) % mod;  // None case
  cout << answer << endl;
  return 0;
}


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


int main(){
	string input;
	cin >> input;
	char memo = {};
	int count = 0;
	for(int i=0;i<input.size();i++){
		if(memo != input[i]){
			count++;
			memo= input[i];
		}
	}
	cout << count-1 << endl;
	return 0;
}

Measured memory_bytes: 512
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    n = int(input())

    ans = 0
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            ans += j

    print(ans)

main()

Measured memory_bytes: 74288
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;

    ll a[3];
    F0R(i,3) cin >> a[i];
    ll k;
    cin >> k;
    sort(a,a+3);
    cout << a[2]*pow(2,k) + a[0] + a[1]<<endl;



    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
	char x,y;
	cin >> x >> y;
	if((int)x < (int)y){
		cout << "<" << endl;
	}else if((int)x == (int)y){
		cout << "=" << endl;
	}else{
		cout << ">" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


ll n, m;

bool isdiv(ll x) {
  bool val = false;

  // if (x * n <= m) {
  //   if ((m - x * n) % x == 0)val = true;
  // }
  if (  (m/x ) >= n   )val = true;

  return val;
}



// ll BinarySearch(vector<ll> vec) {
//   // key: 検索対象の値
//   int left = 0, right = vec.size() - 1, mid;

//   while (left < right) {
//     mid = (left + right) / 2;
//     cerr << vec[mid] << endl;
//     if ( !isdiv(vec[mid]) ) {// 半分より下
//       right = mid;
//     } else {// 半分より上
//       left = mid + 1;
//     }
//   }
//   // key が配列の中に見つからない場合
//   return vec[left-1];
// }


vector<ll> enum_div(ll p){//nの約数を列挙{
  vector<ll> ret;
  for (ll i = 1 ; i * i <= p ; ++i){
    if (p % i == 0){
      ret.push_back(i);
      if (i != 1 && i * i != p){
        ret.push_back(p / i);
      }
    }
  }
  return ret;
}


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



  ll x = m / 2;
  vector<ll> div;
  div = enum_div(m);
  div.push_back(m);
  sort(div.begin(),div.end());

  // for(auto b:div){
  //   cerr << b <<",";
  // }cerr <<endl <<endl;;

  // ll ans = BinarySearch(div);

  ll ans =0;

  for(auto d:div){
    if (isdiv(d)){
      ans = max(ans,d);
    }
  }


  cout << ans ;

}




















Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
using ll=long long;
using namespace std;
//const int INF = 7+(1e+9);
ll GCD(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    else
    {
        return GCD(y, x % y);
    }
}
ll LCM(ll x, ll y)
{
    return x / GCD(x, y) * y;
}
vector<int> color;
vector<vector<int>> vec;
void dfs(int x,int Color,int prev){
    color[x]=Color;
    //cout<<x<<" "<<Color<<endl;
    for(int i=0;i<vec[x].size();i++){
        if(prev!=vec[x][i]&&prev!=-vec[x][i]&&Color!=-1){
            if(vec[x][i]>0){
            //    cout<<"偶数"<<x<<"to"<<i<<endl;
                dfs(vec[x][i],Color,x);
            }else{
              //  cout<<vec[x][i]<<endl;
          //      cout<<"奇数"<<x<<"to"<<i<<endl;
                dfs(-vec[x][i],1-Color,x);
            }
        }
    }
    return;
}
int main()
{
    int n;
    cin>>n;
    color.resize(n);
    for(int i=0;i<n;i++){
        color[i]=-1;
    }
    vec.resize(n);
    for(int i=0;i<n-1;i++){
        int u,v,w;
        cin>>u>>v>>w;
        u--;
        v--;
    //    cout<<u<<" "<<v<<" "<<w<<endl;
        if(w%2==0){
            vec[u].push_back(v);
            vec[v].push_back(u);
        }else{
            vec[u].push_back(-v);
            vec[v].push_back(-u);
        }
        
    }
    for(int i=0;i<n;i++){
        if(color[i]==-1){
            //cout<<i<<endl;
            dfs(i,0,0);
        }
        
    }
    for(int i=0;i<n;i++){
        cout<<color[i]<<endl;
    }
}

Measured memory_bytes: 8960
#include<bits/stdc++.h> 
using namespace std; 
int main()
{  int count=0;
	string str ,str2;
	cin>>str>>str2;
	for(int i=0;i<3;i++)
	{ 
		if(str[i]==str2[i])
		{
			count++;
		}}
		cout<<count;
		return 0;
	
	}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

type Edge struct {
	to, cost int
}

type Vertex struct {
	id, cost int
}

// value: Vertex.to
// priority: Vertex.cost
type Elem struct {
	value    interface{}
	priority int
	index    int
}

type PriorityQueue []*Elem

func (pq PriorityQueue) Len() int {
	return len(pq)
}

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	elem := x.(*Elem)
	elem.index = n
	*pq = append(*pq, elem)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(*pq)
	elem := old[n-1]
	old[n-1] = nil
	elem.index = -1
	*pq = old[0 : n-1]
	return elem
}

func (pq *PriorityQueue) update(elem *Elem, value interface{}, priority int) {
	elem.value = value
	elem.priority = priority
	heap.Fix(pq, elem.index)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()

	edges := make([][]Edge, n)
	for i := range edges {
		edges[i] = make([]Edge, 0)
	}
	for i := 0; i < n-1; i++ {
		a, b, c := nextInt3()
		a--
		b--
		edges[a] = append(edges[a], Edge{b, c})
		edges[b] = append(edges[b], Edge{a, c})
	}

	q, k := nextInt2()
	k--

	// 頂点kから各点への最短距離を求める
	dist := make([]int, n)
	for i := range dist {
		if i != k {
			dist[i] = 1 << 60 // INF
		}
	}
	// ダイクストラ法
	done := make([]bool, n)
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)
	// 始点k
	heap.Push(&pq, &Elem{
		value:    k,
		priority: 0,
	})
	for pq.Len() > 0 {
		v := heap.Pop(&pq).(*Elem)
		done[v.value.(int)] = true // 確定
		for _, next := range edges[v.value.(int)] {
			if done[next.to] {
				continue
			}
			cost := v.priority + next.cost
			if cost < dist[next.to] {
				dist[next.to] = cost
				heap.Push(&pq, &Elem{
					value:    next.to,
					priority: cost,
				})
			}
		}
	}

	for i := 0; i < q; i++ {
		x, y := nextInt2()
		x--
		y--
		puts(dist[x] + dist[y])
	}
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ARegistration {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s, t;
        cin >> s >> t;
        REP(i, s.size()) {
            if (s[i] != t[i]) {
                cout << "No" << endl;
                return;
            }
        }
        cout << "Yes" << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ARegistration solver;
    solver.solve(in, out);
    return 0;
}


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

#define MAX 100002

int n;

long long int h[MAX];

long long int A;
long long int B;

bool ok(long long int op){
	long long int ext = 0;
	for (int i = 0; i < n; i++){
		long long int minu = op*B;
		long long int rest = max(0LL, h[i] - minu);
		long long int dif = A - B;
		long long int need = (rest + dif - 1LL) / dif;
		ext += need;
	}
	return ext <= op;
}
int main(){
	cin >> n >> A >> B;
	long long int S = 0;
	for (int i = 0; i < n; i++){
		scanf("%lld", &h[i]);
		S = max(S,h[i]);
	}
	long long  int mint = 0;
	long long int maxt = (S + B - 1) / B;
	maxt += 10;
	while (mint + 1 < maxt){
		long long int mid = ((mint + maxt) >> 1);
		if (ok(mid)){
			maxt = mid;
		}
		else{
			mint = mid + 1;
		}
	}
	if (ok(mint)){
		maxt = mint;
	}
	else{
		mint = maxt;
	}
	printf("%lld\n", mint);
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <limits.h>
#include <vector>
#include <set>
#include <stack>
#include <queue>

using namespace std;                

#define rep(i,a,b) for(int i = a; i < b; i++)
#define mp make_pair
#define pb push_back

typedef long long lld;
typedef long double llf;
typedef pair<int, int> pii;
typedef vector<int> vi;

char tile1[100005];
char tile2[100005];

int main(void){
    
    int ans1, ans2;
    
    ans1=ans2=0;
    
    scanf("%s",tile1);
    memcpy(tile2,tile1,sizeof(tile1));
    
    for(int i=1;tile1[i];i++){
        if(tile1[i]==tile1[i-1]){
            ans1++;
            if(tile1[i]=='1') tile1[i]='0';
            else tile1[i]='1';
        }
    }
    
    if(tile2[0]=='1') tile2[0]='0';
    else tile2[0]='1';
    ans2++;
    
    for(int i=1;tile2[i];i++){
        if(tile2[i]==tile2[i-1]){
            ans2++;
            if(tile2[i]=='1') tile2[i]='0';
            else tile2[i]='1';
        }
    }
    
    cout<<min(ans1,ans2);
    
    return 0;	
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;


int main(){
  int N; cin >> N;
  int K = N;
  int cnt = 1;
  while (N > 0){
    N -= cnt;
    if (N < 0){
      cout << "No" << endl;
      break;
    }else if (N == 0){
      cout << "Yes" << endl;
      cout << cnt + 1 << endl;
      break;
    } 
    cnt++;
  }
  
  if (N == 0){
    vector < vector<int> > ans(cnt + 1);

    int first = 0, second = 1;
    for (int i = 1; i <= K; i++){
      ans[first].push_back(i);
      ans[second].push_back(i);

      if (second - first == 1){
        first = 0;
        second++;
      }else{
        first++;
      }
    }

    for (int i = 0; i < cnt + 1; i++){
      cout << ans[i].size() << " ";

      for (int j = 0; j < ans[i].size(); j++){
        cout << ans[i][j];
        if(j != ans[i].size() - 1){
          cout << " ";
        }else{
          cout << endl;
        }
      }

    }
    



  }
  
  

  return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main(){
	short i,a,b,c,d,cnt=0;
    cin>>a>>b>>c>>d;
    for(i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
    for(int k=0;k<=c;k++){
        if(500*i+100*j+50*k==d) cnt++;
    }
	}
    }
    cout<<cnt;
} 

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

int main(int argc, const char * argv[]) {
    double a,b,c,d,e,f;
    double x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf ",&a,&b,&c,&d,&e,&f)!=EOF){
        x=(c*e-b*f)/(a*e-b*d);
        y=(c*d-a*f)/(b*d-a*e);
        x=round(x*1000)/1000+0;
        y=round(y*1000)/1000+0;
        
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 668
import java.util.Scanner;
public class Main {
     public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        int s = 0;
        for(int i=1000;  s<a; i+=1000){
             s = i;
        }
        System.out.println(s-a);
    }
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class EDividingChocolate {
public:
    int H, W, K;

    void solve(std::istream& cin, std::ostream& cout) {
        cin >> H >> W >> K;
        vector<vector<int>> s(H, vector<int>(W));
        REP(i, H) REP(j, W) {
                char c;
                cin >> c;
                s[i][j] = c - '0';
            }

        int res = INF;
        REP(d, 1LL << (H - 1)) {
            int sz = __builtin_popcount(d) + 1;
            vector<int> sum(sz);
            bool ok = true;
            int tmp = sz - 1;
            REP(j, W) {
                vector<int> cur(sz);
                int id = 0;
                REP(i, H) {
                    if (s[i][j]) cur[id]++;
                    if (cur[id] > K) ok = false;
                    if (d >> i & 1) id++;
                }
                if (!ok) break;
                bool cut = false;
                REP(i, sz) {
                    if (cur[i] + sum[i] > K) {
                        cut = true;
                        tmp++;
                        break;
                    }
                }
                REP(i, sz) {
                    if (cut) {
                        sum[i] = cur[i];
                    } else {
                        sum[i] += cur[i];
                    }
                }
            }
            if (!ok) continue;
            res = min(res, tmp);
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EDividingChocolate solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#define NUM 100

int main()
{
   static long i,j,k,l;
   static char s[1200];
   fgets(s,1203,stdin);
   for(i=0;s[i];i++) {
      if(isupper(s[i]))
         s[i] = tolower(s[i]);
      else if(islower(s[i]))
         s[i] = toupper(s[i]);
   }
   cout << s;
   return 0;
}

Measured memory_bytes: 1096
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();

		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			list.add(a);
		}

		for(int j = list.size()-1;j >= 0 ; j--) {
			if(j == 0) {
				System.out.println(list.get(0));
			} else {
				System.out.print(list.get(j) + " ");
			}
		}

	}

}



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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#define db(x) cout << "> " << #x << " = " \
	<< (x) << '\n'
#define db2(x, y) cout << "> " << #x << " = " \
	<< (x) << ", " << #y << " = " << (y) << '\n'
#define db3(x, y, z) cout << "> " << #x << \
	" = " << (x) << ", " << #y << " = " << \
	(y) << ", " << #z << " = " << (z) << '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vector<int>> vvi;
typedef map<int, int> mii;
typedef set<int> si;


string s;

int main() {
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin >> s;
	for (int i = 1; i < 4; ++i) {
		if (s[i] == s[i - 1]) {
			cout << "Bad\n";
			return 0;
		}
	}
	cout << "Good\n";
	return 0;
}


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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
	
	int x;
	set<int> s;
	
	for(int i = 0; i < 3; i++){
		cin >> x;
		s.insert(x);
	}	
	
	cout << s.size() << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> v;
int n,m,cnt=0,ans=0,aa[220000],ab[220000];
pair<int,char> pp[220000];
string s,sa[220000];
char ch[110][110];
queue<int> que;
signed main(){
    cin>>n>>s;
    rep(i,n){
        aa[s[i]]++;
    }
    rep(i,n){
        ans=0;
        aa[s[i]]--;
        ab[s[i]]++;
        rep(j,200){
            if(aa[j]!=0&&ab[j]!=0){
                ans++;
            }
        }
        cnt=max(cnt,ans);
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 10560
/*

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

using namespace std;

#define ll           long long int
#define mp           make_pair
#define pb           push_back
#define fi           first
#define si           second
#define fastIO       ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n)       for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n)      for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n)       for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n)      for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m)    for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m)   for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m)   for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m)  for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e7;
const int mod = 1e9+7;
ll n, *ar, len1, len2, len3;

ll func(ll i, ll a, ll b, ll c){
	//base case
	if(i == n){
		ll diff = abs(len1-a) + abs(len2-b) + abs(len3-c);
		return (a == 0 || b == 0 || c == 0) ? INT_MAX : diff;
	}
	//recursive case
	ll op1 = a != 0 ? 10 + func(i+1, a+ar[i], b, c) : func(i+1, a+ar[i], b, c);
	ll op2 = b != 0 ? 10 + func(i+1, a, b+ar[i], c) : func(i+1, a, b+ar[i], c);
	ll op3 = c != 0 ? 10 + func(i+1, a, b, c+ar[i]) : func(i+1, a, b, c+ar[i]);
	ll op4 = func(i+1, a, b, c);

	return min(op1, min(op2, min(op3, op4)));
}

int main(){
fastIO
	cin>>n;
	cin>>len1>>len2>>len3;
	ar = new ll[n];
	F(ar, n);
	cout<<func(0, 0, 0, 0);
}

Measured memory_bytes: 3648
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ld pie=3.1415926535;
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll ans=0,n;
    string s; cin>>s;
    n=s.size();
    rep(i,(1<<(n-1))){
        ll cnt=s[0]-'0';
        rep(j,n-1){
            if(i&(1<<j)){
                cnt=cnt*10+(s[j+1]-'0');
            }
            else{
                ans+=cnt;
                cnt=s[j+1]-'0';
            }
        }
        ans+=cnt;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int w, a, b, aw, bw;
    cin >> w >> a >> b;
    aw = a + w;
    bw = b + w;
    if (aw < b) cout << b - aw;
    else if (bw < a) cout << a - bw;
    else cout << '0';
}

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

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
}

int find_set(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return parent[node] = find_set(parent[node]);
}

void union_sets(int firstNode, int secondNode) {
	int parentOfFirstNode = find_set(firstNode);
	int parentOfSecondNode = find_set(secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		parent[parentOfSecondNode] = parentOfFirstNode;
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	
	for(int i = 0; i < n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_sets(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		mp[find_set(i)]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Measured memory_bytes: 13712
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, v, b ,w, t;
    cin >> a >> v >> b >> w >> t;
    if(w >= v){
    	cout << "NO" << endl;
    	return 0;
    }
    a = abs(a - b);
    v = abs(v- w);
    if(v * t >= a) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3648