akhauriyash/Code-Regression huggingface dataset:
def isant_left(l, r):
    return l == 'R' and r == 'L'

S = input()
N = len(S)
ans = [0]*N
S += 'D'
start_r, prev_ant_left = -1, -1
for i in range(N):
    if not isant_left(S[i], S[i+1]):
        if S[i] == 'L':
            if not isant_left(S[i-1], S[i]):
                if (i - prev_ant_left)%2 == 0:
                    ans[prev_ant_left] += 1
                else:
                    ans[prev_ant_left+1] += 1
            else:
                ans[i] += 1

        if S[i] == 'R' and start_r == -1:
            start_r = i
        elif S[i] == 'R' and start_r != -1:
            continue

    else:
        ans[i] += 1
        prev_ant_left = i
        if start_r != -1:
            for j in range(start_r, i):
                if (i - j)%2 == 0:
                    ans[i] += 1
                else:
                    ans[i+1] +=1
            else:
                start_r = -1

print(*ans)


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

int tax(float x, float k) {
    return int(k * (100.0 + x) / 100.0);
}

int main(void){
    while (1) {
        float x, y, s;
        cin >> x >> y >> s;
        
        if (x == 0 && y == 0 && s == 0) return 0;
        
        int mx = 0;
        for (float i = 1.0; i <= s; i += 1.0) {
            for (float j = 1.0; j <= s; j += 1.0) {
                if (tax(x, i) + tax(x, j) == s) {
                    mx = max(mx, tax(y, i) + tax(y, j));
                }
            }
        }
        
        cout << mx << endl;
    }
}



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

#define repi(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(v) begin(v), end(v)

using ll = long long;

const int kMod = 1000 * 1000 * 1000 + 7;

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

  int N;
  cin >> N;

  vector<int> dp(N + 1);
  for (int i = 3; i <= N; ++i) {
    dp[i] = 1;
    for (int j = 3; j <= i; ++j) {
      dp[i] = (dp[i] + dp[i - j]) % kMod;
    }
  }

  cout << dp[N] << '\n';

  return 0;
}


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


int main (){
    ll A, B;
    cin>>A>>B;
    ll AA=A;
    ll BB=B;
    ll C=1;
    ll D=1;

    while(true){
        C=A/B;
        D=A%B;
        if(D==0)break;
        A=B;
        B=D;
    }
    cout<<AA*BB/B;
}





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

int main() {
	int N;
	cin>>N;
	int arr[N];
	for (int i=0; i<N; i++){
		cin>>arr[i];//{02244}{11335577}
	}
	sort(arr, arr+N);
	bool mis=0;
	if (N%2==0){;
		for (int i=0; i<N-1; i+=2){
			if (arr[i]!=arr[i+1]){
				mis=1;
			}	
		}
		if (mis==0){
			long long n=1;
			for (int i=0; i<N/2; i++){
				n=(n*2);
				n=n%1000000007;
			}
			cout << n << endl;
		}
		else{
			cout << 0 << endl;
		}
	}
	else{
		for (int i=1; i<N-2; i+=2){
			if (arr[i]!=arr[i+1]){
				mis=1;
			}	
		}
		if (mis==0){
			long long n=1;
			for (int i=0; i<N/2; i++){
				n=(n*2);
				n=n%1000000007;
			}
			cout << n << endl;
		}
		else{
			cout << 0 << endl;
		}
		
	}
}

Measured memory_bytes: 640
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A,B,C,D = input_number_list()
    isNg = True
    while True:
        C-=B
        if C<=0:
            isNg = False
            break
        A-=D
        if A<=0:
            break
    print('YNeos'[isNg::2])


if __name__ == '__main__':
    main()


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

struct P{
  int ay,ax,by,bx,cy,cx,cost;
  P(int a1,int a2,int b1,int b2,int c1,int c2,int c){
    ax=a1;ay=a2;
    bx=b1;by=b2;
    cx=c1;cy=c2;
    cost=c;
  }
};

int h,w,n,gx[3],gy[3],sx[3],sy[3];
string s[14],iranai;
bool used[14][14][14][14][14][14];
int dx[]={1,0,-1,0,0};
int dy[]={0,1,0,-1,0};

