akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;

int n, A[MAX], s;
int B[MAX], T[VMAX+1];

int solve(){
    int ans = 0;

    bool V[MAX];
    for(int i=0; i<n; i++){
        B[i] = A[i];
        V[i] = false;
    }
    sort(B, B+n);
    for(int i=0; i<n; i++) T[B[i]] = i;
    for(int i=0; i<n; i++){
        if(V[i]) continue;
        int cur = i;
        int S = 0;
        int m = VMAX;
        int an = 0;
        while(1){
            V[cur] = true;
            an++;
            int v = A[cur];
            m = min(m, v);
            S += v;
            cur = T[v];
            if(V[cur]) break;
        }
        ans += min(S + (an - 2) * m, m + S + (an + 1) * s);
    }

    return ans;
}

int main(){
    cin >> n;
    s = VMAX;
    for(int i=0; i<n; i++){
        cin >> A[i];
        s = min(s, A[i]);
    }
    int ans = solve();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 25
using namespace std;
int n,c[M],v[M];
int main()
{
    while (~scanf("%d", &n)) {
        int ans = 0;
        REP(i,1,n) scanf("%d", &v[i]);
        REP(i,1,n) scanf("%d", &c[i]);
        REP(ch, 0, (1<<n)-1) {
            int x=0, y=0;
            REP(i,1,n) if ((1<<(i-1)) & ch) {
                x += v[i];
                y += c[i];
            }
            ans = max(ans, x-y);
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define INFINITY 2000000000

int cnt=0;

void merge(int* a,int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	int L[n1+1],R[n2+1];
	for(int i=0;i<n1;i++){
		L[i]=a[left+i];
	}
	for(int i=0;i<n2;i++){
		R[i]=a[mid+i];
	}
	L[n1]=INFINITY;
	R[n2]=INFINITY;
	int i=0;
	int j=0;
	for(int k=left;k<right;k++){
		cnt++;
		if(L[i]<=R[j]){
			a[k]=L[i];
			i=i+1;
		}else{
			a[k]=R[j];
			j=j+1;
		}
	}
}

void msort(int* a,int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		msort(a,left,mid);
		msort(a,mid,right);
		merge(a,left,mid,right);
	}
}

int main(void){

	int n;
	scanf("%d",&n);
	int* s=(int*)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	
	msort(s,0,n);
	
	
	for(int i=0;i<n;i++){
		printf("%d",s[i]);
		if(i!=n-1)printf(" ");
	}
	printf("\n%d\n",cnt);
	return 0;

}


Measured memory_bytes: 5640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	
	vector<string> v(h);
	for(int i = 0; i < h; i++)
	{
		cin >> v[i];
	}
	
	bool check[h][w] = {{true}};
	bool flag = true;
	while(flag != false)
	{
		bool flag2 = false;
		for(int i = 0; i < h; i++)
		{
			for(int j = 0; j < w; j++)
			{
				if(v[i][j] == '#')
				{
					break;
				}
				
				if(j == w - 1)
				{
					flag2 = true;
					v.erase(v.begin() + i);
					h--;
				}
			}
		}
		
		for(int i = 0; i < w; i++)
		{
			for(int j = 0; j < h; j++)
			{
				if(v[j][i] == '#')
				{
					break;
				}
				
				if(j == h - 1)
				{
					flag2 = true;
					for(int k = 0; k < h; k++)
					{
						v[k].erase(v[k].begin() + i);
					}
					w--;
				}
			}
		}
		
		flag = flag2;
	}
	
	for(int i = 0; i < h; i++)
	{
		cout << v[i] << endl;
	}
	
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

ll n;
vector<P> g[101010];
ll v[101010],cnt[16];
ll res=0;
ll pre[1<<15],bc[1<<15];
ll dp[1<<15];

int main(){
	cin>>n;
  rep(i,n-1){
    ll a,b,c;
    cin>>a>>b>>c;
    g[a].push_back(P(b,c));
    g[b].push_back(P(a,c));
  }
  rep(i,n){
    for(P e : g[i]){
      v[i]^=e.se;
    }
    cnt[v[i]]++;
  }
  ll iS=0;
  repl(i,1,16){
    res+=cnt[i]/2;
    cnt[i]%=2;
    if(cnt[i])iS|=1<<(i-1);
  }
  rep(S,1<<15){
    dp[S]=INF;
    bc[S]=bcnt(S);
    bool ok=true;
    rep(j,15){
      if((S>>j)&1)continue;
      if(cnt[j+1])pre[S]^=j+1;
    }
  }
  dp[iS]=0;
  for(ll S=(1<<15)-1;S>=0;S--){
    if(dp[S]==INF)continue;
    for(ll T=S-1;T>=0;T--){
      T&=S;
      ll U=S-T;
      if(pre[U]==0)minch(dp[T],dp[S]+bc[U]-1);
    }
  }
  cout<<res+dp[0]<<endl;
	return 0;
}


Measured memory_bytes: 9472
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string[] ab = Console.ReadLine().Split(' ');
        long a = long.Parse(ab[0]);
        decimal b = decimal.Parse(ab[1]);
        decimal res = a * b;
        Console.WriteLine((long)res);
    }
}


Measured memory_bytes: 27536
#include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
bool vis[100010];
int par[100010];
vector<pair<int,int>> G[100010];
vector<int> a,b,c,ans;
int dfs(int s, int p){
	vis[s] = true;
	int cnt = 0;
	for(auto x:G[s]){
		if(vis[x.first]) continue;
		par[x.first] = x.second;
		(cnt += dfs(x.first,s)) &= 1;
	}
	if(c[s]!=cnt){
		ans.push_back(par[s]);
		return 1;
	}
	return 0;
}

vector<pair<int,int>> p;
int main(){
	int i,n,m;
	cin >> n >> m;
	for(i=0;i<n;i++){
		int x,y; cin >> x >> y; x--;
		p.push_back({x,y});
	}
	sort(p.begin(),p.end());
	for(i=0;i<n;i++){
		a.push_back(p[i].first);
		b.push_back(p[i].second);
	}
	c.push_back(b[0]);
	int s = c[0];
	for(i=1;i<n;i++){
		c.push_back((s + b[i])&1);
		(s += c[i]) &= 1;
	}
	c.push_back(s&1);
	for(i=0;i<m;i++){
		int l,r; cin >> l >> r;
		l--;
		auto it1 = lower_bound(a.begin(),a.end(),l);
		auto it2 = lower_bound(a.begin(),a.end(),r);
		int x = it1 - a.begin(),y = it2 - a.begin();
		if(x==y) continue;
		G[x].push_back({y,i});
		G[y].push_back({x,i});
	}
	for(i=0;i<=n;i++){
		vis[i] = false;
	}
	for(i=0;i<=n;i++){
		if(vis[i]) continue;
		par[i] = -1;
		dfs(i,-1);
	}
	if(ans.size()==0){
		cout << 0 << endl;
		return 0;
	}
	sort(ans.begin(),ans.end());
	if(ans[0]==-1){
		cout << -1 << endl;
		return 0;
	}
	cout << ans.size() << endl;
	for(i=0;i<ans.size();i++){
		cout << ans[i] + 1 << " ";
	}
	cout << endl;
}

Measured memory_bytes: 15604
N = int(input())
S = input()
max_n = 0
for i in range(N):
  target1 = S[:i]
  target2 = S[i:]
  target1 = set(target1)
  target2 = set(target2)
  if max_n < len(target1 & target2):
    max_n = len(target1 & target2)
    
print(max_n)

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

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e7
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;
void solve(void)
{
    int d, n;
    cin >> d >> n;
    int cta = 0;
    int i = 0;
    while (cta < n)
    {
        i++;
        int x = i;
        int f = 0;
        while (x % 100 == 0)
            x /= 100, f++;
        if (f == d)
            cta++;
    }
    cout << i << endl;
}
int main(void)
{
    solve();
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    sort(A,A+N);
    vc<bool> V(1000001,true);
    rep(i,N-1) {
        if(!V[A[i]]) continue;
        if(A[i]==A[i+1]) V[A[i]]=false;
        for(int j=2;j*A[i]<1000001;j++) {
            V[j*A[i]]=false;
        }
    }
    int ans=0;
    rep(i,N) {
        if(i) {
            if(A[i]==A[i-1]) continue;
        }
        if(V[A[i]]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5328
#include <iostream>
#include <iomanip>
#include <cstdio>

using namespace std;

int main(){
  int N,K,cnt=0;
  cin >> N >> K;
  int h[N];
  for(int i=0;i<N;i++) cin >> h[i];

  for(int i=0;i<N;i++){
    if(h[i]>=K) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    string s;
    cin >> s;
    int a = 0, z = 0;
    bool b = true;
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) == 'A' && b) {
            a = i + 1;
            b = false;
        }
        if (s.at(i) == 'Z') z = i + 1;
    }
    cout << z - a + 1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;

int main()
{
    
    while(1)
    {
        int a, b;
        string op;
        
        cin >> a >> op >> b;
        
        if(op == "+")
          cout << a + b << endl;
        else if(op == "-")
          cout << a - b << endl;
        else if(op == "*")
          cout << a * b << endl;
        else if(op == "/")
          cout << (int) a / b << endl;
        else if(op == "?")
          break;
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, a, b, count;
    cin >> N;
    count = 0;
    cin >> a;
    for(int i=1;i<N;i++){
        cin >> b;
        if(a == b){
            count++;
            a = -1;
        }else{
            a = b;
        }
    }
    cout << count << "\n";
    return 0;
}


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

using namespace std;

typedef long long ll;

char getS(string name, long ind) {
	return name[ind - 1];
}

int main() {

	string one, two;

	cin >> one;
	cin >> two;

	ll l1 = one.length();
	ll l2 = two.length();

	ll ans[l1 + 1][l2 + 1];
	for (long i = 0l; i <= l1; i++) ans[i][0] = 0;
	for (long i = 0l; i <= l2; i++) ans[0][i] = 0;

	for (long int i = 1; i <= l1; i++) {
		for (long int j = 1; j <= l2; j++) {
			if (getS(one, i) == getS(two, j)) {
				ans[i][j] = ans[i - 1][j - 1] + 1;
			} else {
				ans[i][j] = max(ans[i - 1][j], ans[i][j - 1]);
			}
		}
	}

	stack<char> st;
	ll i = l1, j = l2;
	while ((i != 0) and (j != 0)) {

		if (getS(one, i) != getS(two, j)) {
			if (ans[i - 1][j] > ans[i][j - 1]) {
				i--;
			} else
				j--;
		} else {
			i--;
			j--;
			st.push(one[i]);
		}
	}

	while (!st.empty()) {
		cout << st.top();
		st.pop();
	}

	cout << endl;
	return 0;
}

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

typedef long long LL;
const int M=305;
const LL INF=(LL)M*(1000000000);

LL dp[M][M]; // dp[i][j] i block end at j
// if k=0 ans=\sum_{1~n} {h[i]-h[i-1]} (h[0]=0)
// if k>0 should change k blocks as the left one of themselves

LL h[M];

int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&h[i]);
	for(int i=1;i<=n-k;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(i==1)
			{
				dp[i][j]=h[j];
				continue;
			}
			dp[i][j]=INF;
			for(int k=i-1;k<j;k++)
				dp[i][j]=min(dp[i][j],dp[i-1][k]+max(0LL,h[j]-h[k]));
			//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	LL ans=INF;
	for(int i=n-k;i<=n;i++)
		ans=min(ans,dp[n-k][i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
def bingo_check():
    from collections import defaultdict
    import sys
    A = []
    pos = {}
    for i in range(3):
        a1, a2, a3 = list(map(int, input().split()))
        A += [[a1, a2, a3]]
        pos[a1] = (i+1, 1)
        pos[a2] = (i+1, 2)
        pos[a3] = (i+1, 3)

    checked = defaultdict(lambda: False)
    N = int(input())
    for _ in range(N):
        b = int(input())
        if pos.get(b):
            checked[pos[b]] = True
    
    ### checked を確認する
    for i in range(1, 4):
        ### 横
        if checked[(i, 1)] and checked[(i, 2)] and checked[(i, 3)]:
            return "Yes"
        ### 縦
        if checked[(1, i)] and checked[(2, i)] and checked[(3, i)]:
            return "Yes"
            

    ### 斜め
    if checked[(1, 1)] and checked[(2, 2)] and checked[(3, 3)]:
        return "Yes"
    if checked[(1, 3)] and checked[(2, 2)] and checked[(3, 1)]:
        return "Yes"
    
    return "No"

print(bingo_check())    

Measured memory_bytes: 3316
def main():
    n = int(input()) # 2 >= n
    min_value = int(input())
    max_profit = - 10 ** 9
    for i in range(n-1):
        now_value = int(input())
        tmp_profit = now_value - min_value

        if now_value < min_value:
            min_value = now_value
        if max_profit < tmp_profit:
            max_profit = tmp_profit

        #print(i+1,now_value,max_profit)
    print(max_profit)
    return


main()


Measured memory_bytes: 5616
import java.util.*;


public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int sum = 0;
        for(int i = 0; i < n; i++){
            int p = sc.nextInt();
            sum += p;
            max = Math.max(max, p);
        }
        System.out.println(sum - max / 2);
    }
}


Measured memory_bytes: 23892
arr = gets.chomp.split
stack = []
for i in 0..arr.length-1 do
  s = arr[i]
  if s == "+"
    s = stack.pop + stack.pop
  elsif s == "-"
    num1 = stack.pop
    num2 = stack.pop
    s = num2 - num1
  elsif s == "*"
    s = stack.pop * stack.pop
  end
  stack.push(s.to_i)
end
puts stack


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

namespace AtCoder
{
    class Abc162B
    {
        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());

            long sum = 0;

            for (int i = 1; i <= n; i++)
            {
                if (i % 3 == 0 || i % 5 == 0)
                    continue;
                sum += i;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 17624
n = int(input())
a = list(map(int, input().split()))
accu = [0]
mod = 10**9+7
for i in range(n):
    accu.append((accu[-1]+a[i])%mod)
ans = 0
for i in range(n-1):
    ans += (a[i]*(accu[-1]-accu[i+1]))%mod
    ans %= mod
print(ans)

Measured memory_bytes: 31436
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		long sum = 0;
		long count = 0;
		Map<String, Long> map = new HashMap<>();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if (map.containsKey(String.valueOf(a[i]))) {
				map.put(String.valueOf(a[i]), map.get(String.valueOf(a[i])) + b[i]);
			} else {
				map.put(String.valueOf(a[i]), (long) b[i]);
				list.add(a[i]);
			}
		}
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			if (map.get(String.valueOf(list.get(i))) < m - count) {
				sum += list.get(i) * map.get(String.valueOf(list.get(i)));
				count += map.get(String.valueOf(list.get(i)));
			} else {
				sum += list.get(i) * (m - count);
				System.out.println(sum);
				return;
			}
		}
	}
}


Measured memory_bytes: 104148
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////

int ans4[4][4] = { {1,2,1,1},{1,2,3,3},{3,3,2,1},{1,1,2,1} };
int ans5[5][5] = { {1,1,2,2,1},{2,0,3,3,1},{2,3,0,0,2},{1,3,0,0,2},{1,2,2,1,1} };
int ans6[6][6] = { {1,2,2,1,0,0},{1,0,0,1,2,2},{2,1,1,2,0,0},{2,0,0,2,1,1},{1,2,2,1,0,0},{1,0,0,1,2,2} };
int ans7[7][7] = { {1,1,2,2,1,1,0},{2,2,1,1,0,0,2},{1,1,2,2,0,0,2},{0,0,0,0,1,2,1},{0,0,0,0,1,2,1},{0,0,0,0,2,1,2},{0,0,0,0,2,1,2} };

void solve(int N) {
	if (N == 2) { cout << -1; return; }
	if (N == 3) {
		cout << "aa." << endl << "..a" << endl << "..a" << endl;
		return;
	}

	int a[1200][1200] = { {} };
	
	if (N == 6) { rep(i, N) rep(j, N) a[i][j] = ans6[i][j]; }
	else if (N == 7) { rep(i, N) rep(j, N) a[i][j] = ans7[i][j]; }
	else if (N == 10) {
		rep(i, 4)rep(j, 4) a[i][j] = ans4[i][j];
		rep(i, 6)rep(j, 6) a[i + 4][j + 4] = ans6[i][j];
	}
	else if (N == 11) {
		rep(i, 4)rep(j, 4) a[i][j] = ans4[i][j];
		rep(i, 7)rep(j, 7) a[i + 4][j + 4] = ans7[i][j];
	}

	else{

		ll M = 0;
		
			while ((N - M) % 4 != 0) {
				rep(i, 5)rep(j, 5) a[M + i][M + j] = ans5[i][j];
				M += 5;
			}
	

		while (M <= N) {
			rep(i, 4)rep(j, 4) a[M + i][M + j] = ans4[i][j];
			M += 4;
		}
	
	
	}

	rep(i, N) {
		rep(j, N) {
			if (a[i][j] == 0) { cout << "."; }
			if (a[i][j] == 1) { cout << "a"; }
			if (a[i][j] == 2) { cout << "b"; }
			if (a[i][j] == 3) { cout << "c"; }

		}
		cout << endl;
	}

	}


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

	
	system("PAUSE");


}

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

int main()
{
   ll a,b,c,k;
   cin>>a>>b>>c>>k;
   ll sum=0;
  if(a>k){
    sum=k;
  }
  else{
    k=k-a;
    sum=a;

    if(b>k){
        sum=a;

    }
    else{
        k=k-b;

        sum-=k;



    }






  }
cout<<sum;
    return 0;
}


Measured memory_bytes: 3592
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
ans=INF
("a".."z").to_a.each do|c|
  cnt=0
  val=0
  S.each do|s|
      if c==s
        val=max(val,cnt)
        cnt=0
      else
        cnt+=1        
      end
  end
  val=max(cnt,val)
  ans=min(ans,val)
end
puts ans

Measured memory_bytes: 14372
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll k,a,b,ans=0;
    cin>>k>>a>>b;
    if(a+1>=b) cout<<1+k;
    else{
        if(k<=a) cout<<1+k;
        else cout<<a+(k-a+1)/2*(b-a)+(k-a+1)%2;
    }
}

