akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N;

struct edge{
    ll to,cost;
    edge(){}
    edge(ll a,ll b) : to(a),cost(b){}
};

using P = pair<ll,ll>;

int V;
vector<edge> G[100005];
ll d[100005];

void dij(int s){
    priority_queue<P,vector<P>,greater<P>> que;
    fill(d,d+V,LINF);

    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();

        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0;i<G[v].size();i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main(){
    cin >> N;
    V = N;
    rep(i,N-1){
        ll aa,bb,cc;
        cin >> aa >> bb >> cc;
        aa--;
        bb--;
        G[aa].pb(edge(bb,cc));
        G[bb].pb(edge(aa,cc));
    }

    ll Q,K;
    cin >> Q >> K;
    K--;
    dij(K);


    rep(i,Q){
        int x,y;
        cin >> x >> y;
        x--;
        y--;
        //cout << x << " " << y << endl;
        cout << d[x] + d[y] << endl;
    }
}


Measured memory_bytes: 11120
package main

import (
	"fmt"
	"io"
	"os"
)

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	run()
}

func run() {
	var N, Y int
	fmt.Fscan(reader, &N, &Y)

	for i := N; i >= 0; i-- {
		for j := N - i; j >= 0; j-- {
			total := 10000*i + 5000*j + 1000*(N-i-j)

			if total == Y {
				fmt.Fprintln(writer, i, j, (N - i - j))
				return
			}
		}
	}

	fmt.Fprintln(writer, -1, -1, -1)

}


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

int main(){
	int r, D, x;
	cin >> r >> D >> x;
	for(int i = 0; i < 10; i++){
 		x = r * x - D;
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
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
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;
            var T = cin.ReadInt;
            WriteLine(T / A * B);
        }
    }

    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: 11220
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        if (a < b) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}


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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define All(x) (x).begin(), (x).end()
#define mp make_pair
#define Task "abc"

typedef long long ll;
const int maxn = 2e5 + 10;
const ll mod = 1e9 + 7;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(NULL);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  const int maxa = 12 * int(1e5) + 1;
  int ans = 12 * int(1e5) + 1;
  int n, m, x; cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int> > a(n, vector<int> (m));
  for (int i = 0; i < n; ++i){
    cin >> c[i];
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  }

  for (int mask = 1; mask < (1 << n); ++mask){
    vector<int> t(m, 0);
    int ret = 0;
    for (int i = 0; i < n; ++i){
      #define bitk(i, k) ((i >> k) & 1)
      if (bitk(mask, i)){
        ret += c[i];
        for (int j = 0; j < m; ++j) t[j] += a[i][j];
      }
    }
    bool ok = true;
    for (int j = 0; j < m; ++j) if (t[j] < x) ok = false;
    if (ok) ans = min(ans, ret);
  }
  cout << (ans == maxa ? -1 : ans);
return 0;
}




Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int H,W;

void dfs(vector<string> &s, vector<vector<bool>> &seen, int h, int w){
  if(h+1 != H && s[h+1][w] == '#' && w+1 != W && s[h][w+1] == '#'){
    return;// 分岐があったらダメ
  }
  seen[h][w] = true;
  //printf("h:%d w:%d s[h+1][w]:%c\n",h, w, s[h+1][w] );

  if(h+1 != H && s[h+1][w] == '#'){
    dfs(s, seen, h+1, w);
  }
  if(w+1 != W && s[h][w+1] == '#'){
    dfs(s, seen, h, w+1);
  }
}

