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

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    vector<long double> p(n+1);
    p[0] = 0.00;
    for(int i = 1;i<=n;i++)
    {
        cin>>p[i];
    }
    vector<vector<long double>> dp(n+1, vector<long double> (n+1));
    dp[0][0] = 1.00;
    long double ans = 0.00;
    for(int i = 0;i<=n;i++)
    {
        for(int j = 0;j<=n;j++)
        {
            if(i + j <= n)
            {
                if(i == 0 and j == 0)
                {
                    continue;
                }
                else if(i == 0)
                {
                    dp[i][j] = dp[i][j-1] * (1.00-p[j]);
                }
                else if(j == 0)
                {
                    dp[i][j] = dp[i-1][j] * p[i];
                }
                else
                {
                    dp[i][j] = dp[i-1][j]*p[i + j] + dp[i][j-1]*(1.00-p[i + j]);
                }
                if(i+j == n and i>j)
                {
                    ans += dp[i][j];
                }
            }
        }
    }
    cout<<setprecision(15)<<ans<<"\n";
    return 0;
}

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

s = []
for _ in range(n):
  s1 = input()
  s.append(s1)

print('AC x ' + str(s.count('AC')))
print('WA x ' + str(s.count('WA')))
print('TLE x ' + str(s.count('TLE')))
print('RE x ' + str(s.count('RE')))

Measured memory_bytes: 16220
import java.util.Scanner;

    public class Main {

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

            StringBuilder a = new StringBuilder(sc.next());
            StringBuilder b = new StringBuilder(sc.next());
            StringBuilder c = new StringBuilder(sc.next());
            System.out.print(a.charAt(0));
            System.out.print(b.charAt(0));
            System.out.print(c.charAt(0));
        }

    }

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

using namespace std;
typedef long long ll;

const int MAX_N=1e5+5;

int main(void){
    string s;
    cin >>s;
    int res=0;
    int cnt=0;
    for(int i=0;i<(int)s.size();i++){
        if(s[i]=='A'||s[i]=='C'||s[i]=='T'||s[i]=='G'){
            cnt++;
        }
        else    res=max(res,cnt),cnt=0;
    }
    res=max(res,cnt);
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define MOD (100000)

int mask;
int y, x;
char map[32][32];
int idx[1 << 20];
int memo[20][20][17712];

int countWay(int pos, int bit)
{
	if (pos == x * y){
		return (1);
	}
	int ny = pos / x, nx = pos % x;
	
	int ret = memo[ny][nx][idx[bit]];
	if (ret == -1){
		ret = 0;
		int nbit;
		if (map[ny][nx] == 'J' || map[ny][nx] == '?'){
			nbit = bit;
			if (nbit & 1) nbit -= 1;
			nbit = ((nbit << 1) | 1) & mask;
			ret = (ret + countWay(pos + 1, nbit)) % MOD;
		}
		if (map[ny][nx] == 'O' || map[ny][nx] == '?'){
			nbit = (bit << 1) & mask;
			ret = (ret + countWay(pos + 1, nbit)) % MOD;
		}
		if (map[ny][nx] == 'I' || map[ny][nx] == '?'){
			if (!((bit >> (x - 1)) & 1) || nx == x - 1){
				nbit = bit;
				if (nbit & 1) nbit -= 1;
				nbit = (nbit << 1) & mask;
				ret = (ret + countWay(pos + 1, nbit)) % MOD;
			}
		}
	}
	
	return (memo[ny][nx][idx[bit]] = ret);
}

int main()
{
	int p;
	scanf("%d %d", &y, &x);
	
	p = 1;
	for (int i = 0; i < y; i++){
		scanf("%s", map[i]);
		for (int j = 0; j < x; j++){
			if (map[i][j] == '?'){
				p *= 3;
				p %= MOD;
			}
		}
	}
	int ct = 0;
	for (int i = 0; i < 1 << 20; i++){
		bool flag = true;
		for (int j = 0; j < 20; j++){
			if (((i >> j) & 1) && (i >> (j + 1)) & 1){
				flag = false;
				break;
			}
		}
		if (flag) idx[i] = ct++;
	}
	
	mask = (1 << x) - 1;
	memset(memo, -1, sizeof(memo));
	
	printf("%d\n", (p - countWay(0, 0) + MOD) % MOD);
	
	return (0);
}

Measured memory_bytes: 31780
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define M1 1000000007
#define M2 998244353
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define V(a) vector<a>
#define bn "\n"

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int t=1;
    //cin>>t;
	while(t--)
	{
	   int n;
	   cin>>n;
	   ll s=0;
	   fl(i,1,n+1)
	   {
    	   fl(j,1,n+1)
    	   {
        	   fl(k,1,n+1)
        	   {
        	      s=s+gcd( gcd(i,j),k);
        	   }
    	   } 
	   }
	  cout<<s<<bn;
	}
	
	return 0;
}


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

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

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

    for(int i = 1; i <= m; i++){
        for(int j = 0; j < n-1; j++){
            if(a[j]%i > a[j+1]%i)   swap(a[j], a[j+1]);
        }
    }

    for(int i : a)  cout << i << endl;

    return 0;
}


