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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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 (b<a) { a = b; return 1; } return 0; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
  int paSize = printArray.size();
  for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
  if (between != '\n') {cerr << endl;}
}

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

int X, Y;

signed main() {
  cin >> X >> Y;

  puts(abs(X-Y)<=1 ? "Brown":"Alice");

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,b,f,r,v,a[4][3][14]={0};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;
	}
	for(int k=0;k<4;k++){
		for(int j=0;j<3;j++){
			for(int s=0;s<10;s++){
				cout<<" "<<a[k][j][s];
			}
		cout<<endl;
		}
		if(k==0||k==1||k==2){cout<<"####################"<<endl;}

	}
	return 0;
}


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

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
long long a,b,c,k;
int main()
{
	//()
	cin>>a>>b>>c>>k;
	if(k&1)cout<<b-a;else cout<<a-b;  //1ll ull L
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, m;
  int a, b;
  cin >> n >> m >> a >> b;
  cout << 1ll * n * m - 1ll * a * m - 1ll * b * n + 1ll * a * b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 7;
int main() {
	string s;
	cin >> s;
	int a = 0, b = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == 'A') a++;
		else b++;
	}
	if(a && b) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

const int MOD = 1e9+7;

int N, mp, g1, g2;
long cs;
map<int, int> P[100010];

int pyon(int i, int q) {
    int x = 1;
    for(auto p: P[i]) {
        int j, c; tie(j, c) = p;
        if(j != q) {
            int r = pyon(j, i);
            cs += 2 * min(r, N-r) * (long)c;
            x += r;
        }
    }
    int y = min(x, N-x);
    if(mp < y) {
        mp = y;
        if(x == y) {
            g1 = q; g2 = i;
        } else {
            g1 = i; g2 = q;
        }
    }
    return x;
}

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    scanf("%d",&N);
    times(N-1, i) {
        int A, B, C; scanf("%d%d%d", &A, &B, &C);
        P[A-1][B-1] = P[B-1][A-1] = C;
    }
    assert(pyon(0, 0) == N);
    assert(g1 != g2);

    if(N % 2 == 0 && mp == N / 2) {
        cout << cs - P[g1][g2] ln;
    } else {
        int l = INT_MAX;
        for(auto p: P[g1]) l = min(l, p.second);
        cout << cs - l ln;
    }

    return 0;
}


Measured memory_bytes: 19712
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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


Measured memory_bytes: 256
import Control.Monad
import qualified Data.ByteString.Char8 as BS

readString = map BS.unpack . BS.words

getString = readString <$> BS.getLine

calc :: Int -> String -> Int
calc p (s1 : s2 : s3 : ss)
  | s1 == s2 = calc (p + 2) ss
  | otherwise = calc (p + 1) (s2 : s3 : ss)
calc p (s1 : s2 : [])
  | s1 == s2 = p + 1
  | otherwise = p + 2
calc p (s1 : []) = p + 1
calc p [] = p

main = do
  [cs] <- getString
  print $ calc 0 cs


Measured memory_bytes: 1276
from collections import Counter


def main():
    n = int(input())
    s = []
    for i in range(n):
        s.append(input())
    cnt = Counter(s).most_common()
    num = cnt[0][1]
    for v in  sorted([v for v, c in cnt if c == num]):
        print(v)


if __name__ == '__main__':
    main()


Measured memory_bytes: 120144
main(i,j,k,n,c){
	int a[3][3];
	for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%d",&a[i][j]);
	scanf("%d",&n);
	int b[n];
	for(i=0;i<n;i++) scanf("%d",&b[i]);
	for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<n;k++)if(b[k]==a[i][j])a[i][j]=0;
	for(i=0;i<3;i++)if(((a[i][0]==a[i][1])&&(a[i][1]==a[i][2]))||((a[0][i]==a[1][i])&&(a[1][i]==a[2][i]))) c=1;
	if(((a[0][0]==a[1][1])&&(a[1][1]==a[2][2]))||((a[0][2]==a[1][1])&&(a[1][1]==a[2][0])))c=1;
	if(c==1) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if(Math.abs(a - c) <= d || Math.abs(a - b) <= d && Math.abs(b - c) <= d) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
import sys

use_clipboard=True
bbn=1000000007
	
#+++++

def check(sc,tc):
	sc.sort()
	tc.sort()
	for u,v in zip(sc,tc):
		if len(u)!=len(v):
			return False
		for i,j in zip(u,v)	:
			if i!=j:
				return False
	return True
		
						
