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

using ll = long long;
using ull = unsigned long long;
#define repi(n) for (long long i = 0; i < (n); ++i)
#define repj(n) for (long long j = 0; j < (n); ++j)
#define repk(n) for (long long k = 0; k < (n); ++k)
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1e9 + 7;

modint binomial(ll n, ll r) {
  modint re(1), b(1);
  repi(r) {
    re *= n - i;
    b *= i + 1;
  }
  return re / b;
}
int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  cout << modint(2).pow(n) - 1 - binomial(n, a) - binomial(n, b) << endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
if(b<0&&(b-a)%2==0){cout<<"Negative\n";return 0;}
if(a<=0&&b>=0){cout<<"Zero\n";return 0;}
cout<<"Positive\n";return 0;
} 

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def main():
    a,b,k=map(int,input().split())
    kk=[]
    for i in range(a,a+k):
        if i>b:
            break
        kk.append(i)
    for i in range(b-k+1,b+1):
        if i<a:
            continue
        if i <= kk[-1]:
            continue
        kk.append(i)
    for i in kk:
        print(i)

main()

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

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

    if(N % 1000 == 0){
        cout << 0 << endl;
    }
    else{
        int pay = (N / 1000 + 1) * 1000;

        cout << pay - N << endl;
    }
}

Measured memory_bytes: 3604
N = int(input())
S = input()
part = 0
leftW = 0
rightR = S.count('R')
moves = [rightR]

for i in range(N):
	if S[i] == 'R':  # rightR:decrease
		rightR -= 1
	else:          # leftW:increase
		leftW += 1
	moves.append(max(leftW, rightR))
# print(moves)
ans = min(moves[i] for i in range(N+1))
print(ans)

Measured memory_bytes: 81896
def get_args():
    A, B = map(int, input().split())
    # print(A, B)

    return A, B


def solve(A, B):
    if A == 1:
        A = 14
    if B == 1:
        B = 14

    if A == B:
        return "Draw"
    elif A < B:
        return "Bob"
    else:
        return "Alice"


if __name__ == '__main__':
    res = solve(*get_args())
    print(res)


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

ll m[1001][1001];
int main() {
	ll h, w, a, b; cin >> h >> w >> a >> b;

	rep(i, 0, h) {
		if (i < b) {
			rep(j, 0, w) {
				if (j < a)m[i][j] = 0;
				else m[i][j] = 1;
			}
		}
		else {
			rep(j, 0, w) {
				if (j < a)m[i][j] = 1;
				else m[i][j] = 0;
			}
		}
	}
	rep(i, 0, h) {
		rep(j, 0, w) {
			cout << m[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 9088
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
}


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

using namespace std;

const int N = 200005;

long long a[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    a[i] = a[i - 1] + x;
  }
  long long res = 1LL << 62;
  for (int i = 1; i < n; ++i) {
    res = min(res, abs(a[n] - 2 * a[i]));
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1792
import math
N = int(input())
ans = ""

for i in range(1, int(math.sqrt(2*N)+1)):
    if i*(i+1) == 2*N:
        k = i
        break
else:
    print("No")
    exit()

for i in range(k+1):
    if i == 0:
        ans += str(k) + " " + " ".join(map(str, range(1, k+1))) + "\n"
        ans_list = [0, k]
    else:
        ans_list = [i+1 for i in ans_list]
        ans += str(k) + " " + " ".join(map(str, ans_list[:-1]+\
        list(range(ans_list[-1], ans_list[-1]+k-i)))) + "\n"
        ans_list = ans_list[:-1] + [ans_list[-1]-1]
        ans_list.append(ans_list[-1]+k-i)


print("Yes"+"\n{}\n".format(k+1)+ans[:-1])

Measured memory_bytes: 135616
//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↑入力 ↓出力');
  Main();
});
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 s = next();
  var output = 0;
  for(var i = 0; i < s.length; i++){
    output += myconv(s[i], 1);
  }
  if(output % 9 == 0){
    myout("Yes");
  }else{
    myout("No");
  }
}

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

int main() {
	int k,a,b;cin>>k>>a>>b;
	int flag=0;
	if((a/k)*k+k<=b){
		flag=1;
	}
	if(a%k==0){
		flag=1;
	}
	if(flag){
		cout<<"OK"<<endl;
	}else{
		cout<<"NG"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3568
using System;

namespace Study
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int warareru_kazu = int.Parse(input.Split(' ')[0]);
            int waru_kazu = int.Parse(input.Split(' ')[1]);
            int amari = int.Parse(input.Split(' ')[2]);

            for(int i = 1; i<100 ; i++)
            {
                int ans = warareru_kazu * i % waru_kazu;
                if (ans == amari)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct ban
{
    int x, y;
};
bool operator<(const ban& a, const ban& b)
{
    return a.x + a.y < b.x + b.y;
}

int n;
ban a[N];

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].x >> a[i].y;
    }
    sort(a, a + n);
    long long ans = 0;
    for (int i = n - 1; i >= 0; --i)
    {
        if ((n - i) % 2 == 1)
            ans += a[i].x;
        else
            ans -= a[i].y;
    }
    cout << ans << endl;
    return 0;
}


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

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

    int N;
    cin >> N;

    vector<int> V(N), C(N);
    rep(i, N) cin >> V[i];
    rep(i, N) cin >> C[i];

    vector<int> res;

    rep(bit, 1 << N) {
        int X = 0;
        int Y = 0;

        rep(i, N) {
            if (bit & 1 << i) {
                X += V[i];
                Y += C[i];
            }
        }

        res.push_back(X-Y);
    }

    cout << *max_element(res.begin(), res.end()) << "\n";
}