Measured memory_bytes: 3096
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int x, y, h, w;
int judge_weight(int x, int y, int h, int w) {
	if (x + y + h <= 60 && w <= 2) return 600;
	else if (x + y + h <= 80 && w <= 5) return 800;
	else if (x + y + h <= 100 && w <= 10) return 1000;
	else if (x + y + h <= 120 && w <= 15) return 1200;
	else if (x + y + h <= 140 && w <= 20) return 1400;
	else if (x + y + h <= 160 && w <= 25) return 1600;
	else return 0;
}
int main() {
	int n;
	while (cin >> n&&n) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x >> y >> h >> w;
			sum += judge_weight(x, y, h, w);
		}
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;

namespace ABC121B
{
    static class Program
    {
        static void Main(string[] args)
        {
            var line = ReadLine().SplitTryParseToList<int>();
            var b = ReadLine().SplitTryParseToList<int>();
            var a = new List<List<int>>();
            for (int i = 0; i < line[0]; i++)
            {
                a.Add(ReadLine().SplitTryParseToList<int>());
            }

            var sum = new int[line[0]];
            for (int i = 0; i < line[0]; i++)
            {
                sum[i] = 0;
                for (int j = 0; j < line[1]; j++)
                {
                    sum[i] += (a[i][j] * b[j]);
                }
                sum[i] += line[2];
            }

            WriteLine(sum.Count(x => x > 0));

        }

        public static T TryParse<T>(this String input)
        {
            try
            {
                var converter = TypeDescriptor.GetConverter(typeof(T));
                if (converter != null)
                {
                    return (T)converter.ConvertFromString(input);
                }
                else
                {
                    throw new InvalidCastException("");
                }
            }
            catch
            {
                throw new InvalidCastException(typeof(T) + " is not supported.");
            }
        }

        public static List<T> SplitTryParseToList<T>(this String input)
        {
            return input.Split().Select(n => n.TryParse<T>()).ToList();
        }

        public static List<T> ListSwap<T>(this List<T> list, Int32 index1, Int32 index2)
        {
            var t = list[index1];
            list[index1] = list[index2];
            list[index2] = t;
            return list;
        }

