akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
#include <math.h>
#include<iostream>
using namespace std;
typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

#define sf                  scanf
#define pf                  printf
#define srev                reverse(s.begin(),s.end())
#define sortstr             sort(s.begin(), s.end());
#define gtl(x)              getline(cin, (x))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define PI                  acos(-1)
#define Precision(a) cout << fixed << setprecision(a)
#define FasterIO     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
//scanf("%[^\n]", str);
//sort(s,s+n,greater<int>());

int main()
{
    FasterIO
    int n, m, x;
    cin >> n >> m;
    x=n*(n-1)/2+m*(m-1)/2;
    cout << x << endl;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
    	var sc = new Scanner();
    	int n = sc.NextInt();
    	long[] t = new long[n];
    	t[0] = sc.NextLong();
    	long lcm = t[0];
    	for (int i = 1; i < n; i++)
    	{
    		t[i] = sc.NextLong();
    		lcm *= t[i] / Gcd(lcm, t[i]);
    	}
    	Console.WriteLine(lcm);
    }
    
    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }
    
    public double NextDouble()
    {
    	CheckNext();
    	return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

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

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

const ll MAX=1<<18;
const ll INF=0x3f3f3f3f;
ll n,k,a[MAX],s[MAX],ans;
struct dnq{
    ll x,y;
    vector<ll> ss;
};
queue<dnq> uni;
ll sum(ll x,ll y){
    return s[y]-s[x];
}
int main(){
    scanf("%lld%lld",&n,&k);
    for(ll i=0;i<n;i++) scanf("%lld",&a[i]),a[i]-=k;
    for(ll i=1;i<n+1;i++) s[i]=s[i-1]+a[i-1];
    dnq tmp;
    tmp.ss.push_back(0);
    for(ll i=0;i<n;i++){
        tmp.x=i,tmp.y=i+1,tmp.ss[0]=sum(i,i+1);
        if(sum(i,i+1)>=0) ans++;
        uni.push(tmp);
    }
    //printf("%lld\n",ans);
    while(uni.size()!=1){
        dnq t1=uni.front();
        uni.pop();
        if(t1.y==uni.front().x){
            dnq t2=uni.front(),t;
            uni.pop();
            t.x=t1.x,t.y=t2.y;
            for(ll i=0,j=0;i<t1.ss.size();i++){
                for(;j<t2.ss.size();j++){
                    if(sum(t1.x,t1.y)-t1.ss[i]+t2.ss[j]>=0) break;
                }
                ans+=t2.ss.size()-j;
                //printf("now : %lld %lld %lld\n",i,j,sum(t1.x,t1.y));
            }
            for(ll i=0;i<t2.ss.size();i++) {
                if(t2.ss[i]>=0) ans--;
                t2.ss[i]+=sum(t1.x,t1.y);
                if(t2.ss[i]>=0) ans++;
            }
            for(ll i=0,j=0;;){
                if(i==t1.ss.size()&&j==t2.ss.size()) break;
                else if(i==t1.ss.size()) t.ss.push_back(t2.ss[j++]);
                else if(j==t2.ss.size()) t.ss.push_back(t1.ss[i++]);
                else if(t1.ss[i]<t2.ss[j]) t.ss.push_back(t1.ss[i++]);
                else t.ss.push_back(t2.ss[j++]);
            }
            uni.push(t);
            //printf("%lld %lld %lld\n",t.x,t.y,ans);
        }
        else uni.push(t1);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 18448
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

class BIT:
    '''
    0-indexed
    '''
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = N.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & -i
        return ret

    def bitsum(self, l, r=None): # [l, r)
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

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

    def lower_bound(self, x):
        sum_ = 0
        pos = 0
        v = 1 << self.depth
        for i in range(self.depth, -1, -1):
            k = pos + v
            if k <= self.size and sum_ + self.tree[k] < x:
                sum_ += self.tree[k]
                pos += v
            v >>= 1
        return pos + 1, sum_


def solve():
    n = ni()
    g = [BIT(20) for _ in range(19)]
    ans = 0
    for _ in range(n):
        a = input().split('.')
        x = int(a[0])*10**9
        if len(a) > 1:
            x += int(a[1] + '0' * (9-len(a[1])))
        t = 0; f = 0
        while x % 2 == 0:
            t += 1
            x //= 2
        while x % 5 == 0:
            f += 1
            x //= 5
        if t > 18: t = 18
        if f > 18: f = 18
        for i in range(18-f, 19):
            ans += g[i].bitsum(18-t, 19)
        g[f].bitadd(t, 1)
    print(ans)
    return

solve()


Measured memory_bytes: 76048
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#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 ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



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




Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int num[110000];

int main(){
  int N;
  cin>>N;
  cout<<N/3<<endl;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
a = [1] * (N+1)
for i in range(M):
    a[int(input())] = 0
mod = 1000000007
ans = [0] * (N+1)
ans[0] = 1
for i in range(1,N+1):
     ans[i] = (ans[i-2]*a[i-2] + ans[i-1]*a[i-1]) % mod
print(ans[N])

Measured memory_bytes: 7764
#include<stdio.h>
#include<string.h>
int main(){
    
    int A, B;
    scanf("%d%d", &A, &B);
    
    if(B%A == 0){
    	printf("%d", B+A);
	} else {
		printf("%d", B-A);
	}
    
    return 0;
}

Measured memory_bytes: 1664
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations

H, W = map(int, input().split())
C = [[0]*10 for _ in range(10)]
A = [[0]*W for _ in range(H)]

for i in range(10):
  C[i] = list(map(int, input().split()))

C = floyd_warshall(C)  

cost = 0
for i in range(H):
  A[i] = list(map(int, input().split()))
  for a in A[i]:
    if a != -1:
      cost += C[a][1]

print(int(cost))

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ULL = unsigned long long;


void solve() {
	int n; cin >> n;
	int d[50]; rep(i, n) cin >> d[i];
	int m = 0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			m += d[i] * d[j];
		}
	}
	cout << m << endl;
}

int main() {

	solve();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

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

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int res = max(a*b,c*d);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2 + 2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  for( int i = 0; i < n1; i++ )L[i] = A[left + i];
  for( int i = 0; i < n2; i++ )R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i = 0, j = 0;
  for ( int k = left; k < right; k++ ){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int n, int left, int right){
  if( left+1 < right){
    int mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int main(){
  int A[MAX], n, i;
  cnt = 0;
  n=3;
  for ( i = 0; i < n; i++) cin >> A[i];
  mergeSort(A, n, 0, n);
  int x;
  x=A[2]-A[0];
  cout<<x;
  return 0;
}


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

#define NIL -1

struct Node{
  int l,r;
};

Node tree[1000000];
int root = NIL;

void insert(int k){
  int x, y;
  x = root;
  y = NIL;
  tree[k].r = NIL;
  tree[k].l = NIL;
  while(x != NIL){
    y = x;
    if(k < x){
      x = tree[x].l;
    }else{
      x = tree[x].r;
    }
  }

  if(y == NIL){
    root = k;
  }else if(k < y){
    tree[y].l = k;
  }else{
    tree[y].r = k;
  }
}

void inorder(int k){
  if(k == NIL){
    return;
  }
  inorder(tree[k].l);
  cout << " " << k;
  inorder(tree[k].r);
}

void preorder(int k){
  if(k == NIL){
    return;
  }
  cout << " " << k;
  preorder(tree[k].l);
  preorder(tree[k].r);
}

int main(){
  int n,k;
  string s;

  cin >> n;

  for(int i = 0 ; i < n ; i++){
    cin >> s;
    if(s == "insert"){
      cin >> k;
      insert(k);
    }else if(s == "print"){
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#define N 3003
#define P 1000000007
using namespace std;
int n,q,a[N],f[N][N];
struct upd{int x,y,z;};
upd pkg(int x,int y,int z){
    upd res;
    res.x=x,res.y=y,res.z=z;
    return res;
}
queue <upd> Q;
bool b[N][N];
int pow(int x,int y){
    int res=1;
    for(;y;y>>=1,x=1LL*x*x%P)
        if(y&1)res=1LL*res*x%P;
    return res;
}
int main(){
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;++i)scanf("%d",&a[i]);
    //f[i][j]表示a[i]>a[j]的概率
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)f[i][j]=a[i]>a[j];
    int tot=pow(2,q),inv=pow(2,P-2);
    while(q--){
        int x,y;
        scanf("%d%d",&x,&y);
        for(int i=1;i<=n;++i)
            if(i!=x && i!=y){
                Q.push(pkg(i,x,(int)(1LL*(f[i][x]+f[i][y])*inv%P)));
                Q.push(pkg(x,i,(int)(1LL*(f[x][i]+f[y][i])*inv%P)));
                Q.push(pkg(i,y,(int)(1LL*(f[i][y]+f[i][x])*inv%P)));
                Q.push(pkg(y,i,(int)(1LL*(f[y][i]+f[x][i])*inv%P)));
            }
        Q.push(pkg(x,y,(int)(1LL*(f[x][y]+f[y][x])*inv%P)));
        Q.push(pkg(y,x,(int)(1LL*(f[y][x]+f[x][y])*inv%P)));
        while(!Q.empty()){
            upd cur=Q.front();
            f[cur.x][cur.y]=cur.z;
            Q.pop();
        }
    }
    int ans=0;
    for(int i=1;i<n;++i)
        for(int j=i+1;j<=n;++j){
            ans+=1LL*f[i][j]*tot%P;
            if(ans>=P)ans-=P;
        }
    printf("%d\n",ans);
}


Measured memory_bytes: 36352
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K



int main(){
    ll A,B;
    cin >> A >> B;
    if(A<=8 && B<=8){
        cout << "Yay!" << endl;
    }else{
        cout << ":("  << endl;
    }
}


Measured memory_bytes: 256
import sys
import numpy as np

n, *xy = map(int, sys.stdin.read().split())
x, y = np.array(xy).reshape(-1, 2).T

def main():
    dx = (x[:, None] - x) ** 2
    dy = (y[:, None] - y) ** 2
    ans = np.sqrt(dx + dy).sum() / n
    print(ans)

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 12500
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;



signed main() {
    int N;
    cin >> N;
    vi dish(N);
    int res = 0;
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        dish[i] = a+b;
        res -= b;
    }
    GSORT(dish);

    for(int i=0; i<N; i+=2) {
        res += dish[i];
    }

    cout << res << endl;

    return 0;
}

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

using namespace std;

using ll = long long;

int main() {
	ll n, m,k;
	cin >> n >> m >> k;
	ll* a = new ll[n];
	ll* b = new ll[m];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		if (i > 0)a[i] += a[i - 1];
	}
	for (int i = 0;i < m;i++) {
		cin >> b[i];
		if (i > 0)b[i] += b[i - 1];
	}
	int index = upper_bound(b, b + m, k) - b - 1;
	int scoa = index + 1;
	for (int i = 0;i < n;i++) {
		if (a[i] > k)continue;
		int index = upper_bound(b, b + m, k - a[i]) - b - 1;
		scoa = max(index + 1 + i + 1, scoa);
	}
	cout << scoa << endl;
}

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

int main(){
 ll n; cin >> n;
 string s; cin >> s;
 ll rcnt=0,gcnt=0,bcnt=0;
 rep(i,n){
   if(s[i]=='R')rcnt++; else if(s[i]=='G')gcnt++; else bcnt++;
 }
 ll ad=rcnt*gcnt*bcnt;
 ll cnt=0;
 for(int i=1;i<2005;i++){
   for(int j=0;j+2*i<n;j++){
     if(s[j]!=s[j+i] && s[j]!=s[j+2*i] && s[j+i]!=s[j+2*i])cnt++;
   }
 }
 cout << ad-cnt << endl;


}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

typedef  int64_t llong;
llong mod(llong a, llong b) {
  llong res = a % b;
  if (res < 0) {
    return res + b;
  } else {
    return res;
  }
}

      



int main() {
  int n;
  cin >> n;
  vector<llong> a(n);
  for (int j = 0; j < n; ++j) cin >> a[j];

  llong s1 = 0;
  llong s2 = 0;
  llong modul = 1000'000'000 + 7;

  for (int j = 0; j < n; ++j) {
    s1 = mod(s1 + a[j], modul);
    s2 = mod(s2 + mod(a[j]*a[j], modul), modul);
  }

  llong ans = mod(s1*s1, modul);
  ans = mod(ans - s2, modul);
  llong half = (modul + 1) / 2;
  ans = mod(ans*half, modul);
  cout << ans << endl;
  
}


Measured memory_bytes: 4848
//ΔAGC028D
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 666;
const int MO = 1e9+7;
int n,m,a[N],b[N],c[N];
LL d[N],f[N],ans;
void solve(int u){
	int i,j;
	LL x;
	for(i=2;i<=u;i=i+2){
		f[i]=d[c[i]];
		for(j=1;j<=i;j=j+1)
			if(b[j]>i)
				f[i]=0;
		if(!f[i])
			continue;
		for(j=2;j<i;j=j+2)
			f[i]+=MO-f[j]*d[c[i]-c[j]]%MO;
		f[i]%=MO;
		ans+=f[i]*d[m-c[i]]%MO;
		//if(f[i])
		//	cout<<f[i]<<n-u+1<<n-u+i<<d[m-c[i]]<<endl;
	}
}
int main()
{
	int i,x,y;
	d[0]=1;
	for(i=2;i<N;i=i+2)
		d[i]=d[i-2]*(i-1)%MO;
	scanf("%d%d",&n,&m);
	n=n+n;
	while(m--){
		scanf("%d%d",&x,&y);
		a[x]=y,a[y]=x;
	}
	m=0;
	for(i=1;i<=n;i=i+1)
		if(!a[i])
			m++;
	for(i=1;i<=n;i=i+1){
		memset(b,0,sizeof(b));
		for(x=i;x<=n;x=x+1){
			if(a[x]&&a[x]<i)
				b[x-i+1]=N;
			else{
				if(a[x])
					b[x-i+1]=a[x]-i+1;
			}
		}
		for(x=1;x<=n;x=x+1)
			c[x]=c[x-1]+(b[x]==0);
		solve(n-i+1);
	}
	cout<<ans%MO;
	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
c = [list(map(int, input().split())) for i in range(a)]
c.sort()
d = 0
e = 0
for i in range(a):
    if c[i][1] + d < b:
        e += c[i][1] * c[i][0]
        d += c[i][1]
    else:
        e += (b - d) * c[i][0]
        d += b - d
print(e)


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

long func(long n) {
	return n * (n + 1) / 2;
}

int main() {
	int n;
	cin >> n;
	long ans = 0;
	for (int i = 1; i <= n; i++)
		ans += i * func(n / i);
	cout << ans << endl;
}

Measured memory_bytes: 3628
from collections import deque
l=list(deque(input()) for i in range(3))
p=["A","B","C"]
t=0
while len(l[t])>0:
  if l[t][0]=="a":
    l[t].popleft()
    t=0
  elif l[t][0]=="b":
    l[t].popleft()
    t=1
  else:
    l[t].popleft()
    t=2
print(p[t])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

string s;
void input() {
  int x, y, z;
  ;
  cin >> s;
}
void solve() {
  rep(i, 0, s.size() - 1) {
    if (not(i % 2)) {
      cout << s[i];
    }
  };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int main() {
  int n, R[200000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> R[i];
  }
  int max_val = -2000000000;
  int min_val = R[0];
  for (int i = 1; i < n; i++) {
    max_val = max(max_val, R[i] - min_val);
    min_val = min(min_val, R[i]);
  }
  cout << max_val << endl;
  return 0;
}



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

int main() {

  int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  int coute = 0;

  for (int i = 0; i < N; i++) {
    if (i < K) {
      coute += X;
    } else {
      coute += Y;
    }
  }

  cout << coute << endl;

}


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

static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,M[N][N];
int color[N], d[N], f[N], tt;
int nt[N];

int next(int u){
    for(int v = nt[u]; v<n; v++){
        nt[u] = v+1;
        if(M[u][v]) return v;
    }
    return -1;
}

void dfs_visit(int r){
    //for(int i=0; i<n; i++) nt[i] = 0;

    stack<int> S;
    S.push(r);
    color[r] = GRAY;
    d[r] = ++tt;
    
    while(!S.empty()){
        int u = S.top();
        int v = next(u);
        if(v!=-1){
            if(color[v]==WHITE){
                color[v] = GRAY;
                d[v] = ++tt;
                S.push(v);
            }
        }else{
            S.pop();
            color[u] = BLACK;
            f[u] = ++tt;
        }
    }
}

void dfs(){
    for(int i=0; i<n; i++){
        color[i] = WHITE;
        nt[i] = 0;
    }
    tt = 0;
    for(int u=0; u<n; u++){
        if(color[u]==WHITE){
            dfs_visit(u);
        }
    }
    for(int i=0; i<n; i++){
        cout << i+1 << " " << d[i] << " " << f[i] << endl;
    }
}

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

Measured memory_bytes: 3140
S = input()
L = [0] * len(S)
count = 0
for i in range(len(S)):
  if S[i] == 'L':
    count += 1
    L[i] = count
  else:
    count = 0
count = 0
for i in range(len(S)-1,-1,-1):
  if S[i] == 'R':
    count += 1
    L[i] = count
  else:
    count = 0
ans = [0] * len(S)
for i in range(len(S)):
  if S[i] == 'R':
    if L[i] % 2 == 0:
      ans[i+L[i]] += 1
    else:
      ans[i+L[i]-1] += 1
  else:
    if L[i] % 2 == 0:
      ans[i-L[i]] += 1
    else:
      ans[i-L[i]+1] += 1
print(' '.join(map(str,ans)))


Measured memory_bytes: 52208
import java.math.*;
import java.util.*;
public class Main{
	public static void main(String[] args){
		int i;
		Scanner sc=new Scanner(System.in);
		int n;
		while(true){
			n=sc.nextInt();
			if(n==0)
				break;
			int[] a=new int[n];
			int[] b=new int[n];
			for(i=0;i<n;++i){
				a[i]=sc.nextInt();
				b[i]=sc.nextInt();
			}
			BigInteger c=new BigInteger(Integer.toString(b[0]));
			for(i=1;i<n;++i)
				c=c.divide(c.gcd(new BigInteger(Integer.toString(b[i])))).multiply(new BigInteger(Integer.toString(b[i])));
			BigInteger[] d=new BigInteger[n];
			for(i=0;i<n;++i)
				d[i]=c.divide(new BigInteger(Integer.toString(b[i]))).multiply(new BigInteger(Integer.toString(a[i])));
			BigInteger e=new BigInteger("1");
			for(i=0;i<n;++i)
				e=e.divide(e.gcd(d[i])).multiply(d[i]);
			for(i=0;i<n;++i){
				System.out.println(new BigInteger(Integer.toString(b[i])).multiply(e).divide(new BigInteger(Integer.toString(a[i]))).divide(c));
			}
		}
	}


}

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

int main(){
	int N,M;
	while(cin>>N>>M&&N!=0){
		vector<int> a(N);
		for(int i=0; i<N; ++i){
			cin >> a[i];
		}
		vector<int> b(M);
		for(int i=0; i<M; ++i){
			cin >> b[i];
		}
		int c=0;
		int ans=0;
		while(c<N-1){
			c+=b[ans];
			c+=a[c];
			++ans;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int k;
    cin>>k;
    //sort(arr,arr+32);
    cout<<arr[k-1]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
 
typedef vector<int> v64;
typedef pair<int,int> p64;
typedef vector<p64> vp64;
typedef set<int> s64;
typedef map<int,int> m64;
typedef multiset<int> ms64;
typedef multimap<int,int> mm64;
typedef greater<int> g64;
typedef unordered_set<int> us64;
typedef unordered_map<int,int> um64;
 
int32_t main(){
    int n;
    cin>>n;
    bool flg = false;
    loop(i,1,9){
        loop(j,1,9){
            if(i*j==n) {flg = true; break;}
        }
        if(flg) break;
    }      
    if(flg) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>

using namespace std;

/*
N -> N - N % A[i] (N以下の最大のA[i]の倍数にする)ということを繰り返して、最終的に2になった。
最初のNの最大値、最小値は？

Nに対する(最後の数字)は単調増加なので、二分探索でやればよい。
*/

long long K, A[100000];
long long maxN, minN;
long long p, q;
long long r, num;


int main() {
	scanf("%lld", &K);
	for (int i = 0; i < K; i++) {
		scanf("%lld", &A[i]);
	}

	p = 1000000000000000;
	q = 0;

	/*まず、Nの最小値を求める。
	r = (p+q)/2から初めて計算する。答えが>= 2なら、p=rとする。<1なら、q=r+1とする。*/
	while (p - q >= 1) {
		r = (p + q) / 2;
		num = r;
		for (int i = 0; i < K; i++) {
			num = num - num % A[i];
		}
		if (num >= 2) { p = r; }
		else { q = r + 1; }
	}

	num = p;
	for (int i = 0; i < K; i++) {
		num = num - num % A[i];
	}
	if (num != 2) { printf("-1"); return 0; }

	printf("%lld ", p);

	p = 1000000000000000;
	q = 0;
	/*次に、Nの最大値を求める。答えが>2なら、p=r-1とする。<=2なら、q=rとする。*/
	while (p - q >= 1) {
		r = (p + q) / 2+1;
		num = r;
		for (int i = 0; i < K; i++) {
			num = num - num % A[i];
		}
		if (num > 2) { p = r-1; }
		else { q = r; }
	}
	printf("%lld\n", p);


}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<list>
#include<climits>

using namespace std;
#define rep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;


int main(){
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int ret = (int)1e9;
    if(x>y){
        swap(a,b);
        swap(x,y);
    }
    c*=2;
    ret = min(a*x+b*y,min(x*c+(y-x)*b, c*y));
    cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>){
    val N = readLine()!!.toInt()
    val s = (1..N).map { readLine()!! }
    val M = readLine()!!.toInt()
    val t = (1..M).map { readLine()!! }
    val lst = mutableSetOf<String>()
    lst.addAll(s)
    lst.addAll(t)


    val ans = lst.map{
        s.count { item -> item == it } - t.count{ item -> item == it}
    }.max()!!

    println( if(ans > 0 ) ans else 0)


}

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

#define vi std::vector<int>
#define vvi std::vector<std::vector<int> >
#define vpi std::vector<pi >
#define pi std::pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (int var = (from); var <= ((int)(to)); var++)
#define DOWNTO(var, from, to) for (int var = (from); var >= ((int)(to)); var--)
#define FOR(var, to)		  UPTO(var, 0, (to)-1)
#define DOWN(var, from)	   DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static const int MOD = 1000000007;
static const int INF = ((1<<30)-1);
static const s64 LINF = ((1LL << 62)-1);

struct Comb {
	std::vector<std::vector<s64> > a;
	Comb(int n) { // O(n^2)
		a.resize(n+1);
		FOR(i,n+1) {
			a[i].resize(i+1, 1);
			UPTO(j,1,i-1) a[i][j] = a[i-1][j] + a[i-1][j];
		}
	}
	s64 ncr(int n, int r) {
		assert(n >= 0);
		assert(n <= (int)a.size());
		assert(r >= 0);
		assert(r <= n);
		return a[n][r];
	}
};

#define gc(c) (c)=getchar()
int ri() {
	int c,s=0,r=0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}
s64 rs64() {
	s64 r;
	int c,s;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}

int int_less(const void *a, const void *b) {
	return (*(const int*)a - *(const int*)b);
}
int int_greater(const void *a, const void *b) {
	return (*(const int*)b - *(const int*)a);
}
std::string operator*(const std::string &s, int n){ std::string res; FOR(i,n) res += s; return res; }

template<class T> std::ostream& operator<<(std::ostream& os, std::vector<T> a) { for (auto i : a) os << i << " "; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, std::set<T> a) { for (auto i : a) os << i << " "; return os; }
template<class A, class B> std::ostream& operator<<(std::ostream&os, std::pair<A,B> a) { os << a.fi << "," << a.se; return os; }


int main() {
	int n = ri();
	std::string s;
	std::cin >> s;
	int a = 0;
	int b = 0;
	for (auto c : s) if (c == 'R') a++; else b++;
	std::cout << (a>b ? "Yes":"No") << std::endl;
	return 0;
}


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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = m - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  ll n,limit;cin>>n>>limit;
  vector<ll>w(n),v(n);
  rep(i,0,n)cin>>w[i]>>v[i];
  auto dp=make_v(n+1,n+1,301,0LL);
  rep(i,0,n)rep(j,0,n)rep(o,0,298){
    chmax(dp[i+1][j][o],dp[i][j][o]);
    chmax(dp[i+1][j+1][o+w[i]-w[0]],dp[i][j][o]+v[i]);
  }
  rep(i,0,n+1)rep(j,0,301){
    if(i*w[0]+j<=limit)chmax(res,dp[n][i][j]);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 24832
//don't go gentle into
// the goodnight.

#include<bits/stdc++.h>
using namespace std;

#define int       long long
#define ll        long long
#define fr        first
#define sec       second
#define pi        3.141592653589793
#define M         1000000007
#define mod       998244353
#define maxint    2147483647
#define minint    -2147483648
#define maxll     9223372036854775807
#define minll     -9223372036854775808
#define meme0(a)  memset(a,0,sizeof(a));
#define meme1(a)  memset(a,-1,sizeof(a));
#define i_m_speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open      freopen("input.txt","r",stdin);
#define close     freopen("output.txt","w",stdout);
#define v_int     vector<int >
#define v_ll      vector<long long >
#define pb        push_back
#define mk        make_pair
//upper_bound(begin(),end(),key)
//lower_bound(begin(),.end(),key);

ll expo(ll x , ll n , ll m){
    if(n==0)
        return 1;
    else if(n%2==0)
        return expo((x*x)%m , n/2 , m);
    else
        return (x*expo((x*x)%m,(n-1)/2,m))%m;

}
string toBinary(ll n)
{
    std::string r;
    while(n!=0){
        r=(n%2==0 ?"0":"1")+r;
        n/=2;
    }
    return r;
}


void solve(){
    string s;
    cin >> s;
    int n = s.size();
    for(int i=0;i<n;i++)
        cout << "x";
    cout << endl;
    return;
}
int32_t main(){
    i_m_speed
    int t=1;
    //cin >> t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using P = pair<int, int>;
using LL = long long;

#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) LL v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
#define MOD 1000000007


int main() {
  IN(N);

  bool swapped = false;
  VI P, P2;
  REP(i, N) {
    IN(p);
    P.push_back(p);
    P2.push_back(p);
  }
  SORT(P2);
  int difference = 0;
  REP(i, N) {
    if (P[i] != P2[i])
      ++difference;
  }
  if (difference > 2)
    OUT("NO");
  else
    OUT("YES");

  return 0;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

li1 = [i + e for i, e in enumerate(a, 1)]
li2 = [i - e for i, e in enumerate(a, 1)]

c1 = Counter(li1)
c2 = Counter(li2)

ans = 0
for k, v in c1.items():
    v2 = c2[k]
    ans += v * v2

print(ans)


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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    string alphabets = "abcdefghijklmnopqrstuvwxyz";

    int maxVal = 0;
    for (int i = 1; i < N; i++) {
        string prevS = S.substr(0, i);
        string latterS = S.substr(i, N - i);

        int count = 0, pos;
        for (char alphabet : alphabets) {
            pos = prevS.find(alphabet);
            bool prevShas = (pos == -1) ? false : true;
            pos = latterS.find(alphabet);
            bool latterShas = (pos == -1) ? false : true;
            if (prevShas && latterShas) count++;
        }
        maxVal = max(maxVal, count);
    }

    cout << maxVal << endl;

    return 0;
}


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

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

    vector<int> w(n+1);
    vector<int> e(n+1);
    for (int i = 0; i < n; i++) {
        if (s.at(i) == 'W') {
            w.at(i+1) = w.at(i) + 1;
        } else {
            w.at(i+1) = w.at(i);
        }
    }

    for (int i = 0; i < n; i++) {
        if (s.at(i) == 'E') {
            e.at(i+1) = e.at(i) + 1; 
        } else {
            e.at(i+1) = e.at(i);
        }
    }

    int ans = n;
    for(int i = 0; i < n; i++) {
        ans = min(ans, w[i] + e[n] - e[i+1]);
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long  ll; 

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 2; i*i <= n; i++) {
    ll power = 0;
    while (n % i == 0) {
      n /= i;
      power++;
    } 
    ll contribution = (sqrt(1+8*power) - 1)/2;
    ans += contribution;
  }

  if (n > 1) {
    ans += 1;
  }

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

Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <cstring>
#define MN 501000

char s[MN];
int a[MN];

int main()
{
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	for(int i = 1; i <= n; i++)
	{
		a[n - i + 1] = s[i] - '0';
	}
	int tot = 0;
	for(int i = 1; i <= n; i++)
	{
		tot += a[i] * 9;
		a[i] = tot % 10; 
		tot /= 10;
	}
	while(tot) a[++n] = tot % 10, tot /= 10;
	
	int sum = 0;
	for(int i = 1; i <= n; i++) sum += a[i]; 
	for(int k = 0; k <= 5000000; k++)
	{
		if(sum <= k && (k - sum) % 9 == 0) 
			return 0 * printf("%d\n", k / 9 + (k % 9 > 0));
		for(int i = 1; i <= n; i++)
		{
			a[i]++; sum++;
			if(a[i] == 10)
			{
				a[i] = 0, sum -= 10;
				if(i == n) n++;
			}
			else break;
		}
	}
}

Measured memory_bytes: 6248
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
//dp[先頭i文字][あまりj] = 組み合わせ何通り

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

int main() {
    string s;
    cin >> s;
    vector<vector<ll>> dp(s.size()+1, vector<ll>(13, 0));
    dp[0][0] = 1;
    rep(i,s.size()){
        rep(j,13){
            if(s[i]=='?'){
                rep(k,10){
                    add(dp[i+1][(j*10+k)%13], dp[i][j]);
                }
            }
            else{
                int k = s[i]-'0';
                add(dp[i+1][(j*10+k)%13], dp[i][j]);
            }
        }
    }
    cout << dp[s.size()][5] << endl;
    return 0;
}

Measured memory_bytes: 13696
#include <stdio.h>

int main()
{
    int A, B;
    scanf("%d %d", &A, &B);
    if(A > 9 || B > 9)
    {
        printf("-1\n");
    }
    else
    {
        printf("%d\n", A * B);
    }

    return 0;
}


Measured memory_bytes: 128
import math
import sys

def main():
    #an+1=(10~n)*7+an
    K=int(input())

    if K%2==0:
        print(-1)
        sys.exit()
    elif K%5==0:
        print(-1)
        sys.exit()
    n=0
    a=7
    while True:
        if a%K==0:
            break
        n+=1
        a=(a+(pow(10,n,K)*7))%K
    print(n+1)

if __name__=="__main__":
    main()

Measured memory_bytes: 63280
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
ll al[100001];
int main() {

    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> h;

    rep(i,m){
        ll a,b;
        cin>>a>>b;
        h.push_back({b,a});

    }
    sort(h.begin(),h.end());

    ll ans=1;
    ll pu=h[0].first-1;

    for(int i=1;i<h.size();i++){
        //cout<<pu<<" "<<h[i].first<<endl;
       if(pu>=h[i].second){

       }else{
           pu=h[i].first-1;
           ans++;
       }

    }



cout<<ans<<endl;






    return 0;
}


Measured memory_bytes: 2420
import java.io.*;
import java.util.*;

public class Main {
	
	static final int[] queens = new int[8];
	static final boolean[] threatend = new boolean[8];
	
	public static void main(String[] Args) throws IOException {
		final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine(), " ");
			int r = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			queens[r] = c;
			threatend[r] = true;
		}
		check(0);
		final char[] output = new char[72];
		Arrays.fill(output,'.');
		for (int i = 8; i < 72; i+=9) {
			output[i] = '\n';
		}
		for (int i = 0; i < 8; i++) {
			output[i*9+queens[i]] = 'Q';
		}
		System.out.print(output);
	}
	
	private static boolean check(int r){
		if (r>=8) return true;
		if(threatend[r]) return available(r, queens[r]) && check(r+1);
		for (int i = 0; i < 8; i++) {
			queens[r] = i;
			if(available(r,i) && check(r+1)) return true;
		}
		return false;
	}
	
	private static boolean available(int r, int c){
		for (int i = 0; i < 8; i++) {
			if(i<r||(i>r && threatend[i])){
				if(c == queens[i]) return false;
				if(Math.abs(c-queens[i]) == Math.abs(r-i)) return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 24436
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    i = str(i)
    cnt = 1
    for j in range((len(i)//2)+1):
        if i[j] != i[-j-1]:
            cnt = 0
            break
    ans += cnt
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int maxn=1e5+5;
map<P,int>mp; int tot=0; int d[maxn];
int h, w, n;
struct node{
    int x, y; ll val;
    bool operator<(const node &g)const{
        return val>g.val;
    }
}a[maxn]; int par[maxn*3], num1[maxn*3], num2[maxn*3];
int fd(int x){
    return par[x]==x?x:par[x]=fd(par[x]);
}
void unite(int x, int y){
    x=fd(x); y=fd(y);
    if(x==y) return;
    par[x]=y; num1[y]+=num1[x]; num2[y]+=num2[x];
}
int main(){
    scanf("%d%d%d",&n,&h,&w); ll sum=0;
    for(int i=1;i<=n+h+w;i++){
        par[i]=i;
        if(i>n) num2[i]=1;
        else num1[i]=1;
    }
    for(int i=1;i<=n;i++){
        scanf("%d%d%lld",&a[i].x,&a[i].y,&a[i].val);
    } sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        int x=a[i].x; int y=a[i].y;
        if(fd(x+n)!=fd(y+n+h)){
            int t1=fd(x+n); int t2=fd(y+n+h);
            if(num1[t1]+num1[t2]<num2[t1]+num2[t2]) unite(x+n,i), unite(i,y+n+h), sum+=a[i].val;
        }
        else{
            int t=fd(x+n);
            if(num1[t]<num2[t]) unite(x+n,i), sum+=a[i].val;
        }
    }
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    int cnt=0;
    vector<int> masu(n);
    rep(i,n) cin >> masu[i];
    
    for(int i=n-1; i>=1; i--){
        if(masu[i-1] - masu[i] == 1) masu[i-1] -- ;
    }
    for(int i=n-1; i>=1; i--){
        if(masu[i-1] - masu[i] <= 0) cnt++;
    }
    if(cnt == n-1){
        cout << "Yes" << endl;
    }
    else cout << "No" <<endl;
}

Measured memory_bytes: 640
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		long[] h = new long[n];
		for(i=0;i<n;i++) {
			h[i] = parseLong(sc.next());
		}
		sc.close();
		boolean f = true;
		long max=h[0];
		for(i=1;i<n;i++) {
			if(max>=h[i]+2) {
				f=false;
//				out.println(i);
				break;
			}
			max = Math.max(max,h[i]);
		}
		String ans = f?"Yes":"No";
		out.println(ans);
	}
}


Measured memory_bytes: 48740
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

ll m[1000];
bool dp[40010];
bool next[40010];

int main() {
  ll N,L,M,R;
  cin>>N>>L>>M>>R;
  REP(i,N) cin >> m[i];
  R*=2;
  L*=2;
  M*=2;
  ll MM = 2*M;
  dp[M] = 1;
  REP(i,N) {
    REP(j,MM+1)next[j]=0;
    ll ma = m[i]*L/2;
    ll mi = m[i]*R;
    REP(j,MM+1) {
      if (dp[j]) {
        // 右
        if (j+mi<=MM) {
          next[min(MM,j+ma)]=1;
          next[j+mi]=1;
        }
        // 左
        if (j-mi>=0) {
          next[max(0LL,j-ma)]=1;
          next[j-mi]=1;
        }
      }
    }
    bool f = 0;
    REP(j,MM+1) {
      dp[j]=next[j];
      f|=dp[j];
    }
    // REP(j,MM+1)cout<<dp[j]<<" ";cout<<endl;
    if (!f) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 0
from collections import deque
import numpy as np

H,W = [int(i) for i in input().split()]
l = [list(input()) for _ in range(H)]
check = [[False]*W for _ in range(H)]
ans = [[0]*W for _ in range(H)]

q = deque()
q.append([0,0])
check[0][0] = True

while q:
    i,j = q.popleft()
    for next_i, next_j in [[i+1,j], [i-1,j], [i,j+1], [i,j-1]]:
        if 0 <= next_i < H and 0 <= next_j < W:
            if not check[next_i][next_j] and l[next_i][next_j] != '#':
                q.append([next_i,next_j])
                check[next_i][next_j] = True
                ans[next_i][next_j] = ans[i][j]+1

cnt = 0
for i in range(H):
    for j in range(W):
        if l[i][j] == '.':
            cnt += 1

if ans[H-1][W-1]:
    print(cnt-ans[H-1][W-1]-1)
else:
    print(-1)


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

#define N 10000
#define INF 1000000007
#define min(a,b) (a>b?b:a)

int main() {
  int dp[2][N][2], n, cost;
  cin >> n;
  for(int i=0; i<2; ++i) {
    for(int j=0; j<n; ++j) {
      dp[i][j][0] = dp[i][j][1] = INF;
    }
  }
  dp[0][1][0] = dp[0][0][1] = 0;
  for(int i=0; i<n-1; ++i) {
    cin >> cost;
    for(int j=1; j<=n/2+1; ++j) {
      dp[(i+1)%2][j][0] = min( dp[i%2][j-1][0], dp[i%2][j-1][1]+cost );
      dp[(i+1)%2][j][1] = min( dp[i%2][j][0]+cost, dp[i%2][j][1] );
      //cout << j << " " << dp[(i+1)%2][j][0] << " " << dp[(i+1)%2][j][1] << endl;
    }
  }
  cout << min(dp[1][n/2][0], dp[1][n/2][1]) << endl;
  return 0;
}

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

int main()
{
  int S, u, d;
  string A;
  
  cin >> S;
  
  u = S / 100;
  d = S % 100;
  if(u < 1)
  {
    if(d > 0 && d < 13)
    {
      A = "YYMM";
    }else{
      A = "NA";
    }
  }else if(d < 1)
  {
    if(u > 0 && u < 13)
    {
      A = "MMYY";
    }else{
      A = "NA";
    }
  }else if(u > 12)
  {
    if(d > 12)
    {
      A = "NA";
    }else{
      A = "YYMM";
    }
  }else
  {
    if(d > 12)
    {
      A = "MMYY";
    }else{
      A = "AMBIGUOUS";
    }
  }

  cout << A << endl;
}

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

int main() {
    int a; cin>>a;
    int ans=0;
    for(int i=1; i<=a; i++){
        for(int j=1; j<=a; j++){
            for(int k=1; k<=a; k++){
                int g;
                g=__gcd(i, j),
                g=__gcd(g, k);
                ans+=g;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3636
import numpy as np
N,K,Q = map(int,input().split())
A = [int(input()) for x in range(Q)]
points = [K]*N
tmp = [1]*N
for i in range(Q):
    points[A[i]-1] += 1
points = list(np.array(points) - Q)
for i in range(len(points)):
    if points[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 24016