akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let a:String= read();
    let b:String = read();
    let mut ch1 = a.chars();
    let mut ch2 = b.chars();

    let mut counter = 0;
    for i in 0..a.len(){
        if ch1.next().unwrap() != ch2.next().unwrap() {
            counter += 1;
        }
    }
    print!("{}", counter);
}


Measured memory_bytes: 2612
n, m = gets.chomp.split(" ").map(&:to_i)
# arr = [*1..n]
# i = 1
 #nozoku = []


# nozoku.each do |j|
#     arr.delete(j)
# end

suuchi = Array.new(n+1,0)

m.times do |i|
    a = gets.chomp.to_i
    #nozoku << a
    suuchi[a] = -1
end
#p nozoku
i = 1
until i-1 == n
    #if nozoku.include?(i)
     #   suuchi[i] = 0
        # puts "UU"
        # p suuchi
    if i >= 3 && suuchi[i] == 0
        # puts "UU"
        # p  suuchi[i-1] 
        # p suuchi[i-2]
        suuchi[i] = [suuchi[i-1],0].max + [suuchi[i-2],0].max
    elsif i >= 3 && suuchi[i] == -1
        suuchi[i] = 0
    elsif i == 1 && suuchi[1] == 0
        suuchi[i] = 1
    elsif i == 1 && suuchi[1] == -1
        suuchi[i] = 0
    elsif i == 2 && suuchi[1] == 1 && suuchi[2] == 0
        suuchi[i] = 2
    elsif i == 2 && suuchi[1] == 0  && suuchi[2] == 0
        suuchi[i] = 1
    elsif i == 2 && suuchi[1] == 0  && suuchi[2] == -1
        suuchi[i] = 0
    end
    
    if suuchi[i] >= 1000000007
        suuchi[i] = suuchi[i] % 1000000007
    end
    #p suuchi
    i += 1
end
#p suuchi.pop % 1000000007
puts suuchi[-1]
# end

Measured memory_bytes: 15044
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


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

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}



bool mode;
long long  H, W, ans, N, A,X,Y, num,sum,B,now, mx[4000],my[4000];
string s,t,tt,ss;

int main() {
	cin >> X >> Y;
	ans = 1;
	mode = true;
	while (mode) {
		if (X > Y / 2) {
			break;
		}
		X *= 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
int n, a[100], b[100], c[100], res;
int main() {
    DAU
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= n; ++i)
        cin >> b[i];
    for (int i = 1; i < n; ++i)
        cin >> c[i];
    a[0] = n;
    for (int i = 1; i <= n; ++i) {
        res += b[a[i]];
        if (a[i] == a[i-1] + 1)
            res += c[a[i-1]];
    }
    cout << res;
    PLEC
}


Measured memory_bytes: 3620
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, M; cin >> N >> M; int K; cin >> K;
    bool data[N][M];
    F0R(i, N) F0R(j, M) {
        char C; cin >> C; data[i][j] = C == '1';
    }

    int ans = N*M+1;
    F0R(mask, (1 << (N-1))) {
        vi comps;
        comps.pb(0);
        F0R(i, N-1) {
            if (mask & (1 << i)) comps.pb(i+1);
        }
        comps.pb(N);
        int cur = sz(comps) - 2;
        int sum[sz(comps) - 1]; F0R(i, sz(comps) - 1) sum[i] = 0;
        F0R(j, M) {
            int add[sz(comps) - 1]; F0R(i, sz(comps) - 1) add[i] = 0;
            F0R(c, sz(comps) - 1) {
                FOR(i, comps[c], comps[c+1]) {
                    if (data[i][j]) add[c]++;
                }
            }
            F0R(i, sz(comps) - 1) {
                if (add[i] > K) goto bad;
            }
            F0R(i, sz(comps) - 1) {
                if (add[i]+sum[i] > K) {
                    F0R(c, sz(comps) - 1) {
                        sum[c] = 0;
                    }
                    cur++;
                    goto done;
                }
            }

            done:
            ;
            F0R(i, sz(comps) - 1) sum[i] += add[i];
        }
        ans = min(ans, cur);
        bad:
        ;
    }

    cout << ans << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int Q;
  cin >> Q;
  int l[Q], r[Q], e[100001], a[100001];
  for (int i = 0; i < Q; i++){
    cin >> l[i] >> r[i];
  }
  e[1] = 0;
  for (int i = 2; i < 100001; i++){
    e[i] = 1;
  }
  

  for (int i = 2; i <= 100000; i++) {
    if (e[i] == 1) {
      for (int j = 2 * i; j <= 100000; j++) {
        if (j % i == 0) {
          e[j] = 0;
        }
      }
    }
  }

  int s = 0;
  for (int i = 1; i <= 100000; i++){
    if (e[i] == 1 && e[(i+1)/2] == 1) s++;
    a[i] = s;
  }

  for (int i = 0; i < Q; i++){
    printf("%d\n", a[r[i]] - a[l[i]-1]);
  }
}


