akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>


#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::pair<ll, ll> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;


int main()
{
    ll n;
    cin >> n;
    int flag = 1;
    rep(i, n){
        ll t, x, y;
        cin >> t >> x >>y;
        if(t < x+y) flag *= 0;
        else{
            int d1 = t % 2;
            int d2 = (x+y) % 2;
            if(d1 != d2) flag *= 0;
        }
    }
    if(flag == 1) cout << "Yes";
    else cout << "No";
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30

using namespace std;
typedef long long ll;

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

    rep(q,n) {

        string s;
        cin >> s;

        int ans = 0;

        while(s.size() != 1) {
            int res = -INF;
            rep(i,s.size()) {
                if(i == 0) continue;
                
                stringstream ss;
                rep(j,i) ss << s[j];

                int a;
                ss >> a;

                stringstream ss2;
                REP(j,i,s.size()) ss2 << s[j];

                int b;
                ss2 >> b;

                // cout << a << " " << b << endl;

                if(res < a*b) {
                    res = a*b;
                }
            }

            stringstream ret;
            ret << res;
            s = ret.str();
            ans++;
        }

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

Measured memory_bytes: 1232
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}






int main(){
    int N, M; std::cin >> N >> M;
    std::vector<int> P(M), Y(M);
    std::vector<std::vector<int>> vals(N);
    for(int i(0); i < M; ++i){
        std::cin >> P[i] >> Y[i];
        --P[i];
        vals[P[i]].push_back(Y[i]);
    }
    for(int i(0); i < N; ++i){
        std::sort(std::begin(vals[i]), std::end(vals[i]));
        vals[i].erase(std::unique(std::begin(vals[i]), std::end(vals[i])), std::end(vals[i]));
    }
    for(int i(0); i < M; ++i){
        int v(P[i]);
        std::cout << std::setfill('0');
        std::cout << std::setw(6) << v + 1;

        int id(std::lower_bound(std::begin(vals[v]), std::end(vals[v]), Y[i]) - std::begin(vals[v]));
        std::cout << std::setw(6) << id + 1 << std::endl;
    }
    return 0;
}


Measured memory_bytes: 7808
import math

def count_index(list, k):
    count = 0
    for i in range(k):
        if (list[i] < list[k]):
            count = count + 1
    return list[k]-count-1

n = int(input())-1
p = list(map(int,input().split()))
q = list(map(int,input().split()))

a = (p[0]-1) * math.factorial(n)+1
b = (q[0]-1) * math.factorial(n)+1

for i in range(1,n):
    a = a + count_index(p, i) * math.factorial(n-i)
    b = b + count_index(q, i) * math.factorial(n-i)

ans = a-b
print(abs(ans))

Measured memory_bytes: 3064
while True:
  try:
    c1, c2, c3 = map(int, input().split())
    lst = [i for i in range(1,11) if i not in (c1, c2, c3) and i + c1 + c2 <= 20]
    if len(lst) >= 4:
      print("YES")
    else:
      print("NO")

  except EOFError:
    break


Measured memory_bytes: 5596
import Control.Applicative
import Data.Function
import Control.Monad
import Data.List
import Data.Char
import Text.Printf

type Dice = [Int]

rotate :: String -> Dice -> Dice
rotate [] dice = dice
rotate ('W':xs) [a,b,c,d,e,f] = rotate xs [c,b,f,a,e,d]
rotate ('E':xs) [a,b,c,d,e,f] = rotate xs [d,b,a,f,e,c]
rotate ('S':xs) [a,b,c,d,e,f] = rotate xs [e,a,c,d,f,b]
rotate ('N':xs) [a,b,c,d,e,f] = rotate xs [b,f,c,d,a,e]

main :: IO ()
main = do
    d <- map read . words <$> getLine
    c <- getLine
    putStrLn . show $ head $ rotate c d


Measured memory_bytes: 3688
n=int(input())
l=list(map(int,input().split()))
if len(set(l))==1:print(1);exit()
from itertools import groupby as gb
l=[a for a,b in gb(l)]
ans=1
now=0  if l[0]<l[1] else 1
pre=l[0]
n=len(l)
for i in range(n):
    if pre<l[i] and now:
        if i==n-1:print(ans+1);exit()
        else:
            now=0  if l[i]<l[i+1] else 1
            ans+=1
    elif pre>l[i] and 1-now:
        if i==n-1:print(ans+1);exit()
        else:
            now=0  if l[i]<l[i+1] else 1
            ans+=1
    pre=l[i]
print(ans)

Measured memory_bytes: 14736
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
 
int main() {
    int n; cin >> n;
    vector<double> x(n);
    vector<string> u(n);
    rep(i, n) cin >> x[i] >> u[i];

    double ans = 0;
    rep(i, n) {
        if (u[i] == "JPY") {
            ans += x[i];
        }
        else {
            ans += 380000.0 * x[i];
        }
    }

    printf("%.6f\n", ans);

}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const BIT = 60

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()
	next := make([][]int, BIT)
	for i := 0; i < BIT; i++ {
		next[i] = make([]int, N)
	}
	for i := 0; i < N; i++ {
		next[0][i] = getInt() - 1
	}

	for i := 0; i < BIT-1; i++ {
		for j := 0; j < N; j++ {
			next[i+1][j] = next[i][next[i][j]]
		}
	}

	pos := 0
	for i := BIT - 1; i >= 0; i-- {
		l := 1 << uint(i)
		if l <= K {
			// out(l, K, pos)
			K -= l
			pos = next[i][pos]
		}
	}
	out(pos + 1)
}


