akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main(void) {
	long long n, t, ans;
	cin >> n;
	
	cin >> ans;
	for (int i = 1; i < n; ++i){
		cin >> t;
		ans = lcm(ans, t);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n=list(map(int,input().split()))
score=list(map(int,input().split()))
s=input()

def rscore(ss):
  if ss=='r':
    return score[2]
  elif ss=='s':
    return score[0]
  elif ss=='p':
    return score[1]

result=0
flg=[]
for i in range(n[1]):
  result+=rscore(s[i])
  flg.append(True)
for i in range(n[1],len(s)):
  if(s[i-n[1]]==s[i] and flg[i-n[1]]):
    flg.append(False)
    continue
  else:
    flg.append(True)
    result+=rscore(s[i])
print(result)

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

int main(){
  int n,a;
  cin >> n >> a;
  
  string ans = "No";
  for(int i = 0; i <= a; i++){
  if((n-i)%500 == 0) {ans = "Yes"; break;}
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static final int OFS = 8000;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        char[] as = A.toCharArray();
        char[] bs = B.toCharArray();
        char[] cs = C.toCharArray();
        List<Boolean> failAB, failBC, failCA;
        failAB = new ArrayList<>(16005);
        fillFalse(failAB, 16005);
        failBC = new ArrayList<>(16005);
        fillFalse(failBC, 16005);
        failCA = new ArrayList<>(16005);
        fillFalse(failCA, 16005);
        fillFailArr(as, bs, failAB);
        fillFailArr(bs, cs, failBC);
        fillFailArr(cs, as, failCA);
        int ans = Integer.MAX_VALUE;
        for(int bofs= -4000; bofs<=4000; bofs++){
            for(int cofs = -4000; cofs <= 4000; cofs ++){
                if(!failAB.get(bofs+OFS) && !failCA.get(-cofs+OFS) && !failBC.get(cofs-bofs + OFS)){
                    int L = Math.min(Math.min(0, bofs), cofs);
                    int R = Math.max(Math.max(A.length(), bofs+B.length()), cofs+C.length());
                    ans = Math.min(ans, R-L);
                }
            }
        }
        System.out.println(ans);

    }

    private static void fillFalse(List<Boolean> fail, int size){
        for(int i=0;i<size;i++){
            fail.add(false);
        }
    }

    private static void fillFailArr(char[] a, char[] b, List<Boolean> failAB){
        for(int i=0;i<a.length;i++)
            for(int j=0;j<b.length;j++)
                if(!match(a[i], b[j]))
                    failAB.set(i-j+OFS, true);
    }

    private static boolean match(char a, char b){
        return (a=='?' || b == '?' || a==b);
    }
}


Measured memory_bytes: 24004
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n, sum = 0;
  string s;
  cin >> n;
  s = to_string(n);
  for (int i = 0; i < s.length(); i++){
    string numstr = s.substr(i, 1);
    sum += atoi(numstr.c_str());
  }
  if (n % sum == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

int main()
{
	int l, r;
	long long k = 2019;

	cin >> l >> r;

	for (long long i = l; i < r; i++) {
		for (long long j = i + 1; j <= r; j++) {
			k = min(k, i * j % 2019);
			if (k == 0)
				break;
		}
		if (k == 0)
			break;
	}

	cout << k << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
typedef long long ll;
ll C[N][4];
int main(){
	ll n,k;
	scanf("%lld%lld",&n,&k);
	for (int i=1;i<=n;i++){
		C[i][0]=1; C[i][1]=i;
		C[i][2]=i*(i-1)/2; C[i][3]=i*(i-1)*(i-2)/6;
	}
	ll ans=0;
	ll m=n/k;
	ans=m*m*m;
	if (k&1){printf("%lld\n",ans); return 0;}
	ll p=k/2; m=0;
	for (int i=1;i<=n;i++)
	if (i%k==p) m++;
	ans+=m*m*m;
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N, 0);
  int tmp;
  for (int i = 2; i <= N; i++) {
    cin >> tmp;
    A.at(tmp-1)++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << A.at(i) << endl;
  }
   
  return 0; 
  
}
  

Measured memory_bytes: 3960
#include<stdio.h>
int main(void)
{
	int a[110]={0},b[110]={0},c[110]={0};
	int n,d,i,x,y,z,h=0;
	scanf("%d",&n);
	scanf("%d",&x);
	for(i=0;i<x;i++){
		scanf("%d",&d);
		a[d]=1;
	}
	scanf("%d",&y);
	for(i=0;i<y;i++){
		scanf("%d",&d);
		b[d]=1;
	}
	scanf("%d",&z);
	for(i=0;i<z;i++){
		scanf("%d",&d);
		c[d]=1;
	}
	for(i=1;i<=n;i++){
		if((a[i]==1&&b[i]==1&&c[i]==1)||(a[i]==0&&b[i]==1&&c[i]==1)||(a[i]==0&&b[i]==0&&c[i]==1)) h++;
	}
	printf("%d\n",h);
	return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

bool check_prime(int a) {
	for (int i=2; i*i <= a; i++) {
		if (a%i==0) return false;
	}
	return true;
}

int main(int, char**) {
	int a = 100010;
	vector<bool> P;
	vector<int> S;
	P.push_back(false);
	P.push_back(false);
	P.push_back(true);// 2
	S.push_back(0);
	S.push_back(0);
	S.push_back(0);
	int cnt = 0;
	for (int i=3; i<a; i++) {
		if (check_prime(i)) {
			P.push_back(true);
			if (P[(i + 1)/2]) cnt++;
		} else {
			P.push_back(false);
		}
		S.push_back(cnt);
	}
	int q; cin >> q;
	for (int i=0; i<q; i++) {
		int l, r; cin >> l >> r;
		cout << S[r] - S[l - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1144
import sys
input = sys.stdin.buffer.readline
N, M = map(int, input().split())
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1] * (n + 1)
    self.rnk = [0] * (n + 1)

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

  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return 
    elif self.rnk[x] > self.rnk[y]:
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1

  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  def Count(self, x):
    return -self.root[self.Find_Root(x)]
uf = UnionFind(N + M)
for i in range(N):
  l = list(map(int, input().split()))
  for j in range(1, l[0] + 1):
    uf.Unite(i + 1, l[j] + N)
p = -1
for i in range(1, N + 1):
  if uf.Find_Root(i) == i and p == -1:
    p = i
  elif p == -1:
    p = uf.Find_Root(i)
  elif uf.Find_Root(i) != p:
    p = -1
    break
  elif uf.Find_Root(i) == -1 and p != -1:
    p = -1
    break
if p == -1:
  print("NO")
else:
  print("YES")

Measured memory_bytes: 61272
/*
クッキー→円→クッキーは2動作なので2枚以上儲からないならひたすら叩いてる方がいい
仮に儲かるなら最初にA枚到達後はひたすら変換作業を繰り返すのが最高
*/

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int K, A, B;
  cin >> K >> A >> B;
  
  if(B < A + 2)
  {
    cout << 1 + K << endl;
    return 0;
  }

  // 最初にA枚に到達するまでに叩く回数
  long firstmove = A - 1;
  // 繰り返しの回数
  long repetition = (K - firstmove) / 2;
  // 最後余ったので叩く回数
  long lastmove = K - firstmove - repetition * 2;
  
  cout << A + repetition * (B - A) + lastmove << endl;
  return 0;
}

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

typedef long long ll;

ll K,A,B;

//１回しか操作できないとしたら、
// ビスケットを叩き１枚増やすのが最大
//２回操作することでどうなるかというと、
//（１）持っているビスケットを２回たたいて２枚増やすか
//（２）ビスケットA枚を１円に交換してB枚に交換する
//のどちらか
// （２）のときはB-A枚増える
// B-A >2 と B-A <2で変わってくる

int main() {
  cin >> K >> A >> B;
  ll ans;
 
  if (K <= A) {
    ans = 1 + K;
  } else if (B - A <= 2) {
    ans = 1 + K;
  } else if ((K - A + 1) % 2 == 0){
    ans = A + (B - A)*(K - A + 1)/2;
  } else {
    ans = A + (B - A)*(K - A)/2 + 1;
  }

  cout << ans << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
int n, p[N * N], dist[N][N], has[N][N];
void upd(int x, int y) {
	int nd = dist[x][y] + has[x][y];
	for (int k = 0; k < 4; k++) {
		int nx = x + dx[k], ny = y + dy[k];
		if (nx >= 1 && ny >= 1 && nx <= n && ny <= n && dist[nx][ny] > nd) {
			dist[nx][ny] = nd;
			upd(nx, ny);
		}
	}
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n * n; i++) scanf("%d", &p[i]);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			dist[i][j] = min(min(i, n - i + 1), min(j, n - j + 1)) - 1;
			has[i][j] = 1;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n * n; i++) {
		int x = (p[i] - 1) / n + 1;
		int y = (p[i] - 1) % n + 1;
		ans += dist[x][y];
		has[x][y] = 0;
		upd(x, y);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 25740
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, K;
  string S;
  cin >> N >> S >> K;
  char target = S[K - 1];
  for (int i = 0; i < N; i++) {
    if (S[i] != target) {
      cout << "*";
    } else {
      cout << target;
    }
  }
  cout << endl;
  return 0;
}

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

int main() {
  //入力M
  int a;	//a
  int b;	//b
  int x;	//切り上げ後の平均値
  int y;	//あまり
  
  cin >> a >> b; 
  y = ( a + b ) % 2; 
  x = (a + b)/2 + y ;
  
  cout << x << endl; 
}

Measured memory_bytes: 256
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: f64
    }
    println!("{}", r * 2f64 * std::f64::consts::PI);
}


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

int main() {
  int N;
  cin >> N ;
  int ans =0;
  
  for(int i = 0; i < N; i++){
    int l,r;
    
    cin >> l >> r;
    
    ans += ((r-l)+1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let N = xs[0];
   let A = xs[1];
   let B = xs[2];
   let C = xs[3];
   
   let count = 0;
   
   for(let i=0; i<N; i++){
     if(A[i]==B[i]&&A[i]==C[i]){
     count +=0;
     }else if(A[i]==B[i]||A[i]==C[i]||B[i]==C[i]){
     count +=1;
     }else{
     count +=2;
     }
   }
   console.log('%d',count);

}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <ext/pb_ds/assoc_container.hpp>
  #include <bits/stdc++.h>
  using namespace std;
  using namespace __gnu_pbds;
  template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define TRACE
  #ifdef TRACE
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  template <typename Arg1>
  void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
  }
  template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  }
  #else
  #define trace(...) 
  #endif
  template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
  template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
  template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
  typedef long long int ll;
  const ll mod =1e18;
  const int maxn = 300002;
  #define endl '\n'
  #define int ll
  #define ld long double
  #define all(x) (x).begin(),(x).end()


  int32_t main()
  { 
    IOS
  
    int n,m,d;
    cin>>n>>m>>d;
    cout<<setprecision(15)<<fixed;
    ld a = (m-1)*2*(n-d)*powl((ld)n,-2);
    if(d == 0) a/=2.0;
    cout<<a<<endl;





    
    

    

    
    
    
  }

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

ans = 0

i_list = []
for i in range(n-2):
    if s[i] not in i_list:
        i_list.append(s[i])
    elif len(i_list) == 10:
        break
    else:
        continue
    j_list = []
    for j in range(i+1, n-1):
        if s[j] not in j_list:
            j_list.append(s[j])
        elif len(j_list) == 10:
            break
        else:
            continue
        x = len(set(s[j+1:]))
        ans += x

print(ans)

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

//桁和
int digit_sum(int n) {
    int dig;
    int sum = 0;
    while(n) {
        dig = n % 10;
        sum += dig;
        n /= 10;
    }
    return sum;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    
    int ans = 0;
    rep(i, n){
        int sum = digit_sum(i+1);
        if(a <= sum && sum <= b){
            ans += i+1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long LL;

int main() {
	LL n, ans = 1;
	cin >> n;
	vector<LL> a(n);
	for (LL i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (LL i = 0; i < n; ++i) {
		if (log10(ans) + log10(a[i]) > 18) {
			ans = -1;
			break;
		}
		ans *= a[i];
		if (ans > (LL)1e18) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4008
from sys import stdin
from copy import deepcopy
from collections import namedtuple
#stdin = open("input.txt")

def bubbleSort(C, N):
    A = deepcopy(C)
    flag = True
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if A[j].value < A[j-1].value:
                A[j], A[j-1] = A[j-1], A[j]
                flag = True
    return A

def selectionSord(C, N):
    A = deepcopy(C)
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j].value < A[minj].value:
                minj = j
        A[i], A[minj] = A[minj], A[i]
    return A

if __name__ == "__main__":
    Card = namedtuple("Card", ["char", "value"])
    N = int(stdin.readline())
    A = [Card(item[0], int(item[1])) for item in stdin.readline().split()]
    
    bubble = bubbleSort(A, N)
    print(*[item.char+str(item.value) for item in bubble])
    
    bubble_value = [item.value for item in bubble]
    bubble_stable = True
    for v in set(bubble_value):
        bubble_char = [item for item in bubble if item.value==v]
        original_char = [item for item in A if item.value==v]
        if bubble_char != original_char:
            bubble_stable = False
    print("Stable" if bubble_stable else "Not stable")
        
        
    
    selection = selectionSord(A, N)
    print(*[item.char+str(item.value) for item in selection])
    
    selection_value = [item.value for item in selection]
    selection_stable = True
    for v in set(selection_value):
        selection_char = [item for item in selection if item.value==v]
        original_char = [item for item in A if item.value==v]
        if selection_char != original_char:
            selection_stable = False
    print("Stable" if selection_stable else "Not stable")
    
    


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

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

const ll mod = 1e9+7;
template< int mod >
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
      return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inv();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
    
  ModInt inv() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
  
  static int get_mod() { return mod; }
};
 
using mint = ModInt<mod>;

mint nCx(ll n, ll x){
  mint ret = 1;

  for(ll i = n; i >= n - x + 1; i--){
    mint tmp = i % mod;
    ret *= tmp;
  }
  for(ll i = x; i >= 1; i--){
    mint tmp = i % mod;
    ret *= tmp.inv();
  }

  return ret;
}

int main(){
  cout << setprecision(10);

  ll n,a,b;
  cin >> n >> a >> b;

  mint x1 = 2;

  mint ans = x1.pow(n) - 1 - nCx(n, a) - nCx(n, b);
  cout << ans << endl;
}


Measured memory_bytes: 256
#https://atcoder.jp/contests/agc026/submissions/10971924を参考にした

from collections import defaultdict
n = int(input())
s = input()
ls = s[:n:]
rs = s[:n-1:-1]
d = defaultdict(int)

def full_research(sa,r,b,t):
    if t == n:
        d[(r,b)] += 1
        return
    full_research(sa,r+sa[t],b,t+1)
    full_research(sa,r,b+sa[t],t+1)

full_research(ls,"","",0)
dl = d
d = defaultdict(int)
full_research(rs,"","",0)

ans = 0
for dlk,dlv in dl.items():
    ans += dlv*d[dlk]

print(ans)


Measured memory_bytes: 150520
def cal(a, b, c):
    z = max(a, b, c)
    return (3*z-a-b-c)//2


a, b, c = map(int, input().split())
odd_count = 0
for _ in a, b, c:
    if _ % 2 == 1:
        odd_count += 1

if odd_count in [0, 3]:
    print(cal(a, b, c))

elif odd_count == 1:
    if a % 2 == 0:
        a += 1
    if b % 2 == 0:
        b += 1
    if c % 2 == 0:
        c += 1
    print(cal(a, b, c)+1)

else:
    if a % 2 == 1:
        a += 1
    if b % 2 == 1:
        b += 1
    if c % 2 == 1:
        c += 1
    print(cal(a, b, c)+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main() {
    int d, t, s;
    cin >> d >> t >> s;
    puts(t * s >= d ? "Yes" : "No");
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;
template <typename T>
T sq(T x){
  return x * x;
}

signed main (){
  int X,N;
  cin >> X >> N;
if(N == 0){
cout << X << endl;
return 0;

}
  vector<int> p(200);
  rep(i,N){
    int a;
    cin >> a;
    p.at(a)++;
  }
  rep(i,200){
    int Xp = X + i;
    int Xm = X - i;
    if(p.at(Xm) == 0){
      cout << Xm << endl;
      return 0;
    }
    if(p.at(Xp) == 0){
      cout << Xp << endl;
      return 0;
    }

  }
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if (s=="SUN")
        cout<<7;
    else if (s=="MON")
        cout<<6;
    else if (s=="TUE")
        cout<<5;
    else if (s=="WED")
        cout<<4;
    else if (s=="THU")
        cout<<3;
    else if (s=="FRI")
        cout<<2;
    else
        cout<<1;

    return 0;

}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] n = { 0, 0, 0 };
            int temp = 0;
            for(int i = 0; i < 3; i++)
            {
                n[i] = int.Parse(str[i]);
            }
            for (int i = 0; i < 2; i++)
            {
                if (n[i] > n[i+1])
                {
                    temp = n[i];
                    n[i] = n[i+1];
                    n[i+1] = temp;
                }
            }
            for (int i = 0; i < 2; i++)
            {
                if (n[i] > n[i + 1])
                {
                    temp = n[i];
                    n[i] = n[i + 1];
                    n[i + 1] = temp;
                }
            }
            Console.WriteLine("{0} {1} {2}", n[0], n[1], n[2]);
        }
    }
}

Measured memory_bytes: 9164
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	map<char,int> mp;
	string s;cin>>s;
	bool flag=false;
	rep(i,s.size()){
		mp[s[i]]++;
		if(mp[s[i]]>=2) flag=true;
	}
	if(flag) cout<<"no"<<endl;
	else cout<<"yes"<<endl;
}

Measured memory_bytes: 256
package main

import (
        "bufio"
        "fmt"
        "os"
)

func solution(n, m int, a, b []int) (string, []int) {
        const MAX = 1 << 31
        g := make([][]int, n)
        for i := 0; i < m; i++ {
                v, w := a[i]-1, b[i]-1
                g[v] = append(g[v], w)
                g[w] = append(g[w], v)
        }
        queue := make([]int, 0, n)

        visit := make([]int, n)
        for i := range visit {
                visit[i] = MAX
        }

        prev := make([]int, n)
        for i := range prev {
                prev[i] = -1
        }

        queue = append(queue, 0)
        visit[0] = 0
        prev[0] = 0

        for len(queue) > 0 {
                cur := queue[0]
                queue = queue[1:]
                for _, next := range g[cur] {
                        nd := visit[cur] + 1
                        if visit[next] <= nd {
                                continue
                        }
                        visit[next] = nd
                        prev[next] = cur
                        queue = append(queue, next)
                }

        }

        for _, t := range prev {
                if t == -1 {
                        return "No", []int{}
                }
        }
        for i := 1; i < n; i++ {
                prev[i]++
        }
        return "Yes", prev[1:]
}

func main() {
        r := bufio.NewReader(os.Stdin)
        var n, m int
        fmt.Fscan(r, &n, &m)
        a := make([]int, 0, m)
        b := make([]int, 0, m)
        for i := 0; i < m; i++ {
                var ta, tb int
                fmt.Fscan(r, &ta, &tb)
                a = append(a, ta)
                b = append(b, tb)

        }
        ans, s := solution(n, m, a, b)
        fmt.Println(ans)
        if s != nil {
                for _, t := range s {
                        fmt.Println(t)
                }
        }
}

Measured memory_bytes: 19980
from collections import deque
from collections import defaultdict

N, M = map(int, input().split())
graph = defaultdict(list)

# defaultdictにグラフ構造を格納
for _ in range(M):
    a, b = map(lambda x: int(x), input().split())
    graph[a].append(b)
    graph[b].append(a)

# 訪れたかどうかを判定。
visited = [False] * (N + 1)

# 0は捨て番、1は更新されないようにvisitedにしておく
visited[0] = True
visited[1] = True

# start地点を指定
que = deque([1])

while que:
    # 幅優先なのでFIFO。最初はスタート地点をpop
    node = que.popleft()

    # popしたノードを訪れていなければ、ノード番号を格納し、キューにノードをappend
    for n in graph[node]:
        if not visited[n]:
            visited[n] = node
            que.append(n)

# 判定結果はindex:2以降でスライスしたもの
visited = visited[2:]

if all(visited):
    print("Yes")
    print(*visited, sep="\n")
else:
    print("No")

Measured memory_bytes: 40140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;cin>>N>>K;
  vector<int> a(K);
  for(int i=0;i<K;i++){
    if(i<K-1){
      a.at(i)=1;
      N--;
    }
    else a.at(i)=N;
  }
  cout<<a.at(K-1)-a.at(0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, a, cnt[100001];
 
int main(int argc, char **argv) {
	cin >> n;
	CLEAR(cnt);
	REP(i, n) {
		cin >> a;
		if (a > 100000) continue;
		++cnt[a];
	}
	ll res = 0;
	REP(i, 100001) if (cnt[i] >= i) res += i;
	cout << (n - res) << endl;
	return 0;
}
 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 998244353;

     signed main(){
     
char o;
cin>>o;
for(char i='a';i<='z';i++)if(i==o){
   cout<<'a'<<endl;
   return 0;
}
cout<<'A'<<endl;

     }


 


 






    





      

        


Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    int a,b;
    cin >> a >> b;
    cout << ((a+b)%2==0?(a+b)/2:(a+b)/2+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main(){
    cin>>S;
    N = S.size();
    ll lb = (N+1)/2, ub = N+1;
    while(ub - lb > 1){
        ll cen = (ub + lb)/2;
        bool ok = true;
        char c = S[N - cen];
        reps(i, N - cen, cen){
            if(c != S[i]) ok = false;
        }
        (ok ? lb : ub) = cen;
    }
    cout<<lb<<endl;
}

Measured memory_bytes: 512
#define INF 1000000
int graph[101][101],n,c,d;
void warshall_floyd(void);
int min(int,int);

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){
    for(i=1;i<=n;i++)
      for(j=1;j<=n;j++)
	graph[i][j]=i==j?0:INF;
    
    for(;k>0;k--)
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
  }
  return 0;
}

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){return x<y?x:y;}

Measured memory_bytes: 0
#include <stdio.h>
#define MAX 100000
#define NIL -1

struct Node
{
  int p,q,r;
};

struct Node T[MAX];

int n,m,D[MAX];

int getdepth(int u){
  int d = 0;
  while(T[u].p!=NIL){
    u = T[u].p;
    d++;
  }
  return d;
}

void print(int u)
{
  int i,A;

  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,D[u]);

  if(T[u].p == NIL){
    printf("root, ");
  }
  else if(T[u].q == NIL){
    printf("leaf, ");
  }
  else{
    printf("internal node, ");
  }

  printf("[");

  for(i=0,A=T[u].q; A!=NIL; i++,A=T[A].r){
    if(i) printf(", ");

    printf("%d",A);
  }
  printf("]");
  printf("\n");
}

int main()
{
  int i,j,d,v,A,q;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    T[i].p = NIL;
    T[i].q = NIL;
    T[i].r = NIL;
  }

  for(i=0; i<n; i++){
    scanf("%d%d",&v,&d);
    for(j=0; j<d; j++){
      scanf("%d",&A);
      if(j == 0)
        T[v].q = A;
      else
        T[q].r = A;

      q = A;
      T[A].p = v;
    }
  }

  m = 0;

  for(i=0; i<n; i++){
    D[i] = getdepth(i);
    if(D[i] > m)
      m = D[i];
  }

  for(i=0; i<n; i++)
    print(i);

  return 0;
}


Measured memory_bytes: 3416
#include <stdio.h>

int main(void) {
	int a[3],i,j,tmp;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	for(i=0;i<3;i++){
		for(j=0;j<i;j++){
			if(a[i]>a[j]){
				tmp=a[i];
				a[i]=a[j];
				a[j]=tmp;
			}
		}
	}
	printf("%d",a[0]-a[2]);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    
    while(A>0&&C>0) {
        C-=B;
        if(C<=0) {
            cout << "Yes" << endl;
            break;
        }
        
        A-=D;
        if(A<=0) {
            cout << "No" << endl;
            break;
        }
    }
    
    
    
}


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

long long n, m, w[100001], v[100001], dp[101][100001];

int main() {
	cin>>n>>m;
	for (int i=1; i<=n; i++) cin>>w[i]>>v[i];
	for (int i=1; i<=n; i++) {
		for (int j=0; j<=m; j++) {
			if (i==1 and j>=w[i]) dp[i][j] = v[i];
			else if (j>=w[i]) dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
			else dp[i][j] = dp[i-1][j];
		}
	}
	cout<<dp[n][m]<<endl;
}

Measured memory_bytes: 79360
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		int n = sc.nextInt();
		double t = sc.nextLong();
		double a = sc.nextLong();
		int idx = 0;
		double min = Integer.MAX_VALUE;
		for(int i = 1; i <= n; i++) {
			double d = Math.abs(a - (t - sc.nextLong() * 0.006));
			if(min > d) {
				min = d;
				idx = i;
			}
		}
		System.out.println(idx);
	}
	Main(){doIt();}
	public static void main(String[] args) {
		new Main();
	}

}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    map<int,int> mp;
    REP(i,N) {
        int A;
        cin >> A;
        if(mp.count(A) == 0) mp[A] = 0;
        mp[A]++;
    }

    // counting
    int cnt = 0;
    for(const auto &itr: mp) {
        if (itr.second%2 == 1) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


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

using namespace std;

#define N 200000
#define MAX 100000000
#define PI 3.14159265358979323846

int x[N + 1];
int y[N + 1];
int p[N + 1];

// Binary search (note boundaries in the caller)
int CeilIndex(vector<int> &v, int l, int r, int key) {
    while (r-l > 1) {
    int m = l + (r-l)/2;
    if (v[m] >= key)
        r = m;
    else
        l = m;
    }
 
    return r;
}
 
int LongestIncreasingSubsequenceLength(vector<int> &v) {
    if (v.size() == 0)
        return 0;
 
    vector<int> tail(v.size(), 0);
    int length = 1; // always points empty slot in tail
 
    tail[0] = v[0];
    for (size_t i = 1; i < v.size(); i++) {
        if (v[i] < tail[0])
            // new smallest value
            tail[0] = v[i];
        else if (v[i] > tail[length-1])
            // v[i] extends largest subsequence
            tail[length++] = v[i];
        else
            // v[i] will become end candidate of an existing subsequence or
            // Throw away larger elements in all LIS, to make room for upcoming grater elements than v[i]
            // (and also, v[i] would have already appeared in one of LIS, identify the location and replace it)
            tail[CeilIndex(tail, -1, length-1, v[i])] = v[i];
    }
 
    return length;
}

bool compasc(int a, int b){
	return x[a] < x[b];
}

bool compdesc(int a, int b){
	return x[a] > x[b];
}

int main(){
	int xi, yi, xf, yf, minx, miny, maxx, maxy, lis, n, i;
	vector<int> v;
	double ans;

	scanf("%d%d%d%d", &xi, &yi, &xf, &yf);
	scanf("%d", &n);

	// Bounding box
	minx = min(xi, xf);
	miny = min(yi, yf);
	maxx = max(xi, xf);
	maxy = max(yi, yf);

	// Points
	for (i = 0; i < n; i++){
		scanf("%d%d", x + i, y + i);
		p[i] = i;
	}

	// Initial is always lowest
	if (yi > yf){
		swap(xi, xf);
		swap(yi, yf);
	}

	// Sorting by X
	if (xf > xi){
		sort(p, p + n, compasc);
	}
	else{
		sort(p, p + n, compdesc);
	}

	// Points inside the bounding box
	for (i = 0; i < n; i++){
		if (minx <= x[p[i]] and x[p[i]] <= maxx and miny <= y[p[i]] and y[p[i]] <= maxy){
			v.push_back(y[p[i]]);
		}
	}

	ans = (double)((maxx - minx) + (maxy - miny)) * 100.0;
	
	// Straight line
	if (xi == xf or yi == yf){
		if (!v.empty()){
			ans += 10.0 * (PI - 2.0);
		}
	}
	else{
		lis = LongestIncreasingSubsequenceLength(v);

		if (lis == maxy - miny + 1 or lis == maxx - minx + 1){
			ans += (double)(lis - 1) * (5.0 * PI - 20.0) + 10.0 * (PI - 2.0);
		}
		else{
			ans += (double)lis * (5.0 * PI - 20.0);
		}
	}
	
	printf("%.13lf\n", ans);

	return 0;
}

Measured memory_bytes: 4212
#include <stdio.h>
int main(void)
{
	int i,j,h,w;
	while(1){
		scanf("%d %d",&h,&w);
		if(h==0 && w==0) break;
		else if(h>2 && w>2){
			for(j=0;j<w;j++)
				printf("#");
			printf("\n");
			for(i=0;i<(h-2);i++){
				printf("#");
				for(j=0;j<(w-2);j++){
					printf(".");
				}
				printf("#\n");
			}
			for(j=0;j<w;j++)
				printf("#");
			printf("\n\n");
		}
		else{
			for(i=0;i<h;i++){
				for(j=0;j<w;j++)
					printf("#");
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
using namespace std;
char str[10];
int get(int x)
{
	printf("%d\n",x);
	fflush(stdout);
	scanf("%s",&str);
	int ret=0;
	if(str[0]=='F')ret=1;
	else if(str[0]=='M')ret=-1;
	return ret;
}
int main()
{
	int n;
	scanf("%d",&n);
	int l=0,r=n;
	int s=get(0),t=s;
	if(s==0)return 0;
	while(1)
	{
		int m=(l+r)/2;
		int g=get(m);
		if(g==0)return 0;
		if(m%2==l%2){
			if(s==g)l=m,s=g;
			else	r=m,t=g;
		}
		else{
			if(s!=g)	l=m,s=g;
			else	r=m,t=g;
		}
	}
	return 0;
}

Measured memory_bytes: 852
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, P> PP;
struct edge {int to, cost;};

signed main() {
	int a[3]; cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	int ans = 114514;
	do {
		ans = min(ans, abs(a[1] - a[0]) + abs(a[2] - a[1]));
	} while (next_permutation(a, a + 3));
	cout << ans << endl;
	}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    pii p[m];
    rep(i, m) scanf("%d%d", &p[i].fi, &p[i].se), --p[i].se;
    sort(p, p+m);
    int L[n], R[n];
    rep(i, n) L[i] = R[i] = i;
    rep(i, m){
        L[p[i].se+1] = L[p[i].se];
        R[p[i].se] = R[p[i].se+1];
    }
    rep(i, n){
        printf("%d", R[i]-L[i]+1);
        printf("%c", i==n-1 ? '\n' : ' ');
    }
}


Measured memory_bytes: 5532
#include <bits/stdc++.h>
#define mp make_pair
#define pii pair<int,int>
typedef long long ll;
using namespace std;
string str,s[30005];
int k,p,tk,cnt;
int main(){
	ios::sync_with_stdio(false);
	cin>>str;
	cin>>k;
	for (int i=0;i<str.size();i++){
		string now="";
		for (int j=0;j<5 && (i+j)<int(str.size());j++){
			now+=str[i+j];
			s[p++]=now;
		}
	}
	sort(s,s+p);
	tk=0;
	for (int i=0;i<p;i++){
		if (i==0 || s[i]!=s[i-1]) tk++;
		if (tk==k){
			cout<<s[i];
			return 0;
		}
	}
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n;
    cin >> n;

    // 処理
    // 出力
    cout << "ABC" << n << endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    # input
    n = int(input())

    num = int(n//1.08)
    if int(num*1.08)==n:
        print(num)
    elif int((num+1)*1.08)==n:
        print(num+1)
    else:
        print(":(")


    # calc


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans = 0;
  int o = 0;
  for(int i = 0;i<3;i++){
    if(s[i]=='R') o++;
    else o = 0;
    ans = max(o,ans);
  }
  cout << ans;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

signed main() {
	double a, b, h, m;
	cin >> a >> b >> h >> m;
	
	double theta1 = h * 30 + m * 0.5;
	double theta2 = m * 6;
	
	double theta = theta1 - theta2;
	if (theta < 0) theta = -theta;
	if (theta > 180) theta = 360 - theta;
	
	double PI = 3.14159265358979;
	theta = theta * (PI / 180);
	
	double l = a * a + b * b - 2 * a * b * cos(theta);
	printf("%.14f\n", sqrt(l));
	return 0;
}

Measured memory_bytes: 4228
from math import atan, radians, degrees

a, b, x = map(int, input().split())
h = x/(a**2)
he = b - h

if 2*h >= b:
    ans = degrees(atan((2*b-2*h)/a))
    print(ans)

else:
    ans = degrees(atan(b**2/(2*h*a)))
    print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
int flag = 0;
const int V = 10;
struct edge { int to, cost; };
std::vector<edge>v[100];
typedef std::pair<int, int>p;

int main() {
	int n, t[100010], x[100010], y[100010];
	std::cin >> n;
	x[0] = 0, y[0] = 0, t[0] = 0;
	for (int i = 1;i <= n;i++) {
		std::cin >> t[i] >> x[i] >> y[i];
	}
	int flag = 0;
	for (int i = 1;i <= n;i++) {
		int sum = x[i] - x[i - 1] + y[i] - y[i - 1];
		if (sum > t[i] - t[i - 1]) {
			std::cout << "No" << std::endl;
			flag = 1;
			break;
		}
		else {
			if (sum != t[i] - t[i - 1]) {
				if ((t[i] - t[i - 1] - sum) % 2 == 1) {
					std::cout << "No" << std::endl;
					flag = 1;
					break;
				}
			}
		}
	}
	if (flag == 0) {
		std::cout << "Yes" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(){
	char a[105];
	scanf("%[^\n]",a);
	for(int i=1;;i++){
		if (a[i-1]=='\0'){
			printf("Yes\n");
			break;

		}
		if(i%2==0 && a[i-1]=='R'){
			printf("No\n");
			break;
		}
		if(i%2!=0 && a[i-1]=='L'){
			printf("No\n");
			break;
		}
	}

	return 0;
}


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

using namespace std;

#define pii pair < int, int >

int l;
vector < pii > graph[22];

int main() {
    scanf("%d", &l);
    int m = 0;
    for (int i = 2; i < 20; i++) {
        graph[i].push_back(pii(i+1, 1 << (19-i)));
        graph[i].push_back(pii(i+1, 0));
        m += 2;
    }

    int aux = 0;
    for (int i = 0; i < 19; i++) {
        if (l & (1 << i)) {
            graph[1].push_back(pii(20-i, aux));
            m++;
            aux += 1 << i;
        }
    }

    if (l & (1 << 19)) {
        graph[1].push_back(pii(2, aux));
        graph[1].push_back(pii(2, aux + (1 << 18)));
        m += 2;
    }

    printf("20 %d\n", m);
    for (int i = 1; i < 20; i++)
        for (pii v : graph[i])
            printf("%d %d %d\n", i, v.first, v.second);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int x, y, z = 0;
	scanf("%d %d %d\n", &x, &y, &z);
	//printf("%d %d %d\n", x, y, z);
	if ((x>y) && (x>z)){//xが一番大きい場合分け
		if(y>=z){
			printf("%d %d %d\n", z, y, x);
		}else if(z>y){
			printf("%d %d %d\n", y, z, x);
		}
	}
	else if((y>x) && (y>z)){//yが一番大きい場合分け
		if(x>=z){
			printf("%d %d %d\n", z, x, y);
		}else if(z>x){
			printf("%d %d %d\n", x, z, y);
		}
	}
	else if((z>x) && (z>y)){//zが一番大きい場合分け
		if(x>=y){
			printf("%d %d %d\n", y, x, z);
		}else if(y>x){
			printf("%d %d %d\n", x, y, z);
		}
	}
	return 0;
}



Measured memory_bytes: 2044
//https://atcoder.jp/contests/dp/tasks/dp_k
//K - Stones
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-2.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N,K; cin>>N>>K;
    ll mina=INT64_MAX;
    vector<ll> an(N);
    for(auto&& a:an){
        cin>>a;
        chmin(mina,a);
    }
    vector<vector<ll>> dp(K+1,vector<ll>(2,0)); //残り数,player0,1
    FOR(i,1,K+1){
        FOR(p,0,2){ //player
            ll wl=0;
            ll op=p==0?1:0;
            FOR(ap,0,N){
                auto a=an.at(ap);
                if(i>=a){
                    wl |= !dp[i-a][op];
                }
            }
            dp[i][p]=wl;
        }
    }
    dump(dp);
    cout<<(dp[K][0]?"First":"Second")<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define GO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
const int Max = 5e5 + 5;
const int Mod = 1e9 + 7;

ll GCD(ll a, ll b) {
	while (a) b %= a, swap(a, b);
	return b;
}
ll LCM(ll a, ll b) {
	return a * b / GCD(a, b);
}


ll EGCD(ll a, ll b, ll& x, ll& y)
{
	if (a == 0) {
		x = 0;
		y = 1;
		return b;
	}
	ll x1, y1;
	ll G = EGCD(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return G;
}
int Solve(ll a, ll b, ll c, ll& x, ll& y)
{
	ll G = EGCD(a, b, x, y);
	if (c % G != 0)
		return -1;
	ll GG = c / G;
	x *= GG;
	y *= GG;
	ll k = x / (b / G);
	x -= b / G * k;
	y += a / G * k;
	if (x < 0)
	{
		ll k = -(x / (b / G));
		k++;
		x += b / G * k;
		y -= a / G * k;
	}
	return 1;
}



int main()
{
	GO;
	int n, m;
	cin >> n >> m;
	ll start = 0, freq = 1;
	while (n--)
	{
		ll x;
		cin >> x;
		ll a, b;
		int res = Solve(x, freq, start - x / 2, a, b);
		if (res == -1 || a > m/x)
		{
			cout << 0 << endl;
			return 0;
		}
		start = a * x + x / 2;
		freq = LCM(freq, x);
	}
	cout << (m - start) / freq + 1 << endl;
	return 0;
}

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

int main() {
    int n, T;
    cin >> n >> T;
    int t[n];
    rep(i, n) cin >> t[i];

    ll ans = T;
    for (int i = 1; i < n; i++) {
        if (t[i] - t[i-1] < T) ans += t[i] - t[i-1];
        else ans += T;
    }

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


Measured memory_bytes: 1024