akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> z(n);
    ll ans = 0;
    ll gatians=0;
    ll b = 0;
    for (int i = 0; i < n; i++) {
        cin >> z[i];
        ans += max(z[i], b);
    }
    ll zans = ans;
    for (int i = 0; i < k; i++) {
        zans += min(b, z[i]);
    }
    gatians = zans;
    for (int i = 0; i < n-k; i++) {
        zans -= min(b, z[i]);
        zans+= min(b, z[i+k]);
        gatians = max(zans, gatians);
    }
   zans = ans;
    for (int i = 0; i < k; i++) {
        zans -= max(b, z[i]);
    }
    gatians = max(zans, gatians);
    for (int i = 0; i < n - k; i++) {
        zans += max(b, z[i]);
        zans -= max(b, z[i + k]);
        gatians = max(zans, gatians);
    }
    cout << gatians << endl;
}

Measured memory_bytes: 4020
number = input().split()
number_int = [int(x) for x in number]
sum1 = number_int[0]
sum2 = number_int[1]
answer = 'No'

for i in range(sum1+1):
    temp1 = i * 2
    temp2 = (sum1 - i) * 4
    if temp1 + temp2 == sum2:
        answer = "Yes"
        break

print(answer)

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

const int mod = 1000000007;
string s1, s2;

int dp[53][4][4], n;

void adds(int &a, int b) {
    a = (a + b) % mod;
}

int sol(int t, int p1, int p2) {
    if(t == n)
        return 1;
    if(dp[t][p1][p2] != -1)
        return dp[t][p1][p2];
    int sum = 0;
    if(s1[t] == s2[t]) {
        for(int i = 0; i < 3; ++i)
            if(p1 != i && p2 != i)
                adds(sum, sol(t + 1, i, i));
    } else {
        for(int i = 0; i < 3; ++i)
            for(int j = 0; j < 3; ++j)
                if(p1 != j && p2 != i && i != j)
                    adds(sum, sol(t + 2, j, i));
    }
    return dp[t][p1][p2] = sum % mod;
}


