akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a[2222];
int main()
{
	int n,x,y;
	cin>>n>>x>>y;
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++)
		{
			int dist=j-i;
			dist=min(dist,abs(i-x)+1+abs(j-y));
			a[dist]++;
		}
		for(int i=1;i<n;i++)
			cout<<a[i]<<endl;
	
	return 0;
}

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

int main() {
  
	long long int a,b[1010],c[1010],d[1010],e,f;
  cin >> a;
  
  for(int i=0;i<a;i++){
    cin >> b[i] >>c[i];
  
  }
  
  
  for(int i=0;i<a-1;i++){
  
     e = max(((b[i]+b[i+1]-1)/b[i+1]),((c[i]+c[i+1]-1)/c[i+1]));
    
   b[i+1] *= e;
    c[i+1] *= e;
    }
  
    cout << b[a-1]+c[a-1] << endl;
  
}
  
  
  


Measured memory_bytes: 256
function main(input) {
  const n: number = parseInt(input.split('\n')[0], 10);
  const odd: number;
  const even: number;
  
  if(n%2 == 0) {
    odd = n/2;
    even = n/2;
  } else {
    odd = (n-1)/2 + 1;
    even = (n-1)/2;
  }
  console.log(odd/(even+odd));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	int n;
	long long x, a;
	scanf("%d %lld", &n, &x);
	long long vals[n];
	long long vals1[n];
	for (int i = 0; i < n; i++) {
		scanf("%lld", &vals[i]);
		vals1[i] = vals[i];
	}
	long long cont1 = 0;
	long long cont2 = 0;
	for (int i = 0; i < n - 1; i++) {
		long long aux = vals[i] + vals[i + 1];
		if (aux > x) {
			long long restamos = aux - x;
			if (restamos > vals[i + 1]) {
				cont1 += vals[i + 1];
				
				restamos -= vals[i + 1];
				vals[i + 1] = 0;
				cont1 += restamos;
				//vals[i] -= restamos;
			}else {
				cont1 += restamos;
				vals[i + 1] -= restamos;
			}
		}

		aux = vals1[n - i - 1]+ vals1[n - i - 2];
		if (aux > x) {
			long long  restamos = aux - x;
			if (restamos > vals1[n - i - 2]) {
				cont2 += vals1[n - i - 2];
				restamos -= vals1[n - i - 2];
				vals1[n - i - 2] = 0;
				cont2 += restamos;
				//vals1[i] -= restamos;
			}else {
				cont2 += restamos;
				vals1[n - i - 2] -= restamos;
			}
		}
		
	}
	//cout << cont1 <<endl;
	//cout << cont2 <<endl;
	printf("%lld\n", (cont1 > cont2? cont2 : cont1));
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAXN (int)(1e5+1)
using namespace std;
vector<int>adj[MAXN];
bool visited[MAXN];
int dist[MAXN];
void dfs(int u)
{
	visited[u]=true;
	dist[u]=0;
	for(auto v:adj[u])
	{
		if(!visited[v])dfs(v);
		dist[u]=max(dist[u],dist[v]+1);
	}
}
int main()
{
	fastio;
	int n,m,x,y;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		adj[x].push_back(y);

	}
	for(int i=1;i<=n;i++)
	{
		if(!visited[i])
		{
			dfs(i);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		ans=max(ans,dist[i]);
	cout<<ans<<endl;			
}

Measured memory_bytes: 12132
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>


int main() {
    int h, w;

    std::cin >> w >> h;

    std::vector<std::pair<long long, int> > cost(h + w);

    for (int i = 0; i < h + w; i++) {
        long long c;
        std::cin >> c;
        if (i < w) {
            cost[i] = { c, 0 };
        } else {
            cost[i] = { c, 1 };
        }
    }

    std::sort(cost.begin(), cost.end());

    long long total_cost = 0;
    long long a = w + 1, b = h + 1;

    for (int i = 0; i < cost.size(); i++) {
        if (cost[i].second == 0) {
            total_cost += b * cost[i].first;
            a--;
        } else {
            total_cost += a * cost[i].first;
            b--;
        }
    }

    std::cout << total_cost << std::endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
string st;
int main()
{
	cin>>st;
	if (st[0]=='Y'&&st[1]=='A'&&st[2]=='K'&&st[3]=='I') cout<<"Yes"<<endl;else
	  cout<<"No"<<endl;
	return 0;
}


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

int main(){
	long long a,b,x;
	cin>>x>>a>>b;
	if(a>=b) cout<<"delicious"<<endl;
	else if(a+x>=b) cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int max = -101;
		int min = 101;
		int flg = 0;
		for(int i=0;i<N;i++){
			int x = sc.nextInt();
			if(max < x){
				max = x;
			}
		}
                for(int j=0;j<M;j++){
			int y = sc.nextInt();
			if(min > y){
				min = y;
			}
		}
		for(int t= X+1;t<=Y;t++){
			if(max < t && t<= min){
				System.out.println("No War");
				flg=1;
				break;
			}
		}
		if(flg == 0){
		System.out.println("War");
		}
	}
}

Measured memory_bytes: 23252
#include <iostream>

using namespace std;

int main(){
    string a,b,c;
    while(cin >> a >> b >> c){
        int an=0, bn=0, cn=0;
        char x = a[an];
        while(an<=a.length() and bn<=b.length() and cn<=c.length()){
            if(x=='a'){
                if(an==a.length()){
                    cout << "A" << endl;
                }
                x=a[an];
                an++;
            }else if(x=='b'){
                if(bn==b.length()){
                    cout << "B" << endl;
                }
                x=b[bn];
                bn++;
            }else if(x=='c'){
                if(cn==c.length()){
                    cout << "C" << endl;
                }
                x=c[cn];
                cn++;
            }
        }
    }
}

Measured memory_bytes: 3036
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
#include <atcoder/all>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

vector<ll> yakusu(ll n){
  vector<ll> ret;
  for(ll p = 1; p*p <= n; p++){
    if(n%p == 0){
      ret.push_back(p);
      if(p*p != n){
        ret.push_back(n/p);
      }
    }
  }
  sort(all(ret));
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  int n,q;cin>>n>>q;
  atcoder::fenwick_tree<ll> fw(n);
  vector<ll> A(n);
  rep(i,n){
    cin>>A[i];
    fw.add(i,A[i]);
  }
  rep(i,q){
    int t,u,v;cin>>t>>u>>v;
    if(t==0){
      fw.add(u,v);
    }else{
      cout<<fw.sum(u,v)<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 12156
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int whoseTurn(char tmp){
	if(tmp == 'a')
		return 0;
	else if(tmp == 'b')
		return 1;
	else if(tmp == 'c')
		return 2;
	else 
		return -1;
}

int main(){
	string a,b,c;
	int ia,ib,ic;
	ia = 0;
	ib = 0;
	ic = 0;
	int turn = 0;//0,1,2  a,b,c

	cin >> a >> b >> c;
	
	turn = whoseTurn(a[ia++]);
	
	while(true){

		if(turn == 0){
			if(ia == a.length())
				break;
			turn = whoseTurn(a[ia++]);
		}
		else if(turn == 1){
			if(ib == b.length())
				break;
			turn = whoseTurn(b[ib++]);
		}
		else if(turn == 2){
			if(ic == c.length())
				break;
			turn = whoseTurn(c[ic++]);
		}
	}

	if(turn == 0)
		cout << "A" << endl;
	else if(turn == 1)
		cout << "B" << endl;
	else if(turn == 2)
		cout << "C" << endl;

	return 0;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val Array( dis, time, speed ) = scala.io.StdIn.readLine.split( " " ).map{ _.toInt }
    var need_time = dis/speed
    if( dis%speed != 0 ) need_time += 1
    if( need_time <= time ) println( "Yes" )
    else                   println( "No" )
  }
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a > b){
        cout << "a > b" <<endl;
    }else if(a < b){
        cout << "a < b" <<endl;
    }else{
        cout << "a == b"<<endl;
    }
}


Measured memory_bytes: 3088
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
    int N,i,a[100000],b[100000],c[100000],dp[100000][3]={0};
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d%d%d",a+i,b+i,c+i);
    }
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(i=1;i<N;i++){
        dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
    }
    printf("%d\n",max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2])));
    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
    int main(void)
    {
    	int n, k, q, i, j = 0;
        int p[100000], a[100000];
      
    	scanf("%d%d%d", &n, &k, &q);
    	for (i = 0; i < q; i++)
    	  scanf("%d", &a[i]);
      
        for(i=0; i<n; i++)
          p[i]=k - q;
      
        for(i = 0; i < q; i++)
          p[a[i] - 1] += 1;
      
        for(i = 0; i < n; i++){
          if(p[i] > 0)
      		printf("Yes\n");
          else
            printf("No\n");
        }
      return 0;
    }
      

