akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
 
int main(){
    ll n;
    cin >> n;

    vector<ll> a;
    REP(i,n){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    ll count = 0;
    REP(i,n){
        if(a[i]%2 != 0){
            count++;
        }
    }
    if(count%2 == 0){
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
    return 0;
}

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

int main(){
    int a,b,x;
    char op;
    
    cin >> a >> op >> b;
    while(op!='?'){
        if(op=='+'){
            x = a + b;
        }else if(op=='-'){
            x = a - b;
        }else if(op=='*'){
            x = a * b;
        }else if(op=='/'){
            x = a / b;
        }
    cout << x << endl;
    cin >> a >> op >> b;
    }
    return 0;
}


Measured memory_bytes: 3128
import java.util.Scanner;

//https://onlinejudge.u-aizu.ac.jp/problems/1192
public class Main {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	while (true) {
	  int max = 0;
	  int x = sc.nextInt();
	  int y = sc.nextInt();
	  int s = sc.nextInt();
	  
	  if (x == 0 && y == 0 && s == 0) break;
	  for (int i = 1; i < s; i++) {
		for (int j = 1; j < s; j++) {
		  int taxFistProduct1 = ((i * 100) + (i * x)) / 100;
		  int taxFistProduct2 = ((j * 100) + (j * x)) / 100;
		  
		  if (s == taxFistProduct1 + taxFistProduct2) {
			int taxSecondProduct1 = ((i * 100) + (i * y)) / 100;
			int taxSecondProduct2 = ((j * 100) + (j * y)) / 100;
			
			if (max <= taxSecondProduct1 + taxSecondProduct2) {
			  max = taxSecondProduct1 + taxSecondProduct2;
			}
		  }
		}
	  }
	  System.out.println(max);
	}
  }
}


Measured memory_bytes: 29060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

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

const int inf = 1e9 + 7;
const ll longinf = 1LL << 50;
const long long mod_const = 1e9 + 7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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; }

