akhauriyash/Code-Regression huggingface dataset:
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import qualified Data.Set as S

solve :: [Int] -> (Int, Int)
solve xs = let (s, n) = f xs
               sz = S.size s
            in (max sz 1, S.size s + n)
  where
    f :: [Int] -> (S.Set Int, Int)
    f [] = (S.empty, 0)
    f (x:xs) = let (s, n) = f xs
                   c = category x
                in if c == 8 then (s,n+1)
                             else (S.insert c s, n)
    category x
      | x < 400   = 0
      | x < 800   = 1
      | x < 1200  = 2
      | x < 1600  = 3
      | x < 2000  = 4
      | x < 2400  = 5
      | x < 2800  = 6
      | x < 3200  = 7
      | otherwise = 8

main :: IO ()
main = do
    _ <- getLine
    a <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    let (mn,mx) = solve a
    print mn
    print mx


Measured memory_bytes: 508
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int N, M;
    cin >> N >> M;
    map<int, int> m;
    REP(i, M) {
        int a;
        cin >> a;
        m[a] = 1;
    }
    vector<ll> dp(N + 1, 0);
    dp[0] = 1;
    FOR(i, 1, N + 1, 1) {
        if (m.count(i)) {
            continue;
        }
        dp[i] = dp[i - 1];
        if (i > 1) {
            dp[i] += dp[i - 2];
            dp[i] %= MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 5760
using System;
using System.Collections.Generic;
using System.Linq;
namespace csharptest
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            int[] ans = new int[200];
            while (true)
            { 
                string str = Console.ReadLine();
                if (str == null)
                {
                    break;
                }
                else
                {
                    string[] s = str.Split(' ');
                    int a = int.Parse(s[0]);
                    int b = int.Parse(s[1]);
                    a += b;
                    ans[i] = a.ToString().Length;
                    i++;
                }
            }
            for (int n = 0; n < i; n++)
            {
                Console.WriteLine(ans[n]);
            }
        }
    }
}

Measured memory_bytes: 5564
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
	if a[i] % 2 == 1: continue
	if a[i] % 3 != 0 and a[i] % 5 != 0:
		print("DENIED")
		break
else:
	print("APPROVED")

Measured memory_bytes: 3060
use std::cmp::max;
use std::collections::VecDeque;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let a: Vec<Vec<_>> = (0..n)
        .map(|_| (1..n).map(|_| sc.read::<usize>() - 1).collect())
        .collect();
    let mut pos = vec![0; n];
    let mut q = VecDeque::new();
    for i in 0..n {
        let j = a[i][0];
        if a[j][0] == i && i < j {
            q.push_back((i, j, 1));
        }
    }

    let mut t = 0;

    while let Some((i, j, time)) = q.pop_front() {
        t = max(t, time);
        pos[i] += 1;
        if pos[i] < n - 1 {
            let j = a[i][pos[i]];
            if a[j][pos[j]] == i {
                q.push_back((i, j, time + 1));
            }
        }

        let i = j;
        pos[i] += 1;
        if pos[i] < n - 1 {
            let j = a[i][pos[i]];
            if a[j][pos[j]] == i {
                q.push_back((i, j, time + 1));
            }
        }
    }

    if pos.into_iter().all(|x| x == n - 1) {
        println!("{}", t);
    } else {
        println!("-1");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 12540
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    ll source[N][3];
    for(int i=0; i<N; i++){
        cin >> source[i][0] >> source[i][1] >> source[i][2];
    }
    
    for(int x=0; x<=100; x++){
        for(int y=0; y<=100; y++){
            bool flag=true;
            int cnt=0;
            ll h;
            ll tmp_h=-1;
            for(int n=0; n<N; n++){
                if(source[n][2]==0) continue;
                if(cnt==0){
                    h=source[n][2]+abs(source[n][0]-x)+abs(source[n][1]-y);
                    if(h<=0) continue;
                    cnt++;
                    continue;
                }
                tmp_h=source[n][2]+abs(source[n][0]-x)+abs(source[n][1]-y);
                if(tmp_h<=0) continue;
                
                if(tmp_h!=h){
                    flag=false;
                    break;
                }
            }
            if(tmp_h==-1){
                cout << 32 << ' ' << 68 << ' ' << 1;
                return 0;
            }
            
            if(flag){
                cout << x << ' ' << y << ' ' << h << endl;
                return 0;
            }
        }
    }


    
    return 0;
}


Measured memory_bytes: 256
// C.

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

using namespace std;