Measured memory_bytes: 100264
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}
template <class Con>
string concat(const Con &c, const string &spr){
	stringstream ss;
	typename Con::const_iterator it = c.begin(), en = c.end();
	bool fst = true;
	for(; it != en; ++it){
		if(!fst){ ss << spr; }
		fst = false;
		ss << *it;
	}
	return ss.str();
}

template <class Con, class Fun>
vector<typename Con::value_type> cfilter(const Con &c, Fun f) {
	vector<typename Con::value_type> ret;
	typename Con::const_iterator it = c.begin(), en = c.end();
	for(; it != en; ++it){
		if(f(*it)){
			ret.emplace_back(*it);
		}
	}
	return ret;
}
#if __cplusplus >= 201103L
template <class Con, class Fun>
auto cmap(const Con &c, Fun f) -> vector<decltype(f(*c.begin()))> {
	vector<decltype(f(*c.begin()))> ret;
	ret.reserve(c.size());
	for(const auto &x: c){
		ret.emplace_back(f(x));
	}
	return ret;
}
#endif


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()
#define tget(t,i) get<i>(t)

#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	cin >> n;
	bool f = false;
	int c = 0;
	for(int i = 0; i < n; ++i){
		int x, y;
		cin >> x >> y;
		if(x == y){ ++c; }
		else{ c = 0; }
		f |= c >= 3;
	}
	cout << (f ? "Yes\n" : "No\n");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(const exception &e){
	cerr << "exception: " << e.what() << endl;
	abort();
}
catch(...){
	cerr << "exception" << endl;
	abort();
}


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