Measured memory_bytes: 3560
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int
int main(void)
{
  ll N,A,B;
  scanf("%lld %lld %lld",&N,&A,&B);
 ll result;
 ll  divi = N / (A + B);
 ll remaind = N % (A + B);

  if(remaind < A)
  {
    result = A * divi + remaind;
  }
  else
  {
     result = A * divi + A;
  }

 printf("%lld",result);

    return EXIT_SUCCESS;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n';

typedef long long ll;

using namespace std;

int main()
{

    int W, H, x, y;
    cin >> W >> H >> x >> y;

    int same = 0;
    if (2 * x == W && 2 * y == H)
    {
        same = 1;
    }
    double ans = (double)H * W / 2;

    cout << fixed;
    cout << setprecision(8) << ans << ' ';
    cout << same << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define rep(i, a, n) for (int i = a; i <= n; ++i)
using namespace std;
const int m = 1000000007;
int N, K, a[1001], c[1001][1001];
long d[21][1001];
int main() {
	cin >> N >> K;
	rep(k, 1, K) cin >> a[k];
	rep(n, 0, N) rep(r, 0, n) c[n][r] = r == 0 ? 1 : (c[n - 1][r - 1] + c[n - 1][r]) % m;
	d[0][0] = 1;
	rep(k, 1, K) rep(n, 0, N) rep(x, 0, min(n, a[k])) d[k][n] = (d[k][n] + d[k - 1][n - x] * c[n][x] % m * c[N - x][a[k] - x]) % m;
	cout << d[K][N] << endl;
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define INF 2147483647
#define lli long long int

using namespace std;
//typedef vector<int> vi;
//typedef vector< vector<int> > vvi;
int main() {
	int x; cin >> x;
	if (x < 1200){
		cout << "ABC" << endl;
	}else{
		cout << "ARC" << endl;
	}
	return 0;
}





Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def change_color(t):
    if t == '0':
        return '1'
    return '0'


def solve(inputs):
    [A] = string_to_int(inputs[0])
    [B] = string_to_int(inputs[1])
    [C] = string_to_int(inputs[2])
    [D] = string_to_int(inputs[3])
    [E] = string_to_int(inputs[4])
    foods = [A, B, C, D, E]
    time = 0

    while len(foods) > 0:
        optimal_f = -1
        optimal_i = -1
        for i, f in enumerate(foods):
            futility = (time + f) % 10
            if futility == 0:
                optimal_i = i
                break
            if futility > optimal_f or optimal_f == -1:
                optimal_f = futility
                optimal_i = i
        time += foods[optimal_i]
        foods.pop(optimal_i)
        if len(foods) != 0 and time % 10 != 0:
            time += 10 - (time % 10)
    return time


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(5))
    print(ret)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int n,m,ans;
int main(){
	scanf("%d%d",&n,&m);
	if (n>=2) ans+=n*(n-1)/2;
	if (m>=2) ans+=m*(m-1)/2;
	printf("%d\n",ans);
return 0;	
}


Measured memory_bytes: 256
#include<cstdio>
#define For(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
int read(){
	int l=1,x=0; char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') ch=getchar(),l=-1;
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*l;
}
int main(){
	int a=read(),b=read(),c=read(),d=read(),e=read(),f=read(),l,r,n,m,x=0,y=100;
	l=a*100; r=b*100;
	For(i,0,30)
		For(j,0,30){
			if (i==0&&j==0) continue; n=i*l+j*r; if (n>f) break;
			For(k,0,3000)
				For(ll,0,3000){
					m=c*k+d*ll; if ((100+e)*m>e*(n+m)||n+m>f) break;
					if (m*y>=x*(n+m)) x=m,y=n+m;
				}
		}
	printf("%d %d\n",y,x);
	return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 1) continue;
            if (a[i] % 2 == 1) ans++;
        }
        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 25316
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // M_PI, sin(), cos()

typedef struct point_tbl
{
	double x;
	double y;
} point;

void
koch(int n, point a, point b)
{
	point s, t, u;

	if (n == 0)
		return;

	double th = M_PI * 60.0 / 180.0;

	s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
	s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
	t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
	t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

	koch(n - 1, a, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, b);
}

int
main(int argc, char** argv)
{
	point a, b;
	int n;

	scanf("%d", &n);
	a.x = 0, a.y = 0;
	b.x = 100, b.y = 0;

	printf("%.8f %.8f\n", a.x, a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);

	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long int ll;
int N;
ll len[100002];
ll L;
ll sum[100002];
int fro=0;
ll ans;
int main()
{
	scanf("%d%lld",&N,&L);
	for(int i=0;i<N;i++)scanf("%lld",&len[i]);
	sum[0]=len[0];
	for(int i=1;i<N;i++)sum[i]=sum[i-1]+len[i];
	for(int i=1;i<N-1;i++){
		if(len[i-1]>len[i]&&len[i]<len[i+1]){
			if(fro==0)ans=max(ans,L*(i+1)-sum[i]);
			else ans=max(ans,L*(i-fro+1)-sum[i]+sum[fro-1]);
			fro=i;
		}
		else if(len[i-1]<len[i]&&len[i]>len[i+1]){
			if(fro==0)ans=max(ans,L*(i+1)-sum[i]);
			else ans=max(ans,L*(i-fro+1)-sum[i]+sum[fro-1]);
			fro=i;
		}
	}
	if(fro==0)ans=max(ans,L*N-sum[N-1]);
	else ans=max(ans,L*(N-fro)-sum[N-1]+sum[fro-1]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2748
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long mod = 1000000007;
		long taka[] = new long[n+2];
		long ao[] = new long[n+2];
		for(int i = 1; i <= n; i++) {
			taka[i] = sc.nextLong();
		}
		taka[0]=0;taka[n+1]=taka[n];
		for(int i = 1; i <= n; i++) {
			ao[i] = sc.nextLong();
		}
		ao[0]=ao[1];ao[n+1]=0;
		long ans = 1L;
		for(int i = 1; i <= n; i++) {
			if(taka[i-1]<taka[i]&&ao[i]>ao[i+1]) {//両方更新されている場合
				if(taka[i]==ao[i]) {
					//nothing
				} else {
					System.out.println(0);
					return;
				}
			} else if(taka[i-1]<taka[i]&&ao[i]==ao[i+1]) {
				//nothing ans *= 1;
				if(taka[i] <= ao[i]) {
					//nothing
				} else {
					System.out.println(0);
					return;
				}
			} else if(taka[i-1]==taka[i]&&ao[i]>ao[i+1]) {
				//nothing
				if(ao[i] <= taka[i]) {
					//nothing
				} else {
					System.out.println(0);
					return;
				}
			} else if(taka[i-1]==taka[i]&&ao[i]==ao[i+1]) {
				ans *= Math.min(taka[i], ao[i]);
				ans %= mod;
			} else {
				System.out.println(0);
				return;
			}
		}
		System.out.println(ans%mod);
	}
}


Measured memory_bytes: 86744
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <bitset>

using namespace std;

bitset<10000> b[10];

int main()
{
	int h, w, i, j, k, n, num, re, max;
	while (scanf("%d%d", &h, &w) && (h || w))
	{
		for (i = max = 0; i < h; i++)
			for (j = 0; j < w; j++)
			{
				scanf("%d", &n);
				b[i][j] = n;
			}
		n = 1 << h;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < h; j++)
				if (1 & (i >> j))
					b[j].flip();
			for (j = re = 0; j < w; j++)
			{
				for (k = num = 0; k < h; k++)
					if (b[k][j])
						num++;
				if (num < h - num)
					num = h - num;
				re += num;
			}
			if (re > max)
				max = re;
			for (j = 0; j < h; j++)
				if (1 & (i >> j))
					b[j].flip();
		}
		printf("%d\n", max);
	}
	return 0;
}

