akhauriyash/Code-Regression huggingface dataset:
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{
	auto tokens = my_readln().split();
	auto A = tokens[0].to!uint;
	auto B = tokens[1].to!uint;
	auto C = tokens[2].to!uint;
	
	writeln(A * B / 2);
	stdout.flush();
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}



int main() {
	int n; cin >> n;
	vector<Int> cnt(5);
	string temp;
	for(int i = 0; i < n; i++) {
		cin >> temp;
		if (temp[0] == 'M')cnt[0]++;
		if (temp[0] == 'A')cnt[1]++;
		if (temp[0] == 'R')cnt[2]++;
		if (temp[0] == 'C')cnt[3]++;
		if (temp[0] == 'H')cnt[4]++;
	}
	//printVec(cnt);
	long long ans=0;
	ans +=(Int)(cnt[0] * cnt[1] * cnt[2]);
	ans += (Int)(cnt[0] * cnt[1] * cnt[3]);
	ans += (Int)(cnt[0] * cnt[1] * cnt[4]);

	ans += (Int)(cnt[0] * cnt[2] * cnt[3]);
	ans += (Int)(cnt[0] * cnt[2] * cnt[4]);

	ans += (Int)(cnt[0] * cnt[3] * cnt[4]);

	ans += (Int)(cnt[1] * cnt[2] * cnt[3]);
	ans += (Int)(cnt[1] * cnt[2] * cnt[4]);
	ans += (Int)(cnt[1] * cnt[3] * cnt[4]);
	ans += (Int)(cnt[2] * cnt[3] * cnt[4]);
	cout << ans;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)
using namespace std;

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

int main() {
	int c,n;
	string p[1000];
	cin>>c>>n;
	rep(i,n)cin>>p[i];
	int t=0;
	rep(i,n/2){
		rep(j,n/2){
			int s=0;
			if(p[i][j]==p[i][n-1-j])s++;
			if(p[i][j]==p[n-1-i][j])s++;
			if(p[n-1-i][j]==p[n-1-i][n-1-j])s++;
			if(s<3)t++;
		}
	}
	int r=0;
	if(t==0)r++;
	rep(i,c-1){
		int d;
		cin>>d;
		rep(j,d){
			int x,y;
			cin>>x>>y;
			x--;
			y--;
			int s=0;
			if(p[x][y]==p[x][n-y-1])s++;
			if(p[x][y]==p[n-1-x][y])s++;
			if(p[n-1-x][y]==p[n-1-x][n-1-y])s++;
			if(s<3)t--;
			s=0;
			if(p[x][y]=='0'){
				p[x][y]='1';
			}else{
				p[x][y]='0';
			}
			if(p[x][y]==p[x][n-y-1])s++;
			if(p[x][y]==p[n-1-x][y])s++;
			if(p[n-1-x][y]==p[n-1-x][n-1-y])s++;
			if(s<3)t++;
		}
		if(t==0)r++;		
	}
	cout<<r<<endl;
	return 0;
}