Measured memory_bytes: 1280
fun solve(a: String, b: String) {
    val ab = a.repeat(b.toInt())
    val ba = b.repeat(a.toInt())

    var ans = ba
    if (ab <= ba) {
        ans = ab
    }
    println(ans)
}

fun main() {
//    val S = readLine()!!
//    val N = readLine()!!.toInt()
    val (a, b) = readLine()!!.split(" ")
//    val A = readLine()!!.split(" ").map { it.toInt() }
    solve(a, b)
}

Measured memory_bytes: 35776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
  ll ans=1;
  rep(i,n){
    ans*=2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  //##########################################################CODE_START
  string s="";
  string tmp;
  while(cin>>tmp){
    s+=tmp;
  }
  int t=s.size();
  vector<int> words(26,0);
  rep(i,t){
    int r=int(s[i]);
    if(65<=r&&r<=90){
      words[r-65]++;
    }
    if(97<=r&&r<=122){
      words[r-97]++;
    }
  }
  rep(i,26){
    cout<<char(i+97)<<" : "<<words[i]<<endl;
  }
  //##########################################################CODE_END
  return 0;
}



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

int main() {
  int n, x;
  cin >> n >> x;
  int d = 0;
  int count = 1;
  for (int i = 0; i < n; i++){
    int l;
    cin >> l;
    d += l;
    if (d <= x)
      count ++;
    else
      break;
  }
  cout << count << endl;
      
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

fn solve() {
	let (n,k) = read!(i64,i64);
	let mut ans = n;
	for i in -3..3 {
		let val = n/k + i;
		ans = min(ans, (n-val*k).abs());
	}
	println!("{}", ans);
}

fn run() {
    solve();
}


Measured memory_bytes: 8572
#include<iostream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
using namespace std;

int main (void){
	int N;
	int MAX = 0;
	int MIN = 0;
	bool task1 = false;
	bool task2 = false;
	static int d[300000];
	static int should[300000];
	
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> d[i];
	}
	int plan = 0;
	while(1){
		if(d[plan]+(plan*10) > MAX){
			if(d[plan] > 9){
				MAX = d[plan]+(plan*10);
				if(MAX >= (N-1)*10){
					task1 = true;
					break;
				}
			}
		}
		if(MAX < (plan+1)*10){
			break;
		}
		plan++;
	}
	
	if(task1){
		plan = N-1;
		while(1){
			if(d[plan] + (N-plan-1)*10 > MIN){
				if(d[plan] > 9){
					MIN = d[plan]+(N-plan-1)*10;
					if(MIN >= (N-1)*10){
						task2 = true;
						break;
					}
				}
			}
			if(MIN < (N-plan)*10){
				break;
			}
			plan--;
		}
	}
	
	if(task2){
		cout << "yes" << endl;
	}else{
		cout << "no" << endl;
	}
	return 0;
}