Measured memory_bytes: 5184
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define SORT(x) sort((x).begin(),(x).end())
int main(void){
    
    string s;
    cin >>s;
    int cnt=0;
    int MX=0;
    
    for(int i=0; i<(int)s.size(); i++){
        if((s[i]=='A')||(s[i]=='T')||(s[i]=='C')||(s[i]=='G')){
            cnt++;
            MX=max(cnt,MX);
        }else{
            cnt=0;
        }
    }
    
    cout <<MX <<endl;
}

Measured memory_bytes: 256
package main;

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

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

func main() {
	sc := NewScanner()
	F := sc.NextIntArray()
	t := make([]int, F[0])
	count := 0
	for i := 0; i < F[0]; i++ {
		t[i] = sc.NextInt()
		if !(F[1] <= t[i] && t[i] < F[2]) {
			count++
		}
	}
	fmt.Println(count)

}



Measured memory_bytes: 640
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  string s; readV(s);
  string t; readV(t);

  auto sf = s.map!(si => si == 'A' ? 1 : 2).array;
  auto tf = t.map!(ti => ti == 'A' ? 1 : 2).array;

  auto sc = sf.cumulativeSum;
  auto tc = tf.cumulativeSum;

  int q; readV(q);
  foreach (_; 0..q) {
    int a, b, c, d; readV(a, b, c, d); --a; --c;
    writeln(sc[a..b]%3 == tc[c..d]%3 ? "YES" : "NO");
  }
}

class CumulativeSum(T)
{
  size_t n;
  T[] s;

  this(T[] a)
  {
    n = a.length;
    s = new T[](n+1);
    s[0] = T(0);
    foreach (i; 0..n) s[i+1] = s[i] + a[i];
  }

  T opSlice(size_t l, size_t r) { return s[r]-s[l]; }
  size_t opDollar() { return n; }
}
auto cumulativeSum(T)(T[] a) { return new CumulativeSum!T(a); }


Measured memory_bytes: 5528
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
 int n,m;
 cin>>n>>m;
 priority_queue<int> a;
 rep(i,n){
   int x;
   cin>>x;a.push(x);
   }
 rep(i,m){
   int x =a.top();
   x/=2;
   a.pop();
   a.push(x);
  }
 ll sum =0;
 rep(i,n){
   sum+=a.top();
   a.pop();
  }
 cout<<sum<<endl;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll popcount(ll n){
    ll ret=0;
    while(n>0){
        ret+=n%2;
        n/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int h,a;cin>>h>>a;
    int ans=h/a;
    if(h%a!=0)ans++;
    cout<<ans<<endl;
}



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

int main(void){
    int N; cin >> N;
    vector<int> A;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        A.push_back(a);
    }

    int button=0;
    int cnt=0;
    int endcnt=0;

    while(button!=1 and endcnt<N+1){
        button=A[button];
        button--;
        cnt++;
        endcnt++;
    }

    if(endcnt==N+1) cout << -1 << endl;
    else cout << cnt << endl;

    return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;


int main() {
    int n, m;
    cin >> n >> m;
    if(n % 2 == 0) {
        REP(i, m) {
            if(n - (2 * i + 2) > (n / 2)) {
                cout << i+1 << " " << n - (i+1) << endl; 
            } else {
                cout << i+1 << " " << n - (i+2) << endl;
            }
        }
    } else {
        REP(i, m) {
            cout << i + 1 << " " << n - i << endl; 
        }
    }

    return 0;
}

Measured memory_bytes: 3628
import java.util.*;
 public class Main {
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int A = sc.nextInt();
     int B = sc.nextInt();
     int C = sc.nextInt();
     if ((A+B+C)!=17) {
       System.out.println("NO");
     } else if(A != 7 && B != 7 && C != 7) {
       System.out.println("NO");
     } else if(A != 5 && B != 5 && C != 5) {
       System.out.println("NO");
     } else {
       System.out.println("YES");
     };
   };
 };

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

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define mp make_pair
#define F first
#define S second


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(long long* a,long long n,long long val){
	for(long long i=0;i<n;i++)
		a[i]=val;
}
vll adj[100001];
void dfs(ll* a,ll u,ll par){
    ll i;
    
    rep(i,0,adj[u].size()){
        if(adj[u][i]==par)
            continue;
        a[adj[u][i]]=a[u]+1;
        dfs(a,adj[u][i],u);
    }
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
    ll n,u,v;
    cin>>n>>u>>v;
    ll x,y;
    
    rep(i,0,n-1){
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }ll a[n+1],b[n+1];
    a[u]=0;
    b[v]=0;
    dfs(a,u,0);
    dfs(b,v,0);
    ll ans=0;
    rep(i,1,n+1){
        if(b[i]>ans&&a[i]<b[i]){
            ans=b[i];
        }
    }cout<<ans-1<<endl;
	return 0;
}

