akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

            using namespace std;

            #define fastIO  std::ios::sync_with_stdio(false);cin.tie(NULL)
            #define uli unsigned long long int
            #define lli long long int
            #define Lf long double
            #define mod 1000000007
            #define N 21
            #define NN 21
            #define vi vector<int>
            #define vl vector<long>
            #define vll vector<long long>
            #define vc vector<char>
            #define ii <int, int>
            #define ll <long, long>
            #define lll <long long, long long>
            #define loop(i,s,n) for(int i=s;i<n;i++)
            #define loopr(i,n,s) for(int i=n-1;i>=s;i--)
            #define pb push_back

            lli modadd(lli n,lli m){
                lli sum = ((n+m)%mod+mod)%mod;
                return sum;
            }

            lli modsub(lli n,lli m){
                lli diff = ((n-m+mod)%mod+mod)%mod;
                return diff;
            }

            lli modpro(lli n,lli m){
                lli pro = ((n*m)%mod+mod)%mod;
                return pro;
            }

            lli pow(int a,int x){
                lli powe = 1;
                loop(i,0,x){
                    powe*=a;
                }
                return powe;
            }

        lli powmod(int a,int x){
                lli powe = 1;
                loop(i,0,x){
                    powe=modpro(powe,a);
                }
                return powe;
            }




            int main(){
                int p,q;

            cin>>p>>q;
            loop(i,0,20){
            if(((p-1)*i)>=(q-1)){
                cout<<i;
                break;
            }}

            return 0;
            }




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
#define all(a) a.begin(), a.end()