int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1;
		cin >> n;
		if (n <= 0) return 0;
		int seq[] = { 0,1,2,3,4,5,6,7 };
		double sum = 0;
		double cnt = 0;
		vector<double> x(n), y(n);
		for (int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i];
		}
		do {
			cnt += 1.0;
			for (int i = 1; i < n; ++i) {
				double dx = x[seq[i]] - x[seq[i - 1]];
				double dy = y[seq[i]] - y[seq[i - 1]];
				sum += sqrt(dx * dx + dy * dy);
			}
		} while (next_permutation(seq, seq + n));
		double ans = sum / cnt;
		cout << ans << endl;
	}
	return 0;
}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int N;
  string S;
  cin >> N >> S;

  int sumb[200010]={},sumw[200010]={};
  rep(i,N+1){
    sumb[i+1] = sumb[i]+(S[i]=='#');
    sumw[i+1] = sumw[i]+(S[i]=='.');
  }

  int ans = INF;
  rep(w,N+1){
    ans = min(ans,sumb[w]+sumw[N]-sumw[w]);
  }

  cout << ans << endl;
}

Measured memory_bytes: 2180
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY  1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u)
{
    int v;
    color[u]=GRAY;
    d[u]=++tt;
    for(v=0;v<n;v++)
    {
        if(M[u][v]==0) continue;
        if(color[v]==WHITE)
            dfs_visit(v);
    }
    color[u]=BLACK;
    f[u]=++tt;
}

void dfs()
{
    int u;
    for(u=0;u<n;u++)
        color[u]=WHITE;
    tt=0;
    for(u=0;u<n;u++)
        if(color[u]==WHITE)
            dfs_visit(u);
    for(u=0;u<n;u++)
        printf("%d %d %d\n",u+1,d[u],f[u]);
}

