akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll K; cin >> K;
    ll XX,YY; cin >> XX >> YY;

    ll X = abs(XX);
    ll Y = abs(YY);
    if (~K&1 and (X+Y)&1) {
        cout << -1 << ln;
        return 0;
    }
    auto dist=[](ll sx, ll sy, ll gx, ll gy) {return abs(sx-gx)+abs(sy-gy);};
    vector<pii> ans;
    auto yes=[&]() {
        cout << ans.size() << ln;
        ll kx = 1, ky = 1;
        if (XX < 0) kx = -1;
        if (YY < 0) ky = -1;
        for (auto i : ans) print(i.first*kx,i.second*ky);
        exit(0);
    };
    ll x = 0, y = 0;
    while (dist(x,y,X,Y) > K*2) {
        if (X-x>=K) {
            ans.emplace_back(x+K,y);
            x += K;
        } else {
            ans.emplace_back(x,y+K);
            y += K;
        }
    }

    if (((x+y)&1) != ((X+Y)&1)) {
        if (dist(x,y,X,Y)==K) {
            ans.emplace_back(X,Y);
            yes();
        }
        if (X-x>=K) {
            ans.emplace_back(x+K,y);
            x += K;
        } else if (Y-y>=K) {
            ans.emplace_back(x,y+K);
            y += K;
        } else {
            ans.emplace_back(x+K,y);
            x += K;
        }
        //assert(dist(x,y,X,Y) <= K*2);
    }

    ll cx = x + y;
    ll cy = x - y;
    ll cX = X + Y;
    ll cY = X - Y;
    vector<pii> A = {{cx+K,cy+K},{cx+K,cy-K},{cx-K,cy+K},{cx-K,cy-K},{cx+K,cY+K},{cx+K,cY-K},{cx-K,cY+K},{cx-K,cY-K},{cX+K,cy+K},{cX+K,cy-K},{cX-K,cy+K},{cX-K,cy-K},{cX+K,cY+K},{cX+K,cY-K},{cX-K,cY+K},{cX-K,cY-K}};
    for (auto i : A) {
        ll nx = (i.first+i.second)/2;
        ll ny = (i.first-i.second)/2;
        if (dist(x,y,nx,ny)==K and dist(nx,ny,X,Y)==K) {
            ans.emplace_back(nx,ny);
            ans.emplace_back(X,Y);
            yes();
        }
    }

    assert(0);
}


Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> bac(101,0);
  int n;
  int cnt=0;
  cin>>n;
  vector<int> data(n);
  for(int i=0;i<n;i++){
    cin>>data[i];
  }
  for(int i=0;i<n;i++){
    bac[data[i]]++;
  }
  for(int i=0;i<101;i++){
    if(bac[i]) cnt++;
  }
  cout<<cnt<<endl;
  
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var D = int.Parse(Console.ReadLine());

            switch (D)
            {
                case 22:
                    Console.WriteLine("Christmas Eve Eve Eve");
                    break;
                case 23:
                    Console.WriteLine("Christmas Eve Eve");
                    break;
                case 24:
                    Console.WriteLine("Christmas Eve");
                    break;
                case 25:
                    Console.WriteLine("Christmas");
                    break;
                default:
                    break;
            }
        }

    }
}


Measured memory_bytes: 11092
#include <algorithm>
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

const auto INF = static_cast<ll>(1e15);
const auto MOD = static_cast<ll>(1e9 + 7);

/*********** Variables ***********/
ll N;
vector<ll> A, B;

/*********** Functions ***********/
void input() {
    cin >> N;
    A.resize(N, 0); B.resize(N, 0);
    for (auto& item : A) cin >> item;
}

void solve() {
    for (ll i = 0; i < N; i++) {
        i % 2 ? B[0] -= A[i] : B[0] += A[i];
    }
    for (ll i = 1; i < N; i++) {
        B[i] = 2 * A[i - 1] - B[i - 1];
    }
}

void output() {
    for (ll i = 0; i < N; i++) {
        cout << (i ? " " : "") << B[i];
    }
    cout << endl;
}

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

Measured memory_bytes: 2944
import math
A, B = map(int, input().split())
numlist = []
def gcd(x, y):
    while y != 0:
        x, y = y, x%y

    return x

