akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := newIo()
	defer io.Flush()
	H, W := io.NextInt(), io.NextInt()
	Wall := make([][]int, H)
	for h := range Wall {
		Wall[h] = make([]int, W)
	}
	pointMap := make(map[int][][2]int) // point => [[from, to]]
	maxPoint := 0
	minPoint := 1000
	var C [10][10]int
	for from, line := range C {
		for to := range line {
			p := io.NextInt()
			_, exists := pointMap[p]
			if !exists {
				pointMap[p] = [][2]int{}
			}
			pointMap[p] = append(pointMap[p], [2]int{from, to})
			C[from][to] = p
			if p > maxPoint {
				maxPoint = p
			}
			if p < minPoint {
				minPoint = p
			}
		}
	}

	for h := range Wall {
		for w := range Wall[h] {
			Wall[h][w] = io.NextInt()
		}
	}
	// fmt.Println(C)
	for point := minPoint; point <= maxPoint; point++ {
		for _, route := range pointMap[point] {
			i, j := route[0], route[1]
			if point != C[i][j] {
				continue
			}
			for tj := range C[i] {
				tp := C[i][tj]
				newPoint := point + C[j][tj]
				if tp > newPoint {
					C[i][tj] = newPoint
					pointMap[newPoint] = append(pointMap[newPoint], [2]int{i, tj})
				}
			}

			for ti := range C {
				tp := C[ti][j]
				newPoint := C[ti][i] + point
				if tp > newPoint {
					C[ti][j] = newPoint
					pointMap[newPoint] = append(pointMap[newPoint], [2]int{ti, j})
				}
			}
		}
	}

	result := 0
	for h := range Wall {
		for _, point := range Wall[h] {
			if point == -1 {
				continue
			}
			result += C[point][1]
		}
	}
	fmt.Println(result)
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
const ll mod=1e9+7;

