akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register int i = (a); i <= (b); ++i)
#define per(i, a, b) for (register int i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 3e2 + 5 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = int> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

ll n, m, p;

ll f[maxn][maxn], c[maxn][maxn], g[maxn][maxn];

signed main()
{
	scanf("%lld %lld %lld", &n, &m, &p);
	c[0][0] = 1;
	rep(i, 1, n)
	{
		c[i][0] = 1;
		rep(j, 1, i) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % p;
	}
	rep(i, 0, m) f[1][i] = 1;
	per(i, m, 0) g[1][i] = (g[1][i + 1] + f[1][i]) % p;
	rep(i, 2, n + 1) per(j, m, 0)
	{
		rep(k, 1, i - 1) (f[i][j] += f[i - k][j] * g[k][j + 1] % p * c[i - 2][k - 1] % p) %= p;
		g[i][j] = (g[i][j + 1] + f[i][j]) % p;
	}
	printf("%lld\n", f[n + 1][0]);
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

string s;
int main(){
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
//#include<std.lib>

int main(void)
{
  int A;
  int B;
  int ans=0;

  scanf("%d",&A);
  scanf("%d",&B);

  for(int i=0;i<2;i++)
  {
    if(A>B){
      ans+=A;
      A--;
    }
    else if(B>A){
      ans+=B;
      B--;
    }
    else if(A==B){
      ans+=A;
      A--;
    }
  }
  printf("%d\n",ans);

  return 0;

}


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

using namespace std;

int main(){
	string s;
	int K;
	int l;
	int k;

	cin>>s;
	cin>>K;

	l=s.length();
	
	for(int i=0; i<l; i++){
		k=(26-(s[i]-'a'))%26;
		if(k <= K){
			s[i]='a';
			K-=k;
		}
	}
	s[l-1]=s[l-1]+K%26;

	cout<<s<<endl;
	
	return 0;
}


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

int main() {
    int A,B,H,M;

    cin >> A >> B >> H >> M;

    double Pi = 3.141592653589793238462;

    double short_rad = 2 * Pi * (M + (H % 12)*60) / (12 * 60);
    double long_rad = 2 * Pi * M / 60;

    double long_x = A *  cos(long_rad);
    double long_y = A *  sin(long_rad);
    double short_x = B *  cos(short_rad);
    double short_y = B *  sin(short_rad);

    double distance = sqrt((long_x - short_x)*(long_x - short_x) + (long_y - short_y)*(long_y - short_y));
    cout.precision(20);
    cout << fixed << distance << endl;
}


Measured memory_bytes: 4136
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mx = 101010;
    let mut is_prime = vec![true; mx];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 2..mx {
        if is_prime[i] {
            let mut j = i * 2;
            while j < mx {
                is_prime[j] = false;
                j += i;
            }
        }
    }

    let mut a = vec![0; mx];
    for i in 0..mx {
        if i % 2 == 0 {
            continue;
        }
        if is_prime[i] && is_prime[(i+1)/2] {
            a[i] = 1;
        }
    }

    let mut s = vec![0; mx+1];
    for i in 0..mx {
        s[i+1] = s[i] + a[i];
    }

    let q:usize = read();
    for _ in 0..q {
        let l:usize = read();
        let r:usize = read();

        println!("{}", s[r+1] - s[l]);
    }
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int l,r;
	cin >> l >> r;
	r = min(l + 4000,r);
	int ans  = mod;
	for(int i = l ; i <= r; i++){
		for(int j = i + 1; j <= r; j++){
			ans = min(ans,(i % 2019 * j % 2019) % 2019 );
		}
	}
	cout << ans;
}

Measured memory_bytes: 3564
module Graphical
	require 'set'
	def reachable_from(s, max_depth = nil)
		reached = Set[s]
		queue = [s]
		depth = 0
		loop {
			break if max_depth && depth >= max_depth
			next_queue = []
			until queue.empty?
				u = queue.shift
				each_neighbour_of(u){|v|
					next if reached.include?(v)
					reached << v
					next_queue << v
				}
			end
			break if next_queue.empty?
			queue = next_queue
			depth += 1
		}
		return reached
	end
end

loop {
	t, n = gets.split.map &:to_i
	break if t == 0
	g = (0..120).map { [0] * 120 }
	n.times {
		x, y = gets.split.map &:to_i
		g[x+60][y+60] = 1
	}

	g.extend Graphical
	$diff = [[1,0], [1,1], [0,1], [-1,0], [-1,-1], [0,-1]]
	def g.each_neighbour_of(u)
		x1, y1 = u
		$diff.each{|dx, dy|
			x2, y2 = x1+dx, y1+dy
			next if self[x2][y2] == 1
			yield [x2, y2] 
		}
	end

	sx, sy = gets.split.map &:to_i
	p g.reachable_from([sx+60, sy+60], t).size
}

Measured memory_bytes: 6968
#pragma GCC optimize ("O3")
///#include<bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;



/// Info.
///****************************************************************************************************************************************///
/// Coder               : BAHAA El_DEEN OSAMA SAYED.
/// Problem name        : D - I miss you...
/// Method              : IM-string
/// Date                : 23/2/2020
///****************************************************************************************************************************************///


#define rep0(i,x)         for(int i=0; i<=x ;++i)
#define all(v)           ((v.begin()),((v.end())
#define mm(v,d)          memset(v,d,sizeof(v))
#define lp(i,v)          for(int i=0;i<sizeof(v);++i)
#define lpi(i,j,n)       for(int i=(j);i>=(int)n;++i)
#define lpd(i,j,n)       for(int i=(j);i>=(int)n;--i)
#define MP               make_pair
#define SZ(v)            ((int) ( (v).size() ) )
#define ull              unsigned long long
#define ll               long long
#define pi               3.1415926536
#define oo               1e9
#define OO               1e18
#define Fx(n)            fixed<<setprecision(n)
#define FasterIO           std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define RE0              return 0
#define RE1              return 1
#define mp(a,b)          make_pair(a,b)
#define X                first
#define Y                second
#define pii              pair(int a, int b)
#define rep1(i,x)        for(int i=1;i<x;++i)
#define rep2(i,x)        for(int i=2;i<x;++i)
#define RE               return
//#define LD               long double
#define all(v) ((v).begin()),((v).end())


const  int  N   = (int) 1e5+100;
const  int  M   = (int) 1e4+4;
const  int  INF = (int) 0x3f3f3f3f;
///const double ESP = 1e-7;
///const ll MOD=1e8+9;


string str1,str2,str3;
int a=0,b=0;

int main()
{
FasterIO;

cin>> str1 >> str2 ;
cin >> a   >> b;
cin >> str3;
(str1==str3) ? --a : --b;
cout << a << " " << b;



 RE0;}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0;i < n;i++) a[i] = sc.nextInt();
        boolean[] history = new boolean[n];
        boolean success = false;

        int i = 0;
        int count = 0;
        while(true) {
            if(history[i]) break;
            if(i == 1) {
                success = true;
                break;
            }

            history[i] = true;
            i = a[i] - 1;
            count++;
        }

        String ans = success ? String.valueOf(count) : "-1";
        System.out.println(ans);
    }


}

