akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::str::FromStr;

// patisserie-abc.rs --- Patisserie ABC
// author: Seong Yong-ju <sei40kr@gmail.com>

#[allow(unused_macros)]
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      let mut iter = line.split_whitespace();
      (
        $(iter.next().unwrap().parse::<$t>().unwrap(),)*
      )
    }
  };
  ($t:ty; $n:expr) => {
    (0..$n).map(|_|
                get!($t)
    ).collect::<Vec<_>>()
  };
  ($($t:ty),*; $n:expr) => {
    (0..$n).map(|_|
                get!($($t),*)
    ).collect::<Vec<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
        .map(|t| t.parse::<$t>().unwrap())
        .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

#[allow(unused_macros)]
macro_rules! debug {
  ($($a:expr),*) => {
    println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
  }
}

#[allow(dead_code)]
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")
}

#[allow(dead_code)]
fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer);
}

fn main() {
    let (n, m) = get!(u32, usize);
    let cakes = (0..n).map(|_i| get!(i64, i64, i64)).collect::<Vec<_>>();

    let ans = [
        (1, 1, 1),
        (1, 1, -1),
        (1, -1, 1),
        (1, -1, -1),
        (-1, 1, 1),
        (-1, 1, -1),
        (-1, -1, 1),
        (-1, -1, -1),
    ].into_iter()
        .map(|&(a, b, c)| {
            let mut memo = cakes
                .iter()
                .map(|&(x, y, z)| a * x + b * y + c * z)
                .collect::<Vec<_>>();
            memo.sort();
            memo.reverse();
            memo[0..m].into_iter().sum::<i64>()
        })
        .max()
        .unwrap();

    with_bufwriter(|mut out| writeln!(out, "{}", ans).unwrap());
}


Measured memory_bytes: 4352
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		double R1 = GetDouble();
		double R2 = GetDouble();
		double R3 = (R1 * R2) / (R1 + R2);
		Console.WriteLine($"{R3:F9}");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13268
#include<stdio.h>
#include<stdlib.h>

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

int can(void){
  int n;
  scanf("%d",&n);
  int *cnt=(int *)calloc(n,sizeof(int));
  int max=0;
  int min=n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    cnt[a]++;
    max=MAX(max,a);
    min=MIN(min,a);
  }
  if((max+1)/2!=min) return 0;
  if(max&1){
    if(cnt[min]!=2) return 0;
    for(i=max;i>min;i--) if(cnt[i]<2) return 0;
  } else {
    if(cnt[min]!=1) return 0;
    for(i=max;i>min;i--) if(cnt[i]<2) return 0;
  }
  return 1;
}

void run(void){
  puts(can()?"Possible":"Impossible");
}

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

Measured memory_bytes: 128
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

    #pragma GCC target("popcnt")

    string to_string(const string& s) { return '"' + s + '"'; }
    void debug_out() { cout << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) { cout << " " << to_string(H); debug_out(T...); }
    #ifdef LOCAL
        #define debug(...) cout << "#" << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    #else
        #define debug(...) 3;
    #endif

    #define fast_io ios_base::sync_with_stdio(false); \
                    cin.tie(nullptr); cout.tie(nullptr);
    using ld = long double;  using ui = uint_fast32_t;
    using ll = int_fast64_t; using ul = uint_fast64_t;

// -----------------------------------------------------------------------------

const int N = 1e5 + 5;
const int INF = 1e9 + 5;
int n, h[N];
int dp[N];

void solve() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    fill_n(dp, n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j <= i + 2; ++j) {
            if (j >= n) break;
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n - 1] << '\n';
}

// -----------------------------------------------------------------------------