int main(){
  string s,t;
  cin>>s>>t;
  int a=s.size();
  int b=t.size();
  int ans=114514;
  rep(i,0,a-b+1){
    int cur=0;
    rep(j,0,b){
      if(s[i+j]!=t[j]) cur++;
    }
    ans=min(ans,cur);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3576
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    int num, a, b;
    cin >> num >> a >> b;
    int64_t ans = -1;
    // No Way!
    if(a>b) {
        ans = 0;
    } else if(a==b) {
        ans = 1;
    } else if(num == 1) {
        ans = 0;
    } else {
        int64_t mmin = (int64_t)a*(num-2);
        int64_t mmax = (int64_t)b*(num-2);
        ans = mmax - mmin + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
n = gets.chomp.to_i
xy = Array.new(n)
n.times do |i|
	xy[i] = gets.chomp.split.map(&:to_i)
end
aves = []
(0..n-1).to_a.permutation.each do |perm|
	ave = 0
	(n-1).times do |i|
		ave += Math.sqrt((xy[perm[i+1]][0] - xy[perm[i]][0]) ** 2 + (xy[perm[i+1]][1] - xy[perm[i]][1]) ** 2)
	end
	aves << ave 
end

puts aves.inject(:+) / aves.length



Measured memory_bytes: 15056
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, D;
    cin >> N >> D;
    vec d(N);
    readvec(d);
    int Q;
    cin >> Q;
    vec q(Q);
    readvec(q);

    vec pos(N);
    pos[N - 1] = 0;
    IFOR(i, 1, N){
        if(d[i] <= pos[i] + 1){
            pos[i - 1] = pos[i] + d[i];
        }else if(d[i] <= 2 * pos[i] + 1){
            pos[i - 1] = pos[i] + d[i];
        }else{
            pos[i - 1] = pos[i];
        }
    }


    vector<bool> ans(N, false);
    REP(i, N){
        //cout << D << " " << pos[i] << endl;
        if(D > pos[i]) ans[i] = true;
        if(d[i] < 2 * D) D = llabs(D - d[i]);
    }

    REP(i, Q){
        if(ans[q[i] - 1]){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

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

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

    int N; cin >> N;
    vector<int> a(N);
    int sum = 0;
    rep(i, N) {
        cin >> a[i];
        sum += a[i];
    }
    double avg = (double)sum / N;
    vector<int> idx(N);
    iota(idx.begin(), idx.end(), 0);
    sort(idx.begin(), idx.end(), [&](int x, int y) {
        if (a[x] == a[y])
            return x < y;
        return fabs(a[x]-avg) < fabs(a[y]-avg);
    });

    cout << idx[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  string S,T;
  cin >> S >> T;
  map<char,char> m1, m2;
  bool flag = true;
  for(int i = 0; i < S.size(); ++i){
    char s = S[i], t = T[i];
    if(m1.count(s)) if(m1[s] != t) flag = false;
    if(m2.count(t)) if(m2[t] != s) flag = false;
    m1[s] = t;
    m2[t] = s;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
}


Measured memory_bytes: 776
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int a,b,c;
		a = Integer.parseInt(scn.next());
		b = Integer.parseInt(scn.next());
		c = Integer.parseInt(scn.next());

		if(b-a == c-b){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
    }
}

Measured memory_bytes: 23508
//#include<iostream>
#include<cstring>
#include<cstdio>
//#include<math.h>
//#include<set>
//#include<queue>
//#include<bitset>
//#include<vector>
#include<algorithm>
#include<stdlib.h>
using namespace std;

#define LL long long
int qread()
{
	char c; int s=0,f=1; while ((c=getchar())<'0' || c>'9') (c=='-') && (f=-1);
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*f;
}

//Pay attention to '-' , LL and double of qread!!!!

int n,K;
#define maxn 100011
int a[maxn];

int main()
{
	n=qread(); K=qread();
	for (int i=1;i<=n;i++) a[i]=qread();
	int m=1;
	for (int i=1;i<=n;i++) if (a[i]<a[m]) m=i;
	int ans=1; while (ans*(K-1)+1<n) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int i,j;
	int h,w;

	while(1){
		scanf("%d %d", &h,&w);
		if(w==0 && h==0)
			break;
		for(i=0; i<h; i++){
			if(i==0 || i==h-1){
				for(j=0; j<w; j++){
					printf("#");
				}
			} else {
				printf("#");
				for(j=1; j<w-1; j++)
					printf(".");
				printf("#");
			}

			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
//
// Created by Huang,Zhiqiang on 2018/7/16.
//

#include <iostream>
#include <algorithm>
using namespace std;

int n;
int a[105];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 1; i < n; i++) {
        if (a[i] == a[i - 1]) {
            ans++;
            i++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,k; cin>>n>>k;
	int ans=0;
	string s; cin>>s;
	For(i,0,n-1){
		if(s[i]=='L' && i>0   && s[i-1]=='L') ans++;
		if(s[i]=='R' && i<n-1 && s[i+1]=='R') ans++;
	}
	cout<<min(n-1,ans+k*2)<<"\n";
	return 0;
}





























Measured memory_bytes: 512
n, m = gets.split(" ").map(&:to_i)
h_arr = [0] + gets.split(" ").map(&:to_i)

path_arr = []
m.times do
  a, b = gets.split(" ").map(&:to_i)

  path_arr[a] ||= []
  path_arr[a] << b
  path_arr[b] ||= []
  path_arr[b] << a
end
path_arr[n] ||= []

count = 0
path_arr.each_with_index do |arr, i|
  next if i == 0

  good = true
  height = h_arr[i]
  arr&.each do |ind|
    if height <= h_arr[ind]
      good = false 
      break
    end
  end

  count += 1 if good
end
puts count
  


Measured memory_bytes: 30260
#include <bits/stdc++.h>
using namespace std;
int min(int x, int n, vector<int> &P) { 
  int im = 0;
  int a = 0;
  int xa;
  while(1) {
    xa = x - im;
    for(int i = 0; i < n; i++) {
      if(xa == P.at(i)) {
        a = 1;
        break; }
      if(xa < P.at(i)) {
        a = 2;
        break; }
      a = 2;
    }
    if(a == 2) break;
    else im++;
  }
  return xa;
}

int pl(int x, int n, vector<int> &P) { 
  int im = 0;
  int a = 0;
  int xb;
  while(1) {
    xb = x + im;
    for(int i = n-1; i >= 0; i--) {
      if(xb == P.at(i)) {
        a = 1;
        break; }
      if(xb > P.at(i)) {
        a = 2;
        break; }
      a = 2;
    }
    if(a == 2) break;
    else im++;
  }
  return xb;
}



int main() {
  int x,n;
  cin >> x >> n;
  if (n == 0) cout << x << endl;
  else {
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p.at(i);
    sort(p.begin(), p.end());
    int a = min(x,n,p);
    int b = pl(x,n,p);
    if(x-a > b-x) cout << b << endl;
    else cout << a << endl;
  }
}


Measured memory_bytes: 3632
#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>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

int threemax(int a, int b, int c) {
	if (a >= b && a >= c) {
		return a;
	}
	else if (b >= a && b >= c) {
		return b;
	}
	else {
		return c;
	}
}

int threemin(int a, int b, int c) {
	if (a <= b && a <= c) {
		return a;
	}
	else if (b <= a && b <= c) {
		return b;
	}
	else {
		return c;
	}
}

void chmaxl(ll &a,ll b){
	if(a<b){
		a=b;
	}
	return;
}

void chminl(ll &a,ll b){
	if(a>b){
		a=b;
	}
	return;
}

void chmaxi(int &a,int b){
	if(a<b){
		a=b;
	}
	return;
}

void chmini(int &a,int b){
	if(a>b){
		a = b;
	}
	return;
}



int main() {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a;
}

Measured memory_bytes: 3636
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c&&a<=c)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}



Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
void solve()
{
    int n,l;
    cin>>n>>l;
    vector<string>v(n);
    rep0(i,n) cin>>v[i];
    sort(v.beg,v.en);
    rep0(i,n) cout<<v[i];
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3660
// aising2019_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int h, w, n;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << endl;
  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/arc068/tasks/arc068_b

from collections import Counter
n = int(input())
nums = [int(i) for i in input().split()]
c = Counter(nums)
even = 0
odd = 0
for v in c.values():
    if v % 2 == 0:
        even += 1
    else:
        odd += 1

ans = even + odd
if even % 2 == 1:
    ans -= 1
print(ans)

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

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

int n, m, k;
int a[10][10];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '#') {
        a[i][j] = 1;
      }
    }
  }
  int cnt = 0;
  for (int m1 = 0; m1 < (1 << n); m1++) {
    for (int m2 = 0; m2 < (1 << m); m2++) {
      int cur = 0;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (a[i][j] == 1 && !(m1 & (1 << i)) && !(m2 & (1 << j))) {
            cur++;
          }
        }
      }
      if (cur == k) {
        cnt++;
      }
    }
  }
  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;

#define _GLIBCXX_DEBUG
#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

void Add(ll &a, ll b){
    a=(a+b)%MOD;
    return;
}

void Pro(ll &a, ll b){
    a=(a*b)%MOD;
    return;
}

int main(){
    ll N,K; cin>>N>>K;
    vector<P> d;
    rep(i,K){
        ll x,y; cin>>x>>y; x--;
        d.pb(mp(x,y));
    }
    vec ans(N+1,0);
    ans[1]=1;
    REP(i,1,N){
        ll X=0;
        rep(j,K){
            ll p=max((ll)0,i-d[j].first), q=max((ll)0,i-d[j].second);
            Add(X,ans[p]);
            Add(X,MOD-ans[q]);
        }
        Add(X,ans[i]);
        ans[i+1]=X;
    }
    ll ANS=ans[N];
    Add(ANS,MOD-ans[N-1]);
    cout<<ANS<<endl;
}


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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N, M;
  cin >> N >> M;

  // 解答
  cout << (pow(2, M) * M * 1900 + pow(2, M) * (N - M) * 100) << endl;

  return 0;
}


Measured memory_bytes: 256
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
num = 1
begin = 0
for j in range(100000):
    for i in range(begin + 1,N):
        wait = T[i] - T[begin]
        if wait > K or i - begin + 1> C:
            num += 1
            begin = i
            break
    else:
        break
print(num)

Measured memory_bytes: 7420
#include <bits/stdc++.h>
#define INF (1<<30)
#define INFLL (1ll<<60)
using namespace std;
map <int,int> mp;
typedef pair<int, int> P;
typedef long long ll;
static const int MAX=100000;
int N,x,cunt[MAX+1],X[MAX+1],max_p;
int a[3]={-1,0,1};
int main(){
    cin>>N;
    vector<int>V[N];
    
    for(int i=1;i<=N;i++){
        cin>>x;
        for(int j=0;j<3;j++)
            mp[x+a[j]]++;
    }
    
    for(auto p:mp){
        max_p=max(max_p,p.second);
    }

    cout<<max_p<<"\n";

    return 0;
}


Measured memory_bytes: 7168
#include<iostream>
using namespace std;
int main()
{
	int cnm,y,z;
	cin>>cnm>>y>>z;
	for(int i=0;i<=1000;i++)
	if(i*cnm%y==z)
{
    cout<<"YES"<<endl;
    return 0;
}
	cout<<"NO"<<endl;
	return 0;	
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<long long> a;
  long long x,ans=1;
  bool flag1=0,flag2=0;
  for(int i=0;i<n;i++){
    cin>>x;
    a.push_back(x);
  }
  sort(a.begin(),a.end());
  for(int i=n-1;i>0;i--){
    if(a[i]==a[i-1]){
      ans*=a[i];
      i--;
      if(flag1){
        flag2=1;
        break;
      }else{
        flag1=1;
      }
    }
  }
  if(flag1&flag2){
    cout<<ans<<endl;
  }else{
    cout<<0<<endl;
  }
  return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <vector>
using namespace std;
int main(void){
    int N;
    int p;
    scanf("%d",&N);
    vector<int> list(N);
    for(int i=0;i<N;i++)
    {
        scanf("%d",&p);
        list[p-1]=i+1;
    }
    for(int i=0;i<N-1;i++)
    {
        printf("%d",list[i]);
        printf(" ");
    }
    printf("%d",list[N-1]);

   return 0;
}

Measured memory_bytes: 1152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String S = in.next();
            out.println(S + (S.charAt(S.length() - 1) == 's' ? "es" : "s"));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 37300
import java.util.Scanner;

public class Main {
  static Scanner sc = new Scanner(System.in);
  static final long MOD = 1_000_000_007;

  public static void main(String[] args) {
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    long[] fact = new long[N + 1];
    fact[0] = 1;
    for (int i = 0; i < N; i++) {
      fact[i + 1] = (i + 1) * fact[i] % MOD;
    }
    long[][][] dp = new long[N + 1][N + 1][256];
    dp[0][0][0] = 1;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= i; j++) {
        for (int k = 0; k < 256; k++) {
          dp[i + 1][j + 1][k] += dp[i][j][k ^ A[i]];
          dp[i + 1][j + 1][k] %= MOD;
          dp[i + 1][j][k] += dp[i][j][k];
          dp[i + 1][j][k] %= MOD;
        }
      }
    }
    long ans = 0;
    for (int i = 0; i <= N; i++) {
      ans += dp[N][i][K] * fact[i] % MOD;
      ans %= MOD;
    }
    System.out.println(ans);
  }

}


