akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> a(N,0);
  vector<int> packet(N+1,0);
  vector<int> p;

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

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

  for (auto it = packet.begin(); it != packet.end(); ++it) {
    if(*it != 0) p.push_back(*it);
  }

  int size = p.size(), count=0;
  for (int i = 0; i < N; ++i) {
    if(size > K){
      count+=p[i];
      --size;
    }else{
      cout << count << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 2936
// 9*9
#include <iostream>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a<=9 && a>=1 && 1<=b && b<=9){
        cout << a*b << endl;
    }
    else{
        cout << "-1" << endl;
    }
    return 0;

}

Measured memory_bytes: 256
// Problem : D - Min Max Repetition
// Contest : AtCoder - AtCoder Grand Contest 020
// URL : https://atcoder.jp/contests/agc020/tasks/agc020_d
// Memory Limit : 512 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <cmath>
#include <iostream>
using namespace std;
int a,b,c,d,k;
int ra,rb;
bool check(int pos)
{
 ra=a-pos/(k+1)*k-pos%(k+1);
 rb=b-pos/(k+1);
 return 1ll*ra*k>=rb;
}
int main()
{
 int t;
 cin>>t;
 while(t--)
 {
  cin>>a>>b>>c>>d;
  k=max(ceil(1.0*a/(b+1)),ceil(1.0*b/(a+1)));
  int l=0,r=a+b;
  while(l<r)
  {
   int mid=(l+r)>>1;
   if(check(mid))
    l=mid+1;
   else
    r=mid;
  }
  check(l);
  r=l+1+rb-ra*k;
  for(int i=c;i<=d;i++)
   if(i<=l)
   {
    if(i%(k+1))cout<<'A';
    else cout<<'B';
   }
   else
   {
    if((i-r)%(k+1))cout<<'B';
    else cout<<'A';
   }
  cout<<endl;
 }
 return 0;
}

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

using namespace std;

int depth[100005], father[100005], son[100005], size[100005], dis[100005];
struct Edge { int to, color, len; };
vector<Edge> edge[100005];

void dfs1(int x, int f)
{
    depth[x]  = depth[f] + 1;
    father[x] = f;
    son[x]    = 0;
    size[x]   = 1;
    for (int i = 0, i_END_ = edge[x].size(); i < i_END_; ++i) {
        int y = edge[x][i].to;
        if (y == f) continue;
        dis[y] = dis[x] + edge[x][i].len;
        dfs1(y, x);
        size[x] += size[y];
        if (size[y] > size[son[x]]) son[x] = y;
    }
    return;
}

int peak[100005];

void dfs2(int x, int t)
{
    peak[x] = t;
    if (son[x] != 0) dfs2(son[x], t);
    for (int i = 0, i_END_ = edge[x].size(); i < i_END_; ++i) {
        int y = edge[x][i].to;
        if (y == father[x] || y == son[x]) continue;
        dfs2(y, y);
    }
    return;
}

int lca(int x, int y)
{
    while (peak[x] != peak[y])
        if (depth[peak[x]] > depth[peak[y]])
            x = father[peak[x]];
        else y = father[peak[y]];
    return depth[x] < depth[y] ? x : y;
}

int ans[100005], color_sum[100005], color_cnt[100005];
struct Query { int idx, color, len, val; };
vector<Query> query[100005];

void dfs3(int x, int f)
{
    for (int i = 0, i_END_ = query[x].size(); i < i_END_; ++i) {
        int color = query[x][i].color, len = query[x][i].len;
        ans[query[x][i].idx] += (dis[x] - color_sum[color] +
                                 color_cnt[color] * len) * query[x][i].val;
    }
    for (int i = 0, i_END_ = edge[x].size(); i < i_END_; ++i) {
        int y = edge[x][i].to;
        if (y == f) continue;
        ++color_cnt[edge[x][i].color];
        color_sum[edge[x][i].color] += edge[x][i].len;
        dfs3(y, x);
        --color_cnt[edge[x][i].color];
        color_sum[edge[x][i].color] -= edge[x][i].len;
    }
    return;
}

int n, q;

