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

int main(){
  
  int a;
  string b;
  cin >> a >> b;

  if( a >= 3200 ){
    
    cout << b << endl;
   
  }
  
  else{
    
    cout << "red" << endl;
    
  }
 
}
  


Measured memory_bytes: 3604
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	char c[1005],ap[6]="apple",pe[6]="peach";
	int x=0,i,f;
	gets(c);
	while(x+4<strlen(c)) {
	 f=0;
	 for (i=0;i<5;i++) if (c[x+i]==ap[i]) f++;
	 if (f==5) for (i=0;i<5;i++) c[x+i]=pe[i];
	 if (f==0) {
		 for (i=0;i<5;i++) if (c[x+i]==pe[i]) f++;
		 if (f==5) for (i=0;i<5;i++) c[x+i]=ap[i];
	 }
	 if (f==5) x+=5; else x++;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 1124
#include <iostream>
#include <queue>

using namespace std;
const int INF = -1;
const int MaxH = 1000;
const int MaxW = 1000;
const int MaxN = 10;
int h,w;
char ma[MaxH][MaxW];
int dx[4] = {1,0,-1,0};
int dy[4] = {0, 1, 0, -1};
int N;
int res;
int cx[10], cy[10];
int t[MaxH][MaxW];
typedef pair<int,int> P;

int dfs(int start){
    queue<P> que;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            t[i][j] = INF;
        }
    }
    int sx = cx[start];
    int sy = cy[start];
    int ex = cx[start+1];
    int ey = cy[start+1];
    que.push(P(sy,sx));
    t[sy][sx] = 0;
    while(que.size()){
        P p = que.front();
        que.pop();
        if(p.first == ey && p.second == ex) break;
        for(int i = 0; i< 4; i++){
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if (0 <= nx && nx < w && 0 <= ny && ny < h && ma[ny][nx] != 'X' && t[ny][nx] == INF){
                t[ny][nx] = t[p.first][p.second] + 1;
                que.push(P(ny,nx));
            }
        }
    }
    return t[ey][ex];
}

void solve(){
    res = 0;
    cin >> h >> w >> N;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> ma[i][j];
            if(ma[i][j] == 'S'){
                cx[0] = j;
                cy[0] = i;
            }
            if(ma[i][j] >= '1' && ma[i][j] <= '9' ){
                cx[ma[i][j] - '0'] = j;
                cy[ma[i][j] - '0'] = i;
            }
        }
    }
    for (int i = 0; i < N;i++){
        res += dfs(i);
    }
    cout << res << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 8048
x,y=map(int,input().split())
cnt=0
if x>=0:
    if y>0:
        if abs(x)>abs(y):
            cnt=2
    else:
        cnt=1
else:
    if y>0:
        cnt=1
    else:
        if abs(x)<abs(y):
            cnt=2
print(cnt+abs(abs(x)-abs(y)))


Measured memory_bytes: 3064
package main

import "fmt"

func main (){
	var counter,temp int
	fmt.Scanf("%d",&temp)
	counter=temp
	arr:=make([] int,counter,10000)
	char:=make([] byte,counter,10000)
	arr1:=make([] int,counter,10000)
	char1:=make([] byte,counter,10000)
	for i:=0;i<counter ;i++  {
		fmt.Scanf("%c%d",&char[i],&arr[i])
	}
	chartar,arrtar:=findstable(arr,char)
	copy(arr1,arr)
	copy(char1,char)
	for i:=0;i<counter;i++ {
		for j:=counter-1;j>i ;j--  {
			if arr[j]<arr[j-1] {
				swap(arr,char,j,j-1)
			}
		}
	}
	output(arr,char)
	Isstable(arr,char,arrtar,chartar)
	for i:=0;i<counter ;i++  {
		mini:=i
		j:=0
		for j=i;j<counter ;j++  {
			if arr1[j]<arr1[mini] {
				mini=j
			}
		}
		swap(arr1,char1,i,mini)
	}
	output(arr1,char1)
	Isstable(arr1,char1,arrtar,chartar)
}
func output(arr []int,char []byte){
	i:=0
	for i=0;i<len(arr)-1 ; i++ {
		fmt.Printf("%c%d ",char[i],arr[i])
	}
	fmt.Printf("%c%d",char[i],arr[i])
	fmt.Println()
}
func swap(arr []int,char []byte,j int,k int) {
	temp:=arr[j]
	tempc:=char[j]
	arr[j]=arr[k]
	char[j]=char[k]
	arr[k]=temp
	char[k]=tempc
}
func Isstable(arr []int, char []byte, arrtar []int,chartar []byte) {
	for j:=0;j<len(arrtar) ;j++ {
		for i:=0;i<len(arr) ;i++  {
			if arr[i] == arrtar[j] {
				if char[i] != chartar[j] {
					fmt.Println("Not stable")
					return
				}
				break
			}
		}
	}
	fmt.Println("Stable")
}
func findstable(arr []int, char []byte) ([]byte,[]int){
	arrtemp:=make([]int,len(arr),1000)
	chartemp:=make([]byte,len(char),1000)
	copy(arrtemp,arr)
	copy(chartemp,char)
	var dytararr []int
	var dytarbyte []byte
	var temp int =-1
	for i:=0;i<len(arrtemp);i++  {
		if arrtemp[i]==0{
			continue
		}
		for j:=i+1;j<len(arrtemp);j++  {
			if temp ==arrtemp[j] {
				arrtemp[j] = 0
			}
			if arrtemp[i]!=0 && arrtemp[i] == arrtemp[j] {
				//fmt.Println(char[i],arr[i])
				dytararr = append(dytararr, arrtemp[i])
				dytarbyte = append(dytarbyte, chartemp[i])
				temp = arrtemp[i]
				arrtemp[j]=0
				//break
			}

		}
	}
	return dytarbyte,dytararr
}


Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  int x[101];
  int y[101];
  double d = 0, d1 = 0, d2 = 0, d3 = 0, d4 = 0;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> x[i];
  }
  for (int i = 0; i < n; i++)
  {
    cin >> y[i];
  }
  for (int i = 0; i < n; i++)
  {
    d = abs(x[i] - y[i]);
    d1 += d;
    d2 += pow(d, 2);
    d3 += pow(d, 3);
    if (d4 < d)
    {
      d4 = d;
    }
  }
  d2 = sqrt(d2);
  d3 = pow(d3, (1.0 / 3.0));
  printf("%.8lf", d1);
  cout << "\n";
  printf("%.8lf", d2);
  cout << "\n";
  printf("%.8lf", d3);
  cout << "\n";
  printf("%.8lf", d4);
  cout << "\n";
}


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