num = gcd(A, B)
numcpy = num
flag2 = 0
while(1):
    flag = 1
    for i in range(2, int(math.sqrt(num)) + 2):
        #print(i, numcpy, math.sqrt(num))
        if numcpy % i == 0:
            numcpy = numcpy // i
            flag = 0
            if i not in numlist:
                numlist.append(i)
            break
    if flag == 1:
        break

if numcpy != 1:
    flag2 = 1


print(len(numlist) + 1 + flag2)






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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 1LL << 50;
const ll mod = 1000000007;




int main() {
	int n;
	cin >> n;
	vector<pair<int, int>> a, b;
	REP(i, n) {
		int c, d;
		cin >> c >> d;
		a.push_back(make_pair(c, d));
	}
	REP(i, n) {
		int c, d;
		cin >> c >> d;
		b.push_back(make_pair(c, d));
	}

	sort(ALL(a));
	sort(ALL(b));
	int res = 0;
	VI v(n + 10, 0);
	REP(i, n) {
		int c = 0, d = -1;
		REP(j, n) {
			if (v[j]==0 && a[j].first < b[i].first && a[j].second < b[i].second) {
				if (c <= a[j].second) {
					c = a[j].second;
					d = j;
				}
			}
		}
		if (d>=0) {
			v[d] = 1;
			res++;
		}
	}
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string x;
  cin >> x;
  int i;
  int cnt = 0;
  int chk = 0;
  int len = x.length();
  for(i=0;i<x.length();i++){
    if(x[i]=='S'){
      if(chk==0){
        cnt++;
      }else{
        chk=0;
        if(cnt<=0)cnt=1;
        else cnt ++;
      }
    }else{
      chk=1;
      if(cnt>0){
        cnt--;
        len -= 2;
      }else{
        cnt--;
      }
    }
  }
  cout << len;
}


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

#define i64 long long int
#define ran 202202
#define mod 2019

int n;
char s[ran];
int rem[ran];
int cnt[mod];

int main() {
	scanf("%s", s);
	n = strlen(s);
	
	i64 ans = 0;
	int x = 1;
	rem[n] = 0;
	cnt[0] = 1;
	for(int i=n-1;i>=0;i--) {
		rem[i] = ((s[i]-'0')*x+rem[i+1]) % mod;
		x = x*10%mod;
		
		ans += cnt[rem[i]];
		cnt[rem[i]]++;
	}
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 4644
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String a = "ACTG";
        int lo = 0, hi = 0, n = s.length(), count = 0;
        while (hi < n) {
            char left = s.charAt(lo), right = s.charAt(hi);
            if (a.contains(String.valueOf(left)) && a.contains(String.valueOf(right))) {
                hi++;
            } else {
                count = Math.max(count, hi - lo);
                hi++;
                lo = hi;
            }
        }
        count = Math.max(count, hi - lo);
        System.out.println(count);
        sc.close();
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  cout << a[n-1]-a[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() 
{
int i;
string n;
vector<string> arr(4);
arr[0]="Sunny";
 arr[1]="Cloudy";
 arr[2]="Rainy";
 arr[3]="Sunny";
 cin>>n;
 for(i=0;i<3;i++)
 {
     if(arr[i]==n)
     {
         cout<<arr[i+1]<<endl;
         break;
     }
 }
}


Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	map<ll, ll> m;
	m[1]++;
	m[2]++;
	m[3]++;
	ll a, b;
	cin >> a >> b;
	m[a]++;
	m[b]++;
	for (auto x : m)
	{
		if (x.second == 1)
		{
			cout << x.first << endl;
			return;
		}
	}

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();
	}
}

Measured memory_bytes: 3608
from collections import deque
n, r = input().split(' ')
stack = [deque([]) for _ in range(int(n))]
for _ in range(int(r)):
    row = list(map(int, input().split(' ')))
    c = row[0]
    i = row[1]

    if c == 0:
        stack[i].append(row[2])
    if stack[i]:
        if c == 1:
            print(stack[i][0])
        if c == 2:
            stack[i].popleft()




