akhauriyash/Code-Regression huggingface dataset:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 20:16
N = INT()
A = LIST()

dic = {}
for i in range(N):
    if not A[i] in dic:
        dic[A[i]] = 1
    else:
        dic[A[i]] += 1

if N % 2 == 0:
    # even
    # N = 8
    for i in range(N//2):
        #4 (0, 1, 2, 3)
        if N - 1 - 2 * i not in dic:
            # 7, 5, 3, 1
            # なければでる
            print(0)
            # exit()
            break
        elif dic[N-1-2*i] != 2:
            print(0)
            break
        else:
            pass
    else:
        print(2 ** (N // 2) % mod)
else:
    if A.count(0) != 1:
        print(0)
        # exit()
    else:
        # N = 5
        for i in range(N//2):
            # 2, (0, 1)
            if N - 1 - 2 * i not in dic:
                print(0)
                break
            elif dic[N-1-2*i] != 2:
                print(0)
                break
            else:
                pass
        else:
            print(2 ** (N // 2) % mod)



exit()


flag = True
if N % 2 == 1:
    for i in range((N+1) // 2):
        if i == 0:
            if A.count(i) != 1:
                flag = False
        elif A.count(i * 2) != 2:
            flag = False
    if flag == False:
        print(0)
        exit()
    else:
        print(2 ** ((N-1) // 2))
else:
    for i in range(N // 2):
        if A.count(2 * i + 1) != 2:
            flag = False
    if flag == False:
        print(0)
    else:
        print(2 ** (N//2))


Measured memory_bytes: 15956
import itertools as it

N=int(input())
dp=dict()
def ok(s):
    return all(['AGC' not in t for t in 
        [s, s[0:2]+s[3]+s[2], s[0]+s[2]+s[1]+s[3], s[1]+s[0]+s[2:4]]]) 

def n(j, s):
    if j == 3:
        return 1 if s not in ["AGC", "ACG", "GAC"] else 0
    if (j, s) in dp:
        return dp[(j, s)]
    ret = sum([
        n(j-1, "A"+s[:3]) if ok("A"+s[:3]) else 0,
        n(j-1, "C"+s[:3]) if ok("C"+s[:3]) else 0,
        n(j-1, "G"+s[:3]) if ok("G"+s[:3]) else 0,
        n(j-1, "T"+s[:3]) if ok("T"+s[:3]) else 0]
    )
    dp[(j, s)]=ret
    return ret

m=sum([n(N, "".join(s)) for s in it.product("ACGT", repeat=3)])
print(m%(10**9+7))

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

using namespace std;

#define ll long long
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
const int maxn=1e6+10;
ll a[maxn];
ll b[maxn];
int main()
{
    ll h;
    sll(h);
    ll sum=1;
    a[1]=1;
    b[1]=1;
    ll k=1;
    int ss=0;
    for(int i=2; k<=1e13+50; i++)
    {
        a[i]=2*a[i-1]+1;
        b[i]=2*b[i-1];
        k*=2;
        ss++;
    }
    int l=lower_bound(b,b+ss,h)-b;
    if(b[l]!=h)
        l--;
        printf("%lld",a[l]);
//    else
//        printf("%lld",a[l-1]);
    return 0;
}


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int main(){
  string s;

  cin >> s;

  sort(s.begin(), s.end());

  bool flag = false;
  for (auto itr = s.begin(); itr != s.end() - 1; itr++) {
    if (*itr == *(itr + 1)) flag = true;
  }

  if (flag) printf("no\n");
  else printf("yes\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n,h,w;
    cin>>n>>h>>w;
    int ans=0;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        if(a>=h and b>=w)ans++;
    }
    cout<<ans<<endl;
 return 0;   
}

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

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

    int d;
    std::set<int> s;
    for (int i = 0; i < N; ++i) {
        std::cin >> d;
        s.insert(d);
    }

    std::cout << s.size() << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;

/// Info.
///****************************************************************************************************************************************///
/// author                : BAHAA El-DEEN OSAMA .
/// Problem name          : E - An Odd Problem
/// Method                : brute force
/// Online judge          : vjudge(Contest)
/// Date                  : 8/6/2020
///****************************************************************************************************************************************///

long long val,n,cnt=0;

int main()
{

    cin>>n;
    for(int i=0 ;i<n;++i)
    {
         cin>>val;
         if( (val&1) && ((i+1)&1) )
         {
             ++cnt;
         }
    }
    cout <<cnt<<endl;



return 0;
}


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc163/tasks/abc163_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long r = long.Parse(Console.ReadLine());


            var l = Math.PI * (2 * r);



            string result = l.ToString();

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int>v1;
	int n2;
	for(int i=0;i<n;i++)
	{
		cin>>n2;
		v1.push_back(n2);
	}
	sort(v1.begin(),v1.end());
	cout<<v1[n-1]-v1[0];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(void){

	int i,a[10000];
	for(i=0;i<10000;i++){
		cin>>a[i];
		if(a[i]==0){
			return 0;
		}else{
			cout<<"Case "<<i+1<<": "<<a[i]<<endl;
		}
	}
   return 0;
}





Measured memory_bytes: 3036
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

int main(){
	int N,A,B;
	
	cin>>N>>A>>B;
	
	cout<<min(A,B)<<' '<<max(0,A+B-N)<<endl;
	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
int n, k;
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>k;
    cin>>s;
    int happy=0;
    for(int i=1; i<n; i++)
    {
        if(s[i]==s[i-1]) happy++;
    }
    int angry=n-1-happy;
    angry-=(2*k);
    angry=max(0, angry);
    happy=n-1-angry;
    cout<<happy<<endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int cal(string&);
int expression(string&, int&);
int kou(string&, int&);
int num(string&, int&);

int cal(string& s) {
	int pos = 0;
	return expression(s, pos);
}
int expression(string& s, int& pos) {
	int left = kou(s, pos);
	while (1) {
		char op = s[pos++];
		if (op == '+') {
			int right = kou(s, pos);
			left += right;
		}
		else if (op == '-') {
			int right = kou(s, pos);
			left -= right;
		}
		else if (op == '=') {
			return left;
		}
		else if (op == ')') {
			return left;
		}
	}
}
int kou(string& s, int& pos) {
	int left = num(s, pos);
	while (1) {
		char op = s[pos++];
		if (op == '*') {
			left *= num(s, pos);
		}
		else if (op == '/') {
			left /= num(s, pos);
		}
		else {
			--pos;
			return left;
		}
	}
}
int num(string& s, int& pos) {
	int ret = 0;
	if (s[pos] == '(') {
		++pos;
		return expression(s, pos);
	}
	else {
		while ('0' <= s[pos] && s[pos] <= '9') {
			ret *= 10;
			ret += s[pos] - '0';
			++pos;
		}
	}
	return ret;
}


int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		string s; cin >> s;
		cout << cal(s) << endl;
	}
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

signed main()
{
  int n = in(), a = in(), b = in();
  int m[n];
  int ans = 0;
  rep(i, n) m[i] = in();
  rep(i, n) if (m[i] < a or m[i] >= b) ans++;
  print(ans);

  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int32_t main(){
    fast;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int ans=0;
    for(int i=1;i<n;i++){
        int t=max(0ll,a[i-1]-a[i]);
        ans+=t;
        a[i]+=t;
    }
    cout<<ans;
    return 0;
}

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

int main() {
  int R;
  cin >> R;
  if(R < 1200){
    cout << "ABC" << endl;
  }
  else if(R >= 1200 && R < 2800){
    cout << "ARC" << endl;
  }
  else if(R >= 2800){
    cout << "AGC" << endl;
  }
}


Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())
if (x == a*a*b):
    ans = 0.0000000000
    print(ans)
else:
    x2 = x/a
    c = x2*2/a - b
    ans=math.atan(a/(b-c))
    ans = 90 - ans / math.pi * 180
    if c <= 0:
        c = x2*2 / b
        ans=math.atan(c/b)
        ans = 90 - ans / math.pi * 180
    print(ans)

Measured memory_bytes: 3064
s = input()
k = int(input())

n = len(s)
a = []
for i in range(n+1):
    for j in range(6):
        if len(s[i:i+j]) >=1:
            if not s[i:i+j] in a:
                a.append(s[i:i+j])
a.sort()
print(a[k-1])

Measured memory_bytes: 4044
#include <stdio.h>

#define TEMP    48

int read(int *d)
{
    char c;

    scanf("%c", &c);
    if(c == 0+TEMP) return 0;

    *d += c - TEMP;
    while(1) {
        scanf("%c", &c);
        if(c == '\n') break;

        *d += c - TEMP;
    }
    return 1;
}

int main(void)
{
    int i;
    int idx = 0;
    int data[1000] = {};

    while(read(&data[idx++]) != 0);

    for(i=0;i<idx-1;i++) {
        printf("%d\n", data[i]);
    }

    return 0;
}

Measured memory_bytes: 540
a, b, c, d = map(int, input().split())
 
if b >= 0 and d >= 0 and a <= 0 and c <= 0:# - + - +
    e = b*d
    f = a*c
    if e > f:
        print(e)
    else:
        print(f)
elif a >= 0 and b >= 0 and c >= 0 and d >= 0: #+ + + +
    print(b*d)
elif a <= 0 and b <= 0 and c <= 0 and d <= 0: #- - - -
    print(a*c)
elif a >= 0 and b >= 0 and c <= 0 and d <= 0: #+ + - -
    print(a*d)
elif a >= 0 and b >= 0 and c <= 0 and d >= 0: # + + - +
    print(b*d)
elif a <= 0 and b <= 0 and c >= 0 and d >= 0: # - - + +
    print(b*c)
elif a <= 0 and b <= 0 and c <= 0 and d >= 0: # - - - +
    print(a*c)
elif a <= 0 and b >= 0 and c >= 0 and d >= 0: # - + + +
    print(b*d)
elif a <= 0 and b >= 0 and c <= 0 and d <= 0: # - + - -
    print(a*c)

Measured memory_bytes: 62012
def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    solve()


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

using namespace std;
typedef long long ll;

int main(void)
{
    string s, t;
    int a, b;
    string u;
    cin >> s >> t >> a >> b >> u;

    if(s ==u)
        cout << a - 1 << " " << b << endl;
    else
        cout << a << " " << b - 1 << endl;
    return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())


signed main(){

	lli pre=0;
	lli afe=0;

	lli mae=0;
	lli ushi=0;

	lli n;
	cin>>n;

	string s;
	cin>>s;

	REP(i,0,n){
		if(s.at(i)=='('){
			mae++;
		}
		else{
			if(mae==0){
				pre++;
			}
			else{
				mae--;
			}
		}
	}

	REP(i,0,pre)cout<<"(";
	cout<<s;
	REP(i,0,mae)cout<<")";


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n;cin>>n;
    vi A(n);cin>>A;
    vi x(n,0);

    for(int i=0;i<n;i++){
        x[0]+=A[i]*((i&1)?-1:1);
        //cout<<x[0]<<" ";
    }
    x[0]/=2;

    for(int i=1;i<n;i++){
        x[i]=(A[i-1]-x[i-1]);
    }

    for(int i:x){
        cout<<2*i<<" ";
    }



}


Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

int main(){

    int a,b;
    cin >> a >> b;
    int tmp = b-a;
    int tmp2=1,tmp3=1;
    for(int i = 2;i <= 999;i++){

        
        tmp3=tmp2;
        tmp2+=i;
        if(tmp2-tmp3==tmp){
            cout << tmp2-b << endl;
            return 0;
        }

    }

   
    return 0;
}

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

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

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
int main() {
    //COMint();
    ll A=in<ll>();ll B=in<ll>();ll C=in<ll>();
    ll K=in<ll>();
    cout<<(A-B)*(K&1?-1:1)<<endl;
    return 0;   
}

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

int main() {
  int N, M = 1e6+1;
  cin >> N;
  vector V(M, 0);
  for (int a; cin >> a;) V.at(a)++;
  int ans = 0;
  for (int i = 0; i < M; i++) {
    if (V.at(i) == 1) ans++;
    if (V.at(i)) for (int j = 2; i * j < M; j++) V.at(i * j) = 0;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 7228
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int a = tmp[0], b = tmp[1];

        int d = b - a;
        int len = d * (1 + d) / 2;
        int ans = len - b;

        WriteLine(ans);
    }
}


Measured memory_bytes: 13396
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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; }

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

  ll ans = 0;
  rep(i, n){
    if(i==0) continue;

    if(a[i-1] <= a[i]) continue;

    ans += (a[i-1] - a[i]);
    a[i] = a[i-1];
  }

  cout << ans << endl;
}


Measured memory_bytes: 4772
from math import ceil, floor

def resolve():
  S = list(input())
  N = len(S)
  result = ["0"]*N

  # print("S:", S, ", N:", N)

  start_index = 0
  while True:
    R_index = start_index
    R_length = 1
    while S[R_index+1] == "R":
      R_length += 1
      R_index += 1

    L_index = R_index+1
    end_index = L_index
    L_length = 1
    if end_index+1 <= N-1:
      while S[end_index+1] == "L":
        L_length += 1
        if end_index+1 >= N-1:
          break
        else:
          end_index += 1

    result[R_index] = str(ceil(R_length/2) + L_length//2)
    result[L_index] = str(ceil(L_length/2) + R_length//2)

    if end_index + 1 >= N - 1:
      break

    start_index = end_index + 1
  print(" ".join(result))

if __name__ == "__main__":
  resolve()

Measured memory_bytes: 80968
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
const int maxn=3e3+7;
const int MOD=1e9+7;
int n,m;
int f[maxn][2];
int g[maxn][2];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n;++i)f[i][!i]=1;
	for(int i=1;i<=m;++i){
		memcpy(g,f,sizeof(f));
		memset(f,0,sizeof(f));
		#define add(x,y) ((x+=y)>=MOD ? x-=MOD : 1)
		for(int j=0;j<=n;++j)
			for(int k=0;k<2;++k){
				if(!g[j][k])continue;
				const int G=g[j][k];
				if(j<n)add(f[j][k],G),add(f[j+1][k],G);
				if(j>0)add(f[j][k|(j==1)],G),add(f[j-1][k|(j==1)],G);
			}
	}
	int ans=0;
	for(int i=0;i<=n;++i)
		add(ans,f[i][1]);
	printf("%d\n",ans);
	return 0;
}


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

void solve(){
    string s;cin>>s;
    int n;cin>>n;
    for (int i = 0; i < s.length(); i=i+n)
    {
        /* code */
         cout<<s[i];
    }

}
int main()
{    
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    // int  t; cin >> t; while (t--) solve();
    solve();
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define vi vector<int>
int main() {
    int n;
    cin>>n;
    vi a(n,0);
    int now=0;
    int cnt=0;
    rep(i,n){
        cin>>a[i];
    }

    while(true){
        cnt++;
        if(a[now]==2){
            break;
        }else if(cnt>n){
            cnt=-1;
            break;
        }else{
            now = a[now]-1;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3804
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

int main(){

  int a, b, c;
  cin >> a >> b >> c;
  if(a==b){
    cout << c << endl;
  } else if(b==c){
    cout << a << endl;
  } else {
    cout << b << endl;
  }

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string

// int hantei(string S){
//   for(int i=0;i<S.size(),i++){
//     for(int j=0;j<)
//   }
// }
//main
signed main(){
  int N,M,O,P,X,count=0,count2=0;
  double D=0;
  int c='A'-'a';
  //char C;
  str S,T;
  cin>>N>>M>>O>>P;
  if(N!=O)cout<<1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
 
typedef long long ll;
 
 
int main(){
	int n,k,q;
	cin >> n >> k >> q;
	vector<int> v(n,0);
	
	for(int i=0;i<q;++i){
		int a;
		cin >> a;
		a--;
		v[a]++;
	}
	
	for(int i=0;i<n;++i){
		if(k-q+v[i]> 0){
			cout << "Yes" << endl;	
		}else{
			cout << "No" <<endl;
		}
	}
	
	
	
	return 0;
}



Measured memory_bytes: 1024
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    long long n,i,x,y,cnt=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        if(x==y){cnt++;}
        else{cnt=0;}
        if(cnt>=3){cout<<"Yes";return 0;}
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 3620
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y, z, i = 0;
  cin >> x >> y >> z;
  int cru = z;
  while(true) {
    i++;
    cru += y + z;
    if(cru > x) { cout << i - 1 << endl; return 0; }
  }
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
 		Scanner scanner = new Scanner(System.in);
 		for (int i = 1; i < 6; i++) {
 			long N = scanner.nextInt();
 			if (N != i) {
 				System.out.println(i);
 			}
 		}
 	}
 }

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

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

using namespace std;

int main(){
	int n; cin>>n;
	vector<pair<int,int>> a(n);
	rep(i,n){
		string s; cin>>s;
		int cnt=0,mn=0;
		for(char c:s){
			if(c=='(') cnt++;
			else       cnt--, mn=min(mn,cnt);
		}
		a[i]={cnt,min(0,cnt)-mn};
	}

	sort(a.begin(),a.end(),[&](const auto& x,const auto& y){
		int tx=(x.first>=0?0:1);
		int ty=(y.first>=0?0:1);
		if(tx!=ty) return tx<ty;
		if(tx==0) return x.second<y.second;
		else      return x.second>y.second;
	});

	int cnt=0;
	rep(i,n){
		if(cnt+(min(0,a[i].first)-a[i].second)<0) return puts("No"),0;
		cnt+=a[i].first;
	}
	puts(cnt==0?"Yes":"No");

	return 0;
}


Measured memory_bytes: 11104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
ll gcd(ll a,ll b)
{
	return b == 0?a:gcd(b,a%b);
}

int main()
{
	ll a,b;
	while(~scanf("%lld%lld",&a,&b)){
	ll temp=gcd(a,b);
	ll i=100;
	int sum = 1;
	for(i=2;i*i<=temp;i++){	
		if(temp%i==0){
			sum++;
			while(temp % i == 0){
				temp /= i;	
			}
		}			
	}
	if(temp > 1)	sum++;
	printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <math.h>
using namespace std;
const double th = M_PI * 60 / 180;
struct P {
	double x, y;
};
void makeKoch(P a, P b, int de) {
	if (de == 0) return;
	P c, d, e;
	c.x = (a.x * 2 + b.x) / 3;
    c.y = (a.y * 2 + b.y) / 3;
	d.x = (a.x + b.x * 2) / 3;
	d.y = (a.y + b.y * 2) / 3;
	e.x = c.x + (d.x - c.x) * cos(th) - (d.y - c.y) * sin(th);
	e.y = c.y + (d.x - c.x) * sin(th) + (d.y - c.y) * cos(th);
	makeKoch(a, c, de - 1);
	printf("%.8f %.8f\n", c.x, c.y);
	makeKoch(c, e, de - 1);
	printf("%.8f %.8f\n", e.x, e.y);
	makeKoch(e, d, de - 1);
	printf("%.8f %.8f\n", d.x, d.y);
	makeKoch(d, b, de - 1);

}
int main() {
	P p0, p1;
	p0.x = 0;
	p0.y = 0;
	p1.x = 100;
	p1.y = 0;
	int n;
	scanf("%d", &n);
	printf("%.8f %.8f\n", p0.x, p0.y);
    makeKoch(p0, p1, n);
	printf("%.8f %.8f\n", p1.x, p1.y);
	return 0;

}

Measured memory_bytes: 2592
import java.util.Scanner;

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

	int N = scan.nextInt();  //整数の個数

	long[] A_ = new long[N];  //黒板に書かれている数字
	int odd = 0;
	int even = 0;
	for(int i = 0; i < N; i++){
	    A_[i] = scan.nextLong();
	    if(A_[i] % 2 == 0)
		even++;
	    else
		odd++;
	}

	int flag = 1;
	while(odd+even > 1){
	    while(odd > 1){
		odd -= 2;
		even++;
	    }while(even > 1){
		even--;
	    }
	    if(odd == 1 && even == 1){
		flag = -1;
		break;
	    }
	}

	if(flag == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
}


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

int main(){
    int N;
    string s;
    cin >> N >> s;
    int ans=1;
    char a=s[0];
    rep(i,N){
        if(a != s[i]){
            ans ++;
        }
        a=s[i];
    }
    cout << ans;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

string s;
int main(){
	cin >> s;
	if((s[0]=='Y'&&s[1]=='A')&&(s[2]=='K'&&s[3]=='I')){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;
  vector<Double> V(N);
  cin>>V;
  sort(V.begin(), V.end());
  for(Int i=0;i<N-1;i++)
    V[i+1] = (V[i] + V[i+1])/2.0;

  Double ans = V[N-1];
  cout<<ans<<endl;

  return 0;
}


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

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

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int a,n,t=0;
	cin >> n;
	vector<int>vec(n);
	rep(i, n) {
		cin >> vec[i];
	}
	rep(i, n) {
		if (vec[vec[i] - 1] - 1 == i) {
			t++;
		}
	}
	cout << t / 2 << endl;
}


Measured memory_bytes: 1024
N = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())
metal = [(ga, gb), (sa, sb), (ba, bb)]
metal.sort(reverse = True, key = lambda x:x[1]-x[0])
ga, gb = metal[0]
sa, sb = metal[1]
ba, bb = metal[2]
if ba<=bb:
    res = N
    for i in range(N//ga+1):
        for j in range((N-i*ga)//sa+1):
            k = (N-i*ga-j*sa)//ba
            tmp = k*bb+j*sb+i*gb+(N-i*ga-j*sa-k*ba)
            res = max(res, tmp)
elif sa<=sb:
    res = N
    for i in range(N//ga+1):
        j = (N-i*ga)//sa
        tmp = gb*i+sb*j+(N-i*ga-sa*j)
        res = max(res, tmp)
    k = res//bb
    res += (ba-bb)*k
elif ga<=gb:
    i = N//ga
    N+=i*(gb-ga)
    res = N
    for i in range(N//sb+1):
        j = (N-i*sb)//bb
        tmp = N+(sa-sb)*i+(ba-bb)*j
        res = max(res, tmp)
else:
    res = N
    ga, gb = gb, ga
    sa, sb = sb, sa
    ba, bb = bb, ba
    for i in range(N//ga+1):
        for j in range((N-i*ga)//sa+1):
            k = (N-i*ga-j*sa)//ba
            tmp = k*bb+j*sb+i*gb+(N-i*ga-j*sa-k*ba)
            res = max(res, tmp)
print(res)


            


Measured memory_bytes: 41196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll get_sqrt(ll x){
	ll l=1,r=1e9+10,mid,ans;
	while(l<=r){
		mid=l+r>>1;
		if(mid*mid<=x) ans=mid,l=mid+1;
		else r=mid-1;
	}
	return ans;
}
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		ll a,b,n;
		scanf("%lld%lld",&a,&b);
		if(a>b) swap(a,b);
		n=a*b-1;
		ll g=get_sqrt(n),ans=0;
		ans=g+g;
		if(a<=g) ans--;
		if(g*(g+1)>n) ans--;
		printf("%lld\n",ans);
	}
	return 0;
}

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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec)
    is >> x;
  return is;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  int a, b, q;
  cin >> a >> b >> q;
  vll s(a), t(b), x(q);
  cin >> s >> t >> x;

  // cout << *s.begin() << endl;

  REP(i, q) {
    auto ita = lower_bound(all(s), x[i]);
    auto itb = lower_bound(all(t), x[i]);

    ll ua, la, ub, lb;
    if (ita == s.begin()) {
      la = -(1LL << 50);
      ua = *ita;
    } else if (ita == s.end()) {
      la = *(--ita);
      ua = (1LL << 50);
    } else {
      ua = *ita;
      la = *(--ita);
    }

    if (itb == t.begin()) {
      lb = -(1LL << 50);
      ub = *itb;
    } else if (itb == t.end()) {
      lb = *(--itb);
      ub = (1LL << 50);
    } else {
      ub = *itb;
      lb = *(--itb);
    }

    la -= x[i];
    ua -= x[i];
    lb -= x[i];
    ub -= x[i];

    ll ans = (1LL << 50);
    ans = max(abs(ua), abs(ub));
    ans = min(ans, max(abs(la), abs(lb)));
    ans = min(ans, abs(ua) + abs(lb) + min(abs(ua), abs(lb)));
    ans = min(ans, abs(ub) + abs(la) + min(abs(ub), abs(la)));
    // cout << ans << " " << x[i] << " " << la << " " << ua << " " << lb << " "
    //      << ub << endl;
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, T t){return v2<T>(r, vector<T>(c, t));}

int a, b, c, d, k;

void solve(){
    cin >> a >> b >> c >> d >> k;
    cout << (c-a)*60 + (d-b) - k << '\n'; 
}

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


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
    size_t a, b, c;
    cin >> a >> b >> c;
    size_t op = 0;
    while (!(a == b && b == c && c == a)) {
        size_t array[3] = {a, b, c};
        size_t max_index = (a >= b && a >= c) ? 0 : (b >= a && b >= c) ? 1 : 2;
        size_t min_index = (a < b && a < c) ? 0 : (b < a && b < c) ? 1 : 2;
        if (array[max_index] - array[min_index] >= 2) {
            ((min_index == 0) ? a : (min_index == 1) ? b : c) += 2;
            ++op;
        }
        else {
            if (max_index == 0) {
                ++b;
                ++c;
            }
            else if (max_index == 1) {
                ++a;
                ++c;
            }
            else {
                ++a;
                ++b;
            }
            ++op;
        }
    }
    cout << op << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int n, m, a[100000], t, s;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0){
      break;
    }
    for(int i = 0; i < n; i++){
      cin >> a[i];
    }

    t = s = 0;
    for(int i = 0; i < m; i++){
      t += a[i];
    }
    s = t;
    for(int i = m; i < n; i++){
      t += (a[i] - a[i-m]);
      if(s < t){
	s = t;
      }
    }
    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int cmp(char a,char b){
    return a>b;
}
int main(){
    string x,y,x_1,y_1;
    cin>>x>>y;
    sort(x.begin(),x.end());
    sort(y.begin(),y.end(),cmp);
    if(y>x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(raw_input())
p = [1]
for j in [6, 9]:
  i = j
  while i <= N:
    p.append(i)
    i *= j
c = [N] * (N+1)
c[0] = 0
for i in range(0, N+1):
  for j in p:
    if i+j <= N:
      c[i+j] = min(c[i+j], c[i]+1)
print c[N]

Measured memory_bytes: 6532
#include <bits/stdc++.h>
//#include <atcoder/fenwicktree>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
//#define _GLIBCXX_DEBUG

using ll = long long;
using ull = unsigned long long;
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; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;

int main()
{
    vector<vector<int>> A(3, vector<int>(3));
    rep(i, 3) {
        rep(j, 3) {
            cin >> A.at(i).at(j);
        }
    }

    int N;
    cin >> N;
    rep(i, N) {
        int b;
        cin >> b;
            rep(i, 3) {
                rep(j, 3) {
                    
                    if(A.at(i).at(j) == b) A.at(i).at(j)=0;
                        cerr << A.at(i).at(j) << " " << "\n";
                } 
            }
    }

    if((A.at(0).at(0)==0 and A.at(0).at(1)==0 and A.at(0).at(2)==0) or (A.at(1).at(0)==0 and A.at(1).at(1)==0 and A.at(1).at(2)==0) or(A.at(2).at(0)==0 and A.at(2).at(1)==0 and A.at(2).at(2)==0) or(A.at(0).at(0)==0 and A.at(1).at(0)==0 and A.at(2).at(0)==0) or(A.at(0).at(1)==0 and A.at(1).at(1)==0 and A.at(2).at(1)==0) or(A.at(0).at(2)==0 and A.at(1).at(2)==0 and A.at(2).at(2)==0) or (A.at(0).at(0)==0 and A.at(1).at(1)==0 and A.at(2).at(2)==0) or(A.at(0).at(2)==0 and A.at(1).at(1)==0 and A.at(2).at(0)==0)) {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

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

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int n, a, b;
    std::string s;

    std::cin >> n >> a >> b >> s;

    int qualified = 0;
    int foreign = 0;

    for (char &c : s) {
        if (c == 'c') {
            goto No;
        }
        else if (c == 'a') {
            if (qualified < a + b) {
                ++qualified;
                goto Yes;
            }
        }
        else {
            if (qualified < a + b && foreign < b) {
                ++foreign;
                ++qualified;
                goto Yes;
            }
        }

        goto No;

        No:
            std::cout << "No\n";
            continue;
        Yes:
            std::cout << "Yes\n";
    }

    return 0;
}

Measured memory_bytes: 3792
n , m = map(int, input().split())
x = [input().split() for _ in range(m)]

ac, wa = 0, 0
ac_wa_table = [[0, 0] for _ in range(n)]
for p, s in x:
    index = int(p) -1
    if ac_wa_table[index][0] != 0:
        continue
    if s == 'AC':
        ac_wa_table[index][0] +=1
        ac += 1
        wa += ac_wa_table[index][1]
    elif s == 'WA':
        ac_wa_table[index][1] +=1
print(ac, wa)

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

int main() {
  int H,W; cin >> H >> W;
  int d[10][10],A[H][W];
  rep(i,0,10) rep(j,0,10) cin >> d[i][j]; 
  rep(i,0,H) rep(j,0,W) cin >> A[i][j];
  rep(k,0,10) {
    rep(i,0,10) {
      rep(j,0,10) {
        d[i][j] = min(d[i][j],d[i][k]+ d[k][j]);
      }
    }
  }
  
  int ans =0;
  rep (i,0,H) rep(j,0,W) {
    if (A[i][j] == -1 || A[i][j] == 1) continue;
    else ans += d[A[i][j]][1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
  string S; cin>>S;
  int i;
  rep(i,S.size()){
    if(S[i] == '?') S[i] = 'D';
  } 
  AA(S);
  return 0;
}

Measured memory_bytes: 3724
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n= int(input())
G=[[] for i in range(n+1)]

for i in range(n-1):
	a,b,c=map(int, input().split())
	G[a].append([b,c])
	G[b].append([a,c])

q,k=map(int,input().split())


D=[None]*(n+1)
 
def dfs(x,d):
    D[x]=d
    for yy,dd in G[x] :
        if D[yy] is not None:
            continue
        dfs(yy,dd+d)
dfs(k,0)

for i in range(q):
    x, y = map(int, input().split())
    print(D[x] + D[y])

Measured memory_bytes: 139148
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] A = new int [N];
        for (int i = 0 ; i < N ; i++) {
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);

        int a = 0 ;
        int b = 0;
        if (N % 2 == 1) {
            for (int i = 0 ; i < N ; i++) {
                if (i % 2 == 0) {
                    b += A[i];
                } else {
                    a += A[i];
                }
            }
        } else {
            for (int i = 0 ; i < N ; i++) {
                if (i % 2 == 0) {
                    a += A[i];
                } else {
                    b += A[i];
                }
            }
        }
        System.out.println(b - a);
    }

}

Measured memory_bytes: 21076
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <complex>
#include <string.h>
#include <iomanip>
using namespace std;

typedef long long ll;

string s, t;
int ind, l;
char c;
int BOOL = 10007;
int type;
bool val;

char get() {
  if (ind < l) 
    return s[ind++];
  else
    return -1;
}

void lex() {
  if (c == 'T' || c == 'F') {
    type = BOOL;
    val = (c == 'T');
  } else if (c == '*' || c == '+' || c == '(' || c == ')' || c == '=') {
    type = c;
  } else if (c == '-') {
    if (ind < l && s[ind] == '>') {
      c = get();
    }
    type = c;
  }
  c = get();
}

bool F() {
  if (type == BOOL) {
    lex();
    return val;
  }
  if (type == '(') {
    lex();
    bool a = F();
    char prev =type;
    lex();
    bool b = F();
    if (type != ')') cout << "F:error" << endl;
    bool res;
    switch(prev) {
    case '*': res = a && b; break;
    case '+': res = a || b; break;
    case '>': res = !(a && !b); break;
    }
    lex();
    return res;
  }
  if (type == '-') {
    lex();
    bool f = F();
    return !f;
  }
}

bool E() {
  bool a = F();
  if (type != '=') {
    cout << "E:error" << endl;
  }
  lex();
  bool b = F();
  return a == b;
}

bool alpha[11];

bool rec(int k) {
  if (k == 11) {
    s = "";
    l = t.size();
    for (int i = 0; i < l; i++) {
      if ('a' <= t[i] && t[i] <= 'k') 
	s += alpha[t[i]-'a'] ? 'T' : 'F';
      else
	s += t[i];
    }
    ind = 0;
    c = get();
    lex();
    return E();
  } else {
    alpha[k] = true;
    if (!rec(k+1)) return false;
    alpha[k] = false;
    if (!rec(k+1)) return false;
    return true;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);

  while (true) {
    cin >> t;
    if(t == "#") break;
    cout << (rec(0) ? "YES" : "NO") << endl;
  }
}

Measured memory_bytes: 1240
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int a,b,n,ans=0; 
    cin>>a>>b>>n; 
    ans = (a*min(n,b-1))/b-min(n,b-1)/b*a;
    cout<< ans;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3624