int BFS(){
  memset(used,0,sizeof(used));
  queue<P>q;
  q.push(P(sx[0],sy[0],sx[1],sy[1],sx[2],sy[2],0));
  used[sy[0]][sx[0]][sy[1]][sx[1]][sy[2]][sx[2]]=1;
  while(!q.empty()){
    P p=q.front();q.pop();
    int ay=p.ay;
    int ax=p.ax;
    int by=p.by;
    int bx=p.bx;
    int cy=p.cy;
    int cx=p.cx;
    int cost=p.cost;
    if(ay==gy[0]&&ax==gx[0]&&by==gy[1]&&bx==gx[1]&&cy==gy[2]&&cx==gx[2])return cost;
    for(int i=0;i<5;i++){
      int Ay=ay+dy[i];
      int Ax=ax+dx[i];
      if(Ay<0||Ax<0||Ay>=h||Ax>=w)continue;
      if(s[Ay][Ax]=='#')continue;
      if(n>=2){

        for(int j=0;j<5;j++){
          int By=by+dy[j];
          int Bx=bx+dx[j];
          if(By<0||Bx<0||By>=h||Bx>=w)continue;
          if(s[By][Bx]=='#')continue;
          if(n>=3){

            for(int j=0;j<5;j++){
              int Cy=cy+dy[j];
              int Cx=cx+dx[j];
              if(Cy<0||Cx<0||Cy>=h||Cx>=w)continue;
              if(s[Cy][Cx]=='#')continue;
              if(Ax==bx&&Ay==by&&Bx==ax&&By==ay)continue;
              if(Cx==bx&&Cy==by&&Bx==cx&&By==cy)continue;
              if(Ax==cx&&Ay==cy&&Cx==ax&&Cy==ay)continue;
              if(Ax==Bx&&Ay==By)continue;
              if(Ax==Cx&&Ay==Cy)continue;
              if(Cx==Bx&&Cy==By)continue;
              if(!used[Ay][Ax][By][Bx][Cy][Cx]){
                used[Ay][Ax][By][Bx][Cy][Cx]=1;
                q.push(P(Ax,Ay,Bx,By,Cx,Cy,cost+1));
              }
            }

          }
          else{
            if(Ax==bx&&Ay==by&&Bx==ax&&By==ay)continue;
            if(Ax==Bx&&Ay==By)continue;
            if(!used[Ay][Ax][By][Bx][cy][cx]){
              used[Ay][Ax][By][Bx][cy][cx]=1;
              q.push(P(Ax,Ay,Bx,By,cx,cy,cost+1));
            }
          }
        }

      }
      else{
        if(!used[Ay][Ax][by][bx][cy][cx]){
          used[Ay][Ax][by][bx][cy][cx]=1;
          q.push(P(Ax,Ay,bx,by,cx,cy,cost+1));
        }
      }
    }
  }
  return -1;
}

int main(){
  while(cin>>w>>h>>n,n){
    memset(sy,0,sizeof(sy));
    memset(sx,0,sizeof(sx));
    memset(gx,0,sizeof(gx));
    memset(gy,0,sizeof(gy));
    getline(cin,s[0]);
    getline(cin,s[0]);
    r(i,h-2)getline(cin,s[i]);
    getline(cin,iranai);
    h-=2;w-=2;
    r(i,h)s[i].erase(s[i].begin(),s[i].begin()+1);
    r(i,h)s[i].erase(s[i].begin()+w);
    r(i,h)r(j,w){
      if(s[i][j]=='a')sy[0]=i,sx[0]=j;
      if(s[i][j]=='b')sy[1]=i,sx[1]=j;
      if(s[i][j]=='c')sy[2]=i,sx[2]=j;
      if(s[i][j]=='A')gy[0]=i,gx[0]=j;
      if(s[i][j]=='B')gy[1]=i,gx[1]=j;
      if(s[i][j]=='C')gy[2]=i,gx[2]=j;
    }
    cout<<BFS()<<endl;
  }
}


Measured memory_bytes: 17100
let () =
  let n = read_int () in
  let minv = ref (read_int ()) in
  let maxv = ref min_int in
  for i = 1 to n - 1 do
    let j = read_int () in
    maxv := max !maxv (j - !minv);
    minv := min !minv j
  done;
  print_int !maxv; print_newline ()

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

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

		var weathers = new ArrayList<String>();
		weathers.add("Sunny");
		weathers.add("Cloudy");
		weathers.add("Rainy");

		int index = weathers.indexOf(s);
		System.out.println(weathers.get((index + 1) % 3));
	}
}


Measured memory_bytes: 35480
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;

#define EPS (1e-10)
#define equals (fabs((a)-(b)<EPS)
int n;

struct Point
{
    double x, y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator +(Point a)
    {
        return Point(x+a.x,y+a.y);
    }
    Point operator -(Point a)
    {
        return Point(x-a.x,y-a.y);
    }
    Point operator *(double a)
    {
        return Point(x*a,y*a);
    }

    double norm()
    {
        return x*x+y*y;
    }
};
Point p1,p2,p;
double cross(Point a,Point b)
{
    return a.x*b.y-b.x*a.y;
}
double dot(Point a,Point b)
{
    return a.x*b.x+a.y*b.y;
}
void solve()
{
    Point a=p2-p1;
    Point b=p-p1;
    double r=dot(a,b)/a.norm();
    Point q=p1+a*r;
    Point s=p+(q-p)*2;
    printf("%.8lf %.8lf\n",s.x,s.y);
}

int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
    scanf("%d",&n);
    while(n--)
    {
        scanf("%lf%lf",&p.x,&p.y);
        solve();
    }
    return 0;
}

Measured memory_bytes: 3244
n = int(input())
if n == 1:
    print(0)
    exit()
