akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7) 

def dfs(G,v,p):
    for next in G[v]:
        if next == p:
            continue
        counter[next]+=counter[v]
        dfs(G,next,v)
    

N,Q = map(int, input().split())
counter = [0]*N
G = [[] for _ in range(N)]

for _ in range(N-1):
    a,b = map(int, input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

#print(subtree)
for _ in range(Q):
    p,x = map(int, input().split())
    p-=1
    counter[p]+=x
dfs(G,0,-1)
counter = map(str,counter)
print(' '.join(counter))

Measured memory_bytes: 227376
//B - Traveling AtCoDeer Problem 2017/06/10
#include <bits/stdc++.h>
using namespace std;

void i_sort(int *a, int n){
    for(int i=0;i<n;++i){
        int j=i;int tmp;
        while(j>=0 && j!=n-1){
            if(a[j]>a[j+1]){tmp=a[j];a[j]=a[j+1];a[j+1]=tmp;}
            --j;
        }
    }
}

int main(){
    int n; cin >>n;
    int a[n];
    for(int i=0;i<n;++i) cin >> a[i];
    i_sort(a , n);
    cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
from functools import partial, reduce
from operator import mul
prod = partial(reduce, mul)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    x = II()
    ans = x // (6 + 5) * 2
    x %= (6 + 5)
    if 0 < x <= 6:
        ans += 1
    elif 6 < x <= 11:
        ans += 2
    return ans

print(main())


Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, x[101], y[101], h[101];

signed main() {
	cin >> n;
	rep(i,n) cin >> x[i] >> y[i] >> h[i];
	rep(i,101) rep(j,101) {
		int ha;
		rep(k,n) if (h[k]!=0) ha = h[k] + abs(i-x[k]) + abs(j-y[k]);
		bool ok = 1;
		rep(k,n) if (max(ha-abs(i-x[k])-abs(j-y[k]),0)!=h[k]) ok = 0;
		if (ok) return cout << i << ' ' << j << ' ' << ha << endl, 0;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl prime(300,INF);
  vl P(1001,1);
  ll j=0;
  rep(i,1001){
    if(i<2){
      P[i]=0;
    }
    else{
      if(P[i]==1){
        prime[j]=i;
        j++;
        ll k=2*i;
        while(k<=1000){
          P[k]=0;
          k+=i;
        }
      }
    }
  }
  ll ans=1;
  rep(i,300){
    ll cnt=0;
    if(prime[i]!=INF){
      FOR(j,1,n+1){
        ll x=j;
        while(x%prime[i]==0){
          x /=prime[i];
          cnt++;
        }
      }
    }
    ans =ans*(cnt+1)%MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main
{
  public static void main(String Args[])
  {
    Scanner in = new Scanner(System.in);
    String s = in.next();
    String t = in.next();
    int ans=0;
    for(int i = 0;i<3;i++)
    {
      if(s.charAt(i)==t.charAt(i))
        ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 20820
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        a: [usize1; n],
    }
    let mut f = vec![0i64; n];
    let mut tot: i64 = 0;
    for i in 0..n {
        tot += f[a[i]];
        f[a[i]] += 1;
    }
    for i in 0..n {
        puts!("{}\n", tot - f[a[i]] + 1);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 14972
mod = 10**9+7
n,m = map(int,input().split())

dp = [0]*(n+2)
dp[0] = 1

for i in range(m):
    dp[int(input())] = -1

for i in range(n):
    if dp[i] != -1:
        if dp[i+1] != -1:
            dp[i+1] += dp[i]
        if dp[i+2] != -1:
            dp[i+2] += dp[i]

print(dp[n]%mod)


Measured memory_bytes: 462708
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char S;
  cin >> S;
  
  if (S == 'a'){ 
    cout << "vowel" << endl;
  }
   else if (S == 'i'){
     cout << "vowel" << endl;
   }
    else if (S == 'u'){
      cout << "vowel" << endl;
    }
     else if (S == 'e'){
       cout << "vowel" << endl;
     }
      else if (S == 'o'){
            cout << "vowel" << endl;
    }
  else {
    cout << "consonant" <<endl;
  }
}

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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	string s; int n; ll ans=0,mx=0; cin >>n >>s;
	for (int i=0;i<n;i++) {
		if (s[i]=='I') ans++;
		else ans--;
		mx=max(mx,ans);
	}
	cout <<mx;
	return 0;
}
/******************************************************************************
******************************************************************************/



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

using namespace std;
struct f{
    int t;
    int num;
}f[100050];
bool cmp(struct f a,struct f b){
    return a.t<b.t;

}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&f[i].t);
        f[i].num=i+1;
    }
    sort(f,f+n,cmp);
    cout << f[0].num;
    for(int i=1;i<n;i++)
        cout << " "<<f[i].num;
    return 0;
}


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


void solve(long long N, std::string S, std::string T){
    string A;
    rep(i,N){
        A+=S[i];
        A+=T[i];
    }
    cout<<A<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(N, S, T);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> m[100005];
int pa[100005];
int d[100005];
int t[100005];// 0 rt 1 nd 2 lf
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	memset(pa,-1,sizeof(pa));
	for(int tu,tn,tv;cin>>tu;){
		cin>>tn;
		while(tn--){
			cin>>tv;
			m[tu].push_back(tv);
			pa[tu]==-1?(0):(t[tu]=1);
			t[tv]=(m[tv].size()>0?1:2);
			pa[tv]=tu;
		}
	}
	queue<int> q;
	for(int i=0;i<n;i++)if(t[i]==0)q.push(i);
	while(!q.empty()){
		int i=q.front();q.pop();
		for(int j=0;j<m[i].size();j++){
			d[m[i][j]]=d[i]+1;
			q.push(m[i][j]);
		}
	}
	for(int i=0;i<n;i++){
		printf("node %d: parent = %d, depth = %d, %s, [",i,pa[i],d[i],t[i]==0?"root":(t[i]==1?"internal node":"leaf"));
		m[i].size()>0?(printf("%d",m[i][0])):(1);
		for(int j=1;j<m[i].size();j++)printf(", %d",m[i][j]);
		printf("]\n");
	}
	return 0;
}


Measured memory_bytes: 7716
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> nums(n);
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    nums[i]=x;
  }
    vector<int> dp(n,0);
    dp[0]=0;
    dp[1]=abs(nums[0]-nums[1]);
    for(int i=2;i<n;i++)
      dp[i]=min(dp[i-2]+abs(nums[i]-nums[i-2]),dp[i-1]+abs(nums[i]-nums[i-1]));
    cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
public class Main {
	static int gcd(int a, int b) {
		if(a==0)
			return b;
		return gcd(b%a, a);
	}
	static HashSet<Integer> primeFactors(int val){
		HashSet<Integer> hset=new HashSet<>();
		for(int i=2;i<=Math.sqrt(val);i++) {
			while(val%i==0) {
				val=val/i;
				hset.add(i);
			}
		}
		if(val>2) {
			hset.add(val);
		}
		return hset;
	}
	public static void main(String args[]) {
		FastScanner in = new FastScanner();
		int n=in.nextInt();
		int a[]=in.readArray(n);
		HashSet<Integer> set=new HashSet<>();
		boolean chk=true;
		L: for(int i=0;i<n;i++) {
			HashSet<Integer> hset=new HashSet<>(primeFactors(a[i]));
			for(int val: hset) {
				if(set.contains(val)) {
					chk=false;
					break L;
				}
				set.add(val);
			}
		}
		if(!chk) {
			int result=a[0];
			for(int i=0;i<n;i++) {
				result=gcd(result, a[i]);
			}
			if(result==1) {
				System.out.println("setwise coprime");
			}
			else {
				System.out.println("not coprime");
			}
		}
		else {
			System.out.println("pairwise coprime");
		}
	}

	///////////////////////////
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


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

int main(void) {
    string S; cin >> S;
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cassert>
using namespace std;

typedef pair<int, char> PIC;
typedef pair<int, int> PII;

int main(void) {
  int N;
  while (cin >> N, N) {
    vector<PIC> lines(N);

    for (int i = 0; i < N; i++) {
      string line;
      cin >> line;

      lines[i].first = line.size() - 1;
      lines[i].second = line.back();
    }

    if (lines[0].second == '+') {
      lines.push_back(PIC(0, '0'));
    }
    
    if (lines[0].second == '*') {
      lines.push_back(PIC(0, '1'));
    }

    vector<char> operators;
    vector<PII> operands;
    
    int now_dep = 0;
    for (auto line : lines) {
      int dep = line.first;
      char sym = line.second;
    
      while (dep < now_dep) {
        char op = operators.back();
        operators.pop_back();
        int res = ((op == '+') ? 0 : 1);
     
        while (operands.back().first == now_dep) {
          int operand = operands.back().second;
          operands.pop_back();
          if (op == '+') res += operand;
          else res *= operand;
        }
       
        now_dep--;
        operands.push_back(PII(now_dep, res));
      }
    
      now_dep = dep;
     
      if (sym == '+' || sym == '*') operators.push_back(sym);
      else operands.push_back(PII(now_dep, sym - '0'));
    }

    // if (operators.size() != 0) {
    //     char op = operators.back();
    //     operators.pop_back();
    //     int res = ((op == '+') ? 0 : 1);
    //
    //     while (!operands.empty()) {
    //       int operand = operands.back().second;
    //       operands.pop_back();
    //       if (op == '+') res += operand;
    //       else res *= operand;
    //     }
    //
    //     now_dep--;
    //     operands.push_back(PII(now_dep, res));
    // }

    cout << operands[0].second << endl;
  }
  return 0;
}

Measured memory_bytes: 2976
#include <iostream>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

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

  string ans = "";

  for(int i = 0; i < N; ++i){
    ans += "0";
  }

  vector<int> s(M);
  vector<int> c(M);

  for(int i = 0; i < M; ++i){
    cin >> s[i] >> c[i];
  }

  if(M == 0){
    if(2 <= N) ans[0] = '1';
    cout << ans << endl;
    return 0;
  }

  for(int i = 0; i < M; ++i){
    if(2 <= N && s[i] == 1 && c[i] == 0){
      cout << -1 << endl;
      return 0;
    }

    ans[s[i]-1] = to_string(c[i])[0];

    for(int j = i+1; j < M; ++j){
      if(s[i] == s[j] && c[i] != c[j]){
        cout << -1 << endl;
        return 0;
      }
    }
  }

  for(int i = 0; i < M; ++i){
    if(2 <= N  && ans[0] == '0') ans[0] = '1';
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
  string S;
  string T;
  cin >> S;
  cin >> T;
  int l = S.size();
  string tmp;
  for(int i = 0; i<l; i++){
    if(S==T){
      cout << "Yes" << "\n";
      return 0;
    }
    tmp[0] = S[0];
    for(int j = 0; j<l-1; j++){
      S[j] = S[j+1];
    }
    S[l-1] = tmp[0];
  }
  cout << "No" <<"\n";
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)

N = int(input())
edge = [[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)

def dfs(v,mod):
  black,white = 1,1
  for u in edge[v]:
    if visited[u]==False:
      visited[u]=True
      b,w = dfs(u,mod)
      black *= w
      white *= b+w
  black %= mod
  white %= mod
  return black,white

mod = 10**9+7
visited = [False]*N
visited[0]=True
black,white = dfs(0,mod)
print((black+white)%mod)

Measured memory_bytes: 105448
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
string str;
int s[2000001];
void build(int id, int l, int r){
	if (l == r){
		s[id] = 0;
		s[id] |= (1 << (str[l] - 'a'));
		return;
	}
	int mid = l + (r - l) / 2;
	build(id * 2, l, mid);
	build(id * 2 + 1, mid + 1, r);
	s[id] = s[id * 2] | s[id * 2 + 1];
}
void update(int id, int l, int r, int pos, char x){
	if (l == r){
		s[id] = 0;
		s[id] |= (1 << (x - 'a'));
		return;
	}
	int mid = l + (r - l) / 2;
	if (pos <= mid){
		update(id * 2, l, mid, pos, x);
	}else{
		update(id * 2 + 1, mid + 1, r, pos, x);
	}
	s[id] = s[id * 2] | s[id * 2 + 1];
}
int query(int id, int l, int r, int L, int R){
	if (R < l || r < L){
		return 0;
	}else if (L <= l && r <= R){
		return s[id];
	}
	int mid = l + (r - l) / 2;
	return query(id * 2, l, mid, L, R) | query(id * 2 + 1, mid + 1, r, L, R);
}
int main(){
	int n, q, x, y;
	char cc;
	cin >> n >> str >> q;
	build(1, 0, n - 1);
	for (int i = 0; i < q; i++){
		scanf("%d", &x);
		if (x == 1){
			scanf("%d %c", &y, &cc);
			update(1, 0, n - 1, y - 1, cc);
		}else{
			scanf("%d %d", &x, &y);
			int t = query(1, 0, n - 1, x - 1, y - 1), count = 0;
			for (int j = 0, k = 1; j < 26; j++, k <<= 1){
				if ((t & k) != 0) count++;
			}
			printf("%d\n", count);
		}
	}
}

Measured memory_bytes: 7044
import java.util.Scanner;

public class Main {
    static final int INF = (int)Math.pow(10, 9) + 7;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] x = new int[N];
        for (int i = 0; i < x.length; i++) {
            x[i] = sc.nextInt();
        }
        int res = INF;
        for (int i = 0; i < N - K + 1; i++) {
            int l = i;
            int r = i + K - 1;
            int pattern1 = Math.abs(x[l]) + Math.abs(x[r] - x[l]);
            int pattern2 = Math.abs(x[r]) + Math.abs(x[r] - x[l]);
            int time = Math.min(pattern1, pattern2);
            res = Math.min(res, time);
        }
        System.out.println(res);
        sc.close();
    }
}

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

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

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#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(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    auto f = [](int x) {
        int res = 0;
        while (x) {
            res += x % 10;
            x /= 10;
        }
        return res;
    };
    int ans = inf;
    for (int a = 1; a < n; a++) {
        int b = n - a;
        ans = min(ans,f(a)+f(b));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <vector>

using namespace std;

int main() {
	vector <int> a;
	int n;
	scanf("%d", &n);
	int cmd, x;
	for (int i = 0; i < n; i ++) {
		scanf("%d", &cmd);
		if (cmd < 2)
            scanf("%d", &x);
        if (cmd == 0)
            a.emplace_back(x);
        if (cmd == 1)
            printf("%d\n", a[x]);
        if (cmd == 2)
            a.pop_back();
	}
	return 0;
}



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


int main(){
	int n,m,t,x;
	int a[10001] = {};
	cin >> n >> m >> t;
	a[t] = -1;
	for(int i = 0;i < n;i++){
		cin >> x;
		a[x] = 1;
		for(int j = x-m;j<x;j++){
			a[j] = 1;
		}
		if(x+m < t){
			for(int j = x;j<x+m;j++){
				a[j] = 1;
			}
		}
		else{
			for(int j = x;j < t;j++){
				a[j] = 1;
			}
		}
	}
	int res = 0;
	for(int i = 0;i <= t;i++){
		if(a[i] == 0)res++;
	}
	cout << res <<endl;
	return 0;
}

Measured memory_bytes: 3132
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    int c[n];
    int v[n];
    for(int i=0;i<n;i++) cin >> v[i];
    for(int i=0;i<n;i++) cin >> c[i];
    int t[n];
    for(int i=0;i<n;i++) t[i]=v[i]-c[i];
    int ans=0;
    for(int i=0;i<n;i++){
        if(t[i]>0)ans+=t[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]
n,m = map(int,input().split())
#初期化
#根なら-size,子なら親の頂点
par = [-1]*n
count = 0
graph = []
for i in range(m):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    graph.append([x,y])
for i in range(m):
    p = [j for j in range(n)]
    par = [-1]*n
    for j in range(m):
        if i != j:
            unite(graph[j][0],graph[j][1])
    if not((-1)*n in par):
        count+=1
print(count)
        

Measured memory_bytes: 3192
#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

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

#define ft first
#define sd second

using namespace std;

typedef pair<int, int> pii;

class Line{
public:
    int m;
    vector<pii> p;
    void normalize(){
        int dx = p[0].first, dy = p[0].second;
        rep(i,m){
            p[i].ft -= dx;
            p[i].sd -= dy;
        }

        if(p[1].ft==0){
            if(p[1].sd>0){
                reep(i,1,m){
                    p[i] = pii(p[i].sd, -p[i].ft);
                }
            }else{
                reep(i,1,m){
                    p[i] = pii(-p[i].sd, p[i].ft);
                }
            }
        }else if(p[1].ft<0){
            reep(i,1,m){
                p[i] = pii(-p[i].ft, -p[i].sd);
            }
        }
    }
};


int main(){
    int n;
    while(cin>>n,n){
        vector<Line> line(n+1);
        rep(i,n+1){
            int m;
            cin >> m;
            line[i].m = m;
            while(m--){
                int x,y;
                cin >> x >> y;
                line[i].p.push_back(pii(x,y));
            }
            line[i].normalize();

            if(i>0){
                Line rline = line[i];
                reverse(rline.p.begin(), rline.p.end());
                rline.normalize();
                if(line[0].p==rline.p || line[0].p==line[i].p){
                    cout << i << endl;
                }
            }
        }
        cout << "+++++" << endl;
    }
}

Measured memory_bytes: 1204
using System;
using System.Collections.Generic;//
public class A{
    public static void Main(){
        string b = Console.ReadLine();//Read()だとint型といわれる
        Dictionary<string, string> dic = new Dictionary<string, string>();
        
        dic.Add("A","T");
        dic.Add("T","A");
        dic.Add("C","G");
        dic.Add("G","C");
        
        Console.WriteLine(dic[b]);
    }
}


Measured memory_bytes: 11104
#include <bits/stdc++.h>
#define int long long
using namespace std;

template <typename T> class BIT {
public:
  int num;
  vector<T> dat;

  // N:1-indexd
  BIT(int N, T val) : num(N) {
    dat.resize(N);
    fill(dat.begin(), dat.end(), val);
  }

  int query(int i) {
    int res = 0;
    while (i > 0) {
      res += dat[i];
      i -= i & -i;
    }
    return res;
  }

  void update(int i, T x) {
    while (i <= num) {
      dat[i] += x;
      i += i & -i;
    }
  }
};

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    a[i] -= K;
  }

  vector<int> sum(N, 0);
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      sum[i] = a[i];
    } else {
      sum[i] = sum[i - 1] + a[i];
    }
  }

  vector<int> p = sum;
  map<int, int> mp;
  sort(p.begin(), p.end());
  p.erase(unique(p.begin(), p.end()), p.end());
  for (int i = 1; i <= p.size(); i++) {
    mp[p[i - 1]] = i;
  }

  BIT<int> bit(p.size() + 1, 0);
  set<int> st;

  int ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    st.insert(sum[i]);

    auto itr = st.lower_bound(sum[i]);
    itr--;
    ans += bit.query(p.size()) - bit.query(mp[*(itr)]);

    if (sum[i] >= 0) {
      ans++;
    }

    bit.update(mp[sum[i]], 1);
  }

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