int main() {
  int a, b, c, x, cnt = 0;
  cin >> a >> b >> c >> x;
  REP(i, a + 1) REP(j, b + 1) REP(k, c + 1) {
    if (500 * i + 100 * j + 50 * k == x) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 10000
 // 1 mean prime 0 not 
//prime number: 2,3,5,7
int isprime(int target){
    if(target%2==0){
        return 0;
    }
    for(int i = 3; i*i<=target; i++){
        if(target%i==0) {
            return 0;
        } 
    }

    return 1;
}

int main()
{
    int n = 0;
    scanf("%d",&n);
    
    int res = 0;
    int index;
    for(int i = 0; i<n; i++){
        scanf("%d",&index);
        if(isprime(index)) res++;
        if(index==2) res++;
    }
    printf("%d\n",res);
    return 0;
}



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

#define deb(var) "[" << (#var) << " : " << var <<"]" << " "
#define debv(v) "[" << (#v) << " : {";for(int i = 0; i < v.size() - 1; ++i)\
					cout << v[i] <<", ";cout << v.back() << "}] "
#define deba(a,n) "[" << (#a) << " : {";for(int i = 0; i < n - 1; ++i)\
					cout << a[i] << ", ";cout << a[n - 1] << "}] "
#define debp(p) "[" << (#p) << " : {" << p.first << ", " << p.second << "}] "
#define debs(s) "[" << (#s) << " : {";auto _itr = s.begin();\
					for(int k = s.size(); k > 1; --k) {cout << *_itr << ", "; ++_itr;} cout << *_itr << "}] "

typedef long long ll;

/*LETS BEGIN WITH THE NAME OF LORD MAHADEV*/
const int mxN = 2e5;
int ar[mxN];
bool dp[1000001];
int cnt[1000001];

int main(){
	int n, mx = -2e9; 
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> ar[i];
		cnt[ar[i]]++;
		mx = max(mx, ar[i]);
	}
	memset(dp, true, sizeof(dp));
	
	for(int i = 0; i < n; ++i){
		if(dp[ar[i]]){
			for(int j = 2 * ar[i]; j <= mx; j += ar[i]){
				dp[j] = false;
			}
		}
	}

	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(dp[ar[i]] && cnt[ar[i]] == 1){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;


#define MAX_N 1000005

int M,N;

int A[55][55];
int B[55][55];

char st[55];

int main(){
	cin>>N>>M;

	for(int i=1;i<=N;++i){
		cin>>st;
		for(int j=1;j<=N;++j){
			A[i][j]=st[j-1]=='#'?1:0;
		}
	}
	for(int i=1;i<=M;++i){
		cin>>st;
		for(int j=1;j<=M;++j){
			B[i][j]=st[j-1]=='#'?1:0;
		}
	}
	//bool jizz=false;
	for(int i=1;i<=N && i+M-1<=N;++i){
		for(int j=1;j<=N && j+M-1<=N;++j){
			bool tmp=true;
			for(int k=1;k<=M;++k){
				for(int l=1;l<=M;++l){
					if(A[i+k-1][j+l-1]!=B[k][l]){
						tmp=false;
						break;
					}
				}
				if(!tmp)break;
			}
			if(tmp){
				puts("Yes");
				return 0;
			}
		}
		//if(jizz)break;
	}

	puts("No");

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int n ;
  cin >> n;
  int m = 100000;
  rep(i,n){
    m *= 1.05;
    if((int)m % 1000 != 0)
      m = m - (int) m % 1000 + 1000;
  }
  cout << m << endl;
}

Measured memory_bytes: 1160
n, m = map(int, input().split())
list1 = []
list2 = []
result = []
for i in range(n):
    a, b = map(int, input().split())
    list_ab = [a,b]
    list1.append(list_ab)
for i in range(m):
    c, d = map(int, input().split())
    list_cd = [c,d]
    list2.append(list_cd)
for i in range(n):
    for j in range(m):
        ab = abs(list1[i][0]-list2[j][0])+abs(list1[i][1]-list2[j][1]) 
        result.append(ab)
        num = result.index(min(result))
    print(num+1)
    result = []

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <bitset>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

int main() {
  size_t n;
  scanf("%zu", &n);

  intmax_t x = 0;
  std::vector<intmax_t> a(n);
  for (auto& ai: a) {
    scanf("%jd", &ai);
    x ^= ai;
  }

  constexpr size_t m = 61;
  std::vector<intmax_t> bs(n);
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < m; ++j) {
      if (x >> j & 1) continue;
      bs[i] |= (a[i] >> j & 1) << j;
    }
  }

  {
    size_t i = 0;
    for (size_t j = m; j--;) {
      if (i >= n) break;
      for (size_t k = i; k < n; ++k) {
        if (~bs[k] >> j & 1) continue;
        std::swap(bs[i], bs[k]);
        break;
      }
      if (~bs[i] >> j & 1) continue;
      for (size_t k = 0; k < n; ++k) {
        if (k == i) continue;
        if (bs[k] >> j & 1) bs[k] ^= bs[i];
      }
      ++i;
    }
  }

  intmax_t y = 0;
  for (auto b: bs) y ^= b;
  printf("%jd\n", y*2+x);
}


Measured memory_bytes: 1920
# AOJ 0049: Blood Groups
# Python3 2018.6.14 bal4u

blood = ["A","B","AB","O"]
cnt = [0]*4

while True:
	try:
		k, b = list(input().split(','))
	except EOFError:
		break
		
	cnt[blood.index(b)] += 1
print(*cnt, sep='\n')



Measured memory_bytes: 5556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;

int main(){
    ll N, M; cin >> N >> M; 
    ll SUM = 0;
    vector<ll> A(N); for(int i = 0; i < N; i++){
        cin >> A[i];
        SUM += A[i];
    }
    ll cr = ceil((double)SUM / (double)(4*M));
    sort(A.rbegin(), A.rend());
    if(A[M-1] < cr) cout << "No" << endl;
    else cout << "Yes" << endl;

}

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

using namespace std;

int val[501], X[501], Y[501], Z[501];

int main(void){
  int n;
  cin >> n;
  for(int i = 1; i < n; ++i){
    cin >> X[i] >> Y[i] >> Z[i];
  }
  for(int i = 1; i <= n; ++i){
    long t = Y[i] + X[i];
    for(int j = i + 1; j < n; ++j){
      if(t > Y[j]){
        t -= Y[j];
        if(t % Z[j]){
          t /= Z[j];
          t++;
          t *= Z[j];
        }
        t += Y[j];
      }else{
        t = Y[j];
      }
      t += X[j];
    }
    cout << t << "\n";
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		if ((N * A) > B) {
			System.out.println(B);	
		} else {
			System.out.println((N * A));
		}

		sc.close();
	}
}

Measured memory_bytes: 24020
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Closeable;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

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

    static class AAbcOfABC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String S = in.next();
            if (S.contains("a") && S.contains("b") && S.contains("c")) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastScanner implements Closeable {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public void close() {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}



Measured memory_bytes: 22868
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main()
{
	string tapdance;
	cin >> tapdance;

	for (int i = 0; i < tapdance.size(); ++i)
	{
		if((i%2==0&&tapdance.at(i)=='L')
			|| (i % 2 == 1 && tapdance.at(i) == 'R'))
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e9
using namespace std;
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
int dy[2] = {0, 1};
int dx[2] = {1, 0};
char mp[50][50], pm[50][50], d[50][50];
int h, w, n;

void del() {
  rep(i, 50) rep(j, 50) d[i][j] = '$';

  //落とす作業
  for (int j = 0; j < w; j++) {
    for (int i = h - 1; i >= 1; i--) {
      int cnt = 0;
      if (pm[i][j] == '.') {
        while (pm[i - cnt][j] == '.' && i - cnt >= 0) cnt++;
        if (i - cnt >= 0) swap(pm[i][j], pm[i - cnt][j]);
      }
    }
  }
  //消す部分を見つける
  rep(i, h) rep(j, w) {
    if (pm[i][j] == '.') continue;
    int posx = j, posy = i;
    int cnt = 0;
    //横方向
    while (posx < w && pm[i][j] == pm[i][posx]) cnt++, posx++;
    if (cnt >= n)
      for (int jj = j; jj < posx; jj++) d[i][jj] = '.';

    cnt = 0;
    //たて方向
    while (posy < h && pm[i][j] == pm[posy][j]) cnt++, posy++;
    if (cnt >= n)
      for (int ii = i; ii < posy; ii++) d[ii][j] = '.';
  }
  //消す
  bool cflag = false;
  rep(i, h) rep(j, w) if (d[i][j] == '.') pm[i][j] = '.', cflag = true;

  //  debug
  // cout << "debug" << endl;
  // rep(i, h) {
  //   rep(j, w) cout << d[i][j];
  //   cout << ' ';
  //   rep(j, w) cout << pm[i][j];
  //   cout << endl;
  // }
  // cout << endl;

  if (cflag)
    del();
  else
    return;
}

bool check() {
  rep(i, h) rep(j, w) if (pm[i][j] != '.') return false;
  return true;
}

signed main() {
  cin >> h >> w >> n;
  rep(i, h) rep(j, w) cin >> mp[i][j];
  bool flag = false;

  rep(i, h) rep(j, w - 1) {
    rep(k, h) rep(l, w) pm[k][l] = mp[k][l];

    swap(pm[i][j], pm[i][j + 1]);

    del();

    // cout << "final state" << ' ' << "x=" << j << ' ' << "x+1=" << j + 1 << endl;
    // rep(i, h) {
    //   rep(j, w) cout << pm[i][j];
    //   cout << ' ';
    //   rep(j, w) cout << mp[i][j];
    //   cout << endl;
    // }
    // cout << endl;

    if (check()) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod 1000000007
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define setA0(a) for(ull i =0;i<n;i++){a[i] = 0;}
#define aout(a) for(auto x : a){cout<<x<<' ';} // array output macro 
#define ain(a) for(ull i =0;i<n;i++){cin>>a[i];} //array input macro
#define NofSetBits(x) __builtin_popcount(x);
#define InpGrph(g,e) while(e--){ll x;ll y;cin>>x>>y ;g[x].pub(y);g[y].pub(x);}
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll N =1000007;
vector<bool>primes(1000007,1);


int main(){
  FastIO;
  ll x,y;
  cin>>x>>y;
  if(y&1){
    cout<<"No";
  }else{
    if(y>=2*x && y<=4*x){
      cout<<"Yes";
    }else{
      cout<<"No";
    }
  }
  return 0;
}


Measured memory_bytes: 3772
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a == b){
    printf("a == b");
  }else if(a < b){
    printf("a < b");
  }else{
    printf("a > b");
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 584
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	reverse(all(v));
	for (int i = 0; i < n; ++i) {
		cout << v[i];
		if (i < n - 1)
			cout << " ";
	}
	cout << endl;

	return 0;
}


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

const int MAX = 50;
char data[MAX][MAX];

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

int main(){
  int H,W;
  cin >> H >> W;
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      cin >> data[i][j];
    }
  }

  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      if(data[i][j] == '#'){
        cout << data[i][j];
        continue;
      }
      int count = 0;
      for(int k = 0 ; k < 8 ; k++){
        int y = i + dy[k];
        int x = j + dx[k];
        if(!(0 <= y && y < H && 0 <= x && x < W))continue;
        if(data[y][x] == '#')count++;
      }
      cout << count;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/*
 *
 * queue
 *
 */
#include<stdio.h>

#define MAX_N 100000

int head=0, tail;
struct task{
    int time;
    char name[11];
}  que[MAX_N];


void enqueue(struct task);
struct task dequeue(void);

void enqueue(struct task q){
    que[tail] = q;
    if(tail == MAX_N -1){
        tail = 0;
    
    }else{
        tail++;
    }
}

struct task dequeue(){
    struct task t;
    t = que[head];

    if(head == MAX_N -1){
        head = 0;
    }else{
        head++;
    }

    return t;
}


int main(){
    int i, sum_time, q, n, process;
    struct task t;

    scanf("%d %d",&n ,&q);
    for(i=0; i<n; i++){
        scanf("%s %d", que[i].name, &que[i].time);
    }

    tail = n;
    while(head != tail){
        t = dequeue();
        if(t.time > q){
            process = q;
        }else{
            process = t.time;
        }

        t.time -= process;
        sum_time += process;

        if(t.time > 0){
            enqueue(t);
        }else{
            printf("%s %d\n", t.name, sum_time);
        }
    }

    return 0;
}



Measured memory_bytes: 3308
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    int[] a;
    for (int i = 0; i < n; i++) a ~= readint;
    a.sort();
    a[$-1] /= 2;
    writeln(a.sum);
}


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

const ll INF = 1e17;
const ll MOD = 1e9+7;

bool is_prime(int n)
{
    if (n == 1) return false;
    if (n == 2) return true;
    for (int i=2; i< sqrt(n)+1; i++)
    {
        if (n%i == 0) return false;
    }
    return true;
}


int main() {
    // input, ready
    int X;
    cin >> X;

    // resolve
    int n = X;
    while (!is_prime(n)) n++;

    // output
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
// Copyright 2017 wu_qing
#include <cstdio>
#include <cstdint>
const int N = 1e5 + 10, mod = 1e9 + 7;
int x, y;
int64_t j[N], ans;
int main() {
    j[0] = 1;
    for (int i = 1; i < N; i++)
        j[i] = j[i - 1] * i % mod;
    scanf("%d%d", &x, &y);
    if (x - y > 1 || x - y < -1)
        ans = 0;
    else
        ans = j[x] * j[y] % mod;
    if (x == y)
        ans = ans * 2 % mod;
    printf("%lld\n", ans);
    return 0;
}


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

using namespace std;

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

    int a[n],b[n],c[n];
    int ans = 0;

    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        a[i]--;
    }

    for(int i=0; i<n; i++)
    {
        cin>>b[i];
    }
    for(int i=0; i<n-1; i++)
    {
        cin>>c[i];
    }

    for(int i=0; i<n; i++)
    {
        ans += b[a[i]];

        if(i>0 && a[i] == a[i-1]+1)
            ans += c[a[i-1]];
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll x,y,z,k,a[1500],b[1500],c[1500],d[300000],p=0,q,r,s,t;
  cin >> x >> y >> z >> k;
  rep(i,x)cin >> a[i];
  rep(i,y)cin >> b[i];
  rep(i,z)cin >> c[i];
  SORT(a,x);
  SORT(b,y);
  SORT(c,z);
  rep(i,x){
    r=3000/(i+1)+1;
    s=min(r,y);
    rep(j,s){
      q=3000/((i+1)*(j+1))+1;
      t=min(q,z);
      rep(k,t){
        d[p]=a[i]+b[j]+c[k];
        p++;
      }
    }
  }
  SORT(d,p);
  rep(i,k)printf("%lld\n",d[i]);
}

Measured memory_bytes: 2560
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int f[200005],n;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	cin>>n;
	rep(i,1,n){
		cin>>x;
		f[x]++;
	}
	FOR(i,1,n){
		cout<<f[i]<<'\n';
	}
	RE 0;
}




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


using ll = long long int;

using namespace std;

const int mod = 1e9 + 7;



ll add(ll a, ll b)
{
    a += b;
    if (a > mod)
    {
        a -= mod;
    }
    return a;
}

ll mul(ll a, ll b)
{
    a *= b;
    return a % mod;
}

ll binpow (ll a, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 == 1)
		return (binpow (a, n-1) * a) % mod;
	else {
		ll b = binpow (a, n/2);
		return (b * b) % mod;
	}
}


const int A_MAX = 1000000;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int i, j, n, x, k;
    
    cin >> n;
    
    vector<int> max_degree(A_MAX + 1);
    
    vector<int> a(n);
    
    for(int i = 0; i < n; ++i)
    {
        cin >> a[i];
        x = a[i];
        for(int j = 2; j * j <= x; ++j)
        {
            k = 0;
            while (x % j == 0)
            {
                k++;
                x /= j;
            }
            if (k)
            {
                max_degree[j] = max(max_degree[j], k);
            }
        }
        if (x > 1)
        {
            max_degree[x] = max(max_degree[x], 1);
        }
    }
    
    ll lcm = 1;
    
    for(i = 0; i <= A_MAX; ++i)
    {
        while(max_degree[i]--)
        {
            lcm = mul(lcm, i);
        }
    }
    ll ans = 0;
    
    for(i = 0; i < n; ++i)
    {
        ans = add(ans, mul(lcm, binpow(a[i], mod - 2)));
    }

    cout << ans;
    
    return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum,l; 
  char news;
  for(;;)
    {
      robox=10;
      roboy=10;
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf(" %c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1;}}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}	
    }
  return 0;
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pe = pair<int, int>;

pe subdiv(int n){
    return {floor(n*0.5) + 1, ceil(n*0.5) - 1};
}
int main(void)
{
    ll N;
    cin >> N;

    ll diff = 0;
    ll xpos = 0;
    for (ll x = 1; x <= N; x++)
    {
        ll sum = (1 + x) * x / 2;
        if(sum >= N){
            xpos = x;
            diff = sum - N;
            break;
        }
    }
    
    for (ll i = 1; i <= xpos; i++)
    {
        if(i != diff){
            cout << i << endl;
        }
    }
    

    return 0;
}


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

int main(){
    char a[11],b[11],c[11];

    scanf("%s %s %s",a,b,c);

    if(a[strlen(a) - 1] == b[0] && b[strlen(b) - 1] == c[0]){
        printf("YES");
    }
    else{
        printf("NO");
    }

    return 0;
}


Measured memory_bytes: 128
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#define _rnd(a,b)    ((a+b-1)/b) //　A/Bの余りを繰り上げる
#define _abs(x) ((x)<0 ? -(x) : (x))
#pragma endregion

// ABC113 B -  Palace
#define _MAX 100000
int main(void) {
	int n, i, t, a, h;
	double min=_MAX;

	scanf("%d %d %d", &n,&t,&a);

	double tmp;
	int    res=0;
	for (i = 0; i < n; i++) {
		scanf("%d", &h);
	    tmp = (double)t - (double)h * 0.006;
		tmp =_abs(a - tmp);
		if (tmp < min) {
			min = tmp;
			res = i+1;
		}
	}

	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  int n;
  cin>>n>>s;
  int cnt=0;
  rep(i,n-2){
    
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') cnt++;
    
  }
  cout<<cnt<<endl;

  return 0;
}

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

typedef long long ll;

const int INF = (1<<30);
const ll inf = 1E15;

struct FlowGraph{
	#define MAXV (2500)
	#define MAXE (20*MAXV)
	struct edge{
		int to, cap, flow; ll cost;
		edge *nxt, *rev;
	}edges[MAXE + 5], *adj[MAXV + 5], *cur[MAXV + 5], *ecnt;
	FlowGraph() {ecnt = edges;}
	void addedge(int u, int v, int c, ll w) {
		edge *p = (++ecnt), *q = (++ecnt);
		p->to = v, p->cap = c, p->flow = 0, p->cost = w;
		p->nxt = adj[u], adj[u] = p;
		q->to = u, q->cap = 0, q->flow = 0, q->cost = -w;
		q->nxt = adj[v], adj[v] = q;
		p->rev = q, q->rev = p;
	}
	int s, t;
	int hp[MAXV + 5]; ll f[MAXV + 5];
	void update(int x, ll k) {
		f[x] = k;
		while( x ) {
			hp[x] = x;
			if( (x<<1) <= t && f[hp[x<<1]] < f[hp[x]] )
				hp[x] = hp[x<<1];
			if( (x<<1|1) <= t && f[hp[x<<1|1]] < f[hp[x]] )
				hp[x] = hp[x<<1|1];
			x >>= 1;
		}
	}
	ll d[MAXV + 5], h[MAXV + 5];
	bool relabel() {
		for(int i=1;i<=t;i++)
			h[i] += d[i], d[i] = f[i] = inf, hp[i] = i, cur[i] = adj[i];
		update(s, d[s] = 0);
		while( f[hp[1]] != inf ) {
			int x = hp[1]; update(x, inf);
			for(edge *p=adj[x];p;p=p->nxt) {
				ll dis = d[x] + p->cost + (h[x] - h[p->to]);
				if( p->cap > p->flow && dis < d[p->to] )
					update(p->to, d[p->to] = dis);
			}
		}
		return !(d[t] == inf);
	}
	bool vis[MAXV + 5];
	int aug(int x, int tot) {
		if( x == t ) return tot;
		int sum = 0; vis[x] = true;
		for(edge *&p=cur[x];p;p=p->nxt) {
			ll dis = d[x] + p->cost + (h[x] - h[p->to]);
			if( !vis[p->to] && p->cap > p->flow && dis == d[p->to] ) {
				int del = aug(p->to, min(tot - sum, p->cap - p->flow));
				p->flow += del, p->rev->flow -= del, sum += del;
				if( sum == tot ) break;
			}
		}
		vis[x] = false;
		return sum;
	}
	ll min_cost_max_flow(int _s, int _t) {
		s = _s, t = _t; ll cost = 0;
		while( relabel() ) {
			int del = aug(s, INF);
			cost += del*(d[t] + h[t]);
		}
		return cost;
	}
}G;

int main() {
	int N; scanf("%d", &N);
	int s = 2*N + 4 + 1, t = 2*N + 4 + 2;
	for(int i=1;i<=N;i++) {
		int X, Y, C; scanf("%d%d%d", &X, &Y, &C);
		G.addedge(s, i, C, 0);
		G.addedge(i, 2*N + 1, INF, + X + Y);
		G.addedge(i, 2*N + 2, INF, - X + Y);
		G.addedge(i, 2*N + 3, INF, + X - Y);
		G.addedge(i, 2*N + 4, INF, - X - Y);
	}
	for(int i=N+1;i<=2*N;i++) {
		int X, Y, C; scanf("%d%d%d", &X, &Y, &C);
		G.addedge(i, t, C, 0);
		G.addedge(2*N + 1, i, INF, - X - Y);
		G.addedge(2*N + 2, i, INF, + X - Y);
		G.addedge(2*N + 3, i, INF, - X + Y);
		G.addedge(2*N + 4, i, INF, + X + Y);
	}
	printf("%lld\n", -G.min_cost_max_flow(s, t));
}

Measured memory_bytes: 1024
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
namespace mp = boost::multiprecision;
using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n;
  cin>>n;
  ll z,ans;
  z=sqrt(n);
  ans=0;
  for(ll i=1;i<=z;i++){
    if(n%i==0){
      ll a=n/i;
      if(i<a-1)ans+=(n/i-1);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 888
import java.util.Scanner;
public class Main
{
  	public static void main(String[] args)
    {
     	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	long result = 0;
      	for(int i = 1; i <= a; i++)
      	{
      		for(int j = i; j <= a; j++)
      		{
      			for(int k = j; k <= a; k++)
      			{
      				boolean judge = true;
      				for(int l = i; l > 0 && judge; l--)
      				{
      					if(i % l == 0 && j % l == 0 && k % l == 0)
      					{
      						judge = false;
      						if(i == j && j == k)
                            {
                             	result += l; 
                            }else if(i != j && j != k && i != k){
                              	result += (l * 6);
                            }else{
                              	result += (l * 3);
                            }
                              
      					}
      				}
      			}
      		}
      	}
      	
      	System.out.println(result);
    }
}


Measured memory_bytes: 35748
#include<stdio.h>
#include<algorithm>
using namespace std;
int N;
int T[10010];
int dp[10][10010] = {0};
int ANS = 100000000;
int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N - 1; i++)
        scanf("%d",&T[i]);
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < i + 1; j++)
        {
            if(i == j)dp[1][j] = T[i];
            else
            {
                dp[1][j] = min(dp[0][j],T[i] + dp[0][i - j - 1]);
            }
            if(j == N / 2 - 1)ANS = min(ANS,dp[1][j]);
        }
        for(int j = 0; j < 10000; j++)
        {
            dp[0][j] = dp[1][j];
        }
    }
    printf("%d\n",ANS);
    return 0;
}

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