int main()
{
    int u,v,k,i,j;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
            M[i][j]=0;
    for(i=0;i<n;i++)
    {
        scanf("%d %d",&u,&k);
        u--;
        for(j=0;j<k;j++)
        {
            scanf("%d",&v);
            v--;
            M[u][v]=1;
        }
    }
    dfs();
    return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL dp[2][101][301];

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

  LL N, W; cin >> N >> W;
  vector<PLL> xs(N);
  REP(i,N) cin >> xs[i];

  int crt = 0, nxt = 1;
  dp[crt][0][0] = 0;
  REP(i,N){
	REP(j,N+1) REP(w,301) dp[nxt][j][w] = dp[crt][j][w];
	
	REP(j,i+1) for(int w=xs[i].FF-xs[0].FF;w<301;++w){
	  if(w+(j+1)*xs[0].FF <= W)
		maxi(dp[nxt][j+1][w], dp[crt][j][w-(xs[i].FF-xs[0].FF)] + xs[i].SS);
	}
	swap(crt, nxt);
  }
  LL ans = 0;
  REP(i,N+1) REP(w,301) maxi(ans, dp[crt][i][w]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
#[allow(dead_code)]
fn main() {
    let x = i::i();
    let vec: Vec<i64> = (0..1001i64).map(|x| x * x * x * x * x).collect();
    for i in 0..1001 {
        for j in 0..1001 {
            if vec[i] + vec[j] == x {
             //   dbg!(vec);
                println!("{} -{}", i, j);
                return;
            }
            if vec[i] - vec[j] == x {
               // dbg!(vec);

                println!("{} {}", i, j);
                return;
            }
        }
    }
  //  dbg!(vec);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2116
package main

import (
	"fmt"
)

func main() {
	var h, w, ans int64
	fmt.Scan(&h)
	fmt.Scan(&w)

	if h == 1 || w == 1 {
		ans = 1
	} else {
		if h%2 == 0 || w%2 == 0 {
			ans = (h * w) / 2
		} else {
			ans = 1 + ((h * w) / 2)
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define IREP(i,j,n) for(int (i)=(j);(i)<(n);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;

typedef pair<int, int> P;
vector<vector<char>> b;
vector<vector<bool>> vstd;
bool fl = true;
int r, c;
int sy, sx, gy, gx;
queue<P> q;

void add(int x, int y) {
    if (!(0 <= x && x < r && 0 <= y && y < c)) return;
    if (b[x][y] == '#') return;
    if (vstd[x][y]) return;
    vstd[x][y] = true;
    if (x == r-1 && y == c-1) fl = false;
    q.push(make_pair(x, y));
}

void add4(P p) {
    int x = p.first;
    int y = p.second;
    add(x+1, y);
    add(x-1, y);
    add(x, y+1);
    add(x, y-1);
}

int main() {
    cin >> r >> c;
    int k = 0;
    
    b = vector<vector<char>>(r, vector<char>(c, '0'));
    vstd = vector<vector<bool>>(r, vector<bool>(c, false));
    REP(i,r) {
        REP(j,c) {
            cin >> b[i][j];
            if (b[i][j] == '#') k++;
        }
    }
    
    int cnt = 0;
    add(0, 0);
    while (fl) {
        cnt++;
        vector<P> vs;
        while (!q.empty()) {
            vs.push_back(q.front());
            q.pop();
        }
        
        for (P p: vs) {
            add4(p);
        }
        
        if (vs.size() == 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    cout << r * c - cnt - k - 1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  int cost = N * X;
  if (N > K) {
    cost += (N - K) * (Y - X);
  }
  
  cout << cost << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t edge_weight;

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
  edge_weight cost;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void free_graph (graph *g) {
  free (g->edge);
  free (g->start);
  free (g);
  return;
}

void clear_graph (graph *g) {
  g->pointer = 0;
  for (int32_t i = 0; i < g->vertex_num; ++i) {
    g->start[i] = -1;
  }
}

void add_edge (graph *g, int32_t from, int32_t to, edge_weight cost) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from], cost};
  g->start[from] = g->pointer++;
}

typedef int32_t i32;

int bellman_ford (graph *g, i32 *dp, i32 inf) {
  int update = 0;
  for (i32 i = 0; i < g->vertex_num; ++i) {
    if (dp[i] == inf) continue;
    for (i32 p = g->start[i]; p != -1; p = g->edge[p].next) {
      i32 u = g->edge[p].vertex;
      i32 d = dp[i] + g->edge[p].cost;
      if (d >= dp[u]) continue;
      update = 1;
      dp[u] = d;
    }
  }
  return update;
}

void run (void) {
  i32 v, e, r;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &v, &e, &r);
  graph *g = new_graph (v);
  while (e--) {
    i32 s, t, d;
    scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &s, &t, &d);
    add_edge (g, s, t, d);
  }
  i32 *dp = (i32 *) calloc (v, sizeof (i32));
  const i32 inf = 10000 * v + 1;
  for (i32 i = 0; i < v; ++i) {
    dp[i] = inf;
  }
  dp[r] = 0;
  for (i32 iter = 0; iter < v - 1; ++iter) {
    bellman_ford (g, dp, inf);
  }
  if (bellman_ford (g, dp, inf)) {
    puts ("NEGATIVE CYCLE");
    return;
  }
  for (i32 i = 0; i < v; ++i) {
    if (dp[i] == inf) {
      puts ("INF");
    } else {
      printf ("%" PRIi32 "\n", dp[i]);
    }
  }
}

int main (void) {
  run ();
  return 0;
}



Measured memory_bytes: 2112
#include<iostream>

using std::cout;
using std::cin;
using std::endl;

int main(void) {
int x;
int y;
int swap;
cin >> x >> y;
while (x != 0 || y != 0) {
if (x > y) {
swap  = y;
y = x;
x = swap;
}
cout << x << " " << y << endl;
cin >> x >> y;
}
return 0;
}

Measured memory_bytes: 3024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define nl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

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

const int N=2e5+11;
const int M=1e5+1;
const int inf=2e9+1;
const ld EPS=1e-6;
const ll INF=1e18;
const ll mod=/*998244353*/1e9+7;
const int dx[8]={0,0,-1,1,-1,1,1,-1};
const int dy[8]={-1,1,0,0,1,-1,1,-1};

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0),cout.tie(0);
  double a,b,c;
  cin>>a>>b>>c;
  if(a/c<=b)cout<<"Yes";
  else cout<<"No";

}


Measured memory_bytes: 3740
(let ((a (read))
      (b (read))
      (x (read)))

  ;  (format t "~A~%"
  ;          (loop for i from a to b
  ;                when (zerop (mod i x))
  ;                count i)))

  ;  (format t "~A~%"
  ;          (if (or (zerop (mod a x)) (zerop (mod b x)))
  ;            (1+ (floor (- b a) x))
  ;            (floor (- b a) x))))

  (defun f (n)
    (max (1+ (floor n x)) 0))

  (format t "~A~%"
          (- (f b) (f (1- a)))))


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

int main() {
  int n, m;
  cin >> n;
  vector<int> t(n);
  int sum = 0;
  for(int i = 0; i < n; i++){
    cin >> t[i];
    sum += t[i];
  }
  cin >> m;
  int p[m], x[m];
  int sub;
  for(int i = 0; i < m; i++){
    cin >> p[i] >> x[i];
    if(p[i] > n) continue;
    sub = t[p[i] - 1] - x[i];
    cout << sum - sub << endl;
  }
}

Measured memory_bytes: 256
s = input()
emar = []
deta = [0] * 3
for a in s:
    flag = True
    for de in range(len(emar)):
        if a == emar[de]:
            flag = False
            deta[de] += 1
    if flag:
        emar.append(a)
if deta[0] == deta[1] and deta[0] == 1:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <regex>
#include <stdexcept>
#include <unordered_set>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <time.h>
#include <numeric>
#include <complex>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define fill(x, y) memset(x, y, sizeof(x))
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define itn int
#define re return
#define prev PREV
#define next NEXT

#define sz(x) ((int)x.size())

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 1e5 + 10;
#define FILENAME ""

const ll maxn = 500000 + 10;

ll t[4*MAXN];

void build (vector <int>& a, int v, int l, int r) {
    if (l == r) {
        t[v] = a[l];
    }
    else {
        int mid = (l + r)/2;
        build(a, 2*v, l, mid);
        build(a, 2*v + 1, mid + 1, r);
        t[v] = __gcd(t[2*v], t[2*v + 1]);
    }
}

int get (int v, int l, int r, int left, int right) {
    if (left > right) {
        return 0;
    }
    else if (left == l && right == r) {
        return t[v];
    }
    else {
        int mid = (l + r)/2;
        return __gcd(get(2*v, l, mid, left, min(mid, right)), get(2*v + 1, mid + 1, r, max(left, mid + 1), right));
    }
}
 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector <int> a;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.pb(x);
    }
    build(a, 1, 0, sz(a) - 1);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans = max(ans, get(1, 0, sz(a) - 1, 1, sz(a) - 1));
        }
        else {
            ans = max(ans, __gcd(get(1, 0, sz(a) - 1, 0, i - 1), get(1, 0, sz(a) - 1, i + 1, sz(a) - 1)));
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2808
#%%
N = int(input())
S = []
for _ in range(N):
    S.append(input())

dic = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

for i in S:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for key, value in dic.items():
    print("{} x {}".format(key, value))


Measured memory_bytes: 16324
def root(R, a):
    if R[a] != a:
        R[a] = root(R, R[a])
    return R[a]

def union(R, x, y):
    a = root(R, x)
    b = root(R, y)
    if a != b:
        R[a] = b


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

R = [i for i in range(N)]
for i in range(M):
    x, y = list(map(int, input().split()))
    x, y = x-1, y-1
    union(R, x, y)

count = 0
for i in range(N):
    if root(R, i) == root(R, p[i] - 1):
        count += 1

print(count)


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

    #define ll long long
    #define pb push_back
    #define mod 1000000007

    int main() {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      
      ll m,d;
      cin>>m>>d;
      ll i,j,ans=0;
      for(i=1;i<=m;i++){
        for(j=11;j<=d;j++){
          if(i==(j/10) * (j%10) && (j/10)>=2 && (j%10)>=2){
            ans++;
            // cout<<i<<" "<<j<<"\n";
          }
        }
      }
    cout<<ans;

      return 0;
      
      }


    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}