const int MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    vector<ll> A(60);
    long long num;
    rep(i, 0, N){
        cin >> num;
        rep(j, 0, 60){
            if ((num>>j)&1){
                A[j]++;
            }
        }
    }
    ll ans = 0, base = 1;
    rep(i, 0, 60){
        ll ret = (N - A[i]) * A[i] % MOD;
        ret *= base;
        ans += ret;
        ans %= MOD;
        base *= 2;
        base %= MOD;
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> res(n,0);

    for(int i=0;i<k;i++)
    {
        int d;
        cin>>d;
        for(int j = 0; j < d;j++)
        {
            int a;cin>>a;
            res[a-1]++;
        }
    }

    int ans = 0;
    for(int i=0;i<n;i++)
        if(res[i] == 0)
            ans++;

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int W = s.nextInt();
		int H = s.nextInt();
		int x = s.nextInt();
		int y = s.nextInt();
		int r = s.nextInt();
		s.close();

		if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26288
num = int(input())

inputs = []
total = 0.0

for i in range(num):
  line = input().split(' ')
  
  if line[1] == 'JPY':
    total += int(line[0])
  elif line[1] == 'BTC':
    total += float(line[0]) * 380000.0

print(total)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define rep(i,n) for(int i =0;i<n;i++)
#define rep(j,n) for(int j =0;j<n;j++)

int main(){
	string str;
	int cnt=0,cnt1=0;
	cin>>str;
	
	rep(i,4){
		int cnt=0;
		rep(j,4){
			if (str[i]==str[j])
				cnt++;
		}
		if(cnt!=2){
			cout<<"No\n";
			return 0;
		}
	}
	
	cout<<"Yes\n";
	return 0;
}


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

int main(){
    int N; cin >> N;
    vector<long long> a(N, 0LL);
    for (long long i = 0; i < N; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int ptr = 0, res;
    while (ptr < N) {
        long long cc = a.at(ptr);
        int f = 0;
        while (ptr < N && a.at(ptr) == cc) {
            f++;
            ptr++;
        }
        res += f%2;
    }
    cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
const int INF = 0x3f3f3f3f;
typedef long long LL;

int a[maxn],b[maxn];
int n;

bool check(){
    for(int i=1;i<=n-2;i++)
        if(a[i]&&a[i+1]&&a[i+2]) return 1;
    return 0;
}

int main(void)
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",a+i,b+i);
        a[i] = a[i]==b[i];
    }
    if(check()) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 3664
#include<iostream>
#include<stdio.h>

using namespace std;

int main() {
	int n;
	int x0;
	int x;

	cin >> n;

	cin >> x0;

	int min = x0;
	int max = x0;
	long int sum = x0;


	for (int i = 1; i < n; i++) {
		cin >> x;

		sum += x;

		if (min > x) {
			min = x;
		}
		if (max < x) {
			max = x;
		}

	}

	cout << min << " " << max << " " << sum << endl;


	return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define ll long long
#define maxn 200005
#define inf 1e9
#define eps 1e-10
using namespace std;
 
inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}
 
ll a[maxn],b[maxn],c[maxn],d[maxn],pre[maxn],n,tot;
 
inline void add(int x,int val){for(int i=x;i<=maxn-4;i+=i&-i) c[i]+=val;}
inline ll q(int x){ll res=0; for(int i=x;i;i-=i&-i) res+=c[i]; return res;}
 
inline bool jud(ll x)
{
	ll tmp=0;
	for(int i=1;i<=n;i++) if(a[i]<x) b[i]=-1; else b[i]=1;
	for(int i=0;i<=maxn-4;i++) c[i]=0;
	for(int i=0;i<=n;i++) pre[i]=pre[i-1]+b[i],tmp+=q(pre[i]+1e5),add(pre[i]+1e5,1);
	if(tot-tmp+1<=tot/2+1) return true; return false;
	
}
 
int main()
{
	n=read(); tot=n*(n+1)/2;
	for(int i=1;i<=n;i++) a[i]=read(),d[i]=a[i]; sort(d+1,d+n+1);
	int l=1,r=n,ans=0;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(jud(d[mid])) ans=d[mid],l=mid+1;
		else r=mid-1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6400
import sys
input = sys.stdin.readline
from math import factorial

def main():
	n, k = map(int, input().strip().split())
	for i in range(1, k+1):
		if i-1 > n - k:
			print(0)
			continue
		c = factorial(k-1)//(factorial(k-i)*factorial(i-1))
		noko = factorial(n-k+1)//(factorial(i) * factorial(n-k-i+1))
		# print(c, noko)
		ans = c * noko
		# print(ans)
		ans %= 10**9+7
		print(ans)


if __name__ == '__main__':
	main()


Measured memory_bytes: 64472
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var a, b, t int
	fmt.Sscan(getNextLine(scanner), &a, &b, &t)
	ans := 0
	for i := a; float64(i) < float64(t)+0.5; i += a {
		ans += b
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <string>

int main(void) {
    std::string s;

    std::cin >> s;

    if(s.compare("AAA") == 0 || s.compare("BBB") == 0){
        std::cout << "No" << std::endl;
    }else{
        std::cout << "Yes" << std::endl;
    }
}


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

const int N = 99999;
const int INF = 123456789;

int n, m;
int d[N], p[N];
int a[N];

bool check(const int x)
{
	int y = 0;
	for (int i = m; i < n; i++){
		if (d[i] >= x) y++;
	}
	
	std::deque<int> dq(n, 1);
	for (int i = 0; i < m; i++){
		if (d[i] >= x){
			dq[p[i]] = 0;
		}
		else dq[p[i]] = INF;
	}
	
	while (dq.size() > 1){
		int t = (dq[0] + dq[1] + dq[2]) - std::max({dq[0], dq[1], dq[2]});
		t = std::min(t, INF);
		dq.push_back(t);
		for (int i = 0; i < 3; i++){
			dq.pop_front();
		}
	}
	
	return dq.back() <= y;
}

int main(void)
{
	std::scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		std::scanf("%d", &d[i]);
		if (i < m) std::scanf("%d", &p[i]);
		--p[i];
	}
	
	for (int i = 0; i < n; i++){
		a[i] = d[i];
	}
	std::sort(a, a + n);
	
	int l = 1, r = 1e9 + 1;
	while (l + 1 < r){
		int mid = (l + r) / 2;
		if (check(mid)) l = mid;
		else r = mid;
	}
	
	std::printf("%d\n", l);
	
	return 0;
}

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

const int N = 100010;

int n, cnt;
int ada[N], l, r;

int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) {
		scanf("%d %d", &l, &r);
		for(int j = l; j <= r; ++j) {
			if(ada[j] == 0) {
				cnt++;
				ada[j] = 1;
			}
		}
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int X; cin >> X;
    vector<int> ans;
    ans.push_back(1);
    rep(b, 2, 40){
        rep(p, 2, 10){
            int tmp = pow(b, p);
            if(tmp > X) break;
            ans.push_back(tmp);
        }
    }
    sort(ALL(ans));
    cout << ans.back() << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	forn(i, n) cin >> a[i];
	vector<int> mn(n);
	mn[0] = a[0];
	for(int i = 1; i < n; i++) {
		mn[i] = min(mn[i-1], a[i]);
	}
	int cnt = 1;
	for(int i = 1; i < n; i++) {
		if(a[i] <= mn[i-1])
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 4756
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <map>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 100001
#define PLUS 0
#define MINUS 1

using namespace std;

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B > C + D)
		cout << "Left";
	else if (A + B < C + D)
		cout << "Right";
	else
		cout << "Balanced";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,pair<int,int> >  p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};


int main(){
    int N,K;
    cin>>N>>K;
    N-=K;
    if(K==1){
        cout<<0<<endl;
        return 0;
    }
    cout<<N<<endl;
}



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

#define int long long
const int mod = 1e9 + 7;
int ans[100000];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ans[0]=1;
    for (int i = 0; i <= 2000; i++) {
        if(ans[i]==0)continue;
        for (int j = 3; j <= 2000; j++) {
            ans[i+j]+=ans[i];
            ans[i+j]%=mod;
        }
    }
    cout<<ans[n]<<endl;
}



Measured memory_bytes: 3680
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1
{
    class ITP1_4_B
    {
        static void Main(string[] args)
        {
            double area, circle;

            double r = double.Parse(Console.ReadLine());

            area = (Math.Pow(r, 2)) * Math.PI;
            circle = (r * 2) * Math.PI;

            Console.WriteLine($"{area} {circle}");
        }
    }
}



Measured memory_bytes: 15980
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

char board[3010][3010];
int sum1[3010][3010], sum2[3010][3010], sum3[3010][3010];

int get_sum(int sum[][3010], int x1, int y1, int x2, int y2) {
    return sum[x2][y2] - sum[x1][y2] - sum[x2][y1] + sum[x1][y1];
}

int main() {
    int N, M, Q; scanf("%d%d%d", &N, &M, &Q);
    for(int i=0; i<N; i++) {
        for(int j=0; j<M; j++) {
            scanf(" %c", &board[i][j]);
            if(board[i][j] == '1') sum3[i+1][j+1]++;
        }
    }
    for(int i=1; i<N; i++) {
        for(int j=0; j<M; j++) {
            if(board[i-1][j] == '1' and board[i][j] == '1') sum1[i+1][j+1]++;
        }
    }
    for(int i=0; i<N; i++) {
        for(int j=1; j<M; j++) {
            if(board[i][j-1] == '1' and board[i][j] == '1') sum2[i+1][j+1]++;
        }
    }

    for(int i=0; i<=N; i++) {
        for(int j=1; j<=M; j++) {
            sum1[i][j] += sum1[i][j-1];
            sum2[i][j] += sum2[i][j-1];
            sum3[i][j] += sum3[i][j-1];
        }
    }
    for(int j=0; j<=M; j++) {
        for(int i=1; i<=N; i++) {
            sum1[i][j] += sum1[i-1][j];
            sum2[i][j] += sum2[i-1][j];
            sum3[i][j] += sum3[i-1][j];
        }
    }

    while(Q--) {
        int x1, y1, x2, y2; scanf(" %d%d%d%d", &x1, &y1, &x2, &y2);
        x1--; y1--;
        int V = get_sum(sum3, x1, y1, x2, y2);
        int d1 = get_sum(sum1, x1+1, y1, x2, y2);
        int d2 = get_sum(sum2, x1, y1+1, x2, y2);
        V -= d1 + d2;
        printf("%d\n", V);
    }
    return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
typedef struct aaaaa{
  int x,y,t;
}Grid;
using namespace std;
int toInt(string s){
  int ret=0;
  int kake=1;
  for(int i=s.size()-1;i>=0;i--){
    ret += kake*(s[i]-'0');
    kake*=10;
  }
  return ret;
}
int main(){
  int a,b,c,d,e;
  string s,ss,sss;
  cin>>s;
  int ans=INF;
  for(int i=0;i<s.size()-2;i++){
    ans=min(ans,abs(753-toInt(s.substr(i,3))));
  }
  /* for(int i=0;i<s.size()-3;i++){
    ans=min(ans,abs(753-toInt(s.substr(i,4))));
    }*/
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    long long N,K;
    cin >> N >> K;    
    long long ans = N*N;
    for ( int i = 1; i <= K && i <= N; i++ ) {
        ans -= N;
    }
    for ( int i = K+1; i <= N; i++ ) {
        if ( K ) { ans -= (N/i)*K + ( N%i >= K ? K-1 : N%i ); }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
C, S, F = [], [], []
for _ in range(N-1):
     c, s, f = map(int, input().split())
     C.append(c)
     S.append(s)
     F.append(f)


for i in range(N-1):
     time = 0
     for j in range(i, N-1):
          if time <= S[j]:
               time = S[j]
          elif time % F[j] != 0:
               time = time + F[j] - (time % F[j])
          time += C[j]
     print(time)
print(0)


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	int ret=0;
	while(N) {
		ret++;
		N/=K;
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools

# 標準入力を取得
N = int(input())
A = list(map(int, input().split()))

# 求解処理
ans = 0
for A_i, A_j in itertools.combinations(A, r=2):
    ans = max(ans, abs(A_i - A_j))

# 結果出力
print(ans)


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

using namespace std;

int a[201];

int main(){
  int n;
  scanf("%d", &n);
  for(int i = 0; i < n; ++i){
    scanf("%d", a + i);
  }
  int ans = (int) 1e9 + 10;
  for(int i = 0; i < n; ++i){
    int temp = a[i];
    int cur = 0;
    while(temp > 0){
      if(temp % 2 == 0){
        cur++;
      }else{
        break;
      }
      temp >>= 1;
    }
    ans = min(ans, cur);
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int h,w;
	string s;

	cin>>h>>w;

	rep(i,h){
	cin>>s;
	cout<<s<<endl;
	cout<<s<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
r, c = map(int, input().split())
array = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    for j, num in enumerate(input().split()):
        array[i][j] = int(num)
for i in range(r):
    array[i][c] = sum(array[i])
for i in range(c+1):
    for j in range(r):
        array[r][i] += array[j][i]
for i in range(r+1):
    for j in range(c+1):
        if j == c:
            print(array[i][j])
        else:
            print(array[i][j], end=' ')

Measured memory_bytes: 8404
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int a,n,counter=1,ans;
    cin >> n;
    a = n;
    for(int i=0;i<6;i++){
        if((n/10) >0 ){
        counter++;
        n = n/10;
        }
    }
    n=a;
    switch(counter){
        case 1: ans = n;break;
        case 2: ans = 9;break;
        case 3: ans = 9+(n-100+1);break;
        case 4: ans = 909;break;
        case 5: ans = 9+900+(n-10000+1);break;
        case 6: ans = 90909;break;
        default : break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1073741824
#define ll long long
#define PI (2*acos(0.0))
#define Hare printf("here\n")
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define x first
#define y second
#define on(val,pos) val|(1<<pos)
#define off(val,pos) val&(~(1<<pos))
#define check(val,pos) (val&(1<<pos))

//first four adjacent,second four corner
//int row[8]={0,-1,0,1,1,-1,-1,1};
//int col[8]={-1,0,1,0,-1,-1,1,1};
using namespace std;

int main(){
    int i,j,k,n,m,val,t=0,cnt,test;
    //freopen("000input.txt","r",stdin);
    string s,s1,s2;
    char ch;
    cin>>s>>n;
    for(i=0,cnt=0;i<n;i++){
        scanf("%d",&val);
        if(val==1)cnt=(cnt+1)&1;
        else{
            scanf("%d %c",&val,&ch);
            if(cnt){
                val=(val+1)%3+1;
            }
            if(val==1)s1+=ch;
            else s2+=ch;
        }
    }
    if(cnt){
        reverse(s2.begin(),s2.end());
        reverse(s.begin(),s.end());
        cout<<s2<<s<<s1<<endl;
    }
    else{
        reverse(s1.begin(),s1.end());
        cout<<s1<<s<<s2<<endl;
    }
    //free();   //if pointer array
    return 0;
}


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

int main(){
    long long n;
    cin >> n;
    long long h[n];
    for(long long i = 0; i < n; i++){
        cin >> h[i];
    }

    long long i = 0;
    long long length_max = 0;
    while(i < n){
        if(h[i] >= h[i+1]){
            long long length = 0;
            while(h[i] >= h[i+1] and i+1 < n){
                length++;
                i++;
            }
            //printf("length %lld\n", length);
            length_max = max(length_max, length);
        }
        i++;
    }
    cout << length_max << endl;
    return 0;
}

Measured memory_bytes: 4372
A, B, K = list(map(int,input().split(' ')))
'''
x = [i for i in range(A,B+1)]
s_f,s_b = x[:K],x[len(x)-K:]
ans = s_f + s_b
ans =list(set(ans))
#ans.sort()
if len(range(A,B+1))<K:
  [print(i) for i in range(A,B+1)]
else:
  x = [i for i in range(A,B+1)]
  s_f,s_b = x[:K],x[len(x)-K:]
  ans = s_f + s_b
  ans =list(set(ans))
  ans.sort()
  [print(i) for i in ans]

'''
if (B-A+1)<K:
  s =  list(range(A,B+1))
  [print(i) for i in s]
else:           
  s_f = list(range(A,A+K))
  s_b = list(range(B,B-K,-1))
  ans = s_f + s_b
  ans =list(set(ans))
  ans.sort()
  [print(i) for i in ans]
  
  
       

Measured memory_bytes: 3064
N = int(input())

A = list(map(int, input().split()))

money = 1000
kabu = 0

for i in range(len(A)-1):
    if kabu != 0:
        if A[i] >= A[i + 1]:
            money += kabu * A[i]
            kabu = 0

    else:
        if A[i] < A[i + 1]:
            kabu = money // A[i]
            money -= kabu * A[i]

if kabu != 0:
    money += kabu * A[len(A) - 1]
    
print(money)


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

using namespace std;

int main()
{
  	int N;
  	cin >> N;
  	vector<long> L(N+1);
  	L.at(0) = 2, L.at(1) = 1;
  	for(int i = 2; i <= N; i++){
      	L.at(i) = L.at(i-1) + L.at(i-2);
    }
  	cout << L.at(N);
}

Measured memory_bytes: 764
// C - Together

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	map<int, int> cnt;

	int a;
	for (int i=0; i<N; i++) {
		cin >> a;
		cnt[a - 1]++;
		cnt[a]++;
		cnt[a + 1]++;
	}

	int ans = 0;
	for (auto itr : cnt) {
		ans = max(ans, itr.second);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4736
#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 FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

vector<int> a;
ll k, n;
ll kazu[200001] = {};
signed main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	cin >> n >> k;
	REP(i, n) {
		ll tmp;
		cin >> tmp;
		a.pb(tmp);
	}
	VSORT(a);
	ll torima = 1;
	REP(i, n-1) {

		if (a[i] == a[i + 1]) {
			torima++;
			if (i == n - 2) kazu[torima]++;
		}
		else {
			kazu[torima]++; if (i == n - 2) kazu[1]++;
			torima = 1;
		}

	}
	a.erase(unique(a.begin(), a.end()), a.end());
	ll ima = a.size();
	ll kesu = 0;

	ll i = 1;
	while (ima > k) {
		if (kazu[i] != 0) {
			kazu[i]--;
			kesu += i;
			ima--;
		}
		else {
			i++;
		}
	}

	cout <<kesu << endl;
	return 0;
}

Measured memory_bytes: 1400
N = int(input())
A = list(map(int,input().split()))

ans = 0
#nums = [i for i in range(1,N+1)]
cur = 1
for i in range(N):
    if A[i]==cur:
        cur += 1

cur -= 1
ans = N-cur
if cur==0:
    print(-1)
else:
    print(ans)



Measured memory_bytes: 26140
# 168 A

n = int(input())
x = n % 10

if x == 2 or x == 4 or x == 5 or x == 7 or x == 9:
    print("hon")
elif x == 0 or x == 1 or x == 6 or x == 8:
    print("pon")
elif x == 3:
    print("bon")

Measured memory_bytes: 9168
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    char charr[1001] = {};
    int result;
    
    while(1){        
        scanf("%s",charr);
        if(charr[0] == '0') { break; }
        
        result = 0;
        for (int i=0; charr[i] != '\0'; i++){
            result += charr[i] - '0';
        }
        printf("%d\n", result);
    }
    return 0;
}

Measured memory_bytes: 1132
def ispalin(s):
    if(s==s[::-1]):
        return True
    else:
        return False
s=input()
n=len(s)
if(ispalin(s)):
    p=(n-1)//2
    q=(n+3)//2
    #print(s[:p],s[q-1:])
    if(ispalin(s[:p])):
        if(ispalin(s[q-1:])):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>

using namespace std;

int main(){
    int n, x, sum=0, l=1000;
    cin >> n >> x;

    int m[n];

    for(int i=0; i<n; i++){
        cin >> m[i];
        sum += m[i];
        l = min(l, m[i]);
    }

    cout << n + (x-sum) / l << endl;
}

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

string S;
double M,N;
double a,b;

int main(){
	//cin>>S;
	cin>>N>>M;
	vector<double> A(N);
	double S = 0;
	double lim = 1/(4*M);

	for(int i=0;i<N;++i){
		cin>>A.at(i);
		S = S+A.at(i);
	}

	sort(A.begin(),A.end());
	reverse(A.begin(),A.end());

	//for(int i=0;i<N;++i)
		//cout<<A.at(i)<<" ";

	for(int i=0;i<M;++i){
		if(A.at(i)/S<lim){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

}

Measured memory_bytes: 256
using System;

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

            int kari = 0;
            int happiness = 0;

            kari = X / 500;
            happiness += kari * 1000;
            X %= 500;

            kari = X / 5;
            happiness += kari * 5;

            Console.WriteLine(happiness);
            Console.Read();
        }
    }
}


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

using ll = long long;
using P = pair<ll,ll>;

void solve(long long A, long long B, long double H, long double M){
    long double a = ((long double)2)*M_PI* M/60;  
    long double b= ((long double)2)*M_PI *((M/720) + (H/12));
    long double d2 = powl(A*cosl(a)-B*cosl(b),2) + powl(A*sinl(a)-B*sinl(b),2);

    cout << setprecision(10) <<sqrtl(d2) << endl;

}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4232
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i = 0; i < n; i++)

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


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

const int N = 222222;
vector<int> p, q;
int poss[N];
int stree[4 * N][2];
int n;

int build(int left, int right, int pos, int even) {
    if(left == right) {
        stree[pos][even] = left % 2 == even ? N : p[left];
        return stree[pos][even];
    }
    int mid = left + right >> 1;
    int a = build(left, mid, pos * 2 + 1, even);
    int b = build(mid + 1, right, pos * 2 + 2, even);
    stree[pos][even] = min(a, b);
    return stree[pos][even];
}

int query(int left, int right, int curLeft, int curRight, int pos, int even) {
    if(curLeft > right || curRight < left) {
        return N;
    } else if(curLeft >= left && curRight <= right) {
        return stree[pos][even];
    }
    int mid = curLeft + curRight >> 1;
    int a = query(left, right, curLeft, mid, pos * 2 + 1, even);
    int b = query(left, right, mid + 1, curRight, pos * 2 + 2, even);
    return min(a, b);
}

struct compInterval {
    bool operator () (const pair<int, int> &a, const pair<int, int> &b) const {
        int aa = query(a.first, a.second, 0, n - 1, 0, a.first % 2 == 0);
        int bb = query(b.first, b.second, 0, n - 1, 0, b.first % 2 == 0);
        return aa > bb;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++) {
        int cur;
        cin >> cur;
        p.push_back(cur);
        poss[cur] = i;
    }
    build(0, n - 1, 0, false);
    build(0, n - 1, 0, true);
    priority_queue<pair<int, int>, vector<pair<int, int> >, compInterval> qu;
    qu.push(make_pair(0, n - 1));
    while(qu.size()) {
        pair<int, int> in = qu.top();
        qu.pop();
        int par = in.first % 2 == 0;
        int left = query(in.first, in.second, 0, n - 1, 0, par);
        left = poss[left];
        int right = query(left + 1, in.second, 0, n - 1, 0, 1 - par);
        right = poss[right];
        q.push_back(p[left]);
        q.push_back(p[right]);
        vector<pair<int, int> > toa;
        toa.push_back(make_pair(in.first, left - 1));
        toa.push_back(make_pair(left + 1, right - 1));
        toa.push_back(make_pair(right + 1, in.second));
        for(pa : toa) {
            if(pa.second - pa.first >= 1) {
                int a = query(pa.first, pa.second, 0, n - 1, 0, pa.first % 2 == 0);
                qu.push(pa);
            }
        }
    }
    for(x : q) {
        cout << x << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 11380
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
#define MOD 1000000007
vector <ll> g[10];
ll visited[10];
int main(){
    ll n;
    cin >> n;
    ll i;
    ll a[(n+1)/2];
    for(i=0;i<(n+1)/2;i++){
        a[i]=0;
    }
    ll A;
    for(i=0;i<n;i++){
        cin >> A;
        a[A/2]+=1;
        if((A+n)%2==0){cout << 0;return 0;}
    }
    for(i=1;i<(n+1)/2;i++){
        if(a[i]!=2){cout << 0;return 0;}
    }
    if(a[0]!=1+(n+1)%2){cout << 0;return 0;}
    ll ans=1;
    for(i=0;i<n/2;i++){
        ans=ans*2%1000000007;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
//const ll mod = 1e9 + 7;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;

const int N = 2e5 + 10;
int t;

int main() 
{
	ll n;
	while (cin >> n)
	{
		vector<pii> v;
		for (ll i = 2;i <= n / i;i++)
		{
			if (n%i == 0)
			{
				int cot = 0;
				while (n%i == 0)
				{
					n /= i;
					cot++;
				}
				v.emplace_back(pii{ (int)i,cot });
			}
		}
		if (n > 1)v.emplace_back(pii{ (int)n,1 });
		ll ans = 0;
		for (auto I : v)
		{
			int now = I.second;

			f(i, 1, 30)
			{
				if (now >=i)now -=i , ans++;
			}
		}
		cout << ans << endl;
	}
}

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

int main() {
  int N, C;
  scanf("%d %d",&N,&C);
  int s[N], t[N], c[N];
  int maxt=0;
  for (int i=0; i<N; i++) {
    scanf("%d %d %d",&s[i],&t[i],&c[i]);
    maxt=max(maxt,t[i]);
  }
  int sm[maxt*2];
  memset(sm,0,sizeof(sm));
  int tt[maxt*2];
  for (int i=1; i<=C; i++) {
    for (int j=0; j<maxt+1; j++) {
      tt[j]=0;
    }
    for (int j=0; j<N; j++) {
      if (c[j]==i) {
        tt[s[j]-1]++;
        tt[t[j]]--;
      }
    }
    for (int j=1; j<maxt+1; j++) {
      tt[j]+=tt[j-1];
    }
    for (int j=0; j<maxt+1; j++) {
      if (tt[j]>0) {
        sm[j]++;
      }
    }
  }
  int x=0;
  for (int j=0; j<maxt+1; j++) {
    if (x<sm[j]) {
      x=sm[j];
    }
  }
  printf("%d\n",x);
  return 0;
}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define continue continue
#define break break
#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;


int main(void){
	int n; cin >> n;
	rep(i, 10) rep(j, 10){
		if(i*j == n){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

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

            var dict = new Dictionary<char, int>();
            foreach (var c in S)
            {
                dict[c] = 1;
            }

            var alphabet = "abcdefghijklmnopqrstuvwxyz";

            var ans = "";

            if (S.Length == 26)
            {
                if (S == "zyxwvutsrqponmlkjihgfedcba")
                {
                    Console.WriteLine(-1);
                    return;
                }

                Console.WriteLine(nextString(S));
            }
            else
            {
                foreach (var a in alphabet)
                {
                    if (!dict.ContainsKey(a))
                    {
                        ans = a.ToString();
                        break;
                    }
                }

                Console.WriteLine(S + ans);
            }
        }

        static string nextString(string s)
        {
            List<char> c = s.ToList();
            bool[] isUsed = new bool[26];
            for (int i = 0; i < c.Count; i++) isUsed[c[i] - 'a'] = true;
            for (int i = c.Count - 1; i >= 0; i--)
            {
                char item = c[i];
                for (int j = item - 'a'; j < isUsed.Length; j++)
                {
                    if (!isUsed[j])
                    {
                        c[i] = char.ConvertFromUtf32(j + 'a')[0];
                        goto end;
                    }
                }
                isUsed[item - 'a'] = false;
                c.RemoveAt(c.Count - 1);
            }
        end:;
            return string.Join("", c);
        }
        static bool isTasai(string s) => s.Distinct().Count() == s.Count();
    }
}


Measured memory_bytes: 13280
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll n,m,c;
    cin >> n >> m >> c;
    ll b[m],a[n][m];
    rep(i,m) cin >> b[i];
    rep(i,n){
        rep(j,m) cin >> a[i][j];
    }

    ll ans=0;
    rep(i,n){
        ll sum=0;
        rep(j,m) sum += a[i][j]*b[j];
        if(sum+c>0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N = gete()
    c = int(N[-1])
    if c in [2, 4, 5, 7, 9]:
        print('hon')
    elif c in [0, 1, 6, 8]:
        print('pon')
    else:
        print('bon')


if __name__ == "__main__":
    main()

Measured memory_bytes: 65028
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
typedef long long ll;
constexpr int MAX = 100000;

vector<int> Group_list[MAX];
const int NIL = -1;
int Check_list[MAX];
int n;

void Checking(){
  //init
  rep(i,n) Check_list[i] = NIL;
  stack<int> stk;
  int check_cnt = 0;
  //solve
  rep(i,n){
    if(Check_list[i] == NIL) {
      stk.push(i);
      check_cnt++;
      Check_list[i] = check_cnt;
    }
    int now, next;
    while(!stk.empty()){
        now = stk.top();
        stk.pop();
        rep(j, Group_list[now].size()){
          next = Group_list[now][j];
          if(Check_list[next] == NIL) {
            Check_list[next] = check_cnt;
            stk.push(next);
          }
        }
    }
  }
}

int main(){
  int m,q;
  int from, to;
  cin >> n >> m;
  rep(i,m){
    cin >> from >> to;
    Group_list[from].push_back(to);
    Group_list[to].push_back(from);
  }

  Checking();

  cin >> q;
  rep(i,q){
    cin >> from >> to;
    if(Check_list[from] == Check_list[to] && Check_list[from] != NIL){
      cout << "yes" << endl;;
    }else{
      cout << "no" << endl;
    }
  }
  

  return 0;
}


Measured memory_bytes: 8960
# -*- coding: utf-8 -*-


def main():
    from string import ascii_lowercase
    import sys
    input = sys.stdin.readline

    n = int(input())
    ans = ''
    alpha = list(ascii_lowercase)

    while n >= 26:
        p, q = divmod(n, 26)

        ans += alpha[q - 1]
        n = p

        if q == 0:
            n -= 1

    if 0 < n < 26:
        ans += alpha[n - 1]

    print(ans[::-1])


if __name__ == '__main__':
    main()


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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int arr[n];
    for(int i=0; i<n; i++) cin >> arr[i];
    sort(arr,arr+n);
    int count=0;
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            if(arr[j]==arr[i]) continue;
            for(int k=j+1; k<n; k++){
                if(arr[k]==arr[j] || arr[k]==arr[i]) continue;
                if(arr[i]+arr[j]>arr[k] && arr[j]+arr[k]>arr[i] && arr[k]+arr[i]>arr[j]) count++;
            }
        }
    }
    cout<<count<<'\n';
    return 0;
}


Measured memory_bytes: 3656
def main():
  n, mods = 0, [1]+[0]*2019
  d = 1
  for j in map(int, input()[::-1]):
    n = (n+int(j)*d)%2019
    d = d*10%2019
    mods[n] += 1
  print(sum([i*(i-1)//2 for i in mods]))
main()

Measured memory_bytes: 9340
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ans;
  rep(i,n) {
    ans.push_back(s[i]);
    ans.push_back(t[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;


int main()
{
	vector<int> x, y;
	vector<int> memo;

	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		memo.push_back(a);
	}
	sort(memo.begin(), memo.end());

	int l = memo[0];
	int r = memo[memo.size()-1];

	for(int i=1;i<n-1;i++){
		if(memo[i] >= 0){
			x.push_back(l);
			y.push_back(memo[i]);
			l = l - memo[i];
		}else{
			x.push_back(r);
			y.push_back(memo[i]);
			r = r - memo[i];
		}
	}
	x.push_back(r);
	y.push_back(l);

	cout << r - l << endl;
	for(int i=0;i<n-1;i++){
		cout << x[i] << " " << y[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
typedef long long LL;
const int N = 1e6+7 , INF = 0x3f3f3f3f , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
template<typename T1>
T1 gcd(T1 a , T1 b){ return b ? gcd(b,a%b) : a;}

LL fpow(LL x,LL n){
    if( n < 0 ) return 0;
    LL ans = 1;
    for( ; n ; n >>= 1 , x = x * x )
        if( n&1 )
            ans = ans * x;
    return ans;
}

LL C[55][55];

void build(){
    for(int i = 0 ; i <= 50 ; i++)  C[i][0] = 1;

    for(int i = 1 ; i <= 50 ; i++){
        for(int j = 1 ; j <= i ; j++){
            C[i][j] = C[i-1][j] + C[i-1][j-1];;
        }
    }
}

int main(){
#ifdef LOCAL
    freopen("E:\\c++\\in.txt", "r", stdin);
//  freopen("E:\\c++\\out.txt","w",stdout);
#endif
    build();
    int n,p,x;
    LL f = 0 , z = 0 , s = 1;
    scanf("%d%d",&n,&p);
    for(int i = 0 ; i < n ; i++ ){
        scanf("%d",&x);
        if( x&1 )   f++;
        else    z++;
    }
    LL ans = 0 , fi = f;
    //printf("%lld,%lld\n",f,z);
    if( p ){
        z = fpow(2,z+1);
        while( fi > 0 ){
            ans += C[f][s] * z;
            //printf("C(%lld,%lld) = %lld\n",f,s,C[f][s]);
            fi -= 2;
            s+=2;
        }
        printf("%lld\n",ans/2);
    }else{
        s = 2;
        z = fpow(2,z+1);
        ans += z;
        while( fi > 1 ){
            ans += C[f][s] * z;
            fi -= 2;
            s+=2;
        }
        printf("%lld\n",ans/2);
    }
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  FromDihPout
 *    created: 2020-05-26
**/

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    vector<long double> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] = a[i] * (a[i] + 1) / (2 * a[i]);
    }
    double sum = 0;
    for (int i = 0; i < k; i++) {
        sum += a[i];
    }
    double max_sum = sum;
    for (int i = k; i < n; i++) {
        sum += a[i] - a[i-k];
        max_sum = max(max_sum, sum);
    }
    printf("%.10f", max_sum);
    return 0;
}

Measured memory_bytes: 3456
def main():
    s = input()

    ch_lst = [0 for i in range(26)]
    for i in s:
        ch_lst[ord(i)-ord('a')] += 1

    for i in range(len(ch_lst)):
        if ch_lst[i] == 0:
            s += chr(i+ord('a'))
            break

    else:
        for i in range(len(s)-1, -1, -1):
            ch_lst[ord(s[i])-ord('a')] = 0

            for j in range(ord(s[i])-ord('a')+1, 26):
                if ch_lst[j] == 0:
                    s = s[:i]
                    s += chr(j+ord('a'))
                    break

            else:
                continue

            break

        else:
            s = -1

    print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064