Measured memory_bytes: 49992
#if DEBUG
using Console = AtCoder.Console;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
#if DEBUG
            Console.Arg = 
@"3 20
";
#endif
            var line = Console.ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();
            var a = line[0];
            var b = line[1];

            var ans = Math.Max(Math.Max(2 * a -1, 2 * b - 1), a + b);
            Console.WriteLine(ans);
#if DEBUG
            Console.Wait();
#endif

        }
    }

    public static class StringExtension
    {
        public static int ToInt(this string str) => int.Parse(str);

        public static long ToLong(this string str) => long.Parse(str);

        public static short ToShort(this string str) => short.Parse(str);
    }
}


Measured memory_bytes: 11220
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int la[2010], p[2010], a[2010], wh[2010];
int pp[11][2010], d[2010];
int ans[100010], ansn;
inline void pu(int x) {
	ans[ansn++] = x;
	int t = a[x], y = x;
	while (x) {
		int to = p[x];
		swap(a[to], t);
		x = to;
	}
	a[y] = t;
}
vector<int> e[2010];
void pfs(int x) {
	for (int i = 0; i < e[x].size(); i++) {
		int y = e[x][i];
		d[y] = d[x] + 1;
		pfs(y);
	}
}
int lca(int x, int y) {
	if (d[x] > d[y]) return lca(y, x);
	int dd = d[y] - d[x];
	for (int i = 0; i < 10; i++) {
		if (dd >> i & 1) {
			y = pp[i][y];
		}
	}
	if (x == y) return x;
	for (int i = 10; i >= 0; i--) {
		if (pp[i][x] != pp[i][y]) {
			x = pp[i][x];
			y = pp[i][y];
		}
	}
	return pp[0][x];
}
int onr(int x, int y) {
	int l = lca(x, y);
	return y == l;
}
int get(int x, int s) {
	int res = -1;
	if (a[x] < s || !onr(x, a[x])) {
		res = x;
	}
	for (int i = 0; i < e[x].size(); i++) {
		int y = e[x][i];
		int f = get(y, s);
		if (res < f) res = f;
	}
	return res;
}
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		scanf("%d", &p[i]);
		e[p[i]].push_back(i);
		la[p[i]]++;
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = n - 1; i >= 0; i--) {
		if (!la[i] && a[i] == i) {
			int x = i;
			while (x && a[x] == x && !--la[p[x]]) {
				x = p[x];
			}
		}
	}
	for (int i = 0; i < n; i++) {
		pp[0][i] = p[i];
	}
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < n; j++) {
			pp[i+1][j] = pp[i][pp[i][j]];
		}
	}
	pfs(0);
	while (1) {
		int y = 0;
		for (int i = n - 1; i >= 0; i--) {
			wh[a[i]] = i;
			if (a[i] != i) {
				y = i;
				break;
			}
		}
		if (!y) break;
		int x = a[0];
		if (!la[x]) {
			pu(x);
			while (x && a[x] == x && !--la[p[x]]) {
				x = p[x];
			}
			continue;
		}
		int q = get(x, x);
		pu(q);
	}
	printf("%d\n", ansn);
	for (int i = 0; i < ansn; i++) {
		printf("%d\n", ans[i]);
	}
	return 0;
}


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: usize = read();
    let s: usize = read();

    let mut ai: Vec<String> = vec![s.to_string(); k];
    if s != 1000000000 {
        ai.extend(vec![(s+1).to_string(); n-k]);
    } else {
        ai.extend(vec![(s-1).to_string(); n-k]);
    }

    println!("{}", ai.join(" "));
}