Measured memory_bytes: 4228
M1,D1 = map(int,input().split())
M2,D2 = map(int,input().split())
lastday = [31,28,31,30,31,30,31,31,30,31,30,31]
if D2 == 1 and M2-M1 == 1 and D1 == lastday[M1-1]:
    print(1)
else:
    print(0)


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int n, k;
vi arr;
void in(){
    cin >> n >> k;
    rep(i,0,n) arr.push_back(input());
}

void solve(){

    int ans = 0;
    rep(i,0,k + 1){
        rep(j,0,k - i + 1){

            if(i + j > n) continue;

            int rest = k - (i + j);

            vi tmp;
            rep(t,0,i) tmp.push_back(arr[t]);
            revrep(t,n - 1, n - 1 - j) tmp.push_back(arr[t]);
            sort(all(tmp));
            int cnt = sum(tmp);
            int ind = 0;

            if(sz(tmp) == 0) continue;
            while(tmp[ind] < 0 && rest > 0 && ind < sz(tmp)){

                rest--;
                cnt += abs(tmp[ind]);
                ind++;
            }


            chmax(ans, cnt);

        }
    }
    print(ans);

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0;i<n;++i){
        cin >> h[i];
    }

    int ans = 0;
    for(int i=0;i<n;++i) {
        if(h[i] >= k) ++ans;
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int p=1e9+7;
const int Maxn=2e5+2;
int n,a[Maxn],T;
int pow(int a,int b){
	int ret=1;
	while(b){
		if(b&1) ret=1ll*ret*a%p;//忘了加条件了 
		b=b/2;
		a=1ll*a*a%p;
	}
	return ret%p;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(a[x]) T=n-i+a[x]-1;
		else a[x]=i+1;
	}
	cout<<n<<endl;
	int sum1=1,sum=n+1,ret;
	for(int i=2;i<=n+1;i++){
		if(T>=i-1)//C[i-1][T]
			sum1=1ll*sum1*(T-i+2)%p*pow(i-1,p-2)%p;
		else sum1=0;
		sum=1ll*sum*(n-i+2)%p*pow(i,p-2)%p;
		ret=(sum-sum1+p)%p;
		printf("%d\n",ret%p);
	}
	return 0;
}