using pll = pair<long long, long long>;

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

	const ll modnum = 998244353;

	ll N;
	cin >> N;

	vector<ll> vD(N, 0);

	vector<ll> vNum(N, 0);
	rep(i, N) {
		cin >> vD[i];
		vNum[vD[i]]++;
	}

	bool fin = false;
	rep(i, N) {
		if (vNum[i] == 0) {
			fin = true;
		}
		else if (fin) {
			cout << "0" << endl;
			return 0;
		}
	}

	if (vD[0] != 0) {
		cout << "0" << endl;
	}
	else if (vNum[0] != 1) {
		cout << "0" << endl;
	}
	else {
		ll ans = 1;
		for (int i = 1; i != N; ++i) {
			if (vNum[i] != 0) {
				for (int j = 0; j != vNum[i]; ++j) {
					ans *= vNum[i - 1];
					ans = ans % modnum;
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int ans = 1;
  REP(i,n) {
    if(ans < k) ans *= 2;
    else ans += k;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();

    let mut use_indexes = HashSet::new();
    let mut cur_max = a[0];
    use_indexes.insert(a[0]);
    for i in 1..n {
        if cur_max < a[i] {
            use_indexes.insert(a[i]);
            cur_max = a[i];
        }
    }

    let mut a_clone = a.clone();
    a_clone.sort();
    let mut a_sum = vec![0i64; n];
    a_sum[0] = a_clone[0];

    for i in 1..n {
        a_sum[i] = a_sum[i - 1] + a_clone[i];
    }
    let mut integ = vec![0i64; use_indexes.len() + 2];
    let mut use_indexes2 = use_indexes.clone();
    integ[0] = a_sum[n - 1];
    let mut pointer = 1;
    for i in 0..n {
        if use_indexes.contains(&a_clone[i]) {
            integ[pointer] = a_sum[n - 1] - a_sum[i] - (n - 1 - i) as i64 * a_clone[i];
            use_indexes.remove(&a_clone[i]);
            pointer += 1;
        }
    }
    debug!(integ);
    let mut answers = vec![0i64; use_indexes2.len() + 1];
    for i in 0..use_indexes2.len() {
        answers[i] = integ[i] - integ[i + 1];
    }
    debug!(answers);

    let mut pointer = 0;
    for i in 0..n {
        if use_indexes2.contains(&a[i]) {
            use_indexes2.remove(&a[i]);
            println!("{}", answers[pointer]);
            pointer += 1;
        } else {
            println!("{}", 0);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 14508
m,f,r,t;
main(){
    char c;
    for(;scanf("%d%d%d",&m,&f,&r),m+f+r+3!=0;){
        t=m+f;
        c=m==-1||f==-1?'F'
                :t>=80?'A'
                :t>=65?'B'
                :t>=50||r>=50?'C'
                :t>=30?'D'
                      :'F';
        printf("%c\n",c);
    }
}

Measured memory_bytes: 1776
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

    int n; cin>>n;
    int b[n-1];
    rep(i,n-1) cin >> b[i];
    int ans = 0;
    
    ans += b[n-2] + b[0];
    for(int i=n-2; i>0; i--){
        ans += min(b[i-1], b[i]);
    }
    
    cout << ans << ln;
    return 0;
}

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

int main(int argc, char *argv[]) {
	int a, b, c;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	int sort[3];
	sort[0] = a;
	sort[1] = b;
	sort[2] = c;

	int i;
	int j;	
	for (i = 0; i < 3-1; i++) {
		for (j = i+1; j < 3; j++) {
			if (sort[i] > sort[j]) {
				int tmp = sort[i];
				sort[i] = sort[j];
				sort[j] = tmp;
			}
		}
	}

	printf("%d %d %d\n", sort[0], sort[1], sort[2]);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b,c,n;

int main(){
	cin>>a>>b>>c>>n;
	int res=0;
	for(int i=0;i<=n;i++) for(int j=0;j<=n;j++) if(n-i*a-j*b>=0&&(n-i*a-j*b)%c==0) res++;
	cout<<res<<endl;
}

Measured memory_bytes: 256
def f(i):
    global ans
    if i == n:
        w, x, y, z = 0, 0, 0, 0
        for i in range(n):
            if s[i] == 1:
                x += l[i]
            elif s[i] == 2:
                y += l[i]
            elif s[i] == 3:
                z += l[i]
            else:
                w += 1
        if x > 0 and y > 0 and z > 0:
            mp = abs(a - x) + abs(b - y) + abs(c - z) + 10 * (n - w - 3)
            ans = min(ans, mp)
        return
    s[i] = 0
    f(i + 1)
    s[i] = 1
    f(i + 1)
    s[i] = 2
    f(i + 1)
    s[i] = 3
    f(i + 1)

n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
s = [3] * n
ans = 114514
f(0)
print(ans)

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

n, m = map(int, input().split())
a = list(map(int, input().split()))

total = sum(a)
thres = total/(4*m)

ct = 0
for i in a:
    if i >= thres:
        ct += 1

if ct >= m:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 38384
from bisect import bisect_left,insort_left
n=int(input())
s=list(input())
lindex=[[] for _ in range(26)]
for i in range(n):
  lindex[ord(s[i])-97].append(i)
q=int(input())
for i in range(q):
  q1,q2,q3=input().split()
  if q1=='1':
    q2=int(q2)-1
    idx=bisect_left(lindex[ord(s[q2])-97],q2)
    if s[q2]!=q3:
      del lindex[ord(s[q2])-97][idx]
      insort_left(lindex[ord(q3)-97],q2)
      s[q2]=q3
  else:
    l=int(q2)-1
    r=int(q3)-1
    cnt=0
    for j in range(26):
      if len(lindex[j])==0:
        continue
      idx=bisect_left(lindex[j],l)
      if len(lindex[j])>idx and lindex[j][idx]<=r:
        cnt+=1
    print(cnt)

Measured memory_bytes: 30600
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, a, b;

    cin >> n >> a >> b;

    cout << min(n*a, b);

    return 0;
}


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

using namespace std;

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> firstIslandConnections;
  firstIslandConnections.reserve(200000);
  std::unordered_set<int> lastIslandConnections;
  lastIslandConnections.reserve(200000);
  for (int i = 0; i < m; i++) {
    int a, b;
    std::cin >> a >> b;
    if (a == 1) {
      firstIslandConnections.push_back(b);
    } else if (b == n) {
      lastIslandConnections.insert(a);
    }
  }
  for (auto const connection : firstIslandConnections) {
    if (lastIslandConnections.count(connection)) {
      std::cout << "POSSIBLE" << std::endl;
      return 0;
    }
  }
  std::cout << "IMPOSSIBLE" << std::endl;
  return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	ll n, d;
	cin >> n >> d;
	d *= d;
	int ans = 0;
	rep(i, n) {
		ll x, y;
		cin >> x >> y;
		x *= x;
		y *= y;
		ans += x + y <= d;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = a; i >= (b); --i)
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  if (v.size()) {
    rep(i, 0, sz(v) - 1)
      out << v[i] << " ";
    out << v.back();
  }
  return out;
}
#endif
using namespace std;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n; read(n);
  int a[n], b[n];
  rep(i, 0, n) read(a[i]);
  rep(i, 0, n) read(b[i]);
  ll ch = 0, u1 = 0, u2 = 0;
  rep(i, 0, n)
    ch += b[i] - a[i];
  rep(i, 0, n) {
    if (a[i] > b[i]) {
      u1 += a[i] - b[i];
    } else if (a[i] < b[i]) {
      u2 += (b[i] - a[i] + 1) / 2;
    }
  }
  write(u1 <= ch && u2 <= ch ? "Yes" : "No");
}



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

  int a[200010];
 int ans[200010];
int main()
{
  int n;
  scanf("%d",&n);
  for(int i=2;i<=n;i++)scanf("%d",&a[i]);
  for(int i=2;i<=n;i++)ans[a[i]]++;
  for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}


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

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

  int n; cin >> n;
  deque<int> b;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    if(i%2 == 0) b.push_back(a);
    else b.push_front(a);
  }
  if(n%2 == 1) reverse(b.begin(),b.end());
  for(auto p : b){
    cout << p << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3840
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);

		int num = sn.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < num; i++) {
			list.add(sn.nextInt());
		}

		List<Integer> min = new ArrayList<Integer>();

		for (int t = 0; t < num; t++) {
			int S1 = 0;
			int S2 = 0;

			// S1
			for (int i = 0; i <= t; i++) {
				S1 = S1 + list.get(i);
			}
			// S2
			for (int i = t + 1; i < num; i++) {
				S2 = S2 + list.get(i);
			}

			min.add(Math.abs(S1 - S2));
		}

		Collections.sort(min);

		System.out.println(min.get(0));
	}
}