F = {}
tmp = n
i = 2
while i**2 <= tmp:
    cnt = 0
    while tmp % i == 0:
        cnt += 1
        tmp //= i
    if cnt > 0:
        F[i] = cnt
    i += 1
if tmp != 1 or F == {}:
    F[tmp] = 1
ans = 0
for p in F:
    a = 1
    while F[p] >= a:
        F[p] -= a
        ans += 1
        a += 1
print(ans)


Measured memory_bytes: 9140
S=list(input())
T=list(input())



def A(S):
    ok=-1
    for i in range(len(S)):
        if len(T)+i>len(S):
            if ok==-1: return 1000
            else: return ok
        if check(i):
            ok=i
    if not ok==-1:
        return ok
    return 1000

def check(i):
    j=i
    for A in T:
        if not(A==S[j] or S[j]=='?'):
            return False
        else: j+=1
    return True


i=A(S)

if i==1000:
    print('UNRESTORABLE')
    
else:
    for j in range (len(T)):
        S[i+j]=T[j]
    for k in range(len(S)):
        if S[k]=='?':
            S[k]='a'
    print(''.join(S))
        
            
           

Measured memory_bytes: 3064
import numpy as np
n,m,c = map(int, input().split())
b = np.array(list(map(int,input().split())))
a = np.array([list(map(int, input().split())) for i in range(n)])
cnt = 0
for i in range(n):
  if sum(a[i]*b)+c>0:
    cnt+=1
print(cnt)

Measured memory_bytes: 12424
import itertools
import math

number = []
for i in range(5):
    number.append(float(int(input())/10))

result = []

for j in itertools.permutations(number,5):
    time = 0.0
    for i,k in enumerate(j):
        if i < 4:
            time = math.ceil(time + k)
        else:
            time += k
    result.append(time)
    
print(int(min(result)*10))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    string s;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            int left=0,right=0,stage=0;
            int count=0;
            for (int i=0;i<n;i++) {
                cin>>s;
                if (s=="lu") {
                    left=1;
                } else if (s=="ru") {
                    right=1;
                } else if (s=="ld") {
                    left=0;
                } else if (s=="rd") {
                    right=0;
                }
                if (stage==0&&(left==1&&right==1)) {
                    count++;
                    stage=1;
                } else if (stage==1&&(left==0&&right==0)) {
                    count++;
                    stage=0;
                }
            }
            cout<<count<<endl;
        }
    }
}



Measured memory_bytes: 3124
while true
    n, k = gets.chomp.split.map(&:to_i)
    break if [n, k] == [0, 0]
    s = gets.chomp.split.map(&:to_i)
    result = true
    n.times{
        gets.chomp.split.map(&:to_i).each_with_index{|x, i|
            s[i] -= x
            result = false if s[i] < 0
        }
    }
    puts result ? "Yes" : "No"
end


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

const string YES = "Yes";
const string NO = "No";