Measured memory_bytes: 1536
// https://agc026.contest.atcoder.jp/tasks/agc026_c
#include <bits/stdc++.h>
using namespace std;
template<class C>constexpr int sz(const C&c){return int(c.size());}
using ll=long long;constexpr const char nl='\n',sp=' ';

seed_seq seq {
    uint64_t(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()),
    uint64_t(__builtin_ia32_rdtsc()),
    uint64_t(uintptr_t(make_unique<char>().get()))
};

mt19937 rng(seq); mt19937_64 rng64(seq);

const size_t RANDOM = uniform_int_distribution<size_t>(0, numeric_limits<size_t>::max())(rng64);
template <class T, class H = hash<T>> struct rand_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator () (const T &x) const { return splitmix64(H()(x) + RANDOM); }
};

template <class T1, class T2, class H1 = rand_hash<T1>, class H2 = rand_hash<T2>> struct pair_hash {
    size_t operator () (const pair<T1, T2> &p) const { return 31 * H1()(p.first) + H2()(p.second); }
};

template <class K, class H = rand_hash<K>, class ...Ts> using uset = unordered_set<K, H, Ts...>;
template <class K, class V, class H = rand_hash<K>, class ...Ts> using umap = unordered_map<K, V, H, Ts...>;

int N;
string S;
umap<pair<string, string>, ll, pair_hash<string, string>> M;

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // freopen("err.txt", "w", stderr);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N >> S;
    for (int i = 0; i < (1 << N); i++) {
        string red, blue;
        for (int j = 0; j < N; j++) {
            if ((i >> j) & 1) red.push_back(S[j]);
            else blue.push_back(S[j]);
        }
        reverse(blue.begin(), blue.end());
        M[make_pair(red, blue)]++;
    }
    ll cnt = 0;
    for (int i = 0; i < (1 << N); i++) {
        string red, blue;
        for (int j = 0; j < N; j++) {
            if ((i >> j) & 1) red.push_back(S[N + j]);
            else blue.push_back(S[N + j]);
        }
        reverse(blue.begin(), blue.end());
        cnt += M[make_pair(blue, red)];
    }
    cout << cnt << nl;
    return 0;
}


Measured memory_bytes: 64460
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define INF 2147483647
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;



int main(){
	 
	 int n,a[111];
	 cin>>n;
	 for(int i=0;i<n;i++)cin>>a[i];
	 sort(a,a+n);
	 int ans=a[n-1]/2;
	 for(int i=0;i<n-1;i++)ans+=a[i];
	 cout<<ans<<endl;



}

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

using namespace std;

int main() {
    int i, j;
    int k=0; 
    int m=0;
    int N; cin >> N;
    vector<int> p(N);
    for(i=0;i<N;i++) cin >> p[i];

    int count = 0;
    bool flag = false;

    for(i=0; i<N; i++) {
        if(!(i==0)) {
            if(p[i] < p[i-1]) {
                count++;
                flag = true;
                if(count == 1) {k = i - 1;}
                if(count == 2) {m = i;}
            }
            if(count == 3) {
                cout << "NO" << endl;
                return 0;
            }
        }
    }

    if(flag) {
        int tmp = p[k];
        p[k] = p[m];
        p[m] = tmp;
    }

    for(i=0; i<N; i++) {
        if(!(i==0)){
            if(p[i] < p[i-1]) {
                cout << "NO" << endl;
                return 0;
            }
        }
    }

    cout << "YES" << endl;

    return 0;
}

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