int main()
{
  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= 100; i++)
  {
    for (int j = 0; j <= 100; j++)
    {
      if (2 * i + 4 * j == y && i + j == x)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    int a,b,c;cin>>a>>b>>c;
    int ans = min(min(a+b, a+c),b+c);
    cout<<ans<<endl;

}

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

int main() {
  int a, b; cin >> a >> b;
  
  int ans = 0; int x = 1;
  while(x < b){
    x--; x+= a; ans ++;
  }
  
  cout << ans << endl;
  
  return 0;
}

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

int a, b, c;
int main() 
{
    cin >> a >> b >> c;
    if(a == 1)
    {
        cout << "YES" << endl;
        return 0;
    }
    for(int i = 1;i <= 100;++ i)
    {
        if(a * i % b == c)
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdlib.h> 
#include <stdio.h>
#include <iostream>

using namespace std; 

int main()
{
   int k,a,b; 
   bool acc = false;

	cin>>k;
  	cin>>a>>b;
  
    for(int i = a; i <= b; i++)
    {
        if(i % k == 0 )
        {
            cout<<"OK";
            acc = true;
            return 0; 
        }
    }

    if( acc == false) cout<<"NG";

    return 0;
}



Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define mk make_pair
#define pb push_back
#define eps 1e-12
#define MAXN 200009
#define maxn 200009
using namespace std;
const ll INF = 100000000000;
struct edge
{
	ll a,b,cap,flow;
};
ll num,s,t,d[maxn],ptr[maxn],q[maxn];
vector<ll> g[maxn];
vector<edge> e;
inline void add_edge(ll a,ll b,ll cap)
{
	edge e1={a,b,cap,0};
	edge e2={b,a,0,0};
	g[a].pb(e.size());
	e.pb(e1);
	g[b].pb(e.size());
	e.pb(e2);
}
bool bfs()
{
	queue<ll> q;
	for(int i=0;i<=num;i++)
	{
		d[i]=-1;
	}
	d[s]=0;
	q.push(s);
	while(!q.empty())
	{
		if(d[t]!=-1)
		{
			return true;
		}
		ll x=q.front();
		q.pop();
		for(ll i=0;i<g[x].size();i++)
		{
			ll id=g[x][i];
			ll nxt=e[id].b;
			if(e[id].flow<e[id].cap)
			{
				if(d[nxt]==-1)
				{
					d[nxt]=d[x]+1;
					q.push(nxt);
				}
			}
		}
	}
	return false;
} 
ll dfs(ll vv,ll flow)
{
	if(!flow) return 0;
	if(vv==t) return flow;
	for(;ptr[vv]<(ll)g[vv].size();++ptr[vv])
	{
		ll id=g[vv][ptr[vv]],
			to=e[id].b;
		if(d[to]!=d[vv]+1) continue;
		ll pushed=dfs(to,min(flow,e[id].cap-e[id].flow));
		if(pushed)
		{
			e[id].flow+=pushed;
			e[id^1].flow-=pushed;
			return pushed;
		}
	}
	return 0;
}
ll dinic()
{
	ll flow=0;
	while(1)
	{
		if(!bfs())
		{
			break;
		}
		memset(ptr,0,num*sizeof ptr[0]);
		while(1)
		{
			ll pushed=dfs(s,INF);
			if(!pushed)
			{
				break;
			}
			flow+=pushed;
		}
	}
	return flow;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h,w;
	cin>>h>>w;
	string str[h+10];
	for(int i=0;i<h;i++)
	{
		cin>>str[i];
	}
	s=h+w;
	t=h+w+1;
	num=h+w+10;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(str[i][j]=='o')
			{
				add_edge(i,h+j,1);
				add_edge(h+j,i,1);
			}
			else if(str[i][j]=='S')
			{
				add_edge(s,i,INF);
				add_edge(s,h+j,INF);
				add_edge(i,h+j,INF);
				add_edge(h+j,i,INF);
			}
			else if(str[i][j]=='T')
			{
				add_edge(i,t,INF);
				add_edge(h+j,t,INF);
				add_edge(i,h+j,INF);
				add_edge(h+j,i,INF);	
			}
		}
	}
	ll ans=dinic();
	if(ans>=INF)
	{
		cout<<"-1\n";
	}
	else
	{
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 10152
import java.util.*;
import java.math.*;
     
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){

            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());

            System.out.println(a*b);

        }catch(Exception e){
            e.printStackTrace();
        }        
    }
}

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

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
typedef long long ll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

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

    vector<ll> hp(n);rep(i,n)cin>>hp[i];
    sort(hp.begin(),hp.end());
    
    ll ans = 0;
    rep(i,n-k)ans += hp[i];
    cout<<ans<<endl;return 0;
}