int main(){
  cin >> H >> W;
  vector<string> s(H);
  rep(h, H) cin >> s[h];

  vector<vector<bool>> seen(H,vector<bool>(W,false));

  dfs(s, seen, 0, 0);

  bool ok = true;
  if(!seen[H-1][W-1]) ok = false;
  rep(i, H) rep(j, W){
    if(!seen[i][j] && s[i][j] == '#') ok = false;
  }

  if(ok) std::cout << "Possible" << '\n';
  else std::cout << "Impossible" << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x['zzz'],p['zzz'],A,n,s,l=1,r;
int main(){cin>>n>>s;r=n;for(int i=1;i<=r;i++)cin>>x[i]>>p[i];while(l<=r){if(s<=x[l])cout<<A+x[r]-s,exit(0);if(s>=x[r])cout<<A+s-x[l],exit(0);A+=x[r]-x[l];if(p[l]>=p[r]) while(p[l]>=p[r]&&l<r) p[l]+=p[r--];else while(p[l]<p[r]&&l<r) p[r]+=p[l++];}}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    ll ans = 0;

    rep(i,n-1){
        ans += min(b,a*(x[i+1]-x[i]));
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
let () =
  Scanf.scanf "%d" @@ fun k ->
  let n = 50 in
  let d, r = k / n, k mod n in
  Printf.printf "%d\n" n;
  for i = 0 to n-1 do
    (if i < r then n+d else n+d-1-r) |> Printf.printf "%d "
  done;
  print_newline ()

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, K, Q;
  cin >> N >> K >> Q;
  vector<ll> plus(N, 0);
  rep(i,Q) {
    ll a;
    cin >> a;
    K--;
    plus[a-1]++;
  }
  rep(i,N){
    cout << (K + plus[i] > 0 ? "Yes" : "No") << endl;
  }
  return 0;
}


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

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int32_t main()
{
    fast;
    int a , b , c , d , ans = 0 ; 
    cin >> a >> b >> c >> d ; 
    rep(i,0,100) {
        if(i >= a && i >= c && i < b && i < d) ans++ ; 
    }
    cout << ans ; 
    return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split())
a = abs(x)
b = abs(y)
if a == b:
    print(1)
elif y == 0:
    if x > 0:
        print(x+1)
    else:
        print(a)
elif x >= 0 and y >= 0:
    if x < y:
        print(y-x)
    else:
        print(a-b+2)
elif x >= 0 or y >= 0:
    print(abs(a-b)+1)
else:
    if a > b:
        print(a-b)
    else:
        print(b-a+2)

Measured memory_bytes: 3064
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
A = sorted(A)
ans = 0
K = A[0]
cnt = 0
for i in range(N):
    if A[i] == K:
        cnt = (cnt + 1)%2
    else:
        K = A[i]
        ans += cnt
        cnt = 1
if A[N-1] == K:
    ans += cnt
print(ans)

Measured memory_bytes: 8280
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, M;

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

    cout << int((N * 3 + M) / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n,i,j,t;
	int data[4][13];
	char c;
	char gara[4]={'S','H','C','D'};
	scanf("%d",&n);
	
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			data[i][j]=0;
		}
	}
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf(" %c",&c);
		scanf("%d",&t);
		if(c=='S'){
			data[0][t-1]=1;
		}else if(c=='H'){
			data[1][t-1]=1;
		}else if(c=='C'){
			data[2][t-1]=1;
		}else if(c=='D'){
			data[3][t-1]=1;
		}
	}
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(data[i][j]==0){
				printf("%c %d\n",gara[i],j+1);
			}
		}
	}
	
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    for(auto c : s){
        if(c == 'A'){
            cout << 'T';
        }
        else if(c == 'T'){
            cout << 'A';
        }
        else if(c == 'C'){
            cout << 'G';
        }
        else {
            cout << 'C';
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  ll x, y;
  cin >> x >> y;
  
  ll ans = 0;
  
  if(x == 1) ans += 300000;
  if(x == 2) ans += 200000;
  if(x == 3) ans += 100000;
  if(y == 1) ans += 300000;
  if(y == 2) ans += 200000;
  if(y == 3) ans += 100000;
  if(x == 1 and y == 1) ans += 400000;
  
  
  cout << ans << "\n";

}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,c=map(int,input().split())
    if c-a-b>0 and (c-a-b)**2>4*a*b:
        print("Yes")
    else:print("No")

if __name__=='__main__':
    main()

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 1020000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 998244353;

ll n;

void dfs(string s, ll now){
	if(s.size()==n){
		cout << s << endl;
		return;
	}
	rep(i,now+1){
		char t = (char)(i + 'a');
		string nxt = s + t;
		if(i == now){
			dfs(nxt,now+1);
		}else{
			dfs(nxt,now);
		}
	}
}

int main(){
	cin >> n;
	dfs("",0);
}

Measured memory_bytes: 1536
def resolve():
    h, w = map(int, input().split())
    L = [list(input()) for i in range(h)]
    dx = [-1, 0, 1, -1, 1, -1, 0, 1]
    dy = [-1, -1, -1, 0, 0, 1, 1, 1]
    count = 0
    for i in range(h):
        for j in range(w):
            if L[i][j] == "#":
                pass
            else:
                count = 0
                for k in range(8):
                    m = i + dx[k]
                    n = j + dy[k]
                    if m < 0 or n < 0:
                        pass
                    elif m >= h or n >= w:
                        pass
                    else:
                        if L[m][n] == "#":
                            count += 1
                L[i][j] = count
    for i in range(len(L)):
        print(''.join(map(str, L[i])))

if __name__ == '__main__':
    resolve()

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

int  main()
{
	int a,b,c; cin >> a >> b >> c;
	if (a+b >= c)
		cout << "Yes\n";
	else
		cout << "No\n";
	return (0);
}




Measured memory_bytes: 256
# frozen_string_literal: true

n = gets.chomp
int = gets.chomp.split(' ').map(&:to_i)
@result = []

int.each do |i|
  flag = 0
  count = 0

  while flag.zero?
    flag = i % 2
    i /= 2

    next unless flag.zero?

    count += 1
  end

  @result << count
end

puts(@result.min)

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long int
#define INF 0x3f3f3f3f
#define pb push_back
#define se second
#define fi first
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n; cin>>n;
    int a[n],c1=0,c2=0,c4=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]&1) c1++;
        else{
            if(a[i]%4==0) c4++;
            else c2++;
        }
    }
    bool ans=false;
    if(!c2){
        if(c1<=c4+1) ans=true;
    }
    else{
        if(c1<=c4) ans=true;
    }
    if(ans) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define spln(i,n) (i==n?'\n':' ')