int main()
{
    int x;
    cin >> x;
    if(x >= 400 && x <= 599) {
        cout << 8;
    }
    if(x >= 600 && x <= 799) {
        cout << 7;
    }
    if(x >= 800 && x <= 999) {
        cout << 6;
    }
    if(x >= 1000 && x <= 1199) {
        cout << 5;
    }
    if(x >= 1200 && x <= 1399) {
        cout << 4;
    }
    if(x >= 1400 && x <= 1599) {
        cout << 3;
    }
    if(x >= 1600 && x <= 1799) {
        cout << 2;
    }
    if(x >= 1800 && x <= 1999) {
        cout << 1;
    }
    return 0;
}

Measured memory_bytes: 3668
import itertools
N, M, Q = map(int, input().split())
##とりあえず与えられるリストを受け取る処理
L = []
for i in range(Q):
    L.append(list(map(int, input().split())))
#条件をみたす数列Aとしてありうるものをすべて列挙しておく
ALL = list(itertools.combinations_with_replacement(range(1,M+1), N))
'''
項数N、１以上M以下の数をもつ数列を全部列挙する
全部のパターンについてスコアを求め、その最大値を表示する
'''
result = 0
for suretu in ALL:
    score = 0
    #print("suretu is: ", suretu)
    for i in L:
        #print("i is: ",i)
        #添字がややこしいので注意する
        #最初の組み合わせはsuretu is:  (1, 1, 1)  
        #i is:  [1, 3, 3, 100]　であり、
        #条件はA3-A1=3であれば、100点が得点、である。
        if suretu[i[1]-1]-suretu[i[0]-1]==i[2]:
             score += i[3]
    #print("score is: ",score)
    if score > result:
        result = score
print(result)

Measured memory_bytes: 21516
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, Y, i, j, k, i2, j2, k2, judge=0;

    cin >> N >> Y;

    for(i=0; i<=N; i++){ // 1000
        for(j=0; j<=N; j++){ // 5000
            k = N-i-j; // 10000

            if(0<=k && k<=N){
                if(i*1000+j*5000+k*10000 == Y){
                    judge = 1;
                    i2=i; j2=j; k2=k;
                }
            }      
        }
    }

    if(judge == 1) cout << k2 << " " << j2 << " " << i2 << endl;
    else cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  vector<vector<int>> a(n, vector<int>(m));
  rep(i, n) {
    rep(j, m) {
      cin >> a[i][j];
    }
  }

  int res = 0;
  rep(i, n) {
    int sum = c;
    rep(j, m) {
      sum += a[i][j] * b[j];
    }
    if (sum > 0) {
      res++;
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
/** 
 *                                                                   
 *   |    |                        ,   .              ,--.,--.,--.,--.
 *   |    |    ,---..    ,,---.    |   |,---..   .      -||  ||  ||  |
 *   |    |    |   | \  / |---'    `---'|   ||   |       ||  ||  ||  |
 *   `    `---'`---'  `'  `---'      |  `---'`---'    `--'`--'`--'`--'
 *                                   `                                
**/
#include <bits/stdc++.h>
using namespace std;

int n, w, wei[105], val[105];
long long dp[105][100005];

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

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		cin >> wei[i] >> val[i];
	}

	for (int i = 0; i <= w; i++) {
		dp[0][i] = 0;
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= w; j++) {
			dp[i][j] = dp[i - 1][j];
			if (j - wei[i] >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j - wei[i]] + val[i]);
		}
	}

	cout << dp[n][w] << '\n';

	return 0;
}

Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s, t;
 cin >> s >> t;
 int n = s.size(); 
 int answer = 0;
 for(int i = 0; i < n; ++i){
 if(s[i] != t[i]) ++answer;
 }
 cout << answer << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> mt;

ll h,w,c;
mt p;
vector<mt> dp;
ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};
ll ans;

bool is_in(ll x, ll y){
  return x >= 0 && x < h && y >= 0 && y < w;
}


void change(ll d, ll c){
  ll orig = dp[d][0][0];
  dp[d+1] = mt(h,vl(w));
  mt visit = mt(h,vl(w));
  queue<vl> q;
  q.push(vl({0, 0}));
  visit[0][0] = 1;
  while(!q.empty()){
    ll x = q.front()[0];
    ll y = q.front()[1];
    q.pop();

    dp[d+1][x][y] = c;
    visit[x][y] = 1;
    for(ll i = 0;i < 4;i++){
      ll next = x+dx[i];
      ll neyt = y+dy[i];
      if(!is_in(next, neyt)) continue;
      if(visit[next][neyt] == 1) continue;
      if(dp[d][next][neyt] == orig){
        visit[next][neyt] = 1;
        q.push(vl({next, neyt}));
      }
    }
  }
  for(ll i = 0;i < h;i++){
    for(ll j = 0;j < w;j++){
      if(dp[d+1][i][j] == 0) dp[d+1][i][j] = dp[d][i][j];
    }
  }
}