Measured memory_bytes: 6256
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
  int main(){
  long long X;
  long long B = 100;
  int Y = 1;
    cin >> X;
    while(1){
      B = B + B/100;
      if(B >= X){
        cout << Y <<endl;
        break;
      }
      Y++;
    }
}

Measured memory_bytes: 3572
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int N;
	cin >> N;

	int a, b;

	for (int i = sqrt(N + 1); i >= 0; i--) {
		if (N % i == 0) {
			a = i;
			break;
		}
	}

	b = N / a;

	cout << a + b - 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B;
    char field[110][110];
    cin>>A>>B;
    A--;B--;
    rep(i,50){
        rep(j,100){
            field[i][j]='.';
        }
    }
    rep2(i,50,100){
        rep(j,100){
            field[i][j]='#';
        }
    }
    for(ll i=0;i<50;i+=2){
        for(ll j=0;j<100;j+=2){
            if(B>0){
                field[i][j]='#';
                B--;
            }
        }
    }
    for(ll i=51;i<100;i+=2){
        for(ll j=0;j<100;j+=2){
            if(A>0){
                field[i][j]='.';
                A--;
            }
        }
    }
    cout<<100<<" "<<100<<endl;
    rep(i,100){
        rep(j,100){
            cout<<field[i][j];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		LinkedList<Integer> al = new LinkedList<>();
		LinkedList<Integer> ans = new LinkedList<>();
		for (int i = 0; i < n; i++) {
			al.add(sc.nextInt());
		}
		ListIterator<Integer> ite = al.listIterator(al.size());
		while (ite.hasPrevious()) {
			int ind = ite.previousIndex() + 1;
			int pre = ite.previous();
			if (pre == ind) {
				ans.add(pre);
				ite.remove();
				ite = al.listIterator(al.size());
			}
		}
		if (al.isEmpty()) {
			ite = ans.listIterator(ans.size());
			while (ite.hasPrevious()) {
				System.out.println(ite.previous());
			}
		} else {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 21972
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int n;
string ans = "";
void func(int dig, int num)
{
	if(n)
	{
		if(--dig)
		{
			for(int i = max(0, num - 1); i <= min(9, num + 1); ++i)
			{
				ans.push_back('0' + i);
				func(dig, i);
				ans.pop_back();
			}
		}
		else
		{
			if(--n == 0)
			{
				cout << ans << "\n";
			}
		}
	}
}

signed main()
{
	cin >> n;
	for(int i = 1; n; ++i)
	{
		for(int j = 1; j <= 9 && n; ++j)
		{
			ans.push_back('0' + j);
			func(i, j);
			ans.pop_back();
		}
	}
}


Measured memory_bytes: 3604
n,u,v=gets.split.map(&:to_i)
nei=(0..n).map{[]}
(n-1).times{
  a,b=gets.split.map(&:to_i)
  nei[a] << b
  nei[b] << a
}

ut = [0]
uq = [[u,0]]
vt = [0]
vq = [[v,0]]
n.times{
  un,ud = uq.pop
  ut[un] = ud
  nei[un].each{|ni|
    uq.push [ni,ud+1] unless ut[ni]
  }
  vn,vd = vq.pop
  vt[vn] = vd
  nei[vn].each{|ni|
    vq.push [ni,vd+1] unless vt[ni]
  }
}
p ut.zip(vt).select{|u,v|u<v}.map{|u,v|v}.max-1

Measured memory_bytes: 17532
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<cmath>

using namespace std;

int gcd(int n, int m){
	return m != 0 ? gcd(m, n % m) : n;
}

int main(){

	int A, B, K;
	cin >> A >> B >> K;

	int now = 0;

	for (int i = gcd(A, B); i >= 1; i--){
		if (A%i == 0 && B%i == 0)
			now++;

		if (now == K){
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;

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

  int N;
  cin >> N;
  long double temp1, temp2;
  priority_queue<long double, vector<long double>, greater<long double>> que;
  for (int i = 0; i < N; i++) {
    cin >> temp1;
    que.push(temp1);
  }

  while (que.size() > 1) {
    temp1 = que.top();
    que.pop();
    temp2 = que.top();
    que.pop();
    que.push((temp1 + temp2) / 2);
  }
  long double ans = que.top();
  cout << setprecision(52) << ans << endl;

  return 0;
}


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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<endl
#define DO(x, y) cout<<x<<" "<<y<<endl
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<<endl
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)



int main(void)
{
    int i;
    int n;
    SI(n);
    int arr[n];
    F(i, 0, n)
        SI(arr[i]);
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    F(i, 2, n)
    {
        dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
    }
    SO(dp[n - 1]);
    return 0;
}

Measured memory_bytes: 1024
X = int(input())
flag = True
a = 0
b = 0
for i in range(-118, 120):
    if flag == False:
        break
    for j in range(-119, 120):
        if i**5 - j**5 == X:
            a = i
            b = j
            flag = False
            break


print(str(a), str(b))


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
int square[100];

int main() {
    int n, sol{ 0 };
    cin >> n;
    for (int i{ 1 }; i <= n; i++) {
        cin >> square[i];
    }

    for (int i{ 1 }; i <= n; i++) {
        if (i % 2 != 0 && square[i] % 2 != 0)sol++;
    }

    cout << sol;
    
    return 0;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    int m,d;cin>>m>>d;
    int cnt=0;
    REP(i,1,m+1){
        REP(j,1,d+1)if((j%10)>=2&&(j/10)>=2&&(j%10)*(j/10)==i)cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 764
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{

    public class Program
    {
        const long MOD = 1000000007;
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            long N = cin.ReadLong;
            long ans = 0;
            for(long i=1; i<=N; i++)
            {
                if(!(i%15==0 || i%3 == 0 || i%5 == 0))
                {
                    ans+=i;
                }
            }
            WriteLine(ans);
        }

        static long Gcd(long p, long q)
        {
            if (p % q == 0) return q;
            return Gcd(q, p % q);
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }

    }
}

Measured memory_bytes: 27856
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b;
  cin>>a>>b;
  if(a==b){
    cout<<"Draw"<<"\n";
    return(0);
  }
  if(a==1){
    cout<<"Alice"<<"\n";
    return(0);
  }
  if(b==1){
    cout<<"Bob"<<"\n";
    return(0);
  }
  if(a>b){
    cout<<"Alice"<<"\n";
    return(0);
  }
  if(a<b){
    cout<<"Bob"<<"\n";
    return(0);
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n; cin >> n;
	vector<int> hash(n);
	for(auto &x : hash)
		cin >> x;
	int ans = INT_MAX;
	for(int i = 1 ; i < n ; i++){
		int s1 = 0,s2=0;
		for(int j = 0 ; j < i ; j++){
			s1+=hash[j];
		}
		for(int j = i ; j < n ; j++){
			s2+=hash[j];
		}
		ans = min(ans,abs(s1-s2));
	}
	cout<<ans<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3596
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#a = list(map(int, input().split()))

n,T = list(map(int, input().split()))
item=[]

for i in range(n):
    item.append(list(map(int, input().split())))
    
dp = [[-1 for i in range(T+1)] for j in range(n+1)]

for i in range(T+1):
    dp[0][i]=0

item.sort(key=lambda x:x[0])
    
for i in range(n):
    nowit=item[i]
    for j in range(T):
        z = dp[i][j]
        y = dp[i+1][min(j+nowit[0],T)]
        down = dp[i+1][j]
        dp[i+1][j] = max(dp[i][j],down)
        if(z >= 0):
            dp[i+1][min(j+nowit[0],T)] = max(z+nowit[1],y)
    dp[i+1][T] = max(dp[i][T],dp[i+1][T])
            
print(max(dp[n]))

#for i in range(len(dp)):
    #print(dp[i])

Measured memory_bytes: 123736
def main():
  n = int(input())
  p = list(map(int,input().split()))
  res = 0
  for i in range(2, n):
    if p[i-2] == p[i-1] and p[i-1] == p[i]:
      pass
    elif p[i-2] == p[i-1] or p[i-1] == p[i] or p[i] == p[i-2]:
      if min(p[i-2], p[i-1], p[i]) < min(p[i-2], p[i-1], p[i]) < p[i-1] and p[i-1] <= max(p[i-2], p[i-1], p[i]):
        res += 1
      else:
        pass
    else:
      if min(p[i-2], p[i-1], p[i]) < p[i-1] and p[i-1] < max(p[i-2], p[i-1], p[i]):
        res += 1
      else:
        pass
  print(res)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 3064
A,V = input().split()
B,W = input().split()

A = int(A)
V = int(V)
B = int(B)
W = int(W)

T = int(input())



def solve():

    distance = abs(B-A)
    closer = abs(V-W)

    if V <= W:
        print("NO")
        return

    time = distance/closer
    if time <= T:
        print("YES")
        return
    else:
        print("NO")
        return


solve()


Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
const int maxx = 2e6+1314;
char s[maxx];
int aa[maxx];
int n,a,b,c,d;
int read(){int k;cin>>k;return k;}
bool chick(int a,int b){	
	for(int i=a+1;i<=b;i++){
		if(s[i]=='#'&&s[i]==s[i-1])
		return 1;
	}	
	return 0;
}	
int main(){	
	n=read();a=read();b=read();c=read();d=read();
	scanf("%s",s+1);
	for(int i=1;i<=n;i++){	
		aa[i]=(s[i]=='#');
		aa[i]+=aa[i-1];
	}	
	int flag=1;
	if(c<a||d<b)flag=0;
	if(a>b)swap(a,b),swap(c,d);
	if(chick(a,c))flag=0;
	if(chick(b,d))flag=0;
	if(d<=c){	
		int w=0;
		for(int i=b;i<=d;i++){	
			if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.')w++;
		}	
		if(w==0)flag=0;
	}	
	if(flag)puts("Yes");
	else puts("No");
	return 0;
}	

Measured memory_bytes: 3072
import java.util.Scanner;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = new int[n+1];

    for(int i = 1;i <= n;i++){
      int a = sc.nextInt();
      data[a] = i;
    }

    for(int i = 1;i <= n;i++){
      System.out.println(data[i]);
    }


  }
}


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


int main() {
  int n  ;
  cin >> n ;
  
  bool finished = false;
  for(int i=n;i>=1;i--){
    for(int j=1; j*j<=n;j++){
      for(int k=1;k<9;k++){
        if(i/j==pow(j,k)){
        cout << pow(j,k+1) << endl;
        finished = true ;
        break;
        }
      }
      if(finished){
        break;
      }
    }
    if(finished){
        break;
      }
  }
  
}

Measured memory_bytes: 384
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

s = read_int()[0]

A = [False for _ in range(1000000 + 1)]

def solve():
    a = s
    A[a] = True
    ans = 0
    m = 1
    while True:
        if a % 2 == 0:
            a = a // 2
            m += 1
            if A[a]:
                ans = m
                break
            else:
                A[a] = True
        elif a % 2 == 1:
            a = 3*a + 1
            m += 1
            if A[a]:
                ans = m
                break
            else:
                A[a] = True
    return ans


if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 10904
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}

int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
ll n; cin >> n;
ll a[n];
ll dp[n+25]={0};
   for(int i=0;i<=n;i++)
   {
   	dp[i]=0;
   }
    for(ll i = 0; i < n; ++i){
        cin >> a[i];
    }
    dp[0] = 0;
    for(ll i = 1; i < n; ++i){
        dp[i] = min(dp[i - 1] + abs(a[i]  - a[i - 1]), dp[i - 2] +  abs(a[i] - a[i - 2]));
    }
    cout << dp[n - 1];
    return 0;
}

 


Measured memory_bytes: 5136
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#pragma comment(linker, "/STACK:336777216")  

using namespace std;

const int MAXN = 500 + 10;

int N;
char S[100];

bool chk()
{
	N = strlen(S);
	if (N < 4)
		return 0;
	return S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I';
}

void Work()
{
	scanf("%s", S);
	printf(chk() ? "Yes\n" : "No\n");
}

int main()
{
	Work();
	return 0;
}

Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for (int i = (m) ; i < (n) ; i++)
#define per(i,n,m) for (int i = (n-1) ; i >= (m) ; i--)
#define all(x)     (x).begin(), (x).end()
#define sz(x)      ((int) (x).size())
ll gcd(ll x,ll y){
    if(y==0)return x;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}
int main(void){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3636
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		int[]ar=split();
		int n=ar[0];
		int p=ar[1];
		String s=br.readLine();
		if(p==2)
		{
			long ans=0;
			for(int i=0;i<n;i++)
			{
				int x=s.charAt(i)-'0';
				if(x%2==0)
					ans=ans+i+1;
			}
			System.out.println(ans);
		}
		else if(p==5)
		{
			long ans=0;
			for(int i=0;i<n;i++)
			{
				int x=s.charAt(i)-'0';
				if(x%5==0)
					ans=ans+i+1;
			}
			System.out.println(ans);
		}
		else {
		long[] store=new long[p];
		store[0]=(long)1;
		int x=1;
		int sum=0;
		long ans=0;
		for(int i=n-1;i>=0;i--)
		{
			sum=(sum+x*(s.charAt(i)-'0'))%p;
			ans=ans+store[sum];
			x=(x*10)%p;
			store[sum]++;
		}
		System.out.println(ans);}
	}
}


Measured memory_bytes: 36260
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
ll dp[3010][3010];
main(){
    int N,T;
    cin >> N >> T;
    vector<P> V(N);
    rep(i,0,N)cin >> V[i].first >> V[i].second;
    sort(V.begin(), V.end());
    ll ans = 0;
    rep(i,0,N){
        rep(j,0,T+1){       
            if(j-V[i].first >= 0){
                dp[i+1][j] = max(dp[i][j], dp[i][j-V[i].first] + V[i].second);
            }else{
                dp[i + 1][j] = dp[i][j];
            }
            
        }
        ans = max(ans, dp[i][T-1] + V[i].second);
    }
    ans = max(ans, dp[N][T]);
    cout << ans << endl;
}

Measured memory_bytes: 70784
import java.util.Scanner;

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

			int n = sc.nextInt();

			long result = 0;
			for (int i = 1; i < n; i++) {
				result += (n - 1) / i;

			}
			System.out.println(result);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

Measured memory_bytes: 35876
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int x,a,b;
	cin>>x>>a>>b;
	if(fabs(x-a)>fabs(b-x))
	cout<<"B"<<endl;
	else  
	 cout<<"A"<<endl;
	return 0;
}

Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''
    N, P = [int(item) for item in input().split()]
    As = [int(item)%2 for item in input().split()]

    is_all_even = True
    for item in As:
        if item == 1:
            is_all_even = False
    
    res = 0
    if is_all_even:
        if P == 0:
            res = 2 ** N
        else:
            res = 0
    else:
        res = 2**(N-1)
    
    print(res)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9100
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0 ; i<(n) ; ++i)
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;
const double PI=3.14159265358979323846;