const int INF = 100000; 

int main(){
    int n, a;
    cin >> n >> a;

    int ans = n * n - a;

    cout << max(ans, 0) << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<3;i++) {
			int t = - ( sc.nextInt() * 3600 + sc.nextInt() * 60 + sc.nextInt() );
			t += sc.nextInt() * 3600 + sc.nextInt() * 60 + sc.nextInt();
			int s = t % 60;
			int m = (t/60) % 60;
			int h = t/3600;
			System.out.println(h + " " + m + " " + s);
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define MAX 3000
#define MOD 1000000007
using namespace std;
int r,c,k;
int v[MAX+1][MAX+1];
long long dp[MAX+1][MAX+1][4];
bool valid(int x,int y)
{
	return (x>=1&&x<=r&&y>=1&&y<=c);
}
long long go(int x,int y,int used)
{
	if(!valid(x,y))
		return 0;
	if(dp[x][y][used]^-1)
		return dp[x][y][used];
	long long a = 0, c = 0;
	if(used<3)
		a = v[x][y]*1LL+go(x,y+1,used+1), c = v[x][y]*1LL+go(x+1,y,0);
	long long b =  go(x,y+1,used), d = go(x+1,y,0);
	return dp[x][y][used]=max({a,b,c,d});
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	cin>>r>>c>>k;
	for(int i=1;i<=r;++i)
		for(int j=1;j<=c;++j)
			for(int t=0;t<4;++t)
				dp[i][j][t] = -1;
	while(k--)
	{
		int x,y,w;
		cin>>x>>y>>w;
		v[x][y] = w;
	}
	cout<<go(1,1,0)<<endl;
	return 0;
}

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

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

//===

const int INF = int(1e9 + 7);

int main() {

	int N, M;
	cin >> N >> M;
	vector<Vi> to(N);
	for (int i = 0; i < M; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		to[u].push_back(v);
	}
	int S, T;
	cin >> S >> T;
	--S; --T;

	int (*dist)[3] = new int[N][3];
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 3; ++j) {
			dist[i][j] = INF;
		}
	}

	queue<Pii> q;
	q.emplace(S,0);
	dist[S][0] = 0;
	while (!q.empty()) {
		int v = q.front().first;
		int l = q.front().second;
		q.pop();
		for (const auto& u : to[v]) {
			int nl = (l + 1) % 3;
			if (dist[u][nl] != INF) continue;
			dist[u][nl] = dist[v][l] + 1;
			q.emplace(u, nl);
		}
	}

	int ans = dist[T][0];
	if (ans == INF) ans = -1;
	else ans /= 3;
	cout << ans << endl;
}