Measured memory_bytes: 44460
#include<stdio.h>
int main()
{
    int a,b,c,flag=0;
    scanf("%d %d %d",&a,&b,&c);
    while(1)
    {
        if(a<b && c<b || a==c && a!=b && b!=c && a<b && c<b)
        {
            a=a+1;
            c=c+1;
            flag++;
        }
        else if(a<c && b<c || a==b && a!=c && b!=c && a<c && b<c)
        {
            a=a+1;
            b=b+1;
            flag++;
        }
        else if(b<a && c<a || b==c && b!=a && c!=a && b<a && c<a)
        {
            b=b+1;
            c=c+1;
            flag++;
        }
        if(a<b && a<c)
        {
            a=a+2;
            flag++;
        }
        else if(b<a && b<c)
        {
           b=b+2;
           flag++;
        }
        else if(c<a && c<b)
        {
            c=c+2;
            flag++;
        }
        if(a==b && b==c && c==a)
        {
            break;
        }
    }
    printf("%d",flag);

    return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<double> dp(n + 1);
    dp[0] = 1;
    for (int i = 0; i < n; ++i) {
        double p_head;
        cin >> p_head;
        for (int j = i + 1; j >= 0; --j) {
            dp[j] = (j == 0 ? 0 : dp[j - 1] * p_head) + dp[j] * (1 - p_head);
        }
    }
    double answer = 0;
    for (int heads = 0; heads <= n; ++heads) {
        if (heads > n - heads)answer += dp[heads];
    }
    printf("%.10lf", answer);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}


