akhauriyash/Code-Regression huggingface dataset:
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	string s;
	cin>>s;
	ll i,j;
	stack<char>st;
	for(i=0;i<s.size();i++){
		if(s[i]=='S')st.push('S');
		else{
			if(st.size()>0&&st.top()=='S')st.pop();
			else st.push('T');
		}
	}
	cout<<st.size();
	return 0;
}

Measured memory_bytes: 720
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
s = input()
t = input()
if s == t[:len(s)]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 68632
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{ 
		Scanner sc = new Scanner(System.in);
		Double a = sc.nextDouble();
		Double b = sc.nextDouble();
		Double c = Math.toRadians(sc.nextDouble());
		Double s = (a*b)*(Math.sin(c))/2.0;
		Double d = Math.sqrt(a*a+b*b-2*a*b*Math.cos(c));
		Double l = a+b+d;
		Double h = b*Math.sin(c);
		System.out.printf("%.5f\n",s);
		System.out.printf("%.5f\n",l);
		System.out.printf("%.5f\n",h);
	}
}

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



double dp[301][301][301];


double solve(ll x,ll y,ll z,ll n)
{
    if(x<0 || y<0 || z<0)
    {
        return(0.0);
    }
    if(x==0 && y==0 && z==0)
    {
        return(0.0);
    }
    if(dp[x][y][z]>=-0.1)
    {
        return(dp[x][y][z]);
    }
    double ans=(n+x*(solve(x-1,y,z,n))+y*solve(x+1,y-1,z,n)+z*(solve(x,y+1,z-1,n)))/(x+y+z);
    return(dp[x][y][z]=ans);
}

// dp(x,y,z)=1+p0*(dp(x,y,x))+p1*(dp(x-1,y,z))+p2(dp(x+1,y-1,z))+p3(dp(x,y+1,z-1))
//po=(n-(x+y+z))/n p1=x/(n) p2=y/n p3=z/n\


//dp(x,y,z)=(n+x(dp)+y(dp)+z(dp))/(x+y+z)
int main()
{
    ll n,i;
    cin>>n;
    ll a[n];
    ll x=0;
    ll y=0;
    ll z=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==1)
        {
            x++;
        }
        else if(a[i]==2)
        {
            y++;
        }
        else if(a[i]==3)
        {
            z++;
        }
    }
    ll j,k;
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            for(k=0;k<=n;k++)
            {
                dp[i][j][k]=-1.0;
            }
        }
    }
    cout<<fixed<<setprecision(10);
    cout<<solve(x,y,z,n);
}

Measured memory_bytes: 216848
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
      String[] t=sc.nextLine().split(" ");
//    String nyuA=sc.nextLine();
//   String nyu=sc.nextLine();

//int n=Integer.parseInt(nyu);

int A=Integer.parseInt(t[0]);
int B=Integer.parseInt(t[1]);
ArrayList<String> list=new ArrayList<>();
for(int i=0;i<A;i++){
list.add(sc.nextLine());
}
Collections.sort(list);
for(String tem:list)
System.out.print(tem);

System.out.println();


	}
}

Measured memory_bytes: 23892
#include<stdio.h>
int K,T,min;
void same(int a[T])
{
    int i,max,max_index,remain;
    max = a[0];
    max_index = 0;
    for(i=1;i<T;i++){
        if(a[i]>max){
            max = a[i];
            max_index = i;
        }
    }
    remain = K - max;
    if(max>remain){
        min = max - remain - 1;
        return;
    }else if(max = remain){
        min = 0;
        return;
    }else{
        int flag;
        flag = 0;
        for(i=0;i<T;i++){
            if(i!=max_index & flag<max){
                a[i]--;
                flag++;
            }
        }
        a[max_index] = 0;
        same(a);
    }


}

int main(void)
{
    scanf("%d %d",&K,&T);
    int i,a[T];
    for(i=0;i<T;i++){
        scanf("%d",&a[i]);
    }
    same(a);
    printf("%d",min);
    return 0;

}