Measured memory_bytes: 7040
use std::cmp::*;
use std::collections::HashSet;
use std::io::*;
use std::num::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn string() -> String {
    read()
}

fn int() -> i64 {
    read()
}

fn char() -> char {
    read::<String>().pop().unwrap()
}

fn vecchar() -> Vec<char> {
    string().chars().collect()
}

fn vecint(n: i64) -> Vec<i64> {
    let mut vec = Vec::new();
    for i in 0..n {
        vec.push(int())
    }
    vec
}

fn main() {
    let n = int() as usize;
    let mut a = Vec::new();
    a.push(0usize);
    for _ in 0..n {
        a.push(int() as usize)
    }

    let mut memo = HashSet::new();
    let mut cur = 1;
    let mut ans = 1;
    memo.insert(1 as usize);
    loop {
        if memo.contains(&a[cur]) {
            println!("-1");
            return;
        } else {
            let target = a[cur];
            if target == 2 {
                println!("{}", ans);
                return;
            }

            memo.insert(target);
            cur = target;
            ans += 1;
        }
    }
}


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

using namespace std ;

int n ;
map< char , int > cnt[ 100 ] ;
map< int , int > ans ;
char s[ 100 ][ 100 ] ;

int main() {
	scanf( "%d" , &n ) ; 
	for( int i = 1 ; i <= n ; i ++ ) {
		scanf( "%s" , s[ i ] + 1 ) ;
		for( int j = 1 , len = strlen( s[ i ] + 1 ) ; j <= len ; j ++ ) {
			cnt[ i ][ s[ i ][ j ] ] ++ ; 
		}
	}
	for( int i = 0 ; i < 26 ; i ++ )  {
		int m = 1e10 ;
		for( int j = 1 ; j <= n ; j ++ ) {
			m = min( m , cnt[ j ][ (char)(i+'a') ] ) ;
		}
		ans[ i ] = m ;
	}
	for( int i = 0 ; i < 26 ; i ++ ) {
		for( int j = 1 ; j <= ans[ i ] ; j ++ ) {
			putchar( i + 'a' ) ;
		}
	}
	ans.clear() ;
	for( int i = 0 ; i < 26 ; i ++ ) {
		int m = 1e10 ;
		for( int j = 1 ; j <= n ; j ++ ) {
			m = min( m , cnt[ j ][ (char)( i + 'A' ) ] ) ;
		}
		ans[ i ] = m ;
	}
	for( int i = 0 ; i < 26 ; i ++ ) {
		for( int j = 1 ; j <= ans[ i ] ; j ++ ) {
			putchar( i + 'A' ) ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
 
int findLargestDivisor(int n) 
{ 
	int max = 1;
    for (int i = 2; i < n; i++) {        
        if(n %(i) == 0) { 
            max = i;
        } 
    }
    return max;     
} 
	 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return (temp * temp)%1000000007;  
    else
    {  
        if(y > 0)  
            return (x * temp * temp)%1000000007;  
        else
            return (temp * temp)%1000000007 / x;  
    }  
} 
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
    return (a.second < b.second); 

} 


void solve(){
    int n;
    cin >> n;
    string arr;
    cin >> arr;
    int ans = 0;
    for(int i = 0 ; i < n ; i++){
        while(arr[i] == arr[i+1] && i < n-1){
            i++;
        }
        ans++;
    }
    cout << ans << "\n";
}


int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
		solve();
	}
    return 0; 
}





Measured memory_bytes: 3740
#include <iostream>

int main()
{
    int ax, bx, cx;
    int r;
    int N = 0;

    std::cin >> ax >> bx >> cx;

    for (;ax <= bx; ax++){
        r = cx % ax;
        if ( r == 0){
            N++;
        }
    }


    std::cout << N << "\n";

    return 0;
}



