akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main(){
    int X , Y , Z;
    cin >> X >> Y >> Z;
    int N = (X - Z) % (Y + Z);
    if(N == 0){
        cout << (X - Z) / (Y + Z) << endl;
    }
    else{
        if(Y >= Z){
            cout << (X - Z) / (Y + Z) << endl;
        }
        else{
            if(((X - Z) - (X - Z) / (Y + Z)) >= Y){
                cout << (X - Z) / (Y + Z) << endl;
            }
            else{
                cout << (X - Z) / (Y + Z) << endl;
            }
        }
    }
}

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


int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++)
    {
        int t = S[i] - 'A' + 26;
        (t += N) %= 26;
        S[i] = (char)('A' + t);
    }
    cout << S << endl;
}
      


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

using namespace std;

#define int long long
#define uint unsigned int
#define dotimes(i, n) for (int i = 0, i##max__ = (n); i < i##max__; i++)
#define whole(x, f, ...) ([&](decltype((x)) c__) { return (f)(begin(c__), end(c__), ## __VA_ARGS__); })(x)

int rint() { int x; scanf("%lld", &x); return x; }
void wint(int x) { printf("%lld\n", x); }

template<typename T> int size(T const& c) { return static_cast<int>(c.size()); }
template<typename T> bool maxs(T& a, T const& b) { return a < b ? a = b, true : false; }
template<typename T> bool mins(T& a, T const& b) { return a > b ? a = b, true : false; }
inline int lg(int x) { return 63 - __builtin_clzll(static_cast<unsigned int>(x)); }

#ifdef EBUG
#define INT_WIDTH ""
#include "debug.h"
#else
#define inspect(...) do {} while (0)
#define debugf(...) do {} while (0)
#define debugv(...) do {} while (0)
#endif

constexpr uint mask30 = (1ull << 30) - 1, mask31 = (1ull << 31) - 1, mask61 = (1ull << 61) - 1;

uint add61(uint x, uint y) {
  uint z = x + y, w = (z >> 61) + (z & mask61);
  return w < mask61 ? w : w - mask61;
}

uint sub61(uint x, uint y) {
  return x >= y ? x - y : mask61 - (y - x);
}

uint mul61(uint x, uint y) {
  uint a = x >> 31, b = x & mask31, c = y >> 31, d = y & mask31, z = a * d + b * c, e = z >> 30, f = z & mask30;
  return (2 * a * c + e + (f << 31) + b * d) % mask61;
}

uint pow61(uint x, int n) {
  uint r = 1;
  for (; n; n >>= 1, x = mul61(x, x))
    if (n & 1)
      r = mul61(r, x);
  return r;
}

uint base61(uint lb = 256) {
  std::random_device rd;
  std::mt19937_64 prng((static_cast<uint>(rd()) << 32) | rd());
  std::uniform_int_distribution<uint> uid(lb, mask61 - 2);
  return uid(prng);
}

// s = string, h_i = hash of the substring s[i...i+n]
// h_i = s[0] * b^{n-1} + ... + s[n-1] * b^0
// h_{i+1} = (h_i - s[i] * b^{n-1}) * b + s[i+n]

// h_{i+1} = (h_i - s[i] * b^{n-1}) * b + s[i]
// = h_i b - s[i] b^n + s[i]
// = h_i b - s[i] (b^n - 1)

