akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var r1 = ReadStringArray();
            var r2 = ReadIntArray();
            Dictionary<string, int> ret = new Dictionary<string, int>();
            ret.Add(r1[0],r2[0]);
            ret.Add(r1[1],r2[1]);
            var remove = Read();
            --ret[remove];
            List<string> outRet = new List<string>();
            foreach (var item in ret)
            {
                outRet.Add(item.Value.ToString());
            }

            Console.WriteLine(string.Join( " ",outRet));
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 13280
var
	n,i,j,ans,now,c,a,k:Longint;
	f,p:array[1..100,0..10]of Longint;
begin
	ans:=-1000000000;
	read(n);
	for i:=1 to n do for j:=0 to 9 do read(f[i,j]);
	for i:=1 to n do for j:=0 to 10 do read(p[i,j]);
	for i:=1 to 1023 do begin
		now:=0;
		for j:=1 to n do begin
			c:=0;
			a:=i;
			for k:=0 to 9 do begin
				if(a mod 2=1)and(f[j,k]=1)then inc(c);
				a:=a div 2;
			end;
			inc(now,p[j,c]);
		end;
		if ans<now then ans:=now;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	set<int> st;
	for(int i=0; i<n; i++){
		int a; cin>>a;
		st.insert(a);
	}
	if(st.size()==n) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    map<int, int> m;
    for(int i=0; i<n; i++){
        int temp;
        cin>>temp;
        m[temp]++;
    }
    long long count=0;
    for(auto a:m){
        if(a.second>1){
            count+=a.second-1;
        }
    }
    cout<<n - count - count%2;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 1000000007
typedef int ll;
using namespace std;
ll n,i,j,k,z,m,q,r,timer,v,tot,x,y,xx, yy,INF, sz;
ll a[100500], cnt[100500], col[100500];
ll dp[105][105][105];
void ass(ll i, ll j, ll k, ll val) {
    dp[i][j][k] = dp[i][k][j] = dp[j][i][k] = dp[j][k][i] = dp[k][i][j] = dp[k][j][i] = val;
}
bool ss(ll x, ll y) {
    if (min(x,y) == 0 && (x != 0 || y != 0))
        return false;
    return true;
}
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a+n);
    reverse(a, a+n);
    int i = 0, j = 0;
    while (i+1 < n && j+1 < a[i+1])
        i++, j++;
        ll x = a[i]-j;
        ll y = 0;
        while (i+1 < n && j < a[i+1])
            y++, i++;
        //cout << x << " " << y << endl;
        if (x%2 && y % 2 == 0)
            cout << "Second" << endl;
        else
            cout << "First" << endl;
    return 0;
}


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

int main() {
	int week;
	cin >> week;
	int debt = 100;
	for (int i = 0; i < week; i++)
	{
		debt = ((debt * 105) / 100) + ((debt % 20) > 0 ? 1 : 0);
	}
	cout << debt * 1000 << endl;

	return 0;
}

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