int main(){
  ll ans=0;
  cin >> k;
  REP(i,k){
    REP(j,k){
      REP(h,k){
        ans+=gcd(gcd(i+1,j+1),h+1);
      }
    }
  }


  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
import sys
input = sys.stdin.readline

def main():
    while True:
        N = int(input())
        if N == 0:
            return
        W, H = map(int, input().split())
        board = [[0] * (W+1) for i in range(H+1)]
        for i in range(N):
            x, y = map(int, input().split())
            board[y][x] = 1
        for i in range(1, H+1):
            for j in range(W+1):
                board[i][j] += board[i-1][j]
        for j in range(1, W+1):
            for i in range(H+1):
                board[i][j] += board[i][j-1]
        S, T = map(int, input().split())
        ans = 0
        for y in range(1, H-T+2):
            for x in range(1, W-S+2):
                tx = x + S - 1
                ty = y + T - 1
                ans = max(ans, board[ty][tx] - board[ty][x-1] - board[y-1][tx] + board[y-1][x-1])
        print(ans)
        # for i in range(H):
        #     print(board[i])


if __name__ == "__main__":
    main()


Measured memory_bytes: 5792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n,m;
    cin>>n>>m;

    long long int result=0;

    long long int use_s = min(n, m / 2);
    result += use_s;
    m -= use_s * 2;
    long long int no_use_s = m / 4;
    result += no_use_s;

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+7;
int main()
{
  int h,n;
  cin>>h>>n;
  vector<int> dp(h+1,INF);
  dp[0]=0;
  for(int i=0;i<n;i++){
   int cost,value; 
   cin>>value>>cost;
   for(int j=0;j<=h;j++){
     int curr=min(h,j+value);
     dp[curr]=min(dp[j]+cost,dp[curr]);
   }  
  }
  cout<<dp[h];
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll X;
  cin >> X;
  ll n = sqrt(X);
  ll Y = 0;
  while(Y < 2*X){
    Y = n * (n+1);
    n++;
  }
  cout << n - 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int A, B;

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

  cin >> A >> B;

  int ans = 0;
  for (int i = 0; i <= 20; ++i) {
    if (i * (A-1) + 1 >= B) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second

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

    vector<ll> dp(n,100000002);
    dp.at(0)=0;

    for(ll i=1;i < n;i++)
    {   dp.at(i)=abs(h.at(i)-h.at(i-1))+dp.at(i-1);
        
        for(ll j=2;j <= k;j++)//最大ｋ飛べる
        {
            if(i-j>=0){
                dp.at(i)=min(abs(h.at(i)-h.at(i-j))+dp.at(i-j),dp.at(i));
            }
        }
    }
    cout << dp.at(n-1) << endl;
}

Measured memory_bytes: 1920
from collections import defaultdict as ddict
N, C = map(int, input().split())
imos = [0] * (10**5 + 2)
last_s_by_c = ddict(lambda: 1)
last_t_by_c = ddict(int)
stc = [list(map(int, input().split())) for i in range(N)]
for s, t, c in sorted(stc, key=lambda x: x[1]):
	if last_t_by_c[c] != s:
		imos[last_s_by_c[c] - 1] += 1
		imos[last_t_by_c[c]] -= 1
		last_s_by_c[c] = s
	last_t_by_c[c] = t
for c in last_s_by_c:
	imos[last_s_by_c[c] - 1] += 1
	imos[last_t_by_c[c]] -= 1
for i in range(10**5 + 1):
	imos[i + 1] += imos[i]
print(max(imos))

Measured memory_bytes: 31128
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        a: i32, b: i32,
    }
    let ma = max(max(a + b, a - b), a * b);
    puts!("{}\n", ma);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <stdio.h>
 
int main(void){
  int amat[128][128],bmat[128],cmat[128];
  int n,m,i,j;
 
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++)  scanf("%d",&amat[i][j]);
  }
  for(i=0;i<m;i++)  scanf("%d",&bmat[i]);
  for(i=0;i<n;i++)  cmat[i]=0;
 
  for(i=0;i<n;i++){
    for(j=0;j<m;j++)  cmat[i]+=amat[i][j]*bmat[j];
  }
 
  for(i=0;i<n;i++)  printf("%d\n",cmat[i]);
 
  return 0;
}