        public static List<Tuple<T, int>> DuplicateCount<T>(this IEnumerable<T> list)
        {
            return list
                .GroupBy(i => i)
                .Where(g => g.Any())
                .Select(g => Tuple.Create(g.Key, g.Count()))
                .ToList();
        }
        public static List<Tuple<T, int>> DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list)
        {
            return list.OrderByDescending((x) => x.Item2).ToList();
        }
        public static List<T> ReadLineOne<T>(int n)
        {
            var list = new List<T>();
            foreach (var i in Enumerable.Range(1, n))
            {
                list.Add(Console.ReadLine().TryParse<T>());
            }
            return list;
        }
        public static void PrintAll<T>(this IEnumerable<T> list)
        {
            foreach (var i in list)
            {
                Console.Write($"{i} ");
            }

            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 15328
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    string S;
    bool w = false;
    for(int i = 0; i < N; i++){
        cin >> S;
        if(S == "Y"){
            w = true;
            break;
        }
    }
    if(w)
        cout << "Four" << endl;
    else
        cout << "Three" << endl;
}

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

int main(void){
   int N;
   cin>>N;
   vector<int> a(N);
   for(int i=0;i<N;i++){
      cin>>a[i];
   }
   int count=0;
   for(int i=0;i<N;i++){
      if(i%2==0&&a[i]%2==1) count++;
   }
   cout<<count<<endl;
   return 0;
}


Measured memory_bytes: 3624
l,r=map(int,input().split())
if (l-1)//2019!=r//2019:
    print(0)
else:
    t=[]*(r-l+1)
    for i in range(l,r):
        for j in range(l+1,r+1):
            t.append(i*j%2019)
    print(min(t))

Measured memory_bytes: 149584
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()
 
#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>
 
#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}
 
#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
 
#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb fflush(stdout)
 
 
using namespace std;

const int max_n = 3e5+5;

const int mod = 1e9 + 7;

vector<PII> pocz[305];
int mem[305][305][305];
int n;

int main() {
	read(n);
	make(m);
	FOR(i,0,m) {
		make3(a, b, c);
		pocz[b].pb(mp(a,c));
	}
	FOR(i,0,n+1) FOR(j,0,n+1) FOR(k,0,n+1) mem[i][j][k] = 0;
	mem[0][0][0] = 1;
	FOR(pos,0,n) {
		FOR(k,0,pos+1) { FOR(l,k,pos+1) {
				bool ok = true;
				FORE(j, pocz[pos+1]) {
					int ile = 1;
					if (k >= j->st) ile++;
					if (l >= j->st) ile++;
					if (ile != j->nd) {
						ok = false;
						break;
					}
				}
				if (ok) {
					mem[pos+1][k][l] += mem[pos][k][l];
					mem[pos+1][k][l] %= mod;
				}

				ok = true;
				FORE(j, pocz[pos+1]) {
					int ile = 1;
					if (k >= j->st) ile++;
					if (pos >= j->st) ile++;
					if (ile != j->nd) {
						ok = false;
						break;
					}
				}
				if (ok) {
					mem[pos+1][k][pos] += mem[pos][k][l];
					mem[pos+1][k][pos] %= mod;
				}

				ok = true;
				FORE(j, pocz[pos+1]) {
					int ile = 1;
					if (pos >= j->st) ile++;
					if (l >= j->st) ile++;
					if (ile != j->nd) {
						ok = false;
						break;
					}
				}
				if (ok) {
					mem[pos+1][l][pos] += mem[pos][k][l];
					mem[pos+1][l][pos] %= mod;
				}
			}
		}
	}
	int ans = 0;
	FOR(i,0,n+1) FOR(j,0,n+1) ans = (ans + mem[n][i][j]) % mod;
	printf("%d\n", ans);
}


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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> DP(H + 1, 1e9);
  DP.at(0) = 0;
  for (int a, b; cin >> a >> b;) {
    for (int i = 0; i < H; i++) {
      int next = min(H, i + a);
      DP.at(next) = min(DP.at(next), DP.at(i) + b);
    }
  }
  cout << DP.at(H) << "\n";
}

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

namespace mydef
{
  void say(string some){
    cout << some << "\n";
  }
} // namespace mydef
using namespace mydef;

typedef long long ll;


void solve(){
    
}

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string S, T;
  cin >> S >> T;

  T.pop_back();
  if (S == T)
  {
    say(Yes);
  }else
  {
    say(No);
  }
  
  
  return 0;
}




Measured memory_bytes: 3644
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/* libnum {{{*/
void amax(N, Args...)(ref N x, Args y) {
  x = x.max(y);
}
void amin(N, Args...)(ref N x, Args y) {
  x = x.min(y);
}
auto maxE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amax(y);
  return x;
}
auto minE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amin(y);
  return x;
}
/*}}}*/

/+---test
5 4 1
1 2
2 3
3 4
3 5
---+/
/+---test
5 4 5
1 2
1 3
1 4
1 5
---+/
/+---test
2 1 2
1 2
---+/
/+---test
9 6 1
1 2
2 3
3 4
4 5
5 6
4 7
7 8
8 9
---+/

void main(string[] args) {
  long N, u, v;
  readf(" %d %d %d ", &N, &u, &v);
  --u; --v;

  auto E = new long[][](N);
  foreach (i; 0..N-1) {
    long a, b;
    readf(" %d %d ", &a, &b);
    --a; --b;
    E[a] ~= b;
    E[b] ~= a;
  }

  auto level    = new long[](N);
  auto parent   = new long[](N);
  auto children = new long[][](N);
  auto dist     = new long[](N);

  long setlevel(size_t x, long l, long p = -1) {
    if (p != -1) {
      parent[x] = p;
    }
    level[x] = l;

    long maxdist;
    foreach (e; E[x]) {
      if (e != p) {
        maxdist.amax(setlevel(e, l+1, x) + 1);
        children[x] ~= e;
      }
    }
    dist[x] = maxdist;
    return maxdist;
  }

  parent[] = -1;
  level[]  = -1;
  setlevel(u, 0);

  long ans = level[v] <= 2? 0: (level[v]-1)/2;

  u = v;
  foreach (i; 0..ans+1) u = parent[u];

  if (level[v]%2 == 0) {
    u = parent[u];
    ++ans;
  }

  parent[] = -1;
  level[]  = -1;
  setlevel(u, 0);

  long aoki_branch = v;
  while (parent[aoki_branch] != u) {
    aoki_branch = parent[aoki_branch];
  }

  long taka_branch = -1;
  foreach (c; children[u]) {
    if (c == aoki_branch) continue;
    if (taka_branch == -1 || dist[taka_branch] < dist[c]) {
      taka_branch = c;
    }
  }
  if (taka_branch != -1) {
    ans += dist[taka_branch]+1;
  }
  ans.writeln;
}