Measured memory_bytes: 1792
#include <iostream>

bool Solve(int n) {
    if(n == 0) return true;
    if(n < 0) return false;
    int res = Solve(n - 4) || Solve(n - 7);
    return res;
}

int main() {
    int n;

    std::cin >> n;

    if(Solve(n)) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int mod=1e9+7;

int po(int x,int y,int m){
	if (y==0)
		return 1;
	int t=po(x,y/2,m)%m;
	t=(t*t)%m;
	if (y&1)
		return (t*x)%m;
	return t%m;
}

int lb(int a[],int n,int x){
    int l=-1;  //a[l]<x
    int r=n;   //a[r]>=x
    while(r>l+1){
    	int m=l+(r-l)/2;
    	if (a[m]<x)
    		l=m;
    	else
    		r=m;
    }
    return r;
}

int ub(int a[],int n,int x){
    int l=-1;  //a[l]<=x
    int r=n;   //a[r]>x
    while(r>l+1){
    	int m=l+(r-l)/2;
    	if (a[m]>x)
    		r=m;
    	else
    		l=m;
    }
    return l;
}

signed main() {

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	
   	int n;
   	cin>>n;
   	std::vector<int> v(n);
   	for (int i=0;i<n;++i)
   		cin>>v[i];
   	int ans=0;
   	for (int i=1;i<n;++i){
   		if (v[i]<v[i-1]){
   			ans+=abs(v[i-1]-v[i]);
   			v[i]=v[i-1];
   		}
   	}
   	cout<<ans<<endl;
}

Measured memory_bytes: 4776
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    string s;
    int n;
    cin >> n >> s;
    rep(i,s.size()){
        int j = s[i] - 'A';
        j = (j + n) % 26;
        putchar(j +'A');
    }
}

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

