akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
from itertools import combinations
from operator import contains

def readlines(n):
    for _ in range(n):
        x, y = input().split()
        yield int(x)-1, y=="1"

def main():
    n = int(input())
    asserts = []

    for _ in range(n):
        a = int(input())
        asserts.append(list(readlines(a)))

    def check(comb):
        for i in comb:
            for x, y in asserts[i]:
                mujun = contains if not y else lambda a, b: b not in a
                if mujun(comb, x):
                    return -1
        
        return len(comb)

    for i in range(1, n+1):
        for comb in combinations(range(n), i):
            yield check(set(comb))

    yield 0

print(max(main()))

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

int E[55][55];

int main() {
  int H, W; cin>>H>>W;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      char S; cin>>S;
      if(S=='#') E[i][j]=1;
    } //j
  } //i
  bool ikeru=true;
  //カウント
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(E[i][j]==1 && E[i][j-1]!=1 && E[i-1][j]!=1 && E[i][j+1]!=1 && E[i+1][j]!=1) ikeru=0;
    } //j
  } //i
  if(ikeru) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
using System;
class Program
 {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] strListA = Console.ReadLine().Split(' ');
            string[] strListB = Console.ReadLine().Split(' ');
            long shortage = 0;
            long overage = 0;
            long difference = 0;
            for(int i = 0; i < N; i++){
                int a = int.Parse(strListA[i]);
                int b = int.Parse(strListB[i]);
                if(a > b){
                    shortage += a - b;
                }
                if(b > a){
                    overage += (b - a) / 2;
                }
                // difference += (b - a);
                // Console.WriteLine(difference);
            }
            // Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c)//改行なし出力
            // Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);//改行付き出力
            if(shortage <= overage){
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }
        }
 }

Measured memory_bytes: 14688
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>x;i--)
typedef long long ll;
using namespace std;

int main(){
    ll D;
    cin>>D;
    string s="Christmas";
    REP(i,0,25-D){
        s+= " Eve";
    }
    cout<< s << endl;
    
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
 
int main(void){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 3088
X = []
# X = [15, 18, 26, 35, 36]
# X = [1, 2, 4, 8, 9]
# k = 15

for _ in range(5):
    X.append(int(input()))  # S += [input()] とも書ける
k = int(input())

for x in range(len(X)):
    for y in range(x+1, len(X)):
        # print(x, y, k, X[y] - X[x])

        if k < X[y] - X[x]:
            print(':(')
            exit()
print('Yay!')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)    scanf("%d",&x)
#define sl(x)    scanf("%lld",&x)
#define ss(s)    scanf("%s",s)
#define pi(x)    printf("%d\n",x)
#define pl(x)    printf("%lld\n",x)
#define ps(s)    printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>    pii;
typedef pair<ll, ll>    pl;
typedef vector<int>        vi;
typedef vector<ll>        vl;
typedef vector<pii>        vpii;
typedef vector<pl>        vpl;
typedef vector<vi>        vvi;
typedef vector<vl>        vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}

int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];

void solve(){
    string s,t;
    cin>>s>>t;
    ll ans=0,i;
    fo(i,s.size()){
        if(s[i]!=t[i])
        {
            ++ans;
        }
    }
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
    int i, u, v;
    while(m--){
        cin>>u>>v;
    u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par){
    for(int v:g[u]){
        if (v == par) continue;
        dfs(v, u);
    }
}
 

Measured memory_bytes: 10816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[][] = new int[2][n];

		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();

			}
		}

		int max = 0;

		for (int i = 0; i < n; i++) {
			int temp = 0;
			for (int j = 0; j <= i; j++) {
				temp += a[0][j];
			}
			for (int j = i; j < n; j++) {
				temp += a[1][j];
			}
			if (temp > max) {
				max = temp;
			}
		}

		System.out.println(max);

	}

}


Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int n;
	char buf[1024];
	int num[10000];
	int i = 0;
	int min = 0;
	int max = 0;
	long sum = 0;
	char* ptr;

	scanf("%d\n", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%s", buf);
		num[i] = atoi(buf);
	}
	min = num[0];
	max = num[0];
	sum = 0;
	for (i = 0; i < n; i++)
	{
		if (min > num[i]) min = num[i];
		if (max < num[i]) max = num[i];
		sum += (long)num[i];
	}
	printf("%d %d %ld\n", min, max, sum);
	return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri(), a = ri(), b = ri();
	if (a + b > n + 1 || b < (n - 1) / a + 1) {
		puts("-1");
		return 0;
	}
	std::vector<int> res;
	int add = b - ((n - 1) / a + 1);
	while ((n - add - 1) / a + 1 + add < b) add++;
	for (int i = 0; i < n - add; i++) res.push_back(n - i - 1);
	for (int i = 0; i < (n - add) / a * a; i += a) std::reverse(res.begin() + i, res.begin() + i + a);
	std::reverse(res.begin() + (n - add) / a * a, res.end());
	for (int i = 0; i < add; i++) res.push_back(add - i - 1);
	for (auto i : res) std::cout << i + 1 << " ";
	
	std::cout << std::endl;
	
	return 0;
}


Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;