Measured memory_bytes: 14540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;
const double PI = acos(-1);

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long gcd(long long a, long long b) {
  if(a % b == 0) return b;
  else return gcd(b, a % b);
}
int main() {
  string s;
  cin >> s;
  bool yes = true;
  rep(i, s.size()) {
    if(i % 2 == 0 && s[i] != 'h') yes = false;
    if(i % 2 == 1 && s[i] != 'i') yes = false;
  }
  if(s.size() % 2 == 1) yes = false;
  if(yes) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
//omajinai c++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
constexpr auto mod = 1000000007;

using namespace std;
 


int main() {
long int num=1;
long int h;
  long int time=0;
  cin>>h;
  while(h!=0){
    h=h/2;
    time+=num;
    num*=2;
  }
  
  cout<<time;
}
    
  

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N, cnt = 0; cin >> N;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        if (a % 2 != 0) cnt++;
    }
    if (cnt % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3672
import math
n = int(input())

def pF(n):
	fList = []
	while (n%2 == 0):
		fList.append(2)
		n = n//2

	x = int(math.sqrt(n))
	for i in range(3,x+1,2):
		while (n%i == 0):
			fList.append(i)
			n = n//i

	if n>2:
		fList.append(n)

	return set(fList)

pSet = pF(n)

ans = 0

for p in pSet:
	i = 1
	while (n%(p**i)==0):
		n = n//(p**i)
		ans += 1
		i += 1

print(ans)

Measured memory_bytes: 80488
// AOJ 2007

#include <iostream>

using namespace std;

int retcoin(int money, int a)
{
	money -= a;
	int cnt = 0;
	if (500 <= money){
		cnt += (money / 500);
		money %= 500;
	}
	if (100 <= money) {
		cnt += (money / 100);
		money %= 100;
	}
	if (50 <= money){
		cnt += (money / 50);
		money %= 50;
	}
	cnt += (money / 10);

	return cnt;
}

int main(void)
{
	int n;
	bool first = true;
	while (cin >> n, n){
		int ju, g, h, gh;
		cin >> ju >> g >> h >> gh;
		int sum = ju+g+h+gh;

		if (!first) cout << endl;
		first = false;

		int ret[4] = {0};
		int mincoin = 1001001001;
		for (int i = 0; i <= ju; i++){
			for (int j = 0; j <= g; j++){
				for (int k = 0; k <= h; k++){
					for (int l = 0; l <= gh; l++){

						int outmoney = i*10 + j*50 + k*100 + l*500;
						if (n <= outmoney && sum-(i+j+k+l)+retcoin(outmoney, n) < mincoin){
							// cout << "**" << endl;
							mincoin = sum-(i+j+k+l)+retcoin(outmoney, n);
							ret[0] = i;
							ret[1] = j;
							ret[2] = k;
							ret[3] = l;
						}
/*						
						for (int i = 0; i < 4; i++){
							cout << ret[i] << " ";
						}
						puts("");
*/
					}
				}
			}
		}
/*
		for (int i = 0; i < 4; i++){
			cout << ret[i] << " ";
		}
		puts("");
*/
		if (ret[0] != 0){
			cout << "10 " << ret[0] << endl;
		}
		if (ret[1] != 0){
			cout << "50 " << ret[1] << endl;
		}
		if (ret[2] != 0){
			cout << "100 " << ret[2] << endl;
		}
		if (ret[3] != 0){
			cout << "500 " << ret[3] << endl;
		}
	}

	return 0;
}

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


int main(){
    int n,w[200];
    int i,j,k;

    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&w[i]);

    int left_sum,right_sum,min=999999;
    
    for(i=1;i<=100;i++){
        left_sum=right_sum=0;
        for(j=0;j<i;j++)left_sum+=w[j];
        for(j=i;j<n;j++)right_sum+=w[j];
        if(min>abs(left_sum-right_sum)){
            min=abs(left_sum-right_sum);
            //printf("left==%d right=%d\n",left_sum,right_sum);
        }
    }
    printf("%d\n",min);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    long double a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    long double level = -0.1;
    long double ans1 = 0, ans2 = 0;
    loop(o, 30)
    {
        loop(p, 30)
        {
            loop(q, 101)
            {
                loop(r, 101)
                {
                    long double water = 100.0 * a * o + 100.0 * b * p;
                    long double sugar = c * q + d * r;
                    if (water + sugar > f)
                        continue;
                    if ((water / 100) * e < sugar)
                        continue;
                    long double now = sugar / (water + sugar);
                    if (now > level)
                    {
                        level = now;
                        ans1 = sugar + water;
                        ans2 = sugar;
                    }
                }
            }
        }
    }
    cout << (ll)(ans1 + 0.01) << " " << (ll)(ans2 + 0.01) << endl;
    return 0;
}