Measured memory_bytes: 21972
pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

struct Solve {
    grid: Vec<Vec<char>>,
}

impl Solve {
    fn parse(&self, row: usize, level: usize) -> (usize, u64) {
        let c = self.grid[row][level];
        assert!(c != '.');
        if c.is_digit(10) {
            return (row + 1, (c as u8 - b'0') as u64);
        }
        let mut idx = row + 1;
        let mut ans = if c == '+' { 0 } else { 1 };
        loop {
            if idx >= self.grid.len() || level + 1 >= self.grid[idx].len() {
                break;
            }
            let (nrow, val) = self.parse(idx, level + 1);
            ans = if c == '+' { ans + val } else { ans * val };
            idx = nrow;
        }
        (idx, ans)
    }
}
fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    loop {
        let n: usize = sc.read();
        if n == 0 {
            break;
        }
        let mut grid = Vec::new();
        for _ in 0..n {
            grid.push(sc.read_chars());
        }
        let s = Solve { grid };
        println!("{}", s.parse(0, 0).1);
    }
}



Measured memory_bytes: 5048
/***
 **   A S M Atikur Rahman
 **   Update: 17-12-2019
***/

//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<time.h>
#include<limits.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<utility>
#include<iterator>
#include<algorithm>
#include<cassert>
#include<iomanip> ///setprecision


#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define sci(x) scanf("%d%*c", &(x))
#define scll(x) scanf("%lld%*c", &(x))
#define scd(x) scanf("%lf%*c", &(x))
#define scstr(x) scanf("%s", x)
#define pfi(x) printf("%d", (x))
#define pfll(x) printf("%lld", (x))
#define pfd(x) printf("%f", (x))
#define pfstr(x) printf("%s", (x))
#define ps printf(" ")
#define pn printf("\n")
#define pfdot printf("..")

#define For(a,n) for(int i=(a); i<(n); i++)
#define rFor(n,a) for(int i=n-1; i>=0; i--)
#define trav(a,x) for (auto& a : x)
#define Mset(ara, val) memset(ara, val, sizeof(ara))

#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define pi  (2*acos(0))


using namespace std;

using ll=long long;
using pii= pair<int,int>;
using pll= pair<long long, long long>;
using pcc= pair<char, char>;
using pdd= pair<double, double>;

#define V(a) vector<a>
using vi= vector<int>;
using vs= vector<string>;
using vll= vector<ll>;
using vpii= vector<pii>;
using vc= vector<char>;
using vd= vector<double>;