Measured memory_bytes: 12540
var n,k,i,j,ans:longint;
var a:array[0..100] of longint;
procedure dfs(d:longint);
var i:longint;
begin
  if d>n then
  begin
    if a[n]<ans then ans:=a[n];
    exit;
  end;
  a[d]:=a[d-1]*2;dfs(d+1);
  a[d]:=a[d-1]+k;dfs(d+1);
end;
begin
  read(n,k);ans:=2147483647;
  a[0]:=1;dfs(1);writeln(ans);
end.

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int x, a;
	cin >> x >> a;
	if (x < a)  cout << "0\n";
	else cout << "10\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x; cin >> x;
    cout << (x >= 30 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int con=0;

		for (int i = 0; i < str1.length(); i++) {
			char c1 = str1.charAt(i);
			char c2 = str2.charAt(i);
			if (c1 == c2) {
				con++;
			}
		}
		System.out.println(con);
	}

}

Measured memory_bytes: 35624
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

typedef struct
{
  ll b;
  ll c;
} hoge;

int downll_hoge(const void *aa, const void *bb) { return ((hoge *)aa)->c < ((hoge *)bb)->c ? 1 : ((hoge *)aa)->c > ((hoge *)bb)->c ? -1 : 0; }

ll a[100005];
int main()
{
  ll n, m, ans = 0;
  scanf("%lld%lld", &n, &m);
  hoge fuga[m];
  for (ll i = 0; i < n; i++)
  {
    ll aaa;
    scanf("%lld", &aaa);
    a[i] = aaa;
    ans += aaa;
  }
  sortup(a, n);
  for (ll i = 0; i < m; i++)
  {
    ll b, c;
    scanf("%lld%lld", &b, &c);
    fuga[i].b = b, fuga[i].c = c;
  }
  qsort(fuga, m, sizeof(hoge), downll_hoge);
  ll j = 0;
  for (ll i = 0; i < n; i++)
  {
    if (!fuga[j].b)
    {
      i--;
      j++;
      continue;
    }

    if (a[i] >= fuga[j].c || j >= m)
      break;

    ans += (fuga[j].c - a[i]);
    fuga[j].b--;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 4084
S = str(input())
m =0
maxi = 0
for i in range(0,len(S)):
    if S[i] == 'A' or S[i] == 'G'or S[i] == 'C'or S[i] == 'T' :
        m = m + 1 
        maxi = max(maxi,m)
    else:
        m = 0
        maxi = maxi
print(maxi)



Measured memory_bytes: 2940
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	string s;
	cin>>s;
	int n=s.size();
	ll sum=0;
	for (int i = 0; i < (1 << n - 1); i++) {
		ll x = s[0] - '0';
		for (int j = 0; j < n - 1;j++) {
			if (i & (1 << j)) {
				sum += x;
				x = 0;
			}
			x = x*10+s[j + 1]-'0';
		}
		sum+=x;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define rall(n) std::rbegin(n), std::rend(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void init() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
}

void calc() {

	Int N, K; std::cin >> N >> K;
	std::vector<bool> flag(N, false);
	rep(i, K) {
		Int d; std::cin >> d;
		rep(j, d) {
			Int A; std::cin >> A;
			flag[A - 1] = true;
		}
	}

	Int ans = 0;

	rep(i, N) {
		if (!flag[i])ans++;
	}

	std::cout << ans;

}


int main() {

	init();
	calc();

	return 0;
}

Measured memory_bytes: 3656
/*
   Author: Shivam Shukla
   Problem URL: 
*/
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
 
const int MOD=1e9+7;
const int MAX=1e5+5;
const double PI= acos(-1.0);
const long double EPS=1e-10;
const int64_t INF=1e18+10;
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0)
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vi vector<int>
#define vl vector<ll>
#define vs vector<str>
#define vc(x) vector<x>
#define mapll map<ll,ll>
#define mapib map<int,bool>
#define mapiv map<int,vector>
#define mapsi map<string,int>
#define repa(i,n) for(ll i=0;i<n;i++)
#define dowa(i,n) for(ll i=n;i>=0;i--)
#define reps(i,j,k,s) for(ll i=j;i<k;i+=s)
#define downs(i,j,k,s) for(ll i=j;i>=k;i-=s)
#define trv(i,x) for(auto i:x)
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define str string 
#define dub double
#define pqmax priority_queue<ll>
#define pqmin priority_queue<ll,vl,greater<ll> >
 
template<typename t> t lcm(t a, t b) {return (a*b)/__gcd(a,b);}
template<typename t> t gcd(t a, t b) {return __gcd(a,b);}
template<typename t> t mul_mod(t a, t b, t m){t res=((a%m)*(b%m)%m); return res;}
template<typename t> t add_mod(t a, t b, t m){t res=((a%m)+(b%m))%m; return res;}
template<typename t> t pow(t a,t b,t m) {t res=1;while(b){if(b&1) res=mul_mod(res,a,m);a=mul_mod(a,a,m), b>>=1;} return res%m;}
template<typename t> vc(t) num_vec(t num) {t res; while (num) res.pb(num%10), num/=10; return res;}
template<typename t> t vec_num(t vec) {t res=0; ll mul=1; repa(i,sz(vec)) res=vec[i]*mul, mul*=10; return res;}
 

int32_t main(int argc,char** argv){
	fastio();
	auto tstart= clock();
    
    /* Code Starts Here */
    int n,m;cin>>n;
    vi a(n); repa(i,n) cin>>a[i];
    cin>>m;
    vpii d(m); repa(i,m) cin>>d[i].ff>>d[i].ss;

    ll s = 0;
    trv(i,a) s+=i;

    repa(i,m)
       cout<<(s-a[d[i].ff-1]+d[i].ss)<<endl;

    /* Code Ends Here */

    cerr<<setprecision(2)<<fixed<<"Time elapsed: "<<(double)(clock() - tstart)/CLOCKS_PER_SEC<<endl; 
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   int n;cin>>n;
   VEC(int,v,n);
   sort(ALL(v));
   cout<<v[n-1]-v[0];
}



Measured memory_bytes: 256
L,R=map(int,input().split())
l=L%2019
r=R%2019
if R-L>2018:
  print(0)
else:
  if l>r:
    print(0)
  else:
    ans=2019
    for i in range(r-l):
      for j in range(r-l-i):
        x=((l+i)*(l+i+j+1))%2019
        ans=min(ans,x)
    print(ans)

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a.at(i);
    }
    int max = 0;
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j < n;j++){
            int memo = abs(a.at(i) - a.at(j));
            if(memo > max)max = memo;
        }
    }
    cout << max << endl;
}

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