Measured memory_bytes: 3700
n = input()
a = [input() for i in range(n)]
a.append(0)
ans = 0
now = 0
while now<n:
    ans += a[now]/2
    if a[now]%2 and a[now+1] > 0:
        ans += 1
        a[now+1] -= 1
    now += 1
print ans

Measured memory_bytes: 8964
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define Fast ios_base::sync_with_stdio(0), cin.tie(0)
#define ll long long

int pow(int a,int n){
	int ans = 1;
	while(n){
		if(n&1)ans*=a;
		a*=a;
		n>>=1;
	}
	return ans;
}


int main(){
	int a,b,c,k;
	cin>>a>>b>>c;
	cin>>k;
	int ans = 0;
	int tmp = max(a,max(b,c));
	ans = a + b + c - tmp + tmp * pow(2,k);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>

#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)

using namespace std;


int main() {
	int N;
	cin >> N;
	cout << 800 * N - (N / 15) * 200;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

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

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;}

/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[1200005];
char s[500005],t[500005];
bool flag,dame;

int main(){
	cin >> n >> k;
	cin >> s;
	for(i=0;i<n;i++){
		if(i == k - 1){
			pu((char)(s[i] + 32));
		}else{
			pu(s[i]);
		}
	}
	el;
	return 0;
}

Measured memory_bytes: 25472
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

struct Node {
  std::vector<int> child;
  bool root = true;
  int parent_color = -1;
  int parent_edge_id = INT_MAX;

  bool operator<(const auto &right) const {
    return parent_edge_id < right.parent_edge_id;
  }
};

int main() {
  int N; std::cin >> N;
  std::vector<Node> nodes(N + 1);
  for (int n = 1; n < N; ++n) {
    int a, b; std::cin >> a >> b;
    nodes[b].root = false;
    nodes[b].parent_edge_id = n;
    nodes[a].child.push_back(b);
//    std::cout << a << "->" << b << std::endl;
  }

  int root_idx = 0;
  for (int i = 1; i <= N+1; ++i) {
    if (nodes[i].root) {
      root_idx = i;
      break;
    }
  }

  std::deque<int> q;
  q.push_back(root_idx);
  int color_max = 1;
  while(!q.empty()) {
    int idx = q.front();
    int parent_color = nodes[idx].parent_color;
    q.pop_front();
//    std::cout << idx << "(" << parent_color << ")" << std::endl;

    int color = 1;
    for (int i : nodes[idx].child) {
      if (color == nodes[idx].parent_color) ++color;
      nodes[i].parent_color = color;
      color_max = std::max(color, color_max);
      q.push_back(i);
      ++color;
    }
  }

  std::sort(nodes.begin(), nodes.end());
  std::cout << color_max << std::endl;
  for (int n = 0; n < N-1; ++n) std::cout << nodes[n].parent_color << std::endl;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 998244353;
 
int main() {
  ll n, k, ans = 0, l, r;
  set<ll> st;
  cin >> n >> k;
  vector<pair<ll, ll>> v(k);
  ll dp[n + 1] = {};
  dp[0] = 1;
  dp[1] = -1;
  rep(i, k) {
    cin >> l >> r;
    r++;
    v[i].first = l, v[i].second = r;
  }
  for (int i = 0; i < n; ++i) {
    if (i > 0) (dp[i] += dp[i - 1]) %= mod;
    for (int j = 0; j < k; ++j) {
      l = v[j].first, r = v[j].second;
      if (i + l < n) (dp[i + l] += dp[i]) %= mod;
      if (i + r < n) (dp[i + r] -= dp[i] - mod) %= mod;
      // if (i + r < n && dp[i + r] < 0) dp[i + r]+= mod;
    }
  }
 
  // rep(i, n - 1)(dp[i + 1] += dp[i]) %= mod;
 
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 5164
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.IntStream;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		
		long Ans = 0L;
		for (int A = 1; A < N; A++) {
			int MaxB = N/A;
			if (MaxB * A == N)
				MaxB -= 1;
			Ans += MaxB;
		}
		System.out.println(Ans);
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32616
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""
class SegmentTree:
    def segfunc(self,x,y):
        return gcd(x,y)

    def __init__(self,n,init,ide_ele):
        self.n = n
        self.ide_ele = ide_ele
        self.num = 2**(n-1).bit_length()
        self.seg = [ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1] = init[i]
        for i in range(self.num-2,-1,-1):
            self.seg[i] = self.segfunc(self.seg[2*i+1],self.seg[2*i+2])
    
    
    def update(self,k,x):
        k += self.num-1
        self.seg[k] = x
        while k:
            lk = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[2*k+1],self.seg[2*k+2])
    
    def query(self,p,q):
        if q <= p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res = self.ide_ele
        while q-p > 1:
            if p & 1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q & 1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p //= 2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

n = onem()

a = l()


ans = 0
p = SegmentTree(n,a,0)
for i in range(n):
    ans = max(ans,gcd(p.query(0,i),p.query(i+1,n)))
print(ans)



Measured memory_bytes: 93408
void main() {
    int n = readln.chomp.to!int;
    int[string] a;
    foreach (i; 0 .. n) {
        string s = readln.chomp;
        if (s in a) ++a[s];
        else a[s] = 1;
    }
    int m = readln.chomp.to!int;
    foreach (i; 0 .. m) {
        string t = readln.chomp;
        if (t in a) --a[t];
        else a[t] = -1;
    }
    max(0, a.values.reduce!max).writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
import java.util.*;
class Main{
public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
  String s=sc.next();
  String[] a=s.split("");
  String c="Yes";
  for(int n=0;n<a.length;n++){
  if(n%2==0&&a[n].equals("L")){c="No";} 
  if(n%2==1&&a[n].equals("R")){c="No";}
  }
 
  System.out.println(c);
  
  
}

}

Measured memory_bytes: 22612
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

typedef struct p {
  double x, y;
} P;

vector<P> res;

void create(P p1, P p2, int n) {
  P s;
  s.x = (2.0 * p1.x + p2.x) / 3.0;
  s.y = (2.0 * p1.y + p2.y) / 3.0;
  P t;
  t.x = (p1.x + 2.0 * p2.x) / 3.0;
  t.y = (p1.y + 2.0 * p2.y) / 3.0;
  P u;
  u.x = ((t.x + s.x) - sqrt(3) * (t.y - s.y))/2.0;
  u.y = (sqrt(3) * (t.x - s.x) + (t.y + s.y))/2.0;
  if (--n == 0) {
    res.push_back(p1);
    res.push_back(s);
    res.push_back(u);
    res.push_back(t);
    res.push_back(p2);
  } else {
    create(p1, s, n);
    create(s, u, n);
    create(u, t, n);
    create(t, p2, n);
  }
}


int main() {
  int recursive_num;
  cin >> recursive_num;
  P start;
  start.x = 0;
  start.y = 0;
  p end;
  end.x = 100;
  end.y = 0;

  if (recursive_num > 0) {
    create(start, end, recursive_num);
  } else {
    res.push_back(start);
    res.push_back(end);
  }
  for (int i = 0; i < res.size(); ++i) {
    if (i) {
      if (res[i].x == res[i-1].x && res[i].y == res[i-1].y) continue;
    }
    cout << res[i].x << " " << res[i].y << endl;
  }
  return 0;
}



Measured memory_bytes: 3312
import sys
import math


def solve(lines):
    lines = [int(x) for x in lines]
    n = lines[0]
    lines = lines[1:]

    cap = min(lines)
    k = math.ceil(n / cap)
    print(4 + k)


if __name__ == '__main__':
    lines = sys.stdin.read()
    lines = lines.strip().split('\n')
    solve(lines)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
#define INF 1e9
typedef pair<int, int> P;

/* 　"assert"    assert(A：条件式)で　Aが真なら処理は続行、偽ならプログラムを終了する　*/

/*　　ラムダ式　　 auto a = [キャプチャ](パラメータ){ 処理 }  */

/* string型　メンバ関数　substr()    replace()  */

 

int main(){
    int n, m, X, Y; cin >> n >> m >> X >> Y;
    
    vector<int> x(n), y(m);
    rep(i,n) cin >> x[i];
    rep(i,m) cin >> y[i];
    
    sort(all(x)); sort(all(y));
    
    int max_x = x[x.size()-1];  //cout << max_x << ",";
    int min_y = y[0]; //cout << min_y << endl;
    
    if(max_x < min_y){
        for(int z = max_x+1; z <= min_y; z++){
            if(X < z && z <= Y){
                cout << "No War" << endl;
                return 0;
            }
        }
    }
    cout << "War" << endl;
    
    
    
    
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
ll n,k,i,j;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  if(k==0){
    cout<<n*n<<endl;
    return;
  }
  ll ans = 0;
  repl(i,1,n+1) {
    ll m = n/i;
    ll r = n%i;
    ans += (m * MAX(0,i-k) + MAX(0,r - k + 1));
  }
  cout<<ans<<endl;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

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

n_shift = 0
start = 0
ans = [start, n_shift]
for i in range(N-1):
    if H[i] >= H[i+1]:
        n_shift += 1

    else:
        if n_shift > ans[1]:
            ans = [start, n_shift]
        n_shift = 0
        start = i + 1

    if i == N-2:
        if n_shift > ans[1]:
            ans = [start, n_shift]

print(ans[1])


Measured memory_bytes: 14252
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
//組合せの数の計算(nCr)
long long Comb(int n, int r)
{
	//n, rが負またはn<rの時は失敗
	if(n<0||r<0||n<r) return 0;

	//nCr=nCn-r
	r=(r<n-r)?r:(n-r);

	//r=0,1の時は計算する必要がない
	if(r==0) return 1;
	if(r==1) return n;

	vector<int> numerator(r), denominator(r);

	for(int k=0; k<r; k++){
		numerator[k]=n-r+k+1;
		denominator[k]=k+1;
	}

	for(int p=2; p<=r; p++){
		int pivot=denominator[p-1];
		if(pivot>1){
			int offset=(n-r)%p;
			for(int k=p-1; k < r; k+=p){
				numerator[k-offset]/=pivot;
				denominator[k]/=pivot;
			}
		}
	}

	long long result=1;
	for(int k=0; k<r; k++){
		if(numerator[k]>1) result*=numerator[k];
	}
	return result;
}
int main(void)
{
	ll n, m, ans=0;

	cin>>n>>m;

	vll a(n), asum(n+1, 0);

	rep(i, n){
		cin>>a[i];
		a[i]%=m;
		asum[i+1]=(asum[i]+a[i])%m;
	}

	map<ll, ll> count;


	rep(i, n+1){
		count[asum[i]]++;
	}

	map<ll, ll>::iterator it;

	for(it=count.begin(); it!=count.end(); it++){
		//cout<<it->first<<" "<<it->second<<endl;
		ans+=Comb(it->second, 2);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int n,a,b,c,d,e,cnt;
  cin>>n>>a>>b>>c>>d>>e;
  cnt=min(min(a,b),min(c,min(d,e)));
  cout<<(n+cnt-1)/cnt+4<<endl;
}
///////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define repr(i,a,n) for (int i=a;i<n;i++)
#define rrep(i,a,n) for (int i=n-1;i>=a;i--)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define fi first
#define se second
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(ll a, ll b) { if (a < b)swap(a, b); return (((a%mod) - (b%mod) + mod) % mod); }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;

void solve() {
	int n;
	cin >> n;
	vi ans(n);
	vpii v;
	rep(i, n) {
		int a;
		cin >> a;
		v.PB({a,i+1});
		
	}

	sort(all(v));
	rep(i, n) {
		cout << v[i].second << " ";
	}
	cout << endl;
	

}

signed main()
{
	int tc;
	tc = 1;
	//	cin >> tc;
	while (tc--) {
		solve();
	}


}

Measured memory_bytes: 3312
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int a,b,ma,ans,n;
int main(){
    cin>>n;
    cin>>a>>b;
    ma=b,ans=a;
    for(int i=1;i<n;i++){
        cin>>a>>b;
        if(ma<b){
            ans=a;
            ma=b;
        }else if(ma==b&&ans>a)ans=a;
    }
    cout<<ans<<" "<<ma<<endl;
return 0;
}

Measured memory_bytes: 1168
// Original: https://github.com/tanakh/competitive-rs
#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashMap;

fn main() {
    input!(mut n: i64);

    if n == 0 {
        println!("0");
        return;
    }

    let mut s = vec![];
    while n != 0 {
        if n % (-2) == 0 {
            s.push('0');
        } else {
            s.push('1');
            n -= 1;
        }
        n /= (-2);
    }
    s.reverse();
    for c in s.iter() {
        print!("{}", c);
    }
    println!("");
}


Measured memory_bytes: 4476
#include<bits/stdc++.h>
#define ll long long 
#define ld long double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX 10000003
using namespace std;
ll dp[5005][5005];
ll count(ll arr[], ll i, ll j)
{
    if(i>j) return 0;
    if(i==j) return dp[i][j]=arr[i];
    if(dp[i][j]!=-1) return dp[i][j];
    return dp[i][j]=max(arr[i]-count(arr,i+1,j),arr[j]-count(arr,i,j-1));
}
void solve()
{
    memset(dp,-1,sizeof(dp));
    ll n;  cin>>n;
    ll arr[n];
    rep(i,0,n)  cin>>arr[i];
    cout<<count(arr,0,n-1);
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    return 0;
}


Measured memory_bytes: 199472
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll; 
int main() {
  ll c; cin>>c;
  char w[26]={'A','B','C','D','E','F','G','H','I'
    ,'J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
  string s; cin>>s;
  ll n=s.size();
  rep(i, n) {
    rep(j, 26) {
      if(s.at(i)==w[j]) {
        s.at(i) = w[(j+c)%26];
        break;
      }
    }
    cout << s.at(i);
  }
}

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

char s[900][900];

int main() {

    int n;
    cin >> n;

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

    for(int i=0; i<2*n; i++){
        for(int j=0; j<2*n; j++){
            s[i][j] = s[i%n][j%n];
        }
    }

    long long int ans = 0;

    for(int k=0; k<n; k++) {
        bool flag = true;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(s[i+k][j] != s[j+k][i]){
                    flag = false;
                }
            }
        }
        if(flag){
            ans += n;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0], v[1]);
    let a = read_vec::<i64>();

    let mut k_binary = vec![];
    let mut k = k;
    while k != 0 {
        k_binary.push(k % 2);
        k /= 2;
    }
    k_binary.reverse();
    debug!(k_binary);

    let mut one_count = vec![0i64; k_binary.len()];
    let mut init = 0i64;
    for &num in a.iter() {
        let mut num = num;
        let mut i = 0;
        while num != 0 {
            if i < k_binary.len() {
                one_count[i] += num % 2;
            } else {
                init += (num % 2) << i;
            }
            num /= 2;
            i += 1;
        }
    }
    one_count.reverse();

    let mut dp = vec![vec![-1; 2]; k_binary.len() + 1];
    dp[0][0] = 0;
    for (i, &c) in k_binary.iter().enumerate() {
        if one_count[i] > (n - 1) / 2 {
            let add = one_count[i] * (1 << (k_binary.len() - 1 - i));
            dp[i + 1][0] = max(dp[i][0] + add, dp[i + 1][0]);
            if c == 0 {
                if dp[i][1] >= 0 {
                    dp[i + 1][1] = max(dp[i][1] + add, dp[i + 1][1]);
                }
            } else {
                dp[i + 1][1] = max(dp[i][0] + add, dp[i + 1][1]);
                if dp[i][1] >= 0 {
                    dp[i + 1][1] = max(dp[i][1] + add, dp[i + 1][1]);
                }
            }
        } else {
            let add0 = one_count[i] * (1 << (k_binary.len() - 1 - i)); // if one use
            let add1 = (n - one_count[i]) * (1 << (k_binary.len() - 1 - i)); // if one use
            assert!(add1 > add0);
            if c == 0 {
                dp[i + 1][0] = max(dp[i][0] + add0, dp[i + 1][0]);
                if dp[i][1] >= 0 {
                    dp[i + 1][1] = max(dp[i][1] + add1, dp[i + 1][1]);
                }
            } else {
                dp[i + 1][0] = max(dp[i][0] + add1, dp[i + 1][0]);
                dp[i + 1][1] = max(dp[i][0] + add0, dp[i + 1][1]);
                if dp[i][1] >= 0 {
                    dp[i + 1][1] = max(dp[i][1] + add1, dp[i + 1][1]);
                }
            }
        }
    }

    let ans = max(dp[k_binary.len()][1], dp[k_binary.len()][0]);
    debug!(init);
    println!("{:?}", ans + init)
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 8444
import java.util.Scanner;

public class Main
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();

		String[] inputArr = input.split("");
		String output = "Yes";

		for(int i = 0; i < inputArr.length; i++)
		{
			if(i%2 == 0)
			{
				if(inputArr[i].matches("R|U|D"))
				{
					continue;
				}
				else
				{
					output = "No";
					break;
				}
			}
			else
			{
				if(inputArr[i].matches("L|U|D"))
				{
					continue;
				}
				else
				{
					output = "No";
					break;
				}
			}
		}

		System.out.print(output);	
	}
}

Measured memory_bytes: 21844