def main():
	s = input()
	t = input()
	c2i=lambda c : ord(c)-ord('a')
	sc=[[] for _ in range(26)]
	tc=[[] for _ in range(26)]
	
	for i,c in enumerate(s):
		#pa(c2i(c))
		sc[c2i(c)].append(i)
		
	for i,c in enumerate(t):
		tc[c2i(c)].append(i)
		
		
	ret = 'Yes' if check(sc,tc) else 'No'
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)


class input_clipboard:
	def __init__(self,s):
		self.input_l=s.splitlines()
		self.ii=0
		
	def input(self):
		ret = self.input_l[self.ii]
		self.ii+=1
		return ret


if __name__ == "__main__":
	if sys.platform =='ios':
		if use_clipboard:
			import clipboard
			input_text=clipboard.get()
			ic=input_clipboard(input_text)
			input = lambda : ic.input()
		else:
			sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 20656
#include<iostream>
using namespace std;
int main(){
    int x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    if((x1<=x2)&&(y1<=y2)){
        x3 = x2 - (y2 - y1);
        y3 = y2 + (x2 - x1);
        x4 = x3 - (x2 - x1);
        y4 = y3 - (y2 - y1);
    }else if((x1<=x2)&&(y1>y2)){
        x3 = x2 + (y1 - y2);
        y3 = y2 + (x2 - x1);
        x4 = x3 - (x2 - x1);
        y4 = y3 + (y1 - y2);
    }else if((x1>x2)&&(y1<=y2)){
        x3 = x2 - (y2 - y1);
        y3 = y2 - (x1 - x2);
        x4 = x3 + (x1 - x2);
        y4 = y3 - (y2 - y1);
    }else{
        x3 = x2 + (y1 - y2);
        y3 = y2 - (x1 - x2);
        x4 = x3 + (x1 - x2);
        y4 = y3 + (y1 - y2);
    }
    cout <<x3 <<" "<<  y3 <<" "<< x4 <<" "<< y4 << endl;
    return 0;
}


Measured memory_bytes: 256
k = int(input())
q = [list(map(int, input().split())) for _ in range(k)]
import itertools

row = list(range(0,8))
for i in q:
    row.remove(i[0])
col = list(range(0,8))
for i in q:
    col.remove(i[1])

for i in itertools.permutations(list(range(0,8-k)),8-k):
    queens = []
    for j in range(k):
        queens.append(q[j])
    for j in range(8-k):
        queens.append([row[j],col[i[j]]])
    flg = True
    for j in itertools.combinations(queens,2):
        if abs((j[0][0]-j[1][0])/(j[0][1]-j[1][1])) == 1:
            flg = False
    if flg == True:
        break

# print(queens)
lit = [[]  for _ in range(8)]
for i in range(8):
    for j in range(8):
        lit[i].append('.')
for i in queens:
    lit[i[0]][i[1]] = 'Q'

for i in range(8): print(''.join(map(str,lit[i])))


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

using namespace std;

using ll = long long;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

#define int ll

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