Measured memory_bytes: 656
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>

class TaskB {
public:
	void solve(std::istream& in, std::ostream& out) {
	int n,k; in>>n>>k;
		int arr[n];
		int res=0;
		for (int i = 0; i < n; ++i) {
			in>>arr[i];
			res+=2*std::min(arr[i],k-arr[i]);
		}
		out<<res;
	}
};


int main() {
	TaskB solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main {
    public static void main (String args[]) throws IOException {
	InputStreamReader is = new InputStreamReader(System.in);
	BufferedReader br = new BufferedReader(is);

	int tall[] = new int[10];
	int high[] = new int[3];
	int n = 0;
	
	for (int i=0; i<10; i++) {
	    tall[i] = Integer.parseInt(br.readLine());
	}
	
	for (int i=0; i<3; i++) {
	    for (int j=0; j<10; j++) {
		if (high[i] < tall[j]) {
		    high[i] = tall[j];
		    n = j;
		}
	    }
	    tall[n] = 0;
	}
	
        for (int i=0; i<3; i++) {
	    System.out.println(high[i]);
	}
	
    }
}

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

int main()
{
	vector<int> x( 5 );
	for( int i = 0; i < 5; i++ ) {
		cin >> x[i];
	}

	int ans;
	for( int i = 0; i < 5; i++ ) {
		if( x[i] == 0 ) ans = i +1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3544
#include<stdio.h>
int main()
{
    int n,i,a[200000],mx1=0,mx2=0;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>mx2)
        {
            if(a[i]>mx1)
            {
                mx2=mx1;
                mx1=a[i];
            }
            else
                mx2=a[i];
        }
    }
    for(i=0; i<n; i++)
        if(a[i]==mx1)
            printf("%d\n",mx2);
        else
            printf("%d\n",mx1);
    return 0;
}


Measured memory_bytes: 2304
#include "bits/stdc++.h"

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);