int main() {
    fast_io; int t = 1;
    // cin >> t;
    // precompute();
    for (int i = 1; i <= t; ++i) solve();
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 51
//typedef std::pair<int,int> P;

    ll N,A[100001],ans=1;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N;
    REP(i,N)cin>>A[i];
    sort(A,A+N);
    if(N%2){
        if(A[0]!=0){
            cout<<0;
            return 0;
        }
    }
    int cnt=0,pos;
    REP(i,N){
        if(N%2&&i==0){
            continue;
        }
        if(cnt==0){cnt++;pos=A[i];}
        else{
            if(pos==A[i])cnt++;
            else{
                if(cnt!=2){
                    cout<<0;
                    return 0;
                }
                cnt=1;
                pos=A[i];
            }
        }
    }
    REP(i,N/2){
        ans*=2;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define print(x) cout << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T> >
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

vector<string> G(3000);
int mp[3000][3000];
int main() {
  int h, w;
  cin >> h >> w;

  rep(i, h) cin >> G[i];
  rep(i, h) {
    int j = 0;
    while (j < w) {
      if (G[i][j] == '#'){
        j++;
        continue;
      }
      if(j>=w)break;
        int s = j;
        int cnt = 0;
        while (G[i][j] != '#' && j<w) {
          cnt++;
          j++;
        }
        int e =j;
        srep(k,s,e){
          mp[i][k]+=cnt;
        }
    }
  }
  rep(i, w) {
    
    int j = 0;
    while (j < h) {
      if (G[j][i] == '#'){
        j++;
        continue;
      }
      int cnt = 0;
      if(j>=h)break;
        int s = j;
        while (G[j][i] != '#' && j<h) {
          cnt++;
          j++;
        }
        int e =j;
        srep(k,s,e){
          mp[k][i]+=cnt;
        }
    }
  }
  int ans = 0;
  rep(i,h){
    rep(j,w){
      maxs(ans,mp[i][j]);
    }
  }
  print(ans-1);
  return 0;
}

Measured memory_bytes: 28928
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/
string S;
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>S;
    int ans = S.size();
    REP(i,0,S.size()-1){
        if(S[i] != S[i+1]) {
            ans = min(ans, max(i+1, (int)S.size()-(i+1)));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

struct edge { int to, cap, cost, rev; };
int V;
const int MAX_V = 100;
vector<edge> G[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];
 
void add_edge(int from, int to, int cap, int cost) {
    G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
    G[to].push_back((edge){from, 0, -cost, (int)G[from].size() - 1});
}
 
int min_cost_flow(int s, int t, int f) {
    int res = 0;
    while (f > 0) {
        fill(dist, dist + V, INF);
        dist[s] = 0;
        bool update = true;
        while (update) {
            update = false;
            for (int v = 0; v < V; v++) {
                if (dist[v] == INF) continue;
                for (int i = 0; i < G[v].size(); i++) {
                    edge &e = G[v][i];
                    if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
                        dist[e.to] = dist[v] + e.cost;
                        prevv[e.to] = v;
                        preve[e.to] = i;
                        update = true;
                    }
                }
            }
        }
 
        if (dist[t] == INF) {
            return -1;
        }
 
        int d = f;
        for (int v = t; v != s; v = prevv[v]) {
            d = min(d, G[prevv[v]][preve[v]].cap);
        }
        f -= d;
        res += d * dist[t];
        for (int v = t; v != s; v = prevv[v]) {
            edge &e = G[prevv[v]][preve[v]];
            e.cap -= d;
            G[v][e.rev].cap += d;
        }
    }
    return res;
}

int main(void){
	cin >> V;
	int e, f; cin >> e >> f;
	rep(i, e){
		int u, v, c, d;
		cin >> u >> v >> c >> d;
		add_edge(u, v, c, d);
	}
	printf("%d\n", min_cost_flow(0, V - 1, f));
}

Measured memory_bytes: 3320
use std::cmp;
// use std::collections::HashMap;
// use std::collections::HashSet;
// use std::collections::VecDeque;
// use std::collections::BTreeSet;


// const INF: i64 = 1_000_000_000;
// const MOD: i64 = 998244353;


fn put(ans: &mut Vec<Vec<char>>, i: usize, j: usize, pat: &[&str]) {
    let k = pat.len();
    // println!("{:?}", k);
    // println!("{:?}", i);
    // println!("{:?}", j);
    for di in 0..k {
        for dj in 0..k {
            // println!("{:?} {:?}", di, dj);
            // println!("{:?}", ans);
            ans[i+di][j+dj] = pat[di].chars().nth(dj).unwrap();
        }
    }
}


fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());
    let n: usize = sc.read();
    let ans3 = vec![
        ".aa",
        "b..",
        "b..",
    ];
    let ans4 = vec![
        "abcc",
        "abdd",
        "ddba",
        "ccba",
    ];
    let ans5 = vec![
        "..abc",
        "..abc",
        "aadde",
        "bbg.e",
        "ccgff",
    ];
    let ans7 = vec![
        ".aabbcc",
        "a..ddee",
        "a..bbcc",
        "bdb....",
        "bdb....",
        "cec....",
        "cec....",
    ];

    // let mut anss = vec![[]; 8];

    let mut ans = vec![vec!['.'; n]; n];
    if n <= 2 {
        println!("-1");
        return;
    } else if n % 3 == 0 {
        for i in 0..(n/3) {
            put(&mut ans, i*3, i*3, &ans3);
        }
    } else if n == 4 {
        put(&mut ans, 0, 0, &ans4);
    } else if n == 5 {
        put(&mut ans, 0, 0, &ans5);
    } else {
        match n % 4 {
            3 => {
                put(&mut ans, 0, 0, &ans7);
            }
            0 => {
                put(&mut ans, 0, 0, &ans4);
                put(&mut ans, 4, 4, &ans4);
            }
            1 => {
                put(&mut ans, 0, 0, &ans4);
                put(&mut ans, 4, 4, &ans5);
            }
            2 => {
                put(&mut ans, 0, 0, &ans5);
                put(&mut ans, 5, 5, &ans5);
            }
            _ => panic!()
        }
        for i in 0..((n-7)/4) {
            let j = 4 * i + 7+(n-7)%4;
            put(&mut ans, j, j, &ans4);
        }
    }
    for i in 0..n {
        for j in 0..n {
            print!("{}", ans[i][j]);
        }
        println!();
    }
    //println!("{}", s);
}

// thanks, ir5
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 9340
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int R, G;
    cin >> R >> G;

    int ans = 2 * G - R;
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static public void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt(), ret = 0;

        for (int i = 1; i <= k; i++) {
            for (int j = 1; j <= k; j++) {
                for (int h = 1; h <= k; h++) {
                    ret += gcd(i, gcd(j, h));
                }
            }
        }

        System.out.println(ret);
    }

    private static int gcd(int n, int m) {
        int r;
        while (n > 0) {
            r = m % n;
            m = n;
            n = r;
        }
        return m;
    }
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	int sum=0;
	for(auto it:s)
		sum+=it-'0';
	int sum2=s[0]-'1'+(s.size()-1)*9;
	cout<<max(sum,sum2)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
   
   int a,b;
   
   scanf("%d %d",&a,&b);
   
   if(a%2 == 0 || b%2 == 0){
      printf("Even\n");
   }
   else {
      printf("Odd\n");
   }
   
   return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector< pair<int ,int> > amax,bmax;
  int n,a,b;
  cin >> n;
  int retu[n];
  for(int i = 0; i < n; i++){
    cin >> retu[i];
    if(i%2 == 0){
      int flag = 0;
      for(int j = 0; j < amax.size() ; j++) if(retu[i] == amax[j].second){
        flag = 1;
        amax[j].first += 1;
      }
      if(!flag) amax.push_back(make_pair(1,retu[i]));
    }
    else{
      int flag = 0;
      for(int j = 0; j < bmax.size() ; j++) if(retu[i] == bmax[j].second){
        flag = 1;
        bmax[j].first += 1;
      }
      if(!flag) bmax.push_back(make_pair(1,retu[i]));
    }
  }
  int ans = 0;
  sort(amax.begin(),amax.end());
  sort(bmax.begin(), bmax.end());
  //if(amax[amax.end()-1].second != bmax[bmax.end()-1].second) ans = n-(amax[amax.end()-1].first + bmax[bmax.end()-1].first);
  if(amax[amax.size()-1].second != bmax[bmax.size()-1].second) ans = n-(amax[amax.size()-1].first + bmax[bmax.size()-1].first);
  //cout << amax[amax.size()-1].second << " " <<  bmax[bmax.size()-1].second <<amax[amax.size()-1].first<< " " << bmax[bmax.size()-1].first <<endl;
  else if(amax[amax.size()-1].first + bmax[bmax.size()-1].first == n) ans = n/2;
  else if(amax[amax.size()-1].first - amax[amax.size()-2].first < bmax[bmax.size()-1].first - bmax[bmax.size()-2].first){
    ans = n-(amax[amax.size()-2].first + bmax[bmax.size()-1].first);
  }
  else ans = n-(amax[amax.size()-1].first + bmax[bmax.size()-2].first);

  cout << ans << endl;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=1;
  cin >>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >>a[i];
    if(a[i]%2==0)ans*=2;
  }
  cout << pow(3,n)-ans<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <cmath>