//ll POW(ll a,ll b){if(b==0)return 1;ll x=POW(a,b/2);x=(x*x);if(b&1)x=(x*a);return x;}


ll ara[200100], cnt[200100];

int main( int argc, char *argv[] )
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stout);

    ll ans, i,n;
    scll(n);
    For(0,n)
    {
        scll(ara[i]);
        cnt[ara[i]]++;
    }
    ans=0;
    for(i=0;i<200100;i++)
    {
        ans+= (cnt[i]*(cnt[i]-1))/2;
    }
    for(i=0;i<n;i++)
    {
        ll x=cnt[ara[i]]*(cnt[ara[i]]-1);
        x/=2;
        ll y=((cnt[ara[i]]-1)*(cnt[ara[i]]-2))/2;
        pfll(ans-x+y);pn;
    }




    return 0;
}
























Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int N, W, H, x, y, w, s, t, imosx[100001], imosy[100001];
 
int main()
{
    scanf("%d", &N);
    scanf("%d", &W);
    scanf("%d", &H);
 
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &x);
        scanf("%d", &y);
        scanf("%d", &w);
        
        int lx = max(x - w, 0);
        int rx = min(x + w, W);
        int ly = max(y - w, 0);
        int ry = min(y + w, H);
        
        imosx[lx]++;
        imosx[rx]--;
        imosy[ly]++;
        imosy[ry]--;
    }
 
    bool okx = true;
    
    int sumx = 0;
    
    for(int i = 0; i < W; i++)
    {
        sumx += imosx[i];
        
        if(!sumx) okx = false;
    }
    
    bool oky = true;
    
    int sumy = 0;
    
    for(int i = 0; i < H; i++)
    {
        sumy += imosy[i];
        
        if(!sumy) oky = false;
    }
 
    printf("%s\n", okx || oky ? "Yes" : "No");
 
    return 0;
}

Measured memory_bytes: 3928
from itertools import accumulate as ac

n, x = map(int, input().split())
lst = list(map(int, input().split()))
lst_ac = list(ac(lst))
lst_ans = [0] + lst_ac


ans = 0
for a in lst_ans:
    if a > x:
        break
    ans += 1