Measured memory_bytes: 23676
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())

def coin_check(coin_total, total):
    if coin_total==total:
        return 1
    else:
        return 0

count = 0
for i in range(coin_500 + 1):
    for j in range(coin_100 + 1):
        for k in range(coin_50 + 1):
            coin_total = i*500 + j*100 + k*50
            count+=coin_check(coin_total, total)
print(count)

Measured memory_bytes: 3064
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
using namespace std; 
int main()
{
	int a, b;
	cin >> a >> b;
	int x = max(a + b, a - b);
	int ans = max(x, a*b);
	cout << ans << endl;
	
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

# define fr(a,b) for(int i = a; i < b; i++)
# define rep(i,a,b) for(int i = a; i < b; i++)

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 1 , 0 } ;
const int dy[] = { 0 , 1 , 0 , -1 } ;

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;



void solve(){

    int n;
    cin >> n;
    int k;
    cin >> k;
    int x;
    cin >> x;
    int y;
    cin >> y;
    if(n<=k){
        cout << x*n;
    }
    else {
            cout << (k*x+(n-k)*y);
    }


    line


}

int main(){
	fast
	int t=1;
	//cin >> t;
	while(t--){
             solve();
    }

	R 0;
}


Measured memory_bytes: 3604
#include<stdio.h>

