akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int a[] = new int[n];
		int b[] = new int[n];
		for(int i=0; i<n; i++) a[i]=sc.nextInt();
		for(int i=0; i<n; i++) b[i]=sc.nextInt();
		long ans = 0;
		for(int k=0; k<29; k++) {
			int am[] = new int[n];
			int bm[] = new int[n];
			int t = 1<<(k+1);
			for(int i=0; i<n; i++) {
				am[i]=a[i]%t;
				bm[i]=b[i]%t;
			}
			Arrays.sort(am);
			int cnt = 0;
			t>>=1;
			for(int i=0; i<n; i++) {
				cnt += lowerBound(am, 2*t - bm[i]) - lowerBound(am, t - bm[i]);
				cnt += lowerBound(am, 4*t - bm[i]) - lowerBound(am, 3*t - bm[i]);
			}
			if(cnt % 2 != 0) {
				ans |= (1<<k);
			}
		}
		System.out.println(ans);
		sc.close();
	}

	private int lowerBound(int a[], int v) {
		int l=-1;
		int r=a.length;
		while(l+1<r) {
			int m = (l+r)/2;
			if(a[m]<v) {
				l=m;
			}else {
				r=m;
			}
		}
		return r;
	}
}


Measured memory_bytes: 120304
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;

int main()
{
	int N, K;
	scanf("%d%d", &N, &K);
	long long an = 1;
	for (int i = 1; i < N; i++) {
		an *= K - 1;
	}
	printf("%lld", an*K);
	return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    vector<ll> sumv(n + 2);
    sumv[0] = 0;
    for (ll v = 0; v <= n; v++)
        sumv[v + 1] = sumv[v] + v;
    for (ll i = k; i <= n + 1; i++)
    {
        ll vmin = sumv[i];
        ll vmax = sumv[n + 1] - sumv[n + 1 - i];
        // cout << k << " " << vmin << " " << vmax << endl;

        ans += (vmax - vmin + 1);
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, col[N], pos[N];
char s[N];

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> s + 1;
	n = strlen(s + 1);

	for(int i = 1; i <= n; i++)
		col[s[i] - 'a'] = 1;

	if(n < 26) {
		for(int i = 0; i < 26; i++)
			if(col[i] == 0) {
				cout << s + 1 << (char)('a' + i);
				return 0;
			}
	}

	else {
		memset(col, 0, sizeof col);
		for(int i = 26; i >= 1; i--) {
			col[s[i] - 'a'] = 1;
			pos[s[i] - 'a'] = i;
			for(int j = s[i] + 1 - 'a'; j <= 'z' - 'a'; j++) {
				if(col[j] == 1) {
					swap(s[pos[j]], s[i]);
					s[i + 1] = '\0';
					cout << s + 1;
					return 0;
				}
			}
		}
	}
	cout << -1;
}

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

using namespace std;

inline int input() {
    int x;
    scanf("%d", &x);
    return x;
}

const int maxn = 505;
int f[maxn], g[maxn];
int a[maxn][maxn];

void get(int l, int r) {
    int n = r - l + 1;
    if (n <= 2) {
        a[l][r] = f[n];
        return;
    }
    int mid = l + g[n] - 1;
    get(l, mid);
    get(mid + 1, r);
    for (int i = l; i <= mid; i++)
        for (int j = mid + 1; j <= r; j++)
            a[i][j] = f[n];
}

int main() {
    int n = input();
    f[1] = f[2] = 1;
    for (int i = 3; i <= n; i++) {
        f[i] = 1000000000;
        for (int j = 1; j < i; j++) {
            int v = std::max(f[j], f[i - j]) + 1;
            if (v < f[i]) {
                f[i] = v;
                g[i] = j;
            }
        }
    }

    get(1, n);
    for (int i = 1; i < n; i++) {
        for (int j = i + 1; j <= n; j++)
            printf("%d ", a[i][j]);
        puts("");
    }
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include<limits.h>
using namespace std;
using T = tuple<int,int,int>;

#define gc getchar_unlocked
#define sdi(a, b)   si(a);si(b)
#define FOR(i, n)  for(int i = 0;i < n; i++) 
#define eb emplace_back
#define pb push_back
#define MP make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define rep(i,j,n) for (int i = j; i < n; ++i)
#define repn(i,j,n) for (int i = j; i <= n; ++i)
#define revn(i,j,n) for (int i = j; i >= n; --i)
#define sz(i) i.size()
#define mem(i,v) memset(i,v,sizeof(i))
#define all(v) v.begin(), v.end()
#define endl '\n'
#define int long long
#define INF 1e9
#define ss second
#define ff first
#define vi vector<int>
#define pri(arr,a,b) repn(i,1,a){repn(j,i+1,b){cout<<arr[i][j]<<" ";}cout<<endl;}
 
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<int,pair<int,int>> piii;
 
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
 
const int mod=1e9+7;
//const int mod=998244353;
const int up=1e5+10;
const int MAXN=1e6+10;

int a[2*up];

void solve()
{
    int n;
    cin>>n;
    cin>>a[0];
    int x=a[0];
    rep(i,1,n){
        cin>>a[i];
        x^=a[i];
    }
    rep(i,0,n){
        cout<<(x^a[i])<<" ";
    }
    cout<<endl;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.in", "r", stdin);
    //     freopen("outputf.in", "w", stdout);
    // #endif
    fast_cin();
    int T;
    //sieve();
    //cin>>T;
    T=1;
    int t1=1;
    while(true)
    {  
        
        solve(); 
        t1++;
        if(t1>T)
            break;
    }
}

Measured memory_bytes: 5164
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n, m;
	cin>>n>>m;
	int a=0;
	a+=n*(n-1)/2;
	a+=m*(m-1)/2;
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {

	int N;

	scanf("%d",&N);

	int i, j,k;

	for (i = 1; i < 5000; i++) {
		if ((i + 1)*i / 2 >= N) { break; }
	}
	if ((i + 1)*i / 2 == N) {
		for (j = 1; j <= i; j++) {
			printf("%d\n", j);
		}
	}
	else {
		for (j = 1; j <= i; j++) {
			if (((i + 1)*i / 2) - j == N) {
				break;
			}
		}
		for (k = 1; k <= i; k++) {
			if (k == j) { continue; }
			printf("%d\n",k);
		}
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    map<ll, ll> mp; // boss -> count;
    for (int i = 1; i <= n; i++) {
        mp[i] = 0;
    }
    REP(i, n - 1) {
        ll num; cin >> num;
        mp[num]++;
    }

    for (int i = 1; i <= n; i++) {
        cout << mp[i] << endl;
    }
    return 0;
}

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

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;

  vector<int> cnt(101,0);
  REP(i,1,N+1){
    int tmp=i;
    REP(j,2,tmp+1){
      while(tmp%j==0){
        tmp/=j;
        cnt.at(j)++;
      }
    }
  }

  //3,5,15,25,75
  vector<int> X(5,0);
  rep(i,101){
    int tmp=cnt.at(i);
    if(tmp>=3-1)  X.at(0)++;
    if(tmp>=5-1)  X.at(1)++;
    if(tmp>=15-1)  X.at(2)++;
    if(tmp>=25-1)  X.at(3)++;
    if(tmp>=75-1)  X.at(4)++;
  }

  int ans=0;
  //3,5,5
  ans+=X.at(1)*(X.at(1)-1)/2 * (X.at(0)-2);
  //3.25
  ans+=X.at(3)*(X.at(0)-1);
  //5,15
  ans+=X.at(2)*(X.at(1)-1);
  //75
  ans+=X.at(4);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
//
// Created by sark2 on 14-01-2020.
//

#include "bits/stdc++.h"

using namespace std;
#define pb push_back
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define CASES int t;cin>>t;while(t--)

using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;

int main() {
    IOS

    int n; cin>>n;

    vector<int> a(n);
    for(int& x : a)cin>>x;

    int cur = 1;

    int ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i] == cur){
            cur++;
        }else{
            ans++;
        }
    }

    cout<<(ans == n ? -1 : ans)<<"\n";


}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);


bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}

void fun(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        for(int i=0;i<n;i++)
			cout<<"ACL";
    }
    return 0;
}

Measured memory_bytes: 7832
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
int MOD=1000000007;
struct Node{
    int no;
    int dist;
    vector<Node*> next;
    void build(int i){
        no=i;
        dist=0;
    }
};
Node node[100050];
int dfs(Node cur){
    if(cur.next.size()==0){
        node[cur.no].dist=0;
        return 0;
    }
    else{
        if(cur.dist!=0){
            return cur.dist;
        }
        int res=0;
        int num=cur.next.size();
        rep(i,num){
            res=max(res,dfs(*cur.next[i]));
        }
        node[cur.no].dist=res+1;
        return res+1;
    }
}
signed main(){
    int n,m;cin>>n>>m;
    rep1(i,n){
        node[i].build(i);
    }
    rep(i,m){
        int x,y;cin>>x>>y;
        node[x].next.push_back(&node[y]);
    }
    int res=0;
    rep1(i,n){
        res=max(res,dfs(node[i]));
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 13440
#include <stdio.h>

int main()
{
    int iInputR, iInputC, iInputNum[101][101];
    int i, j;
    int sum, sum2 = 0;

    scanf("%d %d", &iInputR, &iInputC);

    for (i = 0; i < iInputR; i++) {
        for (j = 0; j < iInputC; j++) {
            scanf("%d", &iInputNum[i][j]);
        }
    }

    for (i = 0; i < iInputR; i++) {
        sum = 0;
        for (j = 0; j < iInputC; j++) {
            sum += iInputNum[i][j];
            printf("%d ", iInputNum[i][j]);
        }
        sum2 += sum;
        printf("%d\n", sum);
    }

    for (i = 0; i < iInputC; i++) {
        sum = 0;
        for (j = 0; j < iInputR; j++) {
            sum += iInputNum[j][i];
        }
        printf("%d ", sum);
    }
    printf("%d\n", sum2);

    return 0;
}


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

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  
  if((a + b) == c || (a + c) == b || (b + c) == a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main()
{
	int n,k;
    cin>>n>>k;
   int d;
    int a[200]={0};
    int count=0;
    while(k--)
    {
        int d;
        cin>>d;
        while(d--)
        {
            int x;
            cin>>x;
            if(a[x]==0)
                count++;
            a[x]++;
        }
    }
        cout<<n-count<<endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<cstring>
#include<string>
#include<algorithm>
#define mod 1000000007

using namespace std;
typedef long long int lli;

int t, n, k;
int a[50 + 5][30 + 5];
int b[50 + 5][30 + 5];
int res;

int main() {
	int h,w;
	string map[1000];
	int dp[1000][1000];
	memset(dp,0,sizeof(dp));
	scanf("%d%d", &h,&w);
	for (int i = 0; i < h; i += 1) {
		cin>>map[i];
		if(i==0){
		    int j=1;
		    while(true){
		        if(map[i][j]=='#'||j==(w)){
		            break;
		        }
		        dp[i][j]=1;
		        j+=1;
		    }
		}
	}
	dp[0][0]=1;
	for (int i = 1; i < h; i += 1) {
		for(int j=0;j<w;j+=1){
		    if(j==0){
		        if(map[i-1][j]=='.'){
		            dp[i][j]=dp[i-1][j];   
		        }
		        continue;
		    }
		    if(map[i-1][j]=='.'){
		        dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
		    }
		    if(map[i][j-1]=='.'){
		        dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
		    }
		}
	}
	printf("%d",dp[h-1][w-1]);
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int k;cin>>k;

  set<string> sets;

  for(int i=0;i<s.size();i++){
    for(int j=1;j<=k&&i+j<=s.size();j++){
      sets.insert(s.substr(i,j));
    }
  }
  vector<string> ans(sets.begin(),sets.end());
  cout<<ans[k-1]<<endl;
  return 0;
}


Measured memory_bytes: 1792
n , m = map(int, input().split())
# ab = [list(map(int, input().split())) for _ in range(m)]
ranges = [[] for _ in range(m)]
for i in range(m):
    a,b = map(int,input().split())
    ranges[i] = [a,b]
ranges = sorted(ranges, key = lambda x:x[1])
MAX = - float("inf")
ans = 0
for i in range(m):
    if MAX < ranges[i][0]:
        MAX = ranges[i][1] - 0.1
        ans += 1
print(ans)

Measured memory_bytes: 22116
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,m,n,i,f=0,j,ans=0,x,y;
    cin >> n >> x >> y ;
    ll a[n+1][n+1];
    memset(a,0,sizeof(a));
    for(i=1;i<=n;++i) 
    {
        for(j=i+1;j<=n;++j)
        {
            a[i][j]=j-i;
            //a[j][i]=j-i;
        }
    }
    a[x][y]=1;
    a[y][x]=1;
    map<ll,ll> ma;
    for(i=1;i<=n;++i) 
    {
        for(j=i+1;j<=n;++j)
        {
            a[i][j]=std::min(a[i][j],abs(i-x)+a[x][y]+abs(y-j));
            //a[j][i]=a[i][j];
            ma[a[i][j]]++;
        }
    }
    for(i=1;i<n;++i) cout << ma[i] << endl ;
    return 0;
}

Measured memory_bytes: 31616
taxs = input().split(" ")
 
a = int(taxs[0])
b = int(taxs[1])
 
product_min = int(a / 0.08 + 0.5)
product_max = int((a+1) / 0.08)

setflg = 0
for product in range( product_min, product_max ):
  bpred = int(product * 0.1)
  if( bpred == b ):
    print( product )
    setflg=1
    break

if setflg==0:
  print( -1 )

Measured memory_bytes: 3064
mod = 10**9+7

X, Y = map(int, input().split())


def comb(n, r, mod):
    if r < 0 or n < r:
        return 0
    return fact[n]*pow(fact[r], mod-2, mod) * pow(fact[n-r], mod-2, mod) % mod


if (X + Y) % 3 != 0:
    ans = 0
else:
    n = (X + Y) // 3
    r = min(X, Y)-n
    # nCr
    fact = [1, 1]
    for i in range(2, n+1):
        fact.append(fact[-1] * i % mod)
    ans = comb(n, r, mod)

print(ans)


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

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int a, b, c, k;
	scanf("%d%d%d%d%d", &a, &b, &c, &k);
	while (a >= b) {
		b *= 2;
		--k;
	}
	while (b >= c) {
		c *= 2;
		--k;
	}
	printyn(k >= 0);

	Please AC;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using ll=long long;

ll num[4][1010][1010];
ll sum[4][1010];

int main(void){
	ll d[3],p[3],n;
	rep(i,3) cin >> d[i];
	rep(i,3) cin >> p[i];
	cin >> n;

	num[0][0][0]=1LL;

	rep(cur,3){
		const int nxt=cur+1;
		
		rep(i,1,n) rep(j,n) num[cur][i][(j+1)%n]=num[cur][i-1][j];
		rep(i,n)rep(j,n) sum[cur][j]+=num[cur][i][j];

		ll l=p[cur],r=d[cur]-1-p[cur];

		rep(j,n) num[nxt][0][j]+=(l/n+r/n)*sum[cur][j];
		rep(i,l%n+1)rep(j,n) num[nxt][0][j]+=num[cur][i][j];
		rep(i,r%n+1)rep(j,n) num[nxt][0][j]+=num[cur][i][j];
		rep(j,n) num[nxt][0][j]-=num[cur][0][j];
	}

	rep(i,n) cout << (i?" ":"") << num[3][0][i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 26772
class Robot:
    def __init__(self, left, right):
        self.left = left
        self.right = right
    
    def __lt__(self, other):
        return self.right < other.right

n = int(input().rstrip())
robos = [None] * n

for i in range(n):
    line = input().rstrip().split(' ')
    robos[i] = Robot(int(line[0]) - int(line[1]), int(line[0]) + int(line[1]))

robos.sort()

cur = -1000000000
ans = 0
for i in range(n):
    if cur <= robos[i].left:
        ans += 1
        cur = robos[i].right

print(ans)

Measured memory_bytes: 28780
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vb vector< bool >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sort(a) sort(a.begin(),a.end())
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define moddd (1000*1000*1000+9)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
//cout<<fixed<<setprecision(15)<<ans;
 
template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++){
		cout<<vec[i]<<" ";
	}
	cout<<endl;
}

int main(){
	std::ios::sync_with_stdio(false); 
	int ttt=1;
	//cin>>ttt;
	while(ttt--){
		ll n,i;
		cin>>n;
		vl arr(n);
		for(i=0;i<n;i++){
			cin>>arr[i];
		}
		if(arr[0]!=0){
			cout<<"-1";
			return 0;
		}
		ll ans=0;
		for(i=1;i<n;i++){
			if(arr[i]>arr[i-1]+1){
				cout<<"-1";
				return 0;
			}
			else if(arr[i]==arr[i-1]+1){
				ans++;
			}
			else{
				ans+=arr[i];
			}
		}
		cout<<ans;
	}
	return 0;
} 
 


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

int main(){
    int a,b,c,d;
    string ans;
    cin >> a >>b >> c;
    
    //calc
    if(a < b){
        d = b - a;
        if(c < a + d && c > a){
            ans = "Yes";
        }
        else{
            ans = "No";
        }
    }
    else{
        d = a - b;
        if(c < b + d && c > b){
            ans = "Yes";
        }
        else{
            ans = "No";
        }
    }
    
    //out
    cout << ans << endl;   
    
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main()
{
    string s[3];
    rep(i, 3) {
        cin >> s[i];
        reverse(all(s[i]));
    }

    char next = 'a';
    while(true) {
        int id = next - 'a';
        if(s[id].empty()) {
            cout << char(next - 'a' + 'A') << endl;
            return 0;
        }
        next = s[id].back();
        s[id].pop_back();
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}


template<class T> 
class UnionFind {
  using _Tp = T;
  using size_type = std::size_t;
public:
  vector<int> par;
  vector<int> rank;
  vector<_Tp> diff_weight;
 
  UnionFind(int n = 1, _Tp SUM_UNITY = 0) {
    init(n, SUM_UNITY);
  }

  const _Tp & operator[] (size_type i) {
    root(i);
    return diff_weight[i];
  }
 
  void init(int n = 1, _Tp SUM_UNITY = 0) {
    par.resize(n); rank.resize(n); diff_weight.resize(n);
    for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }
 
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      int r = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
    }
  }
 
  _Tp weight(int x) {
    root(x);
    return diff_weight[x];
  }
 
  bool issame(int x, int y) {
    return root(x) == root(y);
  }
 
  bool merge(int x, int y, _Tp w) {
    w += weight(x); w -= weight(y);
    x = root(x); y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y), w = -w;
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    diff_weight[y] = w;
    return true;
  }
 
  _Tp diff(int x, int y) {
    return weight(y) - weight(x);
  }
};


int main() {
  int n,q;
  cin >> n >> q;
  UnionFind<int> uf(n+1);

  rep(i, q) {
    int j;
    cin >> j;
    int x,y,z;
    if (j) {
      cin >> x >> y;
      if (uf.issame(x,y)) {
        cout << uf[y] - uf[x] << endl;
      } else {
        cout << "?" << endl;
      }
    } else {
      cin >> x >> y >> z;
      uf.merge(x,y,z);
    }
  }
}



Measured memory_bytes: 3888
N = int(input())
[T,A] = list(map(int,input().split()))
H = list(map(int,input().split()))

temp = [0]*N
for i in range(N):
    temp[i] = T - H[i]*0.006

sa = [0]*N
for i in range(N):
    sa[i] = abs(A-temp[i])

print(sa.index(min(sa))+1)

Measured memory_bytes: 38384
using System.Collections.Generic;
using static System.Console;

class Program {
    static void Main() {
        var n = NextInt();
        var a = NextInt();
        var b = NextInt();

        if ((b - a) % 2 == 0) {
            WriteLine("Alice");
        } else {
            WriteLine("Borys");
        }
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#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 i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
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 i64 P = 1000000000 + 7;

const int maxn = 5100;
i64 dp[maxn][2];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n, a, b;
    cin >> n >> a >> b;
    i64 ans;
    i64 d2 = 1;
    forn(i, n) (d2 *= 2) %= P;
    if (a == b) {
        vi64 dp(n + 1);
        dp[0] = 1;
        for1(i, n) for1(j, a - 1) if (j <= i) (dp[i] += dp[i - j]) %= P;
        ans = d2 - 2 * dp[n];
        ans %= P;
        if (ans < 0) ans += P;
    } else {
        if (a > b) swap(a, b);
        vi64 sh(b + 1);
        sh[1] = 1;
        forn(i, b + 1) for1(j, b - i) {
            int l = a, r = j - 1;
            if (l <= r) (sh[i + j] += sh[i] * (r - l + 1)) %= P;
        }
        forn(i, b) (sh[i + 1] += sh[i]) %= P;
//        forn(i, b) cerr << sh[i] << ' ';
//        cerr << '\n';

        dp[0][0] = 1;
        forn(i, n + 2) {
//            forn(z, 2) cerr << dp[i][z] << ' ';
//            cerr << '\n';
            for1(j, a - 1) if (i + j <= n + 2) (dp[i + j][0] += dp[i][1]) %= P;
            for1(j, b) {
                if (j == b && i && i + j < n + 2) continue;
                if (i + j <= n + 2) (dp[i + j][1] += dp[i][0] * sh[j]) %= P;
            }
        }

        ans = d2;
        (ans -= dp[n + 2][1]) %= P;
        if (ans < 0) ans += P;
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 100005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(int N, int pos){return (bool)(N & (1<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    ll h, n;
    cin>>h>>n;
    ll a[n+5], sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=h)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  string S;
  cin >> S;

  int N=S.length();

  char pre='!';

  int K=0;

  rep(i,N){
    char c=S[i];

    if(c == pre){
      pre='?';
    }
    else{
      if(pre=='?') pre='!';
      else pre=c;
      K++;
    }
  }

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int n,t,l,b;
  while(cin>>n>>t>>l>>b,n){
    vector<int> s(n+1,0);
    for(int i=0;i<l;i++){
      int u;
      cin>>u;
      s[u]=1;
    }
    for(int i=0;i<b;i++){
      int u;
      cin>>u;
      s[u]=2;
    }
    vector< vector< double > > dp(t+1,vector<double>(n+1,0));
    dp[0][0]=1.0;
    for(int i=0;i<t;i++){
      for(int j=0;j<n;j++){
	if(s[j]!=1){
	  for(int k=1;k<=6;k++){
	    int x=j+k;
	    if(x>n) x=n-(x-n);
	    if(s[x]==2) dp[i+1][0]+=dp[i][j]/6.0;
	    else dp[i+1][x]+=dp[i][j]/6.0;
	  }
	}else if(i+2<=t){
	  for(int k=1;k<=6;k++){
	    int x=j+k;
	    if(x>n) x=n-(x-n);
	    if(s[x]==2) dp[i+2][0]+=dp[i][j]/6.0;
	    else dp[i+2][x]+=dp[i][j]/6.0;
	  }
	}
      }
    }
    double ans=0;
    for(int i=0;i<=t;i++) ans+=dp[i][n];
    cout<<fixed<<setprecision(12)<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3272
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
ind_M = a.index(a_max)
tmpl = a
tmpl.pop(ind_M)
for i in range(n):
    if i != ind_M:
        print(a_max)
    else:
        print(max(tmpl))

Measured memory_bytes: 68568
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		int count = 0;
		for (int i = 0; i < n - 2; i++) {
		    for (int j = i + 1; j < n - 1; j++) {
		        for (int k = j + 1; k < n; k++) {
		            if (arr[i] + arr[j] > arr[k] && arr[i] != arr[j] && arr[j] != arr[k]) {
		                count++;
		            }
		        }
		    }
		}
		System.out.println(count);
	}
	
}


Measured memory_bytes: 36180
N, M = map(int, input().split())
ac, wa = 0, 0

ac_list = [0] * 10**6
wa_list = [0] * 10**6
for i in range(M):
    p, s = input().split()

    if ac_list[int(p)]:
        continue

    if s == "AC":
        ac_list[int(p)] = 1
        ac += 1
        wa += wa_list[int(p)]
    else:
        wa_list[int(p)] += 1

print(ac, wa)


Measured memory_bytes: 18676
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    int c5 = 0, c7 = 0;

    c5 += a == 5; c7 += a == 7;
    c5 += b == 5; c7 += b == 7;
    c5 += c == 5; c7 += c == 7;

    OUT(c5 == 2 && c7 == 1 ? "YES" : "NO");

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a[31];
  int n,w;
  int i,j;
  int x,y,tmp;
  char c;
  scanf("%d",&w);
  scanf("%d",&n);
  for(i=1;i<=w;i++)a[i]=i;
  for(i=0;i<n;i++){
    scanf("%d,%d",&x,&y);
    tmp=a[x];
    a[x]=a[y];
    a[y]=tmp;
   
  }
  for(i=1;i<=w;i++)printf("%d\n",a[i]);
  return 0;
}

Measured memory_bytes: 596
/***************************************************************
	File name: AtCoder137D.cpp
	Author: ljfcnyali
	Create time: 2019年08月11日 星期日 15时43分20秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
typedef long long LL;

const int maxn = 100010;

int n, m, ans;
struct node
{
    int a, b;
    bool operator < (const node &x) const { return a < x.a; }
} a[maxn];

priority_queue<int> Q;

int main()
{
    scanf("%d%d", &n, &m);
    REP(i, 1, n) scanf("%d%d", &a[i].a, &a[i].b);
    sort(a + 1, a + n + 1);
    int now = 1;
    for ( int i = n; i >= 1; -- i )
    {
        while ( now <= n && i + a[now].a - 1 <= m ) Q.push(a[now ++].b);
        if ( !Q.empty() ) { ans += Q.top(); Q.pop(); }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1660
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b, c, k; cin >> a >> b >> c >> k;
  int mx = max({a, b, c}), ans = a + b + c - mx;
  REP(i, k) mx *= 2;
  cout << ans + mx << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
S = list(str(input()))
ans = []
for s in S:
    i = ord(s)
    if i+N>90:
        i -= 26
    ans.append(chr(i+N))

print(''.join(ans))

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k;

    string n;
    cin >> n;
    int s = 0;
    for(i = 0; i < n.length(); i++) {
        s += n[i] - '0';
    }
    if(s % 9 == 0)
        cout << "Yes" << endl;
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3732
import math

n = int(input())
xyn = [None] * n
for i in range(n):
    xyn[i] = list(map(int, input().split(' ')))

t2t = []

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            dis = math.sqrt((xyn[i][0] - xyn[j][0]) ** 2 + (xyn[i][1] - xyn[j][1]) ** 2)
            t2t.append(dis)

ave = sum(t2t) / len(t2t) * (n - 1)

print(ave)



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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

const int N = 3000 + 5;

int dp[N][N];
string s, t;
int n, m;

int sol(int i, int j) {
    if(i == n || j == m) return 0;

    int &ret = dp[i][j];
    if(ret != -1) return ret;

    if(s[i] == t[j]) return ret = 1 + sol(i + 1, j + 1);

    ret = max(sol(i + 1, j), sol(i, j + 1));
    return ret;
}

void print(int i, int j) {
    if(i == n || j == m) return;

    int ret = sol(i, j);

    if(s[i] == t[j]) {
        cout << s[i];
        print(i + 1, j + 1);
        return;
    }

    int ch1 = sol(i + 1, j);
    int ch2 = sol(i, j + 1);


    if(ch1 == ret) print(i + 1, j);
    else print(i, j + 1);
}

int main(){
    fIO

//    freopen("", "r", stdin);
//    freopen("", "w", stdout);

    memset(dp, -1, sizeof(dp));

    cin >> s >> t;
    n = s.length();
    m = t.length();

    sol(0, 0);
    print(0, 0);

}








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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

string str;
vll numbers;

class BitComb {
 private:
  ll _digits;
  ll _base;
  ll _data[512];
  ll _finished;
  ll _i;

 public:
  BitComb(ll digits, ll base) {
    _digits = digits;
    _base = base;
    _finished = false;
    _i = 0;
    fill_n(_data, 512, 0);
  }

  void next() {
    if (_finished) {
      return;
    }
    for (ll i = 0; i < _digits; i++) {
      if (_data[i] + 1 < _base) {
        _data[i] += 1;
        break;
      } else {
        _data[i] = 0;

        if (i == _digits - 1) {
          _finished = true;
          break;
        }
      }
    }
  }

  ll data(ll index) { return _data[index]; }

  void print() {
    for (ll i = _digits - 1; i >= 0; i--) {
      cout << _data[i];
    }
    cout << endl;
  }

  bool finished() { return _finished; }
};

ll N;

bool ok(ll v0, ll v1, ll v2) {
  ll index = 0;

  for (ll i = 0; i < N; i++) {
    ll v;
    if (index == 0) v = v0;
    if (index == 1) v = v1;
    if (index == 2) v = v2;
    if (numbers[i] == v) {
      index++;
      if (index >= 3) {
        return true;
      }
    }
  }
  return false;
}

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  scanf("%lld", &N);
  cin >> str;

  for (ll i = 0; i < N; i++) {
    numbers.emplace_back(str[i] - '0');
  }

  ll ans = 0;
  auto bc = BitComb(3, 10);
  while (!bc.finished()) {
    // bc.print();
    if (ok(bc.data(0), bc.data(1), bc.data(2))) {
      ans++;
    }
    bc.next();
  }

  cout << ans << endl;
}


Measured memory_bytes: 3948
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	int n;
	cin>>n;
	cout<<(n*(n-1))/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 
const int mxN = 1e5 + 7;
int cnt[mxN];

void solve(){
	int n,m; cin >> n >> m;
	FOR(m){
		int l,r; cin >> l >> r;
		cnt[l] += 1;
		cnt[r+1] -= 1;
	}
	int ans = 0;
	FOR(i,1,n+2){
		cnt[i] += cnt[i-1];
		if(cnt[i] == m) ++ans;
	}
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


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


#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
using lli = long long int;
using ll = long long ;
using ld=long double;
using d= double;

bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}

ll lcm(ll x,ll y){
    return (x*y)/(__gcd(x,y));
}

signed main(){
    fast_IO;
    int t=1;
    //cin>>t;
    while(t--){
         ll l,r;
         cin>>l>>r;
         int ans=100000;
         for(ll i=l;i<r;i++){
             for(ll j=i+1;j<=r;j++){
                 if((i%2019)*(j%2019)%2019==0){
                     cout<<0;
                     return 0;
                 }
                 else if((i%2019)*(j%2019)%2019<ans){
                     ans=(i%2019)*(j%2019)%2019;
                 }
             }
         }
         cout<<ans;
    }   
    return 0;
}


Measured memory_bytes: 3628