using namespace std;
int n,m,i,j;
string st;
char cA='A';
int main()
{
	scanf("%d%d",&n,&m);
	rdst(st,200005);st=" "+st;
	i=1;
	while(i<=n&&m)
	{
		m--;
		if(st[i]==cA) st[i]='A'+'B'-cA;
		else {i++;cA='A'+'B'-cA;}
	}
	if(i<=n){
		j=1;
		while(i<=n){
			putchar(st[i]==cA?'A':'B');
			i++;j++; 
		}
		while(j<=n){
			putchar((j&1)==(n&1)?'A':'B');
			j++;
		}
		puts("");
		return 0;
	}
	if(n&1){
		putchar((m&1)?'B':'A');
	}
	fz1(i,n/2){
		printf("BA");
	}
	puts("");
	return 0;
}

Measured memory_bytes: 828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int q; cin >> q;
  while(q > 0) {
    q--;
    int y, m, d; cin >> y >> m >> d;
    ll cnt = 0;
    if(y % 3 == 0 || m % 2) {
      cnt += 20 - d + 1;
    } else {
      cnt += 19 - d + 1;
    }
    if(m == 10) {
      y++;
      m = 1;
    } else {
      m++;
    }
    while(1) {
      if(y == 1000 && m == 1) break;
      if(y % 3 == 0 || m % 2) {
        cnt += 20;
      } else {
        cnt += 19;
      }
      if(m == 10) {
        y++;
        m = 1;
      } else {
        m++;
      }
    }
    cout << cnt << endl;
  }
}



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

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vi a(n);
    rep(i,q){
        int b;
        cin >> b;
        b--;
        a[b]++;
    }
    rep(i,n){
        if(q - a[i] < k){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

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

namespace AtTest.Aising_2020
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();

            int res = 0;
            for(int i = 0; i < n; i+=2)
            {
                if (array[i] % 2 == 1)
                {
                    res++;
                }
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27548
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
const int MOD = 1000000007;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



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

    int N;cin >> N;
    vector<long long> high(N);
    for(int i = 0;i<N;i++) cin >> high.at(i);
    long long ans = 0;
    long long now = 0;
    for(int i = 0;i<N;i++){
        if(now < high.at(i)){
            now = high.at(i);
        }
        else{
            ans += now-high.at(i);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4780
# ABC126 E 1 or 2

# UnionFindの使用
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    X, Y, Z = map(int, input().split())
    uf.union(X-1, Y-1)

ans = uf.group_count()
print(ans)


Measured memory_bytes: 69592
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i,N){
    cin >> v[i];
  }
  sort(ALLOF(v));
  reverse(ALLOF(v));

  int alice = 0, bob = 0;
  rep(i,N){
    if(i%2==0) alice += v[i];
    else bob += v[i];
  }

  cout << alice - bob << endl;
  
  return 0;
}

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

int main(){
  int n;
  int n_bill;

  cin >> n;
  
  if(n % 1000 != 0){
    n_bill = (n / 1000) + 1;
  }else{
    n_bill = n / 1000;
  }
  cout << n_bill * 1000 - n << endl;
  return 0;
}



Measured memory_bytes: 3640
#include <iostream>
using namespace std;
 
int main()
{
  long long H, W;
  cin >> H >> W;
 
  if(H==1 || W==1)
  {
    cout << "1" << endl;
    return 0;
  }

  cout << (H*W+1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3612
use std::cmp::*;

fn main() {
    proconio::input! {
    a:isize,
    b:isize,
    c:isize,
    }
    let m=(max(a,max(b,c)))*3-a-b-c;
    println!("{}",if m%2==0 {m/2}else{m/2+2})
}

Measured memory_bytes: 2100
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        int cnt = 0;

        if(a.charAt(0)==b.charAt(0)){
            cnt++;
        }
        if(a.charAt(1)==b.charAt(1)){
            cnt++;
        }
        if(a.charAt(2)==b.charAt(2)){
            cnt++;
        }
        
        System.out.println(cnt);


    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <stdlib.h>
#include <limits.h>

using namespace std;

#define ull unsigned long long

ull calc(int i, int k, int* arr, ull* ans) {
    if (i-k < 0) 
        return ULONG_MAX;
    else 
        return ans[i-k] + abs(arr[i] - arr[i-k]);
}

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    int arr[N];
    for (int i=0; i<N; i++) {
        scanf("%d", arr+i);
    }

    unsigned long long* ans = (unsigned long long*) calloc(N, sizeof(unsigned long long));
    ans[0] = 0;
    ans[1] = abs(arr[0] - arr[1]);

    for (int i=2; i<N; i++) {
        ans[i] = -1;
        for (int k=1; k<=K; k++) {
            ans[i] = min(ans[i], calc(i,k,arr, ans));
        }
    }

    cout << ans[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
int main(void){
  int n,k;
  int ans=0;
  int A[100000];
  
  scanf("%d %d",&n,&k); 
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  
  ans = 1 + (n-k)/(k-1);
  if((n-k)%(k-1))ans++;
  
  printf("%d\n",ans);
  
  return(0);
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],inv[2][2],a[2],det;
  while(cin >>m[0][0]>>m[0][1]>>a[0]>>m[1][0]>>m[1][1]>>a[1]){
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    printf("%.3lf %.3lf\n",a[0]*inv[0][0]+a[1]*inv[0][1],a[0]*inv[1][0]+a[1]*inv[1][1]);
  }
  return 0;
}

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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

int main() {
  int r;
  cin >> r;
  cout << r * r << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

S=[]
S.append(0)
for i in range(N):
    S.append(S[i]+A[i])

x=dict()
for i in range(len(S)):
    s=S[i]
    if s in x:
        x[s]+=1
    else:
        x[s]=1
ans=0
#print(S)
#print(x)
for idx in x:
    ans+=((x[idx]-1)*(x[idx]))//2
print(ans)

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

int main() {
  string s; cin >> s;
  int size = s.size();
  REP(i,size) {
    s.pop_back();
    if (s.size()%2==1) continue;
    bool ok = true;
    REP(i,s.size()/2) {
      if (s[i] != s[s.size()/2+i]) { ok=false; break; }
    }
    if (ok) { cout << s.size() << endl; return 0; }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n,ans=0;
    cin >> n;
    vector<int> vec(n);
    rep(i,n-1){
        cin >> vec.at(i);
        if(i)ans+=min(vec.at(i),vec.at(i-1));
        else ans+=vec.at(i);
    }
    ans+=vec.at(n-2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int d[5], min = 10, cost=0;
    for(int i=0; i<5; i++)
    {
        std::cin >> d[i];
        if(d[i]%10 == 0)
        {
            cost+=d[i];
            continue;
        }
        else if(d[i]%10<min)
        {
            min = d[i]%10;
        }
        cost += d[i] + 10-(d[i]%10);
    }
    std::cout << cost - 10 + min << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,ans=0,sum=0;
	cin>>n>>m;
	vl v(n);
	rep(i,n){
		cin>>v[i];
		sum+=v[i];
	}
	rep(i,n){
		if((double)v[i]*(4.0*m)>=(sum))ans++;
	}
	Yn(m<=ans);
}


Measured memory_bytes: 3548
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.length();i++){
        s[i]=(s[i]+n-'A')%26+'A';
    }
    cout<<s<<endl;
    return 0;
}

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

int main() {
    string s;
    int n;
    cin >> n >> s;
    char color = s.front();
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == color) {
            --n;
        } else {
            color = s[i];
        }
    }

    cout << n << endl;
}

Measured memory_bytes: 512
MOD = 10**9 + 7
L = input()[1:]

ans = [2, 1]
for l in L:
  ans[1] *= 3
  ans[1] %= MOD
  if l == '1':
    ans[1] += ans[0]
    ans[0] *= 2
    ans[0] %= MOD

print(sum(ans) % MOD)

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

int main()
{
    int a, b;
    int path[4 + 1] = {};
    for (int i = 0; i < 3; i++)
    {
        cin >> a >> b;
        path[a]++;
        path[b]++;
    }
    int one = 0;
    int two = 0;
    for (int i = 1; i <= 4; i++)
    {
        if (path[i] == 1)
        {
            one++;
        }
        if (path[i] == 2)
        {
            two++;
        }
    }
    if (one == 2 && two == 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


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

int main(){
    int x;
    cin >> x;
    if(x >= 400 && x <= 599) cout << 8 << endl;
    else if(x >= 600 && x <= 799) cout << 7 << endl;
    else if(x >= 800 && x <= 999) cout << 6 << endl;
    else if(x >= 1000 && x <= 1199) cout << 5 << endl;
    else if(x >= 1200 && x <= 1399) cout << 4 << endl;
    else if(x >= 1400 && x <= 1599) cout << 3 << endl;
    else if(x >= 1600 && x <= 1799) cout << 2 << endl;
    else  cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	int x = tx - sx;
	int y = ty - sy;

	rep(i, x) cout << "R";
	rep(i, y) cout << "U";
	rep(i, x) cout << "L";
	rep(i, y) cout << "D";

	cout << "D";
	rep(i, x + 1) cout << "R";
	rep(i, y + 1) cout << "U";
	cout << "L";
	cout << "U";
	rep(i, x + 1) cout << "L";
	rep(i, y + 1) cout << "D";
	cout << "R";

	co("");

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    ll A, B;
    cin >> A >> B;
    cout << (A+B) % 24<< endl;
    return 0;
}


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

int main(void) {
	int n1[100000],n2[100000],ans,N,N1=0,N2=0;
	cin >> N;
	ans = N;
	for (int i = 0;i < N;i++) {
		if (i % 2 == 1) {
			cin >> n1[i/2];
		}
		else {
			cin >> n2[i/2];
		}
	}
	sort(n1, n1 + N/2);
	sort(n2, n2 + N/2);
/**/
	int num1, ans1, ans2;
	int r=0, m = 1;
	for (int i = 0;i < N / 2;i++) {
		if (i == N / 2) {
			if (r < m) {
				num1 = n1[i];
				r = m;
			}
		}
		else if (n1[i] == n1[i + 1]) {
			m++;
		}
		else if (n1[i] != n1[i + 1] ) {
			if (r < m) {
				r = m;
				num1 = n1[i];
			}
			m = 1;
		}
	}

	ans1 = N / 2 - r;
	r = 0, m = 1;
	for (int i = 0;i < N / 2;i++) {
		if (n1[i] != num1) {
			if (i == N / 2) {
				if (r < m) {
					r = m;
				}
			}
			else if (n1[i] == n1[i + 1]) {
				m++;
			}
			else if (n1[i] != n1[i + 1]) {
				if (r < m) {
					r = m;
				}
				m = 1;
			}
		}
	}
	ans2 = N / 2 - r;

	/**/
	int num2, ans3, ans4;
	r = 0, m = 1;
	for (int i = 0;i < N / 2;i++) {
		if (i == N / 2) {
			if (r < m) {
				num2 = n2[i];
				r = m;
			}
		}
		else if (n2[i] == n2[i + 1]) {
			m++;
		}
		else if (n2[i] != n2[i + 1]) {
			if (r < m) {
				r = m;
				num2 = n2[i];
			}
			m = 1;
		}
	}
	ans3 = N / 2 - r;
	r = 0, m = 1;
	for (int i = 0;i < N / 2;i++) {
		if (n2[i] != num2) {
			if (i == N / 2) {
				if (r < m) {
					r = m;
				}
			}
			else if (n2[i] == n2[i + 1]) {
				m++;
			}
			else if (n2[i] != n2[i + 1]) {
				if (r < m) {
					r = m;
				}
				m = 1;
			}
		}
	}
	ans4 = N / 2 - r ;
	if (num1 != num2)
		cout <<ans1 + ans3<<endl;
	else
		cout << min(ans1 + ans4,ans2+ans3) << endl;

	return 0;

}


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


using namespace std;

int main()
{
    int N;

    cin>>N;

    bool jelTacno = false;

    if (N%10==7)
    {
        jelTacno=true;
    }
    else if(N/10%10==7)
    {
        jelTacno=true;
    }
    else if(N/100==7)
    {
        jelTacno=true;
    }

    if(jelTacno==true)
    {
        cout<<"Yes"<<endl;
    }

    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <math.h>

int rel_c_c( double, double, double, double, double, double );

int main( void ) {
	int n;
	double xa, ya, ra, xb, yb, rb;

	for ( scanf( "%d", &n ); n--; printf( "%d\n", rel_c_c( xa, ya, ra, xb, yb, rb ) ) )
		scanf( "%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb );

	return 0;
}

int rel_c_c( double x1, double y1, double r1, double x2, double y2, double r2 ) {
	int sign;
	double R, r, d = sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );

	if ( d > r1 + r2 )
		return 0;

	if ( r1 >= r2 ) {
		sign = 1;
		R = r1;
		r = r2;
	} else {
		sign = -1;
		R = r2;
		r = r1;
	}
	if ( R - r <= d && d <= R + r )
		return 1;
	if ( d < R - r )
		return sign * 2;
}

// int rel_c_c( double x1, double y1, double r1, double x2, double y2, double r2 ) {
// 	int sign;
// 	double R, r, d = sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );

// 	if ( d == 0 && r1 == r2 )
// 		return 0;
// 	if ( d > r1 + r2 )
// 		return 1;
// 	if ( d == r1 + r2 )
// 		return 2;

// 	if ( r1 >= r2 ) {
// 		sign = 1;
// 		R = r1;
// 		r = r2;
// 	} else {
// 		sign = -1;
// 		R = r2;
// 		r = r1;
// 	}
// 	if ( R - r < d && d < R + r )
// 		return 3;
// 	if ( d == R - r )
// 		return sign * 4;
// 	if ( d < R - r )
// 		return sign * 5;
// }

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


int main() {

	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0;i < n;i++) {
		cin >> a.at(i);
	}

	int64_t sum = a.at(0);
	int64_t count_eve = 0;
	int64_t count_odd = 0;

	if (a.at(0) <= 0) {
		count_eve += -sum + 1;
		sum = 1;
	}
	for (int i = 0;i < n - 1;i++) {
		if (i % 2 == 0) {
			if (sum + a.at(i + 1) < 0) {
				sum += a.at(i + 1);
			}
			else {
				count_eve += sum + a.at(i + 1) + 1;
				sum = -1;
			}
		}
		else {
			if (sum + a.at(i + 1) > 0) {
				sum += a.at(i + 1);
			}
			else {
				count_eve += -sum - a.at(i + 1) + 1;
				sum = 1;
			}
		}
	}
	
	sum = a.at(0);
	if (a.at(0) >= 0) {
		count_odd += sum + 1;
		sum = -1;
	}
	for (int i = 0;i < n - 1;i++) {
		if (i % 2 == 0) {
			if (sum + a.at(i + 1) > 0) {
				sum += a.at(i + 1);
			}
			else {
				count_odd += -sum - a.at(i + 1) + 1;
				sum = 1;
			}
		}
		else {
			if (sum + a.at(i + 1) < 0) {
				sum += a.at(i + 1);
			}
			else {
				count_odd += sum + a.at(i + 1) + 1;
				sum = -1;
			}
		}
	}
	cout << min(count_eve,count_odd);

}

Measured memory_bytes: 640
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        x: i64,
    }

    let mut yokin: i64 = 100;
    let mut year = 0;
    loop{
        year += 1;
        let rishi = yokin / 100;
        yokin += rishi;

        if yokin >= x { break;}
    }
    println!("{}", year);
}


Measured memory_bytes: 2172
N, X = map(int, input().split())
q = [1]*(N+1)
p = [1]*(N+1)
for i in range(1, N+1):
    q[i] = 2*q[i-1]+3
    p[i] = 2*p[i-1]+1

ans = 0
def search(x, n):
    global ans
    if n==0:
        if x:
            ans += 1
        return
    if x==0:
        return
    
    a = q[n-1] + 2
    b = p[n-1] + 1

    if x > a:
        ans += b
        search(x-a, n-1)
    elif x == a:
        ans += b
    else:
        search(x-1, n-1)

search(X, N)
print(ans)

Measured memory_bytes: 3064
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  ll a[n], x = 0, y = 0, min = 1000000000000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    x += a[i];
  }
  for (int i = n - 1; i >= 1; i--) {
    x -= a[i];
    y += a[i];
    if (abs(x - y) < min) min = abs(x - y);
  }
  cout << min << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
}



Measured memory_bytes: 3632
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)
n,m=map(int,input().split())
p=list(map(int,input().split()))
uf=UnionFind(n)
for i in range(m):
  x,y=map(int,input().split())
  uf.union(p[x-1]-1,p[y-1]-1)
ans=0
for i in range(n):
  if uf.same(i,p[i]-1):
    ans+=1
print(ans)

Measured memory_bytes: 14452
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int mod = 1000000007;
signed main() {
	int n, k; cin >> n >> k;
	int a = n - k + 1, b = 1;
	for (int i = 1; i <= k; i++) {
		cout << (a * b) % mod << endl;
		//f(i+1)
		a *= n - k + 1 - i; while (a % (i + 1) != 0)a += mod; a /= i + 1;
		b *= k - i; while (b % i != 0)b += mod; b /= i;
		a %= mod; b %= mod;
	}
}

Measured memory_bytes: 256
def main():
  n, k = [int(e) for e in input().split()]
  h = [int(e) for e in input().split()]
  cost = [0] * n
  for i in range(1, n):
    cost[i] = min(abs(h[i] - h[j]) + cost[j] for j in range(max(0, i - k), i))
  print(cost[n - 1])
main()

Measured memory_bytes: 13852
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	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;
	}
}

// 二項係数計算
long long 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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long 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;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	long long int k;
	cin >> k;
	long long int number = 7;
	if (k % 2 == 0 || k % 5 == 0) {
		cout << -1;
		return 0;
	}
	for (int i = 1; i <= 10000000; i++) {
		if (number % k == 0) {
			cout << i;
			return 0;
		}
		number = number % k;
		number = number * 10 + 7;
	}
}


Measured memory_bytes: 3548