Measured memory_bytes: 13824
#include<stdio.h>


#include<string.h>
int main()
{
    char ch[1000];
    char arr[1000];
    int a,b,c,i=0,j=0,k=0,l=0,m=0,n=0;
    scanf("%s",ch);
    scanf("%s",arr);
    j=strlen(ch);
    while(i<j)
    {
     
    if(ch[i]!=arr[i])
     {
      l++;
     }
     i++;
    }
    if(l<=0)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

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

int main (){
  double N, M;
  cin >> N >> M;
  vector <double> vote(N);
  for (int i = 0; i < N; i++) cin >> vote.at(i);
  double total = 0;
  for (int i = 0; i < N; i++) total += vote.at(i);
  double count = 0;
  for (int i = 0; i < N; i++) {
    if (vote.at(i) >= total*(1/(4*M))) count ++;
  }
  if (count >= M) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, u, v;
  cin >> n >> u >> v;
  u--, v--;
  vector<vl> g(n);
  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<vl> d(2, vl(n, -1));
  rep(k, 2) {
    queue<ll> q;
    q.push(u);
    d[k][u] = 0;
    while(!q.empty()) {
      int i = q.front();
      q.pop();
      for(auto v : g[i]) {
        if(d[k][v] != -1) continue;
        d[k][v] = d[k][i] + 1;
        q.push(v);
      }
    }
    swap(u, v);
  }
  ll mx = 0;
  rep(i, n) if(d[0][i] < d[1][i]) mx = max(mx, d[1][i]);
  cout << mx - 1 << endl;
}

Measured memory_bytes: 11540
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        var lines = Console.ReadLine();
        var S = lines.ToCharArray();
        int max = 0;
        int count = 0;
        for (int i = 0; i < S.Length; i++)
        {
            if (S[i] == 'R')
            {
                count++;
            }
            else
            {
                count = 0;
            }
            max = Math.Max(count, max);
        }
        System.Console.WriteLine(max);
    }
}


Measured memory_bytes: 25860
// In the name of God

#include <bits/stdc++.h>

using namespace std;

long long a[2*(int)1e5+5], h[2*(int)1e5+5], dp[2*(int)1e5+5];
long long t[1<<25];

void update(int node, int left, int right, int point, long long val) {
	if(left == right) {
		t[node] = max(t[node], val);
		return;
	}
	if(left > right) return;
	if(point > right || point < left) return;
	int mid = (left + right) / 2;
	update(2*node, left, mid, point, val);
	update(2*node+1, mid+1, right, point, val);
	t[node] = max(t[2*node], t[2*node+1]);
}

long long query(int node, int left, int right, int l, int r) {
	if(left > right) return 0;
	if(left >= l && right <= r) return t[node];
	if(l > right || r < left) return 0;
	int mid = (left + right) / 2;
	long long p1 = query(2*node, left, mid, l, r);
	long long p2 = query(2*node+1, mid+1, right, l, r);
	return max(p1, p2);
}



int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for(int i=0; i<n; i++) cin >> h[i];
	for(int i=0; i<n; i++) cin >> a[i];
	dp[0] = a[0];
	update(1, 0, 1<<20, h[0], a[0]);
	for(int i=1; i<n; i++) {
		dp[i] = a[i];
		dp[i] = max(dp[i], a[i] + query(1, 0, 1<<20, 0, h[i]-1) );
		update(1, 0, 1<<20, h[i], dp[i]);
	}
	long long ans = 0;
	for(int i=0; i<n; i++) ans = max(ans, dp[i]);
	cout << ans;
	return 0;
}