int main() {
    cin >> n >> s1 >> s2;
    memset(dp, -1, sizeof dp);
    cout << sol(0, 3, 3) << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class APrefixAndSuffix {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        string S, T;
        in >> S >> T;
        int res = 2 * n;
        FOR(i, 1, n + 1) {
            if (T.substr(0, i) == S.substr(n - i)) {
                res = 2 * n - i;
            }
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    APrefixAndSuffix solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

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

	string s; int q;
	cin >> s >> q;

	int r = 0;

	string pre = "", suf = "";

	while(q--) {
		int op; cin >> op;

		if(op == 1)
			r ^= 1;

		else {
			string c;
			cin >> op >> c;

			if(r == 0) {
				if(op == 1)
					pre += c;

				else suf += c;
			}

			else {
				if(op == 1)
					suf += c;

				else pre += c;
			}
		}
	}

	reverse(pre.begin(), pre.end());

	string ans = pre + s + suf;

	if(r)
		reverse(ans.begin(), ans.end());

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
 
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
 
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
 
#define infi INT_MAX
#define infl LONG_MAX
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)
#define F first
#define S second
#define G(a,b) get<a>(b)
#define MP make_pair
#define MT make_tuple
 
const ll MAX=2e5+5;
ll arr[MAX];
ll n;

ll can()
{
  ll x=0;
  f(i,0,n)
  {
    if(arr[i]==x+1) x++;
  }
  return x;
}

void func()
{
  cin>>n;
  f(i,0,n)  cin>>arr[i];
  ll ans=can();
  if(ans==0) cout<<"-1\n";
  else cout<<(n-ans)<<endl;
}
 
int main() 
{
    fast
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    
    ll q=1;
    //cin>>q;
    while(q)
    {
      func();
      q--;
    }
 
    return 0;
}

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

const int MAX_N = (int)1e5 + 5;

int n;
int a, b;

vector<vector<int>> graph(MAX_N);

int pathF[MAX_N];
int pathS[MAX_N];

int cF;
int cS;

void bfs(int begin, int (&path)[MAX_N]) {
  queue<pair<int, int>> que;
  que.push(make_pair(begin, 0));

  while (!que.empty()) {
    int cvt = que.front().first;
    int ccost = que.front().second;
    que.pop();

    path[cvt] = ccost;

    for (int i = 0; i < graph[cvt].size(); ++i) {
      int nvt = graph[cvt][i];
      if (path[nvt] == -1) {
        que.push(make_pair(nvt, ccost + 1));
      }
    }

  }

  return;
}

int main(void){
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n - 1; ++i) {
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  fill(pathF, pathF + n + 5, -1);
  fill(pathS, pathS + n + 5, -1);

  bfs(1, pathF);
  bfs(n, pathS);

  for (int i = 1; i <= n; ++i) {
    if (pathF[i] > pathS[i]) cS += 1;
    else cF += 1;
  }

  if (cF > cS) printf("Fennec\n");
  else if (cF < cS) printf("Snuke\n");
  else printf("Snuke\n");

  return 0;
}


Measured memory_bytes: 6724
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
int n,m,c,ans[101][101],i=1,j=1,x,t;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	//freopen("sol.in","r",stdin);
	cin>>n>>m>>c;
	for(t=1;t<=c;t++)
	{
		cin>>x;
		for(;i<=n;)
		{
			if((i&1))for(;j<=m && x;j++,x--)ans[i][j]=t;
			else for(;j>=1 && x;j--,x--)ans[i][j]=t;
			if(j>m)j=m,i++;
			else if(!j)j=1,i++;
			if(!x)break;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)cout<<ans[i][j]<<" ";
		cout<<endl;
	}
	return 0;
}

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

int main() {
  int P, Q, R;
  cin >> P >> Q >> R;
  int min = P + Q;
  
  if (min > Q + R)
    min = Q + R;
  if (min > P + R)
    min = P + R;
  
  cout << min << endl;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = []
for num in a:
  b.append(num%2)
  
import collections
c = collections.Counter(b)

num0=c[0]
num1=c[1]
num0 += num1//2
num0 %= 2
num1 = num1%2

if num0+num1==2:
  print("NO")
else:
  print("YES")
  

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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int cnt = 0;
    vector<int> v;
    for (int k = 0; k * b <= n; k++)
    {
        v.push_back(k * b);
    }

    for (int i = 0; i * r <= n; i++)
    {
        for (int j = 0; j * g <= n; j++)
        {
            int tmp = n - i * r - j * g;
            auto itr = lower_bound(v.begin(), v.end(), tmp);
            if (itr != v.end() && *itr == tmp)
            {
                cnt++;
                // cout << i << " " << j << " " << *itr << endl;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    ll sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    for(ll i=0; i<abs(ty-sy); i++)
        cout << "U";
    for(ll i=0; i<abs(tx-sx); i++)
        cout << "R";
    for(ll i=0; i<abs(ty-sy); i++)
        cout << "D";
    for(ll i=0; i<abs(tx-sx); i++)
        cout << "L";
    cout << "L";
    for(ll i=0; i<abs(ty-sy); i++)
        cout << "U";
    cout << "UR";
    for(ll i=0; i<abs(tx-sx); i++)
        cout << "R";
    cout << "DR";
    for(ll i=0; i<abs(ty-sy); i++)
        cout << "D";
    cout << "DL";
    for(ll i=0; i<abs(tx-sx); i++)
        cout << "L";
    cout << "U";
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main() {
	int k,a,b;
    bool flag=false;
	cin >> k >> a >> b;
    for(int i=a;i<=b;i++){
    if(i%k==0){
    flag=true;
    }
    }
    if(flag){
    cout<<"OK"<<endl;
    }else{
    cout<<"NG"<<endl;
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int i,j,a,b;
    cin >> a >> b;
    if(a>9 || b>9)
    {
         cout << "-1"<<endl;
    }
    else
    {
       i=a*b;
        cout << i <<endl;
    }
    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int s=0;
	
	int x=n;
	while(true)
	{
		if(x==0)
			break;
		x/=10;
		s++;
	}
//	cout<<s<<endl;
	int ans=9,res=0;
	for(int i=1; i<=(s+1)/2; i++)
	{
		res+=ans;
		ans*=100;
	}
//	cout<<res<<endl;
	if(s%2==1)
	{
		res=res+n-pow(10,s)+1;
	}
	
	cout<<res;
	
//	if(s%2==1)
//	{
//		
//	}
//	else
//	{
//		s/=2;
//		
//	}
	
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <vector>

#define REP(i, n) for (long long i = 0; i < n; i++)
#define FOR(i, m, n) for (long long i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

using namespace std;

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

    vector<int> top(N, 0);
    vector<int> bottom(N, 0);

    REP(i, N) { cin >> top[i]; }

    REP(i, N) { cin >> bottom[i]; }

    for (int i = 1; i < N; i++) top[i] += top[i - 1];

    for (int i = N - 2; i != -1; i--) bottom[i] += bottom[i + 1];

    int max = -1;
    int max_v = 0;
    REP(i, N) {
        if (max_v < top[i] + bottom[i]) {
            max = i;
            max_v = top[i] + bottom[i];
        }
    }

    cout << max_v << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static int sumDigits(String n) {
    int sum = 0;
    String[] nAry = n.split("");
    for (int i = nAry.length-1; i >= 0; i--) {
      sum += Integer.parseInt(nAry[i]);
    }
    return sum;
  }
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String n = s.next();
    while (!n.equals("0")) {
      System.out.println(sumDigits(n));
      n = s.next();
    }
    s.close();
  }
}



Measured memory_bytes: 27136
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
}

Measured memory_bytes: 22516
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<string>
#include<cmath>
#include<algorithm>
#include<ctime>
#include<fstream>
#include<sstream>
#include<vector>
#include<set>
#include<deque>
#include<cstring>
#include<queue>
#include<stdio.h>
#include<set>
#include<stack>
#include<numeric>
#include<map>
#include<cstdio>
#include<bitset>
#include<array>
#include<list>
using namespace std;
#define ll long long 
const ll mod = 1e9 + 7;

ifstream f1;
ofstream f2;

vector<ll> city;
vector<ll> hero;

ll solve() {
	ll need = 0;
	ll res = 0;
	for (ll i = 0; i < hero.size(); i++) {
		if (hero[i] >= city[i]) {
			res += city[i];
			hero[i] -= city[i];
			city[i] = 0;
			if (hero[i] > 0) {
				res += min(city[i + 1], hero[i]);
				city[i + 1] = max(need, city[i + 1] - hero[i]);
				hero[i] = 0;
			}
		}
		else {
			res += hero[i];
			city[i] -= hero[i];
			hero[i] = 0;
		}
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	f1.open("INP.txt");
	f2.open("OUT.txt");
	//system("pause");
	ll n;
	cin >> n;
	for (ll i = 0; i <= n; i++) {
		ll x;
		cin >> x;
		city.push_back(x);
	}
	for (ll i = 0; i < n; i++) {
		ll x;
		cin >> x;
		hero.push_back(x);
	}
	cout << solve() << '\n';
	return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
    using namespace std;
    int main(){
      int k,s,n;
      //string s;
      cin>>s>>k;
      vector<bool> v(10);
      while(k--){
      	cin>>n;
        v[n]=true;
      }
      n=s;
      for(;n<=100000;n++){
      	bool x = true;
        string ks = to_string(n);
        for(int j=0;j<(int)ks.size();j++){
        	if(v[ks[j]-'0']) x=false;
        }
        if(x) break;
      }
      cout<<n;
    }

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

int main(void) {
	int n, k;
	cin >> n >> k;
	vector<int> l(n);
	for(int i=0;i<n;i++) cin >> l[i];

	sort(l.begin(), l.end());

	int sum=0;

	for(int i=n-k;i<n;i++) sum += l[i];

	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n; cin >> n;
	
	if(n == 1) cout << "Hello World" << endl;
	else {
		int a, b; cin >> a >> b;
		
		cout << a + b << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))
L=[0]*(max(A)+1)
for a in A:
  L[a]+=1
#print(L)
SUM=0
for l in L:
  SUM+=l*(l-1)//2
  
for a in A:
  l=L[a]
  print(SUM-l*(l-1)//2+(l-1)*(l-2)//2)
  

Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int A, B, C;
    cin >> A >> B >> C;
    cout << min(B / A, C) << '\n';
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
using namespace std;
struct TMenseki{
    int Point;
    int Menseki;
};

int Calculation(string str, vector<TMenseki>& MensekiList);

int Calculation(string str, vector<TMenseki>& MensekiList)
{
    int TotalMenseki = 0;
    vector<int> List;
    List.clear();
    
    TMenseki Temp;
    MensekiList.clear();
    
    for(int i = 0; i < str.size(); i++){
        if(str[i] == '\\')  List.push_back(i);
        if(str[i] == '/' && !List.empty()){
            Temp.Menseki = i - List[List.size() - 1];
            Temp.Point = List[List.size() - 1];
            TotalMenseki += Temp.Menseki;
            for(int j = MensekiList.size() - 1; j >= 0; j--){
                if(Temp.Point < MensekiList[j].Point){
                    Temp.Menseki += MensekiList[j].Menseki;
                    vector<TMenseki>::iterator it = MensekiList.end();
                    it--;
                    MensekiList.erase(it);
                }
            }
            MensekiList.push_back(Temp);
            vector<int>::iterator it = List.end();
            it--;
            List.erase(it);
        }
    }
    return TotalMenseki;
}

int main(void){
    string str;
    std::cin >> str;
    
    std::vector<TMenseki> MensekiList;
    cout << Calculation(str, MensekiList) << endl;
    
    cout << MensekiList.size();
    for(int i = 0; i < MensekiList.size(); i++){
        cout << " " << MensekiList[i].Menseki;
    }
    cout << endl;
}

Measured memory_bytes: 1336
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = [input().split() for _ in range(M)]
price = []
price.append(int(min(a)) +int(min(b)))
for i in range(M):
    x = a[int(m[i][0])-1] + b[int(m[i][1])-1] - int(m[i][2])
    price.append(x)
print(min(price))

Measured memory_bytes: 50220
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N,M,C,l;
	vector<int> B;
	cin >> N;
	cin >> M;
	cin >> C;

	for (int i = 0; i< M;i++){
		cin >> l;
		B.pb(l);
	}

	
	int ans = 0;
	for (int i = 0; i< N;i++){
		int tmp = 0;
		for(int j = 0;j < M;j++){
			cin >> l;
			tmp += l*B[j];
		}
		tmp += C;
		if (tmp > 0){
			ans += 1;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int mp[11][11];
    int s[230][230];
    for(int i=0;i<10;i++) for(int j=0;j<10;j++) cin>>mp[i][j];
    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                mp[i][j]=min(mp[i][j],mp[i][k]+mp[k][j]);            
            }
        }
    }
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>s[i][j];
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j]!=1&&s[i][j]!=-1){
                int v=s[i][j];
                ans+=mp[v][1];
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros

int main()
{
    ll N,K;
    cin >> N >> K;

    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    
    for (int i = K, l=0; i < N;i++,l++){
        if(A[i] > A[l]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 4852
def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]

N = getInt()
A = getIntList()
B = getIntList()
sum = 0
sum += min(A[0],B[0])
f = min(A[1],B[0]-min(A[0],B[0]))
sum += f
for i in range(N-1):
    sum += min(A[i+1]-f,B[i+1])
    f = min(A[i+2],B[i+1]-min(A[i+1]-f,B[i+1]))
    sum += f
print(sum)

Measured memory_bytes: 18624
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
namespace bst = boost;

int main() {
  int H,W,A, B;

  cin >> H>>W>>A >> B;
  
  vector<vector<char>> r(H);
  
  for (auto& i : r)
    i.resize(W, '0');
  
  int hn = 0, wn = 0;
  
  if (A > W - A || B > H - B){
    cout<<"No"<<endl;
    return 0;
  }
  REP(i, H){
    wn=0;
  REP(i, A) {
    r[hn][wn++] = '1';
  }
    hn++;
  }
  hn=0;
  REP(i, B){
    REP(j,W){
      r[i][j]= (r[i][j] == '1' ? '0' : '1');
  }
  }

  for (auto& i : r){
  for (auto&j : i)
  cout << j;
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer cur = nil->next;
  while(1) {
  	if ( cur == nil ) return nil;
  	if ( cur->key == key ) return cur;
  	cur = cur->next;
  }
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  t->next->prev = t->prev;
  t->prev->next = t->next;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
  NodePointer t = listSearch(key);
  if ( t == nil ) return;
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /* 

   your code 


  */
  x->next = nil->next;
  x->prev = nil;
  x->next->prev = x;
  nil->next = x;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}

Measured memory_bytes: 31788
#include<stdio.h>
//#include<stdlib.h>

#define INF (1<<30)

int A[500000];
int count = 0;
int R[500000],L[500000];

//void merge(int A[],int left,int mid,int right);
//void mergeSort(int A[],int left,int right);
//  int *L,*R;

void merge(int A[],int left,int mid,int right){

  int n1,n2;
  int i,j,k;


  n1 = mid - left;
  n2 = right - mid;
  
  
  for(i = 0 ; i < n1 ; i++) 
    L[i] = A[left + i]; 
  for(i = 0 ; i < n2 ; i++)
    R[i] = A[mid + i];

  L[n1] = INF;
  R[n2] = INF;

  i = 0;
  j = 0;

  for (k = left ; k < right ; k++){
    count++;
    //printf("came123\n");
    if(L[i] < R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
  //  free(L);
  //free(R);

}


void mergeSort(int A[],int left,int right){
  int mid;
  //int i=0;

  if( left+1 < right){
    //fprintf(stderr,"error :%d\n",i);
    //i++;
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    //printf("came1\n");
    mergeSort(A,mid,right);
    //printf("came2\n");
    merge(A,left,mid,right);
    //printf("came3\n");
  }

}



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

  //  L = malloc(sizeof(int) * length);
  //  R = malloc(sizeof(int) * length);

  mergeSort(A,0,length);
  for(i = 0 ; i < length-1; i++)
    printf("%d ",A[i]);
  printf("%d\n%d\n",A[i],count);

  return 0;
}

Measured memory_bytes: 5484
#include<bits/stdc++.h>
using namespace std;
#define pi pair<int,int>
#define pii pair<pi,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define lli long long int
#define f(i,a,b) for (lli i = a; i <= b; i++)
#define fr(i,a,b) for (lli i = a; i >= b; i--)
#define sl(x)	scanf("%lld",&x)
#define pl(x)	printf("%lld",x)
#define ss(s)	scanf("%s",s)
#define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve()
{
	lli n;
	cin >> n;
	string s;
	unordered_map<string, lli> m;
	while (n--)
	{
		cin >> s;
		m[s]++;
	}
	printf("AC x "), pl(m["AC"]), printf("\n");
	printf("WA x "), pl(m["WA"]), printf("\n");
	printf("TLE x "), pl(m["TLE"]), printf("\n");
	printf("RE x "), pl(m["RE"]), printf("\n");
	m.clear();
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	IOS;
	// lli t;
	// cin >> t;
	// while (t--)
	solve();
	return 0;
}





Measured memory_bytes: 3752
#include<cstdio>
#include<vector>
struct Edge{
    int u,v;
    int c;
    Edge(int u,int v,int c):u(u),v(v),c(c){}
};
std::vector<Edge>g[105];
int bit[30];
int power[30];

int bitFactor(int u){
    int size = -1;
    while(u){
        bit[++size] = u%2;
        u /= 2;
    }
    power[0] = 1;
    for(int i = 1; i <= 23; i++) power[i] = power[i-1]*2;
    return size;
}

int main(){
    int u;
    scanf("%d",&u);
    u--;
    if(u==1){
        printf("%d %d\n",2,2);
        printf("%d %d %d\n",1,2,1);
        printf("%d %d %d\n",1,2,0);
    }
    else{
        int k = bitFactor(u);
        int n = k+1, m = 0;
        for(int i = 1; i <= n-1; i++){
            g[i].push_back(Edge(i,i+1,0));
            g[i].push_back(Edge(i,i+1,power[n-1-i]));
            m += 2;
        }
        //printf("m = %d\n",m);
        for(int i = k-1; i >= 0; i--){
            if(bit[i]==1){
                //printf("i = %d\n",i);
                int cost = 0;
                for(int j = k; j > i; j--) cost += bit[j]*power[j];
                g[1].push_back(Edge(1,n-i,cost));
                m++;
            }
        }
        g[1].push_back(Edge(1,n,u));
        m++;
        printf("%d %d\n",n,m);
        for(int i = 1; i <= n-1; i++){
            //printf("i = %d\n",i);
            for(int j = 0;j < (int)g[i].size(); j++){
                printf("%d %d %d\n",g[i][j].u,g[i][j].v,g[i][j].c);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int nums[3];
    rep(i,3) cin>>nums[i];
    sort(nums,nums+3);
    
    bool f=true;
    if(nums[0]!=5||nums[1]!=5||nums[2]!=7) f=false;
    
    cout1((f?"YES":"NO"))
}

Measured memory_bytes: 256
// reverse を毎回やると計算量があふれるから
// reverse回数記録しておき、あとから実行する
// までは自分でかけたがそれでも TLE
//
// deque を使えばいいらしい

#include <bits/stdc++.h>
#include <deque>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<ll> A;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // Globalなvectorのリサイズ
  //A.resize(N);
  deque<char> deq;
  string s;
  ll q;
  cin >> s;
  cin >> q;
  rep(i, s.size()) deq.push_back(s[i]);
  bool rflag = false;
  ll cnt = 0;
  rep(i, q) {
    int t;
    cin >> t;
    if (t == 2) {
      int f;
      char c;
      cin >> f >> c;
      if (f == 1) {
        if (rflag) deq.push_back(c);
        else deq.push_front(c);
      } else {
        if (rflag) deq.push_front(c);
        else deq.push_back(c);
      }
    }else {
      //reverse(s.begin(), s.end());
      cnt++;
      rflag = (cnt % 2 == 1);
    }
  }
  if (rflag) reverse(s.begin(), s.end());
  if (rflag) {
    while(!deq.empty()) {
      char h = deq.back();
      printf("%c", h);
      deq.pop_back();
    }
  } else {
    while(!deq.empty()) {
      char h = deq.front();
      printf("%c", h);
      deq.pop_front();
    }
  }
  return 0;
}


Measured memory_bytes: 976
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int r, d, x;
	cin >> r >> d >> x;
	for(int i=0; i<10; i++){
		x=r*x-d;
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import re
s = input()
f = s[:2]
l = s[2:]
year_flg = 0
month_flg = 0
if re.match('^(0\d|1(0|1|2))$', l):
    if int(l) != 0:
        year_flg = 1
if re.match('^(0\d|1(0|1|2))$', f):
    if int(f) != 0:
        month_flg = 1
if year_flg == 1:
    if month_flg == 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif month_flg == 1:
    print('MMYY')
else:
    print('NA')

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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 998244353LL;

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

int main() {
  ll N,S;
  cin>>N>>S;
  vector<ll> v(N);
  rep(i,N) cin>>v[i];
  ll ans = 0;
  vector<ll> dp(3005,0);
  dp[0]++;
  dp[v[0]]++;
  ans += dp[S];
  rep(i,N-1){
    dp[0]=(dp[0]+1)%mod;
    for(int j = 3004; j >= 0; j--){
      if(j-v[i+1]>=0) dp[j] = (dp[j]+dp[j-v[i+1]])%mod;
    }
    ans = (ans + dp[S])%mod;
  }
  cout<<ans<<endl;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> c(n);
    int cnum = 0;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        cnum = max(cnum, c[i]);
        c[i]--;
    }

    vector<ll> dp(n + 1, 0);
    vector<int> nxt(n, n);
    vector<int> col(cnum, n);

    for (int i = n - 1; i >= 0; i--) {
        nxt[i] = col[c[i]];
        col[c[i]] = i;
    }

    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        (dp[i + 1] += dp[i]) %= MOD;
        if (nxt[i] != n && i + 1 != nxt[i]) (dp[nxt[i]] += dp[i]) %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

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

int main() {
	int n;
	int *pT1, *pT2;

	cin >> n;

	pT1 = new int[n];
	pT2 = new int[n];

	for (int i = 0; i < n; i++) {
		cin >> pT1[i];
	}

	for (int j = 0; j < n; j++) {
		pT2[pT1[j] - 1] = j + 1;
	}

	for (int k = 0; k < n; k++) {
		cout << pT2[k] << ' ';
	}

	cout << "\n";

	delete[] pT1, pT2;

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  set<int> a;
  rep(i,n) {
    int m;
    cin >> m;
    if(a.count(m)) a.erase(m);
    else a.insert(m);
  }

  cout << a.size() << endl;
}


Measured memory_bytes: 4864
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;

namespace hello_world
{class Program
	{
		static void Main(string[] args)
		{

			int k = int.Parse(Console.ReadLine());
			string[] input = Console.ReadLine().Split(" ");
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			bool div = false;
			for(int i=a;i<=b; i++)
			{
				if (i % k == 0)
				{
					div = true;
					break;
				}
			}if (div == true)
				Console.WriteLine("OK");
			else
				Console.WriteLine("NG");

		
				
	
			
			
		}

		
	}

}


Measured memory_bytes: 27540
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{   
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    rep(i,n){
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main(){
    int X, N;
    cin >> X >> N;
    if (N==0)
    {
        cout << X << endl;
        return 0;
    }
    
    vector<int>P(N,0);
    int min_ans,max_ans,tmp; //Xより小さい範囲と大きい範囲別々で調べる
    bool check = true;
    
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
    }
    int dis1= inf; //小さい方
    int dis2 = inf; //大きい方
    for (int i = -N-5; i < X; i++)
    {
            for (int j = 0; j < N; j++)
            {   
                if (i == P[j])  check = !check;  
            }
            if (check)
            {
                tmp = X - i;
                if (tmp <= dis1)
                {
                    dis1 = tmp;
                    min_ans = i;
                }
            }
            check = true;
    }
    for (int i = X; i < X+N; i++)
    {
            for (int j = 0; j < N; j++)
            {
                if (i == P[j]) check = !check;   
            }
            
            if (check)
            {
                tmp = i - X;
                // cout << i << tmp << endl;
                if (tmp <= dis2)
                {
                    dis2 = tmp;
                    max_ans = i;
                }
            }
            check = true;
    }

    int ans;
    if (dis1 <= dis2)
    {
        cout << min_ans << endl;
    }
    else{
        cout << max_ans << endl;
    }

        // cout << min_ans << endl;
        // cout << max_ans << endl;
}

Measured memory_bytes: 3580
#include <cstdio>
using namespace std;

int main()
{
  int size;
  scanf("%d", &size);

  int heap[size + 1];
  for (int i = 1; i <= size; i++)
    scanf("%d", &heap[i]);

  for (int i = 1; i <= size; i++)
  {
    int parentKey = i / 2;
    int leftKey = i * 2;
    int rightKey = i * 2 + 1;
    printf("node %d: key = %d, ", i, heap[i]);
    if (1 <= parentKey && parentKey <= size)
      printf("parent key = %d, ", heap[parentKey]);
    if (1 <= leftKey && leftKey <= size)
      printf("left key = %d, ", heap[leftKey]);
    if (1 <= rightKey && rightKey <= size)
      printf("right key = %d, ", heap[rightKey]);
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 2704
#include <stdio.h>
int N;
char c;
int main()
{
	if(scanf("%d", &N) == 1);
	int flag = 0;
	for (int i = 0; i < N; i++)
	{
		if(scanf("%c", &c) ==1);
		if (c == 'Y') flag = 1;
	}
	if (flag==1) puts("Four\n");
	else puts("Three\n");
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var cost = map[int]int{
	1: 2,
	2: 5,
	3: 5,
	4: 4,
	5: 5,
	6: 6,
	7: 3,
	8: 7,
	9: 6,
}

func main() {
	n, m := readInt(), readInt()

	matchNums := make([]matchNum, m)
	for i := range matchNums {
		a := readInt()
		matchNums[i] = matchNum{a, cost[a]}
	}

	dp := make([]int, n+1)
	for i := range dp {
		dp[i] = -1
	}
	dp[0] = 0

	for i := 0; i < n+1; i++ {
		for _, x := range matchNums {
			if x.cost+i > n {
				continue
			}
			if dp[i+x.cost] < dp[i]+1 {
			}
			dp[i+x.cost] = max(dp[i+x.cost], dp[i]+1)
		}
	}

	sort.Sort(sortArray(matchNums))
	sort.Sort(sort.Reverse(sortArray(matchNums)))

	ans := ""
	j := n
	for i := dp[n]; i > 0; i-- {
		for _, x := range matchNums {
			if i == 1 && j-x.cost != 0 {
				continue
			}
			if j-x.cost >= 0 && dp[j-x.cost] == dp[j]-1 {
				ans += strconv.Itoa(x.num)
				j -= x.cost
				break
			}
		}
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type matchNum struct {
	num  int
	cost int
}

type sortArray []matchNum

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].num < s[j].num }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

int main()
{
	int n;
	cin >> n;
	vector<int> v( n );
	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	map<int, int> mp;
	map<int, int> mpe;
	map<int, int> mpo;
	for( int i = 0; i < n; i++ ) {
		mp[ v[i] ]++;
		if( i % 2 ) {
			mpo[ v[i] ]++;
		}
		else {
			mpe[ v[i] ]++;
		}
	}
	if( mp.size() == 1 ) {
		cout << n / 2 << endl;
		return 0;
	}
	int ema = 0;
	for( auto it = mpe.begin(); it != mpe.end(); it++ ) {
		if( it->second > ema ) ema = it->second;
	}
	vector<int> eval;
	for( auto it = mpe.begin(); it != mpe.end(); it++ ) {
		if( it->second == ema ) eval.push_back( it->first );
	}
	int oma = 0;
	for( auto it = mpo.begin(); it != mpo.end(); it++ ) {
		if( it->second > oma ) oma = it->second;
	}
	vector<int> oval;
	for( auto it = mpo.begin(); it != mpo.end(); it++ ) {
		if( it->second == oma ) oval.push_back( it->first );
	}
	if( eval.size() == 1 && oval.size() == 1 && eval[0] == oval[0] ) {
		int ema2 = 0;
		for( auto it = mpe.begin(); it != mpe.end(); it++ ) {
			if( it->first == eval[0] ) continue;
			if( it->second > ema2 ) ema2 = it->second;
		}
		int oma2 = 0;
		for( auto it = mpo.begin(); it != mpo.end(); it++ ) {
			if( it->first == oval[0] ) continue;
			if( it->second > oma2 ) oma2 = it->second;
		}
		if( ema - ema2 < oma - oma2 ) ema = ema2;
		else oma = oma2;
	}
	int nume = n / 2 - ema;
	int numo = n / 2 - oma;
	int ans = nume + numo;

	cout << ans << endl;
}


Measured memory_bytes: 13576
#include<iostream>
#include<sstream>
#include<iomanip>
#include<bitset>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a+b<10)ou(a+b);
  else ou("error");
}

Measured memory_bytes: 256
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
count = 0
for i in b:
  t = bisect.bisect_left(a,i)
  q = n-bisect.bisect_right(c,i)
  count += t*q
print(count)

Measured memory_bytes: 23156
import math
def main():
  a, b, h, m = map(int, input().split())
  rad = abs((h*60+m)*0.5 - m * 6)
  temp = abs(360-rad)
  if rad > temp:
    rad = temp
  # print(rad)
  rad = math.radians(rad)
  ans = math.sqrt((a ** 2) + (b ** 2) - 2 *a*b*math.cos(rad))
  print(ans)
  # print(a**2, b**2, 2 * a*b*math.cos(rad),rad,math.cos(rad),rad)

if __name__ == '__main__':
  main()


Measured memory_bytes: 9508