print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  rep(i,n-1){
    if(a[i] == a[i+1]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
vector<int> l;
int N, A, B, C;
int dfs(int cur, int a, int b, int c) {
	if (cur == N) {
		if (a * b * c > 0)return abs(A - a) + abs(B - b) + abs(C - c) - 30;
		else return INF;
	}
	int cost = INF;
	cost = min(cost, dfs(cur + 1, a, b, c));
	cost = min(cost, dfs(cur + 1, a + l[cur], b, c) + 10);
	cost = min(cost, dfs(cur + 1, a, b + l[cur], c) + 10);
	cost = min(cost, dfs(cur + 1, a, b, c + l[cur]) + 10);
	return cost;
}
int main()
{
	cin >> N >> A >> B >> C;
	l.resize(N);
	rep(i, 0, N)cin >> l[i];
	printf("%d\n", dfs(0,0,0,0));
	return 0;
}

Measured memory_bytes: 3764
#include <iostream>

using namespace std;

int main()
{
    int n, w;
    while (cin >> n >> w, n|w) {
        int table[101];
        fill_n((int *)table, 101, 0);
        int maxj = 0;
        for (int i = 0; i < n; i++) {
            int v;
            cin >> v;
            for (int j = 0;; j++) {
                if (v < w*(j+1)) {
                    table[j]++;
                    if (maxj < j) {
                        maxj = j;
                    }
                    break;
                }
            }
        }

        int max = -1;
        for (int i = 0; i < 101; i++) {
            if (table[i] > max) {
                max = table[i];
            }
        }

        double total = 0.0;
        for (int i = 0; i <= maxj; i++) {
            total += (double)table[i]/max * (maxj-i)/maxj;
        }

        total += 0.01;

        printf("%f\n", total);
    }
    return 0;
}

Measured memory_bytes: 3144
N = int(input())
D = sorted(map(int, input().split()))
M = int(input())
T = sorted(map(int, input().split()))

n = 0
for t in T:
    for i in range(n, N):
        if D[i] == t:
            n = i + 1
            break
        if D[i] > t:
            print('NO')
            exit()
        if i == N - 1:
            print('NO')
            exit()
print('YES')


Measured memory_bytes: 35420
#include <iostream>
#include <string>

using namespace std;

int main(){
    int n;
    string s,t,u;
    cin >> s;

    n = s.size();

    t = s.substr(0,(n-1)/2);
    u = s.substr(((n+3)/2)-1,t.size());

    if(t == u)cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

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

using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (a > b || n < 1) cout << 0 << endl;
	else if (n == 1) cout << (a == b ? 1 : 0) << endl;
	else cout << 1ll * (b - a) * (n - 2) + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S; cin >> S;
  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  if (S == "Cloudy") {
    cout << "Rainy" << endl;
  }
  if (S == "Rainy") {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(i) for(int i = 0;true; i++)
#define all(x) (x).begin(), (x).end()
#define mn 1000000007
int main() {
	int N;
	cin >> N;
	int num = 1;
	vi A;
	loop(i) {
		if (N+1==i) {
			cout<<A[A.size()-1]<<endl;
			break;
		}
		if (i >= 2) {
			A.push_back(A[i-1]+A[i-2]);
		}
		else {
			A.push_back(1);
		}
	}
};




Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    bool over = 0;
    ll K = in();
    vector<ll> A(K);
    REP(i,K)A[K-i-1] = in();
    ll sh = 2,ue = 2;
    REP(i,K){
        sh = sh % A[i] == 0 ? sh : (sh/A[i])*A[i] + A[i];
        ue = (ue/A[i])*A[i];
        if(sh > ue){
            over = 1;
            break;
        }
        ue = ue + A[i] - 1;
    }
    if(over){
        cout << -1 << "\n";
    }else{
        cout << sh <<" "<< ue << "\n";
    }
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String line = sc.nextLine();

            for(int i=0; i<line.length(); i++){
                char ch =line.charAt(i);
                if(Character.isLowerCase(ch)) {
                    System.out.print(Character.toUpperCase(ch));
                }else{
                    System.out.print(Character.toLowerCase(ch));
                    }
                }
            System.out.println();
            }
        }
    }


Measured memory_bytes: 27112
#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;

bool checkVector(vector<int> v){
    bool ret=true;
    int num=v.size();
    if(num%2==0){
        for(int i=0;i<num/2;i++){
            if(v[2*i]!=2*i+1 ||v[2*i+1]!=2*i+1){
                    ret=false;break;
                }
        }
    }else{
        if(v[0]!=0){ret=false;}
        for(int i=1;i<=num/2;i++){
                if(v[2*i-1]!=2*i ||v[2*i]!=2*i){
                ret=false;break;
            }
        }

    }
    return ret;
}


int bipow(int j){
    int ret=1;
    for(int i=0;i<j;i++){
        ret=ret*2%mod;
    }
    return ret;
}

int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(auto&& w:a)cin>>w;
    sort(a.begin(),a.end());
    int ans;
    if(checkVector(a))ans=bipow(a.size()/2);
    else ans=0;

    cout <<ans<<endl;




}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <vector>
int n;
int a[3][100010];
long long ans;
long long sum[100010];
int main(){
	scanf("%d",&n);
	for(int j=0;j<3;j++)
	for(int i=0;i<n;i++){
		scanf("%d",&a[j][i]);
	}
	for(int i=0;i<3;i++) std::sort(a[i],a[i]+n);
	for(int i=0;i<n;i++){
		sum[i] = sum[i-1] + (long long)(std::lower_bound(a[0],a[0]+n,a[1][i])-a[0]);
		//printf("%d ",sum[i]);
	}
	//puts("");
	for(int i=0;i<n;i++){
		long long t = sum[(int)(std::lower_bound(a[1],a[1]+n,a[2][i])-a[1])-1];
		ans+=t;
		//printf("%d ",t);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
void print(int sequence[], int N); // 出力するための関数
int bubbleSort(int sequence[], int N); //バブルソートの関数

int main(void){
    
    // 定義：数列を「 sequence 」、数列の個数を「 N 」とソート回数を「 count 」と置く
    int sequence[100], N, count;

    cin >> N;
    
    // 反復：数列に値を入力する
    for(int i = 0; i < N; i++){
        cin >> sequence[i];
    }
    
    count = bubbleSort(sequence, N); //バブルソートの関数
    print(sequence, N); // 出力するための関数
    cout << count << endl;
    
    
}


/***********************  出力するための関数   ******************************/

void print(int sequence[], int N){
    for(int i = 0; i < N; i++){
        cout << sequence[i] << ((i != N-1) ? " " : "\n");
    }
}


/***********************  バブルソートの関数  ******************************/

int bubbleSort(int sequence[], int N){
    int count = 0;
    
    
    for(int i = 0; i < N; i++){
        //反復：バブルソートは末尾の数列から開始 変数 i はソート済の範囲を表す 初めは 0から始めり N-1 まで終わる
        for(int j = N-1; j > i; j--){
            
            //  比較：隣り合う数列を比べる
            if(sequence[j-1] > sequence[j]){
                swap(sequence[j-1], sequence[j]);   // 交換
                count++;
            }
        }
    }
    
    return count;
}






Measured memory_bytes: 3104
#include<stdio.h>
int main()
{
    char line1[10],line2[10],line3[10],final[10];
    int i;
    scanf("%s",&line1);
    scanf("%s",&line2);
    scanf("%s",&line3);
    final[0]=line1[0];
    final[1]=line2[1];
    final[2]=line3[2];
    final[3]='\0';
    printf("%s\n",final);
}


Measured memory_bytes: 128
S = gets.chomp.reverse
index = 0
loop{
    if S.size <= index
        puts "YES"
        break
    end
    if S[index, 5] == "maerd"
        index += 5
    elsif S[index, 7] == "remaerd"
        index += 7
    elsif S[index, 5] == "esare"
        index += 5
    elsif S[index, 6] == "resare"
        index += 6
    else
        puts "NO"
        break
    end
}


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

int main(){
	int n,m,i,j;
	while(cin >> n >> m, n && m){	
		int ret = 0;
		vector<int> data(n+1);
		vector<int> all;
		for(i=0;i<n;i++)cin >> data[i];
		for(i=0;i<n+1;i++)
			for(j=i;j<n+1;j++)
				all.push_back(data[i]+data[j]);
		sort(all.begin(),all.end());
		
		for(i=0;i<all.size();i++){
			int t = m-all[i];
			vector<int>::iterator it = upper_bound(all.begin(),all.end(),t);
			if(it != all.begin()){
				ret = max(ret,all[i] + *(it-1) );
			}
		}
		cout << ret << endl;
	}
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int t=0;
        int h=0;
        for(int i=0;i<n;i++){
            String Taro=sc.next();
            String Hanako=sc.next();
            int result=Taro.compareTo(Hanako);
            if(result>0) t+=3;
            else if(result<0) h+=3;
            else{
                t++;
                h++;
            }
        }
        System.out.println(t+" "+h);
    }
}



Measured memory_bytes: 29788
#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];
	}
	vector<int> l(N + 1), r(N + 1);
	for (int i = 0; i < N; i++) {
		l[i + 1] = max(l[i], A[i]);
	}
	for (int i = N - 1; i >= 0; i--) {
		r[i] = max(r[i + 1], A[i]);
	}
	for (int i = 0; i < N; i++) {
		printf("%d\n", max(l[i], r[i + 1]));
	}
	return 0;
}


