akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a;
    sc(a);
    string s;
    getstr(s);
    cout << (a >= 3200?s:"red");
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF 1e15

#define MAX_N 1000

ll n;
vector<int> g[111111];
ll a[111111];

ll dfs(int pre,int v){
	if(g[v].size()==1)return a[v];
	ll sum=0;
	ll maxx=0;
	rep(i,g[v].size()){
		if(pre!=g[v][i]){
			ll aaa=dfs(v,g[v][i]);
			if(aaa==-INF)return -INF;
			sum+=aaa;
			maxch(maxx,aaa);
		}
	}
	ll x=sum-a[v];
	ll y=a[v]-x;
	if(x>=0&&y>=0&&x<=min(sum-maxx,sum/2))return y;
	else return -INF;
}

int main(){
	cin.sync_with_stdio(false);
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n-1){
		int aa,b;
		cin>>aa>>b;
		aa--; b--;
		g[aa].pb(b); g[b].pb(aa);
	}
	if(n==2){
		if(a[0]==a[1])cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		return 0;
	}
	rep(i,n){
		if(g[i].size()>1){
			if(dfs(-1,i)==0)cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
			return 0;
		}
	}
	return 0;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n,h;
	cin>>n>>h;
	vector<long long> a(n);
	vector<long long> b(n);
	for(int i=0;i<n;i++){
		cin>>a.at(i);
		cin>>b.at(i);
	}

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

	long long top=a.at(0);
	long long ans=0;

	for(auto t:b){
		if(t<top) break;

		h-=t;
		ans++;
		if(h<=0){
			cout<<ans<<endl;
			return 0;
		}
	}

	cout<<ans+(long long)ceil((double)h/top)<<endl;

	return 0;
}


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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int r ,g ;
	cin >> r >>g ;
	g *= 2 ;
	int i = -10000 ;
	while(1){
		int a = r + i ;
		if ( a == g ){
			cout << i << endl;
			break;
		}
		i ++ ;
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i, j;
  int a[3], b[3];
  int c[3][3];
  for( i=0; i<3; i++){
    for( j=0; j<3; j++){
      scanf("%d", &c[i][j]);
    }
  }
  a[0]=0;
  for( i=0; i<3; i++){
    b[i]=c[0][i]-a[0];
    a[1]=c[1][i]-b[i];
    a[2]=c[2][i]-b[i];
  }
  for( i=0; i<3; i++){
    for( j=0; j<3; j++){
      if(c[i][j]!=a[i]+b[j]){
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i=0;i<n;i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		System.out.println(d[n/2]-d[n/2-1]);
	}
	
}

Measured memory_bytes: 52420
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let (k, s): (isize, isize);
    input!(k, s);
    let mut ans = 0_usize;
    for x in 0..k + 1 {
        for y in 0..k + 1 {
            let z = s - x - y;
            if 0 <= z && z <= k {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

int main()
{
    long long A, B;

    cin >> A >> B;

    double min_A = A/0.08;
    double max_A = (A+1)/0.08;
    double min_B = 10*B;
    double max_B = 10*(B+1);

    double min = min_A;
    if(min_A < min_B)
    {
        min = min_B;
    }
    double max = max_A;
    if(max_A > max_B)
    {
        max = max_B;
    }

    if(ceil(min) >= max)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << (int)ceil(min) << endl; 
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String word;
        String[] sen = new String[1000];
        int i=0;
        word = scan.next();
        while(true){
            sen[i] = scan.next();
            if(sen[i].equals("END_OF_TEXT"))break;
            i++; 
        }
        int ans=0;
        int num=word.length();;
        for(int j=0;j<i+1;j++){
            if(sen[j].equalsIgnoreCase(word))ans++;
        }
        System.out.println(ans);
        return;
    }
}


Measured memory_bytes: 26148
N, K, Q = gets.chomp.split(" ").map(&:to_i)
a = {}
Q.times { |i| a[i + 1] = gets.chomp.to_i }

X = Hash.new(0)
a.each do |i, p|
  X[p] += 1
end

1.upto(N) do |p|
  if X[p] > Q - K
    puts "Yes"
  else
    puts "No"
  end
end


Measured memory_bytes: 12924
#include <stdio.h>
int func(int a, int b)
{
  int tmp;
  int r;
  if (a < b)
  {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0)
  {
    a = b;
    b = r;
    r = a%b;
  }
  return (b);
}

int main()
{
  int n;
  scanf("%d",&n);
  int i = 1;
  int j = 1;
  int k = 1;
  int sum = 0;
  while (i <= n)
  {
    k = 1;
    while (k <= n)
    {
      j = 1;
      while (j <= n)
      {
        sum += func(func(i,j),k);
        j++;
      }
      k++;
    }
    i++;
  }
  printf("%d",sum);
}

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

using namespace std;
#define PI 3.141592653589
void solve(){
	int a,b,H,M;
	cin>>a>>b>>H>>M;
	double angle = 6*M;
	angle = angle - (double)30*(H + (double)M/60);
	angle = PI*angle/180;
	double c = sqrt(a*a+b*b - (double)2*a*b*cos(angle));
	printf("%0.20lf\n",c);
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	
	solve();

	return 0;
}

Measured memory_bytes: 4176
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
int main()
{
	int n,m,b=0;
	cin>>m;
	n=m;
	while(n>=10)
	{
		b+=(n%10);
		n/=10;
	}
	b+=n;
	if(m%b==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define A 100005

typedef struct a{
    char name[100];
    int x;
}P;
P c[A];
int head,tail,n;

void enqueue(P p){
    c[tail]=p;
    tail=(tail+1)%A;
} 
P dequeue(){
    P x=c[head];
    head=(head+1)%A;
    return x;
}
int minimum(int a,int b){return a<b ? a: b;}
int main (){
    int m=0,d,i,j;
    P u;
    scanf("%d %d",&n,&j);
for(i=1;i<=n;i++){
    scanf("%s",c[i].name);
    scanf("%d",&c[i].x);
}
head=1;
tail=n+1;
while(head!=tail){
    u=dequeue();
    d=minimum(j,u.x);
    u.x-=d;
    m+=d;
    if(u.x>0)enqueue(u);
    else{
        printf("%s %d\n",u.name,m);
    }
}
return 0;
}


Measured memory_bytes: 11852
using System;
//using System.Text;
namespace AIZU_Cs_
{
    class Program
    {
        static void Main(string[] args)
        {
            int t;
            t = int.Parse(Console.ReadLine());
            Console.Write("{0}", t / 3600);
            t %= 3600;
            Console.Write(":{0}", t / 60);
            t %=60;
            Console.WriteLine(":{0}", t);
        }
    }
}

Measured memory_bytes: 9124
#include<stdio.h>
#define MAX 100
#define INFTY 1<<21
#define WHITE 0
#define GRAY  1
#define BLACK 2

//static const int WHITE = 0;
//static const int GRAY = 1;
//static const int BLACK = 2;

int n , M[MAX][MAX];

int prim() {
  int i,v,u,minv;
  int d[MAX],p[MAX],color[MAX];

  for(i = 0;i<n;i++) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1) {
    minv = INFTY;
    u = -1;
    for(i = 0;i<n;i++) {
      if(minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = BLACK;
    for(v = 0;v<n;v++) {
      if(color[v] != BLACK && M[u][v] != INFTY) {
      if(d[v] > M[u][v]) {
        d[v] = M[u][v];
        p[v] = u;
        color[v] = GRAY;
      }
      }
    }
  }
  int sum = 0;
  for(i = 0;i<n;i++) {
    if(p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}

int main() {
  int i,j,e;
  scanf("%d\n", &n);

  for(i = 0;i<n;i++) {
    for(j=0;j<n;j++) {
      scanf("%d\n", &e);
      M[i][j] = (e == -1) ? INFTY:e;
    }
  }

  printf("%d\n", prim());

  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(N*A, B) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int ans = -1;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            string s = to_string(v[i]*v[j]);
            bool valid = true;
            for (int k = 0; k+1 < s.size(); ++k) {
                if(s[k+1]-s[k] != 1) valid = false;
            }
            if(valid){
                ans = max(ans, stoi(s));
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3348
#include <iostream>
#include <queue>
#include <vector>
#include <functional>

constexpr int MAX_N = 20;
constexpr int INF = (int)1e7;
using P = std::pair<int, int>;

struct edge {
	int to, cost;
	edge() = default;
	edge(const edge&) = default;
	edge(int _t, int _c) : to(_t), cost(_c) {}
	edge& operator= (const edge&) = default;
};

int n, m;
std::vector<edge> G[MAX_N];
int f, t, mym, cm;
int d[MAX_N];

int dijkstra(int s, int g) {
	std::fill(d, d + n, INF);
	std::priority_queue<P, std::vector<P>, std::greater<P>> que;
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;

		if (v == g)
			break;

		if (d[v] < p.first)
			continue;

		for (int i = 0; i < G[v].size(); ++i) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
	return d[g];
}

int main() {
	std::cin >> n >> m;
	char ch;
	int a, b, c, d;
	for (int i = 0; i < m; ++i) {
		std::cin >> a >> ch >> b >> ch >> c >> ch >> d;
		--a;
		--b;
		G[a].push_back(edge(b, c));
		G[b].push_back(edge(a, d));
	}
	std::cin >> f >> ch >> t >> ch >> mym >> ch >> cm;

	--f;
	--t;

	int x = dijkstra(f, t), y = dijkstra(t, f);
	int ans = mym - cm - x - y;
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

int main(){
int h,a;
cin>>h>>a;
if(h%a==0){
    cout<<h/a<<endl;
}else{
    cout<<h/a+1<<endl;
}
}









Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n= sc.nextInt();
    int sum = 0;
    String str[] = String.valueOf(n).split("");
    for (int i=0 ; i < str.length ; i++){
        sum += Integer.parseInt(str[i]);
    }
        System.out.println(n%sum==0?"Yes":"No");
  }
}

Measured memory_bytes: 23636
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

const int N=305;

int n,k,MOD,f[N][N],s[N][N],c[N][N];

int main()
{
	scanf("%d%d%d",&n,&k,&MOD);
	c[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		c[i][0]=1;
		for (int j=1;j<=i;j++)
			c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
	}
	for (int i=0;i<=k;i++) f[1][i]=1,s[1][i]=k-i+1;
	for (int i=2;i<=n+1;i++)
	{
		for (int j=0;j<=k;j++)
			for (int l=1;l<i;l++)
				(f[i][j]+=(LL)f[i-l][j]*s[l][j+1]%MOD*c[i-2][l-1]%MOD)%=MOD;
		for (int j=k;j>=0;j--) s[i][j]=(s[i][j+1]+f[i][j])%MOD;
	}
	printf("%d",f[n+1][0]);
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 

using namespace std;

# define p(s) cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) cout << (j ? "Yes" : "No") << endl;

string lpad(string l,int s,int n){
    string temp = to_string(n);
    string res = "";
    int loop = s - temp.size();
    while(loop--) res+=l;

    return res+temp;
}

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2] ;

    std::sort(a,a+3);

    p(a[2]*10+a[1]+a[0])
}

Measured memory_bytes: 256
n = input()
if n == "SUN":
  print(7)
else:
  if n == "MON":
    print(6)
  else:
    if n == "TUE":
      print(5)
    else:
      if n == "WED":
        print(4)
      else:
        if n == "THU":
          print(3)
        else:
          if n == "FRI":
            print(2)
          else:
            print(1)

Measured memory_bytes: 2940
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2607
#include<iostream>
#include<fstream>
#define fin cin
using namespace std;

int n = 0;
int d = 0;
int x = 0;

int dp[100001] = {0, };
int fx[10][10];//?????????????????\????????? fx[d][n]


int main()
{
   // ifstream fin("in.txt");

    //input
    fin >> n >> d >> x;
    for(int i = 0; i < d; i++)
    {

        for(int j = 0; j < n; j++)
        {
            fin >> fx[i][j];
        }
    }

    //?????????
    for(int i = 1; i < 100001; i++)
    {
        dp[i] = -10;
    }

    //dp
    for(int day = 0; day < d - 1; day++)
    {
        for(int i = 0; i <= x; i++)dp[i] = i;
        for(int i = 0; i < n; i++) 
        {
            for(int j = 0; j <= x; j++)
            {

                int sub = j - fx[day][i];
                if(0 <= sub) 
                {

                    dp[j] = max( dp[sub] + fx[day + 1][i], dp[j] );

                }


            }
        }
        int ans_sub = 0;
        for(int k = 0; k <= 100000; k++)
            if(dp[k] > dp[ans_sub]) ans_sub = k;
        x = dp[ans_sub];
    }

    int ans_sub = 0;
    for(int i = 0; i <= 100000; i++)
        if(dp[i] > dp[ans_sub]) ans_sub = i;

    cout << dp[ans_sub] << endl; 

    return 0;
}

Measured memory_bytes: 3464
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

bool solve(LL &maxs, LL &n, int &c) {
    return (c+1) * log(maxs) >= log(n);
}

long long meguru_bin(LL &n, int &c) {
    long long ok = n + 1;
    long long ng = -1;

    //dump(c);
    while (abs(ok - ng) > 1) {
        long long mid = ng + (ok - ng) / 2;
        //dump(mid);
        if (solve(mid, n, c)) ok = mid;
        else ng = mid;
    }
    //dump(ok);
    return ok;
}

void solve() {
    LL n, a;
    cin >> n >> a;
    LL ans = n + 1;
    REP(i,0,41) {
        LL tmp = meguru_bin(n,i);
        RREP(j,0,i+2) {
            if ((LL)pow(tmp - 1, j) * (LL)pow(tmp, i + 1 - j) >= n) {
                LL sum = (tmp - 1) * j + tmp * (i + 1 - j);
                ans = min(ans, sum + a * i);
                //dump(j);
                //dump(sum + a * i);
                break;
            }
        }
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int G[501][501],n,used[501];

int dfs(int v,int d){
	if(d>2)return 0;
	used[v]=1;
	int res=1;
	for(int i=0;i<=n;i++)if(G[v][i])res+=dfs(i,d+1);
	
	return res;
}

int main(void){
	
	int m;
	
	while(cin >> n >> m,n|m){
		fill(G[0],G[501],0);
		fill(used,used+501,0);
		
		for(int i=0;i<m;i++){
			int a,b;
			cin >> a >> b;
			G[a][b]=G[b][a]=1;
		}
		dfs(1,0);
		int sum=0;
		for(int i=0;i<501;i++)sum+=used[i];
		cout << sum-1 << endl;
	}
	return 0;
}

Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
// undirected graph
struct ArticulationPoint {
  int V;
  vector<vector<int>> G;
  vector<int> visited, prenum, parent, lowest;
  int timer;
  ArticulationPoint() {}
  ArticulationPoint(int V)
      : V(V), G(V), visited(V), prenum(V), parent(V), lowest(V) {}
  void add_edge(int s, int t) {
    G[s].push_back(t);
    G[t].push_back(s);
  }
  void dfs(int cur, int prev) {
    // ノードcurを訪問した直後の処理
    prenum[cur] = lowest[cur] = timer;
    timer++;
    visited[cur] = true;
    for (auto next : G[cur]) {
      if (not visited[next]) {
        // node-cur からnode-nextへ訪問する直前の処理
        parent[next] = cur;
        dfs(next, cur);
        // node-nextの探索が終了した直後の処理
        lowest[cur] = min(lowest[cur], lowest[next]);
      } else if (next != prev) {
        // edge(cur-->next)がBack-edgeの場合の処理
        lowest[cur] = min(lowest[cur], prenum[next]);
      }
    }
  }
  set<int> art_points(int root = 0) {
    fill(all(visited), false);
    timer = 1;
    // lowestの計算
    dfs(root, -1); // 0 is root
    set<int> ap;
    int np = 0;
    for (int i = 1; i < V; i++) {
      int p = parent[i];
      if (p == 0)
        np++;
      else if (prenum[p] <= lowest[i])
        ap.insert(p);
    }
    if (np > 1)
      ap.insert(root);
    return ap;
  }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int V, E;
  cin >> V >> E;
  ArticulationPoint g(V);
  loop(E) {
    int s, t;
    cin >> s >> t;
    g.add_edge(s, t);
  }
  auto x = g.art_points();

  for (auto a : x)
    cout << a << endl;
  return 0;
}



Measured memory_bytes: 4332
#include <stdio.h>

int main(void){
  char c;
  int i;
  for(i=0;i<3;i++){
    scanf("%c",&c);
    if(c=='1') printf("%d",9);
    if(c=='9') printf("%d",1);
  }
  
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
'use strict'

const main = input => {
	const w = input.trim().split('\n')[1].split(' ').map(Number)
	const total = w.reduce((acc, cur) => acc + cur, 0)
	let min = total

	for (let i = 0; i < (w.length - 1); i++) {
		const s1 = w.slice(0, i + 1).reduce((acc, cur) => acc + cur, 0)
		const s2 = w.slice(i + 1).reduce((acc, cur) => acc + cur, 0)
		min = Math.min(min, Math.abs((s1) - (total - s1)))
	}

	console.log(min)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7624
n = int(input())
if n <= 9:
    print(n)
elif n <= 99:
    print(9)
elif n <= 999:
    print(9 + n - 99)
elif n <= 9999:
    print(909)
elif n <= 99999:
    print(909 + n - 9999 )
else:
    print(90909)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String s = sc.nextLine();
        sc.close();

        int judge = 1;
        for (int i = 0; i < s.length(); i++) {
            if (i != a) {
                if (0 <= Character.getNumericValue(s.charAt(i)) && 9 >= Character.getNumericValue(s.charAt(i))) {
                    continue;
                } else {
                    judge = 0;
                    break;
                }
            } else {
                if (s.charAt(i) == '-') {
                    continue;
                } else {
                    judge = 0;
                    break;
                }
            }
        }

        if (judge == 1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    int n = s.Length;
		bool answer = true;

    for(int i = 0; i < n; i++)
    {
      if(i % 2 == 0)
      {
        if(s[i] == 'L') answer = false;
      }else
      {
        if(s[i] == 'R') answer = false;
      }
    }

		Console.WriteLine(answer?"Yes":"No");
	}
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
	public static int top = 0;
	public static int[] stack = new int[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		}
		
		System.out.println(pop());
	}
	
	public static void push(int x) {
		stack[++top] = x;
	}
	
	public static int pop() {
		top--;
		return stack[top+1];
	}
}

Measured memory_bytes: 26300
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int a,b;
  std::string s;
  std::cin >> a >> b >> s;

  bool c = true;
  if(s.size() != a+b+1)
    c = false;
  if(s[a]!='-')
    c = false;
  int h = 0;
  rep(i,a+b+1) {
    if(s[i]=='-')
      h++;
    if(h > 1){
      c = false;
      break;
    }
  }


  if(c)
    std::cout << "Yes" << '\n';
  else
    std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
const int MO=1e9+7; 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
bool check(int x) 
{   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
void solve(){
	int n;
	cin>>n;
	for(int i=n;i>0;i--){
      if(check(i)){
      	cout<<i;
      	break;
      }
	}
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n;
	cin >> n;
	vector<int> p(n);
	vector<int> q(n);
	for (int i = 0; i < n; i++){
		cin >> p[i];
	}
	for (int i = 0; i < n; i++){
		cin >> q[i];
	}
	vector<int> vec1;
	for (int i = 1; i <= n; i++){
		vec1.push_back(i);
	}
	int coun1 = 0;
	do{
		if (p == vec1) break;
		coun1++;
	}while(next_permutation(vec1.begin(), vec1.end()));
	vector<int> vec2;
	for (int i = 1; i <= n; i++){
		vec2.push_back(i);
	}
	int coun2 = 0;
	do{
		if (q == vec2) break;
		coun2++;
	}while(next_permutation(vec2.begin(), vec2.end()));
	cout << abs(coun1 - coun2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N,Q;
  cin>>N>>Q;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];
  vector<ll> L(Q),R(Q);
  rep(i,Q) cin>>L[i]>>R[i];

  vector<ll> B=A;
  B.push_back(-MOD);
  B.push_back(MOD);
  sort(B.begin(),B.end());

  vector<int> ans(Q,0);
  for(int q=0;q<Q;q++){
    int r=upper_bound(B.begin(),B.end(),R[q])-B.begin();
    int l=lower_bound(B.begin(),B.end(),L[q])-B.begin();
    r--;l--;
    ans[q]=r-l;
  }

  rep(i,Q) cout<<ans[i]<<endl;

  return 0;
}



Measured memory_bytes: 6844
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

vector<ll> runrun = {};
int l = 0;

ll add(ll a, int &l) {
    if(a > 4000000000) return 0;
    ll res = a * 10;
    ll aa = a % 10;
    for(int i=-1; i<2; i++) {
        if(aa == 9 && i == 1) continue;
        if(aa == 0 && i == -1) continue;
        runrun.push_back(res + aa + i);
        l++;
        //cout << l << endl;
        add(res + aa + i, l);
    }
}

int main() {
    int k; cin >> k;
    Rep(i, 1, 10) {
        runrun.push_back(i);
        add(i, l);
    }
    sort(all(runrun));
    //rep(i, 10000) cout << runrun[i] << endl;
    cout << runrun[k-1] << endl;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define forn(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;




int main()
{
  float n , m ,val=0,total=0 ,qot=0;
  float tab[1001] ;

  cin >>n>>m  ;
  for (int i=0 ; i<n ; i++ ){
    cin >>tab[i] ;
    total += tab[i] ;
  }
 qot = total/(4*m) ;
  for(int i=0 ; i<n ; i++ ){
    if(tab[i] >= qot )val++ ;
  }
  if(val<m) cout << "No";
    else cout <<"Yes" ;


  return 0 ;
}


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

#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef tuple<int, int, int> TP;
typedef vector<int> VI;
typedef double T;
typedef vector<T> VT;
typedef vector<VT> VVT;

const LL MOD = 1e9 + 7;
const double EPS = 1e-10;
mt19937 rng(7); // random generator using 7 for seed
const int MAXN = 110;

int w[MAXN], v[MAXN];
int dp[MAXN][100100];
bool vis[MAXN][100100];

int main() {
    int N, W;
    scanf("%d%d", &N,&W);
    for(int i=0;i<N;i++) {
        scanf("%d%d", &w[i], &v[i]);
    }
    for(int i=0;i<MAXN;i++) {
        for(int j=0;j<=100000;j++) {
            dp[i][j] = -1u/2;
        }
    }
    dp[0][v[0]] = w[0];
    vis[0][v[0]] = true;
    int ans = v[0];
    for(int i=1;i<N;i++) {
        vis[i-1][0] = true;
        dp[i-1][0] = 0;
        for(int j=0;j<=100000;j++) {
            if(vis[i-1][j]) {
                dp[i][j+v[i]] = min(dp[i][j+v[i]], dp[i-1][j] + w[i]);
                if(dp[i][j+v[i]] <= W) {
                    vis[i][j+v[i]] = true;
                    ans = max(ans, j+v[i]);
                } else {
                    dp[i][j+v[i]] = -1u/2;
                }
                dp[i][j] = min(dp[i][j], dp[i-1][j]);
                vis[i][j] = true;
            }
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 52224
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
  
  string s;cin>>s;
  
  int a0=0,a1=0;
  
  rep(i,s.size()) {
    if (s[i]=='0') a0++;
    else a1++;
  }
  
  cout<<2*min(a0,a1)<<endl;
}


Measured memory_bytes: 512
N = gets.chomp.to_i

# N = 1000

p = 100
array = (1..p).to_a.repeated_permutation(3).to_a
keys = {}
100000.times do |i|
  keys[i+1] = 0
end

array.each do |a|
  x, y, z = a
  n = x*x + y*y + z*z + x*y + y*z + z*x
  keys[n] += 1
end

N.times do |n|
  puts(keys[n+1])
end

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main()
{
    int h, w, n;

    cin >> h >> w >> n;
    int res(0);
    int ma = max(h, w);
    int mi = min(h, w);
    rep(i, mi)
    {
        n -= ma;
        res++;
        if (n <= 0)
            goto end;
    }
    rep(i, ma)
    {
        n -= (ma - mi);
        res++;
        if (n <= 0)
            goto end;
    }

end:
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
ll cost[10],n;
map<ll,ll> dp;
ll dfs(ll x)
{
	if(x==0) return 0;
	if(dp.count(x)) return dp[x];
	ll last[6]={x/2,x/2+1,x/3,x/3+1,x/5,x/5+1};
	ll index[6]={2,2,3,3,5,5};
	ll res=1LL<<60;
	int i;
	for(i=0;i<6;i++)
	{
		if(last[i]<x)
		{
			res=min(res,dfs(last[i])+(ll)min((__int128)abs(last[i]-x)*cost[0],(__int128)abs(last[i]*index[i]-x)*cost[0]+cost[index[i]]));
		}
	}
	return dp[x]=res;
}
int main()
{
	int _;
	for(cin>>_;_;_--)
	{
		dp.clear();
		scanf("%lld%lld%lld%lld%lld",&n,cost+2,cost+3,cost+5,cost);
		printf("%lld\n",dfs(n));
	}
	return 0;
}

Measured memory_bytes: 4384
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b, c, tmp;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int MOD = 1000000007;
const int INF = 1 << 30;
int dp[100005],h[100005];

int main(){
  int n; cin >> n;
  rep(i,n){
    cin >> h[i];
  }
  
  rep(i,100005) dp[i] = INF;
  
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  
  for(int i = 2; i < n; i++){
    chmin(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
    chmin(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
  }
  
  cout << dp[n-1] << endl;
  
  return 0;
}

Measured memory_bytes: 1024
N,M = map(int,input().split())
L=[]
R=[]

for i in range(M):
  l,r = map(int,input().split())
  L.append(l)
  R.append(r)
  
Rm=min(R)
LM=max(L)

if Rm-LM >= 0:
  print(Rm-LM+1)
  
else:
  print(0)

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

int main(void){
	int n,m,l;
	int x;
	while(cin>>n>>m>>l,n||m||l){
		int z=0;
		int ans=0;
		for(int i=0;i<n;i++){
			cin>>x;
			if(x>=l)z=m;
			if(z>0)ans++;
			z--;
		}
		cout<<(ans>0?ans-1:ans)<<endl;
	}
	return 0;
}



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{ int t,x,y; char op  ;
while(1)
{ cin>>x>>op>>y ;
    if(op=='+') cout<< x+y << endl;
   else if(op=='-') cout<< x-y << endl;
   else if(op=='*') cout<< x*y << endl;
   else if(op=='/') cout<< x/y << endl;
else break ;

}
    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	sort(A.begin(),A.end());
	cout << A[N - 1] - A[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main(){
    int n,x[105],y[105],h[105];
    int H;
    bool flag=true;
    cin>>n;
    rep(i,n){
        cin>>x[i]>>y[i]>>h[i];
    }
    for(int k=0;k<n;k++){
        for(int i=0;i<=100;i++){
            for(int j=0;j<=100;j++){
                H=h[k]+abs(x[k]-i)+abs(y[k]-j);
                for(int l=0;l<n;l++){
                    if(h[l]!=max((H-abs(x[l]-i)-abs(y[l]-j)),0)){
                        flag=false;
                        break;
                    }
                }
                if(flag){
                    cout<<i<<" "<<j<<" "<<H<<endl;
                    return 0;
                }
                flag=true;
            }
        }
    }
    return 0;
}



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

const long long MOD = 1000000007;
using ll = long long;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

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

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

void solve(long long S){
    ll ans = 0;
    for(int i = 1;i <= S;i++){
        if(i * 3 > S)break;
        ll ball = S - i * 3;
        //cout<<i<<" "<<COM(i + ball - 1, ball)<<endl;
        ans += COM(i + ball - 1, ball);
        ans %= MOD;
    }
    cout<<ans<<endl;
}

int main(){
    COMinit();
    long long S;
    scanf("%lld",&S);
    solve(S);
    return 0;
}


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

public class Main {

	static Main obj = new Main();
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static int vertex;
	static int edges;
	static int start;
	static int[] cost;
	static int[] parent;
	static boolean[] visited;
	static ArrayList<Edge>[] graph;

	private class Edge implements Comparable<Edge> {
		int from;
		int to;
		int weight;

		public Edge(int from, int to, int weight) {
			this.from = from;
			this.to = to;
			this.weight = weight;
		}

		@Override
		public int compareTo(Edge other) {
			return this.weight - other.weight;

		}
	}

	public static void main(String[] args) throws IOException {
		input();
		dijk(start);
	}

	public static void dijk(int index) {
		// int added = 1;
		cost[index] = 0;
		visited[index] = true;
		parent[index] = index;
		PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
		for (Edge temp : graph[index]) {
			pq.offer(temp);
			cost[temp.to] = temp.weight;
		}
		while (!pq.isEmpty()) {
			Edge e = pq.poll();
			if (visited[e.to]) {
				continue;
			}
			visited[e.to] = true;
			// added++;
			for (Edge f : graph[e.to]) {
				if (!visited[f.to] && cost[f.to] > f.weight + e.weight) {
					cost[f.to] = f.weight + e.weight;
					parent[f.to] = f.from;
					pq.offer(obj.new Edge(f.from, f.to, f.weight + e.weight));
				}
			}
		}
		for (int i : cost) {
			if (i == Integer.MAX_VALUE) {
				System.out.println("INF");
			} else {
				System.out.println(i);
			}
		}
	}

	@SuppressWarnings("unchecked")
	public static void input() throws IOException {
		StringTokenizer st = new StringTokenizer(br.readLine());
		vertex = Integer.parseInt(st.nextToken());
		edges = Integer.parseInt(st.nextToken());
		start = Integer.parseInt(st.nextToken());
		cost = new int[vertex];
		parent = new int[vertex];
		visited = new boolean[vertex];
		graph = new ArrayList[vertex];
		for (int i = 0; i < vertex; i++) {
			graph[i] = new ArrayList<Edge>();
			cost[i] = Integer.MAX_VALUE;
		}
		for (int i = 0; i < edges; i++) {
			st = new StringTokenizer(br.readLine());
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			graph[a].add(obj.new Edge(a, b, c));
		}

	}
}

Measured memory_bytes: 124740
Imports System.Collections.Generic
Imports System.Console
Imports System.Math  
Module Program
 	Sub Main()
        Dim input() As String = Console.ReadLine().Split(" ")
        Dim H As Integer = input(0)
        Dim W As Integer = input(1)
        Dim inputB() As String = Console.ReadLine().Split(" ")
        Dim h2 As Integer = inputB(0)
        Dim w2 As Integer = inputB(1)
        Console.WriteLine((H-h2)*(W-w2))
    End Sub
End Module


Measured memory_bytes: 13268
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
    
        if(X >= A){
            System.out.println(10);
        }else{
            System.out.println(0);
        }
    }
}


Measured memory_bytes: 21716
/*----- || Hare Krishna || -----*/

/*  "WHY DO WE FALL, BRUCE?"  */

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define elif else if
#define pb push_back
#define pf push_front
#define PI 3.1415926535897932384
#define MOD 1000000007
using namespace std;

char alpha[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

string s;
int t;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string s1,s2;
    cin >> s1 >> s2;
    int ans=INT_MAX;
    
    int sz2 = s2.size();
    
    for(int i=0; i<s1.size()-sz2+1; i++){
    	
    	int un_match=0;
    	
    	for(int j=0; j<sz2; j++){
    		if( s2[j]!=s1[i+j] ){
    			un_match++;
			}
		}
    	
    	ans = min(ans,un_match);
    	
	}
    cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=(ll)(1e9+7);
ll run();
int main() {
#ifdef home
    freopen("i", "r", stdin);
    freopen("d", "w", stderr);
#endif
    cout.precision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    run();
    return 0;
}
const ll inf = (1e18+5);

void max_self(int &a, int b){
    a= max(a,b);
}

void min_self(ll &a, ll b){
    a=min(a,b);
}

vector<int> a(401);
vector<ll> prefix_sum(401,0);
int n,k;
ll dp[401][401];

ll f(int i, int j){
    if(j==i)
        return a[i];
    if(dp[i][j]!=-1)
        return dp[i][j];
    ll ans = LLONG_MAX;
    for(int k=i;k<j;k++){
        ans = min(ans, f(i,k)+f(k+1,j)+prefix_sum[j]-prefix_sum[i-1]);
    }
    return dp[i][j]=ans;
}

ll run() {
    ll sum = 0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        prefix_sum[i]=sum;
    }
    memset(dp,-1l,sizeof(dp));

    ll ans = f(1,n)-sum;
    cout<<ans;
}


Measured memory_bytes: 1536
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		print();
	}

	private static void print() throws IOException {
		int a;
		int b;
		int c;

		Scanner scn = new Scanner(System.in);
		a = scn.nextInt();
		b = scn.nextInt();
		c = scn.nextInt();
		compare(a, b, c);
	}

	private static void compare(int a, int b, int c) {
		if (a < b && b < c){
				System.out.println("Yes");
		} else  {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26340
import math
X, N = map(int, input().split())
p_list = list(map(int, input().split()))

if N == 0 or not X in p_list:
    print(X)
else:
    for i in range(1,100):
        if not X-i in p_list:
            print(X-i)
            break
        elif not X+i in p_list:
            print(X+i)
            break

Measured memory_bytes: 9144