int main(void)
{
    scanf("%d%d", &n, &q);
    for (int i = 1; i < n; ++i) {
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        edge[a].push_back((Edge){b, c, d});
        edge[b].push_back((Edge){a, c, d});
    }
    dfs1(1, 0);
    dfs2(1, 1);
    for (int i = 1; i <= q; ++i) {
        int x, y, u, v;
        scanf("%d%d%d%d", &x, &y, &u, &v);
        query[u].push_back((Query){i, x, y, 1});
        query[v].push_back((Query){i, x, y, 1});
        query[lca(u, v)].push_back((Query){i, x, y, -2});
    }
    dfs3(1, 0);
    for (int i = 1; i <= q; ++i)
        printf("%d\n", ans[i]);
    return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
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; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void){
    string s;cin>>s;
    int ans=0;
    rfor(c,s){
        if(c=='+')ans++;
        else ans--;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vi vec[200001];
int x[200001]={};
int dp[200001];

int main() {
	int n;
	float x[9];
	float y[9];
	cin>>n;
	rep(i,n)cin>>x[i]>>y[i];
	float r=0;
	rep(i,n){
		float r2=0;
		rep(j,n){
			r2+=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
		}
		r+=r2/(float)n;
	}
	printf("%.12f",r);
	return 0;
}


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

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

ans = (2, 2)

for div in reversed(nums):
    lower = (ans[0] + div - 1) // div * div
    upper = ans[1] // div * div
    if not lower <= upper:
        print(-1)
        exit()
    
    ans = (lower, upper + div - 1)

print(f'{ans[0]} {ans[1]}')


Measured memory_bytes: 20460
m, d = map(int, input().split())
cnt = 0
for i in range(1, m + 1):
    for j in range(1, d + 1):
        # print(i, j)
        if j % 10 >= 2 and (j // 10) >= 2 and j % 10 * (j // 10) == i:
            cnt += 1
print(cnt)


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

int N;
int march[5] = { 0 };

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { 
		string s;
		cin >> s;
		if (s[0] == 'M') march[0]++;
		if (s[0] == 'A') march[1]++;
		if (s[0] == 'R') march[2]++;
		if (s[0] == 'C') march[3]++;
		if (s[0] == 'H') march[4]++;
	}

	ll ans = 0;
	int bit[5] = { 0,0,1,1,1 };
	do {
		ll tmp = 1;
		for (int i = 0; i < 5; i++) {
			if (bit[i] == 1) tmp *= march[i];
		}
		ans += tmp;
	} while (next_permutation(bit, bit + 5));

	cout << ans << endl;
}

Measured memory_bytes: 256
/*
 * ABC092_B.cpp
 *
 *  Created on: May 21, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N,D,X;
	cin >> N >> D >> X;
	int ate = 0;
	REP(i, N) {
		int a, numa = 1;
		cin >> a;
		while(numa <= D) {
			++ate;
			numa  += a;
		}
	}
	
	cout << X+ate << endl;
}






Measured memory_bytes: 256
/*Round-Robin Scheduling*/
#include<stdio.h>

typedef struct process{
  char name[10];
  int time;
}Proccess;

main(){
  int n, q, i, j, flag=0, temp=0;
  Proccess pro[1001];
  int counter=0;

  scanf("%d%d",&n,&q);
  if(n<1||n>1000||q<1||q>1000) return 0; /*1<=n<1000,1<=q<=1000 */

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

  while(1){                            /* enqueue: This while loop enqueue pro[i] when pro[i].time is not less thanzero.*/
    for(i=0;i<n;i++){
      pro[i].time=pro[i].time-q;
      if(pro[i].time<=0){
        counter=counter+(pro[i].time+q);
        printf("%s %d\n",pro[i].name,counter);
        for(j=i;j<n-1;j++){
          pro[j]=pro[j+1]; /* overwrite */
        }
        n--;                        /* dequeue: this and upper overwite */
        i--;
      } else counter=counter+q;
    }
    if(n==0)break;                /* This if sentens break while loop when queue is empty.*/
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#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 MOD 1000000007
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
        sum %= MOD;
    }
    ll ans = 0;
    rep(i, n - 1) {
        sum -= a[i];
        if (sum < 0) {
            sum += MOD;
        }
        ans += a[i] * sum;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

a = []
for i in range(n):
    d,e = map(int,input().split())
    a.append([d,e])


b = []
for i in range(n):
    if a[i][0] == a[i][1]:
        b.append(1)
    else:
        b.append(0)

c = 0
for i in range(n-2):
    if b[i] == 1 and b[i+1] == 1 and b[i+2] == 1:
        c = 1
        break

if c == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9200
type UF
	n::Int
	pr::Array{Int}
	sz::Array{Int}
	UF(n)=new(n,1:n,ones(Int,n))
end
function find(uf::UF,a::Int)
	if uf.pr[a]==a
		a
	else
		uf.pr[a]=find(uf,uf.pr[a])
	end
end
same(uf::UF,a::Int,b::Int)=find(uf,a)==find(uf,b)
function unite(uf::UF,a::Int,b::Int)
	ap=find(uf,a)
	bp=find(uf,b)
	if ap==bp
		false
	else
		if uf.sz[ap]<uf.sz[bp]
			uf.pr[ap]=bp
			uf.sz[bp]+=uf.sz[ap]
		else
			uf.pr[bp]=ap
			uf.sz[ap]+=uf.sz[bp]
		end
		true
	end
end
size(uf::UF,a::Int)=uf.sz[find(uf,a)]
function main()
	N,M,K=map(x->parse(Int,x),split(readline()))
	uf=UF(N)
	G=[Int[] for _=1:N]
	cnt=0
	for s=readlines()
		a,b=map(x->parse(Int,x),split(s))
		push!(G[a],b)
		push!(G[b],a)
		cnt+=1
		if cnt<=M
			unite(uf,a,b)
		end
	end
	for i=1:N
		ans=size(uf,i)
		for v=G[i]
			if same(uf,i,v)
				ans-=1
			end
		end
		println(ans-1)
	end
end
main()


Measured memory_bytes: 185376
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

ll cs[200001];

int main() {
    int N, a;
    cin >> N;
    REP(i, N) {
        cin >> a;
        cs[i + 1] = a + cs[i];
    }

    ll ans = 1000000000000000000LL;
    FOR(i, 1, N) {
        ans = min(abs(cs[N] - 2 * cs[i]), ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
const ll mod=1e9+7;
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    int t,d;
    cin>>t>>d;
     int c=0;
    while(t--)
    {
        ll x,y;
        cin>>x>>y;
        double dis=sqrt(x*x+y*y);
        if(dis<=(double)d)
            c++;

    }
     cout<<c<<endl;






}

























































Measured memory_bytes: 3692
import math
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i],B[i] = map(int,input().split())
A.sort()
B.sort()
if N % 2 == 0:
    print(int(((B[N//2]+B[N//2-1])/2 - (A[N//2]+A[N//2-1])/2)*2 + 1))
else:
    print(B[N//2] - A[N//2] + 1)

Measured memory_bytes: 25516
#include <iostream>

using namespace std;

int main ( void )
{
  int a, b;
  while (cin >> a >> b)
  {
    int c = a + b, digit = 0;

    do
    {
      c /= 10;
      ++digit;
    } while (c);

    cout << digit << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
package main

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

func main() {
	io := newIo()
	defer io.flush()

	s := io.nextString()
	K := io.nextInt()
	N := len(s)

	lst := []string{}
	for i := 0; i < N; i++ {
		lst = append(lst, s[i:])
	}
	sort.Strings(lst)
	dic := map[string]struct{}{}

	for i := range lst {
		for j := 0; j < len(lst[i]); j++ {
			tmp := lst[i][:j+1]
			if _, in := dic[tmp]; !in {
				K--
				dic[tmp] = struct{}{}
			}
			if K == 0 {
				io.println(tmp)
				return
			}
		}
	}
}

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

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

func (io *io) flush() {
	_ = io.writer.Flush()
}

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

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

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}

func (io *io) print(a ...interface{}) {
	fmt.Fprint(io.writer, a...)
}

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

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


Measured memory_bytes: 1024
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def sum_range(self, x, y):
        return self.sum(y) - self.sum(x - 1)
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


if __name__ == '__main__':
    n, q = map(int, input().split())
    bit = Bit(n)
    for _ in range(q):
        com, x, y = map(int, input().split())
        if com == 0:
            bit.add(x, y)
        else:
            print(bit.sum_range(x, y))


Measured memory_bytes: 7928
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
int n,b[400000];
vector<int>ans;
string s;
signed main(){
    cin>>n>>s;
    if(s[0]=='#')b[0]++;
    rep(i,n){
        if(i==0){
            if(s[0]=='#')b[0]=1;
        }
        else{
            if(s[i]=='#')b[i]=b[i-1]+1;
            else b[i]=b[i-1];
        }
    }
    cout<<endl;
    rep(i,n){
        int bb=b[i];
        int bw=(i+1)-b[i];
        int ab=b[n-1]-b[i];
        int aw=(n-b[n-1])-bw;
        int a[]={b[n-1],n-b[n-1],bb+aw};
        sort(a,a+3);
        ans.push_back(a[0]);
    }
    sort(ans.begin(),ans.end());
    cout<<ans[0]<<endl;
    return 0;
}

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

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> mp1, mp2;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mp1[i - a[i]]++;
        mp2[a[i] + i]++;
    }
    int ans = 0;
    for (auto p : mp1) {
        ans += p.second * mp2[p.first];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 39016
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	vector<long> a(5);
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
	ll ans=1000000;
	rep(i,5){
		ll cnt=0;
		rep(j,5){
			if(i==j)cnt+=a[j];
			else cnt+=(a[j]%10==0?a[j]:(a[j]/10+1)*10);
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()

from1 = set()
toN = set()

for _ in range(m):
    a,b = li()
    if a==1:
        from1.add(b)
    elif b==1:
        from1.add(a)
        
    elif a==n:
        toN.add(b)
    elif b==n:
        toN.add(a)

if from1 & toN:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 19036
#include <bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define int long long
#define forn(i,a,b) for (int i=a; i<b; i++)
#define MOD 1000000000+7;

using namespace std;

void solve (){
	int n;
	cin>>n;
	int A[n],B[n];
	forn(i,0,n) cin>>A[i];
	forn(i,0,n) cin>>B[i];
	vector <int> v(n);
	iota(all(v),1);
	int a=1,b=1;
	do {
		int cnt=0;
		for (int i=0; i<n; i++) {
			if (A[i]!=v[i]) {
				cnt=-1;
				break;
			}
		}
		if (!cnt) break;
		a++;
	}
	while (next_permutation(all(v)));
	iota(all(v),1);
	do {
		int cnt=0;
		for (int i=0; i<n; i++) {
			if (B[i]!=v[i]) {
				cnt=-1;
				break;
			}
		}
		if (!cnt) break;
		b++;
	}
	while (next_permutation(all(v)));
	cout<<abs(a-b)<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    int t=1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace B_ABC145
{
    class MainClass
    {

        static int[] n;

        public static void Main(string[] args)
        {
            
            n = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            string s = ReadLine();
            if(n[0]%2==1){
                WriteLine("No");
                return;
            }
            int mid = n[0]/2;
            string s1 = s.Substring(0,mid);
            string s2 = s.Substring(mid,mid);

            if(s1==s2){
                WriteLine("Yes");
                return;
            }else{
                WriteLine("No");
                return;

            }

            
        }
    }
}


Measured memory_bytes: 13268
'use strict';

var hasN = false;
// p1: 2D split
// p2: space split
// p3: line split
function main(p1, p2, p3, so) {
  var time = Number(p1[0][1]);
  p1.shift();
  p1 = p1.filter(function (e) {
    return time >= Number(e[1]);
  });
  if (p1.length == 0) {
    console.log("TLE");return;
  }
  p1 = p1.map(function (e) {
    return e[0];
  });
  console.log(Math.min.apply(null, p1));
}
function common(a) {
  var line = a.split('\n').slice(0, a.split('\n').length - 1);
  var p2 = line[0].split(' ');
  if (hasN) line = line.slice(1);
  var p1 = line.map(function (e) {
    return e.split(' ');
  });
  main(p1, p2, line, a);
}
common(require("fs").readFileSync("/dev/stdin", "utf8"));


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

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

using namespace std;

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

struct edge
{
	int to;
	int cost;

	edge(int to,int cost) : to(to),cost(cost) {}
};

vector<edge> G[3001];
vector<edge> G2[3001];
ll d[3001];

void dijkstra(int s,int n,int type)
{
	priority_queue<P,vector<P>,greater<P> > que;
	fill(d,d+n,INF);
	d[s] = 0;
	que.push(P(0,s));

	while(!que.empty())
	{
		P p = que.top();
		que.pop();

		ll v = p.second;
		if(d[v] < p.first) continue;


		if(type == 0)
		{
			rep(i,G[v].size())
			{
				edge e = G[v][i];
				if(d[e.to] > d[v] + e.cost)
				{
					d[e.to] = d[v] + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}
		}
		else
		{
			rep(i,G2[v].size())
			{
				edge e = G2[v][i];
				if(d[e.to] > d[v] + e.cost)
				{
					d[e.to] = d[v] + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}
		}


	}
}

int main()
{
	int n,m;
	while(cin >> n >> m)
	{
		if(n == 0 && m == 0) break;

		rep(i,m)
		{
			G[i].clear();
			G2[i].clear();
		}

		rep(i,n)
		{
			int a,b,cost,time;
			cin >> a >> b >> cost >> time;
		
			a--;
			b--;

			G[a].push_back(edge(b,cost));
			G[b].push_back(edge(a,cost));

			G2[a].push_back(edge(b,time));
			G2[b].push_back(edge(a,time));
		}

		int k;
		cin >> k;

		rep(i,k)
		{
			int s,t,type;
			cin >> s >> t >> type;

			s--;
			t--;

			dijkstra(s,m,type);
			cout << d[t] << endl;
		}

	}
	return 0;
}

Measured memory_bytes: 1460
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

int main(){
    ll n;
    cin >> n;
    ll ans = 1;
    for (ll i = 1; i <= n; i++) {
        ans *= i;
        ans %= 1000000007;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define int long long
signed main(signed argc, char* argv[]) {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	vector<pair<int,bool>> task(n,{0,true});
	int ans=0,pena=0;
	rep(i,m){
	    int p;
	    string s;
	    cin>>p>>s;
	    if(s=="WA")task[p-1].first++;
	    else if(task[p-1].second){
	        task[p-1].second=false;
	        ans++;
	        pena+=task[p-1].first;
	    }
	}
	cout<<ans<<" "<<pena<<endl;
}

Measured memory_bytes: 1792
class queue():
    def __init__(self):
        self.Q = []
    
    def enqueue(self, x):
        self.Q.append(x)
        
    def dequeue(self):
        return self.Q.pop(0)
    
    def isEmpty(self):
        if len(self.Q) == 0:
            return True
        else:
            return False
    
n, q = map(int, input().split())
RRS = queue()
for _ in range(n):
    prcs = input().split()
    RRS.enqueue([prcs[0], int(prcs[1])])

time = 0
while True:
    if RRS.isEmpty():
        break
    prcs = RRS.dequeue()
    c = min(prcs[1], q)
    prcs[1] -= c
    time += c
    if prcs[1] > 0:
        RRS.enqueue(prcs)
    else:
        print(prcs[0], time)


Measured memory_bytes: 13020
n=int(input())
left=list(map(int,input().split()))
right=list(left)
right.reverse()
gcds=[]
gcdleft=[]
gcdright=[]

gcdleft.append(left[0])
gcdright.append(right[0])

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

if n==2:
    gcds.append(gcdleft[0])
    gcds.append(gcdright[0])
else:
    for i in range(1,n-1):
        gcdleft.append(gcd(gcdleft[i-1],left[i]))
        gcdright.append(gcd(gcdright[i-1],right[i]))
    gcds.append(gcdright[-1])
    for i in range(0,n-2):
    	gcds.append(gcd(gcdleft[i],gcdright[n-3-i]))
    gcds.append(gcdleft[-1])

print(max(gcds))

Measured memory_bytes: 14076
#include <stdio.h>

int main(void){
    int n,m[3],i;

    scanf("%d",&n);

    m[0]=n/100;
    m[1]=n%100/10;
    m[2]=n%10;
    
    
    for(i=0; i<3; i++){
        if(m[i]==1)
            m[i]=9;
        else if(m[i]==9)
            m[i]=1;
    }

    printf("%d\n",m[0]*100+m[1]*10+m[2]);
}


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

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

    float p;
    if(N%2 == 0){
        p = 0.5;
        //cout<<"run"<<endl;
    }
    else{
        p = (1.0+(N-1.0)/2.0)/N;
        //cout<<"run"<<endl;
    }
    cout<<p<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
	h, w = map(int, input().strip().split())
	a = [[] for _ in range(h)]
	for i in range(h):
		a[i] = list(input().strip())
	for i in range(h):
		flag = True
		for j in range(w):
			if a[i][j] == '#':
				flag = False
				break
		if flag:
			a[i] = [-1] * w
	for j in range(w):
		flag = True
		for i in range(h):
			if a[i][j] == '#':
				flag = False
				break
		if flag:
			for i in range(h):
				a[i][j] = -1
	# print(a)
	for i in range(h):
		for j in range(w):
			if a[i][j] != -1:
				print("{}".format(a[i][j]), end="")
		print("")
if __name__ == '__main__':
	main()


Measured memory_bytes: 44636
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	x := scanInt()
	xs := scanInts(n)
	ans := abs(xs[0] - x)
	for i := 0; i < n; i++ {
		ans = gcd(ans, abs(x-xs[i]))
	}
	fmt.Fprintln(wr, ans)
}

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}


Measured memory_bytes: 2944
str = input()
q = int(input())
for x in range(q):
    en = input().split()
    if en[0] == "print":
        print(str[int(en[1]):int(en[2])+1])
    elif en[0] == "reverse":
        str = str[:int(en[1])] + str[int(en[1]):int(en[2])+1][::-1] + str[int(en[2])+1:]
    else:
        str = str[:int(en[1])] + en[3] + str[int(en[2])+1:]




Measured memory_bytes: 5616
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    int A,N;
    cin>>N;
    if(N%10==9 || N/10==9){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define LLIandI pair<long long int , int>
#define ll long long


/*
第3週課題
Make Purse Light
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2007
第三回の着席位置は{前から二列目}*{教卓に向かって左から３席目}


*/
int main(){
    bool syokai=true;
    while(1){
        int N=0;
        scanf("%d",&N);
        if(N==0)return 0;
        if(syokai)syokai=false;
        else printf("\n");
        int n[5];// 10 円玉、50 円玉、100 円玉、500 円玉の枚数
        int n_kind[5]={10,50,100,500};
        int ans[5];
        int syojikin=0;
        rep(i,4){
            scanf("%d",&n[i]);
            syojikin+=n[i]*n_kind[i];
            ans[i]=0;
        }
        //全部払ってみる
        int over=syojikin-N;
        //店員がお釣りを返すことを考える
        //この時、500円から返す
        for(int i=3;i>-1;i--){
            ans[i]=max(n[i]-(over/n_kind[i]),0);
            over%=n_kind[i];
        }
        rep(i,4){
            if(ans[i]>0){
                printf("%d %d\n",n_kind[i],ans[i]);
            }
        }
    }
}


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

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

  char c;
  bool flag = false;
  for(int i = 0; i < n; i++){
    cin >> c;
    if(c == 'Y'){
      flag = true;
    }
  }

  if(flag == true)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+4;
int n,m;
ll K;
ll a[N],b[N];
inline 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;
}
inline void smax(int &x,int y) {
	x=x<y?y:x;
}
int main() {
	n=read(),m=read(),K=read();
	for (register int i=1;i<=n;++i) a[i]=a[i-1]+read();
	for (register int i=1;i<=m;++i) b[i]=b[i-1]+read();
	int ans=0;
	for (register int i=0;i<=n;++i) {
		if (a[i]>K) break;
		int res=K-a[i];
		int pos=upper_bound(b+1,b+m+1,res)-b-1;
		smax(ans,i+pos);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;

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

    int n, t;
    cin >> n >> t;
    vector< P > ab(n);
    rep (i, n)
    {
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab.begin(), ab.end());

    int dp[n + 1][t + 1];
    rep (i, n + 1) rep (j, t + 1) dp[i][j] = 0;

    rep (i, n)
    {
        rep (j, t)
        {
            if (j < ab[i].first)
            {
                dp[i + 1][j] = dp[i][j];
            }
            else
            {
                dp[i + 1][j] = MAX(dp[i][j], dp[i][j - ab[i].first] + ab[i].second);
            }
        }
        dp[i + 1][t] = MAX(dp[i][t], dp[i][t - 1] + ab[i].second);
    }

    cout << dp[n][t] << "\n";
    return 0;
}



Measured memory_bytes: 35456
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const n: number = +input[0];

let ans: number = 0;

for(let i = 1; i <= n; i++){
    const li: string[] = String(i).split('');
    if (li.length % 2 !== 0){
        ans++;
    }
}
console.log(ans);

Measured memory_bytes: 13628
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	// cin >> t;
	while (t--) {
		string s;
		cin>>s;
		if(s[s.length()-1]=='s'){
			cout<<s<<"es";
		}else{
			cout<<s<<'s';
		}
		cout<<endl;
	}

	return 0;

}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100005],p[100005];
set<ll> s;
int main(){
    ll n,ans=0;
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
        p[a[i]]=i;
    }
    s.insert(0);s.insert(n+1);
    for(ll i=n;i>=1;i--){
        auto x=s.upper_bound(p[i]);
        auto y=--s.upper_bound(p[i]);
        if(*y!=0){
            auto t=--y;y++;
            ans+=(*x-p[i])*(*y-*t)*i;
        }
        if(*x!=n+1){
            auto t=++x;x--;
            ans+=(p[i]-*y)*(*t-*x)*i;
        }
        s.insert(p[i]);
    }
    cout<<ans<<endl;
}

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

int main(){
    int p,r,t;
    cin>>p>>r>>t;
    vector<int> l(r);
    for(int i=0;i<r;i++) cin>>l[i];
    vector<vector<int>> n(p,vector<int>(r));
    for(int i=0;i<p;i++)for(int j=0;j<r;j++) cin>>n[i][j];

    vector<int> pv(t),rv(t);
    for(int i=0;i<t;i++) cin>>pv[i]>>rv[i],pv[i]--,rv[i]--;
    int lb=0,ub=t+1;
    
    while(ub-lb>1){
        int mid=(lb+ub)/2;
        auto rest=l;
        auto tmpn=n;
        for(int i=0;i<mid;i++){
            if(rest[rv[i]]){
                rest[rv[i]]--;
                tmpn[pv[i]][rv[i]]--;
                if(count(tmpn[pv[i]].begin(),tmpn[pv[i]].end(),0)==r){
                    tmpn[pv[i]]=n[pv[i]];
                    for(int j=0;j<r;j++) rest[j]+=n[pv[i]][j];
                }
            }
        }
        vector<int> used(p);
        int cnt=0;
        for(int loop=0;loop<p;loop++){
            for(int i=0;i<p;i++){
                if(used[i]) continue;
                bool isdead=false;
                for(int j=0;j<r;j++){
                    isdead=(isdead || rest[j]<tmpn[i][j]);
                }
                if(!isdead){
                    cnt++;
                    for(int j=0;j<r;j++){
                        rest[j]+=n[i][j]-tmpn[i][j];
                    }
                    used[i]=true;
                    break;
                }                
            }
        }
        if(cnt==p){
            lb=mid;
        }
        else{
            ub=mid;
        }
    }
    if(ub==t+1){
        cout<<-1<<endl;
    }
    else{
        cout<<lb+1<<endl;
    }


    
    return 0;
}


Measured memory_bytes: 5232
#include<cstdio>
#include <iostream>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
    if (y == 0) {
        return x;
    }
    return gcd(y, x % y);
}

int main() {
    /*
     * a と b がありました.
     * その時の...
     * g = 最大公約数 <- ユークリッドの互除法で出せる
     * l = 最小公倍数
     *
     * a x b = g x l を変形すればlgを簡単に求められる
     *
     */


    ll a, b, c, d, ans = 0;
    cin >> a >> b >> c >> d;

    // これa-1以下の公約数も足しちゃってるから引かないとだめだよね
    ans += b; // 範囲から割り切れるやつを引く
    ans -= b / c;
    ans -= b / d;
    ans += b / (c * d / gcd(c, d)); // c*d / g = l で最小公倍数が求められる
    // bをcとdの最小公倍数で割ると２つかぶりを潰せる

    // a-1より下の領域を引いて, bの約数はa以下も引いてしまっているので足して戻す
    --a;
    ans -= a;
    ans += a / c;
    ans += a / d;
    ans -= a / (c * d / gcd(c, d));

    cout << ans << endl;
}

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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	int H,W;
	while(true){
		cin >> H >> W;
		if(H==0 && W == 0){
			break;
		}
		for (int j = 0; j < W; ++j) {
			print("#");
		}
		println("");
		for (int i = 1; i < H-1; ++i) {
			print("#");
			for (int j = 1; j < W-1; ++j) {
				print(".");
			}
			print("#");
			println("");
		}
		for (int j = 0; j < W; ++j) {
			print("#");
		}
		println("");
		println("");
	}

	return 0;
}



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


int main() {
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = x2 - x1;
    int b = y2 - y1;
    cout << x2 - b << endl;
    cout << y2 + a << endl;
    cout << x1 - b << endl;
    cout << y1 + a << endl;
}



Measured memory_bytes: 3604
def main():
  import sys
  input = sys.stdin.readline
  n,k=map(int,input().split())
  h=tuple(map(int,input().split()))
  dp=[0]*(n+1)
  for i in range(2,n+1):
    a=min(i-1,k)+1
    m=float('inf')
    for j in range(1,a):
      x=dp[i-j]+abs(h[i-1]-h[i-j-1])
      m=x if m>=x else m
    dp[i]+=m
  print(dp[-1])
if __name__=='__main__':
  main()

Measured memory_bytes: 55004
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int ans=0;
        for(int i=0,x,y,h,w;i<n;i++){
            cin>>x>>y>>h>>w;
            x+=y+h;
            if(x<=60&&w<=2)ans+=600;
            else if(x<=80&&w<=5)ans+=800;
            else if(x<=100&&w<=10)ans+=1000;
            else if(x<=120&&w<=15)ans+=1200;
            else if(x<=140&&w<=20)ans+=1400;
            else if(x<=160&&w<=25) ans+=1600;
        }
        cout<<ans<<endl;
    }
}

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

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

  int ans;
  while (1) {
    int n = S.size();
    S.erase(n - 2, 2);
    n -= 2;
    string sub1 = S.substr(0, n / 2);
    string sub2 = S.substr(n / 2);
    if (sub1 == sub2) {
      ans = n;
      break;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[15][114514];
int main(){
	string s;
	cin>>s;
	ll n=s.size();
	if(s[n-1]=='?')for(int i=0;i<=9;i++)dp[i][1]++;
	else dp[(s[n-1]-'0')][1]++;
	ll mod=1e9+7,now=1;
	for(int i=n-2;i>=0;i--){
		now*=10;
		now%=13;
		if(s[i]=='?'){
			for(int j=0;j<=9;j++){
				 ll x=j*now%13;
				 for(int k=0;k<=12;k++){
					 dp[k][n-i]+=dp[(13+k-x)%13][n-i-1];
					 dp[k][n-i]%=mod;
				 }
			}
		}else{
			ll x=s[i]-'0';
			x=x*now%13;
			for(int k=0;k<=12;k++){
				dp[k][n-i]+=dp[(13+k-x)%13][n-i-1];
				dp[k][n-i]%=mod;
			}
		}
	}
	cout<<dp[5][n]<<endl;
	return 0;
}


Measured memory_bytes: 13872
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

int main() {
	int a, b, c, d, e;
	std::cin >> e;
	a = e / 1000;
	e = e - e / 1000 * 1000;
	b = e / 100;
	e = e - e / 100 * 100;
	c = e / 10;
	e = e - e / 10 * 10;
	d = e;
	if (a + b + c + d == 7) { std::cout << a << "+" << b << "+" << c << "+" << d <<"=7"; return 0; }
	if (a - b + c + d == 7) { std::cout << a << "-" << b << "+" << c << "+" << d <<"=7"; return 0; }
	if (a + b - c + d == 7) { std::cout << a << "+" << b << "-" << c << "+" << d << "=7"; return 0; }
	if (a + b + c - d == 7) { std::cout << a << "+" << b << "+" << c << "-" << d << "=7"; return 0; }
	if (a - b - c + d == 7) { std::cout << a << "-" << b << "-" << c << "+" << d << "=7"; return 0; }
	if (a + b - c - d == 7) { std::cout << a << "+" << b << "-" << c << "-" << d << "=7"; return 0; }
	if (a - b + c - d == 7) { std::cout << a << "-" << b << "+" << c << "-" << d << "=7"; return 0; }
	if (a - b - c - d == 7) { std::cout << a << "-" << b << "-" << c << "-" << d << "=7"; return 0; }
	std::cout << std::endl;
}	

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

namespace ABC163_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string H = Console.ReadLine();
            int N = int.Parse(H);

            string[] H2 = Console.ReadLine().Split(' ');
            int[] A = new int[N - 1];
            int[] B = new int[N];

            for (int i = 0; i < N-1; i++)
            {
                A[i] = int.Parse(H2[i]);
                B[A[i] - 1]++;
            }

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(B[i]);
            }            
        }
    }
}


Measured memory_bytes: 42936
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main() 
{
    char ans[3][3];
    REP(i,3)
    {
        REP(j,3)
        {
            cin >> ans[i][j];
        }
    }

    cout << ans[0][0] << ans[1][1] << ans[2][2] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define x first
#define y second
#define PII pair < int , int >
#define PLL pair < ll , ll >
#define mod 1000000007
#define maxn 100100

using namespace std;
ll n, p, x, par, imp;
ll rs;


int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> p;
    for (int i =1; i <= n; i++){
        cin >> x;
        par += (x%2==0);
        imp += (x&1);
    }
    p %= 2;
    rs = 1LL << par;
    if (p%2==0 && imp == 0) return cout << rs, 0; 
    rs *= 1LL << (imp - 1);
    cout << rs;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9 + 7;

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


Measured memory_bytes: 256
n = int(input())
ac,wa,tle,re=0,0,0,0
for i in range(n):
    s = input()
    if(s=="AC"):
        ac+=1
    elif(s=="WA"):
        wa+=1
    elif(s=="TLE"):
        tle+=1
    else:
        re+=1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)


Measured memory_bytes: 9200
num = int(input())
l_i = list(map(int, input().split()))
ans = 0
for i in range(len(l_i)):
    ival = l_i[i]
    for j in range(len(l_i)):
        if j <= i: continue
        jval = l_i[j]
        if ival == jval: continue
        for k in range(len(l_i)):
            if k <= j: continue
            kval = l_i[k]
            if ival == kval or jval == kval: continue
            if ival < jval + kval and jval < ival + kval and kval < ival + jval: ans += 1
print(ans)

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

bool exist(vector<int> &y, vector<int> &x, vector<int> &r, vector<int> &c) {
    int k = r.size();
    for (int i = 0; i < k; ++i) {
        bool res = false;
        for (int j = 0; j < 8; ++j) {
            if (r.at(i) == y.at(j) && c.at(i) == x.at(j)) {
                res = true;
            }
        }
        if (!res) return false;
    }
    return true;
}

bool check(vector<vector<char> > &A, int y, int x) {
    for (int i = 1; x + i < 8; ++i) {
        if (A.at(y).at(x + i) == 'Q') return false;
    }
    for (int i = 1; x + i < 8 && y - i >= 0; ++i) {
        if (A.at(y - i).at(x + i) == 'Q') return false;
    }
    for (int i = 1; y - i >= 0; ++i) {
        if (A.at(y - i).at(x) == 'Q') return false;
    }
    for (int i = 1; x - i >= 0 && y - i >= 0; ++i) {
        if (A.at(y - i).at(x - i) == 'Q') return false;
    }
    for (int i = 1; x - i >= 0; ++i) {
        if (A.at(y).at(x - i) == 'Q') return false;
    }
    for (int i = 1; x - i >= 0 && y + i < 8; ++i) {
        if (A.at(y + i).at(x - i) == 'Q') return false;
    }
    for (int i = 1; y + i < 8; ++i) {
        if (A.at(y + i).at(x) == 'Q') return false;
    }
    for (int i = 1; x + i < 8 && y + i < 8; ++i) {
        if (A.at(y + i).at(x + i) == 'Q') return false;
    }
    return true;
}

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

    int k;
    cin >> k;
    vector<int> r(k), c(k);
    for (int i = 0; i < k; ++i) {
        cin >> r.at(i) >> c.at(i);
    }
    vector<int> y(8), x(8);
    for (int i = 0; i < 8; ++i) {
        y.at(i) = i;
        x.at(i) = i;
    }

    do {
        do {
            if (!exist(y, x, r, c)) continue;
            vector<vector<char> > A(8, vector<char>(8, '.'));
            for (int i = 0; i < 8; ++i) {
                A.at(y.at(i)).at(x.at(i)) = 'Q';
            }
            bool can = true;
            for (int i = 0; i < 8; ++i) {
                if (!check(A, y.at(i), x.at(i))) {
                    can = false;
                    break;
                }
            }
            if (can) {
                for (auto &V : A) {
                    for (auto &c : V) {
                        cout << c;
                    }
                    cout << endl;
                }
                exit(0);
            }
        } while (next_permutation(x.begin(), x.end()));
    } while (next_permutation(y.begin(), y.end()));

    return 0;
}


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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  int x = n * 800;
  int y = (n / 15) * 200;
  cout << x - y << endl;
}

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

def solve():
  dp = [0]*N
  dp[1] = abs(A[1] - A[0])
  for i in range(2,N):
    dp[i] = min((dp[i-1] + abs(A[i] - A[i-1])), (dp[i-2] + abs(A[i] - A[i-2])))
  return dp

dp = solve()
print(dp[N-1])

Measured memory_bytes: 13980