int main(){
  int a, b;
  cin >> a >> b;
  DEBUG(a); DEBUG(b);
  vi c(10, 1);
  DEBUG_VEC(c);
  cout << max(a - b, max(a + b, a * b)) << endl;
}


Measured memory_bytes: 256
import java.io.*;
public class Main {
		public static void main(String[] arg) throws IOException {
			InputStreamReader is = new InputStreamReader(System.in); 
	        BufferedReader br = new BufferedReader(is);
			String str = br.readLine();
			String[] spl = str.split(" ");
			if(Integer.parseInt(spl[0]) < Integer.parseInt(spl[1]) && Integer.parseInt(spl[1]) < Integer.parseInt(spl[2])){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

}

Measured memory_bytes: 24340
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var n = Console.ReadLine();

        if(n[0] == n[2])
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())

    ac_check = [False] * N
    p_counts = [0] * N

    for i in range(M):
        p, s = input().strip().split()
        p = int(p) - 1
        if s == "AC":
            if not ac_check[p]:
                ac_check[p] = True
        else:
            if not ac_check[p]:# まだ正解していないならペナルティ追加
                p_counts[p] += 1

    ac_count = 0
    p_count = 0
    for i in range(N):
        if ac_check[i]:# 正解している問題のみ考慮
            ac_count += 1
            p_count += p_counts[i]
    print(ac_count, p_count)


if __name__ == "__main__":
    main()

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

typedef long long ll;

#define v(T) vector<T>
#define ttt(T) tuple<T, T, T>
#define pb push_back
#define mp make_pair
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define poiu(n) for(int i=0; i < n; i++)
#define MOD 1000000007
#define endl '\n'

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;

int n;


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