Measured memory_bytes: 3112
N, M = map(int, input().split())
L = [tuple(map(int, input().split())) for _ in range(M)]
import itertools
l = [i for i in range(2, N+1)]
Ps = itertools.permutations(l, N-1)
c = 0
for P in Ps:
  T = 1
  for p in P:
    if (T, p) in L or (p, T) in L:
      T = p
    else:
      break
  else:
    c += 1
print(c)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
#define pi acos(-1)
#define el << endl
#define yes cout << "YES" <<  endl
#define no cout << "NO" << endl
#define show(x) cout << x << endl
#define impossible cout<< "impossible" << endl
#define tc int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const ll maxn = 2e5+10;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);



	string s,t;
	cin>>s>>t;
	int l = s.size();
	int cnt=0;
	for(int i=0; i<l; i++){
		if(s[i]!=t[i]){
			++cnt;

		}
	}
	show(cnt);


	return 0;
}
///Alhamdulillah
///Full: me




Measured memory_bytes: 3780
import sys

input = sys.stdin.readline

def main():
    ans = 0
    x, k, d = map(int, input().split())
    ans = abs(x) - (d * min(k, abs(x)//d))
    t = k - abs(x)//d
    if t%2 != 0 and t > 0:
        ans = min(abs(ans-d), abs(ans+d))
    print(ans)

main()



Measured memory_bytes: 9080
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }


int main(){
    int a, b, c, d, e;
    cin>>a>>b>>c>>d>>e;
    int f =0;
    f += a%10!=0 ? a/10+1 : a/10;
    f += b%10!=0 ? b/10+1 : b/10;
    f += c%10!=0 ? c/10+1 : c/10;
    f += d%10!=0 ? d/10+1 : d/10;
    f += e%10!=0 ? e/10+1 : e/10;
    f-=1;
    f*=10;
    f += min({(a-1)%10, (b-1)%10, (c-1)%10, (d-1)%10, (e-1)%10})+1;
    cout<<f<<endl;
    return 0;
}

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

long long MOD=998244353;

int main(){
    long long N,S;
    cin >> N >> S;
    long long aa;
    vector<long long> A;
    long long i,j;
    for(i=0; i<N; i++){
        cin >> aa;
        A.push_back(aa);
    }
    sort(A.begin(),A.end());
    long long dp[N+1][S+1];
    for(j=0; j<=S; j++){
        dp[0][j]=0;
    }
    dp[0][0]=1;
    for(i=1; i<=N; i++){
        dp[i][0]=(2*dp[i-1][0])%MOD;
    }
    for(i=1; i<=N; i++){
        for(j=1; j<=S; j++){
            if(j<A[i-1]){
                dp[i][j]=(2*dp[i-1][j])%MOD;
            }else{
                dp[i][j]=(2*dp[i-1][j]+dp[i-1][j-A[i-1]])%MOD;
            }
        }
    }
    cout << dp[N][S] << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 74020
#include <iostream>
#include <bits/stdc++.h>
#define loop(i,N) for(int i=0;i<N;i++)
#define vi vector<int>
#define vs vector<string>
#define vl vector<long long int>
#define vpi vector<pair<int,int>>
#define msi map<string,int>
#define mil map<int,long long int>
#define lli long long int
#define ulli unsigned long long int
using namespace std ;
/*********************************reused****************************/
int h,w;
int c[10][10];

int main()
{
    cin>>h>>w;
    loop(i,10){
        loop(j,10){
            cin>> c[i][j];
        }
    }
    loop(k,10){
        loop(i,10){
            loop(j,10){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    lli ans=0;
    int x;
    loop(i,h){
        loop(j,w){
            cin>>x;
            if(x!=-1 && x!=1)
                ans+=c[x][1];
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        long a = 0, b = 0;
        Map<Long, Long> map = new HashMap<Long, Long>();
        map.put(0L, 0L);
        for (long i = 1; i < 1000; i++) {
            long a5 = (long) Math.pow(i, 5);
            if(a5 < x){
                if(map.containsKey(x - a5)){
                    a = i;
                    b = - map.get(x-a5);
                    break;
                }
                map.put(a5, i);
            }else{
                if(map.containsKey(a5 - x)){
                    a = i;
                    b = map.get(a5 - x);
                    break;
                }
                map.put(a5, i);
            }
        }
        System.out.println(a + " " + b);
        sc.close();

    }

}


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

int main() {
	int n;
	cin >> n;
	int sum = 0, max = 0;
	for (int i = 0, p; i < n; i++) {
		cin >> p;
		sum += p;
		if (p > max)
			max = p;
	}
	cout << sum - max / 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a,b,x,t1,t2;
	cin>>x>>a>>b;
	if(a>x) t1=a-x;
	else    t1=x-a;
	if(b>x) t2=b-x;
	else    t2=x-b;
	if(t1<t2) cout<<"A";
	else	  cout<<"B";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<math.h>
using namespace std;
long  n;int ans = 0;
int main() {
	cin >> n;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n%i == 0)ans = log10(n / i) + 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; 
int main(){
    int n,a[4];
	cin>>n;
	for(int i=1;i<=3;i++){
		a[i]=n%10;
		n/=10;
	}
	if(a[1]==a[3]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    
    int n = 0;
    cin >> n;

    float Ax, Ay, Bx, By, Cx, Cy, Dx, Dy;
    vector<pair<float, float> > A;
    vector<pair<float, float> > B;
    vector<pair<float, float> > C;
    vector<pair<float, float> > D;

    for(int i = 0; i < n; i++){
        cin >> Ax >> Ay >>  Bx >>  By >>  Cx >>  Cy >>  Dx >> Dy;
        A.push_back(make_pair(Ax, Ay));
        B.push_back(make_pair(Bx, By));
        C.push_back(make_pair(Cx, Cy));
        D.push_back(make_pair(Dx, Dy));
    }

    for(int i = 0; i < n; i++){
        float a = 0;
        float b = 0;
        //0除算対策
        if(A[i].first == B[i].first ){
            a = 9999999;
        }else{
            a = (A[i].second - B[i].second) / (A[i].first - B[i].first);
        }

        if(C[i].first == D[i].first){
            b = 9999999;
        }else{
             b = (C[i].second - D[i].second) / (C[i].first - D[i].first);
        }

        if(a == b){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
} 


Measured memory_bytes: 3208
/*author @dhanush*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define se second
#define fi first
ll MOD = 1e9 + 7;

int n, m;
vector<int>adj[200005];
bool vis[200005];
int ans = 1;
int cnt = 0;
void dfs(int n)
{
  cnt++;
  vis[n] = 1;
  ans = max(ans, cnt);
  for (auto x : adj[n])
  {
    if (!vis[x])
    {
      dfs(x);
    }
  }

}
int main()
{



  cin >> n >> m;
  for (int i = 0; i < m; i++)
  {
    int a, b;
    cin >> a >> b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  for (int i = 1; i <= n; i++)
  {
    if (!vis[i])
    {
      cnt = 0;
      dfs(i);
    }
  }
  cout << ans << endl;



}







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

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

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


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

    vector<int> P(N);
    rep(i, N) cin >> P.at(i);

    int ans = 0;
    int min = 100100100;
    rep(i, N) {
        if (min >= P.at(i)) {
            ans++;
            min = P.at(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    let mut hn = [false; 4];
    for s in buf.trim().split(' '){
        match s {
            "P" => hn[0] = true,
            "W" => hn[1] = true,
            "G" => hn[2] = true,
            "Y" => hn[3] = true,
            _ => (),
        }
    }

    if hn.iter().all(|&x| x){
        println!("Four");
        return;
    }
    println!("Three");
}


Measured memory_bytes: 4352
//#include "oj/atcoder.h"
//#include "std.h"
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <float.h>

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define SWAP(T,a,b) do { T _tmp=a; a=b; b=_tmp; } while (0)

//#include "oj/io.h"

void print_ai(int *a, int n) {
	for (int i=0; i<n; i++) {
		if (i) printf(" ");
		printf("%d", a[i]);
	}
	printf("\n");
}

void scan_ai(int *a, int n) {
	for (int i=0; i<n; i++)
		scanf("%d", &a[i]);
}

//#include "oj/debug.h"

void print_hr() {
	printf("---------------------------\n");
}



int main() {
	int n;
	while (scanf("%d", &n)==1) {
		int a[n];
		scan_ai(a, n);
		// 2 0 1 3
		// 4 2 0 1 3
		int p = n-1;
		printf("%d", a[n-1]);
		p -= 2;
		while (p >=0) {
			printf(" %d", a[p]);
			p -= 2;
		}
		p = (n%2==0 ? 0: 1);
		while (p < n) {
			printf(" %d", a[p]);
			p += 2;
		}
		printf("\n");
	}
}


Measured memory_bytes: 2816
#include <stdio.h>
#define N 500001
#define INFTY 1000000000
int A[N],l[N],r[N],count=0;
 
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++)l[i]=A[left+i];
  for(i=0;i<n2;i++)r[i]=A[mid+i];
   
  l[n1]=INFTY;
  r[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++,count++){
    if(l[i]<=r[j]){
      A[k]=l[i];
      i++;
    }
    else {
      A[k]=r[j];
      j++;
    }
  }
}
 
void mergesort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}
 
int main(){
  int n,i;
 
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
 
  mergesort(A,0,n);
 
 
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1)printf(" ");
  }
  printf("\n%d\n",count);
   
  return 0;
}


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

int main() {
  int count = 0;
  string str;
  cin >> str;
  rep(i,3) {
  	if (str.at(i)=='1') {
      count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3532
import java.util.Scanner;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var x = sc.nextInt();
		var y = sc.nextInt();
		sc.close();

		var a = (x + y) / 3;
		var b = Math.min(x, y) - a;
		if ((x + y) % 3 == 0 && b >= 0) {
			var modCalc = new Main().new ModCalc(MOD);
			var result = modCalc.combine(a, b);
			System.out.println(result);
		} else {
			System.out.println(0);
		}
	}

	public class ModCalc {
		int mod;

		public ModCalc(int mod) {
			this.mod = mod;
		}

		public int add(int a, int b) {
			return (int) (((long) a + b) % mod);
		}

		public int subtract(int a, int b) {
			return (int) (((long) a - b + mod) % mod);
		}

		public int multiply(int a, int b) {
			return (int) (((long) a * b) % mod);
		}

		public int divide(int a, int b) {
			return multiply(a, pow(b, mod - 2));
		}

		public int pow(int n, int k) {
			if (k == 0) {
				return 1;
			} else if (k % 2 == 0) {
				int p = pow(n, k / 2);
				return multiply(p, p);
			} else {
				int p = pow(n, (k - 1) / 2);
				return multiply(multiply(p, p), n);
			}
		}

		public int combine(int n, int k) {
			int sum1 = 1;
			int sum2 = 1;
			for (int i = 0; i < k; i++) {
				sum1 = multiply(sum1, n - i);
				sum2 = multiply(sum2, i + 1);
			}
			return divide(sum1, sum2);
		}
	}
}


Measured memory_bytes: 35792
/**
 * Boris Sokolov
 * Software Engineer at Ring Labs
 * Kiev, Ukraine | Los Angeles, CA
 */
 
#pragma comment(linker, "/STACK:500000000")
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <time.h>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

typedef long long ll;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int INF = static_cast<int>(2e9);
const int MOD = static_cast<int>(1e9) + 7;

char s[(int)2e5 + 9];
int cnt[26];

int main() {
    //freopen("in.txt", "rt", stdin);
    //freopen("out.txt", "wt", stdout);
    scanf("%s", s);
    int n = strlen(s);
    for (int i = 0; i < n; ++i) {
        ++cnt[s[i] - 'a'];
    }
    ll res = 1;
    for (int i = 0; i < n; ++i) {
        --cnt[s[i] - 'a'];
        int cur_cnt = 0;
        for (int j = 0; j < 26; ++j) {
            if ((s[i] - 'a') != j) {
                cur_cnt += cnt[j];
            }
        }
        res += cur_cnt;
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int,int> P;

int main() {
    string S;cin >> S;
    int N = S.size();
    string revS;
    revS = S;
    reverse(revS.begin(),revS.end());
    string Left,revLeft,Right,revRight;
    int Q;cin >> Q;
    int rev = 0;
    for (int i = 0;i < Q;i++){
        int T;cin >> T;
        if (T == 1) rev++;
        else{
            int F;cin >> F;
            char C;cin >> C;
            if (rev % 2 == 0){
                if (F == 1) Left += C;
                else Right += C;
            }
            else{
                if (F == 1) Right += C;
                else Left += C;
            }
        }
    }
    if (rev % 2 == 0){
        reverse(Left.begin(),Left.end());
        cout << Left + S + Right << endl;
        return 0;
    }
    else{
        reverse(Right.begin(),Right.end());
        cout << Right + revS + Left << endl;
        return 0;
    }
}

Measured memory_bytes: 1476
input_list = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_list.sort()
b_list.sort()

a_max = a_list[-1]
b_min = b_list[0]

for n in range(input_list[2]+1, input_list[3]+1):
    if a_max < n <= b_min:
        print("No War")
        exit()
print("War")



Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void){
	int a, b;
	
	scanf("%d", &a);	scanf("%d", &b);

	if (a < b){
		printf("a < b\n");
	}
	else if (a > b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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; }

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

    string N; cin >> N;

    ll dig = N.size();
    ll ans = stoll(N);
    for (ll i = 1; i<dig; ++i) {
        ll d = dig - i;
        if (d%2==1) continue;
        ans -= 9 * pow(10, d-1);
    }
    if (dig%2==0) {
        ans -= stoll(N) - pow(10, dig-1) + 1;
    }
    cout << ans << '\n';


    return 0;
}



Measured memory_bytes: 256