Measured memory_bytes: 13568
// ALDS1_4Truck.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>
#include<vector>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	vector<int>A(n + 1);
	int right = 0;
	int left = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> A.at(i);
		right += A.at(i);
	}
	A.at(n) = right;
	int mid;
	while (left < right) {
		vector<int>car(k);
		int count = 0;
		mid = (left + right) / 2;
		for (int j = 0; j < k; j++)
		{
			while (car.at(j) <= mid)
			{
				car.at(j) += A.at(count);
				count++;
			}
			count--;
			car.at(j) -= A.at(count);
		}
		//cout << left << " " << right << " " << mid << "  ";
		//cout << car.at(0) << " " << car.at(1) << " " << endl;

		if (count == n)
		{
			right = mid;
		}
		else
		{
			left = mid + 1;
		}
	}
	cout << left << endl;
}



Measured memory_bytes: 3608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();

            if (a + b == 15) {
                out.println("+");
            } else if (a * b == 15) {
                out.println("*");
            } else {
                out.println("x");
            }
        }

    }
}



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

#define debug(x) cerr << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

ll exp(ll a, ll b)
{
  ll ans = 1;
  while(b)
  {
    if(b & 1)
      ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}

const int maxn = 3e6 + 10;
ll fat[maxn], inv[maxn];

ll C(int n, int k)
{
  if(n < k) 
    return 0;
  if(n < 0 || k < 0) 
    return 0;
  return (((fat[n] * inv[k]) % mod) * inv[n - k]) % mod;
}

void initFactorials()
{
  fat[0] = 1;
  inv[0] = 1;
  for(int i = 1; i < maxn; i++)
  {
    fat[i] = (i * fat[i-1]) % mod;
    inv[i] = exp(fat[i], mod - 2);
  }
}
map<ll, int>mapa;

int solve(ll g)
{
  map<ll, int>ans;
  for(ll i = 2;  i * i <= g; i++)
  {
    while(g % i == 0)
    {
      ans[i]++;
      g /= i;
    }
  }
  if(g!= 1)
    ans[g] = 1;
  return ans.size() + 1;
}


int main()
{
  ios::sync_with_stdio(0);
  ll a, b;
  cin >> a >> b;
  ll g = __gcd(a,b);
  cout << solve(g) << endl;

  return 0;
}

Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	N := getStdinInt64()
	A := getStdinIntArr64()
	var i int64 = 0
	var max int64 = 0

	// 最大値を求める
	for i = 0; i < N; i++ {
		if A[i] > max {
			max = A[i]
		}
	}

	// 素数を求める
	isPrime := make([]bool, max+1)
	for i := 2; i < len(isPrime); i++ {
		isPrime[i] = true
	}
	isPrime[0] = false
	isPrime[1] = false
	for i := 2; i < len(isPrime); i++ {
		if isPrime[i] {
			for j := i * 2; j < len(isPrime); j += i {
				isPrime[j] = false
			}
		}
	}

	// 個数
	countMap := make(map[int64]int64)
	for _, a := range A {
		countMap[a]++
	}

	// 1が1個、または1が2個以上の場合
	if countMap[1] == 1 {
		// x % 1 == 0のみ
		fmt.Printf("%d\n", 1)
		return
	}
	if countMap[1] >= 2 {
		// 全てが x % 1 == 0 になってしまう
		fmt.Printf("%d\n", 0)
		return
	}

	var ans int64 = 0
	for _, a := range A {
		if countMap[a] >= 2 {
			// x % x == 0 になってしまう
			continue
		}
		if isPrime[a] {
			// 素数なので明らか
			ans++
			continue
		}

		// 約数を求める
		fac := make([]int64, 0)
		for i = 2; i*i <= a; i++ {
			if a%i == 0 {
				fac = append(fac, i) // 因数
				if i*i != a {
					fac = append(fac, a/i) // 因数で割ったもの
				}
			}
		}

		flag := true
		for _, f := range fac {
			if countMap[f] >= 1 {
				flag = false
				break
			}
		}
		if flag {
			ans++
		}
	}

	fmt.Printf("%d\n", ans)
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 31020
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heappop, heappush 
def main():
    N, M = map(int, readline().split())
    A = [-int(i) for i in readline().split()]
    heapify(A)
    for _ in range(M):
        v = -heappop(A)
        heappush(A, -(v//2))
    print(sum([-i for i in A]))
if __name__ == '__main__':
    main()

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

int main() {
    int n;cin>>n;
    set<string>st;
    while(n--)
    {
        string s;cin>>s;
        st.insert(s);
    }
    cout<<st.size();
	return 0;
}


Measured memory_bytes: 19224
n=int(input())
ab = []
for i in range(n):
    a, b = input().split()
    b = int(b)
    ab.append((a, b, i+1))
ab.sort(key=lambda x: -x[1])
ab.sort(key=lambda x: x[0])
for i in range(n):
    print(ab[i][2])

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define N 100010
#define P 1000000007
using namespace std;

int n;
long long a[N], inv[N], sum[N];

int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sum[0] = 0, inv[1] = 1;
    for (int i = 1; i <= n; ++i) {
        if (i > 1) inv[i] = (P - P / i) * inv[P % i] % P;
        sum[i] = (sum[i - 1] + inv[i]) % P;
    }
    long long ret = 0, fact = 1;
    for (int i = 1; i <= n; ++i) 
        ret = (ret + (sum[i] + sum[n - i + 1] - 1) * a[i]) % P, fact = fact * i % P;
    cout << ret * fact % P << endl;  
    return 0;
}

Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
INF = 10**12
V, E = map(int, input().split())
d = [[INF]*(V) for _ in range(V)]
for i in range(E):
    s, t, dd = map(int, input().split())
    d[s][t] = dd
def f():
    #dp[i][j] : i　はすでに訪れた集合, 現在いる状態から残りの全ての頂点を巡って頂点０に帰るようなパスの重みの最小値
    dp = [[INF]*(V) for _ in range(1<<V)]
    dp[(1<<V)-1][0] = 0
    for i in range((1<<V)-2, -1, -1):
        for j in range(V):
            for k in range(V):
                if not (i>>k & 1):
                    dp[i][j] = min(dp[i][j], dp[i | 1 << k][k]+ d[j][k])
    if dp[0][0] < INF:
        print(dp[0][0])
    else:
        print(-1)
    
f()


Measured memory_bytes: 19796
#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const int N = 1e5 + 5;
int arr[N][3];
int dp[N][3];
int call(int k, int j, int n) {
	if ( k == n) {
		return 0;
	}
	int ans = -inf;
	if ( dp[k][j] != 0) {
		return dp[k][j];
	}
	for (int i = 0; i < 3; i++) {
		if (i != j) {
			ans = max(ans, arr[k][i] + call(k + 1, i, n));
		}
	}
	return dp[k][j] = ans;
}
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> arr[i][j];
		}
	}
	cout << call(0, N, n);
	return 0;

}



Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for(long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for(long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                                                            \
    (upper_bound((V).begin(), (V).end(), X) -                                  \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                                                               \
    {                                                                          \
        cerr << #v << ':';                                                     \
        for(auto xv : v) cerr << xv << ' ';                                    \
        cerr << endl;                                                          \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
    if(a > b) a = b;
    return a > b;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
    if(a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* liblary */

/* main */

signed main() {
    ll N, M;
    cin >> N >> M;
    vl L(M), R(M);
    FOR(i, 0, M) cin >> L[i] >> R[i];
    ll imos[100010] = {0};
    FOR(i, 0, M) {
        imos[L[i]] += 1;
        imos[R[i] + 1] -= 1;
    }
    FOR(i, 0, 100009) {
        imos[i + 1] += imos[i];
    }
    ll ans = 0;
    FOR(i, 0, 100010) {
        ans += imos[i] == M;
    }
    cout << ans << endl;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a+b > c+d)
    cout << "Left" << endl;
  else if (a+b == c+d)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
}

Measured memory_bytes: 3628
A=[]
B=[]
for i in range(3):
    a,b=map(int,raw_input().split())
    A.append(a)
    B.append(b)

Deg=[0 for i in range(4)]
for a in A:
    Deg[a-1]+=1
for b in B:
    Deg[b-1]+=1
if min(Deg)==1 and max(Deg)==2:
    print "YES"
else:
    print "NO"

Measured memory_bytes: 2696
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

struct edge{
  int u,v,s,t;
  edge(int a=0, int b=0, int x=0, int y=0):u(a), v(b), s(x), t(y) {}
  bool operator<(const edge &e) const {
    return t < e.t;
  }
};

int main(){
  int n,m,s,g;
  cin >> n >> m >> s >> g; s--; g--;

  vector<vi> event(n);
  vector<edge> edges;
  rep(i,m){
    int u,v,t,c;
    cin >> u >> v >> t >> c; u--; v--;
    edges.eb( edge(u,v,t,t+c) );
    event[v].eb(t+c);
  }
  event[s].eb(0);
  sort(all(edges));
  rep(i,n){
    sort(all(event[i]));
    event[i].erase( unique(all(event[i])), event[i].end() );
    //rep(j,event[i].size()) cerr << event[i][j] << " ";
    //cerr << endl;
  }

  vector<vi> ans(n);
  rep(i,n){
    if(i==g) ans[i] = vi(event[i].size(), 0);
    else ans[i] = vi(event[i].size(), INF);
  }

  rrep(i, m){
    edge &e = edges[i];
    int u_p = upper_bound(all(event[e.u]), e.s) - event[e.u].begin();
    int v_p = lower_bound(all(event[e.v]), e.t) - event[e.v].begin();

    if(u_p != 0) chmin(ans[e.u][u_p-1], ans[e.v][v_p] + (e.s - event[e.u][u_p-1]));
    if(v_p != 0) chmin(ans[e.v][v_p-1], ans[e.v][v_p] + event[e.v][v_p] - event[e.v][v_p-1]);
  }
  cout << ans[s][0] << endl;
}

Measured memory_bytes: 16160
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;




void main() {
    int N; long T;
    scan(N, T);
    auto t = readln.split.to!(long[]);

    long ans;
    foreach (i ; 0 .. N - 1) {
        ans += min(t[i + 1] - t[i], T);
    }
    ans += T;
    writeln(ans);
}


Measured memory_bytes: 11608
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <stack>

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define MP make_pair

using namespace std;

typedef pair<int, int> P;

const int dx[] = {-1, 1, -3, 3};
int costs[4];

map<int, vector<pair<int, int> > > m;



int main(){
	string s = "012345678";

	do{
		int val = atoi(s.c_str());
		int zpos = 0;
		rep(i, 9) if(s[i] == '0') zpos = i;
		rep(i, 4){
			string next = s;
			swap(next[zpos], next[(9+zpos+dx[i])%9]);
			m[val].push_back(MP(atoi(next.c_str()), i));
		}
	}while(next_permutation(s.begin(), s.end()));

	int ch, cv;
	while(cin >> ch >> cv, ch|cv){
		costs[0] = costs[1] = ch;
		costs[2] = costs[3] = cv;

		int s = 0, g = 0;
		rep(i, 9){
			int x;
			cin >> x;
			s *= 10;
			s += x;
		}
		rep(i, 9){
			int x;
			cin >> x;
			g *= 10;
			g += x;
		}

		map<int, int> dist;
		dist[s] = 0;

		priority_queue<P, vector<P>, greater<P> > q;
		q.push(MP(0, s));

		while(!q.empty()){
			int d = q.top().first;
			int pos = q.top().second;
			q.pop();

			if(dist[pos] < d) continue;

			if(pos == g) break;

			rep(i, 4){
				P &p = m[pos][i];
				int next = p.first;
				int nd = d+costs[p.second];
				if(dist.count(next) && dist[next] <= nd) continue;
				dist[next] = nd;
				q.push(MP(nd, next));
			}
		}

		cout << dist[g] << endl;
	}

	return 0;
}

Measured memory_bytes: 64540
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    a, b, c, d = MI()
    ans = -1 * 10 ** 19

    for A in [a, b]:
        for B in [c, d]:
            ans = max(ans, A * B)

    print(ans)


main()


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    ll n, k, q;
    cin >> n >> k >> q;

    ll add[n];
    memset(add, 0, sizeof add);
    ll menos = 0;

    for(int i = 0; i < q; i++) {
        int x;
        cin >> x;
        add[x-1]++;
        menos--;
    }

    for(int i = 0; i < n; i++) {
        if(k + add[i] + menos > 0) {
            cout << "Yes\n";
        }else {
            cout << "No\n";
        }
    }
}


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

long long gcd(long long x, long long y){
    if(y == 0)return x;
    return gcd(y, x % y);
}

int main(){
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    long long ans = a[0];
    for(int i = 1; i < n; i++){
        ans = gcd(ans, a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

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

int usagi[1000001];
int neko[1000001];
int Ru[500], Cu[500], Du[2];
int Rn[500], Cn[500], Dn[2];

int main() {

  int N, U, V, M; cin >> N >> U >> V >> M;
  rep(i, 1000001) usagi[i] = neko[i] = -1;
  rep(i, N) rep(j, N) {
    int x; scanf("%d", &x);
    usagi[x] = i * N + j;
  }
  rep(i, N) rep(j, N) {
    int x; scanf("%d", &x);
    neko[x] = i * N + j;
  }

  int u = 0, v = 0;

  rep(_, M) {
    int card; scanf("%d", &card);
    if(~usagi[card]) {
      int a = usagi[card] / N; Ru[a]++;
      int b = usagi[card] % N; Cu[b]++;
      if(a == b) Du[0]++;
      if(a == N-1-b) Du[1]++;
      if(Ru[a] == N) u++, Ru[a] = -1;
      if(Cu[b] == N) u++, Cu[b] = -1;
      if(Du[0] == N) u++, Du[0] = -1;
      if(Du[1] == N) u++, Du[1] = -1;
    }
    if(~neko[card]) {
      int a = neko[card] / N; Rn[a]++;
      int b = neko[card] % N; Cn[b]++;
      if(a == b) Dn[0]++;
      if(a == N-1-b) Dn[1]++;
      if(Rn[a] == N) v++, Rn[a] = -1;
      if(Cn[b] == N) v++, Cn[b] = -1;
      if(Dn[0] == N) v++, Dn[0] = -1;
      if(Dn[1] == N) v++, Dn[1] = -1;
    }
    if(N == 1) {
      u = min(1, u), v = min(1, v);
      if(!((u == 1 && U == 1) || (v == 1 && V == 1))) continue;
      if(u == 1 && v == 1 && U == V && U == 1) {
        cout << "DRAW" << endl;
        return 0;
      }
      else if(u == 1 && U == 1) {
        cout << "USAGI" << endl;
        return 0;
      }
      else if(v == 1 && V == 1) {
        cout << "NEKO" << endl;
        return 0;
      }
      else {
        cout << "DRAW" << endl;
        return 0;
      }
    }
    else if(U <= u && V > v) {
      cout << "USAGI" << endl;
      return 0;
    }
    else if(U > u && V <= v) {
      cout << "NEKO" << endl;
      return 0;
    }
    else if(U <= u && V <= v) {
      break;
    }
  }

  cout << "DRAW" << endl;
  
  return 0;
}

Measured memory_bytes: 11052
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
int main()
{
	scanf("%d", &n);
	int p = n / 100;
	int pp = n % 10;
	if(p == pp) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

bool ok(ll N, vi& h, ll A, ll B, ll x) {
  ll y = 0;

  for (ll i = 0; i < N; i++) {
    if (h[i] > x * B) {
      y += (h[i] - x * B + A - B - 1) / (A - B);
    }
  }

  return y <= x;
}

int main() {
  ll N, A, B;
  cin >> N >> A >> B;

  vi h(N);
  for (ll i = 0; i < N; i++) {
    cin >> h[i];
  }

  ll l = 0;
  ll r = 1000000000;

  while (r - l > 1) {
    ll mid = (l + r) / 2;
    if (ok(N, h, A, B, mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }

  cout << r << endl;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
#include <iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
typedef pair<string,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
const ll MODatc = 1000000007;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
bool pairCompare2(P firstElof,P secondElof){
    return (firstElof.second)%1000>(secondElof.second)%1000;
}
bool less_mod1000(int lhs, int rhs) {
  if ((lhs - rhs) % 1000 != 0)
    return lhs % 1000 < rhs % 1000;
  else // 5で割った余りが等しいなら普通に大小比較する
    return lhs < rhs;
}
string A="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string a="abcdefghijklmnopqrstuvwxyz";
ll dp[107000];
ll jump(ll start,ll goal){
  if(dp[start]>=0)return dp[start];
  if(start==goal){
    return 1;
  }elif(start>goal){
    return 0;
  }
  return dp[start]=(jump(start+1,goal)+jump(start+2,goal))%MODatc;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n;cin>>n;
    ll d[n];
    rep(i,0,n)cin>>d[i];
    sort(d,d+n);
    cout<<d[n/2]-d[n/2-1]<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#include<cmath>
#define int long long int
int32_t main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(c<a+b)
    {
		cout<<"No"<<endl;
	}
	else
	{
		int x=(c-a-b)*(c-a-b);
		int y=4*a*b;
		if(x>y)
		    cout<<"Yes"<<endl;
		else
		    cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,d;
    a=0;b=0;c=0;d=0;
    scanf("%d %d %d",&a,&b,&c);
    while(a>b || b>c || a>c){
        if(a>b){
            d=a;
            a=b;
            b=d;
        }
        else if(b>c){
            d=b;
            b=c;
            c=d;
        }
        else if(a>c){
            d=a;
            a=c;
            c=d;
        }
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2100
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

const ll inf = 1e18;

int A, B, Q;
ll s[100000];
ll t[100000];

ll g(ll si, ll ti, ll x){
  ll res = inf;
  rep(ds, -1, 2){
    rep(dt, -1, 2){
      int sii = si + ds;
      int tii = ti + dt;
      if(sii >= A) continue;
      if(tii >= B) continue;
      if(sii < 0) continue;
      if(tii < 0) continue;
      ll sx = s[sii];
      ll tx = t[tii];
      res = min(res, abs(sx - tx) + min(abs(x - sx), abs(x - tx)));
    }
  }
  return res;
}

ll f(ll x){
  ll si, ti;
  {
    ll ng = 0;
    ll ok = A - 1;
    while(abs(ok - ng) > 1){
      ll md = (ok + ng) / 2;
      (s[md] >= x ? ok : ng) = md;
    }
    si = ok;
  }
  {
    ll ng = 0;
    ll ok = B - 1;
    while(abs(ok - ng) > 1){
      ll md = (ok + ng) / 2;
      (t[md] >= x ? ok : ng) = md;
    }
    ti = ok;
  }
  return g(si, ti, x);
}

int main(){
  cin >> A >> B >> Q;
  rep(i, A) cin >> s[i];
  rep(i, B) cin >> t[i];
  rep(i, Q){
    ll x;
    scanf("%lld", &x);
    printf("%lld\n", f(x));
  }
  return 0;
}


Measured memory_bytes: 2816
#include <iostream>
int map[14][14];
void dfs(int x, int y){
	map[y][x] = 0;
	int vx[] = {-1, 0, 0, 1}, vy[] = {0, -1, 1, 0};
	for(int i=0;i<4;i++){
		for(int j=1;j<=3;j++){
			if(map[y+vy[i]*j][x+vx[i]*j] == 1)
				dfs(x+vx[i]*j, y+vy[i]*j);
		}
	}
	return;
}
int main(){
	int n;
	std::cin >> n;
	for(int c=1;c<=n;c++){
		for(int i=0;i<14*14;i++){
			map[i/14][i%14] = 0;
		}
		for(int i=0;i<8;i++){
			std::string s;
			std::cin >> s;
			for(int j=0;j<8;j++)
				map[i+3][j+3] = s[j] - '0';
		}
		int sx, sy;
		std::cin >> sx >> sy;
		dfs(sx-1+3, sy-1+3);
		std::cout << "Data " << c << ":\n";
		for(int i=0+3;i<14-3;i++){
			for(int j=0+3;j<14-3;j++)
				std::cout << map[i][j];
			std::cout << "\n";
		}
	}
}

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

const int N = 1e6 + 100, MOD = 1000 * 1000 * 1000 + 7;

int n, dp[N];
vector<int> nei[N];

void input() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		nei[--u].push_back(--v);
		nei[v].push_back(u);
	}
}

void dfs(int v = 0, int par = -1) {
	for (int u: nei[v])
		if (u ^ par) {
			dfs(u, v);
			dp[v] ^= ++dp[u];
		}
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	input();
	dfs();
	cout << (dp[0] == 0? "Bob\n": "Alice\n");
}


Measured memory_bytes: 34176
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.array;

  int n, m; rd(n, m);
  auto a=readln.split.to!(long[]).map!((e)=>(e%m)).array;

  auto cul=new long[](n+1);
  foreach(i; 0..n) cul[i+1]=(cul[i]+a[i])%m;
  long[long] freq;
  freq[0]=0;
  long tot=0;
  foreach(x; cul[1..$]){
    if(x==0){
      tot+=(++freq[x]);
      continue;
    }
    if(x in freq){
      tot+=freq[x]++;
    }else{
      freq[x]=1;
    }
  }
  writeln(tot);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


Measured memory_bytes: 8784
//stringray
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ost;

typedef pair<int,int> pi;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;

#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define pb push_back
#define F first
#define S second
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

ll mpow(ll a, ll b){
  ll ret=1;
  while(b>0){
    if(b&1)ret=(ret*a)%mod;
    (a=a*a)%=mod;
    b>>=1LL;
  }
  return ret;
}

//#define int int64_t
//int a[N+2];

int32_t  main(){
  IOS;
  ll m,n;cin>>m>>n;
  cout<<mpow(m,n)<<endl;

  return 0;
}



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

int main(){
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	f(i, 0, n + 1)f(j, 0, m + 1){
		int z = i * m;
		int d = n - i - i;
		z += j * d;
		if (z == k) { printf("Yes\n"); return 0; }
	}
	printf("No\n");
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	int n=read(),m=read();
	cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a, b, c, r, tai, n, i;
    scanf("%d",&a);
    while(a) {
        scanf("%d%d%d",&b,&c,&n);
        if(a < b && c < b) {
            tai = a * a + c * c;
        } else if(b < a && c < a) {
            tai = b * b + c * c;
        } else {
            tai = a * a + b * b;
        }
        for(i = 0; i < n; i++ ) {
            scanf("%d",&r);
            if(tai < (2 * r) * (2 * r) ) {
                puts("OK");
            } else {
                puts("NA");
            }
        }
        scanf("%d",&a);
    }
    return 0;
}

Measured memory_bytes: 584