    string s;
    cin >> s;

    bool found = false;
    if(s[3]!=s[2])
        found = true;
    if(s[4]!=s[5])
        found = true;
    if(found)
        cout << "No";
    else
        cout << "Yes";

    


    return 0;

}



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

using namespace std;
using ll = long long;

int main() {
	const ll MOD = 1e9 + 7;
	ll N, M;
	cin >> N >> M;
	vector<ll> a(M);
	for (int i = 0; i < M; ++i) { cin >> a[i]; }

	vector<ll> v(N + 1, 0);
	v[0] = 1;
	for (int i = 0; i < M; ++i) {
		v[a[i]] = -1;
	}

	for (int i = 0; i < N; ++i) {
		if (v[i] < 0) { continue; }
		if (i + 1 <= N && v[i+1] >= 0) { (v[i + 1] += v[i]) %= MOD; }
		if (i + 2 <= N && v[i+2] >= 0) { (v[i + 2] += v[i]) %= MOD; }
	}

	cout << v[N] % MOD << endl;

	return 0;
}


Measured memory_bytes: 1792
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(void) {
  int n;
  cin >> n;
  ll k;
  cin >> k;
  vector<P> v(n);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    v[i].first = a;
    v[i].second = b;
  }

  sort(v.begin(), v.end());

  for (int i = 0; i < v.size(); ++i) {
    k -= v[i].second;
    if (k <= 0) {
      cout << v[i].first << endl;
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 4052
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    n = NI()
    a = LI()
    ans = INF
    for s in (1,-1):
        acc = 0
        cnt = 0
        x = s
        for i in range(n):
            acc += a[i]
            if acc * x <= 0:
                cnt += abs(x-acc)
                acc = x
            x = -x
        ans = min(ans,cnt)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 61288
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<vector<bool>> a(N+1,vector<bool>(N+1));
    vector<int> avl(N+1,0);
    vector<int> nd(N+1,0);
    vector<int> nd2(N+1,0);
    bool svb = false;
    for(int i=1;i<=N;++i){
        for(int j=1;j<=N;++j){
            char c;
            cin >> c;
            if(c == '#') {
                a[i][j] = true;svb=true;
                avl[j] = 1;
            }
            else {
                a[i][j] = false;
                ++nd[i];
                nd2[j] = 1;
            }
        }
    }
    for(int i=1;i<=N;++i){
        if(!a[i][i] && nd[i] < N && avl[i] == 0) avl[i] = 2; 
    }
    if(!svb){cout << -1 << endl; return 0;}
    int res = 1000000009;
    int i=1;
    for(;i<=N;++i){
        if(avl[i]) res = min(res,nd[i]+avl[i]-1);
        if(nd[i] == 0) break; 
    }
    
    for(int j=1;j<=N;++j){
        res += (nd2[j]==0?0:1);
    }
    cout << res << endl;
}

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

int digit(int N){
  int i,j,k;
    i=N%10;
    j=(N/10)%10;
    if(i != j) return 0;
    k=(N/100)%10;
    if(i != k) return 0;
    return 1;
}
int main(){
  int i,N;
  cin >> N;
  for(i=N;i<1000;i++){
    if(digit(i)==1) break;
  }
  cout << i;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int A, B, Diff, A2, B2;
    
    scanf("%d %d", &A, &B);
    
    Diff = B-A;
    
    B2 = (1+Diff)*Diff/2;
    //A = B-Diff;
  
    printf("%d\n", B2-B);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	if (n <= 111)cout << 111;
	else if (n <= 222)cout << 222;
	else if (n <= 333)cout << 333;
	else if (n <= 444)cout << 444;
	else if (n <= 555)cout << 555;
	else if (n <= 666)cout << 666;
	else if (n <= 777)cout << 777;
	else if (n <= 888)cout << 888;
	else cout << 999;
	cout << endl;
}

Measured memory_bytes: 256
#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 ;


void solve(){
    string s;
    cin>>s;
    string ans="";
    int cnt=0;
    vector<vector<char> > v(10);
    v[1]={'.',',','!','?',' '};
    v[2]={'a','b','c'};
    v[3]={'d','e','f'};
    v[4]={'g','h','i'};
    v[5]={'j','k','l'};
    v[6]={'m','n','o'};
    v[7]={'p','q','r','s'};
    v[8]={'t','u','v'};
    v[9]={'w','x','y','z'};
    rep(i,s.size()){
        if(s[i]!='0')++cnt;
        else {
            if(cnt==0)continue;
            ans+=v[s[i-1]-'0'][(cnt-1)%v[s[i-1]-'0'].size()];
            cnt=0;
        }
    }
    cout<<ans<<endl;
}
int main(){
    int n;
    cin>>n;
    rep(i,n)solve();
    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define Data_Nerd ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define files freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;
using ll = long long;

const int N = 1e5 + 1;

int a[N], b[N];

int main() {
	Data_Nerd
	int n; scanf("%d", &n);

	for(int i = 0; i <= n; ++i) {
		scanf("%d", a + i);
	}

	for(int i = 0; i < n; ++i)
		scanf("%d", b + i);

	ll ans = 0;

	for(int i = n - 1; i >= 0; --i) {
		int before = b[i];

		int temp = min(a[i + 1], b[i]);

		a[i + 1] -= temp;
		b[i] -= temp;

		int temp_2 = min(a[i], b[i]);

		a[i] -= temp_2;
		b[i] -= temp_2;

		ans += before - b[i];
	}

	cout << ans;
}


Measured memory_bytes: 1024
num_of_switch,num_of_denkyu = map(int,input().split())

denkyu_switch_connection = []
for denkyu in range(num_of_denkyu):
    denkyu_switch_connection.append(list(map(lambda x:int(x)-1,input().split())))
    del denkyu_switch_connection[denkyu][0]

surplus = list(map(int,input().split()))


ans=0
for pattern in range(2**num_of_switch):#スイッチのオンオフを全ての通り＝（2のスイッチの数乗）通り考える
    denkyu_True_or_False=[False for _ in range(num_of_denkyu)]#電球がそれぞれ点灯するかどうか
    switch_on_off = list(map(int,list(str(bin(pattern)).replace("0b","").zfill(num_of_switch))))#スイッチのonoff
    
    for i in range(num_of_denkyu):#電球
        count=0#電球iに繋がっているスイッチのうち、オンのものの数
        for j in range(len(denkyu_switch_connection[i])):#電球iに繋がっているスイッチ
            if switch_on_off[denkyu_switch_connection[i][j]]==1:#電球iに繋がっているスイッチijがonのとき
                count += 1
        
        if count%2 == surplus[i]:
            denkyu_True_or_False[i]=True
        else:break

    if False not in denkyu_True_or_False:#電球がすべてオンの時
        ans+=1
print(ans)


Measured memory_bytes: 3064