int main(){
    
    int n;
    cin >> n;
    vector<int> x(n,0);
    double ave = 0;

    for(int i=0;i<n;i++) cin >> x[i],ave += (double)x[i];
    ave = ave/n;


    double integral_part = 0;
    double fractional_part = modf(ave, &integral_part);//小数部分
    ave = (int)ave;
    if(fractional_part > 0.5) ave += 1;
    
    int sum = 0;
    for(int i=0;i<n;i++) sum += (int)pow((double)(x[i] - ave),2);

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
#define int long long
using namespace std;
int a[45];
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
signed main(){
	int n;
	cin>>n;
	int sum=0;
	rep(0,i,n)cin>>a[i];
	rep(0,i,n-2)if((a[i]<a[i+1]&&a[i+1]<a[i+2])||(a[i]>a[i+1]&&a[i+1]>a[i+2]))sum++;
	c(sum)
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  FOR(i, a, b + 1){
    if(c % i == 0) ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3132
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

k,s=get_i
ans=0
(k+1).times do|x|
  (k+1).times do|y|
    if s>=x+y and s-x-y<=k
      ans+=1
    end
  end
end
puts ans

Measured memory_bytes: 1788
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;

int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	k=min(k,n);
	cout<<k*x+(n-k)*y<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <climits>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <utility>
using namespace std;
int n;
pair<int, int> a[100005];//人数，编号
int main(){
    cin>>n;
    for (int i=1; i<=n; i++) {
        int x;
        cin>>x;
        a[i]=pair<int, int>(x,i);
    }
    sort(a+1, a+1+n);
    for (int i=1; i<=n; i++) {
        cout<<a[i].second<<" ";
    }
    return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 100
int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    while(a>0 || c>0){
        c-=b;
        if (c <= 0)
        {
            printf("Yes");
            return 0;
        }
        a -= d;
        if (a <= 0)
        {
            printf("No");
            return 0;
        }
    }
    return 0;
}

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

//int solve();
int main()
{
   int n;
   cin>>n;
   if(n>29)
        cout<<"Yes";
   else
        cout<<"No";
    return 0;
}
/*int solve()
{
    int n;
    cin>>n;
}*/


Measured memory_bytes: 3640
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string s;
    cin>>s;
    int cont=0;

    for(int t=1;t<s.size();t++){
        if(s[t-1]!=s[t])cont++;
    }

    cout<<cont<<"\n";
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
using namespace std;
#define LATTE 10000

int main(){
	int C1,C2,C3;
	while(cin>>C1>>C2>>C3){
		int cnt=0;
		for(int i=1;i<=10;i++){
			if(C1+C2+i<=20 && i!=C1 && i!=C2 && i!=C3) cnt++;
		}
		if(cnt/7.0>=0.5) puts("YES");
		else puts("NO");
	}
    return 0;
}

Measured memory_bytes: 1116
# coding: utf-8

# In[6]:


import numpy as np


# In[15]:


s = str(input())


# In[16]:


data = []
for i in range(len(s)-2):
    data.append(int(s[i:i+3]))
data = np.array(data)


# In[17]:


print(min(abs(753 - data)))



Measured memory_bytes: 12424
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memcpy( x, y, sizeof x )
using namespace std;

typedef long long LL;
typedef pair < int, int > pa;

inline int read()
{
	int sc = 0, f = 1; char ch = getchar();
	while( ch < '0' || ch > '9' ) { if( ch == '-' ) f = -1; ch = getchar(); }
	while( ch >= '0' && ch <= '9' ) sc = sc * 10 + ch - '0', ch = getchar();
	return sc * f;
}

LL x, y;
int a[70], b[70], cur = 59, nxt;

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	cin >> x >> y;
	if( x == y ) return printf( "1\n" ), 0;
	for( int i = 0 ; i < 60 ; i++ ) a[ i ] = x >> i & 1, b[ i ] = y >> i & 1;
	LL ans = y - x + 1;
	while( a[ cur ] == b[ cur ] ) cur--;
	for( int i = 0 ; i < cur ; i++ ) if( b[ i ] ) nxt = i;
	ans += ( 1LL << nxt ) - 1 - ( y & ( 1LL << nxt ) - 1 );
	ans += ( 1LL << cur );
	x &= ( 1LL << cur ) - 1; y &= ( 1LL << cur ) - 1;
	y |= ( 1LL << nxt ) - 1;
	ans -= max( x, y + 1 );
	cout << ans << endl;
}


Measured memory_bytes: 256
from collections import deque

N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
op = []
for i in range(M):
  m,v = map(int,input().split())
  op.append([v,m])
op.sort(reverse=True)
op = deque(op)

ans = 0
n = 0
v = op.popleft()
c = v[1]
while n != N:
  if A[n] < v[0]:
    ans += v[0]
    n += 1
    c -= 1
    if c == 0:
      if len(op) > 0:
        v = op.popleft()
        c = v[1]
      else:
        v = [0,0]
        c = v[1]
  else:
    ans += A[n]
    n += 1
print(ans)    

Measured memory_bytes: 24772
# -*- coding: utf-8 -*-

N = int(input())
A1List = list(map(int, input().split()))
A2List = list(map(int, input().split()))

max = 0

for n in range(0, N):
    sumA1 = 0
    sumA2 = 0
    
    for i in range(0, n+1):
        sumA1 = sumA1 + A1List[i]

    for j in range(n, N):
        sumA2 = sumA2 + A2List[j]

    sumA = sumA1 + sumA2
    
    if max <= sumA:
        max = sumA
        
print(max)
        
    

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

typedef long long i64;

using namespace std;

int main(){
    int N,M;
    vector<int> vec(1001,0);   
    cin>>N>>M;

    int ans = 1e9;

    for(int i=0;i<=1000;i++) vec[i+1] = vec[i]+i;

    vector<int> a,b;

    for(int i=0;i<=1000;i++){
        if(vec[i] - N  > 0 ) {
            a.push_back(vec[i] - N);
        }

    }

    for(int i=0;i<=1000;i++){
        if(vec[i] - M  > 0 ) {
            b.push_back(vec[i] - M);
        }

    }

    for(int i=0;i<a.size();i++){
        for(int j=0;j<b.size();j++){
            if(a[i] == b[j]) ans = a[i];
        }
    }

    cout<<ans<<endl;
   

}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define pb push_back
#define ll long long
#define ff first
#define ss second
using namespace std;

long long n,W;
long long w[101];
long long v[101];
long long dp[100][100001];

long long fun(long long i,long long wx){
    if(i==n){
        return 0;
    }
    if(dp[i][wx]!=-1){
        return dp[i][wx];
    }
    if(w[i]+wx>W){
        return dp[i][wx] = fun(i+1,wx);
    }
    else{
        return dp[i][wx] = max(fun(i+1,wx+w[i])+v[i],fun(i+1,wx));
    }
}

int main(){
    cin>>n>>W;
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<fun(0,0)<<endl;
    return 0;
}

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

a.sort()
a.reverse()

ret = 0
ret += a[0]

for i in range(1, len(a)):
    tmp = a[i]
    if i * 2 < len(a):
        ret += tmp
    if i * 2 + 1 < len(a):
        ret += tmp

print(ret)


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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> plus,minus;
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    if(x<0){
      minus.push_back(-x);
    }else{
      plus.push_back(x);
    }
  }
  int n=plus.size();
  reverse(minus.begin(),minus.end());
  int m=minus.size();
  int ans=1000000000;
  if(K<=n){
    ans=min(ans,plus.at(K-1));
  }
  if(K<=m){
    ans=min(ans,minus.at(K-1));
  }
  //cout<<"hello"<<endl;
  for(int i=1;i<=min(n,K);i++){
    //cout<<i<<" ";
    if(K-i>m||K-i<1){
      continue;
    }
    //cout<<i<<" ";
    ans=min(ans,2*plus.at(i-1)+minus.at(K-i-1));
    //cout<<i<<" ";
    ans=min(ans,plus.at(i-1)+2*minus.at(K-i-1));
    //cout<<i<<" ";
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1020
#include<stdio.h>

int main (void){

  char o[100]={0};
  int i=0;
  while(scanf("%c",&o[i]) != EOF){
    //printf("i=%d %c\n",i,o[i]);
    i++;
  }
  //printf("lasi=%d\n",i);
  if(o[0]==o[i-2]){
    printf("%c\n",o[0]);
  }else{
    printf("o\n");
  }
  return 0;
}

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

int X;

int calcu_pow(int a) {
	int n = a;
	while (true) {
		int m = n * a;
		if (m > X)
			break;
		n = m;
	}
	return n;
}

int main(void) {
	cin >> X;

	int ans = 1;
	if (X != 1) {
		for (int i = 2; i * i <= X; ++i) {
			int val = calcu_pow(i);
			ans = max(val, ans);
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	
	ll n , m ,k;
	cin>> n>> m >> k;
	ll dp[11];dp[0]=k;
	for(ll i=1 ;i<=10 ;i++){
		dp[i]=n*dp[i-1]-m;
		cout<<dp[i]<<endl;
	}
	return 0;
}

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

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const int MX = 100005;

int main(){
    int n;
    cin >> n;
    vi cnt(MX);
    ll tot = 0;
    rep(i, n) {
        int a;
        cin >> a;
        cnt[a]++;
        tot += a;
    }
    int q;
    cin >> q;
    rep(i, q) {
        int b, c;
        cin >> b >> c;
        tot += (ll)(c - b) * cnt[b];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << tot << endl;
    }
    return 0;
}


Measured memory_bytes: 3748
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };
#define MOD 1000000007
#define ARRAY_MAX 100015

//const int INF = 1e9 + 7;


ll s(ll num) {

	ll res = 0;
	while (num > 0) {
		res += num % 10;
		num /= 10;
	}
	return res;
}

bool check(ll n, ll m) {

	if (n*s(m) > m*s(n)) {
		return true;
	}
	else {
		return false;
	}

}


int main() {

	ll k;
	cin >> k;

	vector<ll> res;
	ll base = 1;

	for (int i = 0; i < 15; i++) {
		for (int j = 1; j < 130; j++)
		{
			res.push_back(base*(j + 1) - 1);
		}
		base *= 10;
	}
	sort(res.begin(), res.end());
	res.erase(unique(res.begin(), res.end()), res.end());

	ll siz = res.size();

	for (ll i = 0; i < res.size();++i)
	{
		for (ll j = i+1; j < res.size(); ++j)
		{
			if (check(res[i], res[j])) {
				res.erase(res.begin() + i);
				i--;
				break;
			}
		}
	}

	for (ll i = 0; i < k; i++) {
		cout << res[i] << endl;
	}

	return 0;
}


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

typedef long long ll;
const int MAX_N = 100;

int main() {
  int N;
  std::map<std::string, std::vector<std::pair<int, int>>> m;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::string S;
    int P;
    std::cin >> S >> P;
    m[S].push_back(std::make_pair(P, i + 1));
  }

  for(auto& p : m) {
    auto v = p.second;
    std::sort(v.begin(), v.end(), std::greater<std::pair<int, int>>());
    for(auto& val : v) {
      std::cout << val.second << std::endl;
    }
  }
}


Measured memory_bytes: 256
import java.util.*;
  
public class Main {
    private static final Scanner scn = new Scanner(System.in);
      
    public static void main(String[] args) {
        int n = scn.nextInt();
        StringBuilder sb = new StringBuilder(scn.next());
        for(int i = 1; i < n; i++) {
            sb.insert(0, scn.next() + " ");
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 26412
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int X;
    cin >> X;

    int x = 1;
    while ((1 + x) * x / 2 < X) {
        x++;
    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <cstring>

using namespace std;

string s;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> s;
	int n = s.length(), idx = 0;
	long long res = 0;
	for (int i = 0; i < n; ++i)
	{
		if (s[i] == 'W') {
			res += i - idx;
			++idx;
		}
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    int n;
    cin >> n;

    vector<int> abc;
    for (int i = 111; i <= 999; i += 111) {
        abc.push_back(i);
    }

    for (size_t i = 0; i < abc.size(); i++) {
        if (abc.at(i) >= n) {
            cout << abc.at(i) << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int Q;
int dp[64][64][64];

int dfs(int c, int a, int n){
  if(dp[c][a][n] >= 0) return dp[c][a][n];
  int res = 0;
  if(c > 0 && a > 0 && n > 0) res = max(res, dfs(c-1, a-1, n-1)+1);
  if(c > 1 && a > 0) res = max(res, dfs(c-2, a-1, n)+1);
  if(c > 2) res = max(res, dfs(c-3, a, n)+1);
  return dp[c][a][n] = res;
}

int main(){
  cin >> Q;
  rep(i, Q){
    memset(dp, -1, sizeof(dp));
    int c, a, n;
    cin >> c >> a >> n;
    int res = 0;
    while(c > 8 && a > 4 && n > 0){
      res++;
      c--;
      a--;
      n--;
    }

    while(c > 8 && a > 4){
      res++;
      c-=2;
      a--;
    }

    while(c > 8){
      res++;
      c-=3;
    }
    res += dfs(c, a, n);
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define MN 100000
int u[2][MN+5];
int main()
{
	int n,i,j,x,mx,ans=MN;
	scanf("%d",&n);
	for(i=1;i<=n;++i)scanf("%d",&x),++u[i&1][x];
	for(x=0;x<2;++x)
	{
		for(i=1,mx=0;i<=MN;++i)mx=max(mx,u[x][i]);
		for(i=1;i<=MN;++i)if(u[x][i]==mx)
		{
			for(j=1;j<=MN;++j)if(j!=i)ans=min(ans,n-mx-u[x^1][j]);
			break;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    long long int a,b;
    double k;
    scanf("%lld %lld",&a, &b);
    k=(a+b)/2.0;
    if(k-(long long int)k==0)
    {
        printf("%lld\n",(long long int)k);
    }
    else
        printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 1732
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	char c=0;
	int n = 0;
	cin >> s;
	for (char ch:s) {
		if (ch != c)n++;
		c = ch;
	}
	cout << n - 1 << endl;

	return 0;
}

Measured memory_bytes: 1148
#include <iostream>

using namespace std;


int main(){
    
    // 奇数人の場合、真ん中の人が0と答え、その両側に進むに従って2ずつ増える。
    // -> 同じ数を申告した人が2人いるはずで、2^((n-1)/2)通りになるはず
    
    // 偶数人の場合、真ん中の2人が1と答え、その両側に進むに従って2ずつ増える
    // -> 同じ数を申告した人が2人いるはずで、2^(n/2)通りになるはず
    
    int n;
    cin >> n;
    int a[100001];
    int num[100001];
    unsigned long ans = 1;
    
    long PRIME = 1000000007;
    
    
    for(int i = 0; i < 100001; i++){
        num[i] = 0;
    }
    for(int i = 0; i < n; i++){
        int tmp;
        cin >> tmp;
        if(n % 2 == tmp % 2){
            // nが奇数ならtmpは偶数
            // nが偶数ならtmpは奇数
            cout << 0 << endl;
            return 0;
        }
        num[tmp/2]++;
    }
    
    if(n % 2 == 0){
        // 偶数の場合
        bool flag = true;
        for(int i = 0; i < (n / 2); i++ ){
            if(num[i] != 2){
                flag = false;
                break;
            }
        }
        
        if(flag == false){
            cout << 0 << endl;
        } else {
            for(int i = 0; i < (n / 2); i++){
                ans *= 2;
                ans = ans % PRIME;

            }
                        cout << ans << endl;
        }
    } else {
        // 奇数の場合
        bool flag = true;
        if(num[0] != 1){
            flag = false;
        } else {
            for(int i = 1; i < (n / 2); i++){
                if(num[i] != 2){
                    flag = false;
                    break;
                }
            }
        }
        
        if(flag == false){
            cout << 0 <<endl;
        } else {
            for(int i = 0; i < (n / 2); i++){
                ans *= 2;
                ans = ans % PRIME;
            }
            
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 640
E = list(map(int,input().split()))
Ans = []
for i in range(E[0]+1):
    for k in range(E[0] - i+1):
        if i*10000 + k*5000 + (E[0] - i - k)*1000 == E[1]:
            Ans = [i,k,E[0] - i - k]
if len(Ans) == 0:
    print('-1 -1 -1')
else:
    print(Ans[0],Ans[1],Ans[2])


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int N;
ll d[10], v[10];

ll gcd(ll a, ll b){
    if(b == 0){return a;}
    return gcd(b, a%b);
}

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

int main(){
    while(std::cin >> N, N){
        REP(i, N){
            std::cin >> d[i] >> v[i];
        }

        ll c = lcm(d[0]*v[1], d[1]*v[0]) / d[0] / v[1];
        FOR(i, 2, N){
            c = lcm(d[0]*v[i]*c, d[i]*v[0]) / d[0] / v[i];
        }

        REP(i, N){
            printf("%lld\n", c * d[0] * v[i] / v[0] / d[i]);
        }
    }
}

Measured memory_bytes: 1156
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int n, a[1000006];
map <int, int> s;
bool check(int x){
	s.clear();
	for (int i = 1; i <= n; ++ i){
		if (a[i - 1] >= a[i]){
			map <int, int> :: iterator it = s.upper_bound(a[i]);
			map <int, int> :: iterator _it;
			while (it != s.end()){
				_it = it ++;
				s.erase(_it);
			}
			int j = a[i];
			while (s[j] == x - 1 && j)
				s[j --] = 0;
			if (j == 0)
				return false;
			if (s.count(j))
				s[j] ++;
			else
				s[j] = 1;
		}
	}
	return true;
}
int solve(int l, int r){
	int ans = r;
	while (l <= r){
		int m = l + r >> 1;
		if (check(m)){
			ans = m;
			r = m - 1;
		}
		else
			l = m + 1;
	}
	return ans;
}
int read(){
	int cnt = 0;
	char ch = getchar();
	while (ch < '0' || '9' < ch)
		ch = getchar();
	while ('0' <= ch && ch <= '9'){
		cnt = cnt * 10 + ch - '0';
		ch = getchar();
	}
	return cnt;
}
int main(){
	n = read();
	bool flag = true;
	for (int i = 1; i <= n; ++ i){
		a[i] = read();
		if (a[i - 1] >= a[i])
			flag = false;
	}
	if (flag){
		cout << 1 << endl;
		return 0;
	}
	cout << solve(2, 1000000000) << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MAXN=4e5+51;
struct Edge{
	ll from,to,dist;
	inline bool operator <(const Edge &rhs)const
	{
		return this->dist<rhs.dist;
	}
};
Edge ed[MAXN];
ll nc,cnt,x,y,z,tot;
ll dist[MAXN],boss[MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
inline void setup(ll cnt)
{
	for(register int i=0;i<cnt;i++)
	{
		boss[i]=i;
	}
}
inline void update()
{
	for(register int i=0;i<nc;i++)
	{
		dist[i]=min(dist[i],dist[(i+nc-1)%nc]+2);
	}
}
inline ll findb(ll node)
{
	if(node==boss[node])
	{
		return node;
	}
	boss[node]=findb(boss[node]);
	return boss[node];
}
inline void Union(ll x,ll y)
{
	ll bx=findb(x),by=findb(y);
	if(bx!=by)
	{
		boss[by]=bx;
	}
}
inline ll Kruskal()
{
	ll res=0,k=0;
	sort(ed,ed+tot),setup(nc);
	for(register int i=0;k<nc-1;i++)
	{
		if(findb(ed[i].from)!=findb(ed[i].to))
		{
			Union(ed[i].from,ed[i].to),res+=ed[i].dist,k++;
		}
	}
	return res;
}
int main()
{
	nc=read(),cnt=read(),memset(dist,0x3f,sizeof(dist));
	for(register int i=0;i<cnt;i++)
	{
		x=read(),y=read(),z=read();
		ed[tot++]=(Edge){x,y,z};
		dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
	}
	update(),update();
	for(register int i=0;i<=nc;i++)
	{
		ed[tot++]=(Edge){i,(i+1)%nc,dist[i]};
	}
	printf("%lld",Kruskal());
}

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

int main(){
	int n,count=0;
	string s;
	cin>>n;
	cin>>s;
	int x=n/2;
	if(n%2==1){
		cout<<"No"<<endl;
		return 0;
	}
	else{
		for(int i=0;i<x;i++){
			if(s[i]!=s[x+i]){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes";

return 0;
}

Measured memory_bytes: 256
/*
Link: 
*/

#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

void Res(){
    int n,r;
    cin>>n>>r;
  	int ans=0;
    if(n>=10) ans=r;
  	else ans=r+100*(10-n);
    cout<<ans;

}
int main(){
    IOS;
    Res();
}

Measured memory_bytes: 256
#include<cmath>
#include<queue>
#include<cstdio>

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

using namespace std;

const double EPS=1e-8;
const double INF=1e77;
const double PI=acos(-1);

struct state{
	double d;
	int pre,now,val;
	state(double d,int pre,int now,int val):d(d),pre(pre),now(now),val(val){}
	bool operator<(const state &S)const{ return d>S.d; }
};

int main(){
	int n;
	double r,theta; scanf("%d%lf%lf",&n,&r,&theta);
	theta*=PI/180;

	int x[20],y[20];
	rep(i,n) scanf("%d%d",x+i,y+i);

	double dist[20][20];
	rep(i,n) rep(j,n) dist[i][j]=hypot(x[i]-x[j],y[i]-y[j]);

	static bool adj[20][20][20]; // ツ陳シツ前ツづ?i ツづ可つ「ツづ?債。 j ツづ可つ「ツづゥツづ?つォ k ツづ可行ツつッツづゥツつゥツづ?つ、ツつゥ
	rep(i,n) rep(j,n) if(i!=j) rep(k,n) if(j!=k) {
		double phi=acos(((x[i]-x[j])*(x[k]-x[j])+(y[i]-y[j])*(y[k]-y[j]))/(dist[i][j]*dist[k][j]));
		if(PI-phi<=theta) adj[i][j][k]=true;
	}

	static double d[20][20][10001];
	rep(i,n) rep(j,n) rep(k,10001) d[i][j][k]=INF;
	priority_queue<state> Q;
	rep(i,n) if(i!=0 && dist[0][i]<=r) {
		d[0][i][1]=dist[0][i];
		Q.push(state(dist[0][i],0,i,1));
	}
	while(!Q.empty()){
		state S=Q.top(); Q.pop();
		double d_now=S.d;
		int pre=S.pre,now=S.now,val=S.val;

		if(d_now>d[pre][now][val]+EPS) continue;

		rep(nxt,n) if(adj[pre][now][nxt]) {
			double d_next=d_now+dist[now][nxt];
			if(d_next<=r && d_next+EPS<d[now][nxt][val+1]) {
				d[now][nxt][val+1]=d_next;
				Q.push(state(d_next,now,nxt,val+1));
			}
		}
	}

	int ans=0;
	rep(i,n) rep(j,n) rep(k,10001) if(d[i][j][k]<=r) ans=max(ans,k);
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 32532
//Tax Rate

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
using ll = long long;
#define range(a) (a).begin(),(a).end()


int main (){
    double N;cin >> N;
    rep(i,0,46298){
        int znk = i * 1.08;
        if(N==znk){
            cout << i << endl;
            break;
        }
        if(i==46297)cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256