akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <stdio.h>
#pragma warning(disable : 4996)

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
//#define int long long;

double dist(double x1, double y1, double x2, double y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
	return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

signed main() {
	int n, a;
	cin >> n;
	vector<int> list(n--);
	rep(i, n) {
		cin >> a;
		a--;
		list.at(a)++;
	}
	rep(i, n) {
		cout << list.at(i) << endl;
	}
	cout << "0" << endl;
}

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


void solve(double T, double X){
    double ans=T/X;
    printf("%lf\n",ans);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    double T;
    scanf("%lf",&T);
    double X;
    scanf("%lf",&X);
    solve(T, X);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c; 
	if(a==5 && b==5 && c==7){
		cout<<"YES"<<endl;
		return 0;
	}
	if(a==5 && b==7 && c==5){
		cout<<"YES"<<endl;
		return 0;
	}
	if(a==7 && b==5 && c==5){
		cout<<"YES"<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
	/*
	int n,m,a;
	cin>>n>>m>>a;
	if(n%a==0){
		if(m%a!=0)
			cout<<(n/a)*(m/a+1)<<endl;
		if(m%a==0)
			cout<<(n/a)*(m/a)<<endl;
	} 
	if(n%a!=0){
		if(m%a!=0)
			cout<<(n/a+1)*(m/a+1)<<endl;
		if(m%a==0)
			cout<<(n/a+1)*(m/a)<<endl;
	}
	*/
	return 0;
}



/*
书签1：
书签2：
书签3：
书签4：
书签5：
书签6：
书签7：
书签8：
书签9： 
书签10： 
*/ 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    
    
    cout << b-d+c << " " << -(a-c)+d << " " << -(d-b)+a << " " << c-a+b << endl;
    
    
    
    return 0;
}



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

lst = [0 for i in range(10**5+1)]
for i in range(n):
    ai, bi = map(int, input().split())
    lst[ai] += bi

for i in range(1, 10**5+1):
    k -= lst[i]
    if k <= 0: break

print(i)

Measured memory_bytes: 45040
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s;
    cin >> s;
    int n = len(s);
    vector <int> lef(n), righ(n), ans(n, 0);
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'R')
        {
            righ[i] = i;
        }
        else
        {
            righ[i] = righ[i-1];
        }
    }
    for (int i = n - 1; i >= 0; i--)
    {
        if (s[i] == 'L')
        {
            lef[i] = i;
        }
        else
        {
            lef[i] = lef[i+1];
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            int x = righ[i];
            if ((i - x) % 2)
            {
                ans[x+1]++;
            }
            else
            {
                ans[x]++;
            }
        }
        else
        {
            int x = lef[i];
            if ((x - i) % 2)
            {
                ans[x-1]++;
            }
            else
            {
                ans[x]++;
            }
        }
    }
    for (auto it : ans)
        cout << it << " ";
    return 0;
}

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

int main() {
  int A,B,C,D;
  int S,T;
  cin >> A >> B >> C >> D;
  
  S = A;
  T = C;
  while (S > 0 && T > 0){
    T -= B;
    
    if (T > 0)
      S -= D;
  }  
  
  if (S > 0)
    cout << "Yes" << endl;
  
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)


const ll inf=2e18+5;