Measured memory_bytes: 3968
cards = []
scores = [0, 0]

gets.to_i.times { cards << gets.chomp.split }

cards.each do |card|
	sorted = card.sort

	card[0] == card[1] ? scores.map!{|s| s += 1}
	  : card[0] == sorted[1] ? scores[0] += 3
	  : scores[1] += 3
end

puts "#{scores[0]} #{scores[1]}"



Measured memory_bytes: 6852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    ll x;
    cin >> N >> x;
    ll a[N+1];
    a[0] = 0;
    rep2(i, 1, N) cin >> a[i];
    ll ans = 0;
    rep2(i, 1, N){
        if(a[i]+a[i-1] > x){
            ans += a[i]+a[i-1]-x;
            a[i] = x-a[i-1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll a, b, c, d, k;
	cin >> a >> b >> c >> d >> k;
	ll ans = 60 * (c - a) + (d - b);
	cout << max(ans - k, 0ll) << endl;
}


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

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

  vector<int> anss;
  for (int i = 0; i < n; i++)
  {
    string s,t;
    cin >> s >> t;

    int lens = s.size();
    int lent = t.size();
    int dp[lens][lent];
    bool flg = false;
    for (int j = 0; j < lens; j++)
    {
      if(t[0]==s[j]) flg = true;
      if(flg) dp[j][0] = 1;
      else dp[j][0] = 0;
    }
    flg = false;
    for (int j = 0; j < lent; j++)
    {
      if(s[0]==t[j]) flg = true;
      if(flg) dp[0][j] = 1;
      else dp[0][j] = 0;
    }

    for (int j = 1; j < lens; j++)
    {
      for (int k = 1; k < lent; k++)
      {
        if(s[j]==t[k]) dp[j][k] = dp[j-1][k-1]+1;
        else dp[j][k] = max(dp[j-1][k],dp[j][k-1]);
      }      
    }
    anss.push_back(dp[lens-1][lent-1]);
  }
  for(int ans:anss) cout << ans << endl;
}


Measured memory_bytes: 7040
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let _: usize = parse_line().unwrap();
    let a: Vec<isize> = parse_line().unwrap();

    let mut ret = std::isize::MAX;
    for t in -100..101 {
        let mut cost = 0;
        for v in &a {
            cost += (v - t) * (v - t);
        }
        if cost < ret {
            ret = cost;
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 2148
import math

def isprime(n):
    if n == 1: return False
    
    for k in range(2, int(math.floor(math.sqrt(n))) + 1):
        if n % k == 0:
            return False
    
    return True

n = int(input())
a = 0

for i in range(n):
    x = int(input())
    if isprime(x):
        a += 1
        
print(a)


Measured memory_bytes: 5684
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
inline void print() { cout << endl; }
template <class Head, class... Tail> inline void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...);}
template <class T> inline void print(vector<T>& vec) { for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " "; } cout << endl;}
template <class T> inline void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); }}
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;