int main(void) {
    int n;
    cin >> n;
    vector<int> cnt(1e5 + 1);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        cnt.at(x)++;
        sum += x;
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int b, c;
        cin >> b >> c;
        cnt.at(c) += cnt.at(b);
        sum += (c - b) * cnt.at(b);
        cnt.at(b) = 0;
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	string s, t;
	cin >> s >> t;
	vector<char> s_v(s.begin(), s.end());
	vector<char> t_v(t.begin(), t.end());

	//sは昇順、tは降順ソート
	sort(s_v.begin(), s_v.end());
	sort(t_v.begin(), t_v.end(), greater<char>());

	if (s_v < t_v) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>V[I]
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>inline T lcm(T a,T b){return a*b/gcd(b,a%b);}
double T,X;
inline void solve(){
  IN2(T,X);
  OUT(T/X);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
fn main() {
    let (a, b) : (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    
    println!("{}", std::cmp::max(0, a - 2 * b));
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#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(x) (x).begin(),(x).end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  cin>>n;
  vector<pair<int,int> > v;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    v.pb(make_pair(a,b));
  }
  sort(all(v));
  int sa=v[n-1].first-v[0].first;
  
  int ans=0;
  if(sa==n){
    ans+=sa;
    ans+=v[n-1].second;
  }else{
    ans+=n;
    ans+=v[0].first-1;
    ans+=v[n-1].second;
    ans+=v[n-1].first-v[0].first-n+1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <string>
#define int long long
using namespace std;

string s;
int n;

signed main() {
	int i, j;
	
	cin >> s;
	n = s.length();
	
	int ans = 0;
	for (i = 0; i < (1 << (n - 1)); i++) {
		int ssum = 0;
		int val = 0;
		for (j = 0; j < n - 1; j++) {
			val *= 10;
			val += s[j] - '0';
			if ((i >> j) & 1) {
				ssum += val;
				val = 0;
			}
		}
		val *= 10;
		val += s[n - 1] - '0';
		ssum += val;
		ans += ssum;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin>>n>>x;
  vector<int> s(n,0);
  for(int i=0;i<n;i++)cin>>s[i];
  sort(s.begin(),s.end());
  for(int i=1;i<n;i++)s[i]+=s[i-1];
  for(int i=0;i<n;i++){
    if(x<s[i]){
      cout<<i<<endl;
      return 0;
    }
    else if(x>s[i])continue;
    else{
      cout<<i+1<<endl;
      return 0;
    }
  }
  cout<<n-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[3];
int main()
{
    int n;

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        int a, b, c;

        cin >> a >> b >> c;

        int c0, c1, c2;

        c0 = dp[0];
        c1 = dp[1];
        c2 = dp[2];

        dp[0] = max(c1, c2) + a;
        dp[1] = max(c0, c2) + b;
        dp[2] = max(c0, c1) + c;
    }

    cout << max(max(dp[0], dp[1]), dp[2]);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <utility>
#include <set>

#define fprintf(...) void(0)

int main() {
  size_t N;
  scanf("%zu", &N);

  const int INF=12345;
  std::vector<std::vector<int>> g(N+1, std::vector<int>(N+1, INF));
  std::map<std::string, size_t> labels;
  std::vector<std::pair<bool, std::string>> stmt;
  for (size_t i=0; i<N; ++i) {
    char buf[128];
    scanf("%s", buf);
    std::string s=buf;
    if (s == "goto") {
      // goto statement
      scanf("%s", buf);
      std::string label=buf;
      label.pop_back();
      stmt.emplace_back(true, label);
    } else {
      // label statement
      stmt.emplace_back(false, s);
      s.pop_back();
      fprintf(stderr, "%s: L%zu\n", s.c_str(), i);
      labels[s] = i;
    }
  }

  for (size_t i=0; i<N; ++i) {
    bool is_goto=stmt[i].first;
    if (is_goto) {
      g[i][i+1] = 1;
      g[i][labels[stmt[i].second]] = 0;
      fprintf(stderr, "1:  %zu -> %zu\n", i, labels[stmt[i].second]);
    } else {
      g[i][i+1] = 0;
    }
    fprintf(stderr, "0: %zu -> %zu\n", i, i+1);
  }

  for (size_t k=0; k<=N; ++k)
    for (size_t i=0; i<=N; ++i)
      for (size_t j=0; j<=N; ++j)
        g[i][j] = std::min(g[i][j], g[i][k]+g[k][j]);

  printf("%d\n", g[0][N]);
}


Measured memory_bytes: 2952
N, M = (int(i) for i in input().split())
a = [int(input()) for i in range(M)]
broken = [False] *(N+1)
for i in range(M):
    broken[a[i]] = True

dp = [0]*(N+1)
dp[0] = 1
mod = 1000000007

for i in range(N):
    for j in range(i+1, min(N+1, i+3)):
        if not broken[j]:
            dp[j] += dp[i]


print(dp[N]%mod)


Measured memory_bytes: 466552
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		double t=sc.nextInt();
		double x=sc.nextInt();
		System.out.println(t/x);
	}

}


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

int main(void){
  string str;
  cin >> str;
  if (str.length()<=3){
    int val = atoi(str.c_str());
    printf("%d\n",abs(val-753));
    return 0;
  }
  int length = str.length();
  int m = 999;
  for (int i = 0; i < length-2; i++) {
    int val = atoi(str.substr(i,3).c_str());
    m = min(m,abs(val-753));
  }
  printf("%d\n",m);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>
#include <ctime>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define umap unordered_map

using namespace std;

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

const int N = 55;

int d[N][N];
vector<P> G[N];
int ball[N];

priority_queue<int> cand[N][1 << 7];

struct state{
	int pos, visit, total;
	bool operator < (const state &r) const{
		return total > r.total;
	}
};

int main(){
	ios::sync_with_stdio(false);

	int n, m, l, k;
	while (cin >> n >> m >> l >> k, n | m | l | k){
		rep(i, N) rep(j, N) d[i][j] = 1 << 29;
		rep(i, N) rep(j, 1 << 7) while (!cand[i][j].empty()) cand[i][j].pop();
		rep(i, N) G[i].clear();
		MEMSET(ball, 0);
		rep(i, m){
			int u, v, c;
			cin >> u >> v >> c;
			--u, --v;
			d[u][v] = d[v][u] = c;
			G[u].push_back(MP(v, c));
			G[v].push_back(MP(u, c));
		}
		int s, g;
		cin >> s >> g;
		--s, --g;
		rep(i, l){
			int b;
			cin >> b;
			ball[--b] = 1 << i;
		}
		rep(i, n) rep(j, n) rep(k, n) d[j][k] = min(d[j][k], d[j][i] + d[i][k]);

		priority_queue<state> q;
		q.push({s, ball[s], 0});

		int cnt = 0, ans = -1;
		if (d[s][g] >= 1 << 29) goto fail;
		while (!q.empty()) {
			auto s = q.top();
			q.pop();

			auto &pq = cand[s.pos][s.visit];
			if (!pq.empty() && pq.top() < s.total) continue;

			if (s.pos == g && s.visit + 1 == (1 << l)){
				//cout << s.total << endl;
				if (++cnt == k){
					ans = s.total;
					break;
				}
			}

			for (auto e : G[s.pos]){
				state nxt = s;
				nxt.pos = e.first;
				nxt.total += e.second;
				nxt.visit |= ball[nxt.pos];
				auto &c = cand[nxt.pos][nxt.visit];
				if (c.size() < k || nxt.total < c.top()){
					q.push(nxt);
					c.push(nxt.total);
					if (c.size() > k) c.pop();
				}
			}
		}

	fail:;

		if(ans >= 0) cout << ans << endl;
		else cout << "NA" << endl;
	}

	return 0;
}

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


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
ll n,m;
cin>>n>>m;

if(n>m)swap(n,m);

if(n==1&&m==1)
{
	ol("1");
	return 0;
}

if(n==1)
{
	ol(m-2);
	return 0;
}

ol((n-2)*(m-2));

return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;

struct edge{int to,cost;};

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

	int n,i;
	cin >> n >> i;

	cout << n-i+1 << "\n";
	

	return 0;
}

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

int main(void) {
	int N, K;
	scanf("%d %d", &N, &K);
	vector<int> h(N);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &h[i]);
		if (h[i] >= K) ans++;
	}
	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 640
//Created Time:2019/12/9 8:57:49
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define ll __int128 
#define mod 1000000007

using namespace std;

ll f[100];

void init();
void work(ll, ll);
int calc(ll, ll, ll, ll);
ll read();

int main(){
	init(); int t; cin >> t;
	while(t--){
		ll x = read(), y = read();
		if(x > y) swap(x, y); work(x, y);
	}
	return 0;
}

void init(){
	f[1] = 1;
	for(int i = 2; i <= 88; ++i)
		f[i] = f[i - 1] + f[i - 2];
	return ;
}

int calc(ll x, ll y, ll a, ll b){
	int ans = ((y - b) / a + 1) % mod;
	if(b <= x) (ans += ((y - a) / b + 1) % mod) %= mod;
	return ans;
}

void work(ll x, ll y){
	if(x == 1){
		printf("%d %d\n", 1, y % mod);
		return ;
	}
	if(x == 2 && y == 2){
		puts("1 4");
		return ;
	}
	int pos = upper_bound(f + 1, f + 89, x) - f - 1;
	if(f[pos + 1] > y) --pos; printf("%d ", pos - 1);
	ll a = f[pos], b = f[pos + 1];
	int ans = calc(x, y, a, b);
	for(int i = 2; i < pos; ++i){
//		for(int j = 1; j; ++j){
		ll na = a + f[pos - i] * f[i], nb = b + f[pos - i + 1] * f[i];
		if(na < a || nb < b || na > x || nb > y) continue; 
		(ans += calc(x, y, na, nb)) %= mod;
//		}
	}
	printf("%d\n", ans);
	return ;
}

ll read(){
	ll x = 0; char ch = getchar();
	for(; !isdigit(ch); ch = getchar());
	for(; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
	return x;
}


Measured memory_bytes: 3968
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

template<class T>
T gcd(T a, T b)
{
    if (a == 0) return b;
    else if (b == 0) return a;

    if (b > a) swap(a, b); // assume a >= b

    T ret = b;
    while (a % b != 0) {
        ret = a % b;
        a = b;
        b = ret;
    }
    return ret;
}


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

    int N;
    long long int X;
    cin >> N >> X;

    long long int tmp_x;
    long long int ans = 0;
    for (int i = 0; i < N; ++i) {
        cin >> tmp_x;
        ans = gcd(ans, abs(tmp_x - X));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
  
using namespace std;
  
int main(void){
  int a=1,b=1;
  int tmp;
  while(1){
      cin>>a>>b;
      if(a==0&&b==0) break;
      if(a>b){
          tmp=a;
          a=b;
          b=tmp;
      }
      cout<<a<<" "<<b<<endl;
  }
  
  return 0;
  
}



Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
	int n, x,i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &x);
		if (x % 2 == 0)
			if (x % 3 != 0 && x % 5 != 0)
			{
				printf("DENIED");
				exit(0);
			}
	}
	if (i == n)
		printf("APPROVED");
}

Measured memory_bytes: 128
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    
    let mut buf: String = String::new();

    stdin.lock().read_line(&mut buf).expect("read_line()");
    stdin.lock().read_line(&mut buf).expect("read_line()");
    let vec: Vec<&str> = buf.split_whitespace().collect();

    // The number of elements (r0, r1, ..., r_n-1)
    let n = vec[0].parse().unwrap();

    // The old value r_t-1 at r_t
    let mut r_old: i32 = vec[1].parse().unwrap(); // r_t-1

    // Minimum value of range r0, r1, ..., rt
    let mut min = r_old;

    // Current maximum gain
    let mut gain_max: i32 = -1000000000;

    // Current gain
    let mut gain = 0;

    let mut buf = String::new();
    for _t in 1..n {
        stdin.lock().read_line(&mut buf).expect("read_line()");
    }
    let r_series: Vec<&str> = buf.split_whitespace().collect();
    for t in 1..n {
        let rt = r_series[t-1].parse().unwrap();
        let diff = rt - r_old;
        if min > rt {
            min = rt;
            if gain_max < diff {
                gain_max = diff;
            }
            gain = 0;
        } else {
            gain += diff;
            if gain_max < gain {
                gain_max = gain;
            }
        }
        r_old = rt;
    }
    println!("{}", gain_max);
}



Measured memory_bytes: 12676
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

using ll = long long;
using P = pair<int, int>;

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    ll n, k;
    cin >> n >> k;
    if (k < n) n %= k;
    cout << min(n, k - n) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
char s[N];
int len,cnt=0,maxl[N];
int main()
{
	//freopen("pp.in","r",stdin);
	scanf("%s",s+1);
	len=strlen(s+1);
	for (int i=0;i<=len+1;i++) maxl[i]=i;
	int r=2;
	while (r<=len)
	{
		int l=maxl[r-1],r1=r;
		while (l>=1 && r<=len && s[l]!=s[r]) {
			l=maxl[l-1];r++;
			cnt+=2;
		}
		maxl[r-1]=l;
		if (r1==r) r++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 768
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


a,b = map(int, input().split())
def sub(a):
    # 0^1^...^a-1
    ans = 0
    for i in range(a.bit_length()):
        l = pow(2,i)
        num = (a//(l*2)) * l + min(l, a%(l*2))
        num1 = a - num
        if num1%2:
            ans += l
    return ans
def sub2(a):
    ans = 0
    for i in range(a):
        ans ^= i
    return ans
ans = sub(b+1) ^ sub(a)
print(ans)

Measured memory_bytes: 62016
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
using namespace std;
#define MAX 30
#define MOD 998244353
char s[MAX];
int main()
{
    int n,i,j;
    char t[2]={'h','i'};
    for(i=0;;i++)
    {
        scanf("%c",&s[i]);
        if(!(s[i]>='a'&&s[i]<='z')) break;
    }
    n=i;
    bool res=(n%2==0);
    for(i=0;i<n;i++)
    {
        res=res&&(s[i]==t[i%2]);
    }
    if(res)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int[]> table = new List<int[]>();

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                int[] temp = Array.ConvertAll(input.Split(','), int.Parse);
                table.Add(temp);
            }

            int m = table.Count / 2;

            for (int i = 1; i <= m; i++)
            {
                table[i][0] += table[i - 1][0];
                table[i][table[i].Length - 1] += table[i - 1][table[i].Length - 2];

                for (int j = 1; j < table[i].Length - 1; j++)
                {
                    int a = table[i][j] + table[i - 1][j - 1];
                    int b = table[i][j] + table[i - 1][j];
                    table[i][j] = Math.Max(a, b);
                }
            }

            for (int i = m + 1; i < table.Count; i++)
            {
                for (int j = 0; j < table[i].Length; j++)
                {
                    int a = table[i][j] + table[i - 1][j];
                    int b = table[i][j] + table[i - 1][j + 1];
                    table[i][j] = Math.Max(a, b);
                }
            }
            Console.WriteLine(table[table.Count - 1][0]);
        }
    }
}

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

int main(void)
{
    int N;
    vector<long long> L;
    cin >> N;

    for(int i=0; i < N; ++i){
        long long t;
        cin >> t;
        L.push_back(t);
    }



    int count = 0;
    for(int i=0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            for(int k=0; k < N; ++k){
                if(L[i] != L [j] && L[j] != L[k] && L[k] != L[i]){
                    if( (L[i] + L[j] > L[k]) && (L[j] + L[k] > L[i]) && (L[k] + L[i] > L[j]) ){
                        if(i < j && j < k){
                            ++count;
                        }
                    }
                }
            }
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
int main(){
	int sum=0,temp=1;
	long long n;

	cin >>n;
	for(int i=1;i<n;i*=10)temp*=10;
	while(1){
		sum+=n/temp%10;
		if(temp==1)break;
		temp/=10;
	}
	if(n%sum==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}

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

int main(){
    int n,i,j,k,x,swap,*A;

    scanf("%d",&n);

    A = (int *) malloc ( sizeof(int) * n);

    for(j=0;j<n;j++) scanf("%d",&A[j]);

    i=-1;

    for(j=0;j<n-1;j++){
        if(A[j] <= A[n-1]) {
            i++;
            swap=A[i];
            A[i]=A[j];
            A[j]=swap;
        }
    }

    swap=A[i+1];
    A[i+1]=A[n-1];
    A[n-1]=swap;

    for(j=0;j<=i;j++) printf("%d ",A[j]);
    printf("[%d]",A[i+1]);
    for(j=i+2;j<n;j++) printf(" %d",A[j]);
    printf("\n");

    return 0;    
}


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




 
int main(){
	int n, m ,k;
	cin >> n >> m >> k;
	vector<int> N(n); 
	vector<int> M(m); 
	rep(i, n) cin >> N[i];
	rep(i, m) cin >> M[i];
	ll t = 0;
	int ans = 0;
	int j = m;
	rep(i, m) t += M[i];
	rep(i, n+1) {
		while (j > 0 && t > k){
			--j;
			t -= M[j];
		}
		if(t > k) break;
		ans = max(ans, i+j);
		if(i == n) break;
		t += N[i];
		
	}
	cout << ans << endl;

}

Measured memory_bytes: 4800
#include <iostream>
#define MAX_N 50
using namespace std;
int dx[8] = {-1, 0, 1, -1, 1, -1,  0,  1};
int dy[8] = {1,  1, 1, 0,  0, -1, -1, -1};
int main(void){
  int h, w;
  string s[MAX_N];
  cin >> h >> w;
  for(int i = 0; i < h; i++) cin >> s[i];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#') continue;
      int cnt = 0;
      for(int d = 0; d < 8; d++){
        int nx = j + dx[d];
        int ny = i + dy[d];
        if(!(0 <= nx && nx < w)) continue;
        if(!(0 <= ny && ny < h)) continue;
        if(s[ny][nx] == '#') cnt++;
      }
      s[i][j] = cnt + '0';
    }
  }
  for(int i = 0; i < h; i++) cout << s[i] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()


int main(){
  int n,cnt=0;
  cin >> n;
  vi p(n);
  vi q(n);

  rep(i,0,n) cin >> p[i];
  rep(i,0,n) cin >> q[i];

  if(p>q){
    vi temp(n);
    temp=p;
    p=q;
    q=temp;
  }

  while(p != q){
    cnt++;
    next_permutation(all(p));
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	if (a%2==0){
        	System.out.println(a/2);
        }else if (a%2==1){
          	System.out.println((a/2)+1);
        }
    }
}

Measured memory_bytes: 21844
#include <cmath>
#include <vector>
#include <iomanip>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <limits> 

using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<PII> VP;

ll fact[15];
int n;
string s;
vector<string> sequences;

void generate(int m, int dig, string& seq) {
	if (m == 0) {
		sequences.push_back(seq);
		return;
	}
	if (dig == 10) return;
	for (int i = m; i >= 0; --i) {
		if (i > 0) seq += string(i, '0'+dig);
		generate(m-i, dig+1, seq);
		for (int j= 0; j < i; ++j) seq.pop_back();
	}
} 

int cmpr(const string& a, const string& b) {
	int suma = 0, sumb = 0;
	ll mula = 1, mulb = 1;
	for (auto& x : a) {
		int dig = x-'0';
		suma += dig;
		mula *= (dig+1);
	}
	for (auto& x : b) {
		int dig = x-'0';
		sumb += dig;
		mulb *= (dig+1);
	}
	if (suma == sumb && mula == mulb) return 0;
	if (suma > sumb || (suma == sumb && mula > mulb)) return 1;
	return -1;
}
ll Count(const string& a) {
	VI cnt(10, 0);
	for (auto& x : a) cnt[x-'0']++;
	ll res = fact[a.size()];
	for (auto& x : cnt) res /= fact[x];
	return res;
}
ll countme(const VI& cnt, int len) {
	ll res = fact[len];
	for (auto& x : cnt) res /= fact[x];
	return res;
}
ll CountLessThenS(string& a) {
	VI cnt(10, 0);
	for (auto& x : a) cnt[x-'0']++;
	/*VI sums(10, 0);
	sums[0] = cnt[0];
	for (int i = 1; i < 10; ++i) sums[i] = cnt[i] + sums[i-1];*/
	ll sol = 0;
	int len = a.size();
	for (int i = 0; i < s.size(); ++i) {
		for (int j = 0; j < s[i]-'0'; ++j) {
			if (cnt[j]) {
				--cnt[j];
				sol += countme(cnt, len-1);
				++cnt[j];
			}
		}
		if (cnt[s[i]-'0'] == 0) return sol;
		--cnt[s[i]-'0'];
		--len;
	}
	return sol;
}

int main() {
	ios::sync_with_stdio(false);
	fact[0] = fact[1] = 1;
	for (int i = 2; i < 15; ++i) fact[i] = fact[i-1] * i;
	while (cin >> s) {
		n = s.size();
		sequences.clear();
		string tmps = "";
		generate(n, 0, tmps);
		ll sol = 0;
		for (auto& seq : sequences) {
			int cmp = cmpr(seq, s);
			if (cmp == -1)
				sol += Count(seq);
			else if (cmp == 0) {
				sol += CountLessThenS(seq);
			}
		}
		cout << sol << '\n';
	}
}

Measured memory_bytes: 60576
#include <stdio.h>
#include <math.h>

int main(void){
    int n;
    scanf("%d", &n);
    
    int ans=ceil(n/1.08);
    
    if(floor(ans*1.08)==n){
        printf("%d\n", ans);
    }else{
        printf(":(\n");
    }
    return 0;
}


Measured memory_bytes: 1716
#include <bits/stdc++.h>
#include <vector>
#include<algorithm>
using namespace std;
int main(){
  int a;
  cin >> a;
  vector<int> apple(a);
  for(int i=0;i<a;i++){
    int ap;
    cin >> ap;
    apple.at(i)=ap%2;
  }
  if(count(apple.begin(),apple.end(),0)==a)
    cout << "second" << endl;
  else
    cout << "first"  << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string x;
	cin>>x;
	stack <char> S;
	for (int i = 0; i < x.length(); ++i)
	{
		if(x[i] == 'T' && !S.empty() && S.top() == 'S')
			S.pop();
		else
			S.push(x[i]);
	}
	int ans = 0;
	while(!S.empty())
	{
		ans++;
		S.pop();
	}
	cout<<ans<<"\n";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
pii pts[252];
ll bin[252];

int cross(pii a,pii b){
  return a.first*b.second - a.second*b.first;
}
int sp(pii a,pii b,pii c){
  pii x = pii(b.first-a.first, b.second-a.second);
  pii y = pii(c.first-a.first, c.second-a.second);
  return cross(x,y);
}

int main(){
  scanf("%d",&n);
  REP(i,n){
    int x,y;
    scanf("%d%d",&x,&y);
    pts[i] = pii(x,y);
  }

  bin[0] = 1;
  FOR(i,1,252)bin[i] = bin[i-1]*2%MOD;

  ll ans = bin[n];
  FOR(i,0,n)FOR(j,i+1,n){
    int x = 0;
    FOR(k,j+1,n){
      if(sp(pts[i],pts[j],pts[k]) == 0){
        x++;
      }
    }
    ans -= bin[x];
  }
  ans -= n;
  ans -= 1;
  printf("%lld\n",FIX(ans));
  return 0;
}


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

ll mod = 1e9 + 7;
ll N, K;

ll sum[101010];


struct ModComb {
    vector<long long> fact, rfact;
    long long max, mod;
    ModComb(long long ma, long long mod) :fact(ma, 0), rfact(ma, 0), max(ma), mod(mod) {
        fact[0] = 1;
        for (long long i=1; i<max; ++i) {
            fact[i] = fact[i-1]*i;
            fact[i] %= mod;
        }
        rfact[max-1] = mod_inverse(fact[max-1], mod);
        for (long long i=max-2; i>=0; --i) {
            rfact[i] = rfact[i+1]*(i+1);
            rfact[i] %= mod;
        }
    }
    long long mod_pow(long long x, long long n, long long mod) {
        long long a = 1LL;
        while (n) {
            if (n%2) a = ((a%mod)*(x%mod))%mod;
            x = ((x%mod)*(x%mod))%mod;
            n /= 2LL;
        }
        return a;
    }

    long long mod_inverse(long long a, long long m) {
        return mod_pow(a, m-2, m);
    }

    long long operator()(long long n, long long r) {
        if (n < r) return 0;
        return (((fact[n] * rfact[r]) % mod) * rfact[n - r]) % mod;
    }
};

int main() {
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());

    ModComb mb(N, mod);

    ll ans = 0;
    ll cur = 1;
    for (int i=K-1; i<N; ++i) {
        ans += A[i] * mb(i, K-1);
        ans %= mod;
    }

    //cout << ans << endl;

    cur = 1;
    ll ans2 = 0;
    for (int i=N-K; i>=0; --i) {
        ans2 += A[i] * mb(N-i-1, K-1);
        ans2 %= mod;
    }

    cout << ((ans%mod - ans2%mod) + mod)%mod  << endl;
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 100005;

int main() {

	FAST;

	int a, v;
	int b, w;
	int t;
	cin >> a >> v >> b >> w >> t;
	if (v <= w) {
		cout << "NO\n";
	}
	else {
		int k = abs(a - b) / (v - w);
		if (abs(a - b) % (v - w)) k ++;
		cout << ((k <= t) ? "YES\n" : "NO\n");
	}
	return 0;
}

Measured memory_bytes: 3640
//#include <bits/stdc++.h>
//using ll = long double ;
//using namespace std;
//int main()
//{
//    ll a , b, c; cin >> a >> b >> c;
//   ll d = c - a - b; ll e = 4 * a * b ; ll f = d * d;
//   if(d > 0 && (e < f))
//   {
//       cout << "Yes";
//   }
//   else
//   {
//       cout << "No";
//   }
//
//}
#include <bits/stdc++.h>
using ll = long long int ;
using namespace std;
int main()
{
    ll a , b; cin >> a >> b; ll c = a * b;
    if(a == 1 || b == 1)
    {
        cout << 1;
        return 0;
    }
    else{
    if(c & 1)
    {
        cout << (c) / 2 + 1 ;
    }
    else
        cout << c / 2;
    }

}



Measured memory_bytes: 256
import java.util.Scanner;

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

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
}


Measured memory_bytes: 35984
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(a==b && b==c ? "Yes" : "No")<<'\n';
  return(0);
}


Measured memory_bytes: 256
length = int(input())
num_list = list(map(int, input().split()))

change_count = 0

for i in range(length):
    flag = 0
    for k in range(length-1,i,-1):
        if num_list[k-1] > num_list[k]:
            num_list[k-1], num_list[k] = num_list[k], num_list[k-1]
            change_count += 1
            flag = 1
    if flag == 0:
        break

print(" ".join(map(str,num_list)))
print(change_count)



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

const int D = 60;
const int MAX_N = 200005;
int to[D][MAX_N];

int main(){
    int n;
    ll k;
    cin >> n >> k;
    rep(i, n){
        cin >> to[0][i];
        to[0][i] --;
    }
    rep(i, D-1) rep(j, n){
        to[i+1][j] = to[i][to[i][j]];
    }

    int v = 0;
    for (int i = D-1; i >= 0; --i){
        ll l = 1ll << i;
        if (l <= k){
            v = to[i][v];
            k -= l;
        }
    }
    cout << v+1 << endl;
    return 0;    
}

Measured memory_bytes: 50476