int main(void) {

  int d;
  long g;
  scanf("%d %ld", &d, &g);
  long p[d],c[d];
  for (int i = 0; i < d; i++) {
  scanf("%ld %ld", &p[i], &c[i]);
  }
  int bit[d];
  bit[0] = -1;
  for (int i = 1; i < d; i++) {
    bit[i] = 0;
  }
  long score;
  long solve;
  long min = -1;
  for (long i = 0; i < pow(2,d); i++) {
    bit[0]++;
    for (int j = 1; j < d; j++) {
      bit[j] += bit[j-1]/2;
      bit[j-1] %= 2;
    }
    score = 0;
    solve = 0;
    for (int j = 0; j < d; j++) {
      if (bit[j] == 1) {
        score += (j+1)*100*p[j]+c[j];
        solve += p[j];
      }
    }
    if (score >= g) {
      if (min == -1 || solve < min) {
        min = solve;
      }
      continue;
    }
    for (int j = d-1; j >= 0; j--) {
      if (bit[j] == 0) {
        if (score+(j+1)*100*(p[j]-1) < g) {
          score += (j+1)*100*(p[j]-1);
          solve += p[j]-1;
        } else {
          solve += (g-score+(j+1)*100-1)/((j+1)*100);
          score += (j+1)*100*((g-score+(j+1)*100-1)/((j+1)*100));
          break;
        }
      }
    }
    if (score >= g) {
      if (min == -1 || solve < min) {
        min = solve;
        continue;
      }
    }
  }
  printf("%ld\n", min);

  return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


#define ld long double
#define F first
#define S second
//
#define int long long
#define ll long long
#define db(x)                cerr<<#x<<": "<<x<<endl
#define db2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define db3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define db5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define db6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
//
#define mem(x,y) memset(x,y,sizeof(x))
#define bitcount    __builtin_popcount
//
#define pii pair<int, int>
#define all(v) v.begin(),v.end()
//
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define vi vector<int>
#define vvi vector< vector<int> >
#define si set<int>
#define pb push_back
#define lp(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define mk make_pair
const int N=2e5+3;
const int mod=1e9+7;
const int mod1=998244353;
const int inf=1e16+7;
using namespace std;

void solve(){
    int h1,s1,h2,s2;
    cin>>h1>>s1>>h2>>s2;
    int i=0;
    while(1){
        if(i%2==0){
            h2-=s1;
        }
        else {
            h1-=s2;
        }
        if(h1<=0) {
            cout<<"No";
            return;
        }
        if(h2<=0){
            cout<<"Yes";
            return ;
        }
        i++;
    }
}
 

int32_t main() {
    IOS;
    int t;
   // cin>>t;
    
    t=1;
    for(int i=1;i<=t;i++){
       // cout<<"Case #"<<i<<": ";
        solve();
        cout<<'\n';
    }
   
}

















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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;
typedef unordered_map<int,int> uoii;
typedef unordered_map<string,int> uosi;

const int MOD = 1e9+7;

const int INF = 1e10;




int32_t main()
{
   
    IOS
    int a,b;
    cin>>a>>b;
    bool found=false;
    int i=1;
    while(!found&&i<100000){
        int x=i*0.08;
        int y=i*0.1;
       // cout<<i<<" "<<x<<" "<<y<<'\n';
        if(x==a&&y==b){
            found=true;
            break;
        }
        i++;
    }
    if(found)
        cout<<i;
    else cout<<-1;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()

using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

//負の辺が存在する場合
// O(E*V)
//負閉路がスコアに寄与しないパターンを考えよう
struct edge{
    int from;
    int to;
    ll cost;
};

const int MAX_V=2525;
vector<int> to[MAX_V],from[MAX_V];
bool toN[MAX_V];
bool from1[MAX_V];
bool ok1N[MAX_V];
void dfs(int v){
    if(from1[v]) return;
    from1[v]=1;
    for(int u:to[v]){
        dfs(u);
    }
}
void rdfs(int v){
    if(toN[v]) return;
    toN[v]=1;
    for(int u:from[v]){
        rdfs(u);
    }
}

signed main(){
    int n,m;
    ll p;
    cin >> n >> m >> p;
    vector<edge> v;
    rep(i,m){
        int a,b; ll c;
        cin >> a >> b >> c;
        a--; b--;
        to[a].pb(b);
        from[b].pb(a);
        c-=p;
        edge e={a,b,-c};
        v.pb(e);
    }
    dfs(0);
    rdfs(n-1);
    rep(i,n){
        ok1N[i]=toN[i]*from1[i];
    }
    ll d[n];
    rep(i,n) d[i] = 1e18;
    d[0]=0;
    //for(auto e:v) cout << e.from <<" "<<e.to<<" "<<e.cost<<endl;
    bool ng=0;
    rep(i,n){
        rep(j,v.size()){
            edge e = v[j];
            if(!ok1N[e.to]||!ok1N[e.from]) continue;
            if(d[e.to] > d[e.from]+e.cost){
                d[e.to] = d[e.from] + e.cost;
                if(i==n-1){
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }
    cout << max(0LL,-d[n-1]) << endl;
}


Measured memory_bytes: 768
#include<stdio.h>

int main()
{

  int n, m, a[ 100000 ];
  int i;
  int MAX = 0, tmp;

  scanf( "%d%d", &n, &m );

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

  if( a[ 0 ] != 1 ) MAX = a[ 0 ] - 1;

  for( i = 0; i < m; i++ ){
    tmp = ( a[ i ] - a[ i - 1 ] ) / 2;
    if( MAX < tmp ) MAX = tmp;
  }

  tmp = n - a[ m - 1 ];
  if( MAX < tmp ) MAX = tmp;

  
  printf( "%d\n", MAX );

  return 0;

}

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

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

    double ans = 0;

    for(int i = 1; i <= n; i++)
    {   double cnt = 1.0/n;
        int j = i;
        while(j < k)
        {
            j *= 2;
            cnt /= 2;
        }
        //cout << cnt << endl;
        ans += cnt;
    }

    printf("%.10f\n", ans);

    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define MOD (ll)(1e9+7)
#define fastcin  ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){

	fastcin
		
	ll n, k, ans = 0;
	cin >> n >> k;
	
	ll sum[n+1];
	
	memset(sum, 0, sizeof sum);
	
	for(int i=1; i<=n; i++) sum[i] += sum[i-1] + i;
	
	/*
	 * Example : n = 5, k = 3
	 * 
	 * 0 1 2 3 4 5
	 *
	 * for k = 3
	 * 
	 * Possible Combinations:
	 * (0,1,2) = 3
	 * (0,1,3) = 4
	 * (0,1,4) = 5
	 * (0,1,5) = 6
	 * (0,2,5) = 7
	 * (0,3,5) = 8
	 * (0,4,5) = 9
	 * (1,4,5) = 10
	 * (2,4,5) = 11
	 * (3,4,5) = 12
	 * 
	 * Possible Sums: 3,4,5,6,7,8,9,10,11,12
	 * 
	 * Always sums will have difference equal one,
	 * starting of lesser possible sum until bigger 
	 * possible sum
	 * 
	 * We need to know how many numbers have in between
	 * the bigger and lesser number. 
	 *
	 * Therefore : (12 - 3) + 1 = 10 
	 * 
	 * Do repeat of k until n+1
	 * 
	 * 
	 */ 
	
	for(int i=k; i<=n+1; i++){
		
		ll s = sum[i-1];
		ll x = sum[n], y;
		
		(i == n+1) ? y = 0 : y = sum[n-i];
		
		ll b = x-y;
		
		ans += (b-s+1)%MOD;
	}
	
	cout << ans%MOD << endl;
	
	
	return 0;
}


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

int main(){
    int a ,b,c;
    cin>>a>>b;
    if((a==1 && b==2) ||(a==2 && b==1) ){
        c=3;
    }else if((a==2 && b==3) || (a==3 && b==2)){
    c=1;}
    else{c=2;}
    cout<<c<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>

#define REP(i, n) for(int i=0;i<n;i++)
#define ll long long
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;

int main(){

  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if(a == b)
    printf("%d\n", c);
  else if(b == c)
    printf("%d\n", a);
  else
    printf("%d\n", b);

  return 0;
}



Measured memory_bytes: 128
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        /*String str[]=br.readLine().split(" ");
        int n=Integer.parseInt(str[0]);
        int k=Integer.parseInt(str[1]);
        */
        char carr1[]=br.readLine().toCharArray();
        char carr2[]=br.readLine().toCharArray();
        boolean b=true;
        for(int i=0;i<carr1.length;i++)
        {
            if(carr1[i]!=carr2[i])
            {
                b=false;
                break;
            }
        }
        if(b)
        pw.println("Yes");
        else
        pw.println("No");
        pw.flush();
        pw.close();
    }
}

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

using namespace std;

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

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

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

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

vector<pair<char, int>> lanlength(string s) {
    char prev = '\0';
    int cnt = 0;
    vector<pair<char, int>> res;
    REP(i, s.size()+1) {
        if (i == s.size() || s[i] != prev) {
            if (prev != '\0') {
                res.pb({prev, cnt});
            }
            prev = s[i];
            cnt = 1;
        }
        else {
            ++cnt;
        }
    }
    return res;
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    string s; cin >> s;
    int rest = 0, ans = 0;
    REP(i, s.size()) {
        if (s[i] == 'S') {
            ++rest;
        }
        else {
            if (rest > 0) {
                --rest;
                ++ans;
            }
        }
    }
    cout << (int)s.size()-ans*2 << endl;
}


Measured memory_bytes: 720
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long int
#define pb push_back
#define fi first
#define se second
#define deb cerr << "Line no." << __LINE__
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define aint(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;
#ifndef LOCAL
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}
int pwr(int a,int b){
	int ans = 1;
	while(b){
		if(b & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ans;
}
void solve(){
	int n, h, w;
	cin >> n >> h >> w;
	cout << (n - h + 1) * (n - w + 1) << endl;
}
signed main(){
  	IO;
  	#ifdef LOCAL
		freopen("inp.txt","r", stdin);
		// freopen("out.txt", "w", stdout);
	#endif
 	clock_t clk = clock();
  	int t = 1;
  	// cin >> t;
  	fr(tt, 1, t){
    	solve();
  	}
  	cerr << endl << (double)(clock() - clk) / CLOCKS_PER_SEC;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define ss                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define li                list<int>
#define pii               pair<int,int>
#define vi                vector<int>
#define mii               map<int ,int>
#define setbits(x)        _builtin_popcountll(x)
#define zrobits(x)        _builtin_ctzll(x)
#define mod               1000000007
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type *arr=new type(n);
#define w(x)              int x; cin>>x; while(x--)
#define all(x)            (x).begin(), (x).end()
#define PI                3.14159265358979
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
#endif
}
// int fact(int n)
// {
// 	if (n == 1)return 1;
// 	return (n * (fact(n - 1))) % mod;
// }
// int power(int x, unsigned int y, int mo)
// {
// 	int res = 1;

// 	while (y > 0)
// 	{
// 		if (y & 1)
// 			res = (res * x) % mo;
// 		y = y >> 1; // y = y/2
// 		x = (x * x) % mo; // Change x to x^2
// 	}
// 	return res % mo;
// }


//int a[111111111], b[111111111], c[1111111];
void solve()
{
	int counter = 0;
	string s, s1; cin >> s >> s1;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != s1[i])counter++;
	}
	cout << counter;

}
int32_t main()

{
	c_p_c();
	solve();
}

Measured memory_bytes: 3912
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, k = na()
h = na()
h.sort(reverse=True)
h[:k] = [0]*k
print(sum(h))

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

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

char H[M][L]; /* Hash Table */

//プロトタイプ宣言
void insert(char [], int);
long long getKey(char []);
int getChar(char);
int h1(int, int);
int h2(int, int);
int find(char [], int);

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

    return 0;
}

void insert(char str[], int m){

  int k,insert_pointer;
  int h_1,h_2;
  int i = 0;

    k = getKey(str);
    h_1 = h1(k,m);
    h_2 = h2(k,m);

    while(1){
      insert_pointer = (h_1 + i * h_2) % m;

      //文字列が格納されていなければ格納してループを抜ける。
      if(H[insert_pointer][0] == '\0'){
	strcpy(H[insert_pointer],str);
	break;
      }

      //既に文字列が格納されているので別の場所を探す
      i++;
    }
}

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


int getChar(char ch){

  int code;
  if ( ch == 'A') 
    code = 1;
  else if ( ch == 'C')
    code = 2;
  else if ( ch == 'G')
    code = 3;
  else if ( ch == 'T')
    code = 4;

  return code;
}

int h1(int key, int m){
  return key % m;

}
int h2(int key, int m){
  return 1 + (key % (m - 1));

}

int find(char str[], int m){

  int k,find_pointer;
  int check = 0;
  int h_1,h_2;
  int i = 0;

    k = getKey(str);
    h_1 = h1(k,m);
    h_2 = h2(k,m);
    
    while(1){
      find_pointer = (h_1 + i * h_2) % m;
      
      if(H[find_pointer][0] == '\0')
	break;
      
      else{
	if(strcmp(H[find_pointer],str) == 0){
	  check = 1;
	  break;
	}
      }     
      i++;
    } 

    return check;   
}

Measured memory_bytes: 14280
const [meta,a,b,c] = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const [X,Y,Z,K] = meta.trim().split(' ').map(i => parseInt(i));
const A = a.trim().split(' ').map(i => parseInt(i)).slice(0,X).sort((a,b)=>b-a);
const B = b.trim().split(' ').map(i => parseInt(i)).slice(0,Y).sort((a,b)=>b-a);
const C = c.trim().split(' ').map(i => parseInt(i)).slice(0,Z).sort((a,b)=>b-a);

const result = [];
let queue = [{
    p: A[0]+B[0]+C[0],
    x: 0,
    y: 0,
    z: 0
}];

const addToQueue = (p,x,y,z) => {
    if (!queue.find(v => v.p === p && v.x === x && v.y === y && v.z === z)
    && !result.find(v => v.p === p && v.x === x && v.y === y && v.z === z)) {
        queue.push({p,x,y,z});
    }
}

const min = (i,arr) => Math.min(i,arr.length - 1);

Array.from(Array(K)).forEach(() => {
    queue = queue.sort((a,b)=>a.p-b.p);
    const largest = queue.pop();
    result.push(largest);
    const {x,y,z} = largest;
    addToQueue(A[min(x+1,A)]+B[y]+C[z],min(x+1,A),y,z);
    addToQueue(A[x]+B[min(y+1,B)]+C[z],x,min(y+1,B),z);
    addToQueue(A[x]+B[y]+C[min(z+1,C)],x,y,min(z+1,C));
});

console.log(result.map(v => v.p).join('\n'));

Measured memory_bytes: 16196
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














string S;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S;
	string ans = S.substr(0, 3);
	cout << ans << endl;
}







Measured memory_bytes: 3576
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

ll pow_mod(ll a, ll n, ll MOD){
  ll m[60]; m[0]=a; // m[i] : a^(2^i)をMODで割った余り
  rep(i,59) m[i+1] = (m[i]*m[i])%MOD;

  ll retval = 1;
  bitset<60> s(n);
  rep(i,60) if (s.test(i)) (retval *= m[i]) %= MOD;

  return retval; 
}

int main(){
  int N; cin >> N;
  int A[N];
  int ABS[N];
  int cnt = 0;
  ll ans = 0;
  rep(i,N) {
    cin >> A[i];
    ans += abs(A[i]);
    ABS[i] = abs(A[i]);
    if (A[i]<=0) cnt++;
  }
  if (cnt%2){
    int MIN = min_element(ABS,ABS+N) - ABS;
    if (A[MIN]<=0) ans = ans - abs(A[MIN]) + A[MIN];
    else ans = ans - abs(A[MIN]) - A[MIN];
  }
  cout << ans << endl;






  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 4380
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
	string S,T;
	int a[26][26]={};
	
	cin >> S >> T;
	
	for(int i=0;i<S.size();i++)
		a[S[i]-'a'][T[i]-'a']=1;
	
	for(int i=0;i<26;i++)
	{
		int cnt=0;
		for(int j=0;j<26;j++)
			cnt+=a[i][j];
		if(cnt>1)
		{
			cout << "No" << endl;
			return 0;
		}
		cnt=0;
		for(int j=0;j<26;j++)
			cnt+=a[j][i];
		if(cnt>1)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long 
signed main() {
  int n,wt ;cin >> n>> wt;
  vector<int>w(n),v(n) ;
  for(int i=0;i<n;i++)
    cin >> w[i] >> v[i] ;
  vector<vector<int>>dp(n,vector<int>((int)1e5+1));
  // dp[i][j]->min wt.after processing first i wts. and having a value of j  
  //dp[i][j]=min(dp[i-1][j-w[i]]+v[i],dp[i-1][j])
  for(int i=0;i<(int)1e5+1;i++)
    dp[0][i]=(v[0]==i?w[0]:(int)1e12) ;
  dp[0][0]=0 ;
  for(int i=1;i<n;i++)
    for(int j=0;j<(int)1e5+1;j++)
      dp[i][j] =min(dp[i-1][j],(j>=v[i]?dp[i-1][j-v[i]]+w[i]:(int)1e12)) ;
  int ans ;
  for(int i=0;i<(int)1e5+1;i++)
    ans=(dp[n-1][i]<=wt?i:ans) ;
  cout << ans  ;
}

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

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

#define MOD 1000000007
#define INF INT_MAX

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

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

int main(int, char**)
{
    int n;
    cin >> n;

    map<PL, int> mp;
    rep(i,n) {
        ll a, b;
        cin >> a >> b;
        if (!a) {
            if (b) b = 1;
        } else if (!b) {
            a = 1;
        } else {
            ll d = gcd(abs(a), abs(b));
            if (b < 0) d *= -1;
            a /= d; b /= d;
        }
        mp[PL(a,b)]++;
    }
    vector<ll> pow2(n+1);
    pow2[0] = 1;
    rep(i,n+1) {
        if (!i) pow2[i] = 1;
        else {
            pow2[i] = (pow2[i-1] << 1) % MOD;
        }
    }

    ll ans = 1;
    for (auto m : mp) {
        ll a = m.first.first;
        ll b = m.first.second;
        int v = m.second;
        if (a == 0 && b == 0) continue;
        ll a2, b2;
        if (a > 0) { a2 = -b; b2 = a; }
        else { a2 = b; b2 = -a; }
        int v2 = mp[PL(a2, b2)];
        ans *= (pow2[v] + pow2[v2] - 1) % MOD;
        ans %= MOD;
        mp[PL(a,b)] = mp[PL(a2,b2)] = 0;
    }
    ans += mp[PL(0,0)];
    ans %= MOD;
    ans--;
    if (ans < 0) ans += MOD;

    cout << ans << endl;

    return 0;
}

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



int main() {
	string S, T;
	cin >> S >> T;
	if (T.length() != S.length() + 1)
		cout << "No";
	else
	{
		for (int i = 0; i < S.length(); ++i)
		{
			if (S[i] != T[i])
			{
				cout << "No";
				return 0;
			}

		}
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
R, G, B, N = map(int, input().split(' '))
count = 0
for i in range((N // R)+1):
    for j in range((N // G)+1):
        tmp = N - (R * i + G * j)
        if tmp < 0:
            break
        if tmp == 0:
            count += 1
        elif tmp % B == 0:
            count += 1
print(count)

Measured memory_bytes: 41308
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, T;
        public int[] X, Y, H;

        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            X = new int[N];
            Y = new int[N];
            H = new int[N];
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                X[i] = line[0];
                Y[i] = line[1];
                H[i] = line[2];
            }

            for (int x = 0; x <= 100; x++)
            for (int y = 0; y <= 100 ; y++)
            {
                int h = -1;
                bool success = true;
                for (int i = 0; i < N; i++)
                {
                    if (H[i] != 0)
                    {
                        int hh = H[i] + Math.Abs(x - X[i]) + Math.Abs(y - Y[i]);
                        if (h != -1 && h != hh)
                        {
                            success = false;
                            break;
                        }
                        h = hh;
                    }
                }

                for (int i = 0; i < N; i++)
                {
                    int hhh = Math.Max(h - Math.Abs(x - X[i]) - Math.Abs(y - Y[i]), 0);
                    if (hhh != H[i])
                    {
                        success = false;
                        break;
                    }
                }

                if (success)
                {
                    Console.WriteLine($"{x} {y} {h}");
                }
            }

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int main(){
  string s; cin >> s;
  int n = s.size();
  bool eas = true;
  for(int i = 0; i < n; i++){
    if((i % 2 == 0) && (s[i] == 'L')) {
      eas = false;
    }
    if((i % 2 == 1) && (s[i] == 'R')) {
      eas = false;
    }
  }
  cout << (eas?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int loect=0,hisi=0;
int main(){int a1,a2,aa;char b1,b2;
while(cin>>a1>>b1>>a2>>b2>>aa){
	if(a1==a2){hisi++;}
	if(aa*aa==a1*a1+a2*a2){loect++;}}
cout<<loect<<endl<<hisi<<endl;
	return 0;}


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

int main() {
    string s;
    cin >> s;
    int cc = 0;
    int l = s.length();
    
    if (s[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    
    for (int i = 2; i < (l - 1); i++) {
        if (s[i] == 'C') {
            cc++;
        }
    }
    
    if (cc != 1) {
        cout << "WA" << endl;
        return 0;
    }
    
    for (int i = 1; i < l; i++) {
        if (
            (s[i] != 'C') &&
            ((s[i] < 'a') || (s[i] > 'z'))
        ) {
            cout << "WA" << endl;
            return 0;
        }
    }
    
    cout << "AC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
char s[10000];
int n,k,l,r,last,ans;
int ask(int x){return x/2ll;}
int solve()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    scanf("%lld",&k);
    l=1;
    while(s[l]==s[l+1]) l++;
    if(l==n) return printf("%lld",ask(n*k)),0;
    r=n;
    while(s[r]==s[r-1]) r--;
    last=l+1;
    for(int i=l+1;i<r;i++)
    {
        if(s[i]!=s[i-1])
        {
            ans+=ask(i-last);
            last=i;
        }
    }
    ans+=ask(r-last);
    ans=ans*k;
    if(s[1]==s[n]) ans=ans+ask(l)+ask(n-r+1)+1ll*ask(n-r+1+l)*(k-1);
    else ans=ans+(ask(l)+ask(n-r+1))*k;
    printf("%lld",ans);
}
signed main()
{
    solve();
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

#define PA pair<string,string>

int main(){
    int n; cin>>n;
    string s; cin>>s;
    map<PA,ll> m;
    ll ans=0;
    FOR(i,0,1<<n){
        string sk,sl;
        FOR(j,0,n){
            if((i>>j)&1) sk+=s[j];
            else sl+=s[j];
        }
        m[PA(sk,sl)]++;
        //cout<<sk<<" "<<sl<<endl;
    }
    //cout<<endl;
    FOR(i,0,1<<n){
        string sk,sl;
        FOR(j,0,n){
            if((i>>j)&1) sk=s[n+j]+sk;
            else sl=s[n+j]+sl;
        }
        //cout<<sk<<" "<<sl<<endl;
        ans+=m[PA(sk,sl)];
    }
    co(ans);
}


Measured memory_bytes: 87040
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)


int main() {

	long long N, A, B;
	cin >> N >> A >> B;

	long long AandB = A + B;
	long long cycle = N / (AandB);

	long long extra = N - cycle * AandB;

	long long ans = cycle * A + min(extra, A);

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
using namespace std;
inline int toInt(string s) {
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
 
int main () {
    string s;
    stack<int> st;
    while (cin >> s) {
        if (isdigit(s[0])) {
            st.push(toInt(s));
        }
        else {
            int a = st.top();
            st.pop();
            int b = st.top();
            st.pop();
            switch(s[0]) {
            case '+':
                st.push(a + b);
                break;
            case '-':
                st.push(b - a);
                break;
            case '*':
                st.push(a * b);
                break;
            }
        }
    }
    cout<<st.top()<<'\n';
    return 0;
}



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

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

    int pmin = INT_MAX;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int p;
        cin >> p;
        if(p < pmin) {
            ans++;
        }
        pmin = min(pmin, p);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int H = GetInt();
		int W = GetInt();
		int K = GetInt();
		char[,] grid = new char[H, W];
		bool[] has = new bool[H];
		for(int i = 0; i < H; i++)
		{
			string S = GetString();
			for(int j = 0; j < W; j++)
			{
				grid[i, j] = S[j];
				if(S[j] == '#')
					has[i] = true;
			}
		}

		int[,] ans = new int[H, W];
		int num = 0;
		bool started = false;
		int back = -1;
		int last = -1;
		for(int i = 0; i < H; i++)
		{
			if(!has[i])
			{
				if(back == -1)
					back = i;

				continue;
			}

			num++;
			started = false;
			for(int j = 0; j < W; j++)
			{
				if(grid[i, j] == '.')
					ans[i, j] = num;
				else
				{
					if(started)
					{
						num++;
					}
					else
					{
						started = true;
					}					
					ans[i, j] = num;					
				}
			}

			if(back != -1)
			{
				for(int j = back; j < i; j++)
				{
					for(int k = 0; k < W; k++)
						ans[j, k] = ans[i, k];
				}
			}
			back = -1;
			last = i;
		}

		for(int i = last + 1; i < H; i++)
			for(int j = 0; j < W; j++)
				ans[i, j] = ans[last, j];

		var sb = new StringBuilder();
		for(int i = 0; i < H; i++)
		{
			for(int j = 0; j < W - 1; j++)
			{
				sb.AppendFormat($"{ans[i, j]} ");
			}
			sb.AppendFormat($"{ans[i, W - 1]}\n");
		}
		Write(sb);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 20312
#include <iostream>
#include <cmath>
using namespace std;
bool IsPrime(int n)
{
	int s = floor(sqrt(n)+0.5);
	for(int i = 2;i<=s;i++)
		if(n%i==0)return false;
	return true;
}
const int maxn = 1000000;
bool ar[maxn];
int dp[maxn];
int main()
{
	for(int i = 2;i<=maxn;i++)
		if(IsPrime(i))
		{
			ar[i] = true;
			dp[i] = dp[i-1]+1;
		}
		else dp[i] = dp[i-1];
	int n;
	while(cin >> n)
		cout << dp[n] <<endl;
	return 0;
}

Measured memory_bytes: 6044
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    int h,w,x,cu=0,ans=0;
    cin>>h>>w>>x;
    vector<vector<char>> a(6, vector<char>(6));
    vector<int> b(13);

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<pow(2,(h+w));i++){
        for(int j=0;j<h;j++){
            for(int k=0;k<w;k++){
                if(a[j][k]=='#'&&b[j]==0&&b[h+k]==0){
                    cu++;
                }

            }
        }
        if(cu==x){
            ans++;
        }
        cu=0;
        b[0]++;
        for(int j=0;j<h+w;j++){
            if(b[j]>1){
                b[j]=0;
                b[j+1]++;
            }
        }
        

    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 4112
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N, K;
	string S;
	cin >> N >> K >> S;
	int cnt = 0, l = 0, r = 0, ans = 0;
	//さっき見たところが1だったか
	bool flag1, flag2;
	while(true){
		//cout << "l = " << l << ", r = " << r << endl;
		//右をできるだけ伸ばす
		flag1 = true;
		while(true){
			if(r == N)break;
			if(flag1 && S[r] == '1'){
				
			}
			else if(flag1 && S[r] == '0'){
				if(cnt == K)break;
				flag1 = false;
				cnt ++;
			}
			else if(!flag1 && S[r] == '1'){
				flag1 = true;
			}
			else if(!flag1 && S[r] == '0'){

			}
			r ++;
		}
		//判定する
		//cout << "ans: l = " << l << ", r = " << r << endl;
		ans = max(ans, r - l);
		if(r == N)break;
		//左を一つ右にする
		flag1 = true;
		while(true){
			if(l == r)break;
			if(flag1 && S[l] == '1'){

			}
			else if(flag1 && S[l] == '0'){
				flag1 = false;
			}
			else if(!flag1 && S[l] == '1'){
				cnt --;
				break;
			}
			else if(!flag1 && S[l] == '0'){

			}
			l ++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
n = int(input())
data  = [list(map(str, input().split())) for _ in range(n)]
sum = 0
for i in range(n):
  if data[i][1] == 'JPY':
    sum += int(data[i][0])
  else:
    sum += float(data[i][0])*380000
print(sum)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_map>

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

using namespace std;

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

typedef pair<ll,ll> p;

bool compare(p p1, p p2) {
    return p1.second < p2.second;
}

int main(){
    ll n; cin >> n;
    vector<ll> x(n);
    vector<ll> l(n);
    vector<pair<ll,ll>> pairs(n);
    rep(i, n) {
        cin >> x[i] >> l[i];
        pairs[i] = make_pair(x[i]-l[i], x[i] + l[i]);
    }
    sort(pairs.begin(), pairs.end(), compare);
    // rep(i, n) {
    //     cout << pairs[i].first << " " << pairs[i].second << endl;
    // }
    ll ans = 0;
    ll t = -1000000001;
    for(int i = 0; i < n; i++) {
        if(t <= pairs[i].first) {
            ans++;
            t = pairs[i].second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
    long long a[3];
    cin >> a[0] >> a[1] >> a[2];
    if(!(a[0]&1) || !(a[1]&1) || !(a[2]&1)){
	cout << 0 << endl;
    }else{
	sort(a,a+3);
	cout << a[0]*a[1] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;


public class Program{


	public static void Main(){
	
	
		var input = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
		
		double startPer1 = 1 / input[0];
		var target = input[1];
		
		
		
		double autoWin = 0.0;
		if(input[0] >= target){
			autoWin = ((input[0] - target) + 1) / input[0];
		}
		double tryHard = 0.0;
		double need = 0;
		double hoge = 0;
		for(int i = 1; i <= input[0]; i++){
			if(i >= target){
				tryHard += startPer1;	
				continue;
			}
			need = 0;
			hoge = i;
			while(target > hoge){
				need++;
				hoge *=2;
			
			}
			tryHard += startPer1 * (double)(Math.Pow(0.5, need));
		}
		
		Console.WriteLine((tryHard).ToString("F10"));
		
	
	}

}

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

char b1[5]={'.' , ',' , '!' , '?' , ' '};
char b2[3]={'a' , 'b' , 'c'};
char b3[3]={'d' , 'e' , 'f'};
char b4[3]={'g' , 'h' , 'i'};
char b5[3]={'j' , 'k' , 'l'};
char b6[3]={'m' , 'n' , 'o'};
char b7[4]={'p' , 'q' , 'r' , 's'};
char b8[3]={'t' , 'u' , 'v'};
char b9[4]={'w' , 'x' , 'y' , 'z'};

int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		string in,out;
		cin>>in;
		int cnt=0;
		for(int i=0;i<in.size();i++)
		{
			if(in[i]==0&&cnt==0) continue;
			else if(in[i]!='0') cnt++;
			else
			{
				switch(in[i-1]){
					case '1':
						out+=b1[(cnt-1)%5];
						break;
					case '2':
						out+=b2[(cnt-1)%3];
						break;
					case '3':
						out+=b3[(cnt-1)%3];
						break;
					case '4':
						out+=b4[(cnt-1)%3];
						break;
					case '5':
						out+=b5[(cnt-1)%3];
						break;
					case '6':
						out+=b6[(cnt-1)%3];
						break;
					case '7':
						out+=b7[(cnt-1)%4];
						break;
					case '8':
						out+=b8[(cnt-1)%3];
						break;
					case '9':
						out+=b9[(cnt-1)%4];
						break;
				}
				cnt=0;
			}
		}
		cout<<out<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>

int n, A[50];

int main(){
    int a, B, i;
    
    scanf("%d", &n);
    for(i=0 ; i<n ;i++){
        scanf("%d", &A[i]);
    }
    scanf("%d", &a);
    for(i=0 ; i < a ; i++){
        scanf("%d", &B);
        
        if(solve(0, B)==1){
            printf("yes\n");
        }else{
            printf("no\n");
        }
    }
    
    return 0;
}

int solve(int i,int j){
    if(j==0){
        return 1;
    }
    
    if(i>=n){
        return 0;
    }
    
    int rr = {solve(i+1, j) || solve(i+1, j-A[i])};
    return rr;
}


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

int main() {
    string S; cin >> S;
    vector<char> ans(3);
    for (int bit = 0; bit < (1 << 3); bit++) {
        int sum = S[0]-'0';
        vector<char> vec(3);
        for (int i = 0; i < 3; i++) {
            if (bit & (1 << i)) vec[i] = '+';
            else vec[i] = '-';
        }
        for (int i = 0; i < 3; i++) {
            if (vec[i] == '+') sum += S[i+1]-'0';
            else sum -= S[i+1]-'0';
        }
        if (sum == 7) {
            ans = vec;
            break;
        }
    }


    for (int i = 0; i < 3; i++) {
        cout << S[i] << ans[i];
    }
    cout << S[3] << "=7" << endl;
}

Measured memory_bytes: 256
n = int(input())
s = ([''.join(sorted(input())) for _ in range(n)])
S = sorted(s)
D = {}#辞書
ans = 0
for i in S:
    #print('i:'+str(i))
    if i in D:
        #print('ii:'+str(i))
        D[i] += 1
        ans += D[i]
    else:
        D[i] = 0
#print(D)
print(ans)

Measured memory_bytes: 20228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int a[100005],b[100005];
int m[100005];
vector<int> G[100005];
ll ans;
void bfs(int s){
	queue<int> que;
	que.push(s);
	while(!que.empty()){
		int p=que.front(); que.pop();
		int I=0;
		for(int i=0;i<G[p].size();i++){
			int e=G[p][i];
			if(m[e]==100000000){
				//cout<<e<<endl;
				m[e]=k-G[p].size()+I;
				que.push(e);
				I++;
			}
		}
	}
}
int main(void){
	cin>>n>>k;
	for(int i=0;i<100005;i++){
		m[i]=100000000;
	}
	for(int i=0;i<n-1;i++){
		cin>>a[i]>>b[i];
		G[a[i]-1].push_back(b[i]-1);
		G[b[i]-1].push_back(a[i]-1);
	}
	m[0]=k;
	bfs(0);
	ans=1;
	//cout<<m[1]<<" "<<m[2]<<" "<<m[3]<<endl;
	for(int i=0;i<n;i++){
		ans=ans*m[i]%1000000007;
	}
	cout<<ans<<endl;
	
	
}


Measured memory_bytes: 7672