int N;
string S;

unordered_set<int> keta1, keta2, keta3;

signed main()
{
  cin >> N;
  cin >> S;

  for(int i = (int)S.size()-1; i>=0; i--) {
    int d = S[i] - '0';
    for(auto k2 : keta2) keta3.insert(k2 + d*100);
    for(auto k1 : keta1) keta2.insert(k1 + d*10);
    keta1.insert(d);
  }
  cout << keta3.size() << endl;
}


Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size()-1;
    if(s[n] == '1' or s[0] == '0') {
        cout << -1 << endl;
        return 0;
    }

    s = s.substr(0, n);
    string t = s;
    reverse(all(t));
    list<int> lst;
    vector<list<int>::iterator> itr(n);
    rep(i, n) {
        if(s[i] != t[i]) {
            cout << -1 << endl;
            return 0;
        }
        if(s[i] == '0') {
            itr[i] = prev(lst.end());
        } else {
            lst.back() = i+1;
            lst.push_back(i+2);
            itr[i] = prev(lst.end());
        }
    }

    rep(i, n) {
        cout << i+1 << ' ' << *itr[i] << '\n';
    }
}

Measured memory_bytes: 7288
#define DREP(i, s, e) for(int i = s; i >= e ;i--)
#define  REP(i, s, e) for(int i = s; i <= e ;i++)