ll N;

void rec(ll cur, int use, ll& counter) {
    if (cur > N) return;

    if (use == 0b111) counter++;

    rec(cur * 10 + 7, use | 0b100, counter);
    rec(cur * 10 + 5, use | 0b010, counter);
    rec(cur * 10 + 3, use | 0b001, counter);
}

int main() { 
    cin >> N;
    ll res = 0;
    rec(0, 0, res);

    cout << res << endl;
    
    return 0;
}

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

constexpr int nax = 1e5;

int n, val[nax + 1];
vector< int > gr[nax + 1];

void dfs(const int v, const int oj)
{
    for (int s : gr[v])
        if (s != oj)
            dfs(s, v);

    for (int s : gr[v])
	if (s != oj)
	    val[v] xor_eq (val[s] + 1);
}

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

    cin >> n;

    for (int i = 0; i < n - 1; ++i)
    {
        int p, q; cin >> p >> q;
        gr[p].push_back(q);
        gr[q].push_back(p);
    }

    dfs(1, 1);

    cout << (val[1]? "Alice" : "Bob") << '\n';
}


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

using namespace std;
const int SIZE=200000+50;
int arr[SIZE];
int s[SIZE],res[SIZE];

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&arr[i]);
    }
    int top=0;
    for(int i=n;i>=1;i--){
        while(top && arr[s[top]]>arr[i])top--;
        res[i]=s[top];
        s[++top]=i;
    }
    int cnt=0,flag=1;
    for(int i=1;i<=n-k+1;i++){
        if(res[i]==0 && flag==0)continue;
        if(res[i]-i<=k-1 && res[i]!=0){
            cnt++;printf("i=%d\n",i);
        }
        else{
            if(flag){
                cnt++;flag=0;printf("i=%d\n",i);
            }
        }
        printf("res[%d]=%d flag=%d\n",i,res[i],flag);
    }
    printf("%d",cnt);
    return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