void calc(){
  ll d = 5;
  ll orig = dp[d][0][0];
  if(orig != c) return;
  mt visit = mt(h,vl(w));
  queue<vl> q;
  q.push(vl({0, 0}));
  visit[0][0] = 1;
  ll cnt = 0;
  while(!q.empty()){
    ll x = q.front()[0];
    ll y = q.front()[1];
    q.pop();
    cnt++;
    visit[x][y] = 1;
    for(ll i = 0;i < 4;i++){
      ll next = x+dx[i];
      ll neyt = y+dy[i];
      if(!is_in(next, neyt)) continue;
      if(visit[next][neyt] == 1) continue;
      if(dp[d][next][neyt] == orig){
        visit[next][neyt] = 1;
        q.push(vl({next, neyt}));
      }
    }
  }
  ans = max(ans,cnt);
}

void dfs(ll d){
  if(d == 5){
    calc();
    return;
  }
  for(ll i = 1;i <= 6;i++){
    change(d, i);
    dfs(d+1);
  }
  return;
}

int main(){
  while(cin >> h >> w >> c){
    if(h == 0 && w == 0 && c == 0) return 0;
    dp = vector<mt>(6);
    dp[0] = mt(h,vl(w));
    for(ll i = 0;i < h;i++){
      for(ll j = 0;j < w;j++){
        cin >> dp[0][i][j];
      }
    }
    ans = 0;
    dfs(0);
    cout << ans << endl;
  }
}



Measured memory_bytes: 3144
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	cout << (n + 1) / 2;
	return 0;
}

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

int main(){
	int a,b,c;
	cin >> a;
	cin >> b;
	cin >> c;
	if(a < b){
		if(b < c){	cout << a << " " << b << " " << c << endl;	}
		else if(a < c){	cout << a << " " << c << " " << b << endl;	}
		else{	cout << c << " " << a << " " << b << endl;	}
	}else{
		if(a < c){	cout << b << " " << a << " " << c << endl;	}
		else if(b < c){	cout << b << " " << c << " " << a << endl;	}
		else{	cout << c << " " << b << " " << a << endl;	}
	}
	
}

Measured memory_bytes: 3084
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = new List<int>();

        aa.Add(0);
        foreach(var s in input.ReadLine().Split(' ')) {
            aa.Add(int.Parse(s));
        }
        aa.Add(0);

        var ab = new int[aa.Count];
        for(int i=1; i< aa.Count; i++) {
            ab[i] = Math.Abs(aa[i-1] - aa[i]);
        }

        var absum = ab.Sum();

        for(int i=1; i<aa.Count-1; i++) {
            var x = absum - ab[i] - ab[i+1] + Math.Abs(aa[i - 1] - aa[i + 1]);
            Console.WriteLine(x);
        }

        return null;
    }


    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define rep(i, n) FOR(i, 0, n)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;

int main(void){
	ll n, k;
	cin >> n >> k;

	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	vector<ll> f(n);
	rep(i, n) cin >> f[i];
	sort(all(f));
	reverse(all(f));

	ll l = 0, r = 1e12;
	while(r-l >= 1){
		ll x = (l+r)/2, kk = 0;
		rep(i, n) if(a[i]*f[i] > x) kk += a[i]-x/f[i];
		if(kk <= k) r = x;
		else l = x+1;
	}

	co(l);

	return 0;
}


Measured memory_bytes: 3328
#!/usr/bin/env python3
 
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a, v = LI()
b, w = LI()
t = I()
if w >= v:
    print('NO')
else:
    if abs(a - b) <= abs(v - w) * t:
        print('YES')
    else:
        print('NO')  