int main(){
  int l;
  cin >> l;
  double a = l/3.0;
  double ans = a*a*a;
  cout << fixed << setprecision(15) << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main(void)
{   
    int diff = abs('A' - 'a');
    int n, k;
    cin >> n >>k;
    string s;
    cin >> s;
    s[k-1] = (char)(s[k-1] + diff);
    cout << s << endl; 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	}
  }	  

Measured memory_bytes: 49768
use std::io;
use std::str::FromStr;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (a, b) = input_tuple();
    if a > b {
        for _ in 0..a {
            print!("{}", b);
        }
    } else {
        for _ in 0..b {
            print!("{}", a);
        }
    }
    println!();
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    int n,W;
    scanf("%d%d", &n,&W);

    vector<int> v(n), w(n);
    int i;
    ll vsum=0;
    for(i=0; i<n; i++) {
        scanf("%d%d", &w[i], &v[i]);
        vsum+=v[i];
    }

    vector<ll> dp(vsum+1,LINF);
    dp[0]=0;
    long j;
    for(i=0; i<n; i++) {
        for(j=vsum; j>=0; j--) {
            if(j-v[i]>=0 && dp[j-v[i]]<LINF) dp[j] = MIN(dp[j], dp[j-v[i]]+w[i]);
        }
    }
    ll ans=0;
    for(j=0; j<=vsum; j++) {
        if(dp[j]<=W) ans=MAX(ans,j);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int a[] = new int[n];
		int count = 0;
		int precount = 0;

		for (int i = 0;i<n ;i++ ) {
			a[i] = sc.nextInt();
		}

		for (int i = 0;i<n ;i++ ) {
			if (a[i]%2==0) {
				precount++;
				if (a[i]%3==0||a[i]%5==0) {
					count++;
				}
			}
		}

		if (count==precount) {
			System.out.println("APPROVED");
		}else{
			System.out.println("DENIED");
		}

	}
}


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