Measured memory_bytes: 20216
#include<stdio.h>
int main(){
  int a[4],i,ans;
  for(i=1;i<=3;i++)
    scanf("%d",&a[i]);
  ans=abs(a[1]-a[2]);
  if(ans<abs(a[1]-a[3]))ans=abs(a[1]-a[3]);
  if(ans<abs(a[2]-a[3]))ans=abs(a[2]-a[3]);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i, a, b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_back
 
using namespace std;
 
const int mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long int LINF = 1LL<<56;

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


int N;
double p[3003];
double dp[3003][3003];

int main(){

	cin >> N;
	rep(i, 0, N) cin >> p[i];
	
	rep(i, 0, N+1) dp[i][(N+1)/2] = 1.0;
	
	for(int i=N-1; i>=0; i--){
		for(int j=N/2; j>=0; j--){
			dp[i][j] = dp[i+1][j]*(1.0-p[i]) + dp[i+1][j+1]*(p[i]);
		}
	}
	
	printf("%.10lf\n", dp[0][0]);
	
	
	
	return 0;
}

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

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

    sort(a.begin(), a.end());

    ll ans1 = a[a.size() - 1];
    ll ans2;
    ll diff = 10e16;
    rep(i, n) {
        if (abs(ans1 - a[i] * 2) < diff) {
            diff = abs(ans1 - a[i] * 2);
            ans2 = a[i];
        }
    }

    cout << ans1 << " " << ans2 << endl;
}

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