signed main() {
  const int b1 = base61();
  const int N = rint();
  vector<int> A, B, C(N);
  A.reserve(N);
  B.reserve(N);
  dotimes(i, N)
    A.emplace_back(rint());
  dotimes(i, N)
    B.emplace_back(rint());
  dotimes(j, 30) {
    auto extract = [=](int x) {
      return (x & (1 << j)) ? 225978934030950003ull : 1260431013037990585ull;
    };
    dotimes(f, 2) {
      uint b = 1, ha = 0, hb = 0;
      for (int i = 0; ; i++, b = mul61(b, b1)) {
        ha = add61(ha, mul61(b, extract(A[N-i-1])));
        hb = add61(hb, mul61(b, extract(f ? B[N-i-1] : ~B[N-i-1])));
        if (i == N - 1)
          break;
      }
      if (ha == hb)
        C[0]++;
      uint bn_1 = sub61(mul61(b, b1), 1);
      dotimes(k, N-1) {
        ha = sub61(mul61(ha, b1), mul61(extract(A[k]), bn_1));
        if (ha == hb)
          C[k+1]++;
      }
    }
  }
  dotimes(k, N)
    if (C[k] == 30)
      printf("%lld %lld\n", k, A[k] ^ B[0]);
  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    long a, b, k;
    cin >> a >> b >> k;

    long ak = a - k;
    if(ak < 0){
        long bk = b + ak;
        if(bk < 0){
            cout << 0 << " " << 0 << endl;
        }else{
            cout << 0 << " " << bk << endl;
        }
    }else{
        cout << ak << " " << b << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
    int i,j,n,a,b,c;
    int count=0;
   cin>>a>>b>>c;
   if(a!=b&&a!=c)cout<<a;
    if(b!=a&&b!=c)cout<<b;
    if(c!=b&&c!=a)cout<<c;
    return 0;
}

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

int main(){
  long long N;
  cin >> N;
  vector<vector<long long> > xyh(N, vector<long long>(3));
  for (int i=0; i<N; i++){
    cin >> xyh[i][0] >> xyh[i][1] >> xyh[i][2];
  }
  sort(xyh.begin(), xyh.end() ,[](const auto a, const auto b){return (a[2]>b[2]);});
  for (long long cx=0; cx<=100; cx++){
    for (long long cy=0; cy<=100; cy++){
      bool flag = true;
      long long H=0;
      for (int i=0; i<N; i++){
        if (H==0) {
          if (xyh[i][2]==0) continue;
          else{
            H = xyh[i][2] + abs(cx-xyh[i][0]) + abs(cy-xyh[i][1]);
          }
        }
        else {
          if (xyh[i][2] != max(H-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), (long long)0)){
            flag = false;
            break;
          }
        }
      }
      if (flag&&H!=0){
        cout << cx << ' ' << cy << ' ' << H << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

N=int(input())
mod=10**9+7
if N==1:
  print(1)
else:
  ans=1
  dp=[0]*1001
  for i in range(2,N+1):
    p=factorization(i)
    for i,j in p:
      dp[i]+=j
  for i in range(1001):
    ans*=(dp[i]+1)
    ans%=mod
  print(ans)

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

int main() {
    string S; cin >> S;
    int N = S.size();
    int res = 1001001001;
    for(int i=1; i<N; ++i) {
        if(S[i-1] != S[i]) res = min(res, max(i, N-i));
    }
    if(res == 1001001001) res = N;
    cout << res << endl;
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ps := make([]int, n)
	for i := range ps {
		fmt.Scan(&ps[i])
	}

	ans := 0
	for i := 0; i < n; i++ {
		count := 0
		if ps[i] == i+1 {
			count++
			j := i + 1
			for ; j < n && ps[j] == j+1; j++ {
				count++
				i = j
			}
			ans += (count + 1) / 2
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
/*********************
*@Author:   CKang *
*@Language: C++11    *
*********************/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
//#define DEBUG
#define RI register int
#define endl "\n"

using namespace std;

typedef long long ll;
//typedef __int128 lll;
//const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-9;
const int INF = 0x3fffffff;
const ll LINF = 0x3fffffffffffffff;

inline ll read(){
    long long x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int main()
{
#ifdef DEBUG
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout)
#endif
    //cout.tie(0);
    //ll t = read() ;
    //while(t--){}
    ll k=read();
    deque<ll>dq;
    for(int i=1;i<=9;i++)dq.push_back(i);
    for(ll i=1;i<k;i++){
        ll tem=dq.front();
        if(tem%10==0){
            dq.push_back(tem*10+tem%10);
            dq.push_back(tem*10+tem%10+1);
        }
        else if(tem%10!=9){
            dq.push_back(tem*10+tem%10-1);
            dq.push_back(tem*10+tem%10);
            dq.push_back(tem*10+tem%10+1);
        }
        else{
            dq.push_back(tem*10+tem%10-1);
            dq.push_back(tem*10+tem%10);
        }
        dq.pop_front();
    }
    cout<<dq.front();
#ifdef DEBUG
    printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Fuck You !" << endl;
    return 0;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

vector<P>E[30000];
vector<int>G[30000];
bool used[3000];

void dfs(int v){
	used[v]=true;
	for(int u:G[v]){
		if(!used[u]){
			dfs(u);
		}
	}
}

ll d[3000];

int main(){
	int n,m;cin>>n>>m;
	int e;cin>>e;
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		E[a].push_back(P(c-e,b));
		G[b].push_back(a);
	}
	dfs(n-1);
	rep(i,n)d[i]=-INFL;
	d[0]=0;
	rep(i,n){
		bool flag=false;
		rep(v,n){
			if(d[v]==-INFL)continue;
			for(auto p:E[v]){
				if(d[p.second]<p.first+d[v]){
					d[p.second]=p.first+d[v];
					if(used[p.second])flag=true;
				}
			}
		}
		if(i==n-1&&flag){
			puts("-1");return 0;
		}
	}
	cout<<max(d[n-1],0LL)<<endl;
}

Measured memory_bytes: 1920
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let m: usize = input();
    let ab: Vec<(usize, usize)> = (0..m)
        .map(|_| {
            let a = input();
            let b = input();
            (a, b)
        })
        .collect();

    let mut path = vec![vec![]; n + 1];
    for (a, b) in ab {
        path[a].push(b);
        path[b].push(a);
    }

    let mut g = vec![false; n + 1];
    for &i in &path[1] {
        for &j in &path[i] {
            if j != 1 {
                g[j] = true;
            }
        }
    }

    println!("{}", if g[n] { "POSSIBLE" } else { "IMPOSSIBLE" });
}


Measured memory_bytes: 22780
#include <iostream>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main() {
    string S,T; cin >> S >> T;
    ll a[26]={0};
    ll b[26]={0};
    ll p=0;
    ll r=0;
    for (int i=0; i<S.size()-1;i++){
        int q=1;
        char w = S[i];
        if (w == 'B') continue;
        for (int j=i+1;j<S.size();j++){
            if (S[j] == w){
                q++;
                S[j] = 'B';
            }
        }
        a[p] = q;
        S[i] = 'B';
        p++;
    }
    for (int i=0; i<T.size()-1;i++){
        int q=1;
        char w = T[i];
        if (w == 'B') continue;
        for (int j=i+1;j<T.size();j++){
            if (T[j] == w){
                q++;
                T[j] = 'B';
            }
        }
        b[r] = q;
        T[i] = 'B';
        r++;
    }
    sort(a,a+26); sort(b,b+26);
    for (int i=0; i<26; i++){
        if (a[i] != b[i]){
            cout << "No" << endl;
            break;
        }
        if (i==25) cout << "Yes" << endl;
    }
    
    
    
    return 0;
}


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

int main(){
    int N;
    int count = 0;
    cin >> N;
    long long H[N];
    for(int i=0;i<N;i++){
        cin >> H[i];
    }
    int fl = 0;
    for(int i= N-2;i>=0;i--){
        if(H[i] - H[i+1] == 1) H[i]--;
        else if(H[i] > H[i + 1]){
            fl = 1;
            break;
        }
    }
    if(fl == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound


using namespace std;
vector<pair<ll,ll> > v ;

ll min(ll a, ll b)
{

    if(a<b) return a ;
    return b ;
}
ll max(ll a, ll b)
{

    if(a>b) return a ;
    return b ;
}
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    ll n ;

       cin >> n ;
       v.clear() ;
       for(int i=0 ;i<n;i++)
       {
           ll a,b ;
           cin >> a>> b ;
           v.push_back({a,b});
       }

       // case 1
       ll ans=LLONG_MIN;
       ll a=LLONG_MIN,b=LLONG_MAX;
       for(ll i=0 ;i<n;i++)
       {
           a=max(a,v[i].ff+v[i].ss);
           b=min(b,v[i].ff+v[i].ss);
       }
         ans=max(ans,a-b);

        // case 2
         a=LLONG_MIN,b=LLONG_MAX;
       for(ll i=0 ;i<n;i++)
       {
           a=max(a,v[i].ff-v[i].ss);
           b=min(b,v[i].ff-v[i].ss);
       }
         ans=max(ans,a-b);

          // case 4
         a=LLONG_MIN,b=LLONG_MAX;
       for(ll i=0 ;i<n;i++)
       {
           a=max(a,v[i].ss-v[i].ff);
           b=min(b,v[i].ss-v[i].ff);
       }
         ans=max(ans,a-b);
        cout << ans << endl;
}


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

int main() {
  int K,A,B;
  cin >> K >> A >> B;
  bool div = false;
  for(int i ; i <= B-A ; i++){
  	if((A+i) % K == 0){
    	div = true;
      	break;
    }
  }
  if(div){
  cout << "OK" << endl;
  }
  else{
  cout << "NG" << endl;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>

#define mod 1000000000+7;
typedef long long ll;
using namespace std;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int a,b; cin >> a >> b;
	int ans{}; int le{1};
	while(le<b){
		--le;
		le += a;
		++ans;
		}
	cout << ans << "\n";
}

Measured memory_bytes: 3640
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		loop: while (true) {
			Point2D.Double[] points = new Point2D.Double[4];
			int maxx = Integer.MIN_VALUE;
			int maxy = Integer.MIN_VALUE;
			int minx = Integer.MAX_VALUE;
			int miny = Integer.MAX_VALUE;
			for (int i = 0; i < 4; i++) {
				int x = scanner.nextInt();
				int y = scanner.nextInt();
				if (i == 0 && x == 0 && y == 0) {
					break loop;
				}
				points[i] = new Point2D.Double(x, y);
				if (i != 3) {
					maxx = Math.max(maxx, x);
					maxy = Math.max(maxy, y);
					minx = Math.min(minx, x);
					miny = Math.min(miny, y);
				}
			}
			double r = scanner.nextDouble();
			Line2D.Double a = new Line2D.Double(points[1], points[2]);
			Line2D.Double b = new Line2D.Double(points[2], points[0]);
			Line2D.Double c = new Line2D.Double(points[0], points[1]);
			Ellipse2D.Double circle = new Ellipse2D.Double(points[3].x,
					points[3].y, r * 2, r * 2);
			double d0 = points[3].distance(points[0]);
			double d1 = points[3].distance(points[1]);
			double d2 = points[3].distance(points[2]);
			double ap = a.ptSegDist(points[3]);
			double bp = b.ptSegDist(points[3]);
			double cp = c.ptSegDist(points[3]);

			if (d0 <= r && d1 <= r && d2 <= r) {
				System.out.println("b");
			} else if (ap >= r && bp >= r && cp >= r) {
				Line2D.Double da = new Line2D.Double(points[0], points[3]);
				Line2D.Double db = new Line2D.Double(points[1], points[3]);
				Line2D.Double dc = new Line2D.Double(points[2], points[3]);
				double x3 = points[3].x;
				double y3 = points[3].y;
				if (minx < x3 && x3 < maxx && miny < y3 && y3 < maxy
						&& !a.intersectsLine(da) && !b.intersectsLine(db)
						&& !c.intersectsLine(dc)) {
					System.out.println("a");
				} else {
					if (ap == r || bp == r || cp == r) {
						System.out.println("c");
					} else {
						System.out.println("d");
					}
				}
			} else {
				System.out.println("c");
			}

		}
	}
}

Measured memory_bytes: 21388
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int arr[101][101] = {0};

int main()
{
	int a;
	cin >> a;
	if(a%2 == 0)
	{
		cout << a/2;	
	}	
	else
	{
		cout << a/2+1;
	}
}



Measured memory_bytes: 3636
package main

import (
	"fmt"
	"math"
)

type Point struct {
	t int
	x int
	y int
}

func (p Point) distance(p2 Point) int {
	return int(math.Abs(float64(p2.x-p.x))) + int(math.Abs(float64(p2.y-p.y)))
}

func main() {
	var n int
	fmt.Scanln(&n)
	points := make([]Point, n)
	for i := 0; i < n; i++ {
		var t, x, y int
		fmt.Scanf("%d %d %d", &t, &x, &y)
		points[i] = Point{t, x, y}
	}

	// fmt.Println(points)

	prevPoint := Point{0, 0, 0}
	carryOut := true
	for _, point := range points {
		distance := point.distance(prevPoint)
		deltaT := point.t - prevPoint.t

		if distance > deltaT {
			carryOut = false
			break
		}
		if (deltaT-distance)%2 != 0 {
			carryOut = false
			break
		}
	}

	if carryOut {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main()
{
	int n, y;

	cin >> n;

	while (n > 0) {
		cin >> y;

		int m;
		double s = 0, u;

		for (int i = 0; i < n; i++) {
			int b, r, t;
			cin >> b >> r >> t;

			if (t == 1)
				u = (1 + (double)(y * r) / 100);
			else
				u = pow(1 + ((double)r / 100), (double)y);

			if (s < u) {
				s = u;
				m = b;
			}
		}

		cout << m << endl;

		cin >> n;
	}
	return 0;
}



Measured memory_bytes: 3360
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int uinps[64];
int n, k;
bool intcmp (const int a, const int b) {
	return a > b;
}


int main (void) {
	ios::sync_with_stdio (false);
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> uinps[i];
	sort (uinps, uinps + n, intcmp);
//	for (int i = 0; i < n; i++) cout << i << " : " << uinps[i] << endl;
	
	int sum = 0;
	for (int i = 0; i < k; i++) sum += uinps[i];
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
int main() { 
  int N,X;
  cin>>N>>X;
  vector<int> D(N + 1);
  D[0] = 0;
  for(int i=0;i<N;++i){
    int x; 
    cin >> x; 
    D[i + 1] = D[i] + x;
  }
  int ans=0;
  for(int i=0;i<=N;++i){
    if (D[i] <= X) {
      ans++;
    } 
  }
  cout << ans << endl;
  return 0; 
}

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

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

    long long n;
    cin>>n;
    long long  a;
    //for (long long i=0;i<n-1;i++)
        //cin>>a[i];
    long long times=0,count=1;
    int array[n];
    for (int i=0;i<=n;i++)
    array[i]=0;
    //cout<<array<<endl;
    for (int i=0;i<n-1;i++)
    {
        cin>>a;
        array[a]++;
    }
    for (int i=1;i<=n;i++)
    cout<<array[i]<<endl;
    /*for (long long i=0;i<n-1;i++)
    {
        if (a[i]==a[i+1])
        {
            count++;
        }
        else 
        {
            cout<<count<<endl;
            times++;
            count=1;   
        }
    }
        long long val=n-times;
    if (val>=1)
    {
     while(val--)
     cout<<0<<endl;   
    }*/
    return 0;
}

Measured memory_bytes: 4312
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x0123456789) cerr<<#x0123456789<<':'<<x0123456789<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x0123456789:v)cerr<<x0123456789<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;
typedef long double ld;

ll N,M,W,T;
vector<ll> V,P;
vector<ll> L,X,Y;
vector<vector<ll>> R,Q;
map<string,ll> m;

ll md(ll x1,ll y1,ll x2,ll y2){
    return abs(x1-x2)+abs(y1-y2);
}

pair<ll,ll> bitfunc(ll n){
    vector<ll> v;
    FOR(i,0,N)if((1<<i)&(n))v.pb(i);
    //x
    ll x=LINF;
    do{
        ll dist=0;
        dist += md(0,0,X[v[0]],Y[v[0]]);
        FOR(i,0,v.size()-1){
            dist += md(X[v[i]],Y[v[i]],X[v[i+1]],Y[v[i+1]]);
        }
        dist += md(X[v[v.size()-1]],Y[v[v.size()-1]],0,0);
        x = min(x,dist);
    }while(next_permutation(ALL(v)));
    //y
    ll value[M],weight[M];
    FOR(i,0,M)value[i]=0,weight[i]=LINF;
    FOR(rep,0,v.size()){
        ll t = v[rep];
        FOR(i,0,L[t]){
           value[R[t][i]] = max(value[R[t][i]],P[R[t][i]]-Q[t][i]);
           weight[R[t][i]] = min(weight[R[t][i]],V[R[t][i]]);
        }
    }
    ll DP[W+1]={0};
    FOR(i,0,M){
        FOR(j,0,W+1){
            if((j == 0 || DP[j]) && j+weight[i]<=W){
                DP[j+weight[i]] = max(DP[j+weight[i]],DP[j]+value[i]);
            }
        }
    }
    ll y=0;
    FOR(i,0,W+1)y = max(y,DP[i]);
    return make_pair(x,y);
}

int main(){
    cin >> N >> M >> W >> T;
    V.resize(M);P.resize(M);
    FOR(i,0,M){
        string s;
        cin >> s >> V[i] >> P[i];
        m[s] = i;
    }
    L.resize(N);X.resize(N);Y.resize(N);
    R.resize(N);Q.resize(N);
    FOR(i,0,N){
        cin >> L[i] >> X[i] >> Y[i];
        FOR(j,0,L[i]){
            string s;
            ll n;
            cin >> s >> n;
            R[i].pb(m[s]);
            Q[i].pb(n);
        }
    }
    ll value[((ll)1<<N)-1],weight[((ll)1<<N)-1];
    FOR(i,1,((ll)1<<N)){
        pair<ll,ll> p = bitfunc(i);
        value[i-1] = p.second;
        weight[i-1] = p.first;
    }
    ll DP[T+1]={0};
    FOR(i,0,((ll)1<<N)-1){
        FOR(j,0,T+1){
            if((j == 0 || DP[j]) && j+weight[i]<=T){
                DP[j+weight[i]] = max(DP[j+weight[i]],DP[j]+value[i]);
            }
        }
    }
    ll ans=0;
    FOR(i,0,T+1)ans = max(ans,DP[i]);
    cout << ans << endl;
}


Measured memory_bytes: 3292
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def solve(N,Q):
    era = []
    for _ in range(N):
        X = input().split()
        name = X[0]
        y = int(X[1])
        w = int(X[2])
        era.append((w - y + 1,w,name))

    for _ in range(Q):
        flag = False
        y = int(input())
        for a,b,c in era:
            if a <= y <= b:
                flag = True
                ans = (c,y - a + 1)
                break
        if flag:
            print(*ans)
        else:
            print('Unknown')

def main():
    while True:
        N,Q = map(int,input().split())
        if N == 0:
            return
        solve(N,Q)
if __name__ == '__main__':
    main()


Measured memory_bytes: 5624
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"math/big"
	"os"
)

var scan *bufio.Scanner
var reader io.Reader
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	reader = os.Stdin
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func main() {
	solve()
}

func solve() {
	var n, k int
	fmt.Scan(&n, &k)
	res := 0
	var tmp int
	for i := 0; i < n; i++ {
		fmt.Scan(&tmp)
		if tmp >= k {
			res++
		}
	}
	fmt.Print(res)
}

func cin(a ...interface{}) {
	for i := 0; i < len(a); i++ {
		doScan(a[i])
	}
	return
}
func doScan(a interface{}) {
	switch a.(type) {
	case *[]int:
		s := *a.(*[]int)
		for i := 0; i < len(s); i++ {
			fmt.Fscan(reader, &s[i])
		}
	case *[]string:
		s := *a.(*[]string)
		for i := 0; i < len(s); i++ {
			fmt.Fscan(reader, &s[i])
		}
	default:
		fmt.Fscan(reader, a)
	}
	return
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max(x int, y ...int) int {
	res := float64(x)
	for _, z := range y {
		res = math.Max(res, float64(z))
	}
	return int(res)
}

func min(x int, y ...int) int {
	res := float64(x)
	for _, z := range y {
		res = math.Min(res, float64(z))
	}
	return int(res)
}

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func sqrt(x int) int {
	return int(math.Sqrt(float64(x)))
}

func int2Int(x int) big.Int {
	var res big.Int
	res.SetInt64(int64(x))
	return res
}


Measured memory_bytes: 5504
A, B, C = gets.chomp.split(" ").map(&:to_i)
if [A, B, C].any? {|edge| edge.even?}
    puts 0
else
    sorted = [A, B, C].sort
    puts ((sorted[2] / 2 + 1) - (sorted[2] / 2)) * sorted[0] * sorted[1]
end


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

int main(){

    int a,b,c;

    cin >> a >> b >> c;

    if(a+b==c||b+c==a||a+c==b){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) \
  it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

int main()
{
    ios_base::sync_with_stdio(false);
    
    int a, b, c;
    cin >> a >> b;
    if(a*b%2==1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;

int N;
ll a[200000];
int o[200000];

int main() {
    cin >> N;
    rep(i, N){cin >> a[i];}

    {
        int i = 0;
        int c = N-1;
        while(true){
            o[i] = c;
            c -= 2;
            i++;
            if(c < 0){
                c = -c -1;
                break;
            }
        }

        while(true){
            o[i] = c;
            c += 2;
            i++;
            if(c >= N){break; }
        }
    }

    /*
    rep(i, N){
        cerr << o[i] << ",";
    }
    cerr << endl;
    */

    rep(i, N){
        cout << a[o[i]];
        if(i < N-1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4480
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    from collections import defaultdict

    n, c = map(int, input().split())
    dt = [[int(e) for e in input().split()] for _ in range(c)]
    ct = [[int(e) for e in input().split()] for _ in range(n)]

    cd0 = defaultdict(int)
    cd1 = defaultdict(int)
    cd2 = defaultdict(int)
    for i in range(n):
        for j in range(n):
            if (i + 1 + j + 1) % 3 == 0:
                cd0[ct[i][j]] += 1
            if (i + 1 + j + 1) % 3 == 1:
                cd1[ct[i][j]] += 1
            if (i + 1 + j + 1) % 3 == 2:
                cd2[ct[i][j]] += 1

    ans = 500 ** 2 * 1000 * 30
    for c0 in range(1, c + 1):
        base = 0
        for d in cd0:
            if d == c0:
                continue
            base += dt[d - 1][c0 - 1] * cd0[d]
        for c1 in range(1, c + 1):
            if c0 == c1:
                continue
            base2 = 0
            for d in cd1:
                if d == c1:
                    continue
                base2 += dt[d - 1][c1 - 1] * cd1[d]
            base2 += base
            for c2 in range(1, c + 1):
                if c0 == c2 or c1 == c2:
                    continue
                tans = 0
                for d in cd2:
                    if d == c2:
                        continue
                    tans += dt[d - 1][c2 - 1] * cd2[d]
                ans = min(ans, tans + base2)
                
    print(ans)
    
if __name__=="__main__":
    solve()


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

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

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

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

void solve() {
    ll N;
    cin >> N;
    vector<Pll> ps, zs, ns;
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
        string S;
        cin >> S;
        ll t = 0;
        ll mn = 0;
        for (const auto& c : S) {
            if (c == '(') {
                ++t;
            }
            else {
                --t;
            }
            mn = min(mn, t);
        }

        sum += t;

        if (t > 0) {
            ps.emplace_back(mn, t);
        }
        else if (t == 0) {
            zs.emplace_back(mn, t);
        }
        else {
            ns.emplace_back(mn - t, -t);
        }
    }

    sort(ps.begin(), ps.end(), greater<Pll>());
    sort(ns.begin(), ns.end(), greater<Pll>());

    bool ok = true;
    if (sum != 0) ok = false;

    ll cur = 0;
    for (const auto& [mn, t] : ps) {
        if (cur + mn < 0) {
            ok = false;
            break;
        }
        cur += t;
    }
    for (const auto& [mn, t] : zs) {
        if (cur + mn < 0) {
            ok = false;
            break;
        }
        cur += t;
    }

    cur = 0;
    for (const auto& [mn, t] : ns) {
        if (cur + mn < 0) {
            ok = false;
            break;
        }
        cur += t;
    }

    cout << (ok ? "Yes\n" : "No\n");
}

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

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

Measured memory_bytes: 19060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll,ll> P;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
ll c,d,e,f,p,t,ans=0;


ll n,m;
vector<P> gragh[3000];
vl A,B,C;
vl cost(3000,INF);

void input(void){
    cin>>n>>m>>p;
    rep(i,m){
        cin>>c>>d>>e;
        gragh[c].push_back(make_pair(d,p-e));
    }
}

ll solve(void){
    cost[1]=0;
    vl renewed(3000,0);
    rep(k,n-1){
    for(ll i=1;i<n+1;i++){
        rep(j,gragh[i].size()){
            cost[gragh[i][j].first]=min(cost[i]+gragh[i][j].second,cost[gragh[i][j].first]);
        }
    }
    }

    rep(k,n-1){
    for(ll i=1;i<n+1;i++){
        rep(j,gragh[i].size()){
            if(cost[i]+gragh[i][j].second<cost[gragh[i][j].first]){
                cost[gragh[i][j].first]=cost[i]+gragh[i][j].second;
                if(cost[i]<INF/2)renewed[gragh[i][j].first]=1;
            }
            if(renewed[i]==1)renewed[gragh[i][j].first]=1;
        }
    }
    }

    if(renewed[n]==1)return -1;
    return max(-cost[n],0LL);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    cout<<solve()<<endl;
}

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

int main(){

	ll n, x, a[100000], ans=0;
	cin >> n >> x;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	if(a[0]>x){
		ans+=(a[0]-x);
		a[0]=x;
	}
	for(int i=1; i<n; i++){
		if(a[i]+a[i-1]>x){
			ans+=(a[i]+a[i-1]-x);
			a[i]=x-a[i-1];
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>

using namespace std;

int main(void) {
  int n, prev=-1, first, a, b, c, p_a, p_b, p_c;
  cin >> n;
  int h[n][3];
  int happy[n][3];
  for(int i=0;i<n;i++) {
    cin >> h[i][0] >> h[i][1] >> h[i][2];
  }
  for(int i=0;i<3;i++) {
    happy[0][i] = h[0][i];
  }
  for(int i=1;i<n;i++) {
    a=h[i][0]; b=h[i][1]; c=h[i][2];
    p_a=happy[i-1][0]; p_b=happy[i-1][1]; p_c=happy[i-1][2];
    happy[i][0] = max(p_b, p_c) + a;
    happy[i][1] = max(p_a, p_c) + b;
    happy[i][2] = max(p_a, p_b) + c;
  }
  int ans=-1;
  for(int i=0;i<3;i++) { ans = max(ans, happy[n-1][i]); }
  cout << ans << endl;
 }

Measured memory_bytes: 2560
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

long long gcd(long long a, long long b)
{
	long long temp;

	while (b != 0)
	{
		a %= b;

		temp = a;
		a = b;
		b = temp;
	}

	return a;
}

int main()
{
	long long a, b;

	scanf("%lld %lld", &a, &b);

	printf("%lld\n", a*b / gcd(a, b));

	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String s = in.next();
			Set<Character> set = new TreeSet<>();
			for(int i = 0; i < s.length(); i++) {
				set.add(s.charAt(i));
			}
			List<Character> list = new ArrayList<>(set);
			if(list.size() == 26) {
				out.println("None");
			} else {
				for(int i = 'a'; i <= 'z'; i++) {
					if(list.indexOf((char)i) < 0) {
						out.println((char)i);
						break;
					}
				}
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 24532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  int S,h,m,s;
  cin >> S;
  h = S/3600;
  m = (S%3600)/60;
  s = (S%3600)%60;
  cout << h <<":"<<m <<":"<<s<< endl;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int n,k;
string s;

int solve(){
    cin>>n>>k;
    cin>>s;
    s='R'+s+'L';
    int c1=0,c2=0;
    for(int i=0;i<=n;++i){
        if(s[i]=='R' && s[i+1]=='L'){
            if(i==0)c1++;
            else if(i==n)c1++;
            else c2++;
        }
    }
//    while(k>0 && c2>1){
//        k--;c2--;
//    }
//    if(c1==0){
//        if(k>0 && c2>0){
//            k--;c2--;c1++;
//        }
//    }else{
//        if(k>0 && c2>0){
//            k--;c2--;
//        }
//    }
//    while(k>0 && c1>1){
//        k--;c1--;
//    }
//    
    while(k>0){
        k--;
        if(c2>1){
            c2--;
            continue;
        }
        if(c2==1){
            if(c1==0) c1++;
            c2--;
            continue;
        }
        if(c1>1){
            c1--;
            continue;
        }
        break;
    }
    
    
    return n-c2*2-c1*1;
}

int main(){
    cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

bool ok(int a){
    string s = to_string(a);
    bool f3 = false;
    bool f5 = false;
    bool f7 = false;
    bool f = true;
    for(char c : s){
        if(c == '3') f3 = true;
        else if(c == '5') f5 = true;
        else if(c == '7') f7 = true;
        else f = false;
    }
    return f3 & f5 & f7 & f;
}

int main(){
    int N;
    cin >> N;
    queue<int> q;
    vector<int> n_set = {3, 5, 7};
    for(int i=0; i<3; i++) q.push(n_set[i]);
    int cnt = 0;

    while(!q.empty()){
        int v = q.front(); q.pop();
        for (int i : n_set){
            int n = 10 * v + i;
            if(ok(n) && n <= N) {
                cnt++;
            }
            if(n <= N / 10) q.push(n);        
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
// ???????????? I
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);
		
		// ?????????????????????
		Dise dise = new Dise();
		// ?????¢?????°??????????????????
		for(int i = 0; i < 6; i++) {
			dise._values[i] = scan.nextInt();
		}
		// ?????????????????????
		String s = scan.next();
		int l = s.length();
		for(int i = 0; i<l; i++){
			String meirei = s.substring(i, i+1);
			int lx =0;
			if(meirei.equals("S")){
				dise.MoveSouth();
			}
			else if(meirei.equals("N")){
				dise.MoveNorth();
			}
			else if(meirei.equals("W")){
				dise.MoveWest();
			}
			else if(meirei.equals("E")){
				dise.MoveEast();
			}
		}
		System.out.println(dise._values[0]);
		
		
	}
}

// ??????????????????
class Dise {

	public int _values[] = new int[6];
	
	public void Dice(int values[]) {
    	for (int i = 0; i < values.length; i++)
    	this._values[i] = values[i];
	}
    
    public enum ValueType
    {
        Top,
        Front,
        Right,
        Left,
        Back,
        Bottom
    }
    
    // memo 0:top, 1:front, 2:r, 3:l, 4:back, 5under
    public void MoveWest()
    {
        int tmp = this._values[0];
        this._values[0] = this._values[2];
        this._values[2] = this._values[5];
        this._values[5] = this._values[3];
        this._values[3] = tmp;
    }
    public void MoveEast()
    {
        int tmp = this._values[0];
        this._values[0] = this._values[3];
        this._values[3] = this._values[5];
        this._values[5] = this._values[2];
        this._values[2] = tmp;
    }
    public void MoveNorth()
    {
        int tmp = this._values[0];
        this._values[0] = this._values[1];
        this._values[1] = this._values[5];
        this._values[5] = this._values[4];
        this._values[4] = tmp;
    }
    public void MoveSouth()
    {
        int tmp = this._values[0];
        this._values[0] = this._values[4];
        this._values[4] = this._values[5];
        this._values[5] = this._values[1];
        this._values[1] = tmp;
    }


}

Measured memory_bytes: 26248
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i+1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main() {
    int N,K;
    cin >> N >> K;
    int P[N];
    for(int i=0;i<N;i++){
        cin >> P[i];
    }
    double sum[1001];
    int maxindex = 0;
    sum[0] = 0;
    long s = 0;
    for(int i=1;i<=1000;i++){
        s += i;
        sum[i] = s;
    }
    double max = 0.0;
    double temp =0.0;
    for(int i=0;i<K;i++){
        temp += (double)sum[P[i]]/(double)P[i];
    }
    max = temp;
    for(int i=0;i<N-K;i++){
        //cout << i << " " << i+K << endl;
        temp -= ((double)sum[P[i]]/(double)P[i]);
        temp += ((double)sum[P[i+K]]/(double)P[i+K]);
        if(temp > max){
            max = temp;
        }
    }
    printf("%.12lf",max);




}


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

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

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

  int a, b;
  cin >> a >> b;
  if ((a * b) % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n;
    string s1,s2,s="";
    cin>>n>>s1>>s2;
    for(int i=0;i<n;i++)
    {
        s.push_back(s1[i]);
        s.push_back(s2[i]);
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys

s = sys.stdin.readline().rstrip()

def main():
    t = s
    cands = 'eraser, erase, dreamer, dream'.split(', ')
    for c in cands:
        t = t.replace(c, '')
    
    return 'YES' if not t else 'NO'

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld",&x);
int main(){
    int n; scanf("%d", &n);
    ll T[n], A[n];
    REP(i, n){
        sc(T[i])
        sc(A[i])
    }
    ll ans1 = 0, ans2 = 0, tmp = 0;
    for (int i = 0; i < n; i++){
        if (T[i] == A[i] && ans1 == ans2) continue;
        if (ans1 == 0){
            ans1 = T[i];
            ans2 = A[i];
            continue;
        }else if (ans1 % T[i] == 0 && ans2 % A[i] == 0){
            tmp = max(ans1 / T[i], ans2 / A[i]);
        }else if (ans1 % T[i] == 0){
            tmp = max(ans1 / T[i], ans2 / A[i] + 1ll);
        }else if (ans2 % A[i] == 0){
            tmp = max(ans1 / T[i] + 1ll, ans2 / A[i]);
        }else tmp = max(ans1 / T[i] + 1ll, ans2 / A[i] + 1ll);
        ans1 = T[i] * tmp;
        ans2 = A[i] * tmp;
    }
    if (ans1 == 0){
        ans1 = 1;
        ans2 = 1;
    }
    cout << ans1 + ans2 << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
from math import log10
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    x = int(input())
    cnt = 0
    initial = 100
    while initial < x:
        initial = floor(initial * 1.01)
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

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

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

template <typename T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}

template <typename T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


int main() {
	int N, M;
	bool ispo = false;
	cin >> N >> M;
	vector<vector<int>>island(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		island[a - 1].push_back(b - 1);
		island[b - 1].push_back(a - 1);
	}

	for (auto n : island[N - 1]) {
		for (auto s : island[n]) {
			if (s == 0) {
				ispo = true;
				break;
			}
		}
	}
	if (ispo) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
	return 0;
}


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

int main() {
	string s;
	int n, k;
	cin >> n >> s >> k;
	char A = s.at(k-1);
	for (int i = 0; i < n; i++) {
		if (s.at(i) != A) s.replace(i, 1, 1, '*');
	}
	cout << s << endl;
}

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

int main(){
    int A, B, C; cin >> A >> B >> C;

    int cnt5 = 0;
    if((A == 5 && B == 5 && C == 7) || (A == 7 && B == 5 && C == 5) || (A == 5 && B == 7 && C == 5)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
(n, m)=[int(x) for x in input().split()]
p=[x for x in range(1, n+1)]
h=[int(x) for x in input().split()]
hp=dict(zip(p, h))
path={i:[] for i in range(1, n+1)}
for i in range(m):
  (a, b)=[int(x) for x in input().split()]
  path[a].append(b)
  path[b].append(a)
c=0
for i, v in path.items():
  f=0
  for j in v:
    if hp[i] <= hp[j]:
      f=1
      break
  if f==0:
    c+=1
print(c)

Measured memory_bytes: 50820
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.StringTokenizer;

/**
 * Graph I - Depth First Search
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = Integer.parseInt(line);
			Graph g = new Graph(n);
			for (int i = 0; i < n; i++) {
				g.add(br.readLine());
			}
			//g.sort();
			g.dfs(0);
			for (int i = 1; i <= n; i++) {
				System.out.print(g.get(i).toString());
			}
		}
	}
}

class Graph implements Iterable<Graph.Vertex> {

	private ArrayList<Vertex> vertexs;
	private int[] indexes;

	public Graph(int n) {
		vertexs = new ArrayList<Vertex>();
		indexes = new int[n + 1];
	}

	public void add(String info) {
		int id;
		int[] edge;
		String[] _edge;

		StringTokenizer st = new StringTokenizer(info);
		id = Integer.parseInt(st.nextToken());
		_edge = new String[Integer.parseInt(st.nextToken())];
		edge = new int[_edge.length];
		for (int i = 0; i < _edge.length; i++) {
			_edge[i] = st.nextToken();
		}
		//Arrays.sort(_edge);
		for (int i = 0; i < edge.length; i++) {
			edge[i] = Integer.parseInt(_edge[i]);
		}
		vertexs.add(new Vertex(id, edge));
		indexes[id] = vertexs.size() - 1;
	}

	public void sort() {
		Collections.sort(vertexs);
		for (int i = 0; i < vertexs.size(); i++) {
			indexes[vertexs.get(i).id] = i;
		}
	}

	public Vertex get(int id) {
		return vertexs.get(indexes[id]);
	}

	public void dfs(int t) {
		for (Vertex v : vertexs) {
			t = v.dfs(t);
		}
	}

	@Override
	public Iterator<Graph.Vertex> iterator() {
		return null;
	}

	public Integer[] dict() {
		Integer[] d = new Integer[indexes.length];
		for (int i = 0; i < d.length; i++) {
			d[i] = indexes[i];
		}
		Arrays.sort(d, new Comparator<Integer>() {

			@Override
			public int compare(Integer o1, Integer o2) {
				String s1, s2;
				s1 = o1.toString();
				s2 = o2.toString();
				return s1.compareTo(s2);
			}
		});
		return d;
	}

	class Vertex implements Comparable<Vertex> {
		private int id, d, f;
		private int[] edge;

		private Vertex(int id, int[] edge) {
			this.id = id;
			d = 0;
			f = 0;
			this.edge = edge;
		}

		private int dfs(int t) {
			if (d == 0) {
				d = ++t;
				for (int i = 0; i < edge.length; i++) {
					t = get(edge[i]).dfs(t);
				}
				f = ++t;
			}
			return t;
		}

		public String toString() {
			return String.format("%d %d %d\n", id, d, f);
		}

		@Override
		public int compareTo(Vertex o) {
			String s1, s2;
			s1 = Integer.valueOf(id).toString();
			s2 = Integer.valueOf(o.id).toString();
			return s1.compareTo(s2);
		}
	}
}

Measured memory_bytes: 18604
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> s;
  double m, a;

  for (size_t i = 0; i < 1000; i++) {
    cin >> n;
    if (n == 0) break;
    s.resize(n);
    for (size_t j = 0; j < n; j++) {
      cin >> s.at(j);
    }

    m = accumulate(s.begin(), s.end(), 0.0) / s.size();
    a = sqrt(accumulate(
                 s.begin(), s.end(), 0.0,
                 [&](double acc, int elem) { return acc + pow(elem - m, 2); }) /
             n);
    cout << fixed << setprecision(10) << a << endl;
  }
}



Measured memory_bytes: 3244