int main(){
    int n; cin >> n;
    vector <int> w(n);
    vector <int> ans(n-1);

    for (int i=0;i<n;++i) cin >> w[i];
    for (int i=0;i<n-1;++i){
        for(int j=0;j<=i;++j) ans[i] += w[j];
        for(int k=i+1;k<n;++k) ans[i] -= w[k];
        if (ans[i]<0) ans[i] = -1 * ans[i];
    }
    sort(ans.begin(),ans.end());
    cout << ans[0] << endl;
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int c=0;

    for (int t=0;t<3;++t){
        if(s[t]=='1'){
            ++c;
        }
    }
    cout << c <<endl;
    return 0;
}


Measured memory_bytes: 256
#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() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int min=1;
  int max=pow(10,9);
  while (min != max){
    int t=(min+max)/2;
    int ans=0;
    rep(i,n){
      ans+=(a[i]-1)/t;
    }
    if (ans<=k){
      max=t;
    }else{
      min=t+1;
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 4040
#include <iostream>
#include <cstring>

#define reset(a, b) memset(a, b, sizeof(a))

using namespace std;

const int maxn = 501;
int n;
int a[maxn], color[maxn][maxn];

void dq(int l, int r, int cnt)
{
    if (l == r)
        return;
    int m = (l + r)/2;
    for (int i = l; i <= m; i++)
        for (int j = m+1; j <= r; j++)
            color[a[i]][a[j]] = color[a[j]][a[i]] = cnt;
    dq(l, m, cnt+1);
    dq(m+1, r, cnt+1);
}

int main()
{
    cin >> n;
    reset(a, 0);
    for (int i = 1; i <= n; i++)
        a[i] = i;
    reset(color, 0);
    dq(1, n, 1);
    for (int i = 1; i < n; i++)
    {
        for (int j = i+1; j <= n; j++)
            cout << color[i][j] << ' ';
        cout << '\n';
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,K; cin>>N>>K;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  sort(ALL(A));
  int ans=0;
  rep(i,0,N-K) ans+=A[i];
  cout<<ans<<endl;
  }


Measured memory_bytes: 1792
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum[200000], ans, dp[40000],a[200000],b[200000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<LL>vec;
vector<edge>ed;
vector<LL>v;
map<LL,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

map<LL,LL> zip;
int unzip[200000];

int compress(vector<LL> &x) {
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for (int i = 0; i < x.size(); i++) {
		zip[x[i]] = i;
		unzip[i] = x[i];
	}
	return x.size();
}

int main() {
	cin >> h >> w >> s >> t;
	if ((h - s) % 2 == (s - 1) % 2 && (w - t) % 2 == (t - 1) % 2 && (s - 1) % 2 != (t - 1) % 2) {
		cout << "No" << endl;
	}
	else
		cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 3172
n,c,k = map(int,input().split())
ab = []
for _ in range(n):
    t=int(input())
    ab.append(t)
ab.sort()

bus = 1
bustime = ab[0] + k
customer = 1

for i in range(1,n):
    if customer < c and ab[i] <= bustime:
        customer += 1
    else:
        bustime = ab[i]+k
        customer = 1
        bus += 1
print(bus)

Measured memory_bytes: 50264
n = int(input())
s = input()

acc_r, acc_g, acc_b = [], [], []
cr, cg, cb = 0, 0, 0
for i in s:
    if i == "R":
        cr += 1
    elif i == "G":
        cg += 1
    elif i == "B":
        cb += 1

    acc_r.append(cr)
    acc_g.append(cg)
    acc_b.append(cb)

count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        si = s[i]
        sj = s[j]
        if (si == "R" and sj == "G") or (si == "G" and sj == "R"):
            count += acc_b[-1] - acc_b[j]
            if j+(j-i) < n and s[j+(j-i)] == "B":
                count -= 1
        if (si == "G" and sj == "B") or (si == "B" and sj == "G"):
            count += acc_r[-1] - acc_r[j]
            if j+(j-i) < n and s[j+(j-i)] == "R":
                count -= 1
        if (si == "R" and sj == "B") or (si == "B" and sj == "R"):
            count += acc_g[-1] - acc_g[j]
            if j+(j-i) < n and s[j+(j-i)] == "G":
                count -= 1
                
print(count)


Measured memory_bytes: 69396
#include<bits/stdc++.h>
#define tcn cin.tie(0);
#define tct cout.tie(0);
#define r_0 return 0
#define ll long long
#define TIME ios_base::sync_with_stdio(0);
using namespace std;

const long long N = 1e3 + 7;
const long long MrBeast = 1e9;

ll T = 1, n, m, ans, cnt, a[N];
vector < ll > v, t;
int type = 0;
set< ll > st;
pair< ll ,ll > p[N];
int main()
{
    TIME
    cin >> n >> m >> ans;
    cout << ans << " " << n << ' ' << m;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }

    unordered_map<ll, ll> mp0, mp1;
    for (ll i = 0; i < N; i++) {
        if ((i & 1) == 0) {
            ++mp0[A[i]];
        }
        else {
            ++mp1[A[i]];
        }
    }

    vector<Pll> v0, v1;
    for (const auto& p : mp0) {
        v0.emplace_back(p.second, p.first);
    }
    for (const auto& p : mp1) {
        v1.emplace_back(p.second, p.first);
    }
    sort(v0.begin(), v0.end(), greater<Pll>());
    sort(v1.begin(), v1.end(), greater<Pll>());

    ll ans = L_INF;
    if (v0[0].second != v1[0].second) {
        ans = N - v0[0].first - v1[0].first;
    }
    else if (v0.size() >= 2 && v1.size() >= 2) {
        ans = N - max(v0[0].first + v1[1].first, v0[1].first + v1[0].first);
    }
    else if (v0.size() >= 2) {
        ans = N - max(v0[0].first, v0[1].first + v1[1].first);
    }
    else if (v1.size() >= 2) {
        ans = N - max(v0[0].first + v1[1].first, v1[0].first);
    }
    else {
        ans = N / 2;
    }

    cout << ans << endl;
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 7440
import java.util.Scanner;

class Main{
	public static void main(String[] arg){
	
		
		Scanner sc = new Scanner(System.in);
		String str; 
		int m,n;
		
                     while(true){
			
			 str=sc.next();
		
			if(str.equals("-")){
				break;
			}
			   m=sc.nextInt();
			for(int i=0;i<m;i++){
				n=sc.nextInt();
				str=str.substring(n)+str.substring(0,n);
			}
                        System.out.println(str);
		}
		
		
		
}}


Measured memory_bytes: 26172
#include <bits/stdc++.h>
using namespace std;
#define days 5000000000000000
int main(void){
    string s; cin>>s;
    unsigned long long k; cin>>k;
    int n=s.size();
    if(n==1) {cout<<s[0]<<endl; return 0;}
    for(int i=0;i<n;i++){
        if(i+1==k) {cout<<s[i]; return 0;}
        if(s[i]!='1') {cout<<s[i]; return 0;}
    }
   //unsigned long long start=1;
    //vector < tuple < int , unsigned long long ,unsigned long long>> data[100];
    /*vector <tuple < int , unsigned long long ,unsigned long long>> data;
    for(int i=0;i<n;i++){
        int a=s[i]-'0';
        unsigned long long end=powl(a,days)+start-1;
        //if(a==1) end-=1;
        //data[i]=make_tuple(s[i]-'0', start , end);
        data.push_back(make_tuple(a, start , end));
        start=end+1;
        cout<<get<0>(data[i])<<' '<<get<1>(data[i])<<' '<<get<2>(data[i])<<endl;
        if(k>=get<1>(data[i])&&k<=get<2>(data[i]) ){
        cout<<get<0>(data[i])<<endl;
        return 0;
        }
    }*/
    /*for(int i=0;i<n;i++){
        if(k>=get<1>(data[i])&&k<=get<2>(data[i]) ){
        cout<<get<0>(data[i])<<endl;
        return 0;
        }
    }*/
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<double,double> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  P d[1001];
  d[1].first=0,d[1].second=0;
  double r=0;
  for(int i=1; i<1001; i++) {
    d[i].first=d[i-1].first+cos(r);
    d[i].second=d[i-1].second+sin(r);
    r=atan2(-d[i].second,-d[i].first)-M_PI/2;
  }
  int n;
  while(cin >> n && n!=-1) {
    printf("%.2f\n",d[n].first);
    printf("%.2f\n",d[n].second);
  }			   
  return 0;
}


Measured memory_bytes: 1296