Measured memory_bytes: 1200
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define inf 1e6

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int max_1 = -inf, max_2 = -inf, max_1_idx, max_2_idx;
    for (int i = 0; i < N; i++) {
        if (A[i] >= max_1) {
            max_1 = A[i];
            max_1_idx = i;
        }
    }
    for (int i = 0; i < N; i++) {
        if (i != max_1_idx) {
            if (A[i] >= max_2) {
                max_2 = A[i];
                max_2_idx = i;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        if (i == max_1_idx) {
            cout << max_2 << endl;
        } else {
            cout << max_1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2432
from sys import stdin
import sys
sys.setrecursionlimit(10**6) 
import bisect

n = int(stdin.readline().rstrip())

li = [7,5,3]

if n < 357:
    print(0)
    exit()

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

kazu = 0
point = 0
k = "0"
while int(k) <= n:
    k = Base_10_to_n(kazu,4)
    if k.count("0") > 0:
        kazu += 1
        continue
    k = k.replace("3","7").replace("1","3").replace("2","5")
    if all(k.count(c)>0 for c in "753"):
        if int(k) <= n:
            point += 1
    kazu += 1
print(point)

Measured memory_bytes: 3064
#include <stdio.h>
#include <ctype.h>
#define ALPHA 26
#define CODE 97

int main(void) {
    int i, cnt[ALPHA] = {};
    char buf;
    while(~(buf = getchar())) {
        isalpha(buf) && cnt[tolower(buf) - CODE]++;
    }
    for(i = 0; i < ALPHA; i++) {
        printf("%c : %d\n", i + CODE, cnt[i]);
    }
    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
void solve(){
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    if(m2<m1){
    h2-=1;m2+=60;}
    int diff = m2-m1+60*(h2-h1);
    cout<<diff-k;
}
int main(){
    int T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
  int num;
  scanf("%d",&num);
  int top = num / 100;
  int num2 = top * 111;
  if(num <= num2){
    printf("%d",num2);
  }else{
    top++;
    int num3 = (top)*111;
    printf("%d",num3);
  }
  return 0;
}


Measured memory_bytes: 128
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
sums = []

for i in range(N):
    sums.append(V[i]-C[i])

sums.sort()
sums.reverse()
cost = sums[0]
for i in range(1, N):
    if sums[i] < 0:
        break
    cost += sums[i]

print(max(0, cost))

Measured memory_bytes: 3064
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

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

    int tmp;
    tmp = b;
    b = a;
    a = tmp;

    tmp = c;
    c = a;
    a = tmp;

    cout << a << " " << b <<  " " << c << endl;

    return 0;
}


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

int main(){
int m,n;
int a[1000][1000];
int b[1000];
cin>>m>>n;

for(int i=1;i<=m;i++){
for(int g=1;g<=n;g++){
cin>>a[i][g];
}}
for(int g=1;g<=n;g++){
cin>>b[g];
}

int c[1000]={};
for(int i=1;i<=m;i++){
for(int g=1;g<=n;g++){
c[i]+=a[i][g]*b[g];
}}

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

return 0;
}


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

using namespace std;

const int maxn = 100000 + 5;
const long long INF = 1e18;
typedef long long LL;

struct node {
    int A, B, C;
}p[maxn];
bool cmp(node a, node b) {
    return a.A - a.B < b.A - b.B;
}
int N, X, Y, Z;
LL res = 0;
priority_queue<int, vector<int>, greater<int> > q;
LL pre[maxn], suf[maxn];
int main() {
    scanf("%d%d%d", &X, &Y, &Z);
    N = X + Y + Z;
    for(int i = 1; i <= N; i++) scanf("%d%d%d", &p[i].A, &p[i].B, &p[i].C);

    sort(p + 1, p + N + 1, cmp);

    for(int i = 1; i <= N; i++) {
        res += p[i].C;
        p[i].A -= p[i].C;
        p[i].B -= p[i].C;
    }
    for(int i = 1; i <= N; i++) {
        pre[i] = pre[i - 1] + p[i].B;
        q.push(p[i].B);
        if(q.size() > Y) pre[i] -= q.top(), q.pop();
    }
    while(!q.empty()) q.pop();
    for(int i = N; i; --i) {
        suf[i] = suf[i + 1] + p[i].A;
        q.push(p[i].A);
        if(q.size() > X) suf[i] -= q.top(), q.pop();
    }
    LL tmp = -INF;
    for(int i = Y; i <= N - X; i++) tmp = max(tmp, pre[i] + suf[i + 1]);
    printf("%lld\n", res + tmp);
    return 0;
}


Measured memory_bytes: 3448
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
template <class T> void chmax(T& a, const T b) { a = max<T>(a, b); }
template <class T> void chmin(T& a, const T b) { a = min<T>(a, b); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	ll N; cin >> N;
	string S; cin >> S;
	V<ll> cnt(26, 1);
	for(int i = 0; i < N; ++i){
		cnt[S[i] - 'a']++;
	}
	ll ans = 1;
	for (int i = 0; i < 26; ++i) (ans *= cnt[i]) %= MOD;
	cout << ans - 1 << endl;




	return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int a[10], b[10];
void r1() {
	b[7] = b[1];
	b[1] = b[2];
	b[2] = b[6];
	b[6] = b[5];
	b[5] = b[7];
	return;
}
void r2() {
	b[7] = b[2];
	b[2] = b[3];
	b[3] = b[5];
	b[5] = b[4];
	b[4] = b[7];
	return;
}
bool bf() {
	for (int i = 1; i <= 6; i++)if (a[i] != b[i])return 0; return 1;
}
bool bf1() {
	bool bt = 0;
	//1
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	//2
	r1();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	//3
	r1();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	//4
	r1();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	//5
	r2(); r1();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	//6
	r1(); r1();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	if (bf())bt = 1; r2();
	return bt;
}
signed main() {
	int n; cin >> n;
	for (int i = 1; i <= 6; i++)cin >> a[i];
	bool br = 1;
	for (int p = 1; p < n; p++) {
		for (int i = 1; i <= 6; i++)cin >> b[i];
		if (bf1())br = 0;
	}
	cout << (br ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    const i64 mod = 998244353;
    i64 n, s;
    cin >> n >> s;
    vector<i64> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector<i64> dp(s + 1);
    i64 ans = 0, i = 1;
    for (i64 x : a) {
        for (i64 i = s - x; i > 0; --i) {
            dp[i + x] += dp[i];
            dp[i + x] %= mod;
        }
        if (x <= s) {
            dp[x] += i;
            dp[x] %= mod;
        }
        ans += dp[s];
        ans %= mod;
        ++i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int i, j, k, n, m, l;
  int a[100][100] = {}, b[100][100] = {};
  long long int c[100][100] = {};

  scanf("%d %d %d", &n, &m, &l);

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

  for( i = 0 ; i < m ; i++ )
  {
    for( j = 0 ; j < l ; j++ )
    {
      scanf("%d", &b[i][j]);
    }
  }

  for( i = 0 ; i < n ; i++ )
  {
    for( j = 0 ; j < l ; j++ )
    {
      for( k = 0 ; k < m ; k++ )
      {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }

  for( i = 0 ; i < n ; i++ )
  {
    for( j = 0 ; j < l - 1; j++ )
    {
      printf("%lld ", c[i][j]);
    }
    printf("%lld\n", c[i][j]);
  }
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
//#define Ak

using namespace std;

template< class t>
long long int gcd( t g,t h )
{
    return ( h==0 ? g : gcd(h,g%h) );
}

vector< int >v[100005];
int visit[100005]={0},color[100005]={0},memo[100005][11];

int dfs(int s,int d,int c)
{
    memo[s][d]=c;
    
    if(d<=0)
    {
        return 0;
    }
    
    vector< int >::iterator k;
    
    for(k=v[s].begin();k!=v[s].end();k++)
    {
        if(memo[*k][d-1]==-1)
        {
            color[*k]=c;
            dfs(*k,d-1,c);
        }
    }


    return 0;
    
}


int main()
{
   /* #ifdef Ak
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    */
    int q,n,m,i,j,ans=-1,sum=0,a,b,s[100005],d[100005],c[100005],S,C,D;
    
   // list< long long int >v;
   
   // map< long long int >m;
   
    cin>>n>>m;
    
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    
    cin>>q;
    
    for(i=0;i<q;i++)
    {
        cin>>s[i]>>d[i]>>c[i];
        s[i]--;
    }
    
    for(i=0;i<n;i++)
    {
        for(j=0;j<11;j++)
        {
            memo[i][j]=-1;
        }
    }
    
    for(i=q-1;i>=0;i--)
    {
        S=s[i];
        D=d[i];
        C=c[i];
        if(memo[S][D]==-1)
        {
            dfs(S,D,i);
        }
    }
        
    for(i=0;i<n;i++)
    {ans=-1;
        for(j=0;j<11;j++)
        {
            ans=max(ans,memo[i][j]);
        }
        
        ans=(ans==-1 ? 0 : c[ans] );
        
        cout<<ans<<endl;
        
    }
        
    return 0;
    
}


Measured memory_bytes: 12792
using System;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using System.Collections.Generic;

class Myon

{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    static Scanner cin;


    void calc()
    {
        if (check()) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }

    bool check()
    {

        char[] A = cin.next().ToCharArray();
        char[] B = cin.next().ToCharArray();
        Array.Sort(A);
        Array.Sort(B);
        Array.Reverse(B);

        for (int i = 0; i < Math.Min(A.Length, B.Length); i++)
        {
            if (A[i] < B[i]) return true;
            if (A[i] > B[i]) return false;
        }
        return A.Length < B.Length;

    }
}


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 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 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;
    }
}




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


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
int a[105];
set<int> s;
rep(i,0,n-1)cin>>a[i],s.insert(a[i]);
ol(s.size());
return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string a;
    cin >> a;
    string out;
    int top = -1;
    for (int i = 0; a[i] != '\0'; i++)
    {
        if (a[i] == 'B')
        {
            if (top == -1)
                continue;
            out.pop_back();
            top--;
        }
        else if (a[i] == '0')
        {
            out += '0';
            top++;
        }
        else if (a[i] == '1')
        {
            out += '1';
            top++;
        }
    }
    cout << out << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int l=a.size();
    for(int i=0;i<l-1;i++)
    {
        if(a[i]=='A' && a[i+1]=='C')
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private final static String ZERO = "Zero";
    private final static String POSITIVE = "Positive";
    private final static String NEGATIVE = "Negative";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if (a <= 0 && b >= 0) {
            System.out.println(ZERO);
        } else if (a > 0 && b > 0) {
            System.out.println(POSITIVE);
        } else {
            int count = b - a + 1;
            
            if (count % 2 == 0) {
                System.out.println(POSITIVE);
            } else {
                System.out.println(NEGATIVE);
            }
        }
    }
}

Measured memory_bytes: 20820
def main():
    x, y = map(int, input().split(' '))
    print(gcd(x, y))

def gcd(x, y):
    if x < y:
        x, y = y, x

    if x % y == 0:
        return y

    return gcd(y, x%y)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7660