akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#define ll long long; int
#define req(i,k) for(int i = 0; i < k; i++)
using namespace std;


int main(void) {
    int n;
    cin >> n;
    vector<int> l(n);
    req(i,n) {
        cin >> l.at(i);
    }
    int x = 0;
    sort(l.begin(), l.end());
    req(i,n-1) {
        x += l.at(i);
    }
    if(x > l.at(n-1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
X = input()
N = len(X)
c = 0
s, t = 0, 0
for k in range(N):
    if X[k] == "S":
        s += 1
    else:
        t += 1
        if s > 0 and t > 0:
            s -= 1
            t -= 1
            c += 2
print(N-c)


Measured memory_bytes: 67016
n = gets.to_i
ans = 0
A = []
B = []
n.times do
  a,b = gets.split.map &:to_i
  A.unshift(a)
  B.unshift(b)
end

n.times do |i|
  a = A[i]
  b = B[i]
  r = (a + ans) % b
  ans += b - r if r != 0
end
puts ans

Measured memory_bytes: 3696
#include<iostream>
using namespace std;
int main()
{
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin>>k;
  cout<<a[k-1];
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n;
	cin >> n;
	int num = n / 111;
	if (n % 111 != 0) num++;
	cout << num * 111 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;
int main() {
	string s; cin>>s;
	int n=s.size();
	int ans=0;
	for(int i=0; i<n; ++i) {
		if(s[0]=='0') {
			if(i%2==0&&s[i]=='1')++ans;
			else if(i%2==1&&s[i]=='0')++ans;
		}
		else if(s[0]=='1') {
			if(i%2==0&&s[i]=='0')++ans;
			else if(i%2==1&&s[i]=='1')++ans;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n,m;
	cin>>n>>m;
 
	long long arr[n+1];
	arr[0]=0;
	long long a;
	map<long long,long long> ma;
	ma[0]=1;
    long long ans=0;
	for(long long i=1;i<=n;i++)
	{
		cin>>a;
		arr[i]=((arr[i-1]+a)%m);
		if(ma[arr[i]]>0)
		{
			ans+=ma[arr[i]];
			ma[arr[i]]++;
		}
		else
		ma[arr[i]]=1;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		String S=stdIn.next();
		int ans=0;
		for(int i=0;i<1000;i++){
			boolean key=false;
			String a[]=new String[3];
			int b=0;
			a[2]=String.valueOf(i%10);
			if(i<100)
				a[0]="0";
			else
				a[0]=String.valueOf(i/100);
			if(i<10)
				a[1]="0";
			else
				a[1]=String.valueOf(i/10%10);
			for(int j=0;j<N;j++){
				if(a[b].equals(S.substring(j,j+1)))
					b++;
				if(b==3){
					key=true;
					break;
				}
			}
			if(key)
				ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 343320
def solve(n, m):
    if 2 * n <= m: #on utilise tous les s
        r1 = n
    else:
        r1 = m // 2
    m -= 2 * r1

    r2 = m // 4

    res = r1 + r2
    return res

n, m = input().split()
n = int(n)
m = int(m)
print(solve(n, m))



Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;

int n,m,p;
int x[400],y[400];
int h[7][7],t[7][7][7];

int dx[]={1,0,0,1,1,0,1,-1,0,1,-1,1,1};
int dy[]={0,1,0,1,0,1,-1,0,1,1,1,-1,1};
int dz[]={0,0,1,0,1,1,0,1,-1,1,1,1,-1};

void putball(int x,int y,int colar){
	t[y][x][h[y][x]]=colar;
	h[y][x]++;
}

bool judge(int colar){
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			for(int k=0;k<7;k++){
				for(int q=0;q<13;q++){
					int cnt=0;
					while(1){
						int nx=i+dx[q]*cnt,ny=j+dy[q]*cnt,nz=k+dz[q]*cnt;
						if(0<=nx&&nx<7&&0<=ny&&ny<7&&0<=nz&&nz<7&&t[nx][ny][nz]==colar){
							cnt++;
						}else break;
					}
					if(cnt>=m)return true;
				}
			}
		}
	}
	return false;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		cin >> n >> m >> p;
		if(n==0&&m==0&&p==0)break;
		for(int i=0;i<p;i++){
			cin >> x[i] >> y[i];
			x[i]--; y[i]--;
		}
		for(int i=0;i<7;i++){
			for(int j=0;j<7;j++){
				h[i][j]=0;
				for(int k=0;k<7;k++){
					t[i][j][k]=-1;
				}
			}
		}
		int t=0;
		bool ok=0;
		for(int i=0;i<p;i++){
			putball(x[i],y[i],t);
			if(judge(t)){
				if(t==0){
					printf("Black %d\n",i+1);
				}else{
					printf("White %d\n",i+1);
				}
				ok=1;
				break;
			}
			t^=1;
		}
		if(!ok){
			printf("Draw\n");
		}
	}
}


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


int main(){
    int n,q;
    cin >> n;
    map<int,int> number_map;
    long long sum=0;
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        sum += k;
        if(number_map.count(k)){
            number_map.at(k) ++;
        }else{
            number_map[k] = 1;
        }
    }
    cin >> q;
    for(int i=0; i<q; i++){
        int b,c;
        cin >> b >> c;
        if(number_map.count(b)){
            int countb = number_map.at(b);
            number_map.at(b) = 0;
            if(number_map.count(c)){
                number_map.at(c) += countb;
            }else{
                number_map[c] = countb;
            }
            sum += (c-b) * countb;
        }
        cout << sum << endl;
    }
    
}

Measured memory_bytes: 7424
#include <stdio.h>
int main(void){
    int n,i,max1=0,max2=0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(max1<a[i]){
            max2=max1;
            max1=a[i];
        }
        else if(max2<a[i]) max2=a[i];
    }
    if(max1==max2){
        for(i=0;i<n;i++) printf("%d\n",max1);
    }
    else{
         for(i=0;i<n;i++){
             if(max1==a[i]) printf("%d\n",max2);
             else printf("%d\n",max1);
         }
    }
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT
 
using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;
 
template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }
 
int n;
int m;
map<ll, int> cnt;
 
int main () {
    scanf ("%d", &n);
    ll cur = 0;
    cnt[0]++;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        scanf ("%d", &x);
        cur += x;
        ans += cnt[cur];
        cnt[cur]++;
    }
    cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(int i = 0; i < 5; i++) {
        int val;
        cin >> val;
        if(val == 0) {
            cout << i + 1 << '\n';
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3656
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	int n,k;cin>>n>>k;
	if(n*500>=k)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
N = gets.to_i
S = gets.chomp

if N < 3
  p 0
  exit 0
end

ret = S.count('R') * S.count('G') * S.count('B')

d = 1
while d*2<N
  i = 0
  while i+d*2<N
    if S[i] != S[i+d] && S[i] != S[i+d+d] && S[i+d] != S[i+d+d]
      ret -= 1
    end
    i += 1
  end
  d += 1
end

puts ret


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

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var reward = 0;
        foreach (var v in vals)
        {
            switch (v)
            {
                case 3:
                    reward += 100000;
                    break;
                case 2:
                    reward += 200000;
                    break;
                case 1:
                    reward += 300000;
                    break;
            }
        }
        if (vals[0] == 1 && vals[1] == 1)
        {
            reward += 400000;
        }
        Console.WriteLine(reward);
    }
}

Measured memory_bytes: 13268
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            Console.WriteLine(800*n - (200*(n/15)));
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
	int n;
	while(cin >> n)
	{
		int cnt = 0;
		
		for(int i0 = 0; i0 < 10; ++i0)
			for(int i1 = 0; i1 < 10; ++i1) 
				for(int i2 = 0; i2 < 10; ++i2) 
					for(int i3 = 0; i3 < 10; ++i3) 
						if(n == i0 + i1 + i2 + i3) cnt++;
		cout << cnt << endl;
	} 
}


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

long long maxn = 1000000000000001;


int main(){
	long long N;
	cin >> N;
	
	string str = "";

	
	while(N != 0){
		long long r = N % 26;
		char rs = 'a' + ((r+25)%26);
		str = rs + str;
		N /= 26;

		if(r == 0){
			N--;
		}
	}
	cout << str << endl;

	return 0;
}


Measured memory_bytes: 3580
# 乗法のmod逆元 (mod-2乗)
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
 
# nCr mod m
# modinvが必要
# rがn/2に近いと非常に重くなる
def comb(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
  
def binary(n):
    return bin(n)[2:]

# バイナリ法
def pow_by_binary(a, x, n): # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y
  
n,a,b = [int(i) for i in input().split()]
mod = 10**9+7
ans = pow_by_binary(2,n,mod)-1-comb(n,a,mod)-comb(n,b,mod)
if ans < 0:
  ans += mod
print(ans%mod)

Measured memory_bytes: 40300
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    ll x; cin >> x;
    int ans = 0;
    ll ima = 100;
    double i = 100;
    while (ima < x){
        ans++;
        i *= 1.01;
        ima = i;
        i = ima;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>
using namespace std;
bool is_integer(double x)
{
  return floor(x) == ceil(x);
}
int main()
{
  string s;
  cin >> s;
  int max = 0;
  bool tmp = false;
  int h = 0;
  if (s.compare("SSS") == 0)
    h = 0;
  else if (s.compare("SSR") == 0 || s.compare("SRS") == 0 || s.compare("RSS") == 0 || s.compare("RSR") == 0)
    h = 1;
  else if (s.compare("SRR") == 0 || s.compare("RRS") == 0)
    h = 2;
  else if (s.compare("RRR") == 0)
    h = 3;
  cout << h << endl;
}


Measured memory_bytes: 3624
fun main(args: Array<String>) {

    val (l, r) = readLine()!!.split(" ").map { it.toLong() }

    var ans = 2019L
    for(i in l until r){
        for(j in i+1..r){
            ans = Math.min(ans, ((i % 2019) * (j % 2019)) % 2019)
            if(ans == 0L) {
                println(ans)
                return
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 37868
n = int(input())
l = list(map(int,input().split()))
l1=sorted(l)
a = l1[n//2-1]
b = l1[n//2]
if a == b:
  for i in range(n):
    print(a)
else:
  for i in l:
    if i <= a:
      print(b)
    else:
      print(a)
  


Measured memory_bytes: 26772
#include <iostream>

using namespace std;
#define MAX 1000000
#define INF 1000000000

int dp1[MAX + 1],dp2[MAX + 2];

int main(){
    for(int i = 1; i <= MAX; i++){
        dp1[i] = INF;
        dp2[i] = INF;
    }

    for(int n = 1; n * (n + 1) * (n + 2) / 6 <= MAX; n++){
        int a = n * (n + 1) * (n + 2) / 6;
        for(int i = a; i <= MAX; i++){
            dp1[i] = min(dp1[i],dp1[i - a] + 1);
        }
        if(a % 2 == 0){
            continue;
        }
        for(int i = a; i <= MAX; i++){
            dp2[i] = min(dp2[i],dp2[i -a] + 1);
        }
    }

    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        cout << dp1[n] << " " << dp2[n] << endl;
    }

    return 0;
}


Measured memory_bytes: 10792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int c0 = 0, c1 = 0;
            for (char cc : in.next().toCharArray()) {
                if (cc == '0')
                    c0++;
                else
                    c1++;
            }
            out.println(Math.min(c0, c1) * 2);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
            this.bufPointer = 0;
            this.bufLength = 0;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 22356
/********************************************************
 **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
 **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
 **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
 **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
 **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
 **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
 *********************************************************/

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


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos

#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define  MN                           INT_MIN
#define  MX                           INT_MAX

bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}

bool check(string s, int len,int n){
    unordered_map<string,int> m;
    for(int i = 0;i < n - len + 1;i++)
    {
        if( m[s.substr(i, len)] == 0)
        {
            m[s.substr(i, len)] = i+len-1;
        }
        if(m[s.substr(i,len)] > 0 &&  i > m[s.substr(i,len)])return true;
    }
    return false;
}
int32_t main()
{
    fastio
    int n;
    string s;
    cin >> n >> s;
    int l = 0, r = n / 2 ;
    int ans = 0;
    while(l<=r)
    {
        int mid = l + (r-l) / 2;
        if(check(s,mid, n)){
            ans = mid;
            l = mid + 1;
        }else{
            r = mid - 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 9960
D=int(input())
C=list(map(int,input().split()))
S=list()
for i in range(D):
  S.append(list(map(int,input().split())))
t=[0]*D
M=0
N=0
L=-10000000000000000000000
di=[0]*26
ddi=[0]*26
for d in range(D):
  #j番目のコンテストについてのスコアが最もよくなるものを求める
  for j in range(26):
    for i in range(26): #ddiはj番目のコンテスト以外はdi+1,j番目は0
      if i==j:
        ddi[i]=0
      else:
        ddi[i]=di[i]+1
    N=S[d][j] #sを加算
    for i in range(26): #c*ddiを減算
      N-=C[i]*ddi[i]
    if N>L:
      L=N
      di=ddi
      t[d]=j+1
  L=-10000000000000000000000 #次の日になる前にLをリセット

for i in range(D):
  print(t[i])

Measured memory_bytes: 9520
#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int N ;
int F[100005],h[100005];
int main()
{
    cin >> N ;
    F[1] = F[0] = h[0] = 0 ;
    for(int i = 1 ; i<= N ; i++)
        cin >> h[i];
    F[2] = F[1] + abs(h[2]-h[1]);
    for(int i = 3 ; i<= N; i++)
        F[i] = min(F[i-1]+abs(h[i]-h[i-1]),F[i-2]+abs(h[i]-h[i-2]));
    cout << F[N] ;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n, k, q;
  cin >> n >> k >> q;
  int a[q];
  for(int i = 0; i < q; i++) cin >> a[i];

  int b[n];
  fill(b, b + n, k);
  for(int i = 0; i < q; i++){
    b[a[i] - 1]++;
  }

  bool ans[n];
  for(int i = 0; i < n; i++){
    ans[i] = (b[i] - q > 0);
  }

  string buf;
  for(int i = 0; i < n; i++){
    if(ans[i]) buf += "Yes";
    else buf += "No";
    buf += "\n";
  }

  cout << buf;

  return 0;
}


Measured memory_bytes: 2044
$<.readlines.map {|a| a.split.map(&:to_i)}.each_slice(2) do |a, b|
  a1, b1 = [], []
  hit = 0
  a.each_index do |i|
    if a[i] == b[i]
      hit += 1
    else
      a1 << a[i]
      b1 << b[i]
    end
  end
  blow = a1.size - (a1 - b1).size
  puts "#{hit} #{blow}"
end


Measured memory_bytes: 6860
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  char prev = s[0];
  for (int i = 1; i < 4; i++) {
    if (prev == s[i]) {
      cout << "Bad" << endl;
      return 0;
    }
    prev = s[i];
  }
  cout << "Good" << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
x = [0] * n
# 合計を求める
x[0] = sum(a)
# 初項x_1
for i in range(1, n - 1, 2):
    x[0] -= 2 * a[i]
# 漸化式で前から求める
for i in range(1, n):
    x[i] = 2 * a[i - 1] - x[i - 1]
print(*x)

Measured memory_bytes: 14092
N,Q=gets.split.map &:to_i
S=gets.chomp
td=$<.map{|s|s.split}
l=0
r=N-1
td.reverse.map{|t,d|
	l+=1 if S[l]==t&&d==?L
	r+=1 if r+1<N&&S[r+1]==t&&d==?L
	r-=1 if S[r]==t&&d==?R
	l-=1 if l-1>=0&&S[l-1]==t&&d==?R
}
p [r-l+1,0].max

Measured memory_bytes: 47100
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    int N; cin >> N;
    vector<int> v, P(N), Q(N);
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];
    for (int i = 1; i <= N; ++i) v.push_back(i);

    int k = 0, m = 0, n = 0, x;

    do {
        ++k;
        int jj = 0;
        rep(i, N) if (v[i] == P[i]) { ++jj; }
        if (jj == N) { m = k; }
        jj = 0;
        rep(i, N) if (v[i] == Q[i]) { ++jj; }
        if (jj == N) { n = k; }
        if (m > 0 && n > 0) { x = abs(m - n); break; }
    } while (next_permutation(v.begin(),v.end()));
    
    cout << x << endl;

}

Measured memory_bytes: 888
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}



signed main(){
	ll n,sum = 0,memo = 0,ans = LINF;
	cin >> n;
	ll a[n];
	rep(i,0,n){
		cin >> a[i];
		sum += a[i];
	}
	
	rep(i,0,n){
		memo += a[i];
		ans = min(ans, abs(sum - 2*memo));
		
	}
	cout << ans << endl;
	
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll N;
ll a[404];
ll dp[404][404];
ll as[404];

ll rec(ll i, ll j){
	if(dp[i][j]>=0) return dp[i][j];
	if(i==j) return 0;
	ll res = LLONG_MAX/3;
	REP(k, j-i){
		res = min(res, (as[i+k+1] - as[i]) + (as[j+1] - as[i+k+1]) + rec(i, i+k)+rec(i+k+1, j));
	}
	dp[i][j] = res;
	return res;
}

int main(){
	cin >> N;
	REP(i, N) cin >> a[i];
	REP(i, 404)REP(j, 404) dp[i][j] = -1;
	as[0] = 0;
	REP(i, N) as[i+1] = a[i] + as[i];

	cout << rec(0, N-1) << endl;
    return 0;
}

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

#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx_ori[4] = { -1,0, 1,0 }, dy_ori[4] = { 0,1,0,-1 };
int dx[4] = {0, 0, 0, 0}, dy[4] = {0, 0, 0, 0};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
  int x;
  cin >> x;
  for (int i = 1; i * 100 <= x; i++) {
    int y = x - i * 100;
    if (y <= 5 * i) {
      cout << 1 << endl;
      return 0;
    }
    
  }
  cout << 0 << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  int ans = 0;
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      if(j <= i) continue;
        ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >> E;
  int L = min((A + 9) % 10,min((B + 9) % 10,min((C + 9) % 10,min((D + 9) % 10,(E + 9) % 10)))) + 1;
  int F = (A + 9) / 10 + (B + 9) / 10 + (C + 9) / 10 + (D + 9) / 10 + (E + 9) / 10;
  cout << F * 10 - 10 + L;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (c-b <= 0)
    cout << "delicious" << endl;
  else if(c-b <= a)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    int h[n];
    rep(i, n) cin >> h[i];
    int ans = 0;
    int num = 0;
    rep(i, n - 1){
        if(h[i] >= h[i+1]){
            num++;
        }else{
            ans = max(num, ans);
            num = 0;
        }
    }
    ans = max(num, ans);
    cout << ans << endl;
}

Measured memory_bytes: 3964
#include <stdio.h>
#include <algorithm>

using namespace std;

typedef struct {
  int v;
  int i;
} data;

data map[100];

int greater(data a, data b){
  if(a.v > b.v) return 1;
  else if(a.v == b.v) return a.i < b.i;
  else return 0;
}

int main(){
  int i;
  for(i=0;i<100;i++) map[i].i=i+1,map[i].v = 0;

  int n;
  while(scanf("%d", &n)!=EOF) map[n-1].v++;

  sort(map, map+100, greater);

  int v = map[0].v;

  for(i=0;i<100;i++){
    if(map[i].v == v) printf("%d\n", map[i].i);
    else break;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
	int n;
	int c;
	
	while (1){
		c = 0;
		
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		while (n != 1){
		
			if (n % 2 == 0){
				n = n / 2;
				c++;
			}	
			else if(n % 2 == 1){
				n = n * 3 + 1;
				c++;
			}
		}
	
		printf("%d\n", c);
	
	}
	
	return (0);
	
}

Measured memory_bytes: 596
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1005;
const int mod=1e9+7;

int R,C,a,b,c,d,dp[N][N];
char g[N][N];
int rec(int i,int j){
    if(i<=0 or j<=0 or i>R or j>C) return 1e9;
    if(g[i][j]=='#') return 1e9;
    if(i==c and j==d) return 0;
    int &cache=dp[i][j];
    if(cache!=-1) return cache;
    cache=1e9;
    rep(u,-2,2) rep(v,-2,2){
        if(u==0 and v==0) continue;
        int t=1;
        if(abs(u)+abs(v)==1) t=0;
        cache=min(cache,t+rec(i+u,j+v));
    }
    return cache==1e9?-1:cache;
}
signed main(){
    FastIO;
//    cin>>R>>C>>a>>b>>c>>d;
//    memset(dp,-1,sizeof dp);
//    rep(i,1,R) rep(j,1,C) cin>>g[i][j];
//    cout<<rec(a,b);

    int h,w,m;
    cin>>h>>w>>m;
    set<int>r[h+5],c[w+5];
    int maxir=0,maxic=0;
    vector<int>v,u;
    rep(i,1,m){
        int a,b;
        cin>>a>>b;
        r[a].insert(b);
        if(r[a].size()==maxir) v.pb(a);
        if(r[a].size()>maxir){
            v.clear();
            maxir=r[a].size();
            v.pb(a);
        }
        c[b].insert(a);
        if(c[b].size()==maxic) u.pb(b);
        if(c[b].size()>maxic){
            u.clear();
            maxic=c[b].size();
            u.pb(b);
        }
    }
    int ans=maxir+maxic;
    rep(i,0,v.size()-1){
        rep(j,0,u.size()-1){
            if(!r[v[i]].count(u[j]) and !c[u[j]].count(v[i])) return cout<<ans,0;
        }
    }
    cout<<ans-1;
    return 0;
}


Measured memory_bytes: 61748
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i] = in.nextInt();
		}
		int q = partition(A,0,n-1);
		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			if(i==q)System.out.print("[");
			System.out.print(A[i]);
			if(i==q)System.out.print("]");
		}
		System.out.println("");
	}
	
	public static int partition(int[] A,int p,int r){
		int x = A[r];
		int i = p-1;
		for(int j=p;j<r;j++){
			if(A[j]<=x){
				i = i +1;
				int temp = A[i];
				A[i] = A[j];
				A[j] = temp;
			}
		}
		int current = A[i+1];
		A[i+1] = A[r];
		A[r] = current;
		return i+1;
	}
}



Measured memory_bytes: 71316
a=list(input())
b=list(input())
c=list(input())
y=a
a.append("A")
b.append("B")
c.append("C")
while 1:
    k=y.pop(0)
    if len(y)==0:
        print(k.upper())
        exit()
    if k=="a":
        y=a
    elif k=="b":
        y=b
    else:
        y=c

Measured memory_bytes: 3064
w,h,x,y = gets.to_s.split
w,h,x,y = w.to_i, h.to_i, x.to_i, y.to_i

c = (w == 2 * x && h == 2 * y) ? 1 : 0

puts "#{(w * h) / 2.0} #{c}"

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

string S;
int N;

void input() {
    cin >> N;
}

int main() {
    input();

    if (N % 2){
        cout << (N / 2) + 1 << endl;
    } else{
        cout << (N / 2) << endl;

    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline int sod_L(T n){
  int res = 0;
  while(n){
    res += n%10;
    n /= 10;
  }
  return res;
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int main(){
  int i;
  int N;
  int res = 1073709056;
  rd(N);
  for(i=(1);i<(N);i++){
    chmin(res, sod_L(i)+sod_L(N-i));
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// {
//   int N, res = int_inf;
//   rd(N);
//   rep(i,1,N) res <?= sod(i) + sod(N-i);
//   wt(res);
// }


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

int main(){
  int n;
  cin >> n;
  int a[100];

  rep(i,n) cin >> a[i];
  for(int i = 0; i<n; ++i) {
    if(i!=0)     cout << " ";
    cout << a[n - 1 - i] ;
  }
  cout << endl;

}


Measured memory_bytes: 3096
#include <iostream>
using namespace std;
#include <algorithm>

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

int main(){
int a, b;
char s[20];
cin >> a >> b;
cin >> s;

bool out = true;
rep(i,a-1) if(s[i] < '0' || s[i] > '9'){ out = false; break;}
if(s[a] != '-') out = false;
REP(i,a+1,a+b+1) if(s[i] < '0' || s[i] > '9') {out = false; break;}

if(out == true) cout << "Yes" <<endl;
else cout << "No" <<endl;  


return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
int main() {
	ll X,Y; SCLLD2(X,Y);
	if (abs(X-Y) > 1){
		printf("Alice\n");
	}else{
		printf("Brown\n");
	}
	return 0;
}

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

using namespace std;

using ll = long long;

template<int MOD>
struct ModInt {
   using Mint = ModInt;
   int val;
   ModInt(ll __val = 0) { fix(__val % MOD + MOD); }
   Mint& fix(int __val) { val = __val; if (val >= MOD) val -= MOD; return *this; }
   explicit operator int() { return val; }
   Mint operator + (const Mint &mt) const { return Mint().fix(val + mt.val); }
   Mint operator - (const Mint &mt) const { return Mint().fix(val - mt.val + MOD); }
   Mint operator * (const Mint &mt) const { return Mint().fix(ll(val) * mt.val % MOD + MOD); }
   Mint& operator += (const Mint &mt) { return *this = *this + mt; }
   Mint& operator -= (const Mint &mt) { return *this = *this - mt; }
   Mint& operator *= (const Mint &mt) { return *this = *this * mt; }
   Mint pow(int y) const {
      Mint x = *this;
      Mint ans(1);
      for (; y > 0; y >>= 1, x *= x) {
         if (y & 1) ans *= x;
      }
      return ans;
   }
   Mint operator -() const { return Mint().fix(MOD - val); }
   Mint inv() const { return pow(MOD - 2); }
   Mint operator / (const Mint &mt) const { return *this * mt.inv(); }
   Mint& operator /= (const Mint &mt) const { return *this / mt; }
   friend ostream& operator<<(ostream& os, const Mint& mt) { return os << mt.val; }
};

using Mint = ModInt<1000000007>;

const int MAXN = 1000100;

Mint fact[MAXN];
Mint ifact[MAXN];
Mint pow2[MAXN];
Mint pow3[MAXN];

void precalc() {
   fact[0] = 1;
   for (int i = 1; i < MAXN; ++i) fact[i] = fact[i - 1] * i;
   ifact[MAXN - 1] = fact[MAXN - 1].inv();
   for (int i = MAXN - 1; i > 0; --i) ifact[i - 1] = ifact[i] * i;
   pow2[0] = pow3[0] = 1;
   for (int i = 1; i < MAXN; ++i) {
      pow2[i] = pow2[i - 1] * 2;
      pow3[i] = pow3[i - 1] * 3;
   }
}

Mint C(int N, int K) {
   if (N < K || K < 0) return Mint(0);
   return fact[N] * ifact[K] * ifact[N - K];
}

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   precalc();
   int N, M, K;
   cin >> N >> M >> K;
   vector<Mint> dp(M + K + 1);
   dp[0] = 1;
   for (int i = 1; i <= M + K; ++i) {
      dp[i] = dp[i - 1] * 2;
      if (i > M) dp[i] -= C(i - 1, M);
      if (i > K) dp[i] -= C(i - 1, K);
   }
   Mint ans = 0;
   for (int i = 0; i <= M + K; ++i) {
      ans += C(N - 1 + i, i) * dp[i] * pow3[M + K - i];
   }
   cout << ans << "\n";
   return 0;
}


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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  int answer = 999;
  for(int i = 0; i < N - 2; i++){
    int sumsum = (S[i] - '0') * 100 + (S[i+1] - '0') * 10 + S[i+2] - '0';
    answer = min(answer , abs(sumsum - 753));
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#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;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    string s ;
    cin >> s ;
    ll n = SZ(s) ;
    ll ans = 0 ;
    ll cnta = 0 ;
    REP(i,n){
        if(s[i]=='A'){
            cnta++ ;
        }
        else if(s.substr(i,2)=="BC"){
            ans += cnta ;
            i++ ;
        }
        else{
            cnta = 0 ;
        }
    }

    cout << ans <<endl;


    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll N,T;
  cin >> N >> T;
  VI A(N);
  rep(i,N) cin >> A[i];

  int minNum = 1e9+10;
  VLL B(N);
  rep(i,N){
    B[i] = A[i] - minNum;
    minNum = min(minNum,A[i]);
  }
  sort(all(B),greater<ll>());
  ll ans = 1;
  rep(i,N-1){
    if(B[i] == B[i+1]) ans ++;
    else break;
  }
  cout << ans << endl;
  return 0;
}


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

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

	for (int i = 0; i * 4 <= n; i++) {
		int sum = i * 4;
		for (int j = 0; j * 7 + sum <= n; j++) {
			sum += j * 7;
			if (sum == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;

	return 0;
}

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

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    long long ans = 0;
    for (int i = 1; i < n + 1; i++)
    {
        long long amari = k - (i % k);
        long long va = ((n - amari) / k) + 1;
        if (amari * 2LL % k == 0LL) ans += va * va;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256