vector<string> week = {"SUN", "MON", "TUE", "WED", "THU", "FRI","SAT"};


int main(){
  string S; cin >> S;

  for(int i=0; i<7; i++){
    if(week[i] == S){
      cout << 7-i;
    }
  }
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    map <string,int> earn,lose;
    int n; cin>>n; 
    while (n--){
        string s; cin>>s;
        earn[s]++;
    }
    cin >> n;
    while (n--){
        string  s; cin>>s;
        lose[s]++;
    }
    int ans=0;
    for (auto it: earn){
        string s=it.ff;
        ans = max(ans,earn[s]-lose[s]);
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int i = 0;
	    int x = 0;
	    while(true){
	        
            x = sc.nextInt();
            i++;
            if ( x == 0 ){
              break;  
            }
            System.out.println("Case "+i+": "+x);
	    }
	    
	}
}


Measured memory_bytes: 41840
#include <stdio.h>
#include <string.h>
int main(void){
	char s[100001];
	scanf("%s",s);
	for(long i=strlen(s);i>0;){
		if(strncmp(s+i-5,"dream",5)==0)	i-=5;
		else if(strncmp(s+i-7,"dreamer",7)==0) i-=7;
		else if(strncmp(s+i-5,"erase",5)==0) i-=5;
		else if(strncmp(s+i-6,"eraser",6)==0) i-=6;
		else{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Data.List (intercalate)

isLeap :: Int -> Bool
isLeap n
    | n `divisible` 400 = True
    | n `divisible` 100 = False
    | n `divisible` 4 = True
    | otherwise = False

divisible :: Int -> Int -> Bool
divisible n m = n `mod` m == 0

leaps :: Int -> Int -> [Int]
leaps a b = filter isLeap [a..b]

step :: IO [[Int]]
step = do
    [n,m] <- map read . words <$> getLine
    if n == 0 && m == 0
        then return []
        else (leaps n m :) <$> step

main = step >>= putStr . intercalate "\n" . map showYears

showYears :: [Int] -> String
showYears [] = "NA\n"
showYears ys = unlines . map show $ ys

Measured memory_bytes: 4344
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <numeric>
using namespace std;

const int64_t MOD = 1000000007;

int main() {
	int n,m;
	cin >> n >> m;
	vector<int64_t> a, b;
	for (int i = 0; i < n; ++i) {
		int64_t ai;
		cin >> ai;
		a.push_back(ai);
	}
	for (int i = 0; i < m; ++i) {
		int64_t bi;
		cin >> bi;
		b.push_back(bi);
	}
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	vector<vector<int64_t>> field(n, vector<int64_t>(m, 0));
	if (a[0] != n * m || b[0] != n * m) {
		cout << "0" << endl;
		return 0;
	}
	int w, h;
	w = h = 1;
	int64_t filled = 1;
	int64_t pat = 1;
	int64_t plc = n * m - 1;
	for(int64_t plc=n*m-1; plc>0 ; plc--){
		int64_t next_ylim;
		if (h == n) next_ylim = -1;
		else next_ylim = a[h];
		int64_t next_xlim;
		if (w == m) next_xlim = -1;
		else next_xlim = b[w];
		if (plc > max(next_ylim, next_xlim)) {
			int64_t cpat = max(w*h - filled, (int64_t)0);
			pat = (pat * cpat) % MOD;
			filled++;
		}
		else if (plc == next_ylim && plc > next_xlim) {
			h++;
			pat = (pat*w) % MOD;
			filled++;
		}
		else if (plc == next_xlim && plc > next_ylim) {
			w++;
			pat = (pat*h) % MOD;
			filled++;
		}
		else if (plc == next_xlim && plc == next_ylim) {
			filled++;
			w++;
			h++;
		}
		else {
			pat = 0;
		}
		if (pat == 0) break;
	}
	cout << pat << endl;
	return 0;
}

Measured memory_bytes: 8064