int main(){
    vector<ll> p(2), q(2);
    rep(i,2) cin>>p[i];
    rep(i,2) cin>>q[i];
    ll ans=-inf;
    rep(i,2){
        rep(j,2){
            ll kari=p[i]*q[j];
            ans=max(ans, kari);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int N,H[22]={},Ans;
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%d",&H[i]);
	Ans=1;
	for(int i=2;i<=N;i++){
		int f=0;
		for(int j=1;j<i;j++)
		 if(H[j]>H[i]){
		 	f++;
		 	break;
		 }
		if(!f) Ans++;
	}
	printf("%d\n",Ans);
	return 0;
}

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

int main(){
  string x;
  cin >> x;
  if (x[3] == x[2] && x[2] == x[1])
    cout << "Yes" << endl;
  else if (x[2] == x[1] && x[1] == x[0])
    cout << "Yes"<< endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3568
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, k = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))

c = 0
for i in range(n):
    c = c ^ a[i]

for i in range(n):
    print(c ^ a[i], end=" ")
















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

int N, M;
int a[1000];

int main()
{
    cin >> N >> M;
    int cnt = 0, total = 0;;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        total += a[i];
    }
    for (int i = 0; i < N; i++)
    {
        if (a[i] * 4 * M >= total)
        {
            cnt++;
        }
    }
    
    cout << (cnt >= M ? "Yes" : "No") << endl;
    // system("pause");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    ll num;
    cin >> num;
    string res = "";
    while(num != 0){
        num--;
        res = (char)('a'+(num%26)) + res;
        num /= 26;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end(),greater<int>());
  int a = 0;
  for(int i = 0; n > i; i++){
    if(i){
      a+=A[i];
    }else{
      a+=A[i]/2;
    }
  }
  cout << a << endl;
}
      
  

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
// vll x(n); x[i]=a;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;
typedef vector<vector<ll>> vvll;
// vvll x(m,vi(n)); x[i][j]=a;

#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    ll n, ans = 0, cnt = 0;
    cin >> n;
    vll a(n), b(n), c;
    cin >> a >> b;

    REP(id,n){
        if(b[id] == a[id]) cnt++;
        else if(b[id] > b[(id+n-1)%n] + b[(id+n+1)%n]) c.push_back(id);
    }

    while(c.size()){
        vll c_nex;
        REP(i,c.size()){
            ll id = c[i];
            ll tmp = (b[id]-a[id]) / (b[(id+n-1)%n]+b[(id+n+1)%n]);
            ans += tmp;
            b[id] -= tmp * (b[(id+n-1)%n]+b[(id+n+1)%n]);
            if(a[id] == b[id]) cnt++;

            if(b[(id+n-1)%n] != a[(id+n-1)%n] && b[(id+n-1)%n] > b[(id+n-2)%n] + b[id]) c_nex.push_back((id+n-1)%n);
            if(b[(id+n+1)%n] != a[(id+n+1)%n] && b[(id+n+1)%n] > b[(id+n+2)%n] + b[id]) c_nex.push_back((id+n+1)%n);
        }
        c = c_nex;
    }

    if(cnt == n) cout << ans << endl;
    else cout << -1 << endl;


    return 0;
}

Measured memory_bytes: 4912
#include<iostream>
#include<string>
#include<cassert>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
#define el endl
#define mod 1000000007
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	long long int count=0;
	long long int sum=0;
	for(int i=0;i<k;i++)sum+=n-2*i;
//	printf("%lld\n",sum);
	count=sum+1;
	for(int i=k;i<=n;i++){
		sum+=n-i;
		sum-=i;
//		printf("%lld\n",sum);
		count+=sum+1;
//		printf("%lld\n",count);
		count%=mod;
	}
	printf("%lld",count);
}

Measured memory_bytes: 3828
package main

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

func main() {
	sc := NewScanner()

	n := sc.NextInt()

	mx := -1
	min := 1 << 31
	for i := 0; i < n; i++ {
		tmp := sc.NextInt()
		if tmp < min {
			min = tmp
		}
		if tmp > mx {
			mx = tmp
		}
	}
	fmt.Printf("%v\n", mx-min)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.nextLine().toCharArray();

        int count = 0;
        for(char c: s) {
            if(c == '1') {
                count++;
            }
        }
        System.out.println(count);
        sc.close();
    }
}


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

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First& first, Rest&... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    string S;
    read(S);
    string ans = "Yes";
    for(ll i = 1; i <= S.size(); i++){
        if(i & 1) {
            if(S[i - 1] == 'L') ans = "No";
        }
        else {
            if(S[i - 1] == 'R') ans = "No";
        }
    }
    write(ans);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First& first, Rest&... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
