akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main (){
  int N,M,K;
  cin >> N >> M >> K;
  for(int n=0;n<=N;n++){
    for(int m=0;m<=M;m++){
      if(K==n*M-n*m*2+N*m){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = list(map(int,input().split()))

for j in range(min(k,45)):
  B = [0]*(n)
  for i in range(n):
    l = max(0,i-A[i])
    r = min(n-1,i+A[i])
    B[l] += 1
    if r+1 < n:
      B[r+1] -= 1  
      
  for i in range(1,n):
    B[i]+=B[i-1]
  
  A = B.copy()
print(*B)  

Measured memory_bytes: 170880
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <type_traits>
#include <limits>
#include <tuple>

template <class Tp>
class lines {
  // based on Li Chao tree
  std::map<Tp, size_t> enc;
  std::vector<Tp> dec;
  std::vector<std::pair<Tp, Tp>> c;
  size_t m = 1;
  Tp inf = std::numeric_limits<Tp>::max() / 8;

private:
  void init_resize(size_t n) {
    while (m < n+n) m <<= 1;
    c.assign(m, {0, inf});
  }

  void inspect() const {
    for (size_t i = 1; i < m; ++i) {
      std::string s = (c[i].first < inf? std::to_string(c[i].first) : "inf");
      std::string t = (c[i].second < inf? std::to_string(c[i].second) : "inf");
      fprintf(stderr, "(%s, %s)%c", s.c_str(), t.c_str(), (i&(i+1))? ' ':'\n');
    }
  }

public:
  template <class ForwardIt>
  lines(ForwardIt first, ForwardIt last): dec(first, last) {
    static_assert(std::is_same<typename ForwardIt::value_type, Tp>::value, "Type mismatch");
    std::sort(dec.begin(), dec.end());
    size_t n = dec.size();
    init_resize(n);
    // while (dec.size() < m/2) dec.push_back(dec.back()+1);
    dec.resize(m/2, dec.back());
    for (size_t i = 0; i < m/2; ++i) enc.emplace(dec[i], i);
  }

  void append(Tp a, Tp b) {
    size_t l = 0;
    size_t j = 1;
    size_t h = 1;
    size_t w = m/2;
    while (w > 0 && l+w-1 < dec.size()) {
      Tp xl = dec.at(l);
      Tp xm = dec.at(l+w/2);
      Tp xr = dec.at(l+w-1);

      Tp a0, b0;
      std::tie(a0, b0) = c[j];

      Tp yl0 = a0*xl + b0;
      Tp ym0 = a0*xm + b0;
      Tp yr0 = a0*xr + b0;

      Tp yl = a*xl + b;
      Tp ym = a*xm + b;
      Tp yr = a*xr + b;

      if (yl0 <= yl && yr0 <= yr) break;
      if (yl0 >= yl && yr0 >= yr) {
        c[j] = {a, b};
        break;
      }

      h <<= 1;
      w >>= 1;

      if (ym0 >= ym) {
        c[j] = {a, b};
        a = a0;
        b = b0;
        j <<= 1;
        if (yr0 < yr) {
          j |= 1;
          l += w;
        }
      } else {
        j <<= 1;
        if (yr0 >= yr) {
          j |= 1;
          l += w;
        }
      }
    }
  }

  Tp min_at(Tp x) const {
    size_t i = enc.at(x) + m/2;
    Tp y = inf;
    while (i > 0) {
      Tp a, b;
      std::tie(a, b) = c[i];
      y = std::min(y, a*x+b);
      i >>= 1;
    }
    return y;
  }
};

int main() {
  size_t N;
  intmax_t C;
  scanf("%zu %jd", &N, &C);

  std::vector<intmax_t> h(N);
  for (auto& hi: h) scanf("%jd", &hi);

  lines<intmax_t> cht(h.begin(), h.end());

  std::vector<intmax_t> dp(N);
  for (size_t i = 0; i+1 < N; ++i) {
    cht.append(-2*h[i], h[i]*h[i]+dp[i]);
    dp[i+1] = cht.min_at(h[i+1]) + h[i+1]*h[i+1] + C;
  }

  printf("%jd\n", dp[N-1]);
}


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

int main()
{
	// 入力
	int r;
	cin >> r;
	
	int rCercleArea = r * r;
	
	// 半径 * 半径の結果が半径1の円の何倍かの値になる
	cout << rCercleArea << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iterator>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <cmath>

#define YESNO(x) x ? printf("YES") : printf("NO")
#define YesNo(x) x ? printf("Yes") : printf("No")
#define scani(x) scanf("%d", &x)
#define printi(x) printf("%d", x)

using namespace std;

//ABC098C - Attention
int Main() {
	int ans = 1 << 30;
	int n;
	vector<char> s;
	vector<int> wSum, eSum;

	scani(n);
	s.resize(n);
	wSum.resize(n);
	eSum.resize(n);
	for (auto& x : s) {
		cin >> x;
	}
	wSum[0] = 0;
	eSum[0] = 0;

	//create table
	for (int x = 0; x < n; x++) {
		if ('W' == s[x]) {
			if (x - 1 < 0) {
				wSum[x] = 1;
			}
			else {
				wSum[x] = wSum[x - 1] + 1;
			}
		}
		else {
			if (n <= x + 1) {
				wSum[x] = 0;
			}
			else {
				wSum[x] = wSum[x - 1];
			}
		}
	}
	for (int x = n - 1; 0 <= x; x--) {
		if ('E' == s[x]) {
			if (n <= x + 1) {
				eSum[x] = 1;
			}
			else {
				eSum[x] = eSum[x + 1] + 1;
			}
		}
		else {
			if (n <= x + 1) {
				eSum[x] = 0;
			}
			else {
				eSum[x] = eSum[x + 1];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		int sum = 0;
		if (0 <= i - 1) {
			sum += wSum[i - 1];
		}
		if (i + 1 < n) {
			sum += eSum[i + 1];
		}
		ans = min(ans, sum);
	}

	cout << ans;

	return 0;
}

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


Measured memory_bytes: 2944
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N;
  cin >> N;
  cout << N * N << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>                                                                           
using namespace std;                                                                          
int main(){                                                                                   
  int n, min, max, tmp;                                                                       
  long int sum;                                                                               
  cin >> n;                                                                                   
  min=1000000;                                                                                
  max=-1000000;                                                                               
  sum=0;                                                                                      
  for (int i=0; i<n; i++){                                                                    
    cin >> tmp;                                                                               
    if (tmp < min) min = tmp;                                                                 
    if (tmp > max) max = tmp;                                                                 
    sum += tmp;                                                                               
  }                                                                                           
  //  printf("%d %d %d\n",min,max,sum);                                                       
  cout << min << " " << max << " " << sum << endl;                                            
}                                                                                             
                                                                                              
                      


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using uint = uint32_t;
using ll = long long;
using ld = long double;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * n; i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,e) for (ll i = s; i < (ll)e; i++)
#define TEN(x) ((ll)1e##x)


struct Edge{ uint32_t to, id; };
typedef vector<vector<Edge>> Graph;
struct SCC {
#define PB push_back
	typedef uint32_t T;
	typedef function<void(T)> F;
	typedef vector<T> vt;
	typedef vector<vt> vvt;
	explicit SCC(const Graph & es) {
		T n = es.size(), k = 0;
		vvt re(n); REP(v, n) for (auto e : es[v]) re[e.to].PB(v);
		vt ord; v2cmp = vt(n, 0);
		F dfs = [&](T v) {
			v2cmp[v] = n;
			for (auto e : es[v]) if (!v2cmp[e.to]) dfs(e.to);
			ord.PB(v);
		};
		REP(v, n) if (!v2cmp[v]) dfs(v);
		reverse(ord.begin(), ord.end());
		F rdfs = [&](T v) {
			v2cmp[v] = k;
			for (T u : re[v]) if (v2cmp[u] == n) rdfs(u);
		};
		for (T v : ord) if (v2cmp[v] == n) { rdfs(v); k++; }
		g = Graph(k); component = vvt(k);
		REP(v, n) {
			component[v2cmp[v]].PB(v);
			for (auto e : es[v]) {
				e.to = v2cmp[e.to];
				if (v2cmp[v] != e.to) g[v2cmp[v]].PB(e);
			}
		}
	}
	// v2cmp[v]     : ??????v???????±????????????£??????????????????????????????
	// component[i] : i??????????????£?????????????±??????????????????????????????????????????????
	// g            : ?????£????????????????????¨????????£??\?????????
	vt v2cmp;
	vvt component;
	Graph g;
};

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	uint n, m; cin >> n >> m;
	Graph g(n);
	REP(i, m){
		uint s, t; cin >> s >> t;
		g[s].push_back({t, i});
	}
	SCC scc(g);

	uint q; cin >> q;
	REP(i, q) {
		uint u, v; cin >> u >> v;
		cout << (scc.v2cmp[u] == scc.v2cmp[v] ? 1 : 0) << endl;
	}
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int ans = n;
  char s;
  while(1){
	cin >> s;
	if(s == '=') break;
	cin >> n;
	if(s == '+')ans += n;
	if(s == '-')ans -= n;
	if(s == '*')ans *= n;
	if(s == '/')ans /= n;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  int x,a;cin>>x>>a;
  int res = (x<a) ? 0:10;
  cout<<res<<endl;
}

Measured memory_bytes: 384
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,*a = map(int,read().split())

a.sort()
res = []
while a and len(res) < 2:
    #print(a,res)
    if len(a) >= 2 and a[-1] == a[-2]:
        res.append(a[-1])
        a.pop()
        a.pop()
    else:
        a.pop()

#print(res)

if len(res) == 2:
    print(res[0]*res[1])
else:
    print(0)

Measured memory_bytes: 20024
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

vector<string> s(12);
vector<bitset<6> > check;

int countBlock(int y, int x)
{
    check[y][x] = true;

    int ret = 1;
    for(int i=0; i<4; ++i){
        int y1 = y + dy[i];
        int x1 = x + dx[i];
        if(y1 < 0 || y1 >= 12 || x1 < 0 || x1 >= 6)
            continue;
        if(!check[y1][x1] && s[y][x] == s[y1][x1])
            ret += countBlock(y1, x1);
    }

    return ret;
}

void eraseBlock(int y, int x)
{
    int color = s[y][x];
    s[y][x] = '.';

    for(int i=0; i<4; ++i){
        int y1 = y + dy[i];
        int x1 = x + dx[i];
        if(y1 < 0 || y1 >= 12 || x1 < 0 || x1 >= 6)
            continue;
        if(s[y1][x1] == color)
            eraseBlock(y1, x1);
        if(s[y1][x1] == 'O')
            s[y1][x1] = '.';
    }
}

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

    while(--n >= 0){
        for(int i=0; i<12; ++i)
            cin >> s[i];

        int ret = 0;
        for(;;){
            bool change = false;
            check.assign(12, 0);
            for(int i=0; i<12; ++i){
                for(int j=0; j<6; ++j){
                    if(s[i][j] == 'O' || s[i][j] == '.')
                        continue;
                    if(countBlock(i, j) >= 4){
                        eraseBlock(i, j);
                        change = true;
                    }
                }
            }
            if(!change)
                break;

            vector<string> next(12, string(6, '.'));
            for(int i=0; i<6; ++i){
                int k = 11;
                for(int j=11; j>=0; --j){
                    if(s[j][i] != '.'){
                        next[k][i] = s[j][i];
                        -- k;
                    }
                }
            }
            s.swap(next);

            ++ ret;
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}


  int main(){
      lint N,K;
      lint ans=0;
      cin>>N>>K;
      lint M[N];
      lint x[60];
      rep(i,60){
          x[i]=0;
      }
      rep(i,N){
          cin>>M[i];
      }
      rep(i,N){
         lint h= log2(M[i])+1;
         rep(j,h){
             if(M[i]%2==1)x[j]++;
             M[i]/=2;
         }
      }
      lint g=log2(K);
     
      repm(i,60){
       
        if((N-x[i])>x[i]&&pow(2,i)<=K){
            ans+=(lint)pow(2,i)*(N-x[i]);
            K-=(lint)pow(2,i);
        } else {
            ans+=(lint)pow(2,i)*x[i];
        }
        
      }
      cout<<ans;
     }
  

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<int64_t> a(n);
    int64_t s = 0;
    for (auto&& aa : a) {
        cin >> aa;
        aa *= 2;
        s += aa;
    }

    auto m = s / 2;
    auto d = s;
    auto ss = 0L;
    for (auto aa : a | sliced(0, n - 1)) {
        ss += aa;
        d = min(d, abs(ss - m));
    }

    cout << d << endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
    int H;
    cin >> H;
    
    int W;
    cin >> W;
    
    int h;
    cin >> h;
    
    int w;
    cin >> w;
    
    int a = H*W-(h*W)-(H*w)+(h*w);
    

    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#define all(o) (o).begin(), (o).end()
#define sz(x) ((int)(x).size())

//#define x first
//#define y second

using namespace std;
typedef long long ll;

const int S = 5010;
const ll MOD = ll(1e9)+7;
const double eps = 1e-8;

double sum = 0;
double x[10], y[10];
int n;

int main() {
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
        for(int j = 0; j < i; j++)
            sum += sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
    }
    
    cout << setprecision(8);
    cout << 2.0*sum/n << endl;
    
    return 0;
}


Measured memory_bytes: 256
//go:generate echo "https://atcoder.jp/contests/dp/tasks/dp_b"
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func iabs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve(n, k int, h []int) int {
	t := make([]int, n+k+1, n+k+1)
	for i := range t {
		t[i] = math.MaxInt64
	}
	t[0] = 0
	for i := 0; i < n; i++ {
		for j := 0; j <= k; j++ {
			if v := t[i] + iabs(h[i+j]-h[i]); v < t[i+j] {
				t[i+j] = v
			}
		}
	}
	return t[n-1]
}

func main() {
	scan := newScanner(os.Stdin)
	n, k := scan.Int(), scan.Int()
	h := make([]int, n+k+1, n+k+1)
	for i := 0; i < n; i++ {
		h[i] = scan.Int()
	}
	a := solve(n, k, h)
	fmt.Println(a)
}


Measured memory_bytes: 3928
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	ll n,m;
	cin>>n>>m;
	cout<<n*m<<endl;
	return 0;
}


Measured memory_bytes: 3100
x = input().split()
H = int(x[0])
W = int(x[1])

n = H % 2
m = W % 2

if H == 1 or W == 1:
  print(1)
elif n == 0 and m == 0:
  print((H*W) // 2)
elif n == 0 and m == 1:
  print(((H*(W-1)) // 2 ) + (H // 2))
elif n == 1 and m == 0:
  print(((W*(H-1)) // 2 ) + (W // 2))
else:
  print(((H-1)*(W-1) // 2) + ((H-1) // 2) + (W // 2) + 1)

Measured memory_bytes: 3064
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int h=sc.nextInt();
        int w=sc.nextInt();
        String s;
        int white=0;
        boolean[][]input=new boolean[h][w];
        boolean[][]visited=new boolean[h][w];
        visited[0][0]=true;
        for(int i=0;i<h;i++){
            s=sc.next();
            for(int j=0;j<w;j++){
                if(s.charAt(j)=='.'){
                    input[i][j]=true;
                    white++;
                }
                
            }
        }
        int[] movex={1,0,-1,0};
        int[] movey={0,1,0,-1};
        Queue<Integer> queuex=new ArrayDeque<>();
        Queue<Integer> queuey=new ArrayDeque<>();
        queuex.add(0);
        queuey.add(0);
        int size;
        for(int i=0;i<h*w;i++){
            size=queuex.size();
            for(int j=0;j<size;j++){
                for(int k=0;k<4;k++){
                    try{
                        if(input[queuex.peek()+movex[k]][queuey.peek()+movey[k]]&&!visited[queuex.peek()+movex[k]][queuey.peek()+movey[k]]){
                            visited[queuex.peek()+movex[k]][queuey.peek()+movey[k]]=true;
                            queuex.add(queuex.peek()+movex[k]);
                            queuey.add(queuey.peek()+movey[k]);
                            
                        }
                        if(queuex.peek()+movex[k]==h-1&&queuey.peek()+movey[k]==w-1){
                            System.out.println(white-i-2);
                            return;
                        }
                    }catch(Exception e){}
                }
                queuex.poll();
                queuey.poll();
            }
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {1, 0}, dy[] = {0, 1};
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int add(int a, int b){return  a + b > mod ? a + b - mod : a + b;}
int mul(int a, int b){return a * b >= mod ? a * b % mod : a * b;} 
char v[10][10];
int main(){
    //FL;
    FIN;
    int H, W, K;
    cin >> H >> W >> K;
    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++)
            cin >> v[i][j];
    int ans = 0;
    for(int maskH = 0; maskH < (1 << H); maskH++){
        for(int maskW = 0; maskW < (1 << W); maskW++){
            int count = 0;
            for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++){
                    if(!(maskH & (1 << i)) and !(maskW & (1 << j))){
                        if(v[i][j] == '#')
                            count++;
                    }
                }
            }
            if(count == K)
                ans++;
        }
    }
    cout << ans << '\n';
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 3776
#include <iostream>

int main()
{
  int N, T, menor = 1000, equal = 0;

  std::cin >> N >> T;

  int ci, ti;

  for(int i=0;i<N;i++){
    std::cin >> ci >> ti;
    if(ti<= T){
      equal = 1;
      if(ci < menor){
        menor = ci;
      }
    }
  }
  if(equal == 0){
    std::cout << "TLE" <<std::endl;
  }else{
    std::cout << menor <<std::endl;  
    }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vv first
#define ww second
using namespace std;

typedef pair <int, int> pii;
const int NN = 1e2 + 5;
const int MM = 1e5 + 5;
int dp[NN][MM];
pii aa[NN];
int nn, ss;
int resu;

void Enter() {
        cin >> nn >> ss;
        for (int ii = 1; ii <= nn; ++ii)
            cin >> aa[ii].ww >> aa[ii].vv;
        sort(aa + 1, aa + nn + 1);
        for (int ii = 0; ii <= nn; ++ii)
        for (int jj = 1; jj <= MM - 5; ++jj)
            dp[ii][jj] = 1e9 + 7;
}

void Solve() {
        for (int ii = 1; ii <= nn; ++ii) {
            for (int jj = 1; jj <= MM - 5; ++jj) {
                int zz = jj + aa[ii].vv;
                if (dp[ii - 1][jj] != 1e9 + 7)
                    dp[ii][zz] = min(dp[ii][zz], dp[ii - 1][jj] + aa[ii].ww);
            }
            for (int jj = 1; jj <= MM - 5; ++jj)
                dp[ii][jj] = min(dp[ii][jj], dp[ii - 1][jj]);
            dp[ii][aa[ii].vv] = min(dp[ii][aa[ii].vv], aa[ii].ww);
        }
        for (int ii = 1; ii <= nn; ++ii)
        for (int jj = 1; jj <= MM - 5; ++jj)
            if (dp[ii][jj] <= ss) resu = max(resu, jj);
        cout << resu;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
        Enter();
        Solve();
    return 0;
}


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

int main()
{
  char n[4];
  cin >> n;

  if(n[0] == n[1] && n[1] == n[2])
    cout << "Yes" << endl;
  else if(n[1] == n[2] && n[2] == n[3])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

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

int main(void) {
	long long s;
	cin >> s;

	long long y2 = 1000000000LL, y1 = 1;
	long long x2 = (y2 - s % y2) % y2;
	long long x1 = (s + x2) / y2;
	
	cout << 0 << " " << 0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
	return 0;
}


Measured memory_bytes: 3648
fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val sticks = readLine()!!.split(" ").map { it.toInt() }.sorted()
    var ans = 0
    for (left in 0..(n - 3)){
        for (right in (left + 1)..(n - 2)){
            var bottom = right
            var top = n
            while (top > bottom + 1) {
                var mid = (top + bottom) / 2
                if (sticks[mid] >= sticks[left] + sticks[right]){
                    top = mid
                } else {
                    bottom = mid
                }
            }
            ans += bottom - right
        }
    }
    println(ans)
}


Measured memory_bytes: 37736
#include <iostream>
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;


const int MAX = 1e5;
int cost[MAX][3];
int dp[3];
int new_dp[3];

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

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) 
            cin >> cost[i][j];

        for (int j = 0; j < 3; j++) {
            new_dp[0] = j ? max(dp[1], dp[2]) + cost[i][0] : cost[i][0];
            new_dp[1] = j ? max(dp[0], dp[2]) + cost[i][1] : cost[i][1];
            new_dp[2] = j ? max(dp[0], dp[1]) + cost[i][2] : cost[i][2];
        }
        dp[0] = new_dp[0];
        dp[1] = new_dp[1];
        dp[2] = new_dp[2];

        memset(new_dp, 0, 3);
    }

    cout << max({dp[0], dp[1], dp[2]});

    return 0;
}



Measured memory_bytes: 1408
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
  int n;
  cin>>n;
  n++;
  V<int> used(n,-1);
  int l,r;
  init();
  for(int i=0;i<n;i++){
      int a;
      cin>>a;
      if(used[a]!=-1)l=used[a],r=n-i-1;
      used[a]=i;
  }
  for(int i=1;i<=n;i++){
      mint res=COM(n,i)-COM(l+r,i-1);
      cout<<res<<endl;
  }
}


Measured memory_bytes: 48512
n=list(input())
count=0
ans=[]
for i in range(len(n)):
    if n[i]=="A" or n[i]=="C" or n[i]=="G" or n[i]=="T":
        count+=1
    else:
        ans.append(count)
        count=0
ans.append(count)
print(max(ans))

Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

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

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

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

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

deque<char> deq;

int main() {
    string S;
    cin >> S;
    REP (i, S.size()) {
        deq.PB(S[i]);
    }
    int Q;
    bool inv = false;
    cin >> Q;
    REP (i, Q) {
        int T;
        cin >> T;
        if (T == 1) {
            inv = !inv;
        }
        else {
            int F;
            char C;
            cin >> F >> C;
            if (inv ^ (F == 1)) {
                deq.push_front(C);
            }
            else {
                deq.PB(C);
            }
        }
        /*
        if (inv) {
            for (auto itr = deq.end(); itr != deq.begin(); itr--) {
                cout << *(itr - 1);
            }
        }
        else {
            for (auto itr = deq.begin(); itr != deq.end(); itr++) {
                cout << *itr;
            }
        }
        cout << endl;
        */
    }
    while (!deq.empty()) {
        if (inv) {
            cout << deq.back();
            deq.pop_back();
        }
        else {
            cout << deq.front();
            deq.pop_front();
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
package main
import (
  "fmt"
  // "math"
)

func main() {
  var (
    A string
    B string
  )
  fmt.Scan(&A)
  fmt.Scan(&B)

  if A[0] == B[2] && A[1] == B[1] && A[2] == B[0] {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }

}


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

int main(void){
    string str;
    string comp = "hi";
    bool flag = true;

    cin >> str;

    if(str.size() % 2 == 1){
        cout << "No" << endl;
        exit(0);
    }

    for(int i=0; i<str.size(); i++){
        if(str.at(i) != comp.at(i % 2)){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

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

#define LOG(variable) cerr << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int n, k; cin >> n >> k;
  vector<int> v(n);
  REP(i,n) {
    cin >> v[i];
  }
  SORT(v);
  int ans = 0;
  REP(i,k) {
    ans += v[i];
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    long double a,p,ans;
    cin>>a>>p;
    ans=a/p;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
ans_1 = y[n // 2 - 1]
ans_2 = y[n // 2]
for i in x:
    if i <= ans_1:
        print(ans_2)
    else:
        print(ans_1)


Measured memory_bytes: 25220
#include <stdio.h>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

int i,j,k,l,m,n;
/////////////////////////////////////////////////////


int A,B;

int main(){
    scanf("%d%d",&A,&B);
    printf("%s",(A*B%2?"Yes":"No"));
    return 0;
}

Measured memory_bytes: 256
n = int(input())
room = [ [[0]*10 for _ in range(3)]for _ in range(4)]

for i in range(n):
    b,f,r,v = map(int,input().split())
    room[b-1][f-1][r-1]+=v
    
for j in range(4):
    for m in range(3):
        for k in range(10):
            print(' {}'.format(room[j][m][k]),end='')
        print()
    if j!=3:
        print('#'*20)
        
        
    


Measured memory_bytes: 5624
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X= sc.nextInt();
		int count = 0;
		for(int i = 0;i <= A;i++) {
			for(int k = 0;k <= B;k++) {
				for(int j = 0;j <= C;j++) {
					int ans = (500 * i) + (100 * k) + (50 * j);
					if(ans == X) count++;
				}
			}
		}
		System.out.println(count);
		sc.close();
	}

}


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

bool ok(ll x) {
  ll sum = 0;
  ll p = 0;
  for (ll i = 0; i < N; i++) {
    if (a[i] <= 2*x || a[i] <= 2*sum) {sum += a[i]; p = i;}
  }
  if (p == N-1) {return true;}
  else {return false;}
}

int main() {
  cin >> N;
  for (ll i = 0; i < N; i++) {
    ll x; cin >> x; a.push_back(x);
  }
  sort(a.begin(), a.end());
  ll ub = N; ll lb = -1;
  while (ub-lb > 1) {
    ll mid = (ub+lb)/2;
    (ok(a[mid])? ub:lb) = mid;
  }
  cout << N-ub << endl;
}

Measured memory_bytes: 1400
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time

def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True

# https://algo-logic.info/abc158e/
def main():
    s = list(map(int, S()[::-1]))
    N = len(s)
    P = 2019
    cnts = [0] * P
    cnts[0] = 1
    sum_of_digits = 0

    for i in range(N):
        sum_of_digits += s[i] * pow(10, i, P)
        sum_of_digits %= 2019
        cnts[sum_of_digits] += 1

    ans = 0
    for i in range(P):
        ans += cnts[i] * (cnts[i]-1) // 2
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 78884
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String S = sc.next();  
    StringBuilder s = new StringBuilder();
    s.append(S.charAt(0)); 
    for(int i=1;i<S.length();i++){
        if(S.charAt(i-1)!=S.charAt(i)){
            s.append(S.charAt(i));
        }
    }
    System.out.print(s.length());
    return;
  }
}



Measured memory_bytes: 25772
#include<stdio.h>
int divisor(int a){
int i,n=0;
for(i=1;i<=a;i++)
{
    if(a%i==0){n++;}
}
return n;
}
int main()
{
    int n,count=0,i;
    scanf("%d",&n);
    for(i=1;i<=n;i+=2){if(divisor(i)==8){count++;}}
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const long long INF = 9223372000000000000/2145;
static const int INF = 1000010000;
//static const int NIL = -1;
//static const int MOD = 1000000007;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
//#define int ll

int n;
int a[60];
int ans = 0;
vector<P> out;

void hoge(){
    for(int i=0;i+1<n;i++){
        a[i+1] += a[i];
        out.pb(mp(i+1,i+1+1));
        ans++;
    }
}

void fuga(){
    for(int i=n-1;i>=1;i--){
        a[i-1] += a[i];
        out.pb(mp(i+1,i));
        ans++;
    }
}

void output(){
    printf("%d\n",ans);
    for(int i=0;i<out.size();i++) printf("%d %d\n",out[i].fi,out[i].se);
}

signed main(){
    bool rull = false, onz = false;
    int maks=0,e;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]>0) rull = true;
        if(a[i]<0) onz  = true;
        if(abs(a[i])>abs(maks)){
            maks = a[i];
            e = i;
        }
    }

    if(rull && !onz) hoge();
    else if(!rull && onz) fuga();
    else if(maks>0){
        for(int i=0;i<n;i++) a[i]+=maks;
        for(int i=0;i<n;i++) out.pb(mp(e+1,i+1));
        ans = n;
        hoge();
    } else if(maks<0){
        for(int i=0;i<n;i++) a[i]+=maks;
        for(int i=0;i<n;i++) out.pb(mp(e+1,i+1));
        ans = n;
        fuga();
    }

    output();
    return 0;
}

Measured memory_bytes: 384
n=int(input())

a_list=[int(i) for i in input().split()]
a_list.sort(reverse=True)


alice=[]
bob=[]
for i in range(n):
    if i%2==0:
        alice.append(a_list[i])
    else:
        bob.append(a_list[i])
        
print(sum(alice)-sum(bob))

Measured memory_bytes: 9076
#py aa.py
#import pandas as pd
n,m = map(int,input().split())
a = []
for i in range(n+1):
	a.append(0)
for i in range(m):
	x,y = map(int,input().split())
	a[x] += 1
	a[y] += 1
ans = True
for i in range(n+1):
	if a[i]%2!=0:
		ans = False

if ans:
	print("YES")
else:
	print("NO")

#a,b = map(int,input().split())
#s = input()



Measured memory_bytes: 3928
module Main where

    import Debug.Trace
    import Text.Printf


    readLine:: IO (Char, Int, Int)
    readLine = do
            line <- getLine
            let [a,op,b] = words line
            return (head op, read a, read b)

    while :: (Char, Int, Int) -> IO ()
    while (op, a, b)
        | op == '?' = return ()
        | otherwise = do
            f op a b
            exp <- readLine
            while exp

    f :: Char -> Int -> Int -> IO ()
    f op a b = do
        print $ case op of
                '+' -> a + b
                '-' -> a - b
                '*' -> a * b
                '/' -> div a b

    main :: IO() 
    main = do
        exp <- readLine
        while exp
    


Measured memory_bytes: 4044
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

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

    int x,a,b;
    cin >> x >> a >>b;
    x -= a;
    x%=b;
    cout << x <<endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define max 100
#define inf 200000
#define BLACK 2
#define GRAY 1
#define WHITE 0

int w[max][max];;
int d[max];
int color[max];
int n;

void dijkstra(){
  int i,u,min,v;
  for(i=0;i<n;i++){
    color[i]=WHITE;
    d[i]=inf;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    min = inf;
    u=-1;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<min){
	u=i;
	min = d[i];
      }
    }
    if(u==-1)break;
    color[u] = BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && w[u][v]!=inf){
	if(d[v]>d[u]+w[u][v]){
	  d[v]=d[u]+w[u][v];
	  color[v]=GRAY;
	}
      }
    }
  }
}

int main(){
  int u,k,i,j,c,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      w[i][j]=inf;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      w[u][v]=c;
    }
  }
  dijkstra();
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]==inf ? -1:d[i]);
  }
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<sstream>

using namespace std;
typedef long long ll;
#define rep(i, x, y) for (ll (i)=(x); (i)<=(y); (i)++)
ll n;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(100);
    cin >> n;
    if (n < 1200)cout << "ABC";
    else if (n < 2800)cout << "ARC";
    else cout << "AGC";
    return 0;
}


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

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;

//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int h, m, s;
int second;

//function---------------------------------------------------------------------------------------------------------------------
int main() {
	while ( scanf( "%d %d %d", &h, &m, &s ) ) {
		if ( h == -1 && m == -1 && s == -1 ) {
			return 0;
		}
		second = 7200 - (h * 3600 + m * 60 + s);
		printf( "%02d:%02d:%02d\n", second / 3600, ( second % 3600 ) / 60, second % 60 );
		second *= 3;
		printf( "%02d:%02d:%02d\n", second / 3600, ( second % 3600 ) / 60, second % 60 );
	}
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <math.h>
#include <set>

typedef long long ll;

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

    std::set<int> A;
    int temp;
    for(int i=0;i<N;i++){
        std::cin >> temp;
        A.insert(temp);
    }

    if(N == A.size()){
        std::cout << "YES" << std::endl;
        return 0;
    }

    std::cout << "NO" << std::endl;

    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;

const long long MOD = 1000000007;
const long long B = 17777771;

int N;
string S;

template<typename T,T MOD,T B>
struct RollingHash{
  vector<T> hash,p;
  RollingHash(){}
  RollingHash(const string &s){
    int n=s.size();
    hash.assign(n+1,0);
    p.assign(n+1,1);
    for(int i=0;i<n;i++){
      hash[i+1]=(hash[i]*B+s[i])%MOD;
      p[i+1]=p[i]*B%MOD;
    }
  }
  //S[l, r)
  T find(int l,int r){
    T res=hash[r]+MOD-hash[l]*p[r-l]%MOD;
    return res>=MOD?res-MOD:res;
  }
};

bool isOk(int key, RollingHash<long long, MOD, B> r) {
  bool f = true;
  if(key == 0) {
    return f;
  }
  rep(i, N - key + 1) {
    string temp = S.substr(i, key);
    // cout << key << " " << temp << endl;
    int cnt = 0;
    for(int j = i+key; j < N - key + 1; j++) {
      if(r.find(j, j+key) == r.find(i, i + key)) {
        if(S.substr(j, key) == S.substr(i, key)) {
          cnt++;
          // cout << cnt << endl;
        }
      }
    }
    if(cnt >= 1) {
      f = false;
      break;
    }
  }
  return f;
}

int lower_search(RollingHash<long long, MOD, B> R) {
  int l = 0, r = N / 2 + 1;
  while(r - l > 1) {
    int half = (r + l) / 2;
    // cout << "half " << half << endl;
    if(isOk(half, R)) r = half;
    else l = half;
  }
  return r;
}

int main() {
  cin >> N >> S;
  RollingHash<long long, MOD, B> r(S);
  int ans = 0;
  ans = lower_search(r);
  cout << ans - 1 << endl;
  return 0;
}

Measured memory_bytes: 3828
N,K = map(int,input().split())
x = list(map(int,input().split()))

start = N
for i in range(N):#０より大きい最初のところをstartとする
    if x[i]>0:
        start = i
        break
x.insert(start,0)

ans = float("inf")
for i in range(0,K+1,1):#左側をいくつとるか
    j = K-i#右側はj個とることになる

    if 0 <= start-i and start+j<=N:
        tmpans = x[start+j]-x[start-i]+min(x[start+j],-x[start-i])
        ans = min(ans,tmpans)
print(ans)


Measured memory_bytes: 85588