int solve(long long A, long long B, long long C, long long K)
{

    for (long long i = 0; i <= K; i++)
    {
        long long AA, BB, CC;
        AA = A;
        AA *= pow(2, i);

        for (long long j = 0; j <= K - i; j++)
        {
            BB = B;
            BB *= pow(2, j);
            for (long long k = 0; k <= K - i - j; k++)
            {
                CC = C;
                CC *= pow(2, k);
                if (CC > BB && BB > AA)
                {
                    cout << "Yes" << endl;
                    return 0;
                }
                //cout << i << " " << j << " " << k << endl;
                //cout << AA << " " << BB << " " << CC << endl;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long K;
    scanf("%lld", &K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 4164
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();main.solve(args);
    }

    int D;
    int G;
    int[] p;
    int[] c;
    int minCount = Integer.MAX_VALUE;
    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        D = scanner.nextInt();
        G = scanner.nextInt();
        p = new int[D];
        c = new int[D];
        for (int i = 0; i < D; i++) {
            p[i] = scanner.nextInt();
            c[i] = scanner.nextInt();
        }

        int ans = 10000000;
        for (int i = 0; i < (1 << D); i++) {
            int count = 0;
            long score = 0;
            for (int j = 0; j < D; j++) {
                if (((i >> j) & 1) == 1) {
                    score += c[j];
                    score += p[j] * (j+1) * 100;
                    count += p[j];
                }
            }
            if (score < G) {
                for (int j = D -1; j >= 0; j--) {
                    if (((i >> j) & 1) == 0) {
                        for (int k = 1; k < p[j]; k++) {
                            score += (j+1) * 100;
                            count++;
                            if (score >= G) {
                                ans = Math.min(ans, count);
                            }
                        }
                    }
                }
            } else {
                ans = Math.min(ans, count);
            }
        }
        System.out.println(ans);
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}



Measured memory_bytes: 23124
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

template <class T = usize> class rep {
	const T f, l;

public:
	class itr {
		friend rep;
		T i;
		constexpr itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		constexpr T operator*() const noexcept { return i; }
		constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	constexpr rep(const T first, const T last) noexcept : f(first), l(last) {}
	constexpr itr begin() const noexcept { return itr(f); }
	constexpr itr end() const noexcept { return itr(l); }
};
template <class T = usize> class revrep {
	const T f, l;

public:
	class itr {
		friend revrep;
		T i;
		constexpr itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		constexpr T operator*() const noexcept { return i; }
		constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	constexpr revrep(const T first, const T last) noexcept : f(first), l(last) {}
	constexpr itr begin() const noexcept { return itr(l - 1); }
	constexpr itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool amax(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool amin(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool asmax(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool asmin(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }
template <class T> constexpr T difference(const T &a, const T &b) {
	return a <= b ? b - a : a - b;
}

#include <algorithm>
#include <iostream>
#include <utility>

int main() {
	u64 a, b;
	std::cin >> a >> b;
	u64 ans = 0;
	if (b - a < 100) {
		for (const auto i : rep<u64>(a, b + 1)) {
			ans ^= i;
		}
	}
	else {
		while (a % 4 != 0) {
			ans ^= a;
			++a;
		}
		while (b % 4 != 3) {
			ans ^= b;
			--b;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
/*#include<bits/stdc++.h>
#define int long long int
#define boost ios_base::sync_with_stdio(false)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 998244353
using namespace std;
signed main()
{
  int n; cin>>n;
  cout<<n<<endl;
  long double dp[n+1][n+1]={0},ans=0.0;
  long double p[n+1]={0};
  repp(i,1,n)cin>>p[i];
  repp(i,1,n)cout<<p[i]<<" ";
  cout<<endl;
  dp[0][0]=1.0;
  //dp[0][1]=1-p[1];
  //dp[1][1]=p[1];
  /*repp(i,1,n)
  {
      dp[i][0]=dp[i-1][0]*(1-p[i]);
  }
 
  repp(i,1,n)
  {
    repp(j,0,n)
    {
      if(!j)(dp[i][j]=dp[i-1][j]*(1-p[i]));
      else
      dp[i][j]=((dp[i-1][j-1]*p[i])+dp[i-1][j]*(1.0-p[i]));
    }
  }
  repp(i,1,n)cout<<dp[i][0]<<" ";
  cout<<endl;
  cout<<ans<<endl;
  cout<<dp[n][n]<<endl;
  cout<<setprecision(11)<<ans;
}*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define vs (v.begin(),v.end())
#define MOD 1000000007
 
int main()
{  
  
  ll n;
  cin>>n;
  ld x[n+1]={0};
  for(ll i=1;i<=n;i++)
    cin>>x[i];
  ld dp[n+1][n+1];
  for(ll i=0;i<=n;i++)
    for(ll j=0;j<=n;j++)
      dp[i][j]=0;
     dp[0][0]=1;
  for(ll i=1;i<=n;i++)
  {
    for(ll j=0;j<=n;j++)
    { 
      if(j==0)
      {
         dp[i][j]=dp[i-1][j]*(1-x[i]);
      }
      else
      dp[i][j]=dp[i-1][j]*(1-x[i])+dp[i-1][j-1]*x[i];
    }
  }
  ld ans=0.0;
  for(ll j=(n+1)/2;j<=n;j++)
    ans+=dp[n][j];
  cout<<setprecision(10)<<ans<<endl;
}

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

int main() {
  ll a,c; 
  double b;
  cin >>a >>b;
  c = b*100+0.5;
  ll ans = a*c/100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3712
<?php
# 入力
fscanf(STDIN, '%d', $n);
$p = array_map('intval', explode(' ', trim(fgets(STDIN))));
$p_sort = $p;
sort($p_sort);
$cnt_diff = 0;
foreach ($p as $i => $v) {
    if ($v != $p_sort[$i]) {
        $cnt_diff++;
    }
}
if ($cnt_diff <= 2) {
    echo 'YES'.PHP_EOL;
} else {
    echo 'NO'.PHP_EOL;
}
?>

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B;
    cin >> A >> B;
    ll cnt = 0;
    ll now = 1;
    while(now < B){
        now--;
        now += A;
        cnt++;
    }
    cout << cnt << endl;
}

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

int main(){
  int N;
  cin >> N;
  int A[N],B[N],C[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  for(int i = 0; i < N; i++){
    cin >> B[i];
  }
  for(int i = 0; i < N; i++){
    cin >> C[i];
  }
  int sum = 0;
  int x = -2;
  for(int i = 0; i < N; i++){
    if(x == A[i]-1){
      sum+=C[x-1];
    }
    sum += B[A[i]-1];
    x = A[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,a;
int main(){
    cin >> N;
    int ans = 0;
    rep(i,N){
        cin >> a;
        ans += a;
    }
    cout << ans - N << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>

#define MAX_N 100000
#define INF ( 1 << 29 )

using namespace std;

typedef pair<int, int> P;

int N, M;
vector<int> G[3 * MAX_N + 1];

int d[3 * MAX_N + 1];

int dijkstra( int s, int t, int N )
{
    priority_queue<P> que;
    for ( int v = 1; v <= N; v++ )
    {
        d[v] = ( v == s ) ? 0 : INF;
        que.push( P( -d[v], v ) );
    }

    while ( !que.empty() )
    {
        int u = que.top().second;
        que.pop();

        for ( auto v : G[u] )
        {
            int alt = d[u] + 1;
            if ( d[v] > alt )
            {
                d[v] = alt;
                que.push( P( -d[v], v ) );
            }
        }
    }

    return d[t] >= INF ? -1 : d[t];
}

int main( int argc, char **argv )
{

    cin >> N >> M;

    for ( int i = 0; i < M; i++ )
    {
        int u, v;
        cin >> u >> v;

        int us[] = {u, u + N, u + 2 * N};
        int vs[] = {v, v + N, v + 2 * N};

        // u0->v1; u1->v2; u2->v0;
        for ( int i = 0; i < 3; i++ ) G[us[i]].push_back( vs[( i + 1 ) % 3] );
    }

    int S, T;
    cin >> S >> T;

    int ans = dijkstra( S, T, 3 * N );
    cout << ( ans < 0 ? ans : ans / 3 ) << endl;

    return 0;
}


Measured memory_bytes: 23924
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(A==1){
            A = A + 13;
        }
        if(B==1){
            B = B + 13;
        }
        
        if(A > B){
            System.out.println("Alice");
        }else if(A == B){
            System.out.println("Draw");
        }else if(A < B){
            System.out.println("Bob");
        }
    }
}

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

		while(n != 0){
			int teamNum[] = new int[n];
			int timeMT = 0;
			int timeST = 0;
			int totalS[] = new int[n];

			for(int i = 0 ; i < n ; i++){
				timeMT = 0;
				timeST = 0;
				teamNum[i] = scan.nextInt();
				for(int j = 0 ; j < 4 ; j++){
					int m = scan.nextInt();
					int s = scan.nextInt();
					timeMT += m;
					timeST += s;
				}
				totalS[i] = timeMT * 60 + timeST;
			}
			for(int i = 0 ; i < n ; i++){
				for(int j = 0 ; j < n-1-i ; j++){
					if(totalS[j] > totalS[j+1]){
						int t = totalS[j];
						totalS[j] = totalS[j+1];
						totalS[j+1] = t;
						int T = teamNum[j];
						teamNum[j] = teamNum[j+1];
						teamNum[j+1] = T;
					}
				}
			}

			System.out.println(teamNum[0]);
			System.out.println(teamNum[1]);
			System.out.println(teamNum[n-2]);
			n = scan.nextInt();
		}
	}
}

Measured memory_bytes: 68048
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int H = 60 * 60, M = 60, CHAKU = 0, HATU = 1;

typedef pair<int, int> pp;

int main()
{
    int n;
    while(cin >> n && n)
    {
        int ans = 0, h, m, s;
        char t;
        vector<pp> tr;
        REP(n)
        {
            cin >> h >> t >> m >> t >> s;
            tr.push_back(pp(h * H + m * M + s, HATU));
            cin >> h >> t >> m >> t >> s;
            tr.push_back(pp(h * H + m * M + s, CHAKU));
        }
        sort(all(tr));

        int num = 0;
        REP(n * 2)
            if(tr[i].second == CHAKU){ num--; ans = max(ans, num);}
            else { num++; ans = max(ans, num);}

        cout << ans << endl;
    }
    return 0;
}

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

int main() {
	// your code goes here
	long long n;
	cin>>n;
	long long a[n];
	for(long long i=0;i<n;i++)
	cin>>a[i];
	long long c=0;
	for(long long i=0;i<n-1;i++)
	{
		if(a[i]>a[i+1])
		{
			c+=(a[i]-a[i+1]);
			a[i+1]=a[i];
		}
	}
	cout<<c;
	return 0;
}


Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int l, r, d, cnt = 0;
    scanf("%d%d%d", &l, &r, &d);
    for (int i = l; i <= r; i++)
    {
        if (!(i % d))
        {
            cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 3828
#include<stdio.h>
#include<ctype.h>

int main() {
  char a;
  
  scanf("%s", &a);
  
  if(islower(a) != 0) {
    
    printf("a");
    
  } else {
    
    printf("A");
  
  }
  
  return 0;
}

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

int	main() {
	string SA, SB, SC;
	cin >>SA >>SB >>SC;
	int a=0;
	int b=0;
	int c=0;
	int T=0;
	while (true) {
		if (0==T) {
			if (a==SA.size()) {
				cout <<'A' <<endl;
				return 0;
			}
			T=SA.at(a)-'a';
			a++;
		} else if (1==T) {
			if (b==SB.size()) {
				cout <<'B' <<endl;
				return 0;
			}
			T=SB.at(b)-'a';
			b++;
		} else {
			if (c==SC.size()) {
				cout <<'C' <<endl;
				return 0;
			}
			T=SC.at(c)-'a';
			c++;
		}
	}
	return 0;
};


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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int n, m;
bool fld[25][25];

int main()
{
	while (1)
	{
		memset(fld, false, sizeof(fld));
		cin >> n;
		if (n == 0) break;
		int x, y;
		REP(i, n)
		{
			cin >> x >> y;
			fld[x][y] = true;
		}
		cin >> m;
		char c; int d;
		x = 10; y = 10;
		int cnt = 0;
		REP(i, m)
		{
			cin >> c >> d;
			if (c == 'N')
			{
				REP(j, d)
				{
					y++;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'S')
			{
				REP(j, d)
				{
					y--;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'E')
			{
				REP(j, d)
				{
					x++;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'W')
			{
				REP(j, d)
				{
					x--;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
		}
		if (n - cnt) cout << "No" << endl;
		else cout << "Yes" << endl;

	}
	return 0;
}

Measured memory_bytes: 1152
def detect(fig)
	i, j = fig.first
	if fig[1] == [i, j + 1]
		case fig[2]
		when [i + 1, j]; return 'A'
		when [i, j + 2]; return 'C'
		when [i + 1, j + 1]; return 'E'
		else return 'G'
		end
	else
		case fig[2]
		when [i + 2, j]; return 'B'
		when [i + 1, j]; return 'D'
		else return 'F'
		end
	end
end

until $<.closed? or $<.eof? do
	fig = []
	$<.each_line.take(8).each_with_index do |line, i|
		line.each_char.with_index do |c, j|
			fig << [i, j] if c == '1'
		end
	end
	$<.gets

	puts detect(fig)
end

Measured memory_bytes: 6112
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
    
    int n,a,b;
    cin>>n>>a>>b;
    int sum;
    int SUM=0;
    int temp;

    for(int i=1;i<=n;i++){
        
        sum=0;
        temp=i;

       for(int j=10000;j>0;j/=10){
           
           sum += i/j;
           i = i-(i/j)*j;
    
        }

        if(sum>=a && sum<=b){
            SUM+=temp;
        }
        i=temp;
    }
    cout<<SUM<<endl;
}

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

int main() {
    string N;
    cin >> N;
    for(int i=0;i<N.size()/2;i++){
        if(N[i]!=N[N.size()-1-i]){
            cout << "No" << endl;
            return 0;
        }

    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <list>
#include <algorithm>
#include <math.h>
#include <iomanip>      // std::setprecision
#include <unordered_map>
#include <set>
#define FOR(x,y,z) for(int x = (y); x < (z); x++)
#define FORD(x,y,z) for(int x = (y); x >= z; x--)
#define REP(r,n) for(int r = 0; r < (n); r++)
#define MP make_pair
#define ST first
#define MAXUS 100020
#define ND second
#define PB push_back
#define MAXUS2 2003
#define PI 3.1415926
#define SIZE(c) ((int)((c).size()))
#define FOREACH(i,x) for (__typeof((x).begin()) i=(x).begin(); i!=(x).end(); i++)
#define ALL(u) (u).begin(),(u).end()
#define epsilon 0.000001
#define MAXUS3 3000010
#define INF 2000000009
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<int, int> PR;


VI graph[MAXUS];
VI colors(MAXUS);
VI len(MAXUS);
VI parent(MAXUS);
vector<bool> visited(MAXUS);
int dfs(int s) {
    stack<int> Q;
    while(!Q.empty()) Q.pop();
    Q.push(s);
    len[s] = 0;
    visited[s] = true;
    while (!Q.empty()) {
        int cur = Q.top(); Q.pop();
        if (colors[cur] == 1) return max(len[cur]-1, 0);
        for (int neigh:graph[cur]) {
            if (!visited[neigh]) {
                len[neigh] = len[cur]+1;
                Q.push(neigh);
                parent[neigh] = cur;
                visited[neigh] = true;
            }
        }
    }
    return len[s];
}


int dfs2(int s, int bannedColor) {
    stack<int> Q;
    while(!Q.empty()) Q.pop();
    Q.push(s);
    int actions = 0;
    while (!Q.empty()) {
        int cur = Q.top(); Q.pop();
       if (!visited[cur]) {
         if (cur != s) actions++;
            visited[cur] = true;
            for (int neigh:graph[cur]) {
                if (colors[neigh] != bannedColor && !visited[neigh]) {
                    Q.push(neigh);
                }
            }
        }
    }
    return actions;
}



// 1 bialy 2 czarny
int main() {
    ios_base::sync_with_stdio(0);

    int n, p, t, s;
    cin >> n;
    REP(i, n+1) {
        graph[i].clear();
        colors[i] = 0;;
        len[i] = 0;
        parent[i] = 0;;
        visited[i] = false;
    }
    REP(i,n-1) {
        cin >> s >> t;
        graph[s].PB(t);
        graph[t].PB(s);
    }
    colors[1] = 2;
    colors[n] = 1;
    s = dfs(1);
    VI path(s);
    int k_ind = s-1;
    int ind = n;
    while (parent[ind] != 1) {
        path[k_ind--] = parent[ind];
        ind = parent[ind];
    }
    int a = 0, b = s;
    bool turnA = true;
    while (a<b) {
        if (turnA) {
            colors[path[a]] = 2;
            turnA = false;
            a++;
        } else {
            colors[path[b-1]] = 1;
            b--;
            turnA = true;
        }
    }
    REP(i,n+1) visited[i] = false;
    int APlayer = dfs2(1, 1);
    REP(i,n+1) visited[i] = false;
    int BPlayer = dfs2(n, 2);
    if (APlayer > BPlayer) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
    return 0;

}


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int X, Y; std::cin >> X >> Y;
  std::cout << X + Y/2 << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

#define MAX_N 5001
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long


int main(){
    int n,k; std::cin>> n >> k;
    int C[MAX_N], P[MAX_N];
    ll ans=-1e18;
    rep(i,n) std::cin >> P[i];
    rep(i,n) std::cin >> C[i];
    rep(i,n) --P[i];

    rep(i,n){
        int x=i;
        std::vector<int> lp;
        ll total=0;
        while(1){
            x = P[x];
            lp.push_back(C[x]);
            total += C[x];
            if(x == i) break;
        }
        int L=lp.size();
        ll t=0;
        rep(j,L){
            t += lp[j];
            if(j+1 > k) break;
            ll now=t;
            if(total > 0){
                ll e = (k-(j+1))/L;
                now += total*e;
            }
            ans = std::max(ans, now);
        }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3720
let w = read_line ()

let h = Hashtbl.create (String.length w)

let () =
  String.iter
    (fun c ->
       let v = try Hashtbl.find h c with Not_found -> 0 in
       Hashtbl.replace h c (v + 1))
    w ;
  ( if Hashtbl.fold
      (fun _ v pre -> v mod 2 = 0 && pre) h true then "Yes" else "No" )
  |> print_endline

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;

class Program
{
  
    
    static void Main(string[] args)
    {
        string[] arr1 = Console.ReadLine().Split(' ').ToArray();
        int[] arr2 = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        string u = Console.ReadLine();
        int ind = 0;
        for(int i = 0; i < 2; i++)
        {
            if (arr1[i].Equals(u)) ind = i;
        }
        arr2[ind]--;
        Console.WriteLine(arr2[0] + " " + arr2[1]);


    }




}

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

d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

ans = 0
for a in d:
    n = d[a]
    ans += n * (n-1) // 2

for a in A:
    n = d[a]
    if n >= 2:
        print(ans - n + 1)
    else:
        print(ans)


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

int main(){
  int N; cin >> N;
  string NN=to_string(N);
  if(NN.size()==1){
    cout << N << endl;
  }else if(NN.size()==2){
    cout << 9 << endl;
  }else if(NN.size()==3){
    cout << 9+N-99 << endl;
  }else if(NN.size()==4){
    cout << 909 << endl;
  }else if(NN.size()==5){
    cout << 909+N-9999 << endl;
  }else{
    cout << 90909 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int X; cin >> X;
    int n = X / 500;
    int m = (X % 500) / 5;
    Out(1000 * n + 5 * m);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  int n,ans=1;
  cin>>n;
  vector<string> c;
  string str,ring;
  cin>>str;
  c.push_back(str);
  
  for(int i=1;i<n;i++){
    cin>>ring;
    c.push_back(ring);
  }
  
  sort(c.begin(),c.end());
  for(int i=0;i<n-1;i++){
    if(c[i]!=c[i+1])ans++;
  }
  
  cout<<ans<<endl;
  return 0;
}

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

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (stderr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int INF = 1e9, MOD = INF + 7 /* INF - 1755647 */;

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

const int N = 1e5 + 20;

int outDeg[N];
bool used[N], marked[N];
pii edgs[N];
vpii g[N];
vi tree[N];

void makeTree(int v) {
	marked[v] = true;
	for(pii p : g[v]) if (!marked[p.first]) {
		tree[v].push_back(p.first);
		tree[p.first].push_back(v);
		used[p.second] = true;
		makeTree(p.first);
	}
}

void dfs(int v, int p = 0) {
	for(int u : tree[v]) if (u != p) dfs(u, v);
	if (p == 0) return;
	if (outDeg[v] % 2 == 0) {
		cout << p << ends << v << endl;
		outDeg[p]++;
	} else {
		cout << v << ends << p << endl;
		outDeg[v]++;
	}
}

int32_t main() {

	sync;
	
	int n, m; cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int v, u; cin >> v >> u;
		edgs[i] = make_pair(v, u);
		g[v].push_back(make_pair(u, i));
		g[u].push_back(make_pair(v, i));
	}
	if (m % 2) die(-1);
	makeTree(1);
	cout << endl;
	for(int i = 0; i < m; i++) if (!used[i]) {
		cout << edgs[i].first << ends << edgs[i].second << endl;
		outDeg[edgs[i].first]++;
	}
	dfs(1);

	return 0;
}

Measured memory_bytes: 22656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  if (a%2==0 || b%2==0) {
 	 cout << "Even"  << endl;
  }
  if(a%2==1 && b%2==1){
    cout << "Odd"  << endl;
  }
}

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

//比較関数
int compare(datatype a, datatype b){
	return a - b;
}

//昇順
void sort_sub(datatype *origin, int left, int right, datatype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(datatype *origin, int N){
	datatype *tmp = (datatype *)malloc(sizeof(datatype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int main(){
	int N, M, i, j;
	scanf("%d", &N);
	int *D = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &D[i]);
	}
	scanf("%d", &M);
	int *T = (int *)malloc(sizeof(int) * M);
	for(j = 0; j < M; j++){
		scanf("%d", &T[j]);
	}
	sort(D, N);
	sort(T, M);
	for(i = 0, j = 0; j < M && i < N;){
		if(D[i] == T[j]){
			i++;
			j++;
		}
		else if(D[i] > T[j]){
			printf("NO\n");
			return 0;
		}
		else{
			i++;
		}
	}
	if(j < M){
		printf("NO\n");
	}
	else{
		printf("YES\n");
	}
	return 0;
}

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

int main(){
  
  for(int i=0;i<7;i++){
    int a,b;
    cin>>a>>b;
    if(a>b){
      cout<<a-b<<endl;
    }else{
      cout<<b-a<<endl;
    }
  }
  return 0;
}
  

    
  
  
	



Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    cin>>n;
    if (n==1) cout<<"Hello World\n";
    if (n==2)
    {
        int a, b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
a,b=[int(x)for x in input().split()]
if a>b :
  a,b=b,a
l=a%4
m=b%4
tmp=0
for p in range(a,a+4-l):
  tmp^=p
for p in range(b-m,b+1):
  tmp^=p
print(tmp)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
const int N=2e5;
int a[4005],b[4005],c[4005];//若改为vector<int>a,b,c错误，vector不能达成a[i]用法
 
int main(){
int n,l=0,m=0,r=0;
ll ans=0;
string s;
cin>>n>>s;
rep(i,n){
if(s[i]=='R')
    a[l++]=i+1;
if(s[i]=='G')
    b[m++]=i+1;
if(s[i]=='B')
    c[r++]=i+1;
}
for(int i=0;i<l;i++)
for(int j=0;j<m;j++){
    int sum=r;
    int a1=min(a[i],b[j]);
    int b1=max(a[i],b[j]);
    if(2*a1-b1-1>=0&&2*a1-b1-1<n&&s[2*a1-b1-1]=='B')
        sum--;
    if(2*b1-a1-1>=0&&2*b1-a1-1<n&&s[2*b1-a1-1]=='B')
        sum--;
    if((a1+b1)%2==0&&s[(a1+b1)/2-1]=='B')
        sum--;
    ans+=sum;
    //cout<<ans<<endl;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
    // ABC080-C, 1141, 
    int n; cin >> n;
    vector<vector<int>> f(n, vector<int>(10, 0));
    vector<vector<int>> p(n, vector<int>(11, 0));
    rep(i, n) rep(j, 10) cin >> f[i][j];
    rep(i, n) rep(j, 11) cin >> p[i][j];
    ll ans = -iINF;
    rep(i, 1 << 10) {
        if (i == 0) continue;
        ll tmpans = 0;
        rep(j, n) {
            int c = 0;
            rep(k, 10) {
                c += (i >> k & 1) * f[j][k];
            }
            tmpans += ll(p[j][c]);
        }
        ans = max(ans, tmpans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;



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

	ll H;
	cin >> H;

	ll yuni = 0;
	while (1) {
		if (H == 1) break;
		else{
			yuni++;
			H /= 2;
		}
	}
	ll ans = pow(2, yuni + 1) - 1;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
import sys
from collections import deque


def main():
    N, M, *AB = map(int, sys.stdin.buffer.read().split())
    
    g = [[] for _ in range(N + 1)]

    for A, B in zip(*[iter(AB)] * 2):
        g[A].append(B)
        g[B].append(A)

    queue = deque([1])
    d = [0] * (N + 1)
    d[0] = 1
    d[1] = 1

    while queue:
        v = queue.popleft()
        for i in g[v]:
            if d[i] == 0:
                d[i] = v
                queue.append(i)

    if all(d):
        print("Yes")
        print("\n".join(map(str, d[2:])))
    else:
        print("No")


if __name__ == '__main__':
	main()

exit()


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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
#endif
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int sum=0;
	for(int i=0;i<k;i++)
		sum+=a[i];
	int best=sum;
	for(int i=k;i<n;i++){
		sum+=a[i]-a[i-k];
		best=max(best,sum);
	}
	best=best+k;  double ans=(double)best/2.00;
	cout<<ps(ans,18)<<endl;
	return 0;
}

Measured memory_bytes: 1024