#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)

#include <iostream>
#include <cstring>
#include <cstdio>
#include <bitset>

using namespace std;
const int maxn = 100 + 5 << 1, N = 1e7;

int n, x[maxn];

bitset <N + 5> notp, s;
int p[N], p_cnt;
inline void init()
{
	notp[1] = 1;
	REP(i, 2, N)
	{
		if (!notp[i]) p[++p_cnt] = i;
		REP(j, 1, p_cnt)
		{
			if (i * p[j] > N) break;
			notp[i * p[j]] = 1;
			if (i % p[j] == 0) break;
		}
	}
}
int a[maxn], b[maxn], cntA, cntB;
bitset <maxn> G[maxn];

int match[maxn], vis[maxn];
int dfs(int x)
{
	REP(i, 1, cntB)
		if (G[x][i] && !vis[i])
		{
			vis[i] = 1;
			if (!match[i] || dfs(match[i])) return match[i] = x;
		}
	return 0;
}

int main()
{
#ifdef CraZYali
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif
	init();
	cin >> n;
	REP(i, 1, n)
	{
		scanf("%d", x + i);
		s.flip(x[i]);
	}
	REP(i, 1, N + 1)
		if (s[i] != s[i-1]) i & 1 ? a[++cntA] = i : b[++cntB] = i;
	REP(i, 1, cntA)
		REP(j, 1, cntB)
		if (!notp[abs(a[i] - b[j])]) G[i][j] = 1;
	int ans(0), temp(0);
	REP(i, 1, cntA)
	{
		memset(vis, 0, sizeof(vis));
		temp += (dfs(i) > 0);
	}
	ans += cntA - temp >> 1 << 1;
	ans += cntB - temp >> 1 << 1;
	ans += temp;
	if ((cntA & 1) ^ (temp & 1)) ans += 3;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6912
import sys
n = int(input())
A = list(map(int,input().split()))
if A.count(0)>0:
    print(0)
else:
    ANS = 1
    for i in range(n):
        ANS *= A[i]
        if ANS > 10**18:
            print(-1)
            sys.exit()
    print(ANS)

Measured memory_bytes: 21744
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    double d, i;
    d = sc.nextDouble();
    if(d < 1)out.println(d * Math.sqrt(2));
    else if(d < Math.sqrt(2))out.println("2");
    else if(d < 2)out.println(d * Math.sqrt(2));
    else if(d < Math.sqrt(2) * 1.5)out.println("3");
    else out.println(d * Math.sqrt(2));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 28012
import java.util.Scanner;

public class Main {

    private static Scanner scan;

    private static void start() {
        scan = new Scanner(java.lang.System.in);
    }

    private static void finish() {
    }

    public static void main(String[] args) {
        start();

        int m = scan.nextInt();
        System.out.println(48 - m);

        finish();
    }
}


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

# スペース区切りの入力を読み込んで数値リストにして返します。
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 log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,p = get_nums_l()
s = input()
X = list(map(int, list(s)))
n = len(s)

if p in (2,5):
    ans = 0
    for i,x in enumerate(X):
        if x%p == 0:
            ans += i+1
    print(ans)
else:
    ruiseki = [0] * (n+1)
    for i in (range(n-1, -1, -1)):
        ruiseki[i] = (X[i] * pow(10, (n-i-1), p) + ruiseki[i+1]) % p

    # log(ruiseki)

    ans = 0
    count = defaultdict(int)

    for x in ruiseki:
        # log(count[x])
        ans += count[x]
        count[x] += 1
    # log(count)
    print(ans)






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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	long long a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a+n, greater<long long>());

	long long ans = 0;
	priority_queue<pair<long long, long long>> q;
	q.push(make_pair(a[0], a[0]));
	for (int i = 1; i < n; i++) {
		auto e = q.top();
		ans += e.first;
		q.pop();
		q.push(make_pair(min(e.first, a[i]), max(e.first, a[i])));
		q.push(make_pair(min(e.second, a[i]), max(e.second, a[i])));
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define MOD 1000000007

int n, x, ans, dp[5005][5005];
set<int> s, se;

void add(int& a, int b) {
	a += b;
	if (a >= MOD)
		a -= MOD;
}

int main() {
	s.insert(0);
	scanf("%d%d", &n, &x);
	dp[0][1] = 2;
	for (int i = 1; i <= n + 1; i++)
		se.insert(i);
	for (int i = 0; i < n; i++) {
		int tmp;
		scanf("%d", &tmp);
		if (i) {
			if (tmp > *s.rbegin()) {
				for (int j = 0; j <= i; j++)
					add(dp[i][j + 1], dp[i - 1][j]);
				if (*s.rbegin() < *se.begin())
					for (int j = 0; j <= i; j++)
						add(dp[i][i - j + 1], dp[i - 1][j]);
			} else if (tmp == *se.begin())
				for (int j = 0; j <= i; j++)
					add(dp[i][j], dp[i - 1][j]);
		}
		s.insert(tmp);
		se.erase(tmp);
		// for (int j = 0; j <= n; j++) for (auto& k : dp[j]) printf("dp[%d][%d][%d]=%d\n", i, j, k.first + dj[j], k.second);
	}
	for (int i = n - x; i <= x; i++)
		add(ans, dp[n - 1][i]);
	printf("%d\n", ans);
}



Measured memory_bytes: 70276
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;
    for(int i = 0; i < N; i++){
      int a = Integer.parseInt(sc.next());
      if(a >= K){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 45252
import numpy as np
import itertools

n, m, x = map(int, input().split())
table = [[0 for i in range(m+1)] for j in  range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for j in range(m+1):
        table[i][j] = tmp[j]
        
table = np.array(table)

ans = float('inf')
for i in range(1, n+1):
    choices = list(itertools.combinations(range(n), i))
    for choice in choices:
        score = np.array([0 for i in range(m+1)])
        for c in choice:
            score += table[c]
        if all(score[1:] >= x):
            ans = min(ans, score[0])
            
if ans == float('inf'):
    ans = -1
print(ans)

Measured memory_bytes: 27604
using System;

namespace ABC152D
{
    public class EmptyClass
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            var table = new int[10, 10];
            for (int i = 1; i <= n; i++)
            {
                table[FirstDigit(i), i % 10]++;
            }

            long result = 0;
            for (int i = 1; i <= n; i++)
            {
                result += table[i % 10, FirstDigit(i)];
            }
            Console.WriteLine(result);
        }

        static int FirstDigit(int num)
        {
            while (num >= 10)
            {
                num /= 10;
            }
            return num;
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
    int64_t l, r;
    cin >> l >> r;

    if (max(0L, l - 1) / 2019 != r / 2019) {
        cout << 0 << endl;
        return 0;
    }

    int64_t m = 2019;
    for (auto i : irange(l, r + 1)) {
        for (auto j : irange(i + 1, r + 1)) {
            m = min(m, (i * j) % 2019);
        }
    }

    cout << m << endl;
}


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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 200005;
int counter[maxn]{0};
vi edge[maxn + 1];

void dfs(int v, int p, int s) {
	counter[v] += s;
	for(auto a : edge[v]) {
		if(a != p) { 	            
			dfs(a, v, counter[v]);
		}
	}
}	
int main() {                          
	int n; int q; scanf("%d%d", &n, &q);
	forn(i, n - 1) {
		int a, b; scanf("%d%d", &a, &b);
		edge[a].pb(b);
		edge[b].pb(a);
	}
	forn(i, q) {
		int a, b; scanf("%d%d", &a, &b);
		counter[a] += b;
	}
	dfs(1, -1, 0);
	for1(i, n) {
		printf("%d ", counter[i]);
	}
	return 0;
}



Measured memory_bytes: 23424
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==b[i] and b[i]==c[i]){
            continue;
        }else if(a[i]==b[i] or b[i]==c[i] or c[i]==a[i]){
            ans++;
        }else{
            ans+=2;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		new Main().run();
	}
	
	Scanner scanner = new Scanner(System.in);
	int m;
	int[][][] tile = new int[26][2][2];
	boolean[][] cantGet =new boolean[26][2];
	int score = 0;
	
	void run() {
		
		m = scanner.nextInt();
		scanner.nextInt();
		
		for (int color = 0; color < 26; color ++) {
			
			tile[color][0][0] = -1;
			cantGet[color][0] = false;
			cantGet[color][1] = false;
		}
		
		for (int y = 0; y < m; y ++) {
			
			char[] line = scanner.next().toCharArray();
			
			for (int x = 0; x < line.length; x ++) {
				
				if(line[x] != '.') {
					
					int color = line[x] - 'A';
					int index = (tile[color][0][0] == -1) ? 0: 1;
					tile[color][index][0] = x;
					tile[color][index][1] = y;
				}
			}
		}
		
		for (int color = 0; color < 26; color ++) {
			
			if (tile[color][0][0] != -1) {
				
				tryGet(color);
			}
		}
		
		System.out.println(score * 2);
	}
	
	boolean tryGet(int color) {
		
		if (! cantGet[color][0]) {
			
			if ((tile[color][0][0] == tile[color][1][0]
					&& Math.abs(tile[color][0][1] - tile[color][1][1]) == 1)
					|| (tile[color][0][1] == tile[color][1][1]
					&& Math.abs(tile[color][0][0] - tile[color][1][0]) == 1)) {
				
				cantGet[color][0] = true;
				cantGet[color][1] = true;
				return false;
			}
			
			cantGet[color][0] = true;
			if((isEmpty(color, 1, tile[color][0][0], tile[color][0][1], tile[color][1][1])
					&& isEmpty(color, 0, tile[color][1][1], tile[color][0][0], tile[color][1][0]))) {
				
				
				if (tile[color][0][0] == -1) {
					
					return true;
				}
				tile[color][0][0] = -1;
				score ++;
				return true;
			}
			cantGet[color][0] = false;
		}
		
		if (! cantGet[color][1]) {
			
			cantGet[color][1] = true;
			if ((isEmpty(color, 1, tile[color][1][0], tile[color][0][1], tile[color][1][1])
					&& isEmpty(color, 0, tile[color][0][1], tile[color][0][0], tile[color][1][0]))) {
				
				
				if (tile[color][0][0] == -1) {
					
					return true;
				}
				tile[color][0][0] = -1;
				score ++;
				return true;
			}
			cantGet[color][1] = false;
		}
		
		return false;
	}
	
	boolean isEmpty(int skip,int axis, int point, int start, int end) {
		
		
		if (start == end) {
			
			return true;
		}
		
		if (start > end) {
			
			int swap = start;
			start = end;
			end = swap;
		}
		
		for (int color = 0; color < 26; color ++) {
			
			if (color == skip
					|| tile[color][0][0] == -1) {
				
				continue;
			}
			
			for (int index = 0; index < 2; index ++) {
				
				if (tile[color][index][1 - axis] == point
						&& tile[color][index][axis] >= start
						&& tile[color][index][axis] <= end
						&& !tryGet(color)) {
					
					return false;
				}
			}
		}
		
		return true;
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


char cs[10] = {};

int main(void) {

	string s;
	cin >> s;

	int c = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			c = max(0, c - 1);
		}
		else {
			cs[c] = s[i];
			c++;
		}
	}

	for (int i = 0; i < c; i++) {
		cout << cs[i];
	}
	cout << endl;


	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def dist(p1,p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

points = []
N = int(input())
for i in range(N):
    x, y = map(int, input().split())
    points.append((x,y))

cand = []
for i in (-1,0,1):
    for j in (-1,0,1):
        best = -10 ** 9
        bestP = (0,0)
        for p in points:
            val = i * p[0] + j * p[1]
            if val > best:
                best = val
                bestP = p
        cand.append(bestP)
                
best = 0
for i in cand:
    for p in points:
       best = max(best,dist(i,p))
print(best)


Measured memory_bytes: 84364
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b,s;
    cin>>n>>a;
    if(n<10)
    {
        s=100*(10-n)+a;
        {
            cout<<s<<endl;
        }}
        else
        {
         cout<<a<<endl;
        }
}


Measured memory_bytes: 256
#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()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
  while (true) {
    char w;
    scanf("%c", &w);
    if (w == '\n') {
      break;
    } else if (isupper(w)) {
      w = tolower(w);
      cout << w;
    } else if (islower(w)) {
      w = toupper(w);
      cout << w;
    } else {
      cout << w;
    }
  }
  cout << "\n";
}



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

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int[] arrow = new int[3];
        arrow[0] = int.Parse(input[0]);
        arrow[1] = int.Parse(input[1]);
        if (arrow[1]>arrow[0]) { Console.WriteLine(2*arrow[1]-1); }
        else if(arrow[1] == arrow[0]) { Console.WriteLine(2 * arrow[1]); }
        else { Console.WriteLine(2 * arrow[0] - 1); }
    }
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */
long long fac[MAX], facinv[MAX], inv[MAX];
void facinit(){
    fac[0] = fac[1] = 1;
    facinv[0] = facinv[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;
        facinv[i] = facinv[i - 1] * inv[i] % MOD;
    }   
}

long long perm(long long a, long long b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * facinv[a - b] % MOD;
}

long long combi(long long a, long long b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (facinv[b] * facinv[a - b] % MOD) % MOD;
}

int main(){
    facinit();
    lint n, k; cin >> n >> k;
    if(k > n-1) k = n-1;

    vector<lint> vec;
    vec.push_back(1);
    repn(i, k){
        lint x = combi(n-1, i);
        x = x * combi(n, i); x %= MOD;
        vec.push_back(x);
    }
    lint ans = 0;
    rep(i, k+1){
        ans += vec[i]; ans %= MOD;
    }
    out(ans);
}



Measured memory_bytes: 7156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second


int main()
{
    ll n;cin >> n;
    string x;cin >> x;
    ll f1 = x[0]-'0';
    ll f2 = x[2]-'0';
    if(x.length()==4) f2 = f2*10 + x[3]-'0';
    else f2 = f2*10;
    ll ans = f1*n;
    ll r1 = n*f2;
    r1 = r1/100;
    ans = ans + r1;
    cout << ans << endl;
}
    

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	REP(i,max(n,m))
		cout<<min(n,m);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    map<string, long long> m;

    long long ans = 0;
    for (int i = 0; i < N; ++i) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        ans += m[s[i]];
        m[s[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 18176
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    ll n;   cin >> n;
    vector<ll> v;
    ll k = 0;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            v.push_back(0);
            while (n % i == 0) {
                v[k]++;
                n /= i;
            }
            k++;
        }
    }
    if (n > 1)
            v.push_back(1);

    ll ans = 0;
    for (ll i = 0; i < v.size(); i++) {
        ll k = 1;
        while (k*(k+1)/2 <= v[i])
            k++;
        ans += k-1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
N = int(input())
words = [input() for _ in range(N)]

flag = False
for i in range(N-1):
  if words[i][-1] != words[i+1][0]:
    flag = True
  else:
    continue

if len(words) != len(set(words)):
  print("No")
elif flag == True:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
const int d = 365;
//const int d = 5;
int c[26];
int s[d][26];
int last[26] = {0};
bool llast[d][26] = {false};
vector<int> solution(d,-1);
int myscore = 0;


int score(vector<int> t){
    vector<int> last(26,0);
    int ans = 0;
    rep(i,d){
        ans += s[i][t[i]];
        last[t[i]] = i+1;
        rep(j,26) ans -= c[j] * (i+1-last[j]);
        //cout << ans << endl;
    }
    return ans;
}

// p day contest changes q
void better(int p,int q){
    //cout << myscore << endl;
    int origin = solution[p];
    int newscore = myscore - s[p][origin] + s[p][q];
    int before_origin = 0,before_q = 0;
    int res = 0;
    for(int i=0;i<d;i++){
        if(llast[i][origin]) before_origin = i+1;
        if(llast[i][q]) before_q = i+1;
        res += (c[origin] * (i+1-before_origin) + c[q] * (i+1-before_q));
    }

    llast[p][q] = true;
    llast[p][origin] = false;
    before_origin = 0;
    before_q = 0;

    for(int i=0;i<d;i++){
        if(llast[i][origin]) before_origin = i+1;
        if(llast[i][q]) before_q = i+1;
        res -= (c[origin] * (i+1-before_origin) + c[q] * (i+1-before_q));
    }

    //cout << res << endl;

    newscore += res;
    if(newscore > myscore){
        myscore = newscore;
        solution[p] = q;
    }else{
        llast[p][q] = false;
        llast[p][origin] = true;
    }
}




//day 1-index i_day 's contest is k
int nowscore(int i,int k){
    int res = s[i][k];
    int before = last[k];
    last[k] = i+1;
    rep(j,26) res -= c[j] * (i+1-last[j]);
    last[k] = before;
    return res;
}

int main(){
    clock_t start = clock();

    random_device seed_gen;
    mt19937 mt(seed_gen());
    uniform_int_distribution<int> con(0,26-1);
    uniform_int_distribution<int> day(0,365-1);

    int tmp;
    cin >> tmp;
    rep(i,26) cin >> c[i];
    rep(i,d)rep(j,26) cin >> s[i][j];

    for(int i=0;i<d;i++){
        int id = -1;
        int mx = -INF;
        for(int j=0;j<26;j++){
            int res = nowscore(i,j);
            if(mx < res){
                id = j;
                mx = res;
            }
        }
        solution[i] = id;
        last[id] = i+1; 
        llast[i][id] = true;
        myscore += mx;
    }

    clock_t end = clock();

    while(((double)(end - start)/CLOCKS_PER_SEC) < 1){
        better(day(mt),con(mt));
        end = clock();
    }



    rep(i,d) cout << solution[i]+1 << endl;
    /*
    cout << (score(solution) + 1e6) << endl;
    cout << (myscore + 1e6) << endl;
    */

    return 0;
}

Measured memory_bytes: 3688