signed main() {
    cin.tie(0);
    cout << fixed << setprecision(10);
    int n, k; cin >> n >> k;
    vector<int> a(n);
    int su = 0;
    for(int i=0;i<n;++i) {
      cin >> a[i];
      su += a[i];
    }
    vector<int> d;
    d.push_back(su);
    for(int i=2;i*i<=su;++i) {
      if(su % i == 0) {
        d.push_back(i);
        if(i*i != su) d.push_back(su / i);
      }
    }

    int sz = d.size();
    int m = (n + 1) / 2;
    int ans = 1;
    for(int i=0;i<sz;++i) {
      vector<int> b(n);
      for(int j=0;j<n;++j) {
        b[j] = a[j] % d[i];
      }
      sort(b.begin(), b.end());
      vector<int> pre(n+1), suf(n+1);
      for(int j=0;j<n;++j) {
        pre[j+1] = pre[j] + b[j];
        suf[n-j-1] = suf[n-j] + (d[i] - b[n-j-1]);
      }
      int ma = INF;
      for(int j=0;j<=n;++j) {
        ma = min(ma, max(pre[j], suf[j]));
      }
      if(ma <= k) ans = max(ans, d[i]);

    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long cc;
typedef pair<int, int> pii;
#define X first
#define Y second
#define mp make_pair
int cnt2, cnt4, cnt1;
int n;
int main() {
    ios_base :: sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        int val; cin >> val;
        if (val % 4 == 0) cnt4++;
        else if  (val % 2 == 0) cnt2++;
        else cnt1++;
    }
    bool ok = true;
    if (cnt1 == 1 && cnt4 == 0) ok = false;
    if (cnt1 == 2 && cnt4 < 2) ok = false;
    if (cnt1 > cnt4) ok = false;
    if (cnt1 == cnt4 + 1 && cnt2 == 0) ok = true;
    if (ok) cout << "Yes"; else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n,i,v,j,k;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  for(i=1;i<n;i++){
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    for(k=0;k<n;k++){
      printf("%d",a[k]);
      if(k!=n-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2124
def main():
    n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    # s = input()

    count = 0
    for i in range(1, n+1):
        i = str(i)
        if len(i) % 2 != 0:
            count += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 69660
package main

import "fmt"

func main() {
	var k, a, b int
	fmt.Scan(&k)
	fmt.Scan(&a, &b)

	for i:=a; i<=b; i++{
		if i%k ==0{
			fmt.Println("OK")
			return
		}
	}
	fmt.Println("NG")
}

Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int a, b, c; cin >> a >> b >> c;
    if ((a == b && a != c) || (a == c && a != b) || b == c && a != b){
        cout << "Yes" <<endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 256
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> 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 long 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; }

int main(){
    ll x;
    cin>>x;

    for(ll i=-122;i<=122;i++){
        for(ll j=-122;j<=122;j++){
            ll p=pow(i,5)-pow(j,5);
            if(p==x){
                cout<<i<<" "<<j;
                exit(0);
            }
        }
    }
}

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

x = int(input())



if x >= 400 and x <= 599:
    print('8')
elif x >= 600 and x <= 799:
    print('7')
elif x >= 800 and x <= 999:
    print('6')
elif x >= 1000 and x <= 1199:
    print('5')
elif x >= 1200 and x <= 1399:
    print('4')
elif x >= 1400 and x <= 1599:
    print('3')
elif x >= 1600 and x <= 1799:
    print('2')
elif x >= 1800 and x <= 1999:
    print('1')



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

int main(){
  int n;
  cin >> n;
  vector<double> x(n);
  vector<double> y(n);
  rep(i,n){
    double tx, ty;
    cin >> tx >> ty;
    x.at(i) = tx;
    y.at(i) = ty;
  }
  double ans=0;
  rep(i,n-1){
    for(int j=i+1;j<n;j++){
      ans += sqrt(pow((x.at(i)-x.at(j)),2)+pow((y.at(i)-y.at(j)),2));
    }
  }
  
  ans = ans/n*2;
  
 
  printf("%.10f", ans);
}
  
  
  
  

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	taka := c / b
	ao := a / d
	if c%b != 0 {
		taka++
	}
	if a%d != 0 {
		ao++
	}
	result := "No"
	if taka <= ao {
		result = "Yes"
	}
	fmt.Println(result)
}


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

int main(){
  int n,l;
  cin >>n>>l;
  vector<string> s(n);
  rep(i,n) cin>>s[i];
  sort(s.begin(),s.end());
  rep(i,n) cout<<s[i];
  return 0;
}

Measured memory_bytes: 256
input_line = list(map(int,input().split(' ')))

if(input_line[0]>=input_line[2]):
    input_line[0] -= input_line[2]
elif((input_line[0]+input_line[1])>=input_line[2]):
    input_line[1] -= (input_line[2]-input_line[0])
    input_line[0] = 0
else:
    input_line[0] = 0
    input_line[1] = 0

print(input_line[0],input_line[1])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}

int main() {
    int x[MAX_N] = {}, y[MAX_N] = {};
    int n, q;
    // scanf("%d%d", &n,&q);
    read(n); read(q);
    ll ans = (ll)(n-2)*(n-2);
    /*
    srep(i,2,n){
        x[i] = n;
        y[i] = n;
    }
    */
    int xx = n;
    int yy = n;
    while(q--){
        int t, z;
        // scanf("%d%d", &t,&z);
        read(t), read(z);
        if(t == 1){
            if(z < xx){
                ans -= yy - 2;
                srep(i,z+1,xx) x[i] = yy;
                xx = z;
            }else{
                ans -= x[z] - 2;
            }
        }else{
            if(z < yy){
                ans -= xx - 2;
                srep(i,z+1,yy) y[i] = xx;
                yy = z;
            }else{
                ans -= y[z] - 2;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}




Measured memory_bytes: 5284
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }
    
    static final char[] alphabet = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        int ans = 0;

        if(S.length() % 2 == 1) {
            for(int i = 0; i < (S.length()-1)/2; i++) {
                if(S.charAt(i) != S.charAt(S.length()-1-i))
                    ans++;
            }
        } else {
            for(int i = 0; i < S.length()/2; i++) {
                if(S.charAt(i) != S.charAt(S.length()-1-i))
                    ans++;
            }
        }
        os.println(ans);
    }
}

Measured memory_bytes: 23380
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define DEBUG(x) cout << endl \
                      << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << endl                \
         << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

vi A;
vector<pii> pairs;

int main()
{
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    REP(i, N)
    {
        int x;
        cin >> x;
        A.PB(x);
    }

    sort(A.begin(), A.end());
    // DEBUG_VEC(A);

    REP(i, M)
    {
        int b, c;
        cin >> b >> c;
        pairs.emplace_back(b, c);
    }


    sort(pairs.begin(), pairs.end(), [](pii a, pii b){ return a.second > b.second; });

    int idx = 0;
    bool done = false;
    for (auto &p : pairs)
    {
        int b = p.first, c = p.second;
        REP(i, b)
        {
            if ((idx < N) and (c >= A[idx]))
            {
                A[idx] = c;
                idx++;
            }
            else
            {
                done = true;
                break;
            }
        }

        if (done) break;
    }

    // DEBUG_VEC(A);
    ll total = accumulate(A.begin(), A.end(), 0LL);
    cout << total << endl;

    return 0;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
map<int,int>Mp,mp,ap;
int n;
long long A[123456];
int ans;
int main(){
    long long x=1,y=1;
    int flag1=0,flag2=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        cin>>A[i];
        Mp[A[i]]++;
    }
    sort(A+1,A+1+n);
    for(int i=n;i>=1;i--){
        if(Mp[A[i]]>=2&&mp[A[i]]==0){
            mp[A[i]]=1;
            x*=A[i];
            ans++;
        }
        if(ans==2){
            flag1=1;
            break;
        }
    }
    for(int i=n;i>=1;i--){
        if(Mp[A[i]]>=4){
            y*=(A[i]*A[i]);
            flag2=1;
            break;
        }
    }
    if(flag1||flag2){
        cout<<max(x,y)<<endl;
    }else{
    cout<<"0"<<endl;
    }
    return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>
int main(void)
{
  int a,b,c,i;
  int d[105]={0};
  int p[100]={0};

  scanf("%d %d",&a,&b);

  for(i=0;i<a;i++){
    scanf("%d",&p[i]);
  }

  if(p[0]>a){
    c=0;
  }else{
    c=1;
  }

  for(i=1;i<=a;i++){
    d[i]=d[i-1]+p[i-1];
    if(d[i]<=b){
      c++;
    }
  }

  printf("%d\n",c);
  return 0;
}

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

int main() {
  int N,sum=0;
  cin >> N;
  vector<int> a(N),b(N);
  for(int i=0;i < N;i++){
    cin >> a.at(i);
  }
  for(int i=0;i < N;i++){
    cin >> b.at(i);
  }
  for(int i=0;i < N;i++){
    if(a.at(i)>b.at(i)){
      sum += a.at(i) - b.at(i);
    }
  }
  cout << sum << endl;
}


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

int main() {
	string s;
	cin >> s;
	bool ac = true;
	if (s[0] != 'A') ac = false;
	string a = s.substr(2, s.size() - 3);
	if (a.find("C") == -1) ac = false;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] >= 'A' && s[i] <= 'Z') {
			cnt++;
		}
		if (cnt > 2) {
			ac = false;
			break;
		}
	}
	(ac) ? puts("AC") : puts("WA");
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
ll dp[114514][3];
int main(){
    //cout << fixed << setprecision(15);
    string s;cin>>s;
    ll n=s.size();
    vl vec(114514);
    ll count=1;
    rep(i,n){
        vec[i]=count;
        if(s[i]=='?'){
            count*=3;
            count%=MOD;
        }
    }
    rep(i,n){
        if(s[i]=='A'){
            dp[i+1][0]=(dp[i][0]+vec[i])%MOD;
            dp[i+1][1]=dp[i][1];
            dp[i+1][2]=dp[i][2];
        }
        if(s[i]=='B'){
            dp[i+1][0]=dp[i][0];
            dp[i+1][1]=(dp[i][1]+dp[i][0])%MOD;
            dp[i+1][2]=dp[i][2];
        }
        if(s[i]=='C'){
            dp[i+1][0]=dp[i][0];
            dp[i+1][1]=dp[i][1];
            dp[i+1][2]=(dp[i][2]+dp[i][1])%MOD;
        }
        if(s[i]=='?') {
            dp[i+1][0]=(dp[i][0]*3+vec[i])%MOD;
            dp[i+1][1]=(dp[i][1]*3+dp[i][0])%MOD;
            dp[i+1][2]=(dp[i][2]*3+dp[i][1])%MOD;
        }
    }
    cout<<dp[n][2]<<endl;
}


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

int main(){
  string S;
  cin >> S;
  int count = 0;
  int length = 0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C'){
      count++;
    }else{
      if(count>length) length = count;
      count = 0;
    }
  }
  if(count>length) length = count;
  cout << length << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

//  2019 = 673 * 3
int main(){ cin.tie(0); ios::sync_with_stdio(false);
    lint L = in, R = in+1;
    if( R - L > 680 ) {
        cout << 0 << "\n";
        return 0;
    }

    lint ans = INT_MAX;
    for( lint i=L; i<R; i++ ) for( lint j=L; j<i; j++ ) {
        ans = min( ans, (i*j) % 2019 );
    }

    cout << ans << "\n";
}


Measured memory_bytes: 256
def ncr(n, r):
	return fact[n] // (fact[r] * fact[n-r]);


fact = [0 for x in range(100)];

fact[0] = 1
for i in range(1, 60):
	fact[i] = i * fact[i-1]

n, p = tuple(map(int, input().split()))

x = 0
y = 0

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

for i in range(n):
	if arr[i] % 2 == 0:
		x += 1
	else:
		y += 1

if (p == 0):
	i = 0
else:
	i = 1

ans = 0
while i <= y:
	ans += ncr(y, i)
	i += 2
print(ans * (2 ** x))

Measured memory_bytes: 3064
N, Y = map(int, input().split())
x = -1
y = -1
z = -1

for i in range(N+1):
    for j in range(N-i+1):
        if Y == i * 10000 + j * 5000 + (N-i-j) * 1000 and N-i-j >= 0:
            x = i
            y = j
            z = N - i - j
            break

print('{0} {1} {2}'.format(x, y, z))


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    static int abs(int a) {
        return Math.abs(a);
    }
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String line[] = bf.readLine().split("\\s");
        int n = Integer.parseInt(line[0]);
        int k = Integer.parseInt(line[1]);
        int ar [] =  new int[n];
        line = bf.readLine().split("\\s");
        for(int i=0;i<n;++i) {
            ar[i] = Integer.parseInt(line[i]);
        }
        int[]dp = new int[n];
        dp[0] = 0;
        dp[1] = abs(ar[1]-ar[0]);
        for(int i=2;i<n;i++) {
            dp[i] = Integer.MAX_VALUE;
            for( int j = Math.max(0, i-k);j<i;j++)
            {
                dp[i] = Math.min(dp[i], dp[j] + Math.abs(ar[i] - ar[j]));
            }
        }
        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 34556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < (n); ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");

int main() {
    in(a);
    in(b);
    in(c);
    in(d);
    //++++
    if (a >= 0 && c >= 0) {
        out(b * d);
    }
    //----
    if (b < 0 && d < 0) {
        out(a * c);
    }

    //--++
    if (a < 0 && b < 0 && c >= 0 && d >= 0) {
        out(b * c);
    }
    //++--
    if (a >= 0 && b >= 0 && c < 0 && d < 0) {
        out(a * d);
    }
    //-+-+
    if (a < 0 && b >= 0 && c < 0 && d >= 0) {
        if (b * d < a * c) {
            out(a * c);
        } else {
            out(b * d);
        }
    }

    //---+
    if (a < 0 && b < 0 && c < 0 && d >= 0) {
        out(a * c);
    }
    //++-+
    if (a >= 0 && b >= 0 && c < 0 && d >= 0) {
        out(b * d);
    }

    //-+--
    if (a < 0 && b >= 0 && c < 0 && d < 0) {
        out(a * c);
    }
    //-+++
    if (a < 0 && b >= 0 && c >= 0 && d >= 0) {
        out(b * d);
    }
}

Measured memory_bytes: 3672
import sys
import math
import numpy as np
import copy


class unionfind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.rank = [0 for i in range(n)]
        self.groupnum = n

    def unite(self, a, b):
        pa = self.find(a)
        pb = self.find(b)
        if pa == pb:
            return
        self.parent[pa] = pb
        # if(self.rank[pa] < self.rank[pb]):
        #     self.parent[pa] = pb
        # else:
        #     self.parent[pb] = pa
        #     if self.rank[pa] == self.rank[pb]:
        #         self.rank[pa] += 1
        self.groupnum -= 1

    def same(self, a, b):
        pa = self.find(a)
        pb = self.find(b)
        return pa == pb

    def find(self, a):
        if self.parent[a] == a:
            return a
        p = self.find(self.parent[a])
        self.parent[a] = p
        return p
    


def main():
    n, m = map(int, input().split())
    edges = [[] for i in range(n)]

    edge_list = []

    for i in range(m):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        edges[a].append(b)
        edges[b].append(a)
        edge_list.append((a, b))

    cnt = 0
    # 除外する辺ごとに。
    for i in range(m):
        uf = unionfind(n)
        for j in range(m):
            if i == j:
                continue
            uf.unite(edge_list[j][0], edge_list[j][1])
        if uf.groupnum >= 2:
            cnt += 1


    print(cnt)
    return 0

if __name__ == '__main__':
    sys.exit(main())

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#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)
#define sz(s) (int)s.size()
#define all(v) v.begin(),v.end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef long double ld;
const ll inf = (ll)1e18+1;
const int N = (int)1e5+77;
const ll mod = (ll)1e9+7;

ll n,m,k,x,y;

int main() {
    fast;
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    m = 1e9;
    fore(i, a[2], N) {
        int b[3] = {0};
        k = 0, n = 0;
        forn(j, 3) b[j] = i - a[j], k += b[j];
        sort(b, b + 3);
        if (k & 1) continue;
        n = min(b[0], b[1]);
        b[1] -= b[0];
        n += min(b[1], b[2]);
        b[2] -= b[1];
        n += b[2] / 2;
        m = min(m, n);
    }
    cout << m << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int h, w, k; cin >> h >> w >> k;
    vector<string> s(h);
    vector<pair<int, int>> P;
    rep(i, h){
        cin >> s[i];
        int cnt = 0; 
        rep(j, w){
            if(s[i][j] == '#'){
                cnt++;
            }
        }
        if(cnt > 0) P.emplace_back(make_pair(i, cnt));
    }
    P.emplace_back(make_pair(h, 0));
    // rep(i, P.size()) cout << P[i].first << endl;
    vector<vector<int>> A(h, vector<int>(w, 0));
    int cnt = 0;
    rep(k, P.size()-1){
        int h_k;
        h_k = P[k+1].first - P[k].first;
        cnt++;
        bool flag = false; // 一つ目のイチゴを見つけたか
        for(int j = 0; j < w; j++){
            if(s[P[k].first][j] == '#'){
                if(flag) cnt++;
                else flag = true;
            }
            for(int i = P[k].first; i < P[k].first+h_k; i++){
                A[i][j] = cnt;
            }
        }
    }
    for(int i = P[0].first-1; i >= 0; i--){
        for(int j = 0; j < w; j++){
            A[i][j] = A[i+1][j];
        }
    }
    rep(i, h){
        rep(j, w){
            cout << A[i][j] << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 1280
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, M, X = nl()
As = nl()

before = 0
after = 0
for i in range(M):
    if As[i] < X:
        before += 1
    if X < As[i]:
        after += 1
print(min(before, after))


Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

k,x=map(int,input().split())
if k*500>=x:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx,avx2")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const ld inf = 6e8;
const ld eps = 1e-10;

int n;
vector<ld> x, y;
vector<char> d;

ld get_x(int i, ld t) {
    if (d[i] == 'L') return x[i] - t;
    if (d[i] == 'R') return x[i] + t;
    return x[i];
}

ld get_y(int i, ld t) {
    if (d[i] == 'D') return y[i] - t;
    if (d[i] == 'U') return y[i] + t;
    return y[i];
}

ld solve(ld t) {
    ld mx_x = -inf * inf, mn_x = inf * inf;
    ld mx_y = -inf * inf, mn_y = inf * inf;
    for (int i = 0; i < n; i++) {
        ld xx = get_x(i, t);
        ld yy = get_y(i, t);
        mx_x = max(mx_x, xx);
        mn_x = min(mn_x, xx);
        mx_y = max(mx_y, yy);
        mn_y = min(mn_y, yy);
    }
    return (mx_x - mn_x) * (mx_y - mn_y);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;
    x.resize(n);
    y.resize(n);
    d.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> d[i];
    }
    ld l = 0.0, r = inf, m2, m1;
    for (int i = 0; i < 200; i++) {
        m1 = l + (r - l) / 3;
        m2 = r - (r - l) / 3;
        if (solve(m1) + eps > solve(m2)) {
            l = m1;
        } else {
            r = m2;
        }
    }
    cout << fixed << setprecision(12) << solve(l) << "\n";
    return 0;
}

Measured memory_bytes: 6416
import sys
def slove(goods, carnum, P):
    tot_good = len(goods)
    cur_good = 0
    for _ in range(carnum):
        load = 0
        while cur_good < tot_good and goods[cur_good] <= P -load:
            load += goods[cur_good]
            cur_good += 1
    if cur_good == tot_good:
        return True
    else:
        return False

if __name__ == '__main__':

    datas = input().split(' ')
    good_num = int(datas[0])
    car_num = int(datas[1])
    goods = []
    for _ in range(good_num):
        goods.append(int(input()))

    left = 0
    right = sys.maxsize
    while left < right:
        mid = (left + right) // 2
        if slove(goods, car_num, mid):
            # 当前的P较大
            right = mid
        else:
            left = mid + 1
    print(right)
    


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

a1 = A[-1]
dif = float("inf")
for i in range(N-1):
    if abs(A[i] - a1/2) < dif:
        a2 = A[i]
        dif = abs(A[i] - a1/2)

print(*[a1,a2])

Measured memory_bytes: 62704
/*
	Created by Faisal Ahmed
*/
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;

int main()
{
	double n;
	
	cin >> n;
	
	double d = n / 3;
	double e = n / 3;
	double f = n - (d + e);
	
	double ans = d * e * f;
	
	printf("%0.12lf\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

import java.util.ArrayList;
import java.util.List;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<String> str = new ArrayList<String>();
		int strCnt = 0;
		while(true){
			String tmp = scan.nextLine();
			if(tmp.equals("-")){
				break;
			}
			str.add(tmp);
			int num = Integer.parseInt(scan.nextLine());
			int cnt = 0;
			while(cnt<num){
				int h = Integer.parseInt(scan.nextLine());
				// try{
				// 	String tmp = scan.nextLine();
				// 	if(tmp.equals("-")){
				// 		System.out.print(str);
				// 		return;
				// 	}
				// 	h  = Integer.parseInt(tmp);
				// }catch(NumberFormatException e){
				// 	break;
				// }
				String first = str.get(strCnt).substring(0,h);
				String second = str.get(strCnt).substring(h, str.get(strCnt).length());
				// System.out.println(first+","+second);
				str.set(strCnt,second + first);
				// System.out.println(str);
				cnt++;
			}
			strCnt++;
		}
		for(String s: str){
			System.out.println(s);
		}
	}

}



Measured memory_bytes: 26320
#include<stdio.h>
int main() 
{
    int x[3000],y[3000],n,a;
    n = 0;
    while (1) 
    {
        scanf("%d %d", &x[n],&y[n]);
        if ((x[n] == 0) && (y[n] == 0)) break;
        if (x[n] > y[n])
        {
            a = y[n];
            y[n] = x[n];
            x[n] = a;
        }
            n = n + 1;
             
    }
    n = 0;
    while (1)
    {
        if ((x[n] == 0) && (y[n] == 0)) break;
        printf("%d %d\n", x[n], y[n]);
        n = n + 1;
    }
    return 0;
}

Measured memory_bytes: 624
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    string S;

int main(){
    cin>>S;
    REP(i,(signed)S.size()-8)cout<<S[i];
    return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;
//bool comp(
//
//	st pll &a, const pll &b) {
//	return a.first < b.first;
//}
//std::vector<int> enum_div(int n)//nの約数を列挙
//{
//	std::vector<int> ret;
//	for (int i = 1; i*i <= n; ++i)
//	{
//		if (n%i == 0)
//		{
//			ret.push_back(i);
//			if (i != 1 && i*i != n)
//			{
//				ret.push_back(n / i);
//			}
//		}
//	}
//	return ret;
//}

template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}

int main()
{
	priority_queue<int> q;
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	string s = {};
	char x[302][302] = {};
	ll y[302][302] = {};

	cin >> h;
	for (double i = 0; i <= 50000; i++)
	{
		b = i*1.08;
		if (b==h)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;

	//cout<<factorial<10><<endl;

	//cin >> a >> b;
	//for (int i = 0; i < a; i++)
	//{
	//	cin >> s[i];
	//	if (s[i] >= b)
	//	{
	//		ans++;
	//	}
	//}

	//cout << ans << endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000 + 7;

template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower) % modd)*a) % modd;
      }
  }
};


