akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int K, S;
    cin >> K >> S;
    int count = 0;
    for(int X = 0; X <= K; X++){
        for(int Y = 0; Y <= K; Y++){
            int Z = S - X - Y;
            if(0 <= Z and Z <= K) count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3516
S = input()

count = 0
max_length = 0
for i in range(0, len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count = count + 1
        if count > max_length:
            max_length = count
    else:
        count = 0
print(max_length)


Measured memory_bytes: 8968
N,T=map(int,input().split())
A,B=[],[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a);B.append(b)
dp=[[0,0] for i in range(T)]

for i in range(N):
    for j in reversed(range(T)):
        dp[j][1]=max(dp[j][1],dp[j][0]+B[i])
        if j-A[i]>=0:
            dp[j][0]=max(dp[j-A[i]][0]+B[i],dp[j][0])
            dp[j][1]=max(dp[j-A[i]][1]+B[i],dp[j][1])
ans=max(dp[T-1][0],dp[T-1][1])
print(ans)

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

#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)

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  rep(i, n) {
    cin >> a.at(i);
    cin >> b.at(i);
  }
  ll plused = 0;
  ll res = 0;
  per(i, n) {
    int aa = a.at(i);
    int bb = b.at(i);
    ll r = (aa + plused) % bb;
    if (r != 0) {
      ll tmp = bb - r;
      res += tmp;
      plused += tmp;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4032
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include <numeric>
using namespace std;

int main()
{	
	long long int N;
	long long int P;
	scanf("%lld %lld", &N, &P);

	long long int soin[1000000][2];
	for(long long int i=0;i<1000000;i++){
		soin[i][0]=0;
		soin[i][1]=0;
	}
	if(N!=1){
	long long int p=2;
	long long int counter=0;
	while(p<=1000000){
		if(P%p==0)
		{	
			P=P/p;
			soin[counter][0]=p;
			soin[counter][1]++;
		}
		else
		{
			if(soin[counter][0]!=0){counter++;}
			p++;
		}
	}
	if(soin[0][0]==0){
		soin[0][0]=P;
		soin[0][1]=1;
	}
		
		
	long long int ans=1;
	for(long long int i=0;i<1000000;i++){
		
			if((soin[i][1])/N!=0)
			{		
					for(long long int j=0;j<(soin[i][1])/N;j++){
						ans=ans*soin[i][0];
					}
			}
		
	}
	
	printf("%lld", ans);
	}
	else{
		printf("%lld", P);
		}
}


Measured memory_bytes: 15744
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323

int main() 
{
    FAST;
    ll n;
    cin>>n;
    string s;
    set<string> st;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        st.insert(s);
    }
    cout<<st.size();
    return 0;
}

Measured memory_bytes: 19284
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main() {
	int ans = 1000000;
	string s;
	cin >> s;
	string alph = "abcdefghijklmnopqrstuvwxyz";
	int curans = 1000000;
	for (int i = 0; i < alph.length(); i++) {
		string tempo = s;
		string t2 = "";
		int ops = 0;
		while (1) {
			t2 = "";
			bool ok = true;
			for (int j = 0; j < tempo.length()-1; j++) {
				if (tempo[j]!=tempo[j+1]) ok = false;
			}
			if (ok) break;
			ops++;
			for (int j = 0; j < tempo.length()-1; j++) {
				if (tempo[j] == alph[i]) {
					t2 += tempo[j];
				}
				else t2 += tempo[j+1];
			}
			tempo = t2;
		}
		ans = min(ans, ops);
	}
	cout << ans << endl;
	// cin >> s;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    ll a, b;
    for(ll i = 1LL; i*i <= n; i++) {
        if(n%i == 0) {
            a = i;
            b = n/i;
        }
    }

    cout << a+b-2LL << endl;
    return 0;
}

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

int main(){
    int H, W;
    while(true){
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                printf("%c", '#');
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

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

using namespace std;

inline int read()
{
	int x=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c<='9'&&c>='0')x=x*10+c-'0',c=getchar();
	return x;
}

int n,m,d[1000010],f[1000010],ans;
vector<int>g[1000010];

void dfs(int x,int fa)
{
	d[x]=0;
	for(int i=0; i<g[x].size(); i++)
	{
		int y=g[x][i];
		if(y==fa)continue;
		dfs(y,x);
		d[x]+=!f[y];
		f[x]+=f[y];
	}
	if(d[x])f[x]+=d[x]-1;
}

void sol(int x,int fa)
{
	if(g[x].size()==1)ans=min(ans,f[x]+1);
	for(int i=0; i<g[x].size(); i++)
	{
		int y=g[x][i];
		if(y==fa)continue;
		f[x]-=f[y];
		if(!f[y]&&--d[x])f[x]--;
		f[y]+=f[x];
		if(!f[x]&&d[y]++)f[y]++;
		sol(y,x);
		if(!f[x]&&--d[y])f[y]--;
		f[y]-=f[x];
		if(!f[y]&&d[x]++)f[x]++;
		f[x]+=f[y];
	}
}

int main()
{
	n=read();
	for(int i=1; i<n; i++)
	{
		int u=read()+1,v=read()+1;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ans=1e9+7;
	dfs(1,0);
	sol(1,0);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 37760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

#define MAX 1000000
void solve(){
    vl a,b;
    ll v1=0,v2=0,v3=0;
    while(1){
        v1++;
        v2+=v1;
        v3+=v2;
        if(v3>MAX)break;
        a.push_back(v3);
        if(v3%2)b.push_back(v3);
    }
    reverse(all(a));
    reverse(all(b));

    vl dpA(MAX+1,LINF);
    dpA[0]=0;
    rep(i,a.size()){
        fore(j,a[i],MAX)chmin(dpA[j],dpA[j-a[i]]+1);
    }
    vl dpB(MAX+1,LINF);
    dpB[0]=0;
    rep(i,b.size()){
        fore(j,b[i],MAX)chmin(dpB[j],dpB[j-b[i]]+1);
    }
    
    while(1){
        ll n;cin>>n;
        if(n==0)return;
        cout<<dpA[n]<<" "<<dpB[n]<<endl;
    }
}

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



Measured memory_bytes: 18260
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
    int N, W;
    cin >> N >> W;
    vector<pair<ll, ll>> wv(N);
    // i番目までの品物で、重さの総和がw以下での価値の総和の最大
    // dp[i][j] := i番目までの品物、重さがj以下のものの価値
    ll dp[105][100500];
    dp[0][0] = 0;

    rep(i, N){
        ll w, v;
        cin >> w >> v;
        wv[i] = make_pair(w, v);
    }
    rep(i, N)rep(j, W+1){
        pair<ll, ll> tmp = wv[i];
        chmax(dp[i+1][j], dp[i][j]);
        if (j+tmp.first <= W) chmax(dp[i+1][j+tmp.first], dp[i][j] + tmp.second);
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 80640
#include<stdio.h>
int main(void)
{
	int a, b;
	int s;

	scanf("%d %d", &a,&b);
	s = a*b;

	if(s % 2 == 0)
	{
		printf("Even");
	}
	else
	{
		printf("Odd");
	}

	return 0;
}

Measured memory_bytes: 1724
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter

# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c = list(map(int,readline().split()))

    ans = 0

    ap = a % 2
    bp = b % 2
    cp = c % 2

    if not(ap == bp == cp):
        ans += 1
        if ap == bp:
            a += 1
            b += 1
        elif bp == cp:
            b += 1
            c += 1
        else:
            c += 1
            a += 1

    ans += ((max(a, b, c) * 3) - (a + b + c)) // 2
    print(ans)

if __name__ == '__main__':
    main()


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

int main(){
  int a;
  cin >> a;
  string ans = "No";
  rep(i, 26){
    rep(j, 15){
      if (4 * i + 7 * j == a) ans = "Yes";
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;

#define rep(i, n) \
for(int i = 0; i <n; i++)
#define REP(i, a, b) \
for(int i = int(a); i <= int(b); i++)
#define TRvi(c, it) \
for(vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for(vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for(msi::iterator it = (c).begin(); it != (c).end(); it++)

#define INF 2000000000

#define MEMSET_INF 127
#define MEMSET_HALF_INF 63

void solve(){
    int n;
    cin>>n;
    if(n>=30){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3624
import collections

def func(n, Command):
    L = collections.deque()
    for i in range(n):
        if "deleteFirst" in Command[i]:
            L.popleft()
        elif "deleteLast" in Command[i]:
            L.pop()
        else:
            if "insert" in Command[i]:
                L.appendleft(int(Command[i][7:]))
            else:
                if int(Command[i][7:]) in L:
                    L.remove(int(Command[i][7:]))
    return L

n = int(input())
Command = [input() for _ in range(n)]
print (*func(n, Command))


Measured memory_bytes: 188568
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main()
{
	int n;
	cin >> n;
	cout << n * n;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve())
}

func resolve() int {
	a, b, _, k := scanInt(sc), scanInt(sc), scanInt(sc), scanInt(sc)
	base := (b - a)
	if (k-1)%2 == 0 {
		return base
	}
	return -base
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

int main() {
	double N,M;
	cin >> N >> M;
	vector<int>A(N);
	double sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] >= sum / (4 * M))ans++;
	}
	if (ans >= M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    ll n;
    cin >> n;
    ll a,b;
    cin >> a >> b;
    ll ans = 0;
    if(a%2==b%2){
        ans = abs(a-b)/2;
    }else{
        ll c = a + max((b - a)/2,0LL);
        ll d = n - b + 1 + max((b - a - 1)/2,0LL);
        ans = min(c,d);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  
  public static void main(String[] args) {
    
    Scanner sin = new Scanner(System.in);

    int x = 0;
    int y = 0;
    while( ( (x = sin.nextInt()) + (y = sin.nextInt()) ) != 0 ) {
      if ( x <= y ) { System.out.println(x + " " + y); }
      else { System.out.println(y + " " + x);}
    }

    sin.close();
  }
}


Measured memory_bytes: 35576
def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n - 1)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    result = []
    result.append(data[0])
    for i in range(len(data) - 1):
        result.append(min(data[i], data[i + 1]))
    result.append(data[-1])
    return sum(result)


def write(result):
    print(result)


if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    # import sys
    # sys.setrecursionlimit(10000)
    solve()

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

int main(){
	int n, m; cin >> n >> m;
	vector<int> a(m+1);
	for(int i = 0; i < n; ++i){
		int k; cin >> k;
		for(int j = 0; j < k; ++j){
			int tmp; cin >> tmp;
			a[tmp]++;
		}
	}
	int  ans = 0;
	for(int i = 1; i <= m; ++i){
		if(a[i] == n) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
PROGRAM piyo
      IMPLICIT NONE
      integer :: w,h,n
      integer,allocatable :: x(:),y(:),a(:)
      integer :: i
      logical,allocatable :: rect(:,:)
      
      read*,w,h,n
      allocate( x(n),y(n),a(n) )
      do i = 1,n
        read*,x(i),y(i),a(i)
      end do
      
      allocate( rect(1:w,1:h) )
      rect = .true.
      
      do i = 1,n
        select case( a(i) )
          case( 1 )
            rect(1:x(i),:) = .false.
          case( 2 )
            rect(x(i)+1:w,:) = .false.
          case( 3 )
            rect(:,1:y(i)) = .false.
          case( 4 )
            rect(:,y(i)+1:h) = .false.
        end select
      end do
      
      
      print*,count( rect )
      
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	int H,W,i,j,k;

        while(k == 0){	
	scanf("%d%d",&H,&W);
	
        if(H == 0 && W == 0){
        break;
        }

	for( i = 0;i < H;i++){
		for( j =  0;j < W; j++){
			printf("#");
		}
		printf("\n");
	}
        printf("\n");
}

	return 0;
}
		


Measured memory_bytes: 2040
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        n:usize,
        d:usize,
        x:[[i32;d];n]
    }
    let mut ans =0;
    // println!("{:?}", x);
    for i in 0..n {
        for j in 0..n {
            if i>=j {
                continue;
            }
            let mut len2 = 0;
            for ind in 0..d {
                len2 += (x[i][ind] - x[j][ind])*(x[i][ind] - x[j][ind]);
            }
            // println!("{:?}", len2);
            for i in 0..1000 {
                if i*i > len2 {
                    break;
                }
                if i*i == len2 {
                    ans+=1;
                    break;
                }
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h> // {{{
// clang-format off
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define USE1(T) template <typename T> inline
#define USE2(T, U) template <typename T, typename U> inline
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

template <typename T> using duo = std::pair<T, T>;
template <typename T> using vec = std::vector<T>;
using ll = long long;
using pii = duo<int>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE1(T=int)vec<T>in(int n){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T)vec<std::pair<T,int>>zipi(const vec<T>&x,int s=0){int N=x.size();vec<std::pair<T,int>>v;v.reserve(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(10);
    std::cerr.precision(10);
  }
} iosetup; //}}}
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() { //
  auto S = in<string>();
  int N = S.size();
  int K = in();
  rep(i, N) {
    int c = S[i] - 'a';
    if (c == 0) continue;
    int cc = 26 - c;
    if (K < cc) continue;
    S[i] = 'a';
    K -= cc;
  }
  S[N - 1] += K % 26;
  pr(S);
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>

int main(void)
{
	int flog[31];
	int d;
	int i;
	for (i = 0; i < 31; i++){
		flog[i] = 0;
	}
	
	for (i = 0; i < 28; i++){
		scanf("%d", &d);
		flog[d] = 1;
	}
	
	for (i = 1; i < 31; i++){
		if (flog[i] == 0){
			printf("%d\n", i);
		}
	}
	
	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug_x(x) cout<< #x <<"---> : "<<x<<endl;
#define debug_ve(x) for(auto it: x) cout<<it<<" ";
#define rep(i,a,n) for (int i=a;i<n;i++)
#define _rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
std::mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x ; }
const ll mod=1e7;
ll ksm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll _;
/***********************/

int main(){
    ssd;
    ll n  ;
    cin>> n ;
    ll cur  = n %10;
    if( cur == 2 || cur == 4 || cur == 5 || cur == 7 || cur == 9)
        cout<<"hon"<<endl;
    else if(cur == 0 || cur == 1 || cur == 6 || cur == 8)
        cout<<"pon"<<endl;
    else cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3636
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextStrArray();
  myout(one[1] + one[0]);
}


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

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

    res = a*c;
    res = max(res, a*d);
    res = max(res, b*c);
    res = max(res, b*d);

    if(res<0){
        if(a<=0 && b>=0){
            res = 0;
        }
        if(c<=0 && d>=0){
            res = 0;
        }
    }


    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3644
#設定
import sys
input = sys.stdin.buffer.readline

INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def Binary_Search(H, N, A, B):
	#初期化
	left = 0
	right = 2 * (10 ** 9)
	ans = INF
	ex = A - B
	
	#二分探索
	while left <= right:
		mid = (left + right) // 2
		cnt = 0
		for i in range(N):
			if H[i] - mid * B > 0:
				if (H[i] - mid * B) % ex == 0:
					cnt += int((H[i] - mid * B) // ex)
				else:
					cnt += int((H[i] - mid * B) // ex) + 1
		#print(mid, cnt)
		if mid >= cnt:
			ans = min(ans, mid)
			right = mid - 1
		else:
			left = mid + 1

	return ans

#処理内容
def main():
	N, A, B = getlist()
	H = []
	for i in range(N):
		H.append(int(input()))
	
	ans = Binary_Search(H, N, A, B)
	print(ans)

if __name__ == '__main__':
	main()

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

int main(){
  long long n, k;
  cin >> n >> k;
  vector<pair<int, int>> ab(n);
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    ab.at(i) = {a, b};
  }
  
  sort(ab.begin(), ab.end());
  int ans;
  long long cnt = 0;
  for(int i = 0; i < n; i++){
    cnt += (long long)ab.at(i).second;
    ans = ab.at(i).first;
    if(cnt >= k) break;
  }
   
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll dist[1111][1111];
ll dist2[1111][1111];
bool used[1111][1111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cin>>dist[i][j];
      dist2[i][j]=dist[i][j];
    }
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      if(i==k)continue;
      for(int j=i+1;j<n;j++){
	dist2[i][j]=min(dist2[i][j],dist[i][k]+dist[k][j]);
	if(i!=k && j!=k)
	  if(dist[i][j] == dist[i][k]+dist[k][j])used[i][j]=true;
      }
    }
  }
  bool fl=true;
  for(int i=0;i<n;i++)
    for(int j=i;j<n;j++)
      if(dist[i][j]!=dist2[i][j])fl=false;
  if(fl){
    ll ans=0;
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++)
	if(used[i][j]==false)
	  ans+=dist[i][j];
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <string>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 998244353;
 
int gcd(int a, int b){
  if(b == 0) return a;
  return gcd(b, a%b);
}
 
int main()
{
  int N,keep,count;
  bool finish = false;
  ll A[100000],i,k,secmin,min;
  cin >> N;
  cin >> A[0] >> A[1];
  min = std::min(A[0],A[1]);
  secmin = max(A[0],A[1]);
  vector<int> minl;
  vector<int> minsl;
  for(int i=2;i<N;i++){
    cin >> A[i];
    if(A[i] < min) {
      secmin = min;
      min = A[i];
    }else if(A[i] < secmin){
      secmin = A[i];
    }
  }
  for(i=1;i<=sqrt(min);i++){
    if(min % i == 0){
      minl.push_back(i);
      minl.push_back(min/i);
    }
  }
  for(i=1;i<=sqrt(secmin);i++){
    if(secmin % i == 0){
      minsl.push_back(i);
      minsl.push_back(secmin/i);
    }
  }
  sort(minl.begin(),minl.end());
  sort(minsl.begin(),minsl.end());
  for(i=minl.size()-1;i>=0;i--){
      count = 0;
      for(int j=0;j<N;j++){
        if(A[j]%minl[i] == 0) count++;
      }
      if(count >= N-1){
        i = minl[i];
          break;
      }
    }
  for(k=minsl.size()-1;k>=0;k--){
    count = 0;
    for(int j=0;j<N;j++){
      if(A[j]%minsl[k] == 0) count++;
    }
    if(count >= N-1){
      k = minsl[k];
      break;
    }
  }
  cout << max(k,i);
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val B = A.map { if (it < 0) -it else it }
    val sum = B.sumByDouble { it.toDouble() }.toLong()
    val min = B.min()!!
    val fu = A.count { it < 0 }
    val ans = if (fu % 2 == 1) sum - min * 2 else sum
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

Measured memory_bytes: 61632
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define drep(i,n) for(int i = (n)-1; i >= 0; --i)

ll dp[101][305];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, w;
    cin >> n >> w;
    int ws = 0, sum = 0;
    rep(i,n){
        int a, b;
        cin >> a >> b;
        if(!i) ws = a;
        a -= ws;
        drep(j,i+1)drep(k,sum+1){
            chmax(dp[j+1][k+a], dp[j][k]+b);
        }
        sum += a;
    }
    ll ans = 0;
    rep(i,n+1)rep(j,sum+1){
        ll x = (ll)ws*i+j;
        if(x <= w) chmax(ans, dp[i][j]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n) cin >> b[i];

    vector<int> ans;
    rep(i, n) {
        int k = 0;
        int cng = -1;
        rep(j, n) {
            if (b[j] == 0) {
                continue;
            }
            if (b[j] == k + 1) {
                cng = j;
            }
            k++;
        }
        // cout << i << " " << cng << endl;
        if (cng == -1) {
            puts("-1");
            return 0;
        }
        ans.push_back(b[cng]);
        b[cng] = 0;
    }
    rep(i, n) {
        cout << ans[n - i - 1] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui R; cin >> R;
  
  cout
    << ( R < 1200
       ? "ABC"
       : (R < 2800
        ? "ARC"
        : "AGC"))
    << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

int a[100001];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1,u,v;i<=m;i++){
		cin>>u>>v;
		a[u]^=1;
		a[v]^=1;
	}
	cout<<(accumulate(a+1,a+n+1,0)==0?"YES":"NO")<<endl;
}



Measured memory_bytes: 640
from itertools import count
q=(5,7,5,7,7)
while 1:
    l=[len(input()) for _ in range(int(input()))]
    for st in range(len(l)-4):
        c=0
        s=st
        for i in count(st):
            if c==5:break
            if sum(l[s:i])==q[c]:
                c+=1
                s=i
            elif sum(l[s:i])>q[c]:
                break
        if c==5:break 
    if len(l)>=5:
        print(st+1)    
    elif not l:
        break



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

int main(){
  vector<int> abc(3);
  
  for (int i = 0; i < 3; i++) {
    cin >> abc.at(i);
  }
  sort(abc.begin(), abc.end());
  
  if (abc.at(0) + abc.at(1) == abc.at(2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//数取得
		int N = sc.nextInt(); //N学期
		int K = sc.nextInt(); //K番目の学期

		ArrayList<Integer> score = new ArrayList<>();

		for(int i = 0; i < N; i++) {
			score.add(sc.nextInt());
		}

		sc.close();

		for(int i = 0; i < N-K; i++) {
			if(score.get(i) < score.get(K+i)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}

}


Measured memory_bytes: 77272
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, A, B = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = N//(A+B)*A + (A if N%(A+B)>A else N%(A+B))
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  string s;
  getline(cin, s);

  for(int i=0; i<s.size(); i++){
    if( s[i]-'a' >= 0 && s[i]-'a' < 26 ) s[i] -= 32;
  }
  cout << s << endl;

  return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end



int main(){
   int a,b; scanf("%d%d",&a,&b);
   rep(i,0,1001){
      if(i*8/100==a&&i*10/100==b){
         printf("%d\n",i);
         return 0;
      }
   }
   printf("-1\n");
   return 0;
}

Measured memory_bytes: 256
<?php
$input = trim(fgets(STDIN));
if ($input < 100 || $input > 999 ) {
    exit(1);
}
$length = strlen($input);
for($i=0;$i<$length;$i++) {
    $keta[] = substr($input, $i, 1);
}
$level = $keta[0];
if( $keta[0] == $keta[1] && $keta[0] == $keta[2] ) {
} else if($level < $keta[1]){
    $level++;
} else if( $level == $keta[1] ){
    if( $level <= $keta[2] ) {
        $level++;
    }
}
echo $level.$level.$level;

Measured memory_bytes: 3828
import java.util.*;
public class Main {
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in).useDelimiter("[s,]+");
        while(sc.hasNextLine()){
            char[] cs=sc.nextLine().toCharArray();
            for(int j=0;j<26;j++){
                String s = new String(cs);
                if(s.matches(".*(this|that|the).*"))break;
                for(int i=0;i<cs.length;i++)cs[i]=decode(cs[i]);
            }
            System.out.println(new String(cs));
        }
    }
    static char decode(char c){
        return Character.isLetter(c)?(char)((c-'a'+25)%26+'a'):c;
    }
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn=102;
int n,m;
short f[maxn][maxn][maxn][maxn];
char s[maxn][maxn];
short a[maxn][maxn];

short ask(int X1,int Y1,int X2,int Y2){
	if(X2<X1 || Y2<Y1) return 0;
	return a[X2][Y2]-a[X1-1][Y2]-a[X2][Y1-1]+a[X1-1][Y1-1];
}

void work(){
	n=read(),m=read();
	int x=-1,y=-1;
	rep(i,1,n){
		scanf("%s",s[i]+1);
		rep(j,1,m){
			if(s[i][j]=='E'){
				x=i;y=j;
			}
			a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+(s[i][j]=='o');
		}
	}
	rrep(i,x,1) rrep(j,y,1) rep(p,x,n) rep(q,y,m){
		short &nw=f[i][j][p][q];
		short le=max(p-x+1,i),ri=min(p,n-x+i);
		short up=max(q-y+1,j),down=min(q,m-y+j);
		if(i>1){
			short ad=0;
			if(p-x<i-1) ad=ask(i-1,up,i-1,down);
			f[i-1][j][p][q]=max(f[i-1][j][p][q],(short)(nw+ad));
		}
		if(j>1){
			short ad=0;
			if(q-y<j-1) ad=ask(le,j-1,ri,j-1);
			f[i][j-1][p][q]=max(f[i][j-1][p][q],(short)(nw+ad));
		}
		if(p<n){
			short ad=0;
			if(x-i+p+1<=n) ad=ask(p+1,up,p+1,down);
			f[i][j][p+1][q]=max(f[i][j][p+1][q],(short)(nw+ad));
		}
		if(q<m){
			short ad=0;
			if(y-j+q+1<=m) ad=ask(le,q+1,ri,q+1);
			f[i][j][p][q+1]=max(f[i][j][p][q+1],(short)(nw+ad));
		}
	}
	printf("%d\n",f[1][1][n][m]);
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif
	
	work();
	
	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


Measured memory_bytes: 209152
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(date, LastDay, type, score):
  res = score
  res += s[date-1][type]
  for i in range(26):
    if i == type:
      continue
    res -= (date - LastDay[i]) *c[i]
  return res

def nasu():
  res = []
  for d in range(1,D+1):
    tmp = ["", 0]
    for i in range(26):
      if tmp[1] < s[d-1][i] + (d - LastDay[i]) * c[i]:
        tmp = [i, s[d-1][i] + (d - LastDay[i]) * c[i]]
    res.append(tmp[0])
    LastDay[res[-1]] = d
  return res

D = I()
c = IL()
s = [IL() for i in range(D)]

LastDay = [0]*26
score = 0
ans = nasu()

for i in ans:
  print(i+1)

"""
for d in range(D):
  score = tami(d+1, LastDay, ans[d]-1, score)
  LastDay[ans[d]-1] = d+1
  print(score)
"""

Measured memory_bytes: 77764
s= input()

listA= list(s)
listB = list(s)
listB.reverse()

index=0
while index < len(listA):
    if listA[index] == "A":
        break
    else:
        index+=1

index2 =0
while index2 < len(listB):
    if listB[index2] == "Z":
        break
    else:
        index2+=1

print(len(listB)-1-index2-index+1)

Measured memory_bytes: 6504
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = upper;
	rep(i, 2001) {
		int tmp = 0;
		rep(j, n) {
			chmax(tmp, abs(i - a[j]));
		}
		chmin(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  if(abs(a-b)%2 == 0) cout << abs(a-b)/2 << endl;
  else {
    ll c = min(a,b) - 1;
    ll d = n - max(a,b);
    ll e = min(c,d);
    cout << e + (abs(a-b)-1)/2 + 1 << endl;
  }
  return 0;
}

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

int main() {
	int N, n;
	cin >> N;
	vector<int> t(N + 1), x(N), y(N), point(2);
	bool finished = false;
	for (int i = 0; i < N; i++)
		cin >> t.at(i + 1) >> x.at(i) >> y.at(i);
	for (int i = 0; i < N; i++) {
		n = t.at(i + 1) - t.at(i) - (abs(x.at(i) - point.at(0)) + abs(y.at(i) - point.at(1)));
		if (n < 0) {
			finished = true;
			break;
		}
		else if (n % 2 == 0) {
			point.at(0) = x.at(i);
			point.at(1) = y.at(i);
		}
		else {
			finished = true;
			break;
		}
	}
	if (finished == true) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 1408
/*
  #問題：
  


  #分析：
  #オブジェクト：
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <initializer_list>
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


const unsigned int BIT_FLAG_0 = (1<<0);
const unsigned int BIT_FLAG_1 = (1<<1);
const unsigned int BIT_FLAG_2 = (1<<2);
const unsigned int BIT_FLAG_3 = (1<<3);
const unsigned int BIT_FLAG_4 = (1<<4);
const unsigned int BIT_FLAG_5 = (1<<5);
const unsigned int BIT_FLAG_6 = (1<<6);
const unsigned int BIT_FLAG_7 = (1<<7);


#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;



int main(void){
  double t; cin>>t;
  double x; cin>>x;
  cout << t/x << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N;
int A[100000+10];
vector<int> parent;

int solve(void) {
    parent.push_back(A[1]);
    for(int j = 2;j <= N;j++) {
        //cout<<upper_bound(parent,parent+N,A[j]) - parent<<endl;
        int index = upper_bound(parent.begin(),parent.end(),A[j]) - parent.begin();
        //cout<<parent.size()<<" "<<index<<endl;
        if(index + 1 > parent.size()) {
            parent.push_back(A[j]);
        } else {
            parent[index] = A[j];
        }
        //parent[(upper_bound(parent+1,parent+N+1,A[j]) - (parent+1))] = A[j];
    }

    cout<<parent.size()<<endl;
    return 0;
}

int main(void) {
    cin>>N;
 
    for(int i = 1;i <= N;i++) {
        cin>>A[i];
        A[i] = -1*A[i];
    }

    solve();

    return 0;
}





Measured memory_bytes: 1276
#include <stdio.h>

int hantei(double,double,double,double,double,double);

main(){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  double xac,yac,xbd,ybd;
  double xab,yab,xad,yad,xcb,ycb;
  int f;
  while(1){
    if(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)==EOF) break;
    xac=xa-xc;
    yac=ya-yc;
    xbd=xb-xd;
    ybd=yb-yd;
    xab=xa-xb;
    yab=ya-yb;
    xad=xa-xd;
    yad=ya-yd;
    xcb=xc-xb;
    ycb=yc-yb;
    
    f=0;
    
    if(hantei(xab,yab,xad,yad,xac,yac)==1) f=1;
    if(hantei(xab,yab,xcb,ycb,xbd,ybd)==1) f=1;
    
    if(f==0) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

int hantei(double a,double b,double c,double d,double e,double f){
  double t1,t2;

  t1=a*f-b*e;
  t2=c*f-d*e;

  if((t1*t2)<0) return 0;
  else return 1;
}

Measured memory_bytes: 0