int ans[1010][1010];
int main()
{
    int H,W;
    scanf("%d%d",&H,&W);
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i = 1;i <= H;i++){
        if(i <= b*2){
            if(i%2 == 1){
                for(int j = 1;j <= a;j++){
                    ans[i][j] = 1;
                }
                for(int j = a+1;j <= W;j++){
                    ans[i][j] = 0;
                }
            }
            else{
                for(int j = 1;j <= a;j++){
                    ans[i][j] = 0;
                }
                for(int j = a+1;j <= W;j++){
                    ans[i][j] = 1;
                }
            }
        }
        else{
            for(int j = 1;j <= a;j++){
                ans[i][j] = 1;
            }
            for(int j = a+1;j <= W;j++){
                ans[i][j] = 0;
            }
        }
    }
    for(int i = 1;i <= H;i++){
        for(int j = 1;j <= W;j++){
            printf("%d",ans[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 5120
#include<stdio.h>
int main()
{
	int w,a,b;

	scanf("%d%d%d",&w,&a,&b);
	if(a<b)
		printf("%d",b-w-a>0?b-w-a:0);
	else
		printf("%d",a-w-b>0?a-w-b:0);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<long> B(N - 1);
    vector<long> A(N);
    rep(i, N - 1)
    {
        cin >> B[i];
    }
    A[0] = B[0];
    A[N - 1] = B[N - 2];
    int i = 0, j = 1;
    while (j < N-1)
    {
        A[j] = min(B[i], B[i + 1]);
        i++;
        j++;
    }
    long sum = 0;
    rep(i, N)
    {
        sum += A[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<1
import math
s = input()
bigger=0
smaller=0
count = 0
bigger=1 if s[0]=="<" else 0 
smaller=1 if s[0]==">" else 0 


for i in range(len(s)-1):
    if (s[i]==">" and s[i+1]=="<"):
        count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
        count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0
        bigger = 1
        smaller = 0
    elif (s[i]=="<" and s[i+1]=="<"):
        bigger += 1
    elif (s[i]=="<" and s[i+1]==">"):
        smaller += 1
    elif (s[i]==">" and s[i+1]==">"):
        smaller += 1
count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0

print(int(count))



Measured memory_bytes: 4232
#include <stdio.h>
#include <string.h>

int main(void)
{
    char s[201];
    int n,i;
    scanf("%s",s);
    n=strlen(s)-1;
    do{
        s[n]='\0';
        n--;
        if(strlen(s)%2)continue;
        for(i=0;i<strlen(s)/2;i++)if(s[i]!=s[strlen(s)/2+i])break;
        if(i==strlen(s)/2)break;
    }while(1);
    printf("%d",strlen(s));
    return 0;
}

Measured memory_bytes: 128
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    S = list(input())



    ans =0
    for k in range(N+1,0,-1):
        i=0
        count =0
        while i<N-k:
            if S[i]==S[i+k]:
                count+=1
                ans =max(ans,min(count,k))
            else:
                count=0

            i+=1

    print(ans)









if __name__ == "__main__":
    main()


Measured memory_bytes: 73612
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;


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

	long double a;
	cin >> a;
	cout << setprecision(20) << a * 2 * 3.14159265358979 << endl;
}

Measured memory_bytes: 3804
#include <iostream>

using namespace std;

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

    int debt = 100; // *1000
    while(n--) {
        int r = debt % 20;
        debt += debt/20;
        if(r) ++debt;
    }
    cout << debt << "000" << endl;

    return 0;
}

Measured memory_bytes: 0
#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.at(i);
	}

	int ans = 0;
	for (int i = 0;i < N;) {
		if (i == N - 1) {
			ans++;
			i++;
		}
		else {
			int plus_i = 0;
			int j = i;
			while (j < N - 1) {
				if (A.at(j) <= A.at(j + 1)) {
					plus_i++;
					j++;
				}
				else
					break;
			}
			int minas_i = 0;
			int k = i;
			while (k < N - 1) {
				if (A.at(k) >= A.at(k + 1)) {
					minas_i++;
					k++;
				}
				else
					break;
			}
			ans++;
			i += max(plus_i, minas_i)+1;
		}
	}
	
	cout << ans;

	
}


Measured memory_bytes: 640
#include <iostream>


using namespace std;

void solution()
{
    char c;
    cin >> c;
    if('a' <= c && c <= 'z'){
        cout  << 'a';
    }else{
        cout << 'A';
    }
    cout << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solution();
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int INF = 1001001001;
const int MAXN = 1001001;

int dp[MAXN][2];

int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  s += '0';
  int n = s.length();
  rep(i, MAXN)rep(j, 2) dp[i][j] = INF;

  dp[0][0] = 0;
  rep(i, n)rep(j, 2) {
    int c = s[i] - '0';
    c += j; // 繰り下がりが起こる場合に桁に1を足しておく
    rep(a, 10) {
      int ni = i + 1, nj = 0;
      int b = a - c;
      if (b < 0) {
        nj = 1;
        b += 10;
      }
      chmin(dp[ni][nj], dp[i][j] + (int)a + b);
    }

  }
  int ans = dp[n][0];
  cout << ans << endl;
}

Measured memory_bytes: 9220
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;
 
int main()
{
    ll N, M;
    cin >> N >> M;
    if (N > M/2) {
        print(M/2);
    } else {
        ll tmp = M - 2*N;
        print(tmp/4+N);
    }

    return 0;
}

Measured memory_bytes: 256