Measured memory_bytes: 65304
#include<iostream>
#include<algorithm>
using namespace std;
int n,C;
int d[33][33];
int c[555][555];
long a[3][33];
main()
{
	cin>>n>>C;
	for(int i=0;i<C;i++)for(int j=0;j<C;j++)cin>>d[i][j];
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>c[i][j];
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<C;j++)
		{
			for(int k=0;k<n;k++)for(int l=0;l<n;l++)if((k+l)%3==i)a[i][j]+=d[c[k][l]-1][j];
		}
	}
	long ans=1e15;
	for(int i=0;i<C;i++)for(int j=0;j<C;j++)for(int k=0;k<C;k++)
	{
		if(i==j||i==k||j==k)continue;
		ans=min(ans,a[0][i]+a[1][j]+a[2][k]);
	}
	cout<<ans<<endl;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int a,b; string s; cin>>a>>b>>s;
	bool yes=true;
	for(int i=0;i<a+b+1;++i){
		if(i==a){if(s.at(i)!='-')yes=false;}
		else if(s.at(i)<'0'||s.at(i)>'9')yes=false;
	}
	cout<<(yes?"Yes"s:"No"s)<<"\n"s;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
static const int INF = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }

	bool possible = false, finished = true;
	for(const auto& row : a){
		for(const char c : row){
			if(c == '#'){
				possible = true;	
			}else{
				finished = false;
			}
		}
	}
	if(!possible){
		cout << -1 << endl;
		return 0;
	}
	if(finished){
		cout << 0 << endl;
		return 0;
	}

	vector<bool> is_done_column(n, false);
	int done_column_count = 0;
	for(int j = 0; j < n; ++j){
		bool done = true;
		for(int i = 0; i < n; ++i){
			if(a[i][j] == '.'){ done = false; }
		}
		if(done){ ++done_column_count; }
		is_done_column[j] = done;
	}
	for(int i = 0; i < n; ++i){
		bool done = true;
		for(int j = 0; j < n; ++j){
			if(a[i][j] == '.'){ done = false; }
		}
		if(done){
			cout << (n - done_column_count) << endl;
			return 0;
		}
	}

	int answer = INF;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < n; ++j){
			if(a[i][j] == '.'){ continue; }
			int count = 0;
			for(int k = 0; k < n; ++k){
				if(a[j][k] == '.'){
					count += 2;
				}else if(!is_done_column[k]){
					count += 1;
				}
			}
			answer = min(answer, count);
		}
	}
	for(int i = 0; i < n; ++i){
		if(a[i][i] != '.'){ continue; }
		if(a[i] == string(n, '.')){ continue; }
		int count = 1;
		for(int k = 0; k < n; ++k){
			if(a[i][k] == '.'){
				count += 2;
			}else if(!is_done_column[k]){
				count += 1;
			}
		}
		answer = min(answer, count);
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 512
#include <stdio.h>

int main() {
	char s[100005];
	scanf("%s", s);

	for (int i = 0; i==0 || (s[i] != '\0' && s[i-1] != '\0'); i = i+2) {
		printf("%c", s[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    char Input;
    int x,c[26]= {0};

    while(scanf("%c",&Input)!=EOF)
    {
        if(Input>='A' && Input<='Z')
        {
            x=Input-'A';
            c[x]+=1;
        }
        else if(Input>='a' && Input<='z')
        {
            x=Input-'a';
            c[x]+=1;
        }
    }

    for(x=0,Input='a'; x<26; x++,Input++)
    {
        printf("%c : %d\n",Input,c[x]);
    }
    return 0;
}




Measured memory_bytes: 2036
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int N = 200200;
int n;
int a[N];
int b[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		a[x - 1] = i;
	}
	int ans = 0;
	int l = 0;
	while(l < n) {
		int r = l + 1;
		while(r < n && a[r] > a[r - 1]) r++;
		ans = max(ans, r - l);
		l = r;
	}
	printf("%d\n", n - ans);

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B;
	cin >> A >> B;
	cout << A*B << endl;
}

Measured memory_bytes: 3656
def main():
    ipt = input()
    lst = list(map(int, ipt.split()))
    prod = lst[0] * lst[1]
    check_parity(prod)

def check_parity(e):
    if (e % 2) == 1:
        print('Odd')
        return
    elif (e % 2) == 0:
        print('Even')
        return
    else:
        print('Unknown parameter -- e in check_parity()')
        return


main()

Measured memory_bytes: 3060
use proconio::input;

fn main() {
    input! {
	n: usize,
	k: u32,
    }
    let mut t = vec![false; n];
    for _i in 0..k {
	input! {
	    d: u32,
	}
	for _j in 0..d {
	    input! {
		a: usize,
	    }
	    t[a - 1] = true;
	}
    }
    println!("{}", t.iter().filter(|x| !**x).count());
}


Measured memory_bytes: 2228
##a = int(stdin.readline().rstrip())
##b, c = [int(x) for x in stdin.readline().rstrip().split()]
##s = stdin.readline().rstrip()
##a = list(set(b))  重複を削除
##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]
##a = [[0] * 2 for _ in range(n)]  a[0,0]
##v = [s[i: i+2] for i in range(0, len(s), 2)]
##  s="12345678" を v=["12","34","56","78"] にするイメージ
##s = "".join(list)リストを文字列に変換[""]は区切り文字
##a.sort(key=itemgetter(1))リストをソートできるよ(from operator import itemgetterが必要)
##sort_p = sorted(p) 昇順ソート

# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
import random
import bisect
import copy
# stdin = open("sample.txt")


MOD = 1000000007
INF = float('inf')
alpha = ["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"]

def keta(kazu): # 入力されたintを桁ごとに分解，リストで出力
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): # 最小公倍数
    return reduce(math.gcd, numbers)

def combination(m,n): # mCn
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): # nの素因数分解の結果を辞書で出力 fuct(24) → {2: 3, 3: 1}
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr
    
def main():
    N, D = [int(x) for x in stdin.readline().rstrip().split()]
    ans = 0
    for _ in range(N):
        x, y = [int(x) for x in stdin.readline().rstrip().split()]
        if x**2 + y**2 <= D**2:
            ans += 1
    print(ans)
main()

Measured memory_bytes: 27240
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int x;
    cin >> x;

    int t = 360 * x / __gcd(x, 360ll);

    cout << t/x << endl;

}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int flag = 0;

    for(int i = 1; i <= B; i++) {
        if( (i*A) % B == C ) {
            flag = 1;
            break;
        }
    }

    if(flag == 1) {
        cout << "YES";
    }
    else {
        cout <<"NO";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bitset>
#include<algorithm>
using namespace std;
int H,W;
int T[88][88],A[88][88],B[88][88];
bitset<25600>dp[81][81];
main()
{
	cin>>H>>W;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>A[i][j];
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>B[i][j];
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)T[i][j]=abs(A[i][j]-B[i][j]);
	dp[0][0][12800+T[0][0]]=1;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)
	{
		if(i+1<H)dp[i+1][j]|=dp[i][j]<<T[i+1][j]|dp[i][j]>>T[i+1][j];
		if(j+1<W)dp[i][j+1]|=dp[i][j]<<T[i][j+1]|dp[i][j]>>T[i][j+1];
	}
	int ans=0;
	while(!dp[H-1][W-1][12800+ans]&&!dp[H-1][W-1][12800-ans])ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 20864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
  	cout << 1 << "\n";
  }else if((a != b && b == c) || (a == b && b != c) || (a == c && a != b)) {
  	cout << 2 << "\n";
  }else {
  	cout << 3 << "\n";
  }
}

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