int main() {
  string c;
  int n, a=0, b=0, i;
  cin >> n;
  cin >> c;
  
  for(int i=0; i<n; i++) {
    if(c[i] == 'R')a++;
  }
  if(a==0||a==n)cout << 0;
  else {
    for(int i=0;i<a;i++) {
      if(c[i] == 'W')b++;
    }
    cout << b;
  }
}


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

bool a[105][105];

int main(){
#ifdef _DEBUG
	freopen("in" , "r", stdin );
	freopen("out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int w, h, n; cin >> w >> h >> n;
	for(int i = 0; i < n; i++){
		int x, y, t; cin >> x >> y >> t;
		if(t == 1){
			for(int i = 1; i <= x; i++)
			for(int j = 1; j <= h; j++) a[i][j] = 1;
		}
		if(t == 2){
			for(int i = x + 1; i <= w; i++)
			for(int j = 1; j <= h; j++) a[i][j] = 1;
		}
		if(t == 3){
			for(int i = 1; i <= w; i++)
			for(int j = 1; j <= y; j++) a[i][j] = 1;
		}
		if(t == 4){
			for(int i = 1; i <= w; i++)
			for(int j = y + 1; j <= h; j++) a[i][j] = 1;
		}
	}
	int ans = 0;
	for(int i = 1; i <= w; i++)
	for(int j = 1; j <= h; j++)
		if(!a[i][j]) ans++;
	cout << ans << '\n';
}


Measured memory_bytes: 3484
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

int main(){
    int n;
    int sum = 0;
    int s1 = 0;
    cin >> n;
    vector<int> w(n);
    for(int i = 0; i < n;i++){
        int temp;
        cin >> temp;
        w.at(i) = temp;
        sum += temp;
    }
    set<int> weight;
    for(int i = 0;i < n;i++){
        s1 += w.at(i);
        int s2 = sum-s1;
        int ans = s1-s2;
        if(ans < 0)ans = -ans;
        weight.insert(ans);
    }
    cout << *weight.begin() << endl;

}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import Data.Array.Unboxed
import Data.Array.ST
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Monad.ST
import Data.STRef 
import Data.List
import Data.Char
import qualified Data.Map.Strict as M

main :: IO ()
main = do
    [a,b,h,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let theta = (pi /6.0)*((fromIntegral h)-(11/60)*(fromIntegral m))
    print $ sqrt $ (fromIntegral a)^2 + (fromIntegral b)^2 - 2*(fromIntegral a)*(fromIntegral b)*(cos theta)

Measured memory_bytes: 4356
X, Y, Z, K = map(int, input().split())

list_cake_1 = list(map(int, input().split()))
list_cake_2 = list(map(int, input().split()))
list_cake_3 = list(map(int, input().split()))

list_cake_1 = sorted(list_cake_1, reverse=True)
list_cake_2 = sorted(list_cake_2, reverse=True)
list_cake_3 = sorted(list_cake_3, reverse=True)

list_total_sum = []

for i, cake_1 in enumerate(list_cake_1, 1):
	for j, cake_2 in enumerate(list_cake_2, 1):
		for k, cake_3 in enumerate(list_cake_3, 1):
			if i*j*k > K:
				break
			list_total_sum.append(cake_1 + cake_2 + cake_3)

for element in sorted(list_total_sum, reverse=True)[:K]:
	print(element)

Measured memory_bytes: 9564
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

ll md(string& s, int m) {
	ll res = 0;
	ll cur = 1;
	for(int i  = s.length() - 1; i>=0; --i) {
		if(s[i]=='1') {
			res = res+cur;
			res %= m;
		}
		cur = cur*2;
		cur %= m;
	}
	return res;
}

int c(string& s) {
	int ans = 0;
	for(int i = 0; i<int(s.length()); ++i) {
		ans += s[i]=='1';
	}
	return ans;
}

ll bin(ll a, ll b, ll m) {
	ll res = 1;
	while(b) {
		if(b&1) res = res*a;
		res %= m;
		b >>=1;
		a *= a;
		a %= m;
	}
	return res%m;
}

void solve() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	int cnt = c(s);
	ll m1 = md(s, max(cnt-1, 1));
	ll m2 = md(s, cnt+1);
	for(int i = 0; i<n; ++i) {
		//cout<<i<<endl;
		if(s[i] == '1') {
			if(cnt-1<=0) {
				cout<<0<<endl;
				continue;
			}
			ll temp = (m1 - bin(2, n-i-1, (cnt-1)) + (cnt-1)) % (cnt-1); 
			ll res = 1;
			while(temp!=0) {
				temp %= __builtin_popcountll(temp);
				res++;
			}
			cout<<res<<endl;
		}
		else 
		{
			ll temp = (m2 + bin(2, n-i-1, (cnt+1)) + (cnt+1)) % (cnt+1); 
			ll res = 1;
			while(temp!=0) {
				//cout<<temp<<endl;
				temp %= __builtin_popcountll(temp);
				res++;
			}
			cout<<res<<endl;
		}
	}
}	

int32_t main() 
{
    fastio
    int t;
    t = 1; //cin>>t;
    while(t--) {
		solve();
	}
}


Measured memory_bytes: 3776
#include <iostream>

using namespace std;

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

int main(){
  int x;
  std::cin >> x;

  for(int num = x; true; num++){
    if(is_prime(num)){
      std::cout << num << '\n';
      return 0;
    }
  }

  std::cerr << "exception!" << '\n';

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  init();
  ll N, T;
  cin >> N >> T;

  ll mini_cost = INF;
  rep(i, N) {
    ll c, t;
    cin >> c >> t;
    if (t <= T) {
      if (mini_cost > c) {
        mini_cost = c;
      }
    }
  }
  if (mini_cost == INF) {
    COUT("TLE");
  } else {
    COUT(mini_cost);
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,ans=0,k;
    scanf("%lld%lld",&k,&n);
    ll a[n],dif[n];
    rep(i,0,n){
        scanf("%lld",&a[i]);
    }
    sortup(a,n);
    rep(i,1,n){
        dif[i]=a[i]-a[i-1];
    }
    dif[0]=a[0]+k-a[n-1];
    // ll ma=0,d=INF;
    // rep(i,0,n-1){
    //     if(ma<dif[i]){
    //         ma=dif[i];
    //         d=dif[i];
    //     }
    // }
    // rep(i,0,n){
    //     printf("%lld ",dif[i]);
    // }
    ans=k-maxn(n,dif);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3964
import java.util.Scanner;
import java.util.Arrays;

public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      long X = scan.nextLong();//初期座標
      long K = scan.nextLong();//移動する回数
      long D = scan.nextLong();//一回で移動する距離
      
      X = Math.abs(X);
      long straight = Math.min(K,X / D);
      long Y = X - (straight * D);
      K -= straight;
      
      if(K > 0)
        if(K % 2 == 1)
          Y = Math.abs(Y - D);
       
      System.out.println(Y);
    }
}

Measured memory_bytes: 35708
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
while 1:
    m,f,r = LI()
    if m==f==r==-1:
        break
    if m==-1 or f==-1:
        print('F')
    elif 80<=m+f:
        print('A')
    elif 65<=m+f:
        print('B')
    elif 50<=m+f or 50<=r:
        print('C')
    elif 30<=m+f:
        print('D')
    else:
        print('F')


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

int main(){
    int N;
    cin>>N;
    vector<int> vt(N,0);
    int count=0;
    for(int i=0;i<N;i++){
        cin>>vt[i];
        if(vt[i]!=(i+1)){
            count++;
        }
    }
    if(count<=2){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
int T,x;
double ans;
int read()
{
	int x=0,f=1;
	char k=getchar();
	while(k<'0'||k>'9')
	{
		if(k=='-') f=-1;
		k=getchar();
	}
	while(k>='0'&&k<='9')
	{
		x=x*10+k-'0';
		k=getchar();
	}
	return x*f;
}
int main()
{
	T=read();
	x=read();
	ans=(double)T*1.0000000000/x;
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<bitset>
#include<vector>
#define ll long long
#define ull unsigned long long
#define db double
#define si short int
using namespace std;
ll read(){
    ll ans=0,fh=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')fh=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        ans=ans*10+c-'0';
        c=getchar();
    }
    return ans*fh;
}
ll a,b,ans=1;
int main(){
	a=read();
	b=read();
	if(a>b)swap(a,b);
	for(int i=a;i<=b;i++){
		if(i<0)ans*=-1;
		if(i==0){
			ans=0;break;
		}
	}
	if(ans>0)cout<<"Positive";
	if(ans<0)cout<<"Negative";
	if(ans==0)cout<<"Zero";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };

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

  int k,a,b; cin >> k >> a >> b;
  for(int i = a; i <= b; ++i) {
    if(i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
      cout << "NG" << endl;
      return 0;
}


Measured memory_bytes: 3652
N = int(input())
MOD = 10 ** 9 + 7

if N == 1:
  ans = 0
elif N == 2:
  ans = 2
else:
  ans = 10 ** N
  ans %= MOD
  ans += 8 ** N
  ans %= MOD
  ans -= 2 * 9 ** N
  ans %= MOD

print(ans)


Measured memory_bytes: 10660
N,K=map(int,input().split())
D=list(map(int,input().split()))
A=[0,1,2,3,4,5,6,7,8,9]
for i in range(0,K):
    A.remove(D[i])
A=sorted(A)
B=A
B.append(0)
ans=0
M=str(N)
L=len(M)
if A[0]==0:
    ans+=111111*A[1]
else:
    ans+=111111*A[0]

if L==5:
    for q in range(0,11-K):
        for w in range(0,10-K):
            for e in range(0,10-K):
                for r in range(0,10-K):
                    for t in range(0,10-K):
                        for y in range(0,10-K):
                            if ans>=1000*(100*B[q]+10*A[w]+A[e])+100*A[r]+10*A[t]+A[y]>=N:
                                ans=1000*(100*B[q]+10*A[w]+A[e])+100*A[r]+10*A[t]+A[y]
elif L==4:
    for q in range(0,11-K):
        for w in range(0,10-K):
            for e in range(0,10-K):
                for r in range(0,10-K):
                    for t in range(0,10-K):
                        if ans>=100*(100*B[q]+10*A[w]+A[e])+10*A[r]+A[t]>=N:
                            ans=100*(100*B[q]+10*A[w]+A[e])+10*A[r]+A[t]
elif L==3:
    for q in range(0,11-K):
        for w in range(0,10-K):
            for e in range(0,10-K):
                for r in range(0,10-K):
                    if ans>=10*(100*B[q]+10*A[w]+A[e])+A[r]>=N:
                        ans=10*(100*B[q]+10*A[w]+A[e])+A[r]
elif L==2:
    for q in range(0,11-K):
        for w in range(0,10-K):
            for e in range(0,10-K):
                if ans>=100*B[q]+10*A[w]+A[e]>=N:
                    ans=100*B[q]+10*A[w]+A[e]
else:
    for q in range(0,11-K):
        for w in range(0,10-K):
            if ans>=10*B[q]+A[w]>=N:
                ans=10*B[q]+A[w]

print(ans)


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out( 
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cout << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    stringstream ss; ss << H;
    cout << args[idx] << "- " << ss.str() << ", ";
    debug_out(args, idx + 1, LINE_NUM, T...);
}

void doit(){
	ll x;
	cin >> x;
	if(x >= 30)cout << "Yes" << nl;
	else cout << "No" << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;


int n, k;
const int N = 200010;
double p[N], acc[N];
int main(void) {
  cin >> n >> k;
  REP(i, 0, n) {
    int v;
    cin >> v;
    p[i] = (v + 1) / 2.0;
    acc[i + 1] = acc[i] + p[i];
  }
  double ma = 0.0;
  REP(i, 0, n - k + 1) {
    ma = max(ma, acc[i + k] - acc[i]);
  }
  printf("%.15f\n", ma);
}


Measured memory_bytes: 3328
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] C = new int[N-1];
    int[] S = new int[N-1];
    int[] F = new int[N-1];
    for (int i = 0; i < N-1; i++) {
      C[i] = sc.nextInt();
      S[i] = sc.nextInt();
      F[i] = sc.nextInt();
    }
    
    for (int i = 0; i < N-1; i++) {
      int t = 0;
      for (int j = i; j < N-1; j++) {
        if (t < S[j]) {
          t += S[j] - t;
        }
        t += t % F[j] == 0 ? 0 : F[j] - t % F[j];
        t += C[j];
      }
      System.out.println(t);
    }
    System.out.println(0);
  }
}

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

//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

        signed main() {
    cout<<fixed<<setprecision(15);
      int a,b;
      cin>>a>>b;cout<<max(a+b,max(a-b,a*b));
      
      }

        


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char s[] = sc.next().toCharArray();
		char t[] = sc.next().toCharArray();
		int cnt = 0;
		for(int i = 0; i < s.length; i++) {
			if(s[i] != t[i])
				cnt++;
		}
		System.out.println(cnt);
	}

}


Measured memory_bytes: 41992
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x==0){
        int d=n/x;
        cout<<d*t<<"\n";
    }else{
        int s=n/x+1;
        cout<<s*t<<"\n";
    }
return(0);
}

Measured memory_bytes: 3632