Measured memory_bytes: 4148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=(1<<18)+5;
const int MOD=1000000007;
int H,L;
int n;
int p[N];
long long tag[N];
void jump(int u,long long fac)
{
	if(!u) return;
	tag[u]=(tag[u]+fac)%MOD;
	jump(u/2,fac*(u/2)%MOD);
	return;
}
void add(int u,long long fac)
{
	if(u>n) return;
	if(u>=L)
	{
		jump(L+p[u]-1,fac*(L+p[u]-1)%MOD);
		return;
	}
	add(u*2,fac*(u*2)%MOD),add(u*2+1,fac*(u*2+1)%MOD);
	return;
}
long long ans;
void getans(int u,long long fac,int pre)
{
	if(!u) return;
	ans=(ans+(tag[u]-tag[pre]*u%MOD+MOD)*fac%MOD)%MOD;
	getans(u/2,fac*u%MOD,u);
	return;
}
void solve(int u,long long fac)
{
	if(u>n) return;
	if(u>=L)
	{
		getans(L+p[u]-1,fac*u%MOD,0);
		return;
	}
	solve(u*2,fac*u%MOD),solve(u*2+1,fac*u%MOD);
	return;
}
void clear(int u)
{
	if(!u) return;
	tag[u]=0;
	clear(u/2);
	return;
}
void remove(int u)
{
	if(u>n) return;
	if(u>=L)
	{
		clear(L+p[u]-1);
		return;
	}
	remove(u*2),remove(u*2+1);
	return;
}
void dfs(int u)
{
	if(u>n) return;
	add(u*2,u*2),solve(u*2+1,u);
	remove(u*2);
	dfs(u*2),dfs(u*2+1);
	return;
}
int main()
{
	scanf("%d",&H);
	n=(1<<H)-1;
	L=1<<(H-1);
	for(int i=1;i<=L;i++)
		scanf("%d",&p[L+i-1]);
	dfs(1);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
 
int N;
int from[4][4][4];
map<char,int>mp;

signed main() {
    IOS();
    cin>>N;
    mp['A']=0;
    mp['G']=1;
    mp['C']=2;
    mp['T']=3;
    
    from[3][3][3]=1;
    rep(i,0,N){
        int to[4][4][4]={};
        rep(j,0,4)rep(k,0,4)rep(l,0,4)rep(m,0,4){
            if(k==mp['A']&&l==mp['G']&&m==mp['C'])continue;//*AGC
            if(k==mp['G']&&l==mp['A']&&m==mp['C'])continue;//*GAC
            if(k==mp['A']&&l==mp['C']&&m==mp['G'])continue;//*ACG
            if(j==mp['A']&&l==mp['G']&&m==mp['C'])continue;//A*GC
            if(j==mp['A']&&k==mp['G']&&m==mp['C'])continue;//AG*C
            (to[k][l][m]+=from[j][k][l])%=MOD;
        }
        swap(from,to);
    }
    
    int ans=0;
    rep(i,0,4)rep(j,0,4)rep(k,0,4){
        (ans+=from[i][j][k])%=MOD;
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

using namespace std;

const int N=100050;

char s[N];
int n,k,ans;

int main(){
	scanf("%d%d",&n,&k);
	scanf("%s",s+1);
	ans=0; 
	for (int i=1;i<n;++i) ans+=(s[i]==s[i+1]);
	ans=min(ans+2*k,n-1);
	printf("%d\n",ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int res=0;
	char ch=getchar();
	while(ch>'9'||ch<'0')ch=getchar();
	while(ch>='0'&&ch<='9')
	res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
	return res;
} 
int road[200005];
int rail[200005];
int ans[200005];
int find_road(int x)
{
	if(x!=road[x])
	road[x]=find_road(road[x]);
	return road[x];
}
void uni_road(int x,int y)
{
	int m=find_road(x),n=find_road(y);
	road[n]=m;
}
int find_rail(int x)
{
	if(x!=rail[x])
	rail[x]=find_rail(rail[x]);
	return rail[x];
}
void uni_rail(int x,int y)
{
	int m=find_rail(x),n=find_rail(y);
	rail[n]=m;
}
int main()
{
	int n=read(),k=read(),l=read();
	int num_road=k,num_rail=l;
	for(int i=1;i<=n;i++)
	road[i]=i,rail[i]=i;
	for(register int i=1;i<=k;i++)
	{
		int x=read(),y=read();
		uni_road(x,y);
		num_road--;
	}
	for(register int i=1;i<=l;i++)
	{
		int x=read(),y=read();
		uni_rail(x,y);
		num_rail--;
	}
//	for(register int i=1;i<=n;i++)
//	{
//		int x=find_road(i),y=find_rail(i),ans=0;
//		for(register int j=1;j<=n;j++)
//		if(find_road(j)==x&&find_rail(j)==y)
//		ans++;
//		printf("%d ",ans);
//	}
	for(int i=1;i<=n;i++)
	find_road(i),find_rail(i);
	map<pair<int,int>,int>mp;
	for(int i=1;i<=n;i++)
	{
		mp[make_pair(road[i],rail[i])]++;
	}
	for(int i=1;i<=n;i++)
	cout<<mp[make_pair(road[i],rail[i])]<<" ";
	return 0;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
int dp[100000]={0};
int main()
{

    int n;
    cin>>n;
    int a[100000];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[1]=0;
    dp[2]=a[2]-a[1];
    if(dp[2]<0)
    {
        dp[2]=-1*dp[2];
    }
    int k,l;
    for(int i=3;i<=n;i++)
    {
        l=abs(a[i]-a[i-1])+dp[i-1];
        k=abs(a[i]-a[i-2])+dp[i-2];
        dp[i]=min(l,k);
    }
  cout<<dp[n]<<endl;
  return 0;
}


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

const int mod = 1e9+7;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

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

  int n;
  cin >> n;
  vector<modint> arr(n,((modint) 0));
  modint sum = 1;
  arr[0]=1;
  rep1(i,n-1){
    if(i>=2) arr[i] = sum - arr[i-2];
    else arr[i] = sum;
    sum += arr[i];
    // cout << arr[i] << endl;
  }
  
  modint ans = arr[n-1];
  rep(i,n){
    if(i<n-1) ans += arr[i]*(n-1)*(n-2);
    ans += arr[i]*(n-1);
    if(i==n-2) ans += arr[i]*(n-1);
    else if(i<n-2) ans += arr[i]*(i+2);
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 4224
#include<stdio.h>
#include<stdlib.h>
#define I 10000
void CountingSort(int*,int*,int);
int main(){
  int *a,*b,i,max=0,n;
  scanf("%d",&n);
  a=(int *)malloc((n+1) *sizeof(int));
  b=(int *)malloc((n+1) *sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&a[i+1]);
  }
  CountingSort(a,b,n);
  printf("%d",b[1]);
  for(i=2;i<n+1;i++)printf(" %d",b[i]);
  printf("\n");
  free(a);
  free(b);
  return 0;
}
void CountingSort(int a[],int b[],int k){
  int c[I],i,j;
  for(i=0;i<=I;i++)c[i]=0;
  for(j=0;j<k;j++)c[a[j+1]]++;
  for(i=1;i<I+1;i++)c[i]+=c[i-1];
  for(j=k;0<j;j--){
    b[c[a[j]]]=a[j];
    c[a[j]]--;
  }
}



Measured memory_bytes: 17108
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int n;
    cin>>n;
    rep(i,n,999) {
        int tmp = i;
        int one = tmp % 10;
        tmp /= 10;
        int two = tmp % 10;
        tmp /= 10;
        int thr = tmp;
        if(one == two && two == thr){
            cout<<one<<two<<thr<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
int main(){
	scanf("%d",&n); int m; cin>>m;
	if(n == 2){
		if(m == 0){
			puts("1");
			puts("1 2");
		}
		else{
			puts("-1");
		}
	}
	else{
		if(m > (n-1)*(n-2)/2) puts("-1");
		else{
			vector<P>edge;
			for(int i=2;i<=n;i++){
				edge.pb(mp(1,i));
			}
			int dif = (n-1)*(n-2)/2-m;
			for(int i=2;i<=n&&dif;i++){
				for(int j=i+1;j<=n&&dif;j++){
					edge.pb(mp(i,j));
					dif--;
					if(dif == 0) break;
				}
			}
			cout<<edge.size()<<endl;
			for(int i=0;i<edge.size();i++){
				cout<<edge[i].fi<<" "<<edge[i].sc<<endl;
			}
			
		}
	}
}

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

int n, k, g, x, m;

int main () {
	
	scanf("%d%d%d", &n, &k, &g);
	
	m = max(m, g);
	
	for (int i = 1; i < n; i++) {
		scanf("%d", &x);
		g = __gcd(g, x);
		m = max(m, x);
	}
	
	printf("%sPOSSIBLE\n", (m >= k && k % g == 0) ? "" : "IM");
	
	return 0;	
}

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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for(auto i = 0; i < n; ++ i){
		cin >> a[i];
	}
	int s = accumulate(a.begin(), a.end(), 0, bit_xor<>());
	for(auto i = 0; i < n; ++ i){
		cout << (s ^ a[i]) << " ";
	}
	cout << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
const int maxn=2E5+5;
ll n,x,m,ans;
ll a[maxn],sum[maxn];
inline ll f(ll x,ll m)
{
	return (x%m)*(x%m)%m;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>x>>m;
	a[x]=1;
	sum[1]=x;
	ans=x;
	for(ll now=x,i=2;i<=n;++i)
	{
		now=f(now,m);
		if(a[now])
		{
			ll len=i-a[now];
			ll left=n-i+1;
			ans+=(sum[i-1]-sum[a[now]-1])*(left/len);
			ans+=(sum[a[now]-1+(left%len)]-sum[a[now]-1]);
			break;
		}
		ans+=now;
		a[now]=i;
		sum[i]=sum[i-1]+now;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
	for (;;) {
		int a,b;
		cin >> a >> b;
		if (a != 0 && b != 0) {
			for (int i = 0; i < a; i++) {
				for (int j = 0; j < b; j++) {
					cout << "#";
				}
				cout << endl;
			}
			cout << endl;
		}
		if (a == 0 && b == 0) {
			break;
		}
	}
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include<stdio.h>
#include <cmath>
using namespace std;
int main()
{
	int N,L;
	cin >> N >> L;
	int pie = N * (L - 1);

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

	int sabun;
	if (L > 0) { sabun = L; }
	else if (N <= abs(L)) { sabun = L + N - 1; }
	else sabun = 0;

	cout << pie - sabun;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
c = [0] * 8
f = 0
for i in range(N):
    if a[i] < 400:
        c[0] += 1
    elif a[i] < 800:
        c[1] += 1
    elif a[i] < 1200:
        c[2] += 1
    elif a[i] < 1600:
        c[3] += 1
    elif a[i] < 2000:
        c[4] += 1
    elif a[i] < 2400:
        c[5] += 1
    elif a[i] < 2800:
        c[6] += 1
    elif a[i] < 3200:
        c[7] += 1
    else:
        f += 1
print(max(8 - c.count(0), 1), 8 - c.count(0) + f)


Measured memory_bytes: 3064
#include <iostream>
#include <map>
using namespace std;
int main(void){
    string s; cin >> s;
    if(s.size() == 2 && s[0] == s[1]) {
        cout << "1 2" << endl;
        return 0;
    }
    int l = 0, r = 0;
    map<char, int> m;
    m[s[0]]++;
    while(true) {
        // cout << l + 1 << " " << r + 1 << endl;
        if(r == s.size() - 1 && r - l <= 1) {
            cout << "-1 -1" << endl;
            return 0;
        }
        if(r - l <= 1) {
            r++;
            m[s[r]]++;
            continue;
        }
        for(auto x : m) {
            // cout << x.first << endl;
            // cout << x.second << endl;
            // cout << r - l + 1 / 2 << endl;
            if(r - l + 1 / 2 <= x.second) {
                cout << l + 1 << " " << r + 1 << endl;
                return 0;
            }
        }
        
        if(r - l + 1 >= 3) {
            m[s[l]]--;
            l++;
        } else {
            r++;
            m[s[r]]++;
        }
    }
}


Measured memory_bytes: 512
def getInput():
    return int(input())

_500 = getInput()
_100 = getInput()
_50  = getInput()
X = getInput()

cnt = 0
for A in range(_500 + 1):
    for B in range(_100 + 1):
        for C in range(_50 + 1):
            calc =  500*A + 100*B + 50*C
            if calc == X:
                cnt += 1

print(cnt)

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

int main(void){

    int n,k,r,s,p;
    int i=0;
    int cr=0, cs=0, cp=0;

    scanf("%d %d", &n, &k);
    
    char t[n+1];
    scanf("%d %d %d", &r, &s, &p);
    scanf("%s", &t);

    for(i = k; i<n; i++){
        if (t[i] == t[i-k]){
            t[i] = 'a';
        }
    }

    i=0;

    while(t[i] != '\0'){

        if(t[i]=='r'){
            cp++;
        }else if(t[i]=='s'){
            cr++;
        }else if(t[i]=='p'){
            cs++;
        }
        i++;
    }

    printf("%d", (r*cr+s*cs+p*cp) );
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const ll MOD = 1000000007;
const int MSIZE = 100007;
const double Pi = 3.14159265358979323146;

int main(){
  int n, k; cin >> n >> k;
  ll ans=0;
  for(ll i=k; i<=n+1; i++){
    ll L = i*(i-1)/2;
    ll R = n*i - L;
    ans += R-L+1;
  }
  cout << ans%MOD << endl;
}


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

int main(){
	int suchi,high=0,middle=0,low=0,i,flag=0,a,b,c;
	
	for(i=0;i<10;i++){
		cin>>suchi;
			
		if(flag==0){
			high = suchi;
			flag++;
			}
			
		else{
			if(suchi<low);
			
			else if(suchi>=low&&suchi<middle)
				low = suchi;
			
			else if(suchi>=middle&&suchi<high){
				low = middle;
				middle = suchi;
			}else{
				low = middle;
				middle = high;
				high = suchi;
				}
				
			}
	}
	
	cout<<high<<endl;
	cout<<middle<<endl;
	cout<<low<<endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
//#include <Eigen/Dense>
//#include <Eigen/Geometry>
//using namespace Eigen;

using namespace std;




int main() 
{
	int a, b, c, d;;
	cin >> a >> b >> c >> d;
	while (1)
	{
		c -= b;
		if (c <= 0)
		{
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if (a <= 0)
		{
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int i[11111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=1,f=0;
  string s;
  cin >>a>>s>>b;
  if(s=="-") cout <<a-b<<'\n';
  else cout <<a+b<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include <iostream>
#define CAKE  4
#define DONUT 7
using namespace std;

int main() {

    int N;
    cin >> N;

    if(N==4||N==7||N==8||N==11||N==12||N==14||N==15||N==16||N>17)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    char a;
    cin >> a;
    //cerr << int(a - '0') << endl;
    if(int(a - '0') < 49) cout << "A" << endl;
    else cout << "a" << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define FORN(i, x, y) for (int i = x; i <= y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define scan1(X) scanf("%d", &X)
#define scan2(X, Y) scanf("%d%d", &X, &Y)
#define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z)
#define scan4(X, Y, Z, W) scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define scanl1(X) scanf("%lld", &X);
#define scanl2(X, Y) scanf("%lld%lld", &X, &Y)
#define scanl3(X, Y, Z) scanf("%lld%lld%lld", &X, &Y, &Z)
#define scanl4(X, Y, Z, W) scanf("%lld%lld%lld%lld", &X, &Y, &Z, &W)
#define print1(X) printf("%d\n", X);
#define print2(X, Y) printf("%d %d\n", X, Y);
#define print3(X, Y, Z) printf("%d %d %d\n", X, Y, Z);
#define print4(X, Y, Z, W) printf("%d %d %d %d\n", X, Y, Z, W);
#define printl1(X) printf("%lld\n", X);
#define printl2(X, Y) printf("%lld %lld\n", X, Y);
#define printl3(X, Y, Z) printf("%lld %lld %lld\n", X, Y, Z);
#define printl4(X, Y, Z, W) printf("%lld %lld %lld %lld\n", X, Y, Z, W);
#define max3(X, Y, Z) max(X, max(Y, Z))
#define max4(X, Y, Z, W) max(max(X, Y), max(Z, W))
#define min3(X, Y, Z) min(X, min(Y, Z))
#define min4(X, Y, Z, W) min(min(X, Y), min(Z, W))
#define popcount(X) __builtin_popcount(X)
#define all(x) x.begin(), x.end()
#define size(X) (int)X.size()
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define lc(x) 2 * x
#define rc(x) 2 * x + 1
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pldld;
const long long l_inf = numeric_limits<long long>::max();
const long long l_ninf = numeric_limits<long long>::min();
const int inf = numeric_limits<int>::max();
const int ninf = numeric_limits<int>::min();
const double pi = 1.00 * acos(-1.00);
const double eps = 1e-8;
void cio(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
int sq( int x ) {return x * x;}
////////////////////////////////////////////////////////////////////Header
const int maxn = 1e5 + 5;
int n;
int dp[maxn][4];
int w[maxn][4];

int main () {
    scan1(n);
    FORN(i, 1, n) FORN(j, 1, 3) scan1(w[i][j]); 
    FORN(i, 1, n) {
        FORN(j, 1, 3) {
            FORN(k, 1, 3){
                if ( k != j ) dp[i][j] = max(dp[i][j], dp[i-1][k] + w[i][j]);
            }
        }
    }
    int ans = 0;
    FORN(j, 1, 3) ans = max(ans, dp[n][j]);
    print1(ans);
}

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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
  cout << setprecision(10);
  int N,M;
  cin >> N >> M;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> v[i];
    v[i]--;
  }

  UnionFind tree(N);
  for(int i = 0; i < M; i++){
    int tmp1,tmp2;
    cin >> tmp1 >> tmp2;
    tmp1--; tmp2--;
    tree.unionSet(tmp1, tmp2);
  }

  vector<int> root(N);
  int tree_size = 0;
  for(int i = 0; i < N; i++){
    root[i] = tree.root(i);
    tree_size = max(root[i], tree_size);
  }

  vector<map<int,int>> cycle(tree_size+1);
  for(int i = 0; i < N; i++){
    cycle[root[i]][i] = 1;
  }

  int ans = 0;
  for(int i = 0; i < tree_size + 1; i++){
    for(auto x: cycle[i]){
      // x.first: cycle[i]に含まれる要素
      int target = v[x.first];
      // target が cycle[i]に含まれていれば、ans++
      if(cycle[i].count(target) != 0){
        ans++;
      }
    }
  }

  cout << ans << endl;





}


Measured memory_bytes: 10752
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int M = 1e8 + 100;
typedef long long ll;
pair<ll ,ll > a[M];
bool cmp(pair<ll ,ll> x,pair<ll ,ll> y){
	if(x.first!=y.first)
		return x.first<y.first;
	else if(x.second!=y.second)
		return x.second>y.second;
}
int main(){
	ll n,m;
	cin>>n>>m;
	for(ll i = 0 ; i < n; i++){
		cin>>a[i].first>>a[i].second;
	}
	sort(a,a+n);
//	for(ll i = 0 ; i < n; i++){
//		cout<<a[i].first<<a[i].second<<endl;
//	}
	long long sum = 0;
	ll st = 0;
	while(m>0 && st<n){
		if(a[st].second<=m){
			sum+=a[st].first*a[st].second;
			m-=a[st].second ;
			st++;
		}
		else{
			sum+=a[st++].first*m;
			m = 0;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
//ALDS1_5_D Recursion / Divide and Conquer - The Number of Inversions
#include <cstdio>

#define MAX 500000
#define SENTINAL 2000000000

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

long long merge(int *A, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    long long c = 0;

    for (int i = 0; i < n1; i++)
    {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++)
    {
        R[i] = A[mid + i];
    }
    L[n1] = R[n2] = SENTINAL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        if (L[i] <= R[j])
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
            c += mid + j - k - 1;
        }
    }
    return c;
}

long long mergeSort(int *A, int left, int right)
{
    long long c1,c2,c3;
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        c1 = mergeSort(A, left, mid);
        c2 = mergeSort(A, mid, right);
        c3 = merge(A, left, mid, right);
        return c1+c2+c3;
    }
    return 0;
}

int main(void)
{
    int A[MAX];
    
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &A[i]);
    }

    long long cnt = mergeSort(A, 0, n);
    printf("%lld\n", cnt);

    return 0;
}


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

using namespace std;

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

    vector <string> S(N);
    for (int i = 0; i < N; i++){
        cin >> S[i];
    }

    sort(S.begin(), S.end());
    string ans;
    for (int i = 0; i < N; i++){
        ans += S[i];
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
readlines.each do |l|
  n,m = l.split.map(&:to_i)
  break if n==0 && m==0
  i = -1
  p = (0..(n-1)).to_a
  while p.size>1
    p.delete_at(i=((i+m) % p.size))
    i = (i-1) % p.size
  end
  puts p.first+1
end

Measured memory_bytes: 6148
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define f(i,x,n) for(ll i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define int ll

template < typename T > using indexed_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
 
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
const int MOD = 1e9+7, INF = INT_MAX, N = 2e5 + 10;
 
int n;
int A[N];
indexed_set<pii> S;

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> n;
   f(i,1,n+1){
      cin >> A[i];
      S.insert({i-A[i],i});
   }
   int ans = 0;
   f(i,1,n+1){
      S.erase({i-A[i],i});
      ans += S.order_of_key({i+A[i],MOD})-S.order_of_key({i+A[i],-1});
   }
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 17688
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, a, cnt, res;
bool b[8];

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i) {
		cin >> a;
		if (a >= 3200)++cnt;
		else {
			b[a / 400] = true;
		}
	}
	for (int i = 0; i != 8; ++i) {
		if (b[i])++res;
	}
	cout << max(res, 1) << sp << res + cnt << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 5 7");
            //10
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 2 9");
            //6
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("20 20 19");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        int A = wkArr[0];
        int B = wkArr[1];
        int T = wkArr[2];

        int Answer = 0;
        for (int I = 1; I < int.MaxValue; I++) {
            if (A * I <= T) Answer += B;
            else break;
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
typedef pair<int, int> P;

int N, M;
map<string, int> score;

int main() {
	cin >> N;
	rep(i, N) {
		string tmp;
		cin >> tmp;
		score[tmp] ++;
	}
	cin >> M;
	rep(i, M) {
		string tmp;
		cin >> tmp;
		score[tmp]--;
	}
	int maxNum = -1000;
	string ans;
	rep(i, score.size()) {
		for (auto p : score) {
			if (p.second > maxNum) {
				maxNum = p.second;
			}
		}
	}
	if (maxNum < 0) {
		cout << 0 << endl;
	}
	else {
		cout << maxNum << endl;
	}
	
}

Measured memory_bytes: 3604
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    a = II()
    print(a + a**2 + a**3)


if __name__ == '__main__':
    solve()


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

string S;

bool subFunc(char c){
  if (c == 'A' || c == 'C'||c == 'T'||c=='G'){
    return true;
  }
  else{
    return false;
  }
}

int main() {
  int count=-1,temp =0;
  
  cin >> S; // input??
  //Go through the String
  for (int i = 0; i < S.length(); i++) {
    if (subFunc(S[i])){
      temp += 1;
    }
    else{
      temp = 0;
    }
    if(temp > count){
      count = temp;
    }

    
  }
  cout << count;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n[10];
  for(int i=0;i<10;i++){
    cin>>n[i];
  }
  sort(n,n+10);//昇順ソート
  for(int i=9;i>=7;i--){
    cout<<n[i]<<endl;
  }
}

Measured memory_bytes: 1176
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main() {
	ll n; cin >> n;
	repd(i, (int)sqrt(n), 1) {
		if (n % i == 0) {
			printf("%d", max((int)log10(i), (int)log10(n / i))+1);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        int ans = 0;
        String codefestival2016 = "CODEFESTIVAL2016";
        for (int i = 0; i < s.length(); i++){
            if (s.charAt(i) != codefestival2016.charAt(i)){
                ans += 1;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23892
function Main(input) {
  var input = input.split("\n").map(v=>+v);
  var h = input[0];
  var w = input[1];
  var n = input[2];

  var size = h > w ? h : w;

  console.log(Math.ceil(n / size));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
int main(){
    double a,b;
    cin >> a >> b;
    b = b*2 + 1;
    if(fmod(a,b) == 0)
        cout << a/b << endl;
    else 
    {
        cout << (int)a/(int)b + 1 << endl;
    }
}

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

const int MAXN = 4e2+5;
const int INF = 1e9+7;
#define ll long long
#define pb push_back
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

ll MOD(ll a){
    return ((a%INF)+INF)%INF;
}

ll inv(ll a){
    return poww(a,INF-2,INF);
}

bool a[MAXN][MAXN];
int dp[(1<<21)+5];

int main()
{
    fast_io;
    //cout << fixed << setprecision(15);

    int n;cin >> n;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j){
            cin >> a[i][j];
        }
    }

    dp[(1<<n)-1] = 1;

    for(int j=(1<<n)-2;j>=0;--j){
        int ones = __builtin_popcount(j);
        for(int f=0;f<n;++f){
            if(!(j & (1<<f)) && a[ones+1][f+1]){
                dp[j] += dp[j ^ (1<<f)];
                while(dp[j] >= INF) dp[j] -= INF;
            }
        }
    }
    cout << MOD(dp[0]);
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define INF 105
#define MOD 1000000007

int main()
{
    //freopen("output.txt","r",stdin);
    //freopen("input.txt","w",stdout);
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    long long n;
    cin >> n;
    long long l=sqrt(n)+1;
    int check=0;
    long long ans=100000000000000;
    for(int i=1;i<=l;i++)
    {
        if(n%i==0)
        {
            long long aa=i;
            long long bb=n/i;
            long long sm=min(aa,bb);
            long long bg=max(aa,bb);
            long long now=(sm-1)+(bg-1);
            ans=min(ans,now);
        }
    }
    cout << ans << endl;
}





Measured memory_bytes: 256
#include<stdio.h>
#define MAX_LEN 10000
#define MAX_QUE 500

int main(){
    int num, que_num, i, j=0, numList[MAX_LEN], queList[MAX_QUE], ans=0;
    scanf("%d", &num);
    for(i=0; i<num; i++){
        scanf("%d", &numList[i]);
    }
    scanf("%d", &que_num);
    for(i=0; i<que_num; i++){
        scanf("%d", &queList[i]);
    }

    for(i=0; i<que_num; i++){
        numList[num]=queList[i];
        j=0;
        while(1){
            if(queList[i] == numList[j]){
                if(j!=num){
                    ans++;
                    break;
                }else{
                    break;
                }
            }
            j++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

int main() {
  string s1,s2;
  cin >> s1 >> s2;
  // s2のサイズがs1より1大きく、0~size-1までは同一であること
  if(s2.size() == s1.size()+1 && s1 == s2.substr(0,s2.size()-1)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
typedef pair< int , int> P;
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){
  if(checkyear%4==0){
    if(checkyear%100!=0||checkyear%400==0)
    return true;
  }
  return false;
}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
bool pairCompare(const P& firstElof, const P& secondElof)
{
  if(firstElof.second!= secondElof.second)    return firstElof.second> secondElof.second;
  else return firstElof.first< secondElof.first;
}
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
int a=0,b=0;
std::cin >> x;
std::cout << x*x*3 << '\n';

}


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

int main(){
     string s,t;
     bool moji = true;
    cin >> s >> t;
    if(s.size()+1 == t.size()){
        for(int i=0; i<s.size(); i++){
           if(s.at(i) == t.at(i)){

           }
           else
           moji=false;
        }
    }
    if(moji)
    cout << "Yes" << endl;
    else 
    cout << "No" << endl;
    
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		int n = (a+b-3)/(a-1);
		System.out.println(n);
		
	}

}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>

int min(int x, int y) {
    return (x > y ? y : x);
}

int main() {
    int i, j;
    int n, a[1001];
    int ans;

    while (1) {
        scanf("%d", &n);
        if (n == 0) { break; }

        for (i = 0; i < n; i++) { scanf("%d", &a[i]); }

        ans = 1e8;

        for (i = 0; i < n-1; i++) {
            for (j = i+1; j < n; j++) {
                ans = min(ans, abs(a[i] - a[j]));
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2080
#
# File    : B.rb
# Author  : Kazune Takahashi
# Created : 2018-8-11 21:01:18
# Powered by Visual Studio Code
#

n = gets.to_i

ary = Array.new(1000){false}

ary[0] = true

for i in 0...1000
  if ary[i]
    ary[i + 4] = true
    ary[i + 7] = true
  end
end

if ary[n]
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
import Control.Applicative
import Control.Monad
import System.IO.Unsafe
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete


main = do
    [n, k] <- getInts
    getInts >>= print . sum . drop k . sortBy (flip compare) . map length . group . sort

Measured memory_bytes: 65404
S=input()

one_start=["1","0"]
one_start_count=0

zero_start=["0","1"]
zero_start_count=0

for i,subs in enumerate(S):
    if subs !=one_start[i%2]:
        one_start_count+=1
    elif subs != zero_start[i%2]:
        zero_start_count+=1
        

print(min(one_start_count, zero_start_count))

Measured memory_bytes: 3316
# coding: utf-8
# Your code here!

S = list(input())
A_li = []
B_li = []

for i in range(1, len(S) + 1):
    S_del = S[:-i]
    A_li = S_del[0:len(S_del) // 2]
    B_li = S_del[len(S_del) // 2::]
    if A_li == B_li:
        print(len(A_li) * 2)
        exit()

Measured memory_bytes: 3060
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll dp[2000][2000];
ll d,a[2000];
ll rec(ll x,ll y){//x~y?????¨??£???
	if(dp[x][y]!=-1) return dp[x][y];
	if((y+1)%d==x) return dp[x][y]=0;
	if((y+2)%d==x) return dp[x][y]=a[(y+1)%d];
	ll res=0;
	//x-1?????????
	if(a[(x-2+d)%d]<a[(y+1)%d]){
		res=max(res,a[(x-1+d)%d]+rec((x-1+d)%d,(y+1)%d));
	}
	else{
		res=max(res,a[(x-1+d)%d]+rec((x-2+d)%d,y));
	}
	//y+1?????????
	if(a[(x-1+d)%d]<a[(y+2)%d]){
		res=max(res,a[(y+1)%d]+rec(x,(y+2)%d));
	}
	else{
		res=max(res,a[(y+1)%d]+rec((x-1+d)%d,(y+1)%d));
	}
	return dp[x][y]=res;
}
ll ans=0;
int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>d;
	rep(i,d) cin>>a[i];
	rep(i,d){
		if(a[(i+1)%d]>a[(i-1+d)%d]){
			ans=max(ans,a[i]+rec(i,(i+1)%d));
		}
		else{
			ans=max(ans,a[i]+rec((i-1+d)%d,i));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 34416
import java.util.*;
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}
}

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

int main() {
    long double n,sum = 0,gousei;
    cin >> n;
    vector<long double> data(n);
    for (int i = 0; i < n; i++){
        cin >> data.at(i);
    }
    sort(data.begin(), data.end());
    gousei = data.at(0);
    for (int i = 0; i < n-1; i++){
        gousei = (gousei+data.at(i+1)) / 2;
    }
    cout << fixed << setprecision(10);
    cout << gousei << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <stdio.h>
using namespace std;
using ll =long long;

int main (void) {
  int sx,sy,tx,ty;
  cin >> sx>>sy>>tx>>ty;
  int dx=tx-sx;
  int dy=ty-sy;
  cout << string(dx,'R') << string(dy,'U') << string(dx,'L') << string(dy,'D');
  cout << 'D' << string(dx+1,'R') << string(dy+1,'U') << 'L';
  cout  << 'U' << string(dx+1,'L') << string(dy+1,'D') <<'R';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long //10^18
#define ull unsigned long long //10^19
using namespace std;
int main() {
  //ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
  int n;cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)cin>>arr[i];
  int maxi=arr[0],ans=0;
  for(int i=0;i<n;i++){
    if(arr[i]>=maxi){
      ans++;
      maxi=arr[i];
    }
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256