Measured memory_bytes: 128
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int main()
{
    _fast_
    ll t = 1;
  //  cin>>t;
    while(t--){
    ll n;
    cin>>n;
    ll arr[n];
    f(n)
    {
        cin>>arr[i];
    }
    ll dp[n];
    dp[0] = 0;
    dp[1] = abs(arr[1]-arr[0]);
    for(ll i = 2;i<n;i++)
    {
        dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
    }
    cout<<dp[n-1]<<"\n";
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

vector< vector<int> > G;
vector<ll> C, R;

vector<int> bfs(int s) {
	int N = G.size();
	vector<int> res(N, inf); res[s] = 0;
	queue<int> Q; Q.push(s);
	while ( !Q.empty() ) {
		int v = Q.front(); Q.pop();
		EACH(to, G[v]) {
			if (res[v]+1 < res[to]) {
				res[to] = res[v]+1;
				Q.push(to);
			}
		}
	}
	return res;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N, K; cin >> N >> K;
	G.resize(N);
	C.resize(N); R.resize(N);
	REP(i, N) {
		cin >> C[i] >> R[i];
	}
	REP(i, K) {
		int u, v; cin >> u >> v; --u, --v;
		G[u].pb(v);
		G[v].pb(u);
	}
	vector<ll> dist(N, inf); dist[N-1] = 0;
	priority_queue<P, vector<P>, greater<P> > Q; Q.push( P(0, N-1) );
	while ( !Q.empty() ) {
		P p = Q.top(); Q.pop();
		int cost, v; tie(cost, v) = p;
		if (cost > dist[v]) continue;
//		cout << v << " " << cost << endl;
		vector<int> d = bfs(v);
		REP(i, N) {
//			cout << d[i] << " " << R[i] << " " << dist[v] << " " << C[i] << " " << dist[i] << endl;
			if (d[i] <= R[i] && dist[v]+C[i] < dist[i]) {
				dist[i] = dist[v]+C[i];
				Q.push({dist[i], i});
			}
		}
	}
	cout << dist[0] << endl;
}

Measured memory_bytes: 3492
#include<iostream>

using namespace std;

string target;

bool can(string s){

  for(int i = 0; i < s.length(); i++)
    if(s[i] == target[0])
      for(int j = i+1; j < s.length(); j++)
	if(s[j] == target[1]){
	  int d = j-i;
	  int now = 2;
	  int index = j;
	  bool flg = true;
	  while(1){
	    index += d;
	    if(index >= s.length()){
	      flg = false;
	      break;
	    }

	    if(target[now++] != s[index]){
	      flg = false;
	      break;
	    }

	    if(now == target.length()) break;

	  }
	  if(flg) return true;
	}
  

  return false;
}

int main(){
  int n;
  int ans = 0;

  cin >> n >> target;
  while(n--){
    string s;
    cin >> s;
    if(can(s)) ans++;
  }

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

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {

	ll N;
	cin >> N;
	map<string, int> mp;

	rep(i, N) {
		string s;
		cin >> s;
		SORT(s);
		mp[s]++;
	}

	ll ans = 0;
	for (auto p = mp.begin(); p != mp.end(); ++p) {
		int s = p->second;
		ans += (ll)s*(s - 1) / 2;//組合せ数
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 11136
N, K = map(int, input().split())
h = list(map(int, input().split())) #1-index

dp = [float('inf')]*(N)

def chmin(a,b):
    if a >= b:
        return b
    else:
        return a

dp[0] = 0
for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    
    for k in range(2, K+1):
        if i - k >= 0:
            dp[i] = chmin(dp[i], dp[i-k] + abs(h[i] - h[i-k]))
    
print(dp[N-1])

Measured memory_bytes: 55520
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
 
int main() {
    int N, M;
    cin >> N >> M;
    ll p[N];
    ll pc[N];
    FOR(i, 0, N) {
        cin >> p[i];
        pc[i] = i;
    }
    REP(i, M) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        ll o = pc[x];
        while (o != pc[o]) o = pc[o];
        ll k = pc[y];
        while (k != pc[k]) k = pc[k];
        pc[o] = min(o, k);
        pc[k] = min(o, k);
    }
    FOR(i, 0, N) {
        ll o = p[i] - 1;
        while (o != pc[o]) {
            o = pc[o];
        }
        ll pos = pc[i];
        while (pos != pc[pos]) {
            pos = pc[pos];
        }
        if (o == pos) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
S = input()

if len(S)%2==1:
    S1 = S[:len(S)//2]
    S2 = S[(len(S)//2)+1:]
else:
    S1 = S[:len(S)//2]
    S2 = S[(len(S)//2):]

hug = 0
for i in range(len(S1)):
    if S1[i] != S2[-(i+1)]:
        hug += 1

print(hug)


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

int main() {
	string str;

	cin >> str;
	
	int flag = 0;

	for (int i=1; i < str.size(); i++) {
		if (str[i] == str[i - 1]) {
			cout << "Bad" << endl;
			flag = 1;
			break;
		}
	}
	if (flag == 0) {
		cout << "Good" << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>

#define conv(c) (int)(c-'A')

void swap(bool *cup1, bool *cup2)
{
  bool tmp = *cup1;
  *cup1 = *cup2;
  *cup2 = tmp;
}

int main()
{
  char input_cup[10];
  bool cups[3] = {true, false, false};

  // while(~scanf("%c,%c", &cup1, &cup2))
  while(fgets(input_cup, sizeof input_cup/sizeof input_cup[0], stdin)!=NULL)
    swap(&cups[conv(input_cup[0])], &cups[conv(input_cup[2])]);

  int i;
  for(i = 0; i < 3; ++i)
    if(cups[i]){
      printf("%c\n", (char)('A'+i));
      break;
    }

  return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int a,b;
    cin >> a >> b;
    int temp;
    temp = max(a+b,a*b);
    cout << max(temp,a-b) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC086CTraveling solver = new ABC086CTraveling();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC086CTraveling {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int t = 0, x = 0, y = 0;
            int n = in.nextInt();
            for (int i = 0; i < n; i++) {
                int nt = in.nextInt(), nx = in.nextInt(), ny = in.nextInt();
                if (!canMove(nx - x, ny - y, nt - t)) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

        public static boolean canMove(int x, int y, int t) {
            int d = t - Math.abs(x) - Math.abs(y);
            return d >= 0 && d % 2 == 0;
        }

    }
}



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	unordered_map<int,int>a;
	int64_t ans=0;
	for(int i=1;i<=n;++i){
		int A; cin>>A;
		ans+=a[i-A];
		++a[A+i];
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 18608
input = [input() for i in range(2)]
N = int(input[0])
S = input[1]

alpha_dict = {}
alpha_dict_rev = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    alpha_dict[chr(c)] = i
    alpha_dict_rev[i] = chr(c)
    
S_digit = ''
for i in range(0,len(S)):
    S_digit += str(alpha_dict_rev[(alpha_dict[S[i]]+N)%26])

print(S_digit)

Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    char c;
    cin >> c;
    c++;
    P(c);
}


Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> v(n);
    int ans=0;
    rep(i,0,m){
        cin>>v[i];
        if(m<v[i])ans++;
    }
    cout<<ans<<endl;
    


    return 0;
}



Measured memory_bytes: 3104
n, a, b = map(int, input().rstrip().split())

forsum = []

for num in range(1, n+1):
  d1 = num // 10000
  m1 = num % 10000
  d2 = m1 // 1000
  m2 = num % 1000
  d3 = m2 // 100
  m3 = num % 100
  d4 = m3 // 10
  m4 = num % 10
  d5 = m4 // 1
  total = d1 + d2 + d3 + d4 + d5
  
  if a <= total <= b:
    forsum.append(num)

print(sum(forsum))

Measured memory_bytes: 3312
while n = gets
   n = n.to_i
   ans = 0
   (0..9).each do |a|
	  (0..9).each do |b|
		 (0..9).each do |c|
			d = n - a - b - c
			if (d > -1) && (d < 10)
			   ans += 1
			   #puts a.to_s + " " + b.to_s + " " + c.to_s + " " + d.to_s
			end
		 end
	  end
   end
   puts ans
end

Measured memory_bytes: 6092
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=int(1e5+5);
typedef long long LL;
#define INF LL(1e15)
LL s1,s2,as,n;
LL sz[MAXN],fh[MAXN];
char c[5];
int main()
{
	scanf("%lld",&n);
	scanf("%lld",&as);
	getchar();
	for(LL i=1;i<=n-1;i++) {
		scanf("%s",c);
		scanf("%d",&sz[i]);
		fh[i]=c[0];
	}
	s1=s2=-INF;
	for(LL i=1;i<=n-1;i++) {
		if(fh[i]=='-') {
			as-=sz[i];
			s1-=sz[i];
			s2+=sz[i];
			s1=max(s1,s2);
			s2=max(as,s2);
			as=max(s1,s2);
		}
		else {
			as+=sz[i];
			s1+=sz[i];
			s2-=sz[i];
			s2=max(s1,s2);
			as=max(s2,as);
		}
	}
	printf("%lld",as); 
}
/*
5
7 - 8 + 9 - 10 - 2*/

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define MOD (1000000007ll)

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	ll x,t=0;
	cin >> x;
	while((t*(t+1))/2 < x){
		t++;
	}
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    bool ok=true;
    REP(i,N){
        if(A[i]&1||A[i]%3==0||A[i]%5==0){
            ok=ok;
        }
        else ok=false;
    }
    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long q,h,s,d,n,ans;
    cin>>q>>h>>s>>d;
    cin>>n;
    q*=8;h*=4;s*=2;
    ans=n/2*min(min(q,h),min(s,d));
    if (n & 1) ans+=min(min(q,h),s)/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
S = int(input())
DP = [0] * (S + 1)
Mod = 10 ** 9 + 7

if S >= 3:
    DP[0] = 1
    DP[1] = 0
    DP[2] = 0
    for TS in range(3,S+1):
        DP[TS] = DP[TS-1] + DP[TS-3]
    print(DP[S] % Mod)
else:
    print(0)

Measured memory_bytes: 9208
import sys
sys.setrecursionlimit(10**9)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

H, W = mi()
C = li2(10)
a = li2(H)
memo = [C[i][1] for i in range(10)]
'''
tmp = -1
def dfs(column, m):
    if column == 1:
        global tmp
        tmp = max(m, tmp)
    for i in range(10):
        if i != column and C[column][i] < m:
            dfs(i, m-C[column][i])
    #return

for i in range(10):
    if i != 1:
        dfs(i, C[i][1])
        if tmp != -1:
            memo[i] = C[i][1] - tmp
        tmp = -1
'''
INF = 10**9
tmp = 10**9
'''
def dfs(col, m):
    if col == 1:
        global tmp
        tmp = min(m, tmp)
    for i in range(10):
        if i != col and m + C[col][i] < lim:
            dfs(i, m + C[col][i])

for i in range(10):
    if i != 1:
        tmp = INF
        lim = C[i][1]
        dfs(i, 0)
        memo[i] = min(tmp, memo[i])
'''
from collections import deque
for i in range(10):
    que = deque()
    lim = C[i][1]
    for j in range(10):
        if C[i][j] < lim:
            que.append([j, C[i][j]])
    while que != deque():
        #print(que)
        k = que.popleft()
        for j in range(10):
            if C[k[0]][j] + k[1] < lim and k[0] != j:
                if j == 1:
                    memo[i] = min(memo[i], C[k[0]][j] + k[1])
                else:
                    que.append([j, C[k[0]][j] + k[1]])

ans = 0
for i in range(H):
    for j in range(W):
        if abs(a[i][j]) != 1:
            ans += memo[a[i][j]]

print(ans)

Measured memory_bytes: 43100
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


struct edge{int to;ll cap;int rev;};
struct Dinic{
private:
    int n;
    vector<vector<edge>> v;
    vector<int> dist,iter;
public:
    Dinic(int sz):n(sz),v(sz),dist(sz),iter(sz){}
    
    void addedge(int from,int to,ll cap){
        int x=v[to].size(),y=v[from].size();
        v[from].push_back({to,cap,x});
        v[to].push_back({from,0,y});
    }
    
    void bfs(int s){
        fill(dist.begin(),dist.end(),-1);
        queue<int> q;
        dist[s]=0;
        q.push(s);
        while(q.size()){
            int x=q.front();q.pop();
            rep(i,v[x].size()){
                edge &e=v[x][i];
                if(e.cap>0&&dist[e.to]<0){
                    dist[e.to]=dist[x]+1;
                    q.push(e.to);
                }
            }
        }
    }
    
    ll dfs(int x,int t,ll f){
        if(x==t)return f;
        for(int& i=iter[x];i<(int)v[x].size();++i){
            edge& e=v[x][i];
            if(e.cap>0&&dist[x]<dist[e.to]){
                ll d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    v[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    ll max_flow(int s,int t){
        ll flow=0;
        while(1){
            bfs(s);
            if(dist[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            ll f;
            while((f=dfs(s,t,1LL<<62))>0)flow+=f;
        }
    }
};
int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    Dinic dn(n+2);
    int s=n,t=n+1;
    ll sum=0;
    rep(i,n){
        if(a[i]<0)dn.addedge(s, i, -a[i]);
        else {
            dn.addedge(i, t, a[i]);
            sum+=a[i];
        }
    }
    rep(i,n){
        for(int j=2*(i+1)-1;j<n;j+=i+1){
            dn.addedge(i, j, longinf);
        }
    }
    cout<<sum-dn.max_flow(s, t)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,a[100005],b[100005],c[100005],dp[100005][10];
int main(){
	cin>>n;
	for(k=1;k<=n;k++){
		cin>>a[k]>>b[k]>>c[k];
	}
	
	for(k=1;k<=n;k++){
		
		dp[k][1]=max(dp[k-1][2],dp[k-1][3])+a[k];
		dp[k][2]=max(dp[k-1][1],dp[k-1][3])+b[k];
		dp[k][3]=max(dp[k-1][2],dp[k-1][1])+c[k];
	}
	cout<<max(max(dp[n][1],dp[n][2]),dp[n][3]);
}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        if (n >= 10) {
            System.out.println(r);
        } else {
            System.out.println(r + 100 * (10 - n));
        }
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define rep3(i, n) for(int i = n-1; i >= 0; i--)
#define rep4(i, x, n) for(int i = x; i > n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    int r;
    cin >> r;
    cout << r*r << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "set"
#include "vector"
#include "climits"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W;

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

	string s;
	cin >> s;
	N = 700;
	for (auto i : s) {
		N += 100 * (i == 'o');
	}
	cout << N << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
char map[25][25];
int mov[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int vis[25][25] = {0}, d[25][25];
int n, m;
struct node
{
	int x, y;
}now, tmp;
int solve(int x, int y)
{
	queue <struct node> q;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			vis[i][j] = 0; d[i][j] = 1e9;
		}
	d[x][y] = 0;
	vis[x][y] = 1;
	now.x = x; now.y = y;
	q.push(now);
	while(!q.empty())
	{
		now = q.front(); q.pop();
		for(int i = 0; i < 4; i++)
		{
			tmp.x = now.x + mov[i][0];
			tmp.y = now.y + mov[i][1];
			if(tmp.x<=0||tmp.x>n||tmp.y<=0||tmp.y>m) continue;
			if(map[tmp.x][tmp.y]=='#') continue;
			if(vis[tmp.x][tmp.y]) continue;
			d[tmp.x][tmp.y] = 1 + d[now.x][now.y];
			vis[tmp.x][tmp.y] = 1;
			q.push(tmp);
		}
	}
	int res = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			if(vis[i][j] && res < d[i][j]) res = d[i][j];
		}
	return res;
}
int main()
{
	int res = 0;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++)
		scanf("%s", map[i]+1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
		if(map[i][j]=='.')
		{
			res = max(res, solve(i, j));
		}
	printf("%d\n", res);
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

min_tmp = 10 ** 5
index = 0
for i in range(n):
    tmp = abs(a - (t - 0.006 * h[i]))
    if tmp <= min_tmp:
        min_tmp = tmp
        index = i
    # print(tmp)
print(index + 1)


Measured memory_bytes: 9260
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())

a=""

l=[]
while n>0:
    n-=1
    mod=n%26
    n//=26
    l.append(mod)
#print(l)
for i in range(len(l))[::-1]:
    a+=chr(97+l[i])
print(a)

Measured memory_bytes: 9156
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int& ai : a) cin >> ai;
    for (int& bi : b) cin >> bi;
    for (int& ci : c) cin >> ci;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        int upper = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        int lower = c.end() - upper_bound(c.begin(), c.end(), b[i]);
        ans += (ll)(upper) * (lower);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

#define MAXN 200005
#define MOD 1000000007

ll binExp(ll a, ll b){
    if(b == 0) return 1LL;
    ll p = binExp(a, b / 2);
    return (b & 1 ? (((p * p) % MOD) * a) % MOD : (p * p) % MOD);
}

ll fat[MAXN], inv[MAXN];

void setup(){
    fat[0] = inv[0] = 1;
    for(int i = 1; i <= MAXN - 1; i++) fat[i] = (fat[i - 1] * i) % MOD;
    inv[MAXN - 1] = binExp(fat[MAXN - 1], MOD - 2);
    for(int i = MAXN - 2; i >= 1; i--) inv[i] = (inv[i + 1] * (i + 1)) % MOD;
}
 
ll comb(ll a, ll b){
    if(b > a) return 0;
    ll res = 1LL;
    for(ll i = a; i >= a - b + 1; i--) res = (res * i) % MOD;
    return (res * inv[b]) % MOD;
}

ll n, a, b;

int32_t main(){
    cin >> n >> a >> b;
    ll c = binExp(2, n);
    setup();
    ll res = (c - comb(n, a) - comb(n, b)) % MOD;
    if(res < 0) res += MOD;
    cout << (res - 1) << endl;

    return 0;
}

Measured memory_bytes: 3328
receber = input()
contador = 0
contaor = 0
casoUm=""
casoDois=""
if receber[0] == "1":
    for i in range(len(receber)):
        if i%2==0:
            casoUm+="1"
        else:
            casoUm+="0"
    for k in range(len(receber)):
        if receber[k] != casoUm[k]:
            contador+=1
else:
    for i in range(len(receber)):
        if i%2==0:
            casoDois+="0"
        else:
            casoDois+="1"
    for k in range(len(receber)):
        if receber[k] != casoDois[k]:
            contador+=1

print(contador)

Measured memory_bytes: 3188
#include<iostream>
#include<cmath>
using namespace std;
signed main(){
	int a, b;
	cin>>a>>b;
	if((a = a*(int)pow(10,(int)(log10(b)+1))+b) == (int)sqrt(a)*sqrt(a)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 768
using namespace std;
#include<string>
#include<cmath>
#include <map>
#include <list>
#include <unordered_map>
#define ppl pair<ll,ll>
#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e5 + 1;
const ll P = 1e9 + 7;
#include<iterator>




void solve() {
	string s; cin >> s;
	ll cnt = 0, ma = 0;
	fr(i, 0, 3) {
		if (s[i] == 'R')cnt++;
		else cnt = 0;
		ma = max(ma, cnt);
	}
	cout << ma;
}



int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif
	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ":\n";
		solve();
		//h++;
		//cout << '\n';
	}
	return 0;
}


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

prime_1 = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
prime_2 = [4,9,25,49]
prime_3 = [8,27]
prime_4 = [16,81]

dp = [0]*15

for i in range(15):
    dp[i] += n // prime_1[i]

for j in range(4):
    dp[j] += n // prime_2[j]
    
for k in range(2):
    dp[k] += n // prime_3[k]

for l in range(2):
    dp[l] += n // prime_4[l]

dp[0] += n // 32
dp[0] += n // 64

n2 = sum(x>1 for x in dp) 
n4 =sum(x>3 for x in dp)
n14=sum(x>13 for x in dp)
n24=sum(x>23 for x in dp)
n74=sum(x>73 for x in dp)

p553 = (n2-n4) * (n4*(n4-1) //2 ) + ((n4*(n4-1)*(n4-2))//2)
p144 = (n4-n14) * n14 + (n14*(n14-1))
p242 = (n2-n24) * n24 + (n24*(n24-1))
p750 = n74

print(p553+p144+p242+p750)

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

int main() {
  int n, a, b;
  cin >> n;
  a = n / 1000;
  b = n % 10;
  if ((n - b) % 111 == 0 ||(n - a*1000) % 111 ==0){
    cout << "Yes"<<endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,x,n) for(int i=x;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005,INF=1<<29;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int H;cin>>H;
        if(H==0) break;
        
        vector<vector<int>> S(H,vector<int>(5));
        
        for(int i=0;i<H;i++){
            for(int j=0;j<5;j++){
                cin>>S[i][j];
            }
        }
        
        int score=0;
        
        while(1){
            bool ok=false;
            
            for(int i=0;i<H;i++){
                if(S[i][2]==0) continue;
                int l=2,r=2;
                while(l>=0&&S[i][l]==S[i][2]) l--;
                while(r<5&&S[i][r]==S[i][2]) r++;
                
                l++;
                r--;
                
                if(r-l>=2){
                    score+=S[i][2]*(r-l+1);
                    for(int j=l;j<=r;j++) S[i][j]=0;
                    ok=true;
                }
            }
            
            if(!ok) break;
            
            for(int k=0;k<H;k++){
                for(int i=H-1;i>0;i--){
                    for(int j=0;j<5;j++){
                        if(S[i][j]==0){
                            S[i][j]=S[i-1][j];
                            S[i-1][j]=0;
                        }
                    }
                }
            }
            
        }
        
        cout<<score<<endl;
    }
    
}



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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ma=pow(3,n);
    int h=1;
    rep(i,n){
        if(a[i]%2==0){
            h*=2;
        }
    }
    cout<<ma-h<<endl;
    
}

Measured memory_bytes: 4992
n, k = map(int, input().split())
s = dict(zip('spr', map(int, input().split())))
t = list(input())
r = sum(s[h] for h in t[0:k])
for i in range(k, n):
  if t[i-k] != t[i]:
    r += s[t[i]]
  else:
    t[i] = None
print(r)

Measured memory_bytes: 4640
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;


public class Main{
	
	@SuppressWarnings("resource")
	public static void main(String[] args){
		//last month
		Map<Integer, Integer> last = new HashMap<>();
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {
			String line = sc.nextLine();
			if(line.equals("")) break;
			
			Scanner scstr = new Scanner(line).useDelimiter(",");
			int no = scstr.nextInt();
			last.merge(no, 1, (A, B) -> (A+1));
		}
		
		//this month
		Map<Integer, Integer> pre = new HashMap<>();
		while(sc.hasNextLine()) {
			String line = sc.nextLine();
			Scanner scstr = new Scanner(line).useDelimiter(",");
			int no = scstr.nextInt();
			pre.merge(no, 1, (A, B) -> (A+1));
		}

		//sort last month
		List<Integer> keyList = Arrays.asList(last.keySet().toArray(new Integer[last.size()]));
		keyList.sort((A, B) -> (A < B)? -1: (A == B)? 0: 1); 
		
		//output
		keyList.forEach(K -> {
			if(pre.containsKey(K)) System.out.println(K + " " + (last.get(K) + pre.get(K)));
		});
	}
	
}

Measured memory_bytes: 33048
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 3e5 + 10;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll n, a[85];

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll cur = 1000, stock = 0;
    for (int i = 0; i < n; i++) {
        cur += (stock * a[i]);
        stock = 0;
        if (i + 1 < n && a[i] < a[i + 1]) {
            stock = cur / a[i];
            cur -= (stock * a[i]);
        }
    }
    cout << cur << '\n';
    return 0;
}


Measured memory_bytes: 3624
def main():
    n, s = int(input()), input()

    c_lst = []
    for i in range(1, n):
        s1, s2 = s[:i], s[i:]

        s1_dic = {chr(j):0 for j in range(ord('a'), ord('a')+26)}
        for j in range(len(s1)):
            s1_dic[s1[j]] = s1_dic.get(s1[j], 0) + 1

        s2_dic = {chr(j): 0 for j in range(ord('a'), ord('a') + 26)}
        for j in range(len(s2)):
            s2_dic[s2[j]] = s2_dic.get(s2[j], 0) + 1

        cnt = 0
        for k in s1_dic:
            if s1_dic[k] != 0 and s2_dic[k] != 0:
                cnt += 1

        c_lst.append(cnt)

    print(max(c_lst))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
$S = trim(fgets(STDIN));
//list($A,$B) =  explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));

if (($N % 2) == 1) {
  printf("No\n");
  exit;
}
$s1 = substr($S,0,$N/2);
$s2 = substr($S,$N/2,$N);
if ($s1 == $s2) {
  printf("Yes\n");
}
else {
  printf("No\n");
}


Measured memory_bytes: 4728
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        int answer = solve(S);
        System.out.println(answer);
    }
    public static int solve(String S) {
        char[] data = S.toCharArray();
        int answer = check(data, true);
        answer = Math.min(answer, check(data, false));
        return answer;
    }
    private static int check(char[] data, boolean way) {
        int length = data.length;
        int answer = 0;
        for (int i = 0; i < length; i++) {
            int target;
            if (way) {
                target = i % 2 == 0 ? '0' : '1';
            } else {
                target = i % 2 == 0 ? '1' : '0';
            }
            if (target != data[i]) {
                answer += 1;
            }
        }
        return answer;
    }
}


Measured memory_bytes: 27856
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac


X, Y = map(int, input().split())
# 後の、n, mの大小を一定にするため
if X > Y:
    X, Y = Y, X
dist = X + Y

if dist % 3 != 0:
    print(0)
else:
    # (+1,+2) の移動の回数を n、(+2,+1) の移動の回数を m とする)
    # total = n + m
    # 以下の式は、2n + m = X, n + 2m = Y の連立方程式を解いた結果
    total = int((X+Y) / 3)
    n = X - total

    # n < 0 もしくは m < 0 の場合、たどり着けない
    # Y > X なので、m > n
    # n < 0 → 2X - Y < 0
    if Y > 2*X:
        print(0)
    else:
        MOD = 10**9 + 7

        fac, ifac = make_tables(MOD, total)
        ans = cmb(total, n, MOD, fac, ifac)
        print(ans)

Measured memory_bytes: 82464
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <random>
#include <queue>
#include <deque>
#include <iterator>
#include <map>
#include <functional>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define pb(a) push_back(a)
#define llong long long
#define INF 1145141919
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int main() {
	int n, a, b;
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	} else {
		cin >> a >> b;
		cout << a + b << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n, x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x, y) (((x) + (y)-1) / (y))

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = min(B-1, N);
    ll ans = floor((A * x) / B) - (A * floor(x / B));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = 1e9;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b, a%b);
}

int main() {
    ll N;
    cin>>N;
    if(N==1){
        ll T;
        cin>>T;
        cout<<T<<endl;
        return 0;
    }
    ll T1,T2;
    cin>>T1>>T2;
    ans=max(T1,T2)/gcd(T1,T2)*min(T1,T2);
    REP(i,N-2){
        ll T;
        cin>>T;
        ans=max(ans,T)/gcd(ans,T)*min(ans,T);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    char w;
    int cnt[26] = {};
    while(cin >> w){
        if (!isalpha(w)) continue;
        w = tolower(w);
        int num =  w - 'a';
        cnt[num] += 1;
    }
    
    for (int i=0; i<26; i++){
        char alpha = 'a'+ i;
        cout << alpha << " " << ":" << " " << cnt[i] << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 3084