constexpr int TEN(int n)
{
	return (n==0)?1:10*TEN(n-1);
}
struct Node
{
	using NP = Node*;
	int ma = -1;
	int get(int a, int b)
	{
		if (b <= 0 or sz <= a)
			return -1;
		if (a <= 0 and sz <= b)
			return ma;
		return max(l->get(a, b), r->get(a-sz/2, b-sz/2));
	}
	void set(int k, int x)
	{
		if (sz == 1)
		{
			ma = x;
			return;
		}
		if (k < sz/2)
			l->set(k, x);
		else
			r->set(k-sz/2, x);
		ma = max(l->ma, r->ma);
	}
	NP l, r;
	int sz;
	Node(int sz) : sz(sz)
	{
		if (sz == 1) return;
		l = new Node(sz/2);
		r = new Node(sz - sz/2);
	}
};
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int p[n], q[n];
	for (int i = 0; i < n; i++)
	{
		scanf("%d", p+i);
		p[i]--;
	}
	for (int i = 0; i < n; i++)
		q[p[i]] = i;
	Node* rmq = new Node(n);
	int mi[n];
	vector<vector<int>> g(n);
	for (int i = 0; i < n; i++)
	{
		{
			int v = rmq->get(max(0, q[i]-k+1), q[i]);
			if (v != -1)
			{
				int qv = q[v];
				g[q[i]].push_back(qv);
			}
		}
		{
			int v = rmq->get(q[i], min(n, q[i]+k));
			if (v != -1)
			{
				int qv = q[v];
				g[q[i]].push_back(qv);
			}
			rmq->set(q[i], i);
		}
		rmq->set(q[i], i);
	}
	int deg[n];
	fill_n(deg, n, 0);
	for (int i = 0; i < n; i++)
		for (int j: g[i])
			deg[j]++;
	priority_queue<int> que;
	for (int i = 0; i < n; i++)
		if (deg[i] == 0)
			que.push(i);
	vector<int> v;
	while (que.size())
	{
		int p = que.top();
		que.pop();
		v.push_back(p);
		for (int d: g[p])
		{
			deg[d]--;
			if (deg[d] == 0)
				que.push(d);
		}
	}
	reverse(v.begin(), v.end());
	int ans[n];
	for (int i = 0; i < n; i++)
		ans[v[i]] = i+1;
	for (int i = 0; i < n; i++)
		printf("%d\n", ans[i]);
}

Measured memory_bytes: 87796
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
int main() {
    abdelrahman010
    int n , a[N] , ans[N];
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
        if(i)
            a[i] ^= a[i - 1];
    }
    for(int i = 0;i < n;i++) {
        int x = a[min(i + n - 2 , n - 1)];
        if(i)
            x ^= a[i - 1];
        int rem = n - 1 - (min(i + n - 2 , n - 1) - i + 1);
        if(rem)
            x ^= a[rem - 1];
        ans[(i - 1 + n) % n] = x;
    }
    for(int i = 0;i < n;i++)
        cout << ans[i] << " ";
    return 0;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  rep(i, 7) {
    int A, B;
    cin >> A >> B;
    cout << (A - B) << endl;
  }
}


Measured memory_bytes: 3140
import * as fs from 'fs';

namespace AtCoder.abc106 {

    class ProgramB {
        args: string[];

        constructor(args: string[]) {
            this.args = args;
        }

        /**
         * in
         *  105
         * out
         *  1
         */
        main(): void {
            const n: number = parseInt(this.args[0], 10);
            let ans: number = 0;
            for (let i: number = 105; i < n + 1; i = i + 2) {
                let cnt: number = 0;
                for (let j: number = 1; j < i + 1; j++) {
                    if (i % j === 0) cnt++;
                }
                if (cnt === 8) {
                    ans++;
                }
            }
            console.log(ans);
        }
    }

    const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
    const prg = new ProgramB(args);
    prg.main();
}




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

int main(){
    unsigned long long int n,ans=0;
    cin >> n ;
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }else{
        for(unsigned long long int i=10;i<n+1;i=i*5){
            ans=ans+n/i;
        }
    }
    cout << ans << endl;
}


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

int main(){
    long long n;cin>>n;
    vector<long long> players(n);for(int i=0;i<n;i++){cin>>players[i];};
    sort(players.begin(), players.end(), greater<long long>());
    if (n == 2){
        cout << players[0] << endl;
    } else {
        long long num = n - 2;
        long long acc = players[0];
        for (int i=1;i<=(num/2);i++){
            acc += (2 * players[i]);
        }
        if (num % 2 == 1){
            acc += players[num / 2 + 1];
        }
        cout << acc << endl;
    }
    return 0;
}