int main(){
    int S,h,m,s;
    
    scanf("%d",&S);

    h = S/3600;
    m = (S-h*3600)/60;
    s = S-h*3600-m*60;

    printf("%d:%d:%d\n",h,m,s);

    return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
#define int long long
#define vin vector<int>
#define vcn vector<char>
#define ver pair<int,int>
#define ld long double
#define pb push_back
#define x first
#define y second
#define blush fflush(stdout);fflush(stdin);
#define $(a) (int)a.size()
#define scanf ;
#define printf ;
using namespace std;
void i_love_misaka_mikoto();
int32_t main(){
    #ifdef RNS
        freopen("input.txt","r",stdin);
        #ifndef DBG
        freopen("output.txt","w",stdout);
        #endif
    #else
        ios_base::sync_with_stdio(false);
    #endif
    i_love_misaka_mikoto();
    #ifdef RNS
        cout<<'\n'<<(ld)clock()/CLOCKS_PER_SEC<<" セクンド\n";
    #endif
    return 0;
}

int rz[(int)1e6];

void i_love_misaka_mikoto(){
    int n, w;
    cin>>n>>w;
    vector<ver> in(n);
    memset(rz, 101, sizeof rz);
    for(int i=0;i<n;i++)
        cin>>in[i].x>>in[i].y;
    rz[0]=0;
    for(int i=0;i<n;i++){
        for(int j=1e5+13;j>=0;j--){
            if(rz[j]!=rz[(int)1e5+12]){
                rz[j+in[i].y]=min(rz[j+in[i].y], rz[j]+in[i].x);
            }
        }
    }
    int ans=1e5+13;
    while(rz[ans]>w)ans--;
    cout<<ans;
}

Measured memory_bytes: 8064
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n, x, a, m[200], s = 0;
    cin >> n >> x;
    for(int i = 0; i < n; i++)
    {
        cin >> m[i];
        s = s + m[i];
    }
    a = m[0];
    for(int i = 0; i < n; i++)
    {
        if(a > m[i])
            a = m[i];
    }
    cout << n + ((x - s)/a);
    return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
l = ['.'*(w+2)]+list('.'+(input()+'.')for _ in range(h))+ ["."*(w+2)]
for i in range(1,h+1):
  for j in range(1,w+1):
    if l[i][j]=="#":
      if l[i-1][j]=="#" or l[i+1][j]=="#" or l[i][j+1]=="#" or l[i][j-1]=="#":
        continue
      else:
        print("No")
        exit()

print("Yes")
      

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
string ans="";
int n;
int main()
{
	cin>>n;
	int cnt=0;
	int bit=1;
	if(n==0)
	{
		cout<<0<<endl;
		return 0;
	}
	while(n)
	{
		if(abs(n)&abs(bit))
		{
			ans+='1';
			n-=bit;
		}
		else
			ans+='0';
		bit*=-2;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
    In the name of
        "ALLAH"
    And say "AL-HAMD-U-LILLAH"
*/

#include<bits/stdc++.h>
#define   ll   long long
#define   llu  unsigned long long
#define   _    printf("\n")
int      take() {
    int n;
    scanf("%d",&n);
    return n;

}
double  ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll     takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define  Int            take()
#define  Dnt            ttake()
#define  LL             takes()
#define  done           {return 0;}
#define  fr(i,x,n,a)    for(int i=x;i<=n;i+=a)
#define  FR(a,b,x)      for(int i=(a);i<=(b);i+=(x))
#define  rfr(i,x,n,a)   for(int i=x;i>=n;i--)
int      cas;
#define  print          printf("Case %d:",++cas)
#define  vi             vector<int>
#define  vl              vector<ll>
#define  pb              push_back
#define  pii             pair<int,int>
#define  vii             vector<pii>
#define  pll             pair<ll,ll>
#define  pil             pair<int,ll>
#define  pli             pair<ll,int>
#define  mk              make_pair
#define  fill(x,v)       memset(x,v,sizeof x)

using    namespace      std;

bool     approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define  STR            {struct info}
#define  dbg(x)         {cout<<"ekhane"<<x<<endl;}
#define  SS             second
#define  FF             first
#define  PQ             priority_queue
#define  great          greatest
#define  less           lesser
#define  mii            map<int,int>
#define  mil            map<int,ll>
#define  mll            map<ll,ll>
#define  msb            map<string,bool>
#define  V              vector
#define  M              100005
#define  pf             printf
//////////////////////////////////////////

int main( ){
    int x = Int , y = Int , z = Int ;
    ll k = LL ;
    if( k % 2 ){
        cout<<y - x <<endl;
    }else{
        cout<<x - y <<endl ;
    }
    done ;
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())

lis = []
ans = ""
now = A % B

while True:

    if now == C:
        ans = "YES"
        break

    if now in lis:
        ans = "NO"
        break

    lis.append(now)
    now += A
    now = now % B

print (ans)

Measured memory_bytes: 3188
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int main() {
    int N, Q; scanf("%d%d", &N, &Q);
    vector< vector<int> > b(2, vector<int>(N, -1));
    vector<int> p(2, N-2);
    ll ans = 1LL * (N-2) * (N-2);
    while(Q--) {
        int t, x; scanf("%d%d", &t, &x);
        t--; x -= 2; // x is 0-indexed
        if(b[t][x] != -1) {
            ans -= b[t][x];
        }
        else {
            ans -= p[t^1];
            for(int a=x+1; a<p[t]; a++) b[t][a] = p[t^1];
            p[t] = x;
        }
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 5620
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
const long long inf=1e9+7;
const long long mod=1e9+7;
const int64_t CYCLES_PER_SEC=2800000000;
//
inline uint32_t Xor128(){
	static uint32_t x=123456789;
	static uint32_t y=362436069;
	static uint32_t z=521288629;
	static uint32_t w=88675123;
	uint32_t t=x^(x<<11);
	x=y;y=z;z=w;
	return w=(w^(w>>19))^(t^(t>>8));
}
struct Timer{
	int64_t start;
	Timer(){reset();}
	void reset(){start=getcycle();}
	void plus(double a){start-=(a*CYCLES_PER_SEC);}
	inline double get(){return (double)(getcycle()-start)/CYCLES_PER_SEC;}
	inline int64_t getcycle(){
		uint32_t low,high;
		__asm__ volatile ("rdtsc":"=a"(low),"=d"(high));
		return ((int64_t)low)|((int64_t)high<<32);
	}
};
//
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=50000;i++){
		int m=i*1.08;
		if(n==m){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void trace(int A[],int N){
  int i;
  for(i=0;i<N-1;++i) cout<<A[i]<<" ";
  cout<<A[i]<<endl;
}
void insertionSort(int A[],int N){
  int i,j,v;
  for(i=1;i<N;++i){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    trace(A,N);
  }
}
int main(){
  int n,i;
  int a[101];
  cin>>n;
  for(i=0;i<n;++i) cin>>a[i];
  trace(a,n);
  insertionSort(a,n);
  return 0;
}

Measured memory_bytes: 3104
N = int(input())
S = input()

L = list(S)
l= len(S)
for _ in range(N):
    for i in range(l):
        if L[i] == "Z":
            L[i] = "A"
        else:
            L[i] = (chr(ord(L[i]) + 1))
ans = "".join(L)
print(ans)

Measured memory_bytes: 3064
#include <iostream>

int main() {
    int data[9];
    for(int i = 0; i < 9; i++) {
        scanf("%d", data + i);
    }

    int flag[9];
    for(int i = 0; i < 9; i++) {
        flag[i] = 0;
    }

    int n;
    scanf("%d", &n);
    int b[n];
    for(int i = 0; i < n; i++) {
        scanf("%d", b + i);
        for(int j = 0; j < 9; j++) {
            if(data[j] == b[i]) {
                flag[j] = 1;
            }
        }
    }

    for(int row = 0; row < 3; row++) {
        if(flag[row * 3] && flag[row * 3+1] && flag[row * 3+2]) {
            printf("Yes\n");
            return 0;
        }
    }

    for(int column = 0; column < 3; column++) {
        if(flag[column] && flag[column+3] && flag[column+6]) {
            printf("Yes\n");
            return 0;
        }
    }

    if(flag[0] && flag[4] && flag[8]) {
        printf("Yes\n");
        return 0;
    }

    if(flag[2] && flag[4] && flag[6]) {
        printf("Yes\n");
        return 0;
    }

    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] x = new double[n];
        String[] u = new String[n];
        for (int i = 0; i < u.length; i++) {
            x[i] = sc.nextDouble();
            u[i] = sc.next();
        }
        double sum = 0.0;
        for (int i = 0; i < u.length; i++) {
            if (u[i].equals("JPY")) {
                sum += x[i];
            } else {
                sum += x[i] * 380000.0;
            }
        }
        System.out.println(sum);
        sc.close();
    }
}

Measured memory_bytes: 23380
def io_tmp():
    global input
    import io, sys
    f = io.BytesIO(sys.stdin.buffer.read())
    input = f.readline

io_tmp()


from scipy.sparse.csgraph import floyd_warshall
import numpy as np

N, M, L = map(int, input().split())
graph = np.zeros((N, N))
for _ in range(M):
    s, t, w = map(int, input().split())
    if w <= L:
        graph[s-1, t-1] = graph[t-1, s-1] = w
dist = floyd_warshall(graph, directed=False)
dist = floyd_warshall(dist <= L, directed=False)
dist[np.isinf(dist)] = 0.0

Q = int(input())
ans = []
for _ in range(Q):
    s, t = map(int, input().split())
    ans.append(int(dist[s-1][t-1]) - 1)
print(*ans, sep='\n')


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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10e9
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;  

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif
 
  int n; cin >> n; 
  int m; cin >> m;
  vector<pair<ll , ll>> v;
  forn(i , 0 , n){
    int a; cin >> a;
    int b; cin >> b;
    v.push_back({a , b});
  }
  sort_all(v);
  ll k = 0 , d = 0;
  forn(i , 0 , n){ 
    k += v[i].first * v[i].second;
    d += v[i].second;
    if(d >= m){
      k -= v[i].first * (d - m);
      break;
    }
  }
  cout << k << endl;
           
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

void make(string &s,char c){
  string k ;
  rep(i,s.size()){
    if(s[i] == c){
      if(i) k[i-1] = c;
      /* k += s[i]; */
    }
    else{
      k += s[i];
    }
  }
  s = k;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  string s,t;
  cin >> s;
  ll c = inf;
  if(s.size() == 1) c = 0;
  else{
    rep(i,s.size()){
      ll tmp = 0;
      t = s;
      rep(_,100){
        set<char> m;
        string k;
        int l = 0;
        while(l < t.size()-1){
          if(t[l] == s[i] || t[l+1] == s[i]){
            k += s[i];
          }
          else{
            k += t[l];
          }
          ++l;
        }
        /* debug(k); */
        rep(j,k.size()){
          m.insert(k[j]);
        }
        if(m.size() == 1) break;
        ++tmp;
        t = k;
      }
      c = min(c,tmp);
    }
  }
  if(c != 0) ++ c;
  std::cout << c << std::endl;
 
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define SECOND_PER_HOUR (60 * 60)
#define SECOND_PER_MINUTE 60

int main() {
  int time_sec;
  int h, m ,s;

  scanf("%d", &time_sec);
  h = time_sec / SECOND_PER_HOUR;
  m = (time_sec % SECOND_PER_HOUR) / SECOND_PER_MINUTE;
  s = time_sec % SECOND_PER_MINUTE;

  printf("%d:%d:%d\n", h, m, s);
}



Measured memory_bytes: 2756
#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
using namespace std;
long long n, k, a[234321], ans = 0;
int main() {
	cin >> n >> k;
	for0(i, n)cin >> a[i]; sort(a, a + n);
	for0(i, n)ans += (n - k <= i ? 0 : a[i]); cout << ans << "\n";
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {

	jaldi

    int n;
	int t;
	int x;
	cin>>n;
	cin>>x;
	cin>>t;
	int ans;
	if(n%x!=0) {
	    ans = ((n/x)*t)+t;
	}
	else {
	    ans = (n/x)*t;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) ;
#define LINE     ;
#define dumpV(v);
#define STOP     ;
#endif
#define mp make_pair

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


const int MAX_N = 256;
vector<int> es[MAX_N];

vector<int> mergeVec(vi& x, vi& y) {
    reverse(all(x));
    reverse(all(y));
    int n = max(x.size(), y.size());
    vi ret(n);
    rep(i, x.size()) ret[i] = max(ret[i], x[i]);
    rep(i, y.size()) ret[i] = max(ret[i], y[i]);
    reverse(all(x));
    reverse(all(y));
    reverse(all(ret));
    return ret;
}

vector<int> memo[MAX_N][MAX_N];

vector<int> calc(int v, int par = MAX_N-1) {
    if(par != MAX_N-1 && es[v].size() == 1) {
        return vi{};
    }
    if(memo[v][par].size() > 0) return memo[v][par];
    vector<int> ret;
    for(int& to : es[v]) {
        if(par != to) {
            vector<int> tmp = calc(to, v);
            ret = mergeVec(ret, tmp);
        }
    }
    int k = es[v].size();
    if(par != MAX_N-1) --k;
    ret.push_back(k);
    return memo[v][par] = ret;
}

ll getLeaf(const vi& x) {
    ll ret = 1LL;
    rep(i, x.size()) {
        if(double(ret)*x[i] > 9e18) return -1;
        ret *= x[i];
    }
    return ret;
}

vector<int> getAns(const vi& x, const vi& y) {
    if(x.size() < y.size()) return x;
    if(x.size() > y.size()) return y;
    ll X = getLeaf(x);
    ll Y = getLeaf(y);
    if(X == -1) return y;
    if(Y == -1) return x;
    if(X < Y) return x;
    return y;
}


int main(){
    int n;
    cin >> n;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        es[a].pb(b);
        es[b].pb(a);
    }
    if(n == 2) {
        cout << 1 << " "<< 2 << endl;
        return 0;
    }
    auto ans = calc(0);
    ans.pb(1);
    // dumpV(ans);
    REP(i, 1, n) {
        auto z = calc(i);
        z.pb(1);
        ans = getAns(ans, z);
        // dumpV(calc(i));
    }
    rep(i, n) {
        for(auto& j : es[i]) {
            auto x = calc(i, j);
            auto y = calc(j, i);
            auto z = mergeVec(x, y);
            z.pb(2);
            ans = getAns(ans, z);
            // dumpV(z);
        }
    }
    cout << ans.size() << " " << getLeaf(ans) << endl;
    // dumpV(ans);
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,a,b,c,d; cin>>n>>a>>b>>c>>d;
    ll diff=b-a;
    for(ll i=0;i<n;i++){
        //i inc,n-i-1 dec
        // printf("Inc %d,Dec %d\n",i,n-i-1);
        ll ubound=i*d-(n-i-1)*c;
        ll lbound=i*c-(n-i-1)*d;
        if(diff<=ubound&&diff>=lbound){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : Lokesh goel*
* NICK : InsaneNerd *
* INSTITUTION : NIT Kurukshetra *
******************************************/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000000
#define N 100005
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cerr.tie(NULL);
#define endl "\n"
#define ms(x,v) memset(x,v,sizeof(x))

int main()
{
	fastio;
	int x;
	cin>>x;
	x^=1;
	cout<<x<<endl;


	return 0;
}

Measured memory_bytes: 3644
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  [n, x] <- getIntList
  xs <- getIntList
  let xs' = toList $ Seq.unstableSort $ Seq.fromList (x:xs)

      cdiff [x]      res = res
      cdiff (y:x:xs) res = cdiff (x:xs) (x-y:res)

      ds = cdiff xs' []

      ans = foldr gcd (head ds) (tail ds)

  print ans

Measured memory_bytes: 29052
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    deque<char> d;
    for (char c : s)
        d.push_back(c);
    int q;
    cin >> q;
    int r = 0;
    while (q--)
    {
        int t;
        cin >> t;
        if (t == 1)
            r = 1 - r;
        else
        {
            int f; char c;
            cin >> f >> c; f--;
            if (f ^ r)
                d.push_back(c);
            else
                d.push_front(c);
        }
    }
    if (r)
        reverse(all(d));
    for (char c : d)
        cout << c;
}


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

int main(void){
  char S[11],T[11],U[11];
  int A,B,i,j;
  
  scanf("%s %s",S,T);
  scanf("%d %d",&A,&B);
  scanf("%s",U);
   
  if(strcmp(S,U)==0){
    printf("%d %d\n",A-1,B);
  }
  if(strcmp(T,U)==0){
    printf("%d %d\n",A,B-1);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 7e18;
using namespace std;


int main(){
	int d, t, s;
	cin >> d >> t >> s;
	if (t*s >= d) cout << "Yes" << endl;
	else cout << "No" << endl; 
	return 0;
}



Measured memory_bytes: 3616
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = [list(map(int,input().split())) for i in range(m)]

for i in range(m):
  time = 0
  for j in range(n):
    if j == p[i][0]-1:
      time += p[i][1]
    else:
      time += t[j]
    
  print(time)

Measured memory_bytes: 3064
using System;
using System.Linq;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ') ;
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            Console.WriteLine(Math.Max(A+B, Math.Max(A-B, A*B)));
        }
    }
}


Measured memory_bytes: 11092
package main

import "fmt"

func main() {
  var a, b int
  fmt.Scan(&a, &b)
  
  if a + b > a - b {
    if a + b > a * b {
      fmt.Println(a + b)
    } else {
      fmt.Println(a * b)
    }
  } else {
    if a - b > a * b {
      fmt.Println(a - b)
    } else {
      fmt.Println(a * b)
    }
  }
}

Measured memory_bytes: 512
def LI():
	return [ int(s) for s in input().split() ]
  
N = int(input())
A = LI()
B = LI()

cnt = 0
for i in reversed(range(N)):
  if A[i+1]+A[i]-B[i] <= 0:
    cnt += A[i+1]+A[i]
    A[i] = 0
  else:
    cnt += B[i]
    if A[i+1] < B[i]:
      A[i]=A[i]-(B[i]-A[i+1])

print(cnt)

Measured memory_bytes: 19156
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

int main(void){
	int a,p;
	cin>>a>>p;
	cout<<(a*3+p)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<math.h>
using namespace std;

int main() {
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	long m=1000000000;
	int s1 = A * X + B * Y;
	int s2 = C *2* max(X, Y);
	int s3;
	if (X > Y) {
		s3 = C * 2 * Y + A * (X - Y);
	}
	else s3 = C * 2 * X + B * (Y - X);
	s2 = min(s3, s2);

	cout << min(s2,s1);
}

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

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> p;
    rep(i,n){
        int a;
        cin>>a;
        p.push_back({a,i+1});
    }
    sort(p.begin(),p.end());
    for(auto x:p){
        cout<<x.second<<endl;
    }
}

Measured memory_bytes: 4204
#include <iostream>
using namespace std ;
int main () {
	char s[3];
	int ans = 0;
	for(int i = 0 ; i < 3; i++){
		cin >> s[i];
		//error check
		//cout << s[i] ;

		//元々のコード
		if(s[i] == '1')ans++;


		//switch
		/*switch (s[i]) {
			case '1':ans++;break;
			case '0':break;
			default:break;
		}*/


 		//error check
		//out << ans << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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 argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  ans = n * (n-1) / 2 + m * (m-1)/ 2; 
  cout << ans << endl;
  return 0;
}



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

int main(){
  int a; cin >> a;
  if(a==1) cout << 0 << endl;
  else cout << 1 << endl;
}


Measured memory_bytes: 3628