int main()   {
    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, 1000);   // rand_gen(rng) gets the rand no
    ll modd = 1000*1000*1000 + 7;

//    auto start = chrono::steady_clock::now();

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(k); readstring(s);

        ll ret = 0;
        ll temp = fastpower<ll>(26, k);
        ll inverse26 = fastpower<ll>(26, modd-2);
        for(int i = 0; i <= k; ++i) {
            if (i>0) {
                temp *= inverse26; temp = temp % modd;
                temp *= 25; temp = temp % modd;
                temp *= (s.size()+i-1); temp = temp % modd;
                temp *= fastpower<ll>(i, modd-2); temp = temp % modd;
            }

            ret += temp;
        }
        cout << (ret%modd) << endl;
    }

//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;

    return 0;
}

Measured memory_bytes: 5328
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: String,
        b: String,
    }
    let mut vec_a: Vec<u64> = Vec::new();
    let mut vec_b: Vec<u64> = Vec::new();
    let mut count = 0;

    for a in a.bytes() {
        vec_a.push(a as u64);
    }

    for b in b.bytes() {
        vec_b.push(b as u64);
    }

    for index in 0..vec_a.len() {
        if !(vec_a[index] == vec_b[index]) {
            count += 1
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  int n;cin >> n;
  int ans=0;
  rep(i,n){
    int k=i+1;
    int cnt=0;
    rep(j,k)if(k%(j+1)==0&&k%2==1)cnt++;
    if(cnt==8)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int h, w,a,b;
	for (;;) {
		cin >> h >> w;
		if (h < 1 && w < 1) {
			return 0;
		}
		a = h;
		b = w;
		for (; h > 0;h=h-1) {
			if ((a - h) % 2 == 0) {
				for(;w>0;w=w-1){
					if ((b - w) % 2 == 0) {
						cout << "#";
					}
					else {
						cout << ".";
					}
				}
				w = b;
				cout << endl;
			}
			else {
				for (; w > 0; w = w - 1) {
					if ((b - w) % 2 == 0) {
						cout << "." ;
					}
					else {
						cout << "#" ;
					}
				}
				w = b;
				cout << endl;
			}
		}
		h = a;
		cout << endl;
	}
}


Measured memory_bytes: 3120
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#include <map>
#include <vector>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>

using namespace std;
typedef long long llint;
const llint inf = 1000000000000000000LL;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

int main(void) 
{
  int N, M;
  cin >> N >> M;

  llint t = (llint)(N - M) * 100 + (llint)M * 1900;
  REP(i, M) t *= 2;

  printf("%lld\n", t);


  return 0;
}




Measured memory_bytes: 256
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def main():
    C = str(input())

    n = ord(C) - ord('A') + 1

    ans = chr(n+64+1)

    print(ans)

if __name__ == "__main__":
	main()

Measured memory_bytes: 9024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

const int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    k--;
    if (s[k] == 'A') s[k] = 'a';
    else if (s[k] == 'B') s[k] = 'b';
    else s[k] = 'c';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace ZDY{
#define fir freopen("2.in","r",stdin)
#define ll long long
#define db double
#define Fur(i,x,y) for(int i=x;i<=y;i++)
#define fur(i,x,y) for(i=x;i<=y;i++)
#define Fdr(i,x,y) for(int i=x;i>=y;i--)
#define in2(x,y) in(x),in(y)
#define in3(x,y,z) in2(x,y),in(z)
#define in4(a,b,c,d) in2(a,b);in2(c,d)
#define clr(x,y) memset(x,y,sizeof(x))
#define cpy(x,y) memcpy(x,y,sizeof(x))
#define fl(i,x) for(ll i=head[x],to;to=e[i].to,i;i=e[i].next)
#define inf 2147483647
}
namespace FAST{
#define pob (fwrite(fob::b,sizeof(char),fob::f-fob::b,stdout),fob::f=fob::b,0)
#define pc(x) (*(fob::f++)=(x),(fob::f==fob::g)?pob:0)
#define gc ((*fib::f)?(*(fib ::f++)):(fgets(fib::b,sizeof(fib::b),stdin)?(fib::f=fib::b,*(fib::f++)):-1))
namespace fib{char b[300000]= {},*f=b;}namespace fob{char b[300000]= {},*f=b,*g=b+300000-2;}struct foce{~foce(){pob;fflush(stdout);}} _foce;namespace ib{char b[100];}template<class T>inline void in(T &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}template<class T>inline void out(T x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}template<class T>inline void outn(T x){out(x);pc('\n');}
inline char sc(){char c=gc;while(!(('A'<=c&&c<='Z')||('a'<=c&&c<='z')||('0'<=c&&c<='9')))c=gc;return c;}
template<class T>inline T ABS(T x){return x>0?x:-x;}
template<class T>inline T MAX(T x,T y){return x>y?x:y;}
template<class T>inline T MIN(T x,T y){return x<y?x:y;}
template<class T>inline T GCD(T x,T y){return y?GCD(y,x%y):x;}
template<class T>inline void swap(T x,T y){T t=x;y=t;x=y;}
}using namespace FAST;using namespace ZDY;using namespace std;
#define N 10001
int n;
int main(){
	in(n);
    int k=0;
    while(k<=n){
        if(((n-k)%7)==0){
            printf("Yes\n");
            return 0;
        }
        k+=4;
    }
    printf("No\n");
}

Measured memory_bytes: 256