string s, t;
string ans;

int main(){
  int n;
  cin >> n;
  cin >> s >> t;
  for(int i = 0; i < s.size(); i++){
    ans += s.at(i);
    ans += t.at(i);
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	
	int L,R,d;
	scanf("%d %d %d", &L, &R, &d);
	int akhir=0;
		for (int i=1;i<=R;i++){
			if(d*i>=L&&d*i<=R){
				akhir++;
			}
		}
		printf("%d\n", akhir);
	return 0;
}

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

void bubbleSort(int A[],int N){ // N 個の要素を含む 0-オリジンの配列 A
  int flag = 1,count=0,k=0; // 逆の隣接要素が存在する
  while(flag){
    flag = 0;
    for(int i=N-1;i>k;i--)
       if (A[i] < A[i-1]){
         swap(A[i],A[i-1]);
         flag = 1;
         count++;
       }
    k++;
    
  }
  cout << A[0];
  for(int i=1;i<N;i++)
    cout<<" "  <<A[i];
  cout << endl<<count<<endl;
  return;
}
  

int main(){
  int n;
  cin >>n;
  int data[100];
  for(int i=0;i<n;i++)
    cin>>data[i];
  bubbleSort(data,n);
  return 0;
}


Measured memory_bytes: 3124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int x = int.Parse(str[0]);
            int t = int.Parse(str[1]);

            int ans = x - t;

            if(ans >= 0)
            {
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int N,M,Q;
char S[2010][2010];
int V[2010][2010];
int X[2010][2010];
int Y[2010][2010];

int cnt_ver(int x1, int y1, int x2, int y2) {
    x1--; y1--;
    return V[y2][x2] - V[y2][x1] - V[y1][x2] + V[y1][x1];
}

int cnt_edge(int x1, int y1, int x2, int y2) {
    x1--; y1--;
    int a = X[y2][x2] - X[y2][x1 + 1] - X[y1][x2] + X[y1][x1 + 1];
    int b = Y[y2][x2] - Y[y2][x1] - Y[y1 + 1][x2] + Y[y1 + 1][x1];
    return a + b;
}

int main() {
 
    cin >> N >> M >> Q;
    vector < string > St(N);
    REP(i,N) cin >> St[i];
    REP(i,N) REP(j,M) S[i + 1][j + 1] = St[i][j];

    REP(i,N) REP(j,M) V[i + 1][j + 1] = S[i + 1][j + 1] - '0';

    N += 2; M += 2;
    REP(i,N) REP(j,M) V[i + 1][j] = V[i + 1][j] + V[i][j];
    REP(i,N) REP(j,M) V[i][j + 1] = V[i][j + 1] + V[i][j];

    for (int i = 2; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            if (S[i][j] == '1' && S[i - 1][j] == '1') Y[i][j] = 1;
        }
    }

    REP(i,N) REP(j,M) Y[i + 1][j] = Y[i + 1][j] + Y[i][j];
    REP(i,N) REP(j,M) Y[i][j + 1] = Y[i][j + 1] + Y[i][j];

    for (int i = 1; i <= N; i++) {
        for (int j = 2; j <= M; j++) {
            if (S[i][j] == '1' && S[i][j - 1] == '1') X[i][j] = 1;
        }
    }

    REP(i,N) REP(j,M) X[i + 1][j] = X[i + 1][j] + X[i][j];
    REP(i,N) REP(j,M) X[i][j + 1] = X[i][j + 1] + X[i][j];

    REP(i,Q) {
        int x1,y1,x2,y2;
        cin >> y1 >> x1 >> y2 >> x2;
        cout << cnt_ver(x1, y1, x2, y2) - cnt_edge(x1, y1, x2, y2) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 57216
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N;
int H[20], W[20];
int dp[1 << 16];
vector<string> board;
const string alph = "RGB";

int solve() {
    queue<int> q; q.push(0);
    while(!q.empty()) {
        int bit = q.front(); q.pop();
        if(bit == (1 << 16) - 1) return dp[bit];
        // i テァツ閉ェテァツ崢ョテ」ツ?ョテ」ツつケテ」ツつソテ」ツδウテ」ツδ療」ツ?ョテ・ツキツヲテ、ツクツ甘」ツつ?(j, k) テ」ツ?ォテ・ツ青暗」ツつ湘」ツ?崚」ツ?ヲティツ可イ s テ」ツ?ァテヲツ環シテ」ツ??
        rep(i,0,N) rep(j,-H[i]+1,4) rep(k,-W[i]+1,4) rep(s,0,3) {
            int nbit = bit;
            rep(x, max(j,0LL), min(j+H[i],4LL)) rep(y, max(k,0LL), min(k+W[i],4LL)) {
                int idx = x * 4 + y;
                if(board[x][y] == alph[s]) nbit |= (1 << idx);
                else if(nbit >> idx & 1) nbit ^= (1 << idx);
            }
            if(dp[nbit] < 0) {
                dp[nbit] = dp[bit] + 1;
                q.push(nbit);
            }
        }
    }
    return 0;
}

signed main() {
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;

    cin >> N;
    rep(i,0,N) cin >> H[i] >> W[i];
    rep(i,0,4) {
        string s; cin >> s;
        board.push_back(s);
    }
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    vector<int> a = {1,
                     1,
                     1,
                     2,
                     1,
                     2,
                     1,
                     5,
                     2,
                     2,
                     1,
                     5,
                     1,
                     2,
                     1,
                     14,
                     1,
                     5,
                     1,
                     5,
                     2,
                     2,
                     1,
                     15,
                     2,
                     2,
                     5,
                     4,
                     1,
                     4,
                     1,
                     51};
    cin >> k;
    cout << a[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<queue>
using namespace std;
#define MAX 100
#define INFTY 1 << 21

int n, M[MAX][MAX];
int dist[MAX];

void bfs_visit(int u){
    queue<int> q;
    q.push(u);
    int v;
    for(v = 0; v < n; v++) dist[v] = INFTY;
    dist[u] = 0;

    while(!q.empty()){
        u = q.front();
        q.pop();
        for(v = 0;  v < n; v++){
            if(M[u][v] == 0) continue;
            if(dist[v] != INFTY) continue;
            dist[v] = dist[u] + 1;
            q.push(v);
        }

    }
    for(int i = 0; i < n; i++){
            cout << i + 1 << " " << (dist[i] == INFTY ? -1 : dist[i]) << endl;
    }
}

int main(){
    cin >> n;
    int i, j, u, k, v;
    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            M[i][j] = 0;
        }
    }
    for(i = 0; i < n; i++){
        cin >> u >> k;
        /* 0 origin */
        u--;
        for(j = 0; j < k; j++){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    bfs_visit(0);

    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int r, d, x; cin >> r >> d >> x;
    rep(i, 10)
    {
        int ans = r * x - d;
        cout << ans << endl;
        x = ans;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0]*n
solved = True
for i in range(n):
    cl[i] = al[i]-bl[i]
    if cl[i]<0:
        solved = False

if solved:
    print(0)
    exit()

cl.sort(reverse=True)
# print(cl)

last = n-1
i = 0
res = 0
used = [False for _ in range(n)]
while True:
    if cl[last]>0:
        break

    while cl[i]>0 and cl[last]<0:
        if cl[i]+cl[last]>=0:
            cl[i] += cl[last]
            cl[last] = 0
            if not used[last]:
                res += 1
            used[last] = True
            last -= 1
        else:
            cl[last] += cl[i]
            cl[i] = 0
        if not used[i]:
            res += 1
        used[i] = True
    i += 1
    if i==last:
        break

if cl[last]<0:
    res = -1
print(res)
# print(cl)


Measured memory_bytes: 19068
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

// http://noshi91.hatenablog.com/entry/2019/03/31/174006
template <uint_fast64_t Mod = 1'000'000'007>
struct modint {
  using u64 = uint_fast64_t;

  u64 n;

  modint(const u64 x = 0) : n(x % Mod) {}
  modint operator+(const modint r) const { return modint(*this) += r; }
  modint operator-(const modint r) const { return modint(*this) -= r; }
  modint operator*(const modint r) const { return modint(*this) *= r; }
  modint operator/(const modint r) const { return modint(*this) /= r; }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) {
    n = n * r.n % Mod;
    return *this;
  }
  modint &operator/=(const modint r) {
    *this *= r.inv();
    return *this;
  }
  modint pow(u64 x) const {
    modint<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  modint inv() const {
    return pow(Mod-2);
  }
};
using mint = modint<1'000'000'007>;

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

  ll n;
  cin >> n;
  vector<mint> x(n);
  rep(i, n) {
    cin >> x[i].n;
  }

  mint ans(0);
  mint sum(0);
  rep(i, n-1) {
    sum += mint(i+1).inv();
    ans += (x[i+1]-x[i])*sum;
  }
  mint fac(1);
  rep(i, n-1) {
    fac *= mint(i+1);
  }
  ans *= fac;
  cout << ans.n << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int ans;
	cin >> ans;
	while (ans != 0) {
		for (int i = 0; i < 9; i++) {
			int x;
			cin >> x;
			ans -= x;
		}
		cout << ans << endl;
		cin >> ans;
	}
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <cmath>
 
using namespace std;
int N;

int top(int);

int m[10][10];

int main()
{
  int i,j;
  int k;
  int ret=0;

  cin >> N;
  for (i=1; i<=N; i++) m[top(i)][i%10]++;
  for (i=1; i<=N; i++) ret += m[i%10][top(i)];
  printf("%d\n", ret);
  return 0;
}

int keta(int n) {
  int ret=0;

  while(n>0) {
    n/=10;
    ret++;
  }
  return ret;
}
int top(int n) {
  while(n>=10) n/=10;
  return n;
}



Measured memory_bytes: 256
#!/usr/bin/env python3

N, A, B, C, D = list(map(int, input().split()))
S = input()

is_ok = True

for i in range(A - 1, max(C, D) - 2):
    if S[i] == "#" and S[i + 1] == "#":
        is_ok = False
        break

if is_ok:
    if C > D:
        is_ok = False
        for i in range(B - 2, D - 1):
            if S[i] == "." and S[i + 1] == "." and S[i + 2] == ".":
                is_ok = True
                break

ans = "Yes" if is_ok else "No"

print(ans)


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>

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

using namespace std;

int main(){
    int n; cin >> n;
    int t,x,y;
    int nowt = 0;
    int nowx = 0;
    int nowy = 0;
    bool isOK = true;
    rep(i, n) {
        cin >> t >> x >> y;
        int difft = t - nowt;
        int diffx = abs(x-nowx);
        int diffy = abs(y-nowy);

        int tmp = diffx + diffy - difft;
        if(tmp > 0){
            isOK = false;
        } else {
            if(abs(tmp)%2 != 0)
                isOK = false;
        }

        if(isOK) {
            nowt = t;
            nowx = x;
            nowy = y;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}





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

int main(){
	long long n;
	scanf("%lld",&n);
	long long arr[n+1],ops=0;
	for(int i=0;i<n;i++){
		scanf("%lld",&arr[i]);ops+=arr[i];
	}
	arr[n]=arr[0];
	if(ops%(n*(n+1)/2)!=0){printf("NO");return 0;}
	ops/=(n*(n+1)/2);
	for(int i=0;i<n;i++){
		if((ops+arr[i]-arr[i+1])%n==0&&ops+arr[i]-arr[i+1]>=0){
		}else{
			printf("NO");return 0;
		}
	}
	printf("YES");
}


Measured memory_bytes: 1024
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	std::string s;
	cin >> s;
	s[3] = '8';
	cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << endl
#define print10(ele) cout << fixed << setprecision(10) << (ele) << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  string s;
  int q;
  cin >> s >> q;
  bool b = true;
  ll count = 0;
  REP(i, q) {
    int t, f;
    string c;
    cin >> t;
    t--;
    if (t) {
      cin >> f >> c;
      f--;
      if (b) {
        if (f) {
          s += c;
        } else {
          s.insert(0, c);
        }
      } else {
        if (f) {
          s.insert(0, c);
        } else {
          s += c;
        }
      }
    } else {
      b = !b;
      count++;
    }
  }
  if (count % 2) reverse(ALL(s));
  print(s);
  return 0;
}

Measured memory_bytes: 900
//https://atcoder.jp/contests/agc032/tasks/agc032_b
//B - Balanced Neighbors
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    ll N; cin>>N;    
    //完全グラフからいらないところ外す
    vector<pair<ll,ll>> ans;
    if(N%2==1){
        FOR(i,1,N+1){
            ll del_no = N-i;
            FOR(j,i+1,N+1){
                if (j==del_no)continue;
                ans.emplace_back(make_pair(i,j));
            }
        }
    }else{
        FOR(i,1,N+1){
            ll del_no = N-i+1;
            FOR(j,i+1,N+1){
                if (j==del_no)continue;
                ans.emplace_back(make_pair(i,j));
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto& p:ans){
        cout<<p.first<<" "<<p.second<<endl;
    }
    return 0;
}

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

struct output{ int a, b, c, d; };
int H, W;

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

  vector<output> res;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W - 1; j++) {
      if (a[i][j] & 1) {
        a[i][j]--; a[i][j + 1]++;
        res.push_back((output){i, j, i, j + 1});
      }
    }
  }
  int j = W - 1;
  for (int i = 0; i < H - 1; i++) {
    if (a[i][j] & 1) {
      a[i][j]--; a[i + 1][j]++;
      res.push_back((output){i, j, i + 1, j});
    }
  }

  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) {
    output r = res[i];
    cout << r.a + 1 << ' '
         << r.b + 1 << ' '
         << r.c + 1 << ' '
         << r.d + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 5232
S = input()

odd_tap = ['R', 'U', 'D']
even_tap = ['L', 'U', 'D']

for i in range(len(S)):
    if i % 2 == 0:
        if not S[i] in odd_tap:
            print('No')
            exit()
    else:
        if not S[i] in even_tap:
            print('No')
            exit()
print('Yes')


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

using namespace std;
using ll = long long;

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

#define INF 99999999
#define MOD (int)1e9 + 7
#define rep(i,n) for(int i = 0;i<n;i++)

int main() {

	string s;
	cin >> s;

	rep(i, s.length()) {
		if (i == 4)cout << ' ';
		cout << s[i];
	}

	cout << endl;

	return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

struct Edge
{
	int u,v,m,t;
	Edge(int u,int v,int m,int t):u(u),v(v),m(m),t(t){}
	Edge():Edge(-1,-1,-1,-1){}
};

vector<Edge> G[55];
pii EXC[55];
int D[55][3010];
int V, E,S;

void shortest_path()
{
	rep(i, 0, V)rep(j,0,3010)D[i][j] = INF;
	D[0][S] = 0;

	priority_queue<pair<int,pii>, vector<pair<int,pii>>, greater<pair<int,pii>>> pq;
	pq.push(mp(0, mp(0,S)));

	while (!pq.empty())
	{
		auto p = pq.top(); pq.pop();
		if (D[p.second.first][p.second.second] < p.first)
		{
			continue;
		}
		/*if(p.second.second!=3000LL)
		{
			int nm=p.second.second+EXC[p.second.first].first;
			int nc=p.first+EXC[p.second.first].second;
			if(chmin(D[p.second.first][nm],nc))
			{
				pq.push(mp(nc,mp(p.second.first,nm)));
			}
		}*/
		for (auto& e : G[p.second.first])
		{
			int nm=p.second.second-e.m;
			int nc=p.first+e.t;

			if(nm>3000LL||nm<0)continue;

			if(chmin(D[e.v][nm],nc))
			{
				pq.push(mp(nc,mp(e.v,nm)));
			}
		}
	}
}
 
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin>>V>>E>>S;
	chmin(S,3000LL);

	int u,v,a,b;
	rep(i,0,E)
	{
		cin>>u>>v>>a>>b;
		u--,v--;
		G[u].push_back(Edge(u,v,a,b));
		G[v].push_back(Edge(v,u,a,b));
	}

	rep(i,0,V)
	{
		cin>>EXC[i].first>>EXC[i].second;
		G[i].push_back(Edge(i,i,-EXC[i].first,EXC[i].second));
	}

	shortest_path();

	rep(i,1,V)
	{
		int res=INF;
		rep(j,0,3010)
		{
			chmin(res,D[i][j]);
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 7500
N = int(input())

hantei = 0

for k in range(9):
    i = k+1
    answer = divmod(N, i)
    if answer[0] < 10 and answer[1] == 0:
        hantei = 1

if hantei == 0:
    print('No')
else:
    print('Yes')

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

using namespace std;

int main (){
  int a,b,i,sum;
	cin >> a >> b;
  	sum = 0;
  	i = a;
  	while(i <= b){
      if ((i / 10000) == (i % 10)){
        if ((i / 1000) - (i / 10000)*10 == ((i % 100) - (i % 10))/10){
          sum++;
        }
      }
      i++;
    }
	cout << sum << endl;
    
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let h: usize = sc.cin();
    let w: usize = sc.cin();
    let f: Vec<Vec<char>> = (0..h).map(|_| sc.chars()).collect();
    for i in 0..h {
        for j in 0..w {
            if f[i][j] == '#' {
                print!("#");
            } else {
                let mut c = 0;
                if i > 0 && j > 0 && f[i-1][j-1] == '#' { c += 1 }
                if j > 0 && f[i  ][j-1] == '#' { c += 1 }
                if i < h-1 && j > 0 && f[i+1][j-1] == '#' { c += 1 }
                if i > 0 && f[i-1][j  ] == '#' { c += 1 }
                if i <h-1&& f[i+1][j  ] == '#' { c += 1 }
                if i > 0 && j <w-1 && f[i-1][j+1] == '#' { c += 1 }
                if j <w-1 && f[i  ][j+1] == '#' { c += 1 }
                if i <h-1 && j <w-1 && f[i+1][j+1] == '#' { c += 1 }
                print!("{}", c);
            }
        }
        println!("");
    }

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
def f(x):
	return x == x[::-1]
S = input()

l1 = (len(S)-1)//2
l2 = (len(S)+3)//2

S1 = S[:l1]
S2 = S[l2-1:]

if f(S) and f(S1) and f(S2):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
<?php
$str = trim(fgets(STDIN));
for($i = 0; $i < 4; $i++){
    $num[$i] = $str[$i];
}
for($i = 0; $i < 2**3; $i++){
    $flagStr = sprintf("%03d", decbin($i));
    $result = $num[0];
    for($j = 0; $j < 3; $j++){
        if($flagStr[$j] == "0"){
            $result+=$num[$j+1];
        }else{
            $result-=$num[$j+1];
        }
    }
    if($result == 7){
        echo $num[0];
        for($i = 0; $i < 3; $i++){
            echo $flagStr[$i] == "0" ? "+" : "-";
            echo $num[$i+1];
        }
        echo "=7";
        exit;
    }
}


Measured memory_bytes: 4728
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
signed main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4)cout << ((((x1 - x2) * (y4 - y1) - (y1 - y2) * (x4 - x1)) * ((x1 - x2) * (y3 - y1) - (y1 - y2) * (x3 - x1)) > 0) && (((x2 - x3) * (y4 - y2) - (y2 - y3) * (x4 - x2)) * ((x2 - x3) * (y1 - y2) - (y2 - y3) * (x1 - x2)) > 0) && (((x3 - x1) * (y4 - y3) - (y3 - y1) * (x4 - x3)) * ((x3 - x1) * (y2 - y3) - (y3 - y1) * (x2 - x3)) > 0) ? "YES\n" : "NO\n");
}


Measured memory_bytes: 3068
num=[]

for i in 1..gets.to_i
    num=gets.split(nil).map(&:to_i)
    b=c=0
    for t in 0...num.size
        if (b<num[t])&&(b-c>=0)
            b=num[t]
        elsif (c<num[t])
            c=num[t]
        else
            puts "NO"
            break
        end
        puts "YES" if (t==num.size-1)
    end
end

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

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

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
  int n;
  cin >> n;
  set<int> a;
  rep(i,n){
    int x;
    cin >> x;
    a.insert(x);
  }
  if(a.size() == n) cout << "YES" << endl;
  else cout << "NO" << endl;
  }


Measured memory_bytes: 9600
#include <iostream>
#include <vector>

using namespace std;

const int N = 100 + 5, NO_OF_LETTERS = 4, MOD = 1e9 + 7, T_INDEX = 3;
long long no_of_strings[N][NO_OF_LETTERS][NO_OF_LETTERS][NO_OF_LETTERS];
char letter[NO_OF_LETTERS] = {'A', 'C', 'G', 'T'};

int ok(int last_1, int last_2, int last_3, int last_4)
{
    char l1 = letter[last_1], l2 = letter[last_2], l3 = letter[last_3], l4 = letter[last_4];

    if(l1 == 'A' && l2 == 'G' && l4 == 'C')
        return false;
    if(l1 == 'A' && l3 == 'G' && l4 == 'C')
        return false;
    if(l1 == 'A' && l2 == 'G' && l3 == 'C')
        return false;
    if(l2 == 'A' && l3 == 'G' && l4 == 'C')
        return false;
    if(l1 == 'G' && l2 == 'A' && l3 == 'C')
        return false;
    if(l2 == 'G' && l3 == 'A' && l4 == 'C')
        return false;
    if(l1 == 'A' && l2 == 'C' && l3 == 'G')
        return false;
    if(l2 == 'A' && l3 == 'C' && l4 == 'G')
        return false;

    return true;
}

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

    vector <long long> total(length + 1, 0);

    for(int i = 1; i <= length; i++)
    {
        for(int last_1 = 0; last_1 < NO_OF_LETTERS; last_1++)
        {
            for(int last_2 = 0; last_2 < NO_OF_LETTERS; last_2++)
            {
                for(int last_3 = 0; last_3 < NO_OF_LETTERS; last_3++)
                {
                    no_of_strings[i][last_1][last_2][last_3] = 0;

                    for(int last_4 = 0; last_4 < NO_OF_LETTERS; last_4++)
                    {
                        if(i == 1)
                        {
                            no_of_strings[i][last_1][T_INDEX][T_INDEX] = 1;
                        }
                        else if(i == 2)
                        {
                            no_of_strings[i][last_1][last_2][T_INDEX] = 1;
                        }
                        else if(i == 3)
                        {
                            if(ok(T_INDEX, last_3, last_2, last_1))
                            {
                                no_of_strings[i][last_1][last_2][last_3] = 1;
                            }
                        }
                        else if(ok(last_4, last_3, last_2, last_1))
                        {
                            no_of_strings[i][last_1][last_2][last_3] += no_of_strings[i - 1][last_2][last_3][last_4];
                        }
                    }

                    no_of_strings[i][last_1][last_2][last_3] %= MOD;

                    total[i] = (total[i] + no_of_strings[i][last_1][last_2][last_3])%MOD;
                }
            }
        }
    }

    cout << total[length];
    return 0;
}


Measured memory_bytes: 256
// Problem: D - Knapsack 1
// Contest: AtCoder - Educational DP Contest
// URL: https://atcoder.jp/contests/dp/tasks/dp_d
// Parsed on: 2020-09-06 13:23:06
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);

using namespace std;

int main() {
    int n, w;
    cin >> n >> w;
    vector<pair<int, int>> arr(n);
    for (auto &e : arr) cin >> e.first >> e.second;
    // dp[n][w] means the best value when carrying n items
    // with max allowed w weight.

    vector<vector<long>> dp(n, vector<long>(w + 1));

	// higher weight limits will also include zero'th values.
    for (int a = arr[0].first; a < w + 1; a++) dp[0][a] = arr[0].second;

    for (int a = 1; a < n; a++) {
        for (int b = 0; b < w + 1; b++) {
            long take = 0;
            if (arr[a].first <= b)
                take = dp[a - 1][b - arr[a].first] + arr[a].second;

            dp[a][b] = max(take, dp[a - 1][b]);
        }
    }

    cout << dp[n - 1][w];

    // traformation operation is
    // take the item or discard it
    // dp[n][w] = d[n-1][w]; // discarded current item;
    // dp[n][w] = d[n-1][w-c] + value of item; c is weight of item
    // max of either of them

    return 0;
}


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

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  if(N&1){
    cout<<"No"<<endl;
  }else{
    for(int i=0;i<N/2;i++){
      if(S[i]!=S[i+N/2]){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
  }
}
      


Measured memory_bytes: 256
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	s = int(rl())

	@lru_cache(None)
	def dp(currsum):
		if currsum == s: return 1
		cnt = 0
		for d in range(3, 2001):
			if currsum + d <= s:
				cnt += dp(currsum + d)
				cnt %= MOD 
		return cnt
	print(dp(0))
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 76464
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,temp1,temp2,t,x,y,m,k,b,temp,a,q,d,p;
   
	cin>>n;
	vector<lli>v(n);
	lli answer=0;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		if(i!=0)
		{
			answer=(answer^v[i]);
		}
	}
	
	vector<lli>ans;
	ans.push_back(answer);
	
	for(int i =1;i<n;i++)
	{
		answer=(answer^v[i]);
		answer=(answer^v[i-1]);
		ans.push_back(answer);
	}
	
	for(int i =0;i<n;i++)
	{
		cout<<ans[i]<<" ";
	}
	
}

	
	


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

using namespace std;

int main()
{
    int n,m,i,j,k;
    double x,y,z;

    cin>>n;
    int a[n+1];
    int b[n+1];
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a+1,a+n+1,greater<int>());
    if(n>2)
    {
        x=((a[n]*1.0)+(a[n-1]*1.0))/2.0;
        for(i=n-2;i>0;i--)
        {
            x=(x+(a[i]*1.0))/2.0;
        }
        cout<<x<<endl;
    }
    else
    {
        cout<<((a[1]*1.0)+(a[2]*1.0))/2.0;
    }


}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;

int main() {
    cin >> N;
    int last = N % 10;
    if (last == 2 || last == 4 || last == 5 || last == 7 || last == 9) {
        cout << "hon\n";
    }
    if (last == 1 || last == 6 || last == 0 || last == 8) {
        cout << "pon\n";
    }
    if (last == 3) {
        cout << "bon\n";
    }

    return 0;
}

Measured memory_bytes: 3592
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_B&lang=jp

#include<iostream>
 using namespace std;

int main(){

    double r ;
    cin >> r ;
    
    std::cout << std::fixed;
    cout <<  r * r * 3.1415926535897932387 << " " << 2 * r * 3.1415926535897932387 << endl ;  
    return 0;

}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int h,w,i,j;
  cin>>h>>w;
  char s[h][w];
  int q[h+1][w+1];
  for(i=0;i<h+1;i++)
    for(j=0;j<w+1;j++) q[i][j]=0;
  for(i=0;i<h;i++)
  {
    for(j=0;j<w;j++)
    {
      cin>>s[i][j];
      if(s[i][j]=='.'&&(i!=0&&j!=0)) q[i+1][j+1]=min(q[i][j+1],q[i+1][j]);
      else if(s[i][j]=='.'&&i==0) q[i+1][j+1]=q[i+1][j];
      else if(s[i][j]=='.'&&j==0) q[i+1][j+1]=q[i][j+1];
      else
      {
        if(i==0&&j==0) q[i+1][j+1]=1;
        else if(i==0&&s[i][j-1]=='.') q[i+1][j+1]=q[i+1][j]+1;
        else if(i==0&&s[i][j-1]=='#') q[i+1][j+1]=q[i+1][j];
        else if(j==0&&s[i-1][j]=='.') q[i+1][j+1]=q[i][j+1]+1;
        else if(j==0&&s[i-1][j]=='#') q[i+1][j+1]=q[i][j+1];
        else
        {
          if(s[i-1][j]=='#'&&s[i][j-1]=='#') q[i+1][j+1]=min(q[i][j+1],q[i+1][j]);
          else if(s[i-1][j]=='#'&&s[i][j-1]=='.') q[i+1][j+1]=min(q[i][j+1],q[i+1][j]+1);
		  else if(s[i-1][j]=='.'&&s[i][j-1]=='#') q[i+1][j+1]=min(q[i][j+1]+1,q[i+1][j]);
		  else q[i+1][j+1]=min(q[i][j+1]+1,q[i+1][j]+1);
        }
      }
    }
  }
  cout<<q[h][w];
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,j,s,n,m;
  static int a[100][100],b[100],c[100];

  scanf("%d%d",&n,&m);

  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&a[i][j]);

  for(i=0;i<m;i++)
    scanf("%d",&c[i]);

  for(i=0;i<n;i++){
    s = 0;
    for(j=0;j<m;j++)
      s += a[i][j] * c[j];
    printf("%d\n",s);
  }
  
  return 0;
}


Measured memory_bytes: 2756
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int k = sc.nextInt();
		String s = sc.next();
        String[] line = new String[num];
        line = s.split("");
        String former = line[0];
        int check = 0;
        int count = 1;
        int count2 = 0;
        int index = 0;
        int sum = 0;
        int max = 0;
        int temp = 0;
        List<Integer> counter = new ArrayList<Integer>();
        List<Integer> counter2 = new ArrayList<Integer>();
        if(line[0].equals("0")) check = 1;
        if(line.length == 1) {
            counter.add(count);
            counter2.add(count);
        }
        for(int i=1; i<num; i++){
          if(line[i].equals(former)){
            count++;
          }
          else{
            check++;
            count++;
            if(line[i].equals("0")) former = "0";
            else former = "1";
          }
          if(check == 2) count2++;
          if(check == 3){
            counter.add(count-1);
            counter2.add(count-1-temp);
            count = count2+1;
            temp = count2;
            count2 = 0;
            check = 1;
          }
          if(i+1 >= num) {
            counter.add(count);
            counter2.add(count-temp);
            break;
          }
        }
        temp = 0;
        while(true){
          temp = index;
          sum += counter.get(index);
          index++;
          for(int j=1; j<k; j++){
             if(index >= counter2.size()) break;
             sum += counter2.get(index);
             index++;
          }
          if(max < sum) max = sum;
          sum = 0;
          index = temp + 1;
          if(index+k > counter2.size()) break;
        }
        System.out.println(max);
	}
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n;
    cin >> n;
    cout << n/3 << endl;
    return 0;
}


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

using namespace std;

int cell[5];

int main() {
    cin >> cell[0] >> cell[1] >> cell[2] >> cell[3] >> cell[4];

    sort(cell, cell + 5);

    cout << cell[4] << " " << cell[3] << " " << cell[2] << " " << cell[1] << " " << cell[0] << endl;

    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int L = S.size();
  string ans = "AC";
  if(S[0] != 'A'){
    ans = "WA";
  }
  int cnt = 0;
  for(int i = 1; i < L; ++i){
  if(isupper(S[i])){
    if(i == 1 || i == L - 1 || S[i] != 'C'){
      ans = "WA";
    }
    ++cnt;
  }
 }
  if(cnt != 1){
    ans = "WA";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256