akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

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

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

    ll A,B,C,D;
    string S;
    cin >> A>>B>>C>>D;

    while(A>0&&C>0){
        C -= B;
        if(C<=0){
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if(A<=0){
            cout << "No" << endl;
            break;
        }
    }
}


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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> A(H);
	for (int n = 0; n < H; ++n) {
		cin >> A[n];
	}
	set<int>X;
	set<int>Y;
	for (int i = 0;i<W;++i) {
		bool b = true;
		for (int j =0 ;j<H;++j) {
			if ('#' == A[j][i]) {
				b = false;
			}
		}
		if (b) {
			X.insert(i);
		}
	}
	for (int i = 0; i < H; ++i) {
		bool b = true;
		for (int j = 0; j < W; ++j) {
			if ('#' == A[i][j]) {
				b = false;
			}
		}
		if (b) {
			Y.insert(i);
		}
	}

	for (int i = 0; i < H; ++i) {
		if (Y.count(i)) {
			continue;
		}
		for (int j = 0; j < W; ++j) {
			if (!X.count(j)) {
				cout << A[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
import java.util.*;

class Main{
    public static void main(String arg[]){
        Scanner scanner = new Scanner(System.in);
        int count_black = scanner.nextInt();
        int black_position = scanner.nextInt();
      
        int min_black_position = black_position - count_black + 1;
        int max_black_position = black_position + count_black - 1;
        
        for(int i = min_black_position; i < max_black_position + 1; i++){
                    System.out.print(i + " ");
        }
    }
}

Measured memory_bytes: 22868
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		ArrayList<Integer> listX = new ArrayList<Integer>();
		ArrayList<Integer> listY = new ArrayList<Integer>();
		int intTempX;
		int intTempY;

		while(scan.hasNext()){
			intTempX = scan.nextInt();
			intTempY = scan.nextInt();
			if(intTempX == 0 && intTempY == 0){
				scan.close();
				break;
			}else if(intTempX < intTempY){
				listX.add(intTempY);
				listY.add(intTempX);
			}else{
				listX.add(intTempX);
				listY.add(intTempY);
			}
		}
		if(listX.size() != 0){
			for(int i = 0; i < listX.size(); i++){
				System.out.println(listY.get(i) + " " + listX.get(i));
			}
		}
	}
}

Measured memory_bytes: 26752
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
struct point{
	ll x,d;
}p[maxn];
bool cmp(point a,point b)
{
	return a.x<b.x;
}
int main()
{
	int n,i,sum[maxn]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%lld%lld",&p[i].x,&p[i].d),p[i].d+=p[i].x;
	sort(p+1,p+1+n,cmp);
	ll dp[maxn]={0},Next[maxn]={0};
	dp[n+1]=1;
	for(i=n;i>=1;i--)
	{
		Next[i]=i+1;
		while(Next[i]!=n+1&&p[Next[i]].x<p[i].d)Next[i]=Next[Next[i]];
		dp[i]=(dp[i+1]+dp[Next[i]])%mod;
	}
	printf("%lld\n",dp[1]);
}

Measured memory_bytes: 8960
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define INF (1e9)

/* Adjacent List */
using Edge  =  pair<int,int>;
using Edges = vector<Edge>;
#define to   first
#define cost second

/* Kosaraju's SCC algorithm */
void dfs(Edges G[], int u, char visited[], stack<int>& st)
{
    visited[u] = 1;
    for(auto& v:G[u]) if (!visited[v.to]) dfs(G, v.to, visited, st);
    st.push(u);
}
void dfs_scc(Edges G[], int u, char visited[], vector<int>& scc)
{
    visited[u] = 1;
    scc.pb(u);
    for(auto& v:G[u]) if(!visited[v.to]) dfs_scc(G, v.to, visited, scc);
}

void kosaraju(Edges G[], int V, vector<vector<int> >& scc)
{
    Edges G_t[V];
    // DFS
    stack<int> st;
    char visited[V]; memset(visited, 0, sizeof(visited));
    rep(i,V) if(!visited[i]) dfs(G, i, visited, st);
    
    // transpose G
    rep(i,V) for(auto v:G[i]) G_t[v.to].pb(Edge(i,1));
    
    // SCC
    memset(visited, 0, sizeof(visited));
    while(!st.empty()) {
        int v = st.top(); st.pop();
        if(!visited[v]) {
            scc.pb(vector<int>());
            dfs_scc(G_t, v, visited, scc.back());
        }
    }

    // printing
    //for(auto& c:scc) {
    //    cout << "SCC: ";
    //    for(auto& v:c) cout << v << " ";
    //    cout << endl;
    //}
}

/* AOJ GRL3 */
int main()
{
    int V,E; cin>>V>>E;
    Edges G[V];
    vector<vector<int> > scc;
    
    rep(i,E){
        int u,v; cin>>u>>v;
        G[u].pb(Edge(v,1));
    }

    kosaraju(G, V, scc);

    int Q; cin>>Q;
    vector<int> ans;
    rep(i,Q) {
        int u,v; cin>>u>>v;
        bool sc = false;
        for(auto& c:scc)
            if((c.end() != find(c.begin(), c.end(), u))
               && (c.end() != find(c.begin(), c.end(), v))) sc = true;
        
        if(sc) ans.pb(1);
        else ans.pb(0);
    }

    for(auto& a:ans) cout << a << endl;
}

Measured memory_bytes: 5012
#include <bits/stdc++.h>
using namespace std;
const int INF = 10e6;

int main() {
    int n; cin >> n;
    vector<vector<int>> l(n, vector<int>(26));
    for(int i = 0; i < n; i ++) {
        string s; cin >> s;
        for(int j = 0; j < s.length(); j ++) l[i][s[j]-97] ++;
    }
    string ans = "";
    for(int i = 0; i < 26; i ++) {
        int cnt = INF;
        for(int j = 0; j < n; j ++) {
            if(l[j][i] == 0) break;
            else cnt = min(cnt, l[j][i]);
            if(j==n-1) {
                char x = (char)i+97;
                for(int k = 0; k < cnt; k ++) ans += x;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int travelCost;
    int income;
    int outlay;
    int difference;
    int month = 0;
    int sumOfDifference = 0;
    int i;
    int j;
    while (1)
    {
        month = 0;
        sumOfDifference = 0;

        //printf("????????£????????\????????????????????????");
        scanf("%d", &travelCost);

        if (travelCost == 0)
        {
            break;
        }

        //printf("?????????????????\??¨??????????????????????????§??\????????????????????????\n");
        for (i = 0; i < 12; i++)
        {
            scanf("%d%d", &income, &outlay);
            difference = income - outlay;
            sumOfDifference += difference;

            if ((travelCost <= sumOfDifference) && (month == 0))
            {
                month = i + 1;
            }
        }

        if (month > 0)
        {
            printf("%d\n", month);
            //printf("%d??????????????£??????%d????????§???????????????\n", travelCost, month);
        }
        else
        {
            printf("NA\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1732
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i:=0;i<n;i++{
		fmt.Scan(&s[i])
	}
	fmt.Println(sub(s))
}

func sub(s []string) int64 {
	mapEx := make(map[string]int)
	for _, value := range s {
		mapEx[sortString(value)] += 1
	}
	var ret int64
	ret = 0
	for _, value := range mapEx {
		if value > 1 {
			ret = ret + combination(value, 2)
		}
	}
	return ret
}

func sortString(s string) string {
	strs := make([]string, len(s))
	for i:=0; i<len(s); i++ {
		strs[i] = s[i:i+1]
	}
	sort.Strings(strs)
	return strings.Join(strs, "")
}

func permutation(n int, k int) int64 {
	var v int64
	v = 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= int64(n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int64 {
	return permutation(n, n - 1)
}

func combination(n int, k int) int64 {
	return permutation(n, k) / factorial(k)
}


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

int matrixChainOrder(vector<int> &p){
  auto n = p.size() - 1;
  int mat[n + 1][n + 1];
  for(auto i = 1; i <= n; i++){
    mat[i][i] = 0;
  }

  for(auto l = 2; l <= n; l++){
    for(auto i = 1; i <= n - l + 1; i++){
      auto j = i + l - 1;
      mat[i][j] = 1000000;

      for(auto k = i; k <= j - 1; k++){
        auto q = mat[i][k] + mat[k + 1][j] + p[i - 1] * p[k] * p[j];
        if(q < mat[i][j]){
          mat[i][j] = q;
        }
      }

    }
  }


  return mat[1][n];
}

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

  vector<int> mat(n + 1);
  for(auto i = 1; i <= n; i++){
    cin >> mat[i - 1] >> mat[i];
  }

  cout << matrixChainOrder(mat) << endl;

  return 0;
}




Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, ans = 1e9, cnt = 0;
  int x[101];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 1; i < 101; i++) {
    for (int j = 0; j < n; j++) {
      cnt += pow(x[j]-i, 2);
    }
  ans = min(ans, cnt);
  cnt = 0;
  }
  cout << ans;
}

Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000007
#define ll long long
#define mp make_pair
int main()
{
	std::ios::sync_with_stdio(false);
	char c[210];
	string s,t;
	cin>>c;
	cin>>t;
	int i,n=strlen(c);
	for(i=n;i<2*n;i++)
	c[i]=c[i-n];
	s=c;
	for(i=0;i<n;i++)
	{
		if(s.substr(i,n)==t)break;
		else;
	}
	if(i<n)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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


void solve(long long r){
    cout << pow(r, 2) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long r;
    scanf("%lld",&r);
    solve(r);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
#include <iomanip>
using namespace std;
typedef long long ll;

int Tmax, V, E, u, v, d, Nnew,Nput,Nachieve, new_id, dst, order[11111],f[444], check[444], par[444], sum = 0,trush;
char s[3];
vector<vector<pair<int, int>>> li(444);
queue<pair<int, int>> route;
queue<int> store;
queue<int> car;

void dfs(int now, int distance) {
	route.push(make_pair(now, distance));
	sum += distance * 2;
	for (auto &e : li[now]) {
		if (par[e.first] == now) {
			dfs(e.first, e.second);
			route.push(make_pair(now, e.second));
		}
	}
}

int main() {
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		cin >> u >> v >> d;
		li[u].push_back(make_pair(v, d));
		li[v].push_back(make_pair(u, d));
	}
	for (int i = 1; i <= V; i++)
		cin >> f[i];
	cin >> Tmax;
	for (int i = 1; i <= V; i++)
		check[i] = 0;
	priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int>>, greater<pair<pair<int, int>, int >>> que;
	que.push(make_pair(make_pair(0, 1), -1));
	while (!que.empty()) {
		int now = que.top().first.second, npar = que.top().second;
		que.pop();
		if (!check[now]) {
			check[now]++;
			par[now] = npar;
			for (auto &e : li[now]) {
				int next = e.first, dnext = e.second;
				if (!check[next])
					que.push(make_pair(make_pair(dnext, next), now));
			}
		}
	}
	dfs(1, 0);
	route.pop();
	int count = 0, ndst=1, check_store = 1;
	for (int i=0; i < Tmax; i++) {
		cin >> Nnew;
		if (Nnew) {
			cin >> new_id >> order[i];
			store.push(order[i]);
		}
		cin >> Nput;
		for (int j = 0; j < Nput; j++)
			cin >> trush;
		if (ndst == 1 && !count)
			check_store = 1;
		if (check_store) {
			while (!store.empty()) {
				car.push(store.front());
				store.pop();
			}
		}
		if (check_store&&car.empty())
			cout << "-1" << endl;
		else {
			check_store = 0;
			if (!count) {
				queue<int> keep;
				while (!car.empty()) {
					if (car.front() != ndst)
						keep.push(car.front());
					car.pop();
				}
				while (!keep.empty()) {
					car.push(keep.front());
					keep.pop();	
				}
				int nowp = ndst;
				ndst = route.front().first;
				count = route.front().second;
				route.pop();
				route.push(make_pair(ndst, count));
				if (car.empty()) {
					while (ndst != par[nowp]) {
						ndst = route.front().first;
						count = route.front().second;
						route.pop();
						route.push(make_pair(ndst, count));
					}
				}
			}
			cout << ndst << endl;
			count--;
			cin >> s >> Nachieve;
			for (int j = 0; j < Nachieve; j++)
				cin >> trush;
		}
	}
}


Measured memory_bytes: 1100
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        long gcd(long a, long b) {
            if (b == 0) return a;
            return gcd(b, a % b);
        }

        long getResult(long a, long b) {
            long x = gcd(a, b);
            return a / x * b;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long res = 1L;
            for (int i = 0; i < n; ++i) {
                long x = in.nextLong();
                res = getResult(res, x);
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 22996
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

    money = 100
    x = int(input())

    for i in range(1, 4000):
        money *= 1.01
        money = int(money)

        if money >= x:
            print(i)
            exit()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
# coding: utf-8
# Your code here!
N=int(input())
all=1
ans=1
l=[1]*(N+1)

for n in range(2,N+1):
    for i in range(2,n+1):
        count=1
        while n%i==0:
            n/=i
            l[i]+=1
for item in l:
    ans*=item
    
print(ans%(10**9+7))

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

int findlm(int n,char *in){
  rep(i,n)if(in[i] == 0)return i;
}

int findNotA(int n,char *in){
  for(int i=n-1;i>=0;i--){
    if (in[i] == 0 && (i==0||in[i-1]!= 'A') && (i == n-1 || in[i+1] != 'A'))return i;
  }
  return -1;
}

int nextP(int n,char *in){
  rep(i,n){
    if (in[i] != 0){
      if (i < n-1 && in[i+1] == 0)return i+1;
      if (i >0 && in[i-1] == 0)return i-1;
    }
  }
  return -1;
}

int notNextP(int n,char *in){
  int ret = -1,maxdist=0;
  rep(i,n){
    if( in[i] != 0)continue;
    int tmpdist = 100000;
    for(int j=i-1;j>=0;j--){
      if (in[j] != 0){tmpdist=i-j;break;}
    }
    for(int j=i+1;j<n;j++){
      if (in[j] != 0){tmpdist=min(tmpdist,j-i);break;}
    }
    if (tmpdist > maxdist)ret=i,maxdist = tmpdist;
  }
  return ret;
}

void put(int n,char *in,char inp){
  int index = -1;
  if (inp == 'A'){
    index = findlm(n,in);
  }else if (inp == 'B'){
    index = findNotA(n,in);
    if (index == -1)index = findlm(n,in);
  }else if (inp == 'C'){
    index = nextP(n,in);
    if (index == -1)index =n/2;
  }else if (inp == 'D'){
    index = notNextP(n,in);
    if (index == -1)index = 0;
  }
  in[index] = inp;
}


main(){
  char op[255];
  op['A']='A';  op['B']='B';  op['C']='C';  op['D']='D';
  op[0]='#';

  int n,m;
  char in[100];
  while(cin>>n>>m && n){
    rep(i,n)in[i] = 0;
    rep(i,m){
      char inp;
      cin>>inp;
      put(n,in,inp);
    }
    rep(i,n)cout << op[in[i]] ;
    cout << endl;
  }


}

Measured memory_bytes: 0
#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; 
typedef short int si;
typedef long long int ll;
typedef long int li;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<li,li> pli;
typedef pair<ll,ll> pll;
#define Max 1010
#define inf INT_MAX
#define linf LONG_MAX 
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mkp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define endl '\n'
const ll N=1e3+10;
ll mod=(ll)1e9+7;
signed main()
{
    fast;
    ll pro=1,temp,n,m,k,t,i,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=0,i1=-1,i2=-1;
    cin>>n;
    ll x1,x2,x3,y1,y2,y3;
    temp=ceil(sqrt((ld)n));
    rem=temp*temp-n;
    x2=0;
    x3=1;
    y1=rem;
    y2=0;
    x1=temp;
    y3=temp;
    cout<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<' '<<x3<<' '<<y3;
    return 0;
}
 

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

int main(){
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    double ans;
    double theta = 2 * M_PI * abs((double(H) + double(M) / 60.0)/ 12.0 - double(M) / 60.0);
    // printf("theta = 2 pi %f\n", theta / 2 / M_PI );
    ans = sqrt(A * A + B * B - 2 * A * B * cos(theta));
    printf("%.15f\n", ans);
    return 0;
}

Measured memory_bytes: 4192
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n-1;i++)if(a[i]==a[i+1]){cout<<"NO"<<endl;return 0;}
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

void call(int n)
{
	int i = 1;
	int x;

	do {
		x = i;
		if (x % 3 == 0) {
			printf(" %d", i);
		}
		else {
			do {
				if (x % 10 == 3) {
					printf(" %d", i);
					x = 0;
				}
				else x /= 10;
			} while (x);
		}
	} while (++i <= n);
	putchar('\n');
}

int main()
{
	int n;

	scanf("%d", &n);
	call(n);
	return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

struct RollingHash {
    int n;
    vector<pair<ll,ll>> vec,pw;
    ll mod1,mod2,base1,base2;
    
    RollingHash(string s) {
        srand(time(NULL));
        n=sz(s);
        vec.resize(n+1);
        pw.resize(n+1);
        pw[0]={1,1};
        
        mod1=1e9+93;
        mod2=1e9+97;
        base1=(ll)rand()%((ll)1e7+9);
        base2=(ll)rand()%((ll)1e7+9);
        rep(i,n) {
            pw[i+1].first=pw[i].first*base1%mod1;
            pw[i+1].second=pw[i].second*base2%mod2;
            vec[i+1].first=(vec[i].first*base1+(ll)s[i])%mod1;
            vec[i+1].second=(vec[i].second*base2+(ll)s[i])%mod2;
        }
    }
    
    //[l,r)
    pair<ll,ll> get(int l,int r) {
        ll fi,se;
        fi=(vec[r].first-vec[l].first*pw[r-l].first+mod1*mod1)%mod1;
        se=(vec[r].second-vec[l].second*pw[r-l].second+mod1*mod2)%mod2;
        return make_pair(fi,se);
    }
};

int main() {
    int n;
    string s;
    cin>>n>>s;
    RollingHash rlh(s);
    
    int ng = n/2+1, ok = 0;
    while (ng - ok > 1) {
        int mid = (ng + ok) / 2;
        
        bool f=false;
        for(int i=0;i+mid-1<n;i++) {
            for(int j=i+mid;j+mid-1<n;j++) {
                if(rlh.get(i,i+mid)==rlh.get(j,j+mid)) {
                    f=true;
                    break;
                }
            }
            if(f) break;
        }
        
        (f ? ok : ng) = mid;
    }
    
    cout<<ok<<endl;
}


Measured memory_bytes: 384
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline


h,w,k = map(int,readline().split())
s = read().split()

ans = 0

for maskh in range(1<<h):
    for maskw in range(1<<w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if s[i][j] == "#" and (maskh>>i)&1==0 and (maskw>>j)&1==0:
                    cnt += 1
        #print(maskh,maskw,cnt,k)        
        if cnt == k: ans += 1

print(ans)
        





Measured memory_bytes: 9188
#include <iostream>

using namespace std;

int main()
{
    int n, m, p, a, v, sum=0;
    while (1)
    {
        cin>>n>>m>>p;
        if (n==0 && m==0 && p==0) break;
        for (int i=1; i<=n; i++)
        {
            cin>>a;
            sum+=a;
            if (i==m) v=a;
        }
        if (v==0) cout<<"0\n";
        else cout<<sum*(100-p)/v<<'\n';
        sum=0;
    }

    return 0;
}



Measured memory_bytes: 3088
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
//#define mod 1000000007
#define mod 998244353


int N,M;
signed main(){
    scanf("%lld",&N);
    if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
        printf("hon\n");return 0;
    }else if(N%10==0||N%10==1||N%10==6||N%10==8){
         printf("pon\n");return 0;
    }else{
         printf("bon\n");return 0;
    }
    return 0;
}


Measured memory_bytes: 1644
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  A-=B;
  ll H[N];
  REP(i,N) cin>>H[i];
  
  ll ok=MOD,ng=-1ll;
  while(ok-ng>1){
    ll mid=(ok+ng)/2;
    
    ll cnt=0ll;
    REP(i,N) cnt+=(max(H[i]-B*mid,0ll)+A-1)/A;
    
    if(cnt<=mid) ok=mid;
    else ng=mid;
  }
  
  cout<<ok<<endl;
  return 0;
}

Measured memory_bytes: 4376
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int K = scanner.nextInt();

    long count = 0;
    for (int b = K + 1; b <= N; b++) {
      long r = f(N - K, b) - f(N - b, b) + b - K;
      if (K == 0) r--;
      count += r;
    }
    System.out.println(count);
  }

  private static long f(long x, long y) {
    long p = x / y;
    long q = x % y;
    return (p - 1) * p * y / 2 + p * (q + 1);
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;

  int left, right;
  left = right = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(') left++;
    else right++;
  }

  //printf("left = %d, right = %d\n", left, right);

  int cnt = 0;
  string ss = s;
  for (int i = 0; i < ss.size(); i++) {
    if (ss[i] == '(') {
      for (int j = i + 1; j < ss.size(); j++) {
	if (ss[j] == ')') {
	  ss[j] = 'x';
	  cnt++;
	  break;
	}
      }
    }
  }
  
  int add_right = left - cnt;
  int add_left = right - cnt;

  //printf("add_right = %d, add_left = %d, cnt = %d\n", add_right, add_left, cnt);
  string ans = s;
  for (int i = 0; i < add_right; i++) ans += ')';
  for (int i = 0; i < add_left; i++) {
    ans = '(' + ans;
  }

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


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+50;
ll n,k;
ll a[maxn];
ll log_number(int x,int mid)
{
    if(x%mid==0) return x/mid;
    else return x/mid+1;
}
bool check(int x)
{
    int ans=0;
    for(int i=0;i<n;++i)
    {
        ans+=log_number(a[i],x)-1;
    }
    if(ans>k) return false;
    return true;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;++i) cin>>a[i];
    int l=1,r=1e9;
    int cnt=0;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid)) r=mid-1,cnt=mid;
        else l=mid+1;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 5144
#include <iostream>
#include <vector>

using namespace std;


void divide_by_two(vector<int> A, int* count){
    bool even_f = true;

    for (auto& a : A){
        if (a%2 != 0){
            return;
        }
        else{
            a = a/2;
        }
    }

    *count += 1;

    divide_by_two(A, count);

    return;
}


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

    vector<int> A(n);
    for (int i=0; i<n; i++) cin >> A[i];

    int count=0;
    divide_by_two(A, &count);

    cout << count << endl;


    return 0;
}


Measured memory_bytes: 256
#![allow(dead_code)]
#![allow(non_snake_case)]



fn main(){
    const MOD: i64 = 1_000_000_007;
    let arg: Vec<usize> = input_vec();
    let n = arg[0] as i64;
    let m = arg[1] as i64;

    let md = Mod::new(MOD, 500000);
    
    let mut ans = 0;
    
    for i in 0..=n {
        let i = i as i64;
        let t = md.comb(n, i) * md.perm(m, i) %MOD;
        let t = t * md.pow(md.perm(m-i, n-i), 2) %MOD;
        let t = t * md.pow(-1, i);
        ans += t;
        ans = (ans%MOD+MOD)%MOD;
    }
    println!("{}", ans);
}

struct Math {
    fact:Vec<i64>,
    factinv:Vec<i64>,
}

mod Mod {
    pub struct Elements {
        memo_fact: Vec<i64>,
        memo_invfact: Vec<i64>,
        MOD: i64,
    }

    pub fn new(n: i64, max_fact_size: i64) -> Elements {
        Elements::new(n, max_fact_size)
    }

    fn _pow(mut r: i64, mut n: i64, MOD: i64) -> i64 {
        let mut res = 1i64;
        while n>0 {
            if n%2==1 { res = res*r %MOD; }
            r = r*r % MOD;
            n /= 2;
        }
        res
    }
    
    impl Elements{
        pub fn new(n: i64, max_fact_size: i64) -> Elements {
            let MOD = n;
            let max_fact_size = max_fact_size as usize + 10;
            let mut memo_fact = vec![1i64; max_fact_size];
            let mut memo_invfact = vec![1i64; max_fact_size];
            
            for i in 2..max_fact_size {
                memo_fact[i] = memo_fact[i-1] * i as i64 %MOD;
            }
            memo_invfact[max_fact_size-1] = _pow(memo_fact[max_fact_size-1], MOD-2, MOD);
            for i in (2..max_fact_size).rev() {
                memo_invfact[i-1] = memo_invfact[i] * i as i64 %MOD;
            }
            
            Elements {memo_fact, memo_invfact, MOD}
        }

        pub fn pow(&self, r: i64, n: i64) -> i64 {
            _pow(r, n, self.MOD)
        }

        pub fn inv(&self, n: i64) -> i64 {
            self.pow(n, self.MOD-2)
        }

        pub fn fact(&self, n: i64) -> i64 {
            self.memo_fact[n as usize]
        }

        pub fn invfact(&self, n: i64) -> i64 {
            self.memo_invfact[n as usize]
        }

        pub fn perm(&self, n: i64, r: i64) -> i64 {
            self.fact(n)*self.invfact(n-r) %self.MOD
        }
    
        pub fn comb(&self, n: i64, r: i64) -> i64 {
            self.perm(n, r) * self.invfact(r) %self.MOD
        }
    }

}



/*
 * input function
 */
fn input<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn input_vec<T: std::str::FromStr>() -> Vec<T> {
    input::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 9936
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

signed main() {
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  for (int i = 1; i <= n; i += 2) {
    cnt++;
    if (cnt == k) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	for i := 1 ; i < 10; i++ {
		for j := 1 ; j < 10; j++ {
			if i * j == n {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include<stdio.h>

int main(){
  int val;
  int val2;
  scanf("%d",&val);
  if((val % 10) == 9){
    val2 = 1;
  }else{
    val2 = 9;
  }
  if(((val / 10) % 10) == 9){
    val2 = val2 + 10;
  }else{
    val2 = val2 +  90;
  }
  if((val / 100) == 9){
    val2 = val2 + 100;
  }else{
    val2 = val2 + 900;
  }
  printf("%d\n",val2);
  return 0;
}

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


int main()
{
	int A, B, C;

	cin >> A >> B >> C;


	if (A == B) {
		cout << C << endl;
	}
	else if(B == C) {
		cout << A << endl;
	}
	else {
		cout << B << endl;
	}

    return 0;
}



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

int main(){
	int n;
	cin >> n;
	vector<int > arr1;
	vector<int > arr2;
	int i;
	for(i=0;i<n;i++){
		int temp1 ;
		int temp2 ;
		cin >> temp1 >> temp2;
		arr1.push_back(temp1);
		arr2.push_back(temp2);
	}
	int count = 0;
	for(i=0;i<n;i++){
		if(count<3){
			if(arr1[i]==arr2[i]){
				count++;
			}
			else{
				count = 0;
			}
		}
		else if(count==3){
			break;
		}
	}
	if(count>=3){
		cout << "Yes" << endl;
	}
	else if(count<3){
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	string s, t; cin >> s >> t;
	int n = s.size();
	int m = t.size();
	int res = 2000;
	for(int i = 0; i <= n - m; i++) {
		int cur = 0;
		for(int j = 0; j < m; j++) {
			cur += s[i + j] != t[j];
		}
		res = min(res, cur);
	}
	cout << res << '\n';
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  	char a;
  cin>>a;
  if(a>='A'&&a<='Z')
    cout<<'A';
  else
    cout<<'a';
    
}


Measured memory_bytes: 3648
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long mod = 1e9 + 7;


const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}




int main() {

  long n,k;

  cin >> n >> k;

  vector<long> d(k);
  cin >> d;

  // nは最大50

  vector<long> dig={0,1,2,3,4,5,6,7,8,9};

  vector<long> dig_b(10,false);
  for (int i = 0; i < k; ++i){
    dig_b[d[i]] = true;
  }

  string nst = to_string(n);
  long ndig = nst.size();

  long ans = 0;
  for (long i = n; i < pow(10,ndig + 1); ++i){
    string tmp = to_string(i);
    bool chk = false;
    for(auto c : tmp){
      if (dig_b[ (int)(c - '0')  ] == true)chk = true;
    }

    if (chk == false){
      ans = i;
      break;
    }
  }





  cout << ans <<endl;


}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int a;
  string s;
  while(cin>>a>>s) {
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
  }
}


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

s = []
for i in range(n):
  s.append(input())
  
s.sort()
t =[]
count = 1
for i in range(1,n):
  if s[i-1] == s[i] and i != n-1:
    count+=1
  elif s[i-1] == s[i] and i == n-1:
    count += 1
    t.append([s[i-1],count])
  elif i == n-1:
    t.append([s[i-1],1])
    t.append([s[i],1])
    
  else:
    t.append([s[i-1],count])
    count = 1

t.sort(key=lambda x:x[1])
ma = t[len(t)-1][1]

for i in range(len(t)):
  if t[i][1] == ma:
    print(t[i][0])


Measured memory_bytes: 39084
#include<bits/stdc++.h>                          
using namespace std;
long long n,a[100005],h,ans;           
int main(){
    cin>>h>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i],ans+=a[i];
    if(ans>=h) cout<<"Yes";
    else cout<<"No";
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  // ここにプログラムを追記
  int i = 10;
  int nn = N;
  int f = 0;
  
  do{
    f += nn % i;
    nn -= nn % i;
    nn /= 10;
  }while(nn > 0);
  
  if( N % f == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;
static const double PI = 3.141592653589793;
double solve() {
    double a, b, x;
    scanf("%lf %lf %lf", &a, &b, &x);
    if (x <= a * a * b / 2) return 180 / PI * atan(a * b * b / 2 / x);
    return 180 / PI * atan(2 * (a * a * b - x) / (a * a * a));
}
int main() {
    printf("%.10lf\n", solve());
}


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

typedef struct {
  int parent;
  int left;
  int right;
} node;


void initNode( node* a, int length) {
  int i;

  for( i=0; i<length; i++) {
    a[i].parent = -1;
  }

}


void scanNode( node* a, int length) {
  int i, id;

  for( i=0; i<length; i++) {
    scanf("%d", &id);

    scanf("%d%d", &a[id].left, &a[id].right);
    if( a[id].left != -1) {
      a[ a[id].left ].parent = id; //左の子の親はid
    }
    if( a[id].right != -1) {
      a[ a[id].right ].parent = id; //右の子の親はid
    }
  }

}


int searchRoot( node *a, int length) {
  int i;

  for( i=0; i<length; i++) {
    if( a[i].parent == -1 ) {
      return i;
    }
  }

  return -1;
}


void preorder( node* a,  int root) {
  printf(" %d", root);
  
  if( a[root].left != -1) {
    preorder( a, a[root].left);
  }
  if( a[root].right != -1) {
    preorder( a, a[root].right);
  }
  
}


void inorder( node* a, int root) {
  if( a[root].left != -1) {
    inorder( a, a[root].left);
  }
  printf(" %d", root);
  
  if( a[root].right != -1) {
    inorder( a, a[root].right);
  }
}

void postorder( node* a, int root) {
  if( a[root].left != -1) {
    postorder( a, a[root].left);
  }
  if( a[root].right != -1) {
    postorder( a, a[root].right);
  }
  printf(" %d", root);

}


int main() {

  int n, r;
  node* a;

  int i;

  scanf("%d", &n);

  a = (node* )malloc( sizeof( node ) * n);

  initNode( a, n);

  scanNode( a, n);

  r = searchRoot( a, n);

  printf("Preorder\n");
  preorder( a, r);
  printf("\n");

  printf("Inorder\n");
  inorder( a, r);
  printf("\n");

  printf("Postorder\n");
  postorder( a, r);
  printf("\n");

  return 0;

}

Measured memory_bytes: 616
#include<stdio.h>
int min(int a,int b){
  if(a<b){
    return a;
  }else{
    return b;
  }
}
 
int main(){
  int n,ans=0;
  scanf("%d",&n);
  int b[n];
  for(int i=0;i<n-1;i++){
    scanf("%d",&b[i]);
  }
  ans+=b[0]+b[n-2];
  for(int i=0;i<n-2;i++){
    ans+=min(b[i],b[i+1]);
  }
  
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int A, B, C, X;
  ci(A, B, C, X);
  int a = 0;
  rep(i, A + 1){
    rep(j, B + 1){
      rep(k, C + 1){
        if(i * 500 + j * 100 + k * 50 == X){
          a++;
        } 
      }
    }
  }
  co(a);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e18+9)
#define fi first
#define se second
#define MAXN   1000001 
typedef long long ll;
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){
	
    long long ret = 1;
    
    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }
  
 return ret;
}
ll add(ll a,ll b){
	return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
	a%=mod;
	b%=mod;
	return ((a%mod)*(b%mod)%mod);
}
int fun[100005][3];
int dp[3][100005];
int main()
{
    int n,q,m,k;
    
    	cin>>n;
    	
    	for(int i=0;i<n;i++){
    		int a,b,c;
    		cin>>a>>b>>c;
    		fun[i][0]=a;
    		fun[i][1]=b;
    		fun[i][2]=c;
		}
    	dp[0][0]=fun[0][0];
    	dp[1][0]=fun[0][1];
    	dp[2][0]=fun[0][2];
    	for(int i=1;i<n;i++){
    		for(int j=0;j<3;j++){
    			dp[j][i]=max(dp[(j+1)%3][i-1]+fun[i][j],dp[(j+2)%3][i-1]+fun[i][j]);
			}
		}
		cout<<max({dp[0][n-1],dp[1][n-1],dp[2][n-1]})<<"\n";
   
    return  0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

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

using namespace std;

int main(){

    int N;cin >> N;
    set<int> s;

    int a;
    rep(i,N){
        cin >> a;
        s.insert(a);
    }
    
     cout << s.size() << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  ll N; cin >> N;
  vector<ll> A(N); REP(i, N) cin >> A[i];
  ll cnt = 0;
  vector<ll> S(N + 1); S[0] = 0;
  for(int i = 0; i < N; ++i) S[i + 1] = S[i] + A[i];
  map<ll, ll> m;
  REP(i, S.size()) m[S[i]]++;
  for(auto x : m) {
    cnt += 0.5 * x.second * (x.second - 1);
  }
  cout << cnt << endl;
}

Measured memory_bytes: 18576
S = input()

if S == 'RRR':
    print("3")
elif S == 'RRS':
    print("2")
elif S == 'SRR':
    print("2")
elif S == 'RSR':
    print("1")
elif S == 'RSS':
    print("1")
elif S == 'SRS':
    print("1")
elif S == 'SSR':
    print("1")
elif S == 'SSS':
    print("0")

Measured memory_bytes: 9048