int main() {
  long long H, W;
  cin >> H >> W;
  
  if (H == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (W == 1) {
    cout << 1 << endl;
    return 0;
  }
  
  cout << (H * W + 1) / 2 << endl;
  return 0;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=2e5 + 5;
const int M=2019;

int me(int x,int y)
{
	if(y==0)
	{
		return 1;
	}
	else
	{
		if(y%2==0)
		{
			return me((x*x)%M,y/2);
		}
		else
		{
			return (x*me((x*x)%M,(y-1)/2))%M;
		}
	}
}

int32_t main()
{
	IOS;
	//memset(dp,-1,sizeof(dp));	
	string s;
	cin >> s;
	int a[N];
	int k=0;
	int n = s.size();
	for(int i=n-1;i>=0;i--)
	{
		int prev = 0;
		if(i+1<n)
			prev = a[i+1];
		int num = me(10,k);
		k++;
		int dig = s[i]-'0';
		num = (num*dig)%M;
		num = (num+prev)%M;
		a[i] = num;
	}
	mi mp;
	mp[0]++;
	rep(i,0,n-1)
	{
		mp[a[i]]++;
	}
	int ans = 0;
	for(auto it: mp)
	{
		int x = it.second;
		ans += ((x)*(x-1))/2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 5296
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b;

int main(){
  cin >> a >> b;
  if(a%b==0) cout << 0 << endl;
  else cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256