akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int dp[101][10100] = {0};

int main () {
  int n; cin >> n;
  vi s(n); rep(i,n) cin >> s[i];

  dp[0][0] = 1;
  rep(i,n) {
    rep(j,10001) {
      if (dp[i][j] == 1) {
        dp[i+1][j] = 1;
        dp[i+1][j+s[i]] = 1;
      }
    }
  }
  for (int i = 10000; i >= 0; i--) {
    if (i%10!=0 && dp[n][i]==1) {
      cout << i << endl;
      return 0;
    }
  }

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

Measured memory_bytes: 2560
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

bool f (char **a, char **b, int n, int m) {
	bool exist = true;

	int sideInterval = n - m;
	int yInterval = ( n / 2 - m > 0 ? n / 2 - m : 0 );
	for (int k = 0; k <= sideInterval; k++) {
		for (int g = 0; g <= yInterval; g++) {
			for (int i = k; i < k + m; i++) {
				for (int j = g; j < g + m; j++) {
					if (a[i][j] == b[i-k][j-g]) {
						continue;
					}
					else {
						exist = false;
						break;
					}
				}
				if(!exist) break;

			}
			if (exist) {
				return true;
			}
			exist = true;
		}
	}
	return false;
}

int main (void) {
	int n,m; cin >> n >> m;
	char **a = new char*[n];
	char **b = new char*[m];
	for (int i = 0; i < n; i++) {
		a[i] = new char[n];
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < m; i++) {
		b[i] = new char[m];
		for (int j = 0; j < m; j++) {
			cin >> b[i][j];
		}
	}

	cout << (f(a,b,n,m) ? "Yes" : "No" ) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    for(int i=0; i<N; i++) {
        char S;
        cin >> S;
        if(S == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <algorithm>
#include <vector>
#include <utility>
#define ll long long
#define mod 1000000007
using namespace std;
int ab(int a) {
	return a > 0 ? a : -a;
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	int a[n];
	ll pref[n + 1];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		pref[i] = (i ? pref[i - 1] : 0) + ab(a[i] - (i ? a[i - 1] : 0));
	}
	pref[n] = ab(a[n - 1]) + pref[n - 1];
	//for (int i = 0;i <= n;i++) cout << pref[i] << " ";
	//cout << endl;
	for (int i = 0;i < n;i++) {
		cout << (i ? pref[i - 1] : 0) + ab((i < n - 1 ? a[i + 1] : 0) - (i - 1 >= 0 ? a[i - 1] : 0)) + pref[n] - pref[i + 1] << "\n";
	}

	return 0;
}
/*
1238149814 1849128424888 -1
973234752
1849128424888 1238149814 -1

1 2 -1

 */


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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,w,item,value;
	long long res=0;
	cin >> n >> w;
	vector<long long> dp(w+1,0);
	for(int i=0;i<n;i++){
		cin >> item >> value;
		for(int j=w-item;j>=0;--j){
			dp[j+item]=max(dp[j+item],dp[j]+value);
		}
	}
	for(int i=1;i<=w;i++)
		res=max(res,dp[i]);
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 3980
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int n; cin >> n;
    vector<ll> A(n), B(n);
    rep(i, n){
        ll a, b; cin >> a >> b;
        A[i] = a % b; B[i] = b;
    }
    ll res = 0;
    for(int i=n-1; i>=0; i--){
        A[i] = (A[i] + res) % B[i];
        res += A[i]== 0 ? 0 : B[i] - A[i];
    }
    cout << res << ln;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int A[200010],B[200010],num[200010];
int N,M,W,C,D,E,G,K;
int ans,ans2,Max=0,Min=INF;
string S,T;
vector<int> V;
set<int> U;
map<int,int> H;
bool F,Q[200010];

signed main(){
	cin>>S;
	REP(i,S.size()){
		if(S[i]=='2'){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;cin >> n;
	ll ans = 1e13;
	for(ll i = 1; i * i <= n; i++){
		if(n % i == 0){
			ans = min(ans, i + n / i - 2);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
D = set(map(int, input().split()))

INF = 10**9
ans = INF
def dfs(price):
    if price > 10*N: return INF

    if not D & set(map(int, list(str(price)))):
        return price

    return dfs(price + 1)

ans = min(ans, dfs(N))
print(ans)


Measured memory_bytes: 71708
using System;


namespace CodeForcesPractice
{
    class Program
    {
        
        public static void Capital(char a) {
            if (char.IsUpper(a))
            {
                Console.WriteLine('A');
            }
            else { Console.WriteLine('a'); }
        }
        static void Main(string[] args)
        {
            char cases = Convert.ToChar(Console.ReadLine());
            Capital(cases);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 17520
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
using namespace std;

int main(){
	long x;
	cin >> x;
	if(x%2==0){
		cout << x << endl;
	}else{
		cout << 2*x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e18;

int main(){
    ll N,M,R;
    cin >> N >> M >> R;
    vector<ll> r(R);
    rep(i,R){
        cin >> r[i];
        r[i]--;
    }
    sort(r.begin(),r.end());
    vector<vector<ll>> d(N,vector<ll>(N,INF));
    rep(i,M){
        ll a,b,c;
        cin >> a >> b >> c;
        a--;
        b--;
        d[a][b]=c;
        d[b][a]=c;
    }
    rep(k,N){
        rep(i,N){
            rep(j,N){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    ll ans=INF;
    do{
        ll sum=0;
        rep(i,R-1){
            sum+=d[r[i]][r[i+1]];
        }
        ans=min(ans,sum);
    }while(next_permutation(r.begin(),r.end()));
    cout << ans << endl;
}

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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

int main(){
    int S, L, R;
    string ans;
    cin >> S;

    R = S % 100;
    L = S / 100;

    if(R <= 12 && L <= 12 && L > 0 && R > 0){
        ans = "AMBIGUOUS";
    }else if((R > 12 || R == 0) && L > 0 && L <= 12){
        ans = "MMYY";
    }else if((L > 12 || L == 0) && R > 0 && R <= 12){
        ans = "YYMM";
    }else{
        ans = "NA";
    }
    cout << ans << endl;
}


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

int main() {
	long long N, T, bt, t, count = 0;
	cin >> N >> T >> bt;
	for (int i = 1; i < N; i++) {
		cin >> t;
		count += min(T, t - bt);
		bt = t;
	}
	cout << count + T;
}

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

typedef long long ll;
const int N=510;
ll a[N][N],b[N][N],f[N][N],g[N][N],dp[N][N],ans=LLONG_MAX;
int n;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i){
		for(int j=1;j<i;++j)cin>>b[j][i-1];
		for(int j=i+1;j<=n;++j)cin>>a[i][j-1];
	}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
			b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
		}
	for(int i=1;i<=n;++i)
		for(int j=i;j<=n;++j){
			f[i][j]=a[j][j]+a[i-1][i-1]-a[i-1][j]-a[j][i-1];
			g[i][j]=b[i][n]-b[i][j-1];
		}
	memset(dp,0x3f,sizeof dp);
	dp[0][0]=0;
	for(int i=1;i<=n;++i)
		for(int j=0;j<i;++j)
			for(int k=j;k<i;++k)dp[k][i]=min(dp[k][i],dp[j][k]+f[k+1][i-1]+g[k][i]-g[j][i]);
	for(int i=0;i<=n;++i)ans=min(ans,dp[i][n]);
	cout<<ans<<'\n';	
	return 0;
}


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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][14];

int getChar (char ch){
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T')return 4;
    else return 0;
}

long long getKey (char str[]){
    long long sum = 0, p = 1, i;
    for (int i = 0; i < strlen(str); i++){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1));}

int find(char str[]){
    long long key, i, h;
    key = getKey(str);
    for (int i = 0; ; i++){
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h],str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[]) {
    long long key, i, h;
    key = getKey(str);
    for (int i = 0; ; i++){
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h],str) == 0) return 1;
        else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for (int i = 0; i < M; i++){
        H[i][0] = '\0';
    }
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%s %s", com, str);
        
        if (com[0] == 'i'){
            insert(str);
        }
        else {
            if (find(str)){
                printf("yes\n");
            }
            else {
                printf("no\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 17072
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9 + 7;
int INF = 2e18;

signed main() {
    string S, T;
    cin >> S >> T;
    int ans = 0;
    vector<vector<int>> check(S.length() + 1, vector<int>(200, -1));
    for (int i = 'a'; i <= 'z'; i++) {
        int count = -1;
        for (int j = S.length() * 2; j >= 0; j--) {
            check[j % S.length()][i] = count;
            // cout << count << " ";
            if (i == S[j % S.length()]) count = 0;
            if (count != -1) ++count;
        }
        // cout << endl;
    }
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == T[0]) {
            ans = i + 1;
            break;
        }
    }
    if (ans == 0)  {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 1; i < T.length(); i++) {
        // cout << ans << endl;
        if (check[(ans - 1) % S.length()][T[i]] == -1) {
            cout << -1 << endl;
            return 0;
        }
        ans += check[(ans - 1) % S.length()][T[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 160640
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	var b, r int
	for _, v := range s {
		if v == 'B' {
			b++
		} else {
			r++
		}
	}
	if b < r {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
#include <queue>

using namespace std;

const int maxn = 210000;
struct node {
	int v;
	node *next;
} pool[maxn*2] , *g[maxn];
int top;
int n , m;
char s[maxn];
int cnt[3][maxn];
int taboo[maxn];
int ans;
queue < int > q;
void add ( int u , int v ) {
	node *tmp = &pool[++top];
	tmp -> v = v; tmp -> next = g[u]; g[u] = tmp;
}
void work () {
	int i , k , x , y;
	scanf ( "%d%d" , &n , &m );
	scanf ( "%s" , s + 1 );
	for ( i = 1 ; i <= m ; i++ ) {
		scanf ( "%d%d" , &x , &y );
		add ( x , y ); add ( y , x );
		cnt[s[x]-'A'][y]++;
		cnt[s[y]-'A'][x]++;
	}
	for ( i = 1 ; i <= n ; i++ ) {
		if ( cnt[0][i] == 0 || cnt[1][i] == 0 ) {
			q.push ( i );
			ans++;
			taboo[i] = 1;
		}
	}
	while ( q.size () ) {
		k = q.front (); q.pop ();
		for ( node *j = g[k] ; j ; j = j -> next ) {
			if ( !taboo[j->v] ) {
				cnt[s[k]-'A'][j->v]--;
				if ( cnt[s[k]-'A'][j->v] == 0 ) {
					taboo[j->v] = 1;
					q.push ( j -> v );
					ans++;
				}
			}
		}
	}
	//printf ( "%d\n" , ans );
	if ( ans == n ) {
		printf ( "No\n" );
	}
	else {
		printf ( "Yes\n" );
	}
}
int main () {
	work ();
	return 0;
}


Measured memory_bytes: 11648
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")
 
ans = r*g*b
    
ct = 0
for i in range(n):
    for j in range(i + 1, n):
        k = j + j - i
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ct += 1                

print(r*g*b-ct)


Measured memory_bytes: 9080
from math import gcd
from collections import Counter
n=int(input())

iw=[]
for i in range(n):
    ab=list(map(int, input().split( )))
    iw.append(ab)

for i in range(n):
    ai,bi=iw[i]
    if bi<0:#biは正に設定
        iw[i][0]*=-1;iw[i][1]*=-1
    if bi==0 and ai<0:#biがゼロならaiは正かゼロ
        iw[i][0]*=-1
    if ai and bi:##互いに素にする
        g=gcd(ai,bi)
        iw[i][0]//=g;iw[i][1]//=g
    else:#どちらか0なら残りを1か0にする
        if ai:#biがゼロでaiが非ゼロ
            iw[i][0]=1
        elif bi:#aiがゼロでbiが非ゼロ
            iw[i][1]=1
    
iw = [tuple(iwi) for iwi in iw]
C=Counter(iw)
ans=1
mod=10**9+7
#print(C)
#ai bi=0,0は別に処理が要る
tmp=0
if (0,0) in C:
    tmp= C.pop((0,0))
#片方0も分けておく
if (0,1) in C and (1,0) in C:
    tmpx=C.pop((0,1))
    tmpy=C.pop((1,0))
    ans*=(pow(2,tmpx,mod)+pow(2,tmpy,mod)-1)
elif (0,1) in C :
    tmpx=C.pop((0,1))
    ans*=pow(2,tmpx,mod)
elif (1,0) in C :
    tmpx=C.pop((1,0))
    ans*=pow(2,tmpx,mod)

for ai,bi in C:
    if C[(ai,bi)]<0:##集計済
        continue

    if ai>0:#ai>0
        if (-bi,ai) in C and C[(-bi,ai)]>0:
            ans*=(pow(2,C[(-bi,ai)],mod)+pow(2,C[(ai,bi)],mod)-1)
            ans%=mod
            C[(-bi,ai)]=-1
        else:
            ans*= pow(2,C[(ai,bi)],mod)
            ans%=mod
    
    else:#ai<0
        if (bi,-ai) in C and C[(bi,-ai)]>0:
            ans*=(pow(2,C[(bi,-ai)],mod)+pow(2,C[(ai,bi)],mod)-1)
            ans%=mod
            C[(bi,-ai)]=-1
        else:
            ans*= pow(2,C[(ai,bi)],mod)
            ans%=mod
    
    #print((ai,bi),C[(ai,bi)],ans)
print((ans+tmp-1)%mod)



        



Measured memory_bytes: 158716
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

(N, K) = reads()

ans = 0
for b in range(K+1, N+1):
    ans += (N + 1) // b * (b - K) + max(0, (N + 1) % b - K)
    ans += 0 if K > 0 else -1
print(ans)


Measured memory_bytes: 3572
fun main(args: Array<String>) {
        val n = readLine()!!.toInt()
        val x = readLine()!!.split(" ").map { it.toInt() }

        val min = x.min()!!
        val max = x.max()!!

        var total = 0
        for (i in min..max) {
            var tmp = 0
            x.forEach {
                tmp += (it - i) * (it - i)
            }
            if (i == min) {
                total = tmp
            }

            if (total > tmp) {
                total = tmp
            }
        }
        println(total)
    }


Measured memory_bytes: 38036
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)

 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

    int main(){
       lint n;
       cin>>n;
       lint ans=0;
       repp(i,1,1000001){
           repp(j,1,1000001){
               if(i*j>=n)break;
               if(n-i*j>0)ans++;
           }
       }
        cout<<ans<<endl;
    }
      

Measured memory_bytes: 3696
n = int(input())
dat = list(map(int, input().split()))
maxval = -9999999999999999999
maxind = -1
numminus = 0
dat2 = []

for i in range(n):
    if dat[i] < 0:
        numminus += 1
    dat2.append(abs(dat[i]))

dat2.sort()
#print(numminus)
#print(dat2)

if numminus %2 == 0:
    print(sum(dat2))
else:
    dat2[0] *= -1
    print(sum(dat2))



Measured memory_bytes: 65440
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    System.out.println(a!=2 && b!=2?"Yes":"No");
  }
}

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

main() {
    int N,M; cin >> N >> M;
    char A[N][N],B[M][M];
    bool can=false,can4=true;
    rep(i,N){
        rep(j,N){
            cin >> A[i][j];
        }
    }
    rep(i,M){
        rep(j,M){
            cin >> B[i][j];
        }
    }
    rep(i,N-M+1){
        rep(j,N-M+1){
            bool can2 = true;
            rep(k,M){
                bool can3=true;
                rep(l,M){
                    if(B[k][l]!=A[i+k][j+l]){
                        can2=false; can3=false; break;
                    } 
                }
                if(!can3)break;
            }
            if(can2){can=true; can4=false; break;}
        }
        if(!can4)break;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

ll sol3(ll a, ll b, ll c)
{
  return max(abs(a - b), max(abs(c - b), abs(c - a)));
}

ll sol2(ll a, ll b, ll s)
{
  ll res = 1e18;
  if (a != 1)
    res = min(res, sol3((a / 2) * b, (a + 1) / 2 * b, s));
  if (b != 1)
    res = min(res, sol3((b / 2) * a, (b + 1) / 2 * a, s));
  return res;
}

ll sol(ll a, ll b)
{
  ll res = 1e18;
  for (ll x = 1; x < a; x++)
  {
    if (2 * x >= a)
    {
      res = min(res, sol2(b, x, (a - x) * b));
    }
  }
  return res;
}

int main()
{
  ll a, b;
  cin >> a >> b;
  ll res = min(sol(a, b), sol(b, a));
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

S = list(rs())
cur = 'D'
answer = 0
A_cnt = 0
for s in S:
    if cur == 'A':
        if s == 'A':
            A_cnt += 1
        elif s == 'B':
            cur = s
        else:
            cur = 'D'
            A_cnt = 0
    elif cur == 'B':
        if s == 'A':
            A_cnt = 1
            cur = s
        elif s == 'B':
            A_cnt = 0
            cur = 'D'
        elif s == 'C':
            answer += A_cnt
            cur = s
        else:
            cur = 'D'
            A_cnt = 0
    elif cur == 'C':
        if s == 'A':
            A_cnt += 1
            cur = s
        elif s == 'B':
            cur = s
        else:
            cur = 'D'
            A_cnt = 0
    else:
        if s == 'A':
            A_cnt += 1
            cur = s
        else:
            A_cnt = 0
            cur = 'D'

print(answer)


Measured memory_bytes: 4968
#include <bits/stdc++.h>
int main() {
    using namespace std;

    int n;
    cin >> n;
    int A[n + 1], b[n + 1];
    fill(b, b + n + 1, 0);
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        b[a]++;
        A[i] = a;
    }

    long long sum = 0LL;
    for (int i = 1; i <= n; i++) {
        sum += ((long long)b[i] * (b[i] - 1)) / 2LL;
    }

    for (int i = 1; i <= n; i++) {
        int diff      = (b[A[i]] == 0) ? 0 : (b[A[i]] - 1);
        long long ans = (sum <= diff) ? 0LL : (sum - (long long)diff);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 4096
// https://atcoder.jp/contests/abc109/tasks/abc109_b
#include <bits/stdc++.h>
using namespace std;
using P = pair<double, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<string> s(n);
    set<string> st;
    REP(i, n) {
        cin >> s[i];
        st.insert(s[i]);
    }

    bool flag = true;
    REP(i, n - 1) {
        string t1 = s[i];
        string t2 = s[i + 1];
        if (t1[t1.length() - 1] != t2[0]) {
            flag = false;
            break;
        }
    }
    if (flag && (int)st.size() == n) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int h,w,i,j,a,b;
    do{
    scanf("%d %d",&h,&w);
    if(h<=300 && w<=300)
    {
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            a=i%2;b=j%2;
            if((a==0 && b==0) || (a==1 && b==1))printf("#");
            if((a==1 && b==0) || (a==0 && b==1))printf(".");
        }
        if(h!=0 && w!=0)printf("\n");
    }
    if(h!=0 && w!=0)printf("\n");
    }a=0;
    }while(h!=0 && w!=0);
return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int x, a, b;
    cin >> x >> a >> b;
    x-=a;
    while(x >= b) x-=b;
    cout << x << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int heya[4][3][10]={0};
	int i,j,k,n,b,f,r,v;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		heya[b-1][f-1][r-1]=heya[b-1][f-1][r-1]+v;
	}
	for(i=0;i<4;i++){
		for(j=0;j<3;j++){
			for(k=0;k<10;k++){
				printf(" %d",heya[i][j][k]);
			}
			printf("\n");
		}
		if(i==3){
			break;
		}
		printf("####################\n");
	}

	return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <vector>

#define mod 1000000000+7;
typedef long long ll;
using namespace std;

vector<int> a,b,c;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n; cin >> n;

	for(int i{}; i<n; i++){
		int x; cin >> x;
		a.push_back(x);
	}
	
	for(int i{}; i<n; i++){
		int x; cin >> x;
		b.push_back(x);
	}
		
	for(int i{}; i<n-1; i++){
		int x; cin >> x;
		c.push_back(x);
	}

	int fornor{};
	int extra{};

	for(ll i{0}; i<a.size(); i++){
		fornor+=b[a[i]-1];
		if(i!=0 && a[i]-a[i-1]==1){
			extra+=c[a[i]-2];
		}
	}
	cout << fornor+extra << "\n";
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, i;
    cin >> a >> b;
    bool ans = false;
    for(i = 1; i < 1009; i++){
        if(int (i * 0.08) == a && int(i * 0.10) == b){
            ans = true;
            break;
        }
    }
    if(ans){
        cout << i << endl;
    }
    else{
        cout << -1 << endl;
    }
    return 0;
} 

Measured memory_bytes: 256
// seabreeeze //
 
#include<bits/stdc++.h>
 
using namespace std;
 
#define lli long long
lli M=1e9+7;
lli MOD=1e9+7;
 
#define MAXN 2000006 
 
// Template function //
lli powermod(lli x, lli y)  
{  
    lli res = 1;  
    x = x % MOD;
    if (x == 0) return 0;  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % MOD;  
        y = y>>1;   
        x = (x*x) % MOD;  
    }  
    return res;  
}
lli modinv(lli x)
{
    return powermod(x,MOD-2);
}
// Template functions end //
 
// Custom funtions //
void preprocess()
{

}

int mex(int a[],int n)
{
    vector<int> c(n+1,0);
    for(int i=0;i<n;i++)
    {
        c[a[i]]=1;
    }
    for(int i=0;i<n+1;i++)
    {
        if(c[i]==0)
        return i;
    }
    return 0;
}
 
// Custom functions end //
 
int main()
{
    lli q=1;
    // cin>>q;
    time_t start, end;
    time(&start);
    preprocess();
    for(lli tc=1;tc<=q;tc++)
    {
        // Start solution //
        int n,k;
        cin>>n>>k;
        lli a;
        vector<lli> v[2];
        for(int i=0;i<n;i++)
        {
            cin>>a;
            if(a>=0)
            v[0].push_back(a);
            else v[1].push_back(a);
        }
        sort(v[0].begin(),v[0].end());
        sort(v[1].begin(),v[1].end());
        lli ans = INT_MIN;
        reverse(v[0].begin(),v[0].end());
        reverse(v[1].begin(),v[1].end());
        int p = v[0].size();
        int q = v[1].size();
        if(k==n)
        {
            ans = 1;
            for(int i=0;i<p;i++)
            {
                ans = (ans*v[0][i])%M;
            }
            for(int i=0;i<q;i++)
            {
                ans = (ans*(v[1][i]+M)%M)%M;
            }
        }
        else {
            ans = 1;
            if(p==0)
            {
                if(k%2==0)
                reverse(v[1].begin(),v[1].end());
                for(int i=0;i<k;i++)
                {
                    ans = (ans*(v[1][i]+M)%M)%M;
                }
                
            }
            else if(q==0)
            {
                for(int i=0;i<k;i++)
                {
                    ans = (ans*v[0][i]+M)%M;
                }
            }
            else{
                reverse(v[1].begin(),v[1].end());
                int i = min(k-k%2,q-q%2);
                int j = k-i;
                while(1)
                {
                    if(i>1&&j<p-1)
                    {
                        if(v[1][i-1]*v[1][i-2]<=v[0][j]*v[0][j+1])
                        {
                            i-=2;
                            j+=2;
                        }
                        else break;
                    }
                    else break;
                }
                for(int K=0;K<i;K++)
                {
                    ans = (ans*(v[1][K]+M)%M)%M;
                }
                for(int K=0;K<j;K++)
                {
                    ans = (ans*(v[0][K]+M)%M)%M;
                }
            }
        }
        cout<<ans<<endl;
        // End Solution //
        end:;
    }
    
    time(&end);
    // cout<<fixed<<double(end - start)<<setprecision(10)<<endl;
    return 0;
}


Measured memory_bytes: 5412
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    long long s;
    cin >> s;

    int ans = 999;
    while (s >= 100) {
        int x = s % 1000;
        ans = min(ans, abs(x - 753));
        s /= 10;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


//ABC049_a
int main() {
	char c;
	cin >> c;

	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int cnt = 0;

        for(; a <= b; a++){
        	if(c%a==0) cnt++;
        }    System.out.println(cnt);

    }
}

Measured memory_bytes: 26336
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define BOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){

    int n;
    cin>>n;
    REP(kai,n){
        int s;
        cin>>s;
        vector<int> a(s);
        REP(i,s)cin>>a[i];
        
        int down=0,up=0;
        for(int i=1;i<s;i++){
            if(a[i]>a[i-1]){
                up=max(up,a[i]-a[i-1]);
            }else if(a[i]<a[i-1]){
                down=max(down,(a[i-1]-a[i]));
            }
        }
        
        cout<<up<<" "<<down<<endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 3012
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

ii mer(int a, int b) {
    int op = 0;
    while (1) {
        ++op;
        if (a + b < 10)
            return mp(a+b,op);
        else
            tie(a,b) = mp((a+b)/10, (a+b)%10);    
    }   
}   

ii mr[10][10];
ii mem[10][60];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    for (int i = 0; i < 10; ++i)
        for (int j = 0; j < 10; ++j)
            mr[i][j] = mer(i, j);

    for (int c = 0; c < 10; ++c) {
        mem[c][0] = mp(c, 0);
        for (int i = 1; i < 60; ++i) {
            auto t = mr[mem[c][i - 1].f][mem[c][i - 1].f];
            mem[c][i] = mp(t.f, t.s + mem[c][i - 1].s * 2);
        }   
    }   

    int n;
    cin >> n;
    int ans = 0;
    vector <int> ar;
    for (int i = 0; i < n; ++i) {
        int d, k;
        cin >> d >> k;
        int c = d;
        --k;
        for (int j = 0; j < 60; ++j) {
            if ((k >> j) & 1) {
                ii add = mem[d][j];
                auto t = mr[c][add.f];
                ans += t.s;
                ans += add.s;
                c = t.f;
            }   
        }
        ar.app(c);   
    }    
    int cur = ar[0];
    for (int i = 1; i < ar.size(); ++i) {
        ii t = mr[cur][ar[i]];
        cur = t.f;
        ans += t.s;
    }   
    cout << ans << endl;
}

Measured memory_bytes: 2420
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   string sa,sb,sc;
   cin >> sa >> sb >> sc;

   string tmp;
   
      tmp = sa[0];
      sa.erase(sa.begin());
  
   while(1){
      if((tmp == "a") && (sa.empty())) {
         cout << "A" << endl;
         break;
      }else if((tmp == "b") && (sb.empty())) {
         cout << "B" << endl;
         break;
      }else if((tmp == "c") && (sc.empty())) {
         cout << "C" << endl;
         break;
      }

      if(tmp == "a")  {
        tmp = sa[0];
         sa.erase(sa.begin());
      }else if(tmp == "b"){
         tmp = sb[0];
         sb.erase(sb.begin());
      }else if(tmp == "c"){
         tmp = sc[0];
         sc.erase(sc.begin());
      }


   }



   return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;
public class Main {





public static void main(String[] args)
{
	Scanner sc=new Scanner(System.in);
String a=sc.next();
String b=sc.next();
if(a.length()>b.length()) {
  System.out.println("GREATER");
}else if(a.length()<b.length()) {
  System.out.println("LESS");
}else
if(a.compareTo(b)==0) {
  System.out.println("EQUAL");
}else if(a.compareTo(b)>0) {
  System.out.println("GREATER");
}else {
  System.out.println("LESS");
}

}

}

class pair{
	int x,y;
	pair(int x,int y){
		this.x=x;
		this.y=y;
	}
}


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

using namespace std;
#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
const ll MOD = 1e9 + 7;
const int MAX = 5000010;

unordered_set<int> a[5];

int main()
{
    int a[5], k;
    for (size_t i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    cin >> k;
    for (size_t i = 0; i < 5; i++)
    {
        for (size_t j = 0; j < 5; j++)
        {
            if (abs(a[i] - a[j]) > k)
                return cout << ":(" << endl, 0;
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll T,N;
void solve()
{
    ll X;

    cin>>X;
    if(X>=30)
    cout<<"Yes\n";
    else
    cout<<"No\n";
}
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
   
    solve();
}

Measured memory_bytes: 3652
/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
   // c_p_c();
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    int prod=1;
    for(int i=0;i<n;i++)
    {
       
        
        if(prod<=inf/a[i])
        {
             prod*=a[i];
        }
        else
        {
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<prod<<endl;
}

Measured memory_bytes: 4392
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    vector<vector<int64_t>> A(N + 1, vector<int64_t> (13));
    A.at(0).at(0)++;
    for (int i = 0; i < N; i++) {

        if (S.at(i) == '?') {
            
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 13; k++) {
                    int64_t a = (j + k) % 13;
                    if (i != N - 1) {
                        a = a * 10 % 13;
                    }
                    A.at(i + 1).at(a) += A.at(i).at(k);
                    A.at(i + 1).at(a) %= 1000000007;
                }
            }
        }
        else {
            for (int j = 0; j < 13; j++) {
                int64_t a = (j + S.at(i) - '0') % 13;
                if (i != N - 1) {
                    a = a * 10 % 13;
                }
                A.at(i + 1).at(a) += A.at(i).at(j);
                A.at(i + 1).at(a) %= 1000000007;
            }
        }

    }
        cout << A.at(N).at(5) << endl;

}


Measured memory_bytes: 13696
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final String S = sc.next();

        int ans = 0;

        for (int i = 1; i < S.length(); i ++) {
            final String s = S.substring(0, S.length()-i);
            final String s1 = s.substring(0, s.length() / 2);
            final String s2 = s.substring(s.length() / 2);
            if (s1.equals(s2)) {
                ans = S.length() - i;
                break;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val n, k = sc.nextInt()
    val children = Array.fill(n)(false)

    (0 until k).foreach { i =>
      val d = sc.nextInt()
      (0 until d).foreach { j =>
        val a = sc.nextInt()
        children(a - 1) = true
      }

    }

    println(children.count(_ == false))
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def printExecTime(process: => Unit): Unit = {
    val start = System.currentTimeMillis
    process
    debug("処理時間： " + (System.currentTimeMillis - start) + " ミリ秒")
  }

}


Measured memory_bytes: 57356
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
ll const N = 1e6 + 5;
ll const INF = 9223372036854775807;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define len length()
#define umap unordered_map
#define uset unordered_set
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define forz(i, n) for (ll i = 0; i < n; i++)
#define fore(i, m, n) for (ll i = m; i <= n; i++)
#define rforz(i, n) for (ll i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (ll i = n; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define sexy ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
struct points
{
        ll start;
        ll end;
};
int main()
{

        ll t, d;
        cin >> t >> d;
        points arr[t];
        ll count=0;
        for (ll i = 0; i < t; i++)
        {
                cin >> arr[i].start >> arr[i].end;
        }
        for (int i = 0; i < t; i++)
        {
                ll a = arr[i].start;
                ll b = arr[i].end;
                if (a * a- d * d + b * b<=0)
                        count++;
        }
        cout << count;
}

Measured memory_bytes: 6736
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
	LL A, B, C;
	cin >> A >> B >> C;

	if (A == B && B == C) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
    return 0;
}


Measured memory_bytes: 256
// @samaranand
//
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define int64 long long
#define VI vector < int >
#define VII vector < vector < int > >
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define pii pair < int , int >
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define sz(v) v.size()
//const string yo = "YES", no = "NO";
const int inf = 2e9 + 7;
//const long long biGinf = 9e+18;
const char nwl = '\n';

int visit[100105];


int fun(VI &v, int n, int k) {
	for (int i = 0; i < 100100; i++)
		visit[i] = inf;
	for0(i, k + 1) v.pb(inf);
	visit[0] = 0;
	for0(i, n) {
		for0(j, k) {
			visit[i + j + 1] = min(visit[i + j + 1], visit[i] + abs(v[i] - v[i + j + 1]));
		}
	}
	return visit[n - 1];
}


int main() {

	//ur code
	int n, k;
	cin >> n >> k;
	VI v(n);
	inpv(v);
	cout << fun(v, n, k);
	//cout << "\ntest done";
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

ll dp[10010][3];

int main(){
    ll n;
    cin >> n;
    ll a[n];
    ll t;
    rep(i,n){
        cin >> t;
        a[i] = t - (i + 1);
    }
    if(n==1){
        cout << 0 << endl;
        return 0;
    }
    sort(a, a + n);
    if(n%2==0){
        ll ans = 0;
        ll ans2 = 0;
        rep(i, n)
        {
            ans += abs(a[i] - a[n / 2]);
            ans2 += abs(a[i] - a[n / 2 - 1]);
        }
        cout << min(ans, ans2) << endl;
    }
    else{
        ll ans = 0;
        rep(i,n){
            ans += abs(a[i] - a[(n-1)/ 2]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1792