Measured memory_bytes: 4760
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int digit(int x) {
    int d = 0;
    int c = 0;
    for(;x > 0;x /= 10) {
        d = d*10+x;
        c++;
    }

    return c&1;
}

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

    int ans = 0;
    for(int i = 1;i <= N;i++) {
        ans += digit(i);
    }

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
import numpy as np


def main():
    N = int(input().rstrip())
    a = np.array([int(i) for i in input().rstrip().split(' ')])

    c = 0
    for i, val in enumerate(a):
        if((i+1)%2 == 1 and val%2 == 1):
            c += 1
    print(c)

if __name__ == "__main__":
    main()


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

#define maxn 500010
#define fo(i,a,b) for(register int (i)=(a);(i)<=(b);++(i))
#define rd read()
#define inf 1e10
#define ll long long
int read() {
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int main() {
	ll n,m;
	scanf("%lld %lld",&n,&m);
	if(n==1||m==1)cout<<"1"<<endl;
	else printf("%lld\n",(n*m+1)/2);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<stw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;

int main(void){
    int N,K;cin>>N>>K;
    int count = 0;
    while(N!=0){
        N /= K;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import math


def solve(n, x_list, y_list):
    d_total = 0.0
    for i in range(n - 1):
        for j in range(i + 1, n):
            d_total += math.sqrt((x_list[i] - x_list[j]) ** 2 + (y_list[i] - y_list[j]) ** 2)
    return d_total * 2 / n


def main():
    n = int(input())
    x_list = [0] * n
    y_list = [0] * n
    for i in range(n):
        x, y = map(int, input().split())
        x_list[i] = x
        y_list[i] = y
    res = solve(n, x_list, y_list)
    print(res)


def test():
    assert abs(solve(3, [0, 1, 0], [0, 0, 1]) - 2.2761423749) < 0.000001
    assert abs(solve(2, [-879, -866], [981, 890]) - 91.9238815543) < 0.000001
    assert abs(solve(
        8, [-406, 512, 494, -955, 128, -986, 763, 449], [10, 859, 362, -475, 553, -885, 77, 310]
    ) - 7641.9817824387) < 0.000001


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3064
-- Try AtCoder
-- author: Leonardone @ NEETSDKASU

main = print . solve . map read . words =<< getContents

solve (n:xs) = ans where
    snuke = head xs
    arai  = last xs
    zs = tail $ take (n-1) xs
    ys = scanl (+) 0 zs
    total = last ys
    ans = foldl f (abs $ total + arai - snuke) ys
    f a y = min a $ abs $ (total - y + arai) - (y + snuke)



Measured memory_bytes: 80252
A, B, K = list(map(int, input().split()))

if A <= K:
    K = K - A
    A = 0
    if B <= K:
        K = K - B
        B = 0
    else:
        B = B - K
else:
    A = A - K 
        
print(str(A) + ' ' + str(B))

Measured memory_bytes: 9184
<?php

while ($line = trim(fgets(STDIN))) {
	$tokens = explode(' ', $line);
	$stack = array();
	foreach ($tokens as $t) {
		switch ($t) {
			case '+':
				$a = array_pop($stack);
				$b = array_pop($stack);
				array_push($stack, $b + $a);
				break;
			case '-':
				$a = array_pop($stack);
				$b = array_pop($stack);
				array_push($stack, $b - $a);
				break;

			case '*':
				$a = array_pop($stack);
				$b = array_pop($stack);
				array_push($stack, $b * $a);
				break;

			case '/':
				$a = array_pop($stack);
				$b = array_pop($stack);
				array_push($stack, $b / $a);
				break;
			default:
				array_push($stack, $t);
		}
	}
	echo array_pop($stack) . "\n";
}

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

int main() {
	int N, A, B;

	std::cin >> N >> A >> B;

	int ans = 0;
	int temp = 0;
	int temp2 = 0;

	for (int i = 1; i <= N; i++) {
		temp = 0;
		temp2 = i;

		while (temp2 > 0) {
			temp += temp2 % 10;
			temp2 /= 10;
		}

		if (A <= temp && temp <= B)
			ans += i;
	}

	std::cout << ans << std::endl;

	return 0;
}

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

int main(){
    int H,W;cin>>H>>W;
    vector<string> G(H);
    rep(i,H)cin>>G[i];
    vector<vector<ll>> dp(H,vector<ll>(W,0LL));
    dp[H-1][W-1]=1LL;
    for(int i=H-1;i>=0;i--){
        for(int j=W-1;j>=0;j--){
            if(G[i][j]=='#')continue;
            else{
                if(i-1>=0 && G[i-1][j]!='#'){dp[i-1][j]+=dp[i][j];dp[i-1][j]%=MOD;}
                if(j-1>=0 && G[i][j-1]!='#'){dp[i][j-1]+=dp[i][j];dp[i][j-1]%=MOD;}
            }
        }
    }
    cout<<dp[0][0]<<endl;
    return 0;
}

Measured memory_bytes: 9216
#include<stdio.h>
#include<string.h>
#define C 36

int number(char []);

main(){
  char barray[C][4],sarray[C][4],array[C][4],temp[4];
  int N,mini,flag=0;
  int i,j;
  
  scanf("%d",&N); /*given set of cards*/
  
  for(i=0; i<N; i++){
    scanf("%s",temp);  
    strcpy(barray[i],temp); 
    strcpy(sarray[i],temp);  
  }
  
  /*Bubble Sort */
  for(i=0; i<N; i++){
    for(j=N-1; j>i; j--){
      if(number(barray[j]) < number(barray[j-1])){
	strcpy(temp,barray[j]);
	strcpy(barray[j],barray[j-1]);
	strcpy(barray[j-1],temp);
      }
    }
  }
  
  for(i=0; i<N; i++){
    printf("%s",barray[i]);
    if(i < N-1)
      printf(" ");
  }
  printf("\n");
  printf("Stable\n");
  
  
  /*Selection Sort */
  for(i=0; i<N; i++){
    mini = i;
    for(j=i; j<N; j++){
      if(number(sarray[j])<number(sarray[mini]))
	mini = j; 
    } 
    strcpy(temp,sarray[i]);
    strcpy(sarray[i],sarray[mini]);
    strcpy(sarray[mini],temp);
  }
  
  for(i=0; i<N; i++){
    printf("%s",sarray[i]);
    if(i < N-1)
      printf(" ");
  }
  printf("\n");
  
  for(i=0; i<N; i++){
    if(strcmp(barray[i],sarray[i])){
      flag=1;
      printf("Not stable\n");      
      break;
    }
  }
    if(flag == 0)
    printf("Stable\n");

    return 0;
  
}

int number(char x[]){
  return x[1] - '0';
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    intl h[n];
    cin(i,h);
    intl cnt = 1;
    repi(i,1,n){
        bool f = true;
        rep(j, i){
            if(h[i] < h[j])f = false;
        }
        cnt += f;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
    LL N;
    cin >> N;
    LL ans = 0;
    for(LL i =1;i*i <= N;i++){
        if(N%i == 0)    ans = i;
    }
    cout << (ans+N/ans-2) << endl;
}

Measured memory_bytes: 256
# Aizu Problem 00160: Delivery Fee
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


tariff = {'A': {"size":  60, "weight":  2, "price":  600},
          'B': {"size":  80, "weight":  5, "price":  800},
          'C': {"size": 100, "weight": 10, "price": 1000},
          'D': {"size": 120, "weight": 15, "price": 1200},
          'E': {"size": 140, "weight": 20, "price": 1400},
          'F': {"size": 160, "weight": 25, "price": 1600}}

def get_fee(s, w):
    for t in ['A', 'B', 'C', 'D', 'E', 'F']:
        if s <= tariff[t]["size"] and w <= tariff[t]["weight"]:
            return tariff[t]["price"]
    return 0

    
while True:
    n = int(input())
    if n == 0:
        break
    fee = 0
    for _ in range(n):
        x, y, z, w = [int(__) for __ in input().split()]
        s = x + y + z
        fee += get_fee(s, w)
    print(fee)
        

Measured memory_bytes: 7792
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] arr = new int[2][n + 1];

		for (int i = 0; i < arr.length; i++) {
			for (int j = 1; j < arr[i].length; j++) {
				arr[i][j] = sc.nextInt();
			}
		}

		int[] a = arr[0];
		int[] b = arr[1];

		int[] c = new int[n];
		for (int i = 1; i < n; i++) {
			c[i] = sc.nextInt();
		}

		int sum = 0;
		int bef = n;
		for (int i = 1; i <= n; i++) {
			int dish = a[i];
			sum += b[dish];
			if (dish - 1 == bef) {
				sum += c[bef];
			}
			bef = a[i];
		}

		System.out.println(sum);

		sc.close();
	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 16010;

bool ox[2*MAX_N],oy[2*MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    s += 'T';
    int x,y;
    cin >> x >> y;
    int n = len(s);
    vector<int> u,v;
    int cnt = 0;
    bool flag = false;
    int nx,ny;
    int kind = 1;
    nx = ny = 0;
    rep(i,n){
        if(s[i] == 'F'){
            cnt++;
        }else{
            if(flag){
                if(cnt > 0){
                    if(kind == 1){
                        v.pb(cnt);
                    }else{
                        u.pb(cnt);
                    }
                }
                cnt = 0;
                kind ^= 1;
            }else{
                flag = true;
                nx += cnt;
                cnt = 0;
            }
        }
    }
    // svec(u),svec(v);
    // cout << nx << " " << ny << "\n";
    int mid = 16005;
    ox[mid] = oy[mid] = true;
    rep(i,len(u)){
        vi ch;
        rep(j,32010){
            if(ox[j]){
                ch.pb(j+u[i]), ch.pb(j-u[i]);
            }
        }
        rep(j,32010){
            ox[j] = false;
        }
        rep(j,len(ch)){
            ox[ch[j]] = true;
        }
    }
    rep(i,len(v)){
        vi ch;
        rep(j,32010){
            if(oy[j]){
                ch.pb(j+v[i]), ch.pb(j-v[i]);
            }
        }
        rep(j,32010){
            oy[j] = false;
        }
        rep(j,len(ch)){
            oy[ch[j]] = true;
        }
    }
    if(ox[x-nx+mid] && oy[y-ny+mid]){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int x = input(), y = input();

    range(t, 0, x + 1) {
        if (t * 2 + (x - t) * 4 == y) {
            cout << "Yes" << endl;
            return;
        }
    }

    cout << "No" << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define dep(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int n=in();
  vi a(n);
  EACH(i,a) cin>>i;
  sort(ALL(a),greater<int>());
  int nmin=1e9+1;
  int itr=0;
  REPS(i,1,n)
  {
    if(abs(a[0]/2-a[i])<nmin) 
    {
      nmin=abs(a[0]/2-a[i]);
      itr=i;
    }
  }
  cout<< a[0] << " " << a[itr] << endl; 

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define vvdebug(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

static int MOD = 1000000007;

ll modadd(ll x, ll y) {
	int xp = x % MOD;
	if (x < 0) x += MOD;
	int yp = y % MOD;
	if (y < 0) y += MOD;
	return (x + y) % MOD;
}

ll modsub(ll x, ll y) {
	return modadd(x, -y);
}

ll modmul(ll x, ll y) {
	return x * y % MOD;
}

// power(mod) x^n
ll modpow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = modmul(res, x);
		x = modmul(x, x);
		n >>= 1;
	}
	return res;
}

// inverse(mod) x^(-1)
ll inv(ll x) {
	return modpow(x, MOD - 2);
}

ll moddiv(ll x, ll y) {
	return modmul(x, inv(y));
}

// factorial(mod) n!
ll fact(ll n) {
	ll res = 1;
	while (n > 1) {
		res = modmul(res, n);
		n--;
	}
	return res;
}

// permutation(mod) nPr
ll permu(ll n, ll r) {
	if (r < 0 || n < r) return 0;
	else {
		ll res = fact(n);
		res = moddiv(res, fact(n - r));
		return res;
	}
}

// nPr(mod) (O(r))
ll mypermu(ll n, ll r) {
	if (r < 0 || n < r) return 0;
	else {
		ll res = 1;
		for (ll i = 0; i < r; i++) {
			res = modmul(res, n - i);
		}
		return res;
	}
}

// combination(mod) nCr
ll combi(ll n, ll r) {
	ll res = permu(n, r);
	res = moddiv(res, fact(r));
	return res;	
}

// nCr(mod) (O(r))
ll mycombi(ll n, ll r) {
	ll res = moddiv(permu(n, r), permu(r, r));
	return res;
}

int main () {
	int n, k; cin >> n >> k;
	vector<ll> f(n + 1), g(n + 1), h(n + 1);
	f.at(1) = 1; g.at(1) = n; h.at(1) = n - 1;
	rep2(i, 2, n + 1) {
		f.at(i) = modmul(f.at(i - 1), i);
		g.at(i) = modmul(g.at(i - 1), n - i + 1);
		h.at(i) = modmul(h.at(i - 1), n - i);
	}
	// vdebug(f); vdebug(g); vdebug(h);
	ll ans = mycombi(2 * n - 1, n -1);
	if (k < n - 1) {
		rep2(x, k + 1, n) {
			ll c1 = moddiv(g.at(x), f.at(x));
			ll c2 = moddiv(h.at(x), f.at(x));
			ans = modsub(ans, modmul(c1, c2));
		}
	}	
	cout << ans << endl;
}

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

int main(){
    int r,c;
    cin >> r >> c;
    int sum1[c+1];
    for(int i=0; i<c+1; i++){
        sum1[i] = 0;
    };
    for(int i=0; i<r; i++){
        int x[c];
        int sum = 0;
        for(int j=0; j<c; j++){
            cin >> x[j];
            sum += x[j];
            sum1[j] += x[j];
            cout << x[j] << " ";
        };
        cout << sum << endl;
    };
    for(int i=0; i<c; i++){
        cout << sum1[i] << " ";
        sum1[c] += sum1[i]; 
    };
    cout << sum1[c] << endl;
    return 0;
}


Measured memory_bytes: 3076
#最長共通部分列
# https://qiita.com/_rdtr/items/c49aa20f8d48fbea8bd2

#比較する文字列
s1 = input()
s2 = input()

table = [[0 for _ in range(len(s1))] for _ in range(len(s2))]

#0行目を埋める
f = 0
for i in range(len(s2)):
    if f or s2[i] == s1[0]:
        table[i][0] = 1
        f = 1

#0列目を埋める
f = 0
for i in range(len(s1)):
    if f or s2[0] == s1[i]:
        table[0][i] = 1
        f = 1


for i in range(1, len(s2)):
    for j in range(1, len(s1)):
        #上マスと左マスは考慮済みなので、左上から遷移する
        if s2[i] == s1[j]:
            table[i][j] += table[i-1][j-1]+1
        else:
            if i == 0 or j == 0:
                continue
            else:
                table[i][j] = max(table[i-1][j], table[i][j-1])

# for col in table:
#     print(col)

#最長文字列を求める
lcs_str = ""
i, j = len(s2)-1, len(s1)-1

while i >= 0 and j >= 0:
    # print("i", i, "j", j)
    if s2[i] == s1[j]:
        # print("c")
        lcs_str += s2[i] #or s2[j-1]
        i -= 1
        j -= 1
    else:
        if j == 0:
            i -= 1
        elif i == 0:
            j -= 1
        else:
            if table[i-1][j] > table[i][j-1]:
                i -= 1
            else:
                j -= 1
print(lcs_str[::-1])

Measured memory_bytes: 119516
char S[5<<17],*p=S,c;
b[5<<17];
I,l,r,t;
main(q)
{
	scanf("%*d%s%*d ",S);
	for(;*p;)b[++I]=1<<*p++-97;
	for(;q=~getchar();)
	{
		if(q&1)
		{
			scanf("%d%d ",&l,&r);t=0;
			for(int i=l;i<=r;i++)t|=b[i];
			printf("%d\n",__builtin_popcount(t));
		}
		else
		{
			scanf("%d %c ",&I,&c);
			b[I]=1<<c-97;
		}
	}
}


Measured memory_bytes: 2688
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var scan = new Scanner();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve(scan));
        Console.Out.Flush();
    }
    static object Solve(Scanner scan) {
        int K = scan.NextInt();
        var temp = 0;
        for (int i = 1; i <= K; i++) {
            temp = (10 * temp + 7) % K;
            if (temp == 0) return i;
        }
        return -1;
    }
}

class Scanner
{
    string[] s;
    int i;
    public Scanner() {
        s = new string[0];
        i = 0;
    }
    public string Next() {
        if (i < s.Length) return s[i++];
        string str = Console.ReadLine();
        while (str == "") str = Console.ReadLine();
        s = str.Split(' ', StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }
    public int NextInt() => int.Parse(Next());
}

Measured memory_bytes: 27532
#include<iostream>
using namespace std;
int h, w;
int main() {
	while (cin >> h >> w, h) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) cout << "#";
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3028
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>

typedef long long ll;
using namespace std;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;

const double EPS = 1e-8;

int main()
{
	string A[50],B[50];

	ll N=0,M=0,cnt=0,ans=0;

	cin >> N >> M;

	for(ll i=0;i<N;i++){
		cin >> A[i];
	}

	for(ll i=0;i<M;i++){
		cin >> B[i];
	}

	for(ll i=0;i<=N-M;++i){
		for(ll j=0;j<=N-M;++j){
			for(ll k=0;k<M;k++){
				for(ll m=0;m<M;m++){
					if(A[i+k][j+m]==B[k][m])
						cnt++;
				}
			}
			if(cnt==M*M){
				ans=1;
			}
			cnt=0;
		}
	}

	cout << ((ans==1) ? "Yes" : "No");
	
	return 0;
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    rep(s, 1000) {
        int l = (s == 0 ? 1 : log10(s) + 1);
        rep(i, n - l + 1) {
            int t = 0;
            rep(j, l) {
                t *= 10;
                t += a[i + j];
            }
            if (s == t) {
                break;
            }

            if (i == n - l) {
                cout << s << endl;
                return 0;
            }
        }
    }

}

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

namespace ProblemC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var Ss = new HashSet<string>();
            for (int i = 0; i < N; i++)
            {
                Ss.Add(Console.ReadLine());
            }

            Console.WriteLine(Ss.Count());
        }
    }
}


Measured memory_bytes: 47876
n, m = map(int, input().split())
l = list(map(int, input().split()))
arrs = [list(map(int, input().split())) for i in range(m)]

s = set()

for i in range(m):
    arr = arrs[i]
    if l[arr[0]-1] < l[arr[1]-1]:
        s.add(arr[0])
    elif l[arr[0]-1] == l[arr[1]-1]:
        s.add(arr[0])
        s.add(arr[1])
    else:
        s.add(arr[1])

ans = n - len(s)
print(ans)

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    
    for(int i = k; i < n; i++) {
        if(a.at(i-k) < a.at(i)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
}

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

template <typename T> T load() { T r; cin >> r; return r; }
template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto n = load<int>();
    auto k = load<int>();
    auto height = loadMany<int>(n);
    auto dyn = vector<int>(n, numeric_limits<int>::max());
    dyn[0] = 0;
    for (auto i=1; i<n; ++i) {
        // dyn[i] = dyn[i-1] + abs(height[i-1] - height[i]);
        // if (i >= 2)
            // dyn[i] = min(dyn[i], dyn[i-2] + abs(height[i] - height[i-2]));
        for (auto l=1; l<=k; ++l)
            if (i-l >= 0)
                dyn[i] = min(dyn[i], dyn[i-l] + abs(height[i] - height[i-l]));
    }
    cout << dyn[n-1] << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i > n; --i)
typedef long long ll;
#define mod 1000000007

int main() {
  int X; cin >> X;
  int cur = 0;
  rep(i, 1, X + 1) {
    cur += i;
    if(cur >= X) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
H = list(map(int, input().split()))

LL = []
for i in range(M):
    a,b = map(int, input().split())
    if H[a-1] > H[b-1]:
        LL.append(b)
    elif H[a-1] < H[b-1]:
        LL.append(a)
    elif H[a-1] == H[b-1]:
        LL.append(a)
        LL.append(b)

LLS = set(LL)
print(N-len(LLS))

Measured memory_bytes: 20000