akhauriyash/Code-Regression huggingface dataset:
#ifdef _DEBUG
#include ".vscode/debug_print.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1050000000;
constexpr long long INF64 = 4000000000000000000;
constexpr int MOD7        = 1000000007;
constexpr int MOD53       = 998244353;
constexpr long double PI  = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void vprint() { std::cout << '\n'; }
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}

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

    int a, b;
    scan(a, b);
    for (size_t i = 0; i < 10000; i++) {
        int A = (ld)i * 0.08;
        int B = (ld)i * 0.1;
        if (A == a && B == b) {
            print(i);
            exit(0);
        }
    }
    print(-1);

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define mp make_pair
#define f first
//#define sex second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <set>
#include <ostream>
#include <queue>
#include <functional>
#include <sstream>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#pragma comment(linker, "/STACK:228228000")
const ll mod = 9982443530;

ll n;
ll res;

ll fu(ll a)
{
	ll ret = 0;
	while (a / 2 * 2 == a)
	{
		a /= 2;
		ret++;
	}
	return ret;
}

int main()
{
	/*

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

	cin >> n;
	forn(i, 0, n)
	{
		ll a;
		cin >> a;
		res += fu(a);
	}
	
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

string query(int x) {
  cout << x << endl;
  fflush(stdout);
  string res;
  cin >> res;
  if(res == "Vacant") {
    exit(0);
  }
  return res;
}
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N; cin >> N;
  int l = 0, r = N - 1;
  string x = query(l), y = query(r);
  for(int i = 0; i < 20; i ++) {
    int mid = (r + l) / 2;
    string z = query(mid);
    if(mid % 2 == 0 && x == z) {
      l = mid;
    }
    if(mid % 2 == 0 && y == z) {
      r = mid;
    }
    if(mid % 2 == 1 && x == z) {
      r = mid;
    }
    if(mid % 2 == 1 && y == z) {
      l = mid;
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

int main(){
	char s[10] = {};
	bool yymm = false, mmyy = false;
	int f = 0, e = 0;
	string a = "NA";

	rep(i, 4) cin >> s[i];

	f = (s[0] - '0') * 10 + (s[1] - '0');
	e = (s[2] - '0') * 10 + (s[3] - '0');

	if (0 < e && e < 13) yymm = true;
	if (0 < f && f < 13) mmyy = true;

	if (yymm) {
		if (mmyy) cout << "AMBIGUOUS" << endl;
		else cout << "YYMM" << endl;
	}
	else if (mmyy) cout << "MMYY" << endl;

	if (!yymm && !mmyy) cout << "NA" << endl;

	return 0;
}


Measured memory_bytes: 256
n,k=int(input()),0
for i in range(int((2*n)**0.5)+10):
    if i*(i-1)==2*n:
        k=i
if k==0:
    print('No')
else:
    print('Yes')
    print(k)
    c=1
    a=[[0]*k for _ in range(k)]
    for i in range(1,k):
        for j in range(1,i+1):
            a[i][j]=c
            c+=1
    ans=[[k-1]+[a[i][i] for i in range(1,k)]]
    for i in range(1,k):
        l=[k-1]
        h,w=i,1
        for j in range(1,k):
            l.append(a[h][w])
            h,w=(h,w+1) if j<i else (h+1,w)
        ans.append(l)
    for i in ans:
        print(*i)

Measured memory_bytes: 49116
import sys
input = sys.stdin.readline

l1=[]
l2=[]
for _ in range(5):
    m = int(input())
    if m % 10 == 0:
        l1.append(m)
    else:
        l2.append([m, int(str(m)[-1])])

l2 = sorted(l2, key=lambda x: x[1], reverse=True)
ans = sum(l1)
for i in range(len(l2)):
    if i+1 != len(l2):
        ans += l2[i][0]+10-l2[i][1]
    else:
        ans += l2[i][0]

print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC145D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] XY = Console.ReadLine().Split(' ');
            long X = long.Parse(XY[0]);
            long Y = long.Parse(XY[1]);
            long ans = 1;
            if (Y <= 2 * X && 2 * Y >= X)
            {
                if ((X + Y) % 3 == 0)
                {
                    long N = (X + Y) / 3;
                    long x = 0;
                    long y = 0;
                    for(long i = 0; i <= N; i++)
                    {
                        if ((2 * i + (N - i)) == X && (i + 2 * (N - i)) == Y)
                        {
                            x = i;
                            y = N - i;
                        }
                    }
                    //Console.WriteLine(x);
                    //Console.WriteLine(y);
                    if (x > y)
                    {
                        long temp = x;
                        x = y;
                        y = temp;
                    }
                    List<long> gyakugen = new List<long>();
                    long mod = 1000000007;
                    string smod = Convert.ToString(mod - 2, 2);
                    int l = smod.Length;
                    for (long i = 1; i <= x; i++)
                    {
                        long p = i;
                        long g = 1;
                        for(int j = l-1 ; j >= 0; j--)
                        {
                            if (smod[j].ToString() == "1")
                            {
                                g *= p;
                            }
                            p *= p;
                            p %= mod;
                            g %= mod;
                            //Console.WriteLine(p);
                        }
                        gyakugen.Add(g);
                    }
                    long m = x + y;
                    for(long i = m; i > m-x; i--)
                    {
                        ans *= i;
                        ans %= mod;
                    }
                    //Console.WriteLine(smod);
                    //Console.WriteLine(gyakugen[1]);
                    int L = gyakugen.Count;
                    for(int i = 0; i < L; i++)
                    {
                        ans *= gyakugen[i];
                        ans %= mod;
                    }
                    Console.WriteLine(ans);
                }
                else Console.WriteLine(0);
            }
            else Console.WriteLine(0);
        }
    }
}


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

int main() {
  int a,b; cin>>a>>b;
  if (a<=0 && b>=0) cout<<"Zero"<<endl;
  else if (a>0) cout << "Positive" << endl;
  else{
    int num =b-a+1;
    if (num%2==0) cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b;	ci(a>>b);
  co(a%b)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 100000000;
const int MAX_N = 100;
typedef pair<int , int> P;
typedef long long ll;
 
int main () {
  string s, t;
  cin >> s >> t;
  int len = s.length();
  int count = 0;
  for (int i = 0; i < len; ++i) {
    if (s[i] != t[i]) {
      ++count;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,x[100005],nx[20][100005],L,q,ls[100005],gs[100005];
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;++i) scanf("%d",x+i);
	scanf("%d%d",&L,&q);
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
	for(i=0;i<n;++i){
		int dis=0;
		for(j=20;j>=0;--j){
			if(i+dis+(1<<j)<n){
				if(x[i+dis+(1<<j)]<=x[i]+L){
					dis+=(1<<j);
				}
			}
		}
		nx[0][i]=i+dis;
	}
	for(i=1;i<20;++i){
		for(j=0;j<n;++j){
			nx[i][j]=nx[i-1][nx[i-1][j]];
		}
	}
	for(i=n-2;i>=0;--i){
		ls[i]=ls[nx[0][i]]+1;
	}
    while(q--){
		int a,b,R=0;
		scanf("%d%d",&a,&b);
		--a;--b;
		if(a>b) swap(a,b);
		if(b==n-1){
			printf("%d\n",ls[a]+gs[a]);
			continue;
		}
		for(i=19;i>=0;--i){
			if(nx[i][a]<=b){
				a=nx[i][a];
				R+=(1<<i);
			}
		}
		if(a<b) ++R;
		printf("%d\n",R);
	}
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,sum = 0;
cin >>N;
for (int i = 1; i < N; i++){
int j = 1,count = 0;
while(i *j < N){
count++;
j++;
}
sum += count;
}
cout << sum <<endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<bitset>
#include<bits/stdc++.h>

#define ll long long int
#define N 1000000
using namespace std;

main()
{
	ll n,m;
	cin>>n>>m;
	ll a[n];
	for(ll i=0;i<n;i++)
		cin>>a[i];
		sort(a,a+n);
		ll ans=0;
		for(ll i=0;i<m;i++)
			ans+=a[i];
			cout<<ans<<endl;	
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N, K; cin >> N >> K;
  map<int, int> u;
  rep(i, N) {
    int a; cin >> a;
    u[a]++;
  }
  map<int, vector<int>> m;
  for (auto e: u) {
    m[e.second].push_back(e.first);
  }
  int C = u.size();
  int ans = 0;
  for (auto e: m) {
    for (auto f: e.second) {
      if (C <= K) break;
      ans += e.first;
      C--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 11256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

i64 f(i64 N) {
    i64 ans = 0;

    rep(bit, 0, 58) {
        const i64 v = 1LL << bit;
        const i64 k = N / v;
        i64 cnt = v * (k / 2);
        if (k & 1) {
            cnt += N - v * k;
        }
        ans += v * (cnt & 1);
    }

    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int_fast64_t, A, B);
    dump(f(A));
    dump(f(B + 1));
    print(f(A) ^ f(B + 1));

    return 0;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 3; i <= n; i++)
            if (check(i)) Console.Write(" {0}",i);
        Console.WriteLine();
    }
    public static bool check (int n)
    {
        if (n % 3 == 0) return true;
        var s = n.ToString();
        return s.Length - s.Replace("3", "").Length > 0;
    }
}


Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mod=1e9+7;
const int N=2e5+100;
ll a[N];
int f[5];
bool cmp(int x,int y)
{
    return abs(x)<abs(y);
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    memset(f,0,sizeof f);
    for(int i=1;i<=n;i++) {
        cin>>a[i];
        if(a[i]>=0) f[1]++;
        else f[2]++;
    }
    int l=1,r=n;
    ll ans=1;
     if(!f[1]&&m%2==1){
        sort(a+1,a+1+n,cmp);
        for(int i=1;i<=m;i++){
            ans=a[i]*ans%mod;
        }
    }
    else {
        sort(a+1,a+1+n,greater<int>());
    while(m>0){
        if(m%2) ans=ans*a[l]%mod,l++,m--;
        else if(m>=2){
           if(a[l]*a[l+1]>=a[r]*a[r-1]){
              ans=ans*a[l]%mod*a[l+1]%mod;
              l+=2;
              m-=2;
           }
           else{
            ans=ans*a[r-1]%mod*a[r]%mod;
            r-=2;
            m-=2;
           }
        }
    }
    }
    cout<<(ans%mod+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 5128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cerr << #s << " = " << s << '\n'
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define ff first
#define ss second
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

char s[15], t[15];

int main() {
  scanf("%s %s", s, t);
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    if (s[i] != t[i]) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)




using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll Nmax=1e9;
const ll INF=1e9;

// B貪欲法で決定する．
int main(){
  int d;
  cin>>d;
  vector<int> c(26);
  vector<vector<int>> s(d,vector<int>(26));
  vector<int> last(26);
  vector<int>c_inv(26); // iを選んだ際の1日での下がり幅

  ll c_tot=0;
  rep(i,26){
    cin>> c[i];
    c_tot+=c[i];
    last[i]=-1;
  }
  rep(i,26){
    c_inv[i]=c_tot-c[i];
  }

  rep(i,d){//i日目
    int maxs=-INF;
    int jm=0;

    rep(j,26){
      cin>>s[i][j];
      ll casej=s[i][j]-c_inv[j];

      if(casej>maxs){
        maxs=s[i][j]-c_inv[j];
        jm=j;
      }
    }
    cout<<jm+1<<endl;
  }











}


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

int main() {
  int N,A,B=0;
  cin >> N;
  
  
  for (int i = 0; i < N  ; i++) {
		
    int m,l;
    cin >> m >> l ;
    
    A = l-m +1;
    B = A + B ;
  }
    
    
    

  cout << B << endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2>> K;
    int ans = H2*60 + M2 - H1*60 - M1 -K;
    cout << max(0,ans) << endl;
    return 0;
}

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

using namespace std;

string A[55], B[55];

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i) {
		string str;
		cin >> str;
		A[i] = str;
	}
	for (int i = 0; i < m; ++i) {
		string str;
		cin >> str;
		B[i] = str;
	}
	for (int i = 0; i < n - m + 1; i ++) {
		for (int j = 0; j < n - m + 1; j++) {
			bool ok = true;
			for (int k = 0; k < m; k++) {
				for (int l = 0; l < m; ++l) {
					if (A[i + k][j + l] != B[k][l]) {
						ok = false;
						break;
					}
				}
				if (!ok) break;
			}
			if (ok) {
				printf("Yes");
				return 0;
			}
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;

int main() {
	fastIO;
#ifdef LOCAL
//	freopen("input.in", "rt", stdin);
#endif
	ll cur = 100;
	ll x, steps = 0;
	cin >> x;
	while(cur < x) {
		cur += cur / 100;
		steps++;
	}
	cout << steps;
	return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define print(x,y) (cout << (x) << (y))
#define inf INT_MAX
#define sz(x) (ll)x.size()
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair< int , pii> piii;
typedef pair<int,bool> pib;
typedef vector<pii> vii;
typedef vector<pib> vib;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<string,string> pss;
typedef vector<pss> vss;
const int MOD = 1e9 + 7; //998244353;

pii dirs[3] = {{-1, -1} , {-1 , 0} , {0,-1}};
int main() {
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    int dp[n + 1][m + 1];
    for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < m + 1; j++)dp[i][j] = inf;
    }
    int bt[n + 1][m + 1];
    for (int i = 0; i < n + 1; i++)dp[i][0] = i, bt[i][0] = 1;
    for (int i = 0; i < m + 1; i++)dp[0][i] = i, bt[0][i] = 2;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            int x = dp[i - 1][j] + 1;
            int y = dp[i][j - 1] + 1;
            int z = dp[i - 1][j - 1] + (s[i - 1] == t[j - 1] ? 0 : 2);
            if (x < y && x < z) {
                dp[i][j] = x;
                bt[i][j] = 1;
            } else if (y < z) {
                dp[i][j] = y;
                bt[i][j] = 2;
            } else {
                dp[i][j] = z;
                bt[i][j] = 0;
            }
        }
    }
    stack<char> res;
    for (int i = n, j = m; i > 0 || j > 0;) {
        if (s[i - 1] == t[j - 1])res.push(s[i - 1]);
        pii p = dirs[bt[i][j]];
        i += p.fi;
        j += p.se;
    }
    while (res.size()) {
        cout << res.top();
        res.pop();
    }
}




Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }


signed main()
{
    int H,W,N; cin>>H>>W>>N;
    int sy,sx; cin>>sy>>sx; sy--; sx--;
    string S,T; cin>>S>>T;

    int curx=sx;
    for(int i=0;i<N;i++){
	if(S[i]=='R') curx++;
	if(curx>=W){
	    cout<<"NO"<<endl;
	    return 0;
	}
	if(T[i]=='L'){
	    if(curx-1>=0) curx--;
	}
    }

    curx=sx;
    for(int i=0;i<N;i++){
	if(S[i]=='L') curx--;
	if(curx<0){
	    cout<<"NO"<<endl;
	    return 0;
	}
	if(T[i]=='R'){
	    if(curx+1<W) curx++;
	}
    }

    int cury=sy;
    for(int i=0;i<N;i++){
	if(S[i]=='D') cury++;
	if(cury>=H){
	    cout<<"NO"<<endl;
	    return 0;
	}
	if(T[i]=='U'){
	    if(cury-1>=0) cury--;
	}
    }

    cury=sy;
    for(int i=0;i<N;i++){
	if(S[i]=='U') cury--;
	if(cury<0){
	    cout<<"NO"<<endl;
	    return 0;
	}
	if(T[i]=='D'){
	    if(cury+1<H) cury++;
	}
    }
    cout<<"YES"<<endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
 
#define pi 3.1415926535

int main()
{
  int n, x, t;
  cin >> n >> x >> t;

  int ans = (n + (x - 1)) / x ;

  cout << t * ans;

  return 0; 
}

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

int partition(vector<int> &A,int p,int r){
    int x=A[r];
    int i=p-1;
    for(int j=p;j<r;j++){
        if(A[j]<=x){
            i=i+1;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

int main(){
    int n;
    cin>>n;
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int t=partition(A,0,n-1);
    for(int i=0;i<n;i++){
        if(i) cout<<' ';
        if(i==t) cout<<'[';
        cout<<A[i];
        if(i==t) cout<<']';
    }
    cout<<endl;
}


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

int main(){
    ll n,s;
    cin >> n;
    s = n%11;
    if(s == 0) cout << 2*(n/11) << endl;
    else if(s < 7) cout << 2*(n/11)+1 << endl;
    else cout << 2*(n/11)+2 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する

int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << max(A*B,C*D) << endl;


    return 0;
}


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

int main(){
  map<int, string> mp;
  for(int i = 0; i < 26; i++){
    mp[i] = i + 65;
  }
  int h, w;
  cin >> h;
  cin >> w;
  string m[h][w];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> m[i][j];
    }
  }

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(m[i][j] == "snuke"){
	h = i + 1;
	w = j;
	break;
      }
    }
  }

  cout << mp[w] << h << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))

L = sorted(L)

ans = 0

if N < 3:
   print(ans)
   exit()

for i in range(N-2):
   for j in range(i+1, N -1):
      for k in range(j + 1, N):
         if L[i] + L[j] > L[k] and L[i] != L[j] and L[j] != L[k]:
            ans += 1

print(ans)

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

void dfs(vector<vector<int>> &T, vector<int> &counter, int v, int parent) {
    for (int next_v : T[v]) {
        if (next_v == parent) continue;
        counter[next_v] += counter[v];
        dfs(T, counter, next_v, v);
    }
}

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> T(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        T[a].push_back(b);
        T[b].push_back(a);
    }
    vector<int> counter(N);
    for (int i = 0; i < Q; i++) {
        int p, x;
        cin >> p >> x;
        p--;
        counter[p] += x;
    }

    dfs(T, counter, 0, -1);

    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << counter[i];
    }
    cout << endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep (i, n) {
    cin >> a[i];
  }
  vi win(k + 1);
  win[0] = 1;
  rep1 (i, k) {
    bool flag = false;
    rep (j, n) {
      if (i - a[j] < 0) continue;
      flag |= win[i - a[j]];
    }
    win[i] = !flag;
  }
  if (!win[k]) {
    cout << "First" << endl;
  }
  else {
    cout << "Second" << endl;
  }
}
  


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

//50 
typedef long long ll;

vector<vector<int>> pre;
void rec(vector<int> &v, int l, int r) {
	if (l == r) {
		pre.push_back(v);
	}else {
		for (int i = l; i <= r; ++i) {
			swap(v[l],v[i]);
			rec(v,l + 1, r);
			swap(v[l],v[i]);
		}
	}
}

int main() {
	int n;
	cin >> n;
	int val[n][2];
	vector<int> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> val[i][0] >> val[i][1];
		v[i] = i;
	}
	rec(v,0, n - 1);
	int p = (int)pre.size();
	double ans = 0;
	//for (int i = 0; i < p; ++i) {
		//for (int j = 0; j < n; ++j) {
			//cout << pre[i][j];
		//}
		//cout << endl;
	//}
	for (int i = 0; i < p; ++i) {
		for (int j = 1; j < n; ++j) {
			double x = val[pre[i][j]][0] - val[pre[i][j - 1]][0];
			double y = val[pre[i][j]][1] - val[pre[i][j - 1]][1];
			ans += sqrt(x * x + y * y);
		}
	}
	cout << fixed << setprecision(12) << ans / p;
}


Measured memory_bytes: 6324
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}
template <class Con>
string concat(const Con &c, const string &spr){
	stringstream ss;
	typename Con::const_iterator it = c.begin(), en = c.end();
	bool fst = true;
	for(; it != en; ++it){
		if(!fst){ ss << spr; }
		fst = false;
		ss << *it;
	}
	return ss.str();
}

template <class Con, class Fun>
vector<typename Con::value_type> cfilter(const Con &c, Fun f) {
	vector<typename Con::value_type> ret;
	typename Con::const_iterator it = c.begin(), en = c.end();
	for(; it != en; ++it){
		if(f(*it)){
			ret.emplace_back(*it);
		}
	}
	return ret;
}
#if __cplusplus >= 201103L
template <class Con, class Fun>
auto cmap(const Con &c, Fun f) -> vector<decltype(f(*c.begin()))> {
	vector<decltype(f(*c.begin()))> ret;
	ret.reserve(c.size());
	for(const auto &x: c){
		ret.emplace_back(f(x));
	}
	return ret;
}
#endif


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()
#define tget(t,i) get<i>(t)

#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	cin >> n;
	vector<int> ans(n + 1);
	for(int x = 1; x * x <= n; ++x)
	for(int y = 1; y * y <= n; ++y)
	for(int z = 1; z * z <= n; ++z){
		int a = x * x + y * y + z * z + x * y + y * z + z * x;
		if(a <= n){ ++ans[a]; }
	}
	for(int i = 1; i <= n; ++i){
		cout << ans[i] << '\n';
	}
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(const exception &e){
	cerr << "exception: " << e.what() << endl;
	abort();
}
catch(...){
	cerr << "exception" << endl;
	abort();
}


Measured memory_bytes: 3612
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
using P = pair<int, int>;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};
int d[51][51];

char s[51][51];
int main(){
    int H, W;
    cin >> H >> W;

    int white = 0;
    for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j){
        cin >> s[i][j];
        if(s[i][j] == '.') ++white;
    }

    queue<P> que;
    que.push(P(0, 0));
    d[0][0] = 1;
    int ans = 0;
    while(!que.empty()){
        P q = que.front();
        que.pop();

        for(int i = 0; i < 4; ++i){
            int nx = q.first + dx[i];
            int ny = q.second + dy[i];
            if(nx == W-1 && ny == H-1){
                ans = d[q.second][q.first] + 1;
                break;
            }
            if(0 <= nx && nx < W && 0 <= ny && ny < H && s[ny][nx] == '.' && d[ny][nx] == 0){
                d[ny][nx] = d[q.second][q.first] + 1;
                que.push(P(nx, ny));
            }
        }
        if(ans != 0) break;
    }
    if(ans == 0) cout << -1 << endl;
    else cout << white - ans << endl;
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        a: usize,
        p: usize,
    }
    let ans = (3 * a + p) / 2;
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int a,b;
    cin >> a >> b;
    if( a == 1 && b == 1 ){
        cout << "Draw" << endl;
        return 0;
    }else if( b == 1 ){
        cout << "Bob" << endl;
        return 0;
    }else if( a == 1 ){
        cout << "Alice" << endl;
        return 0;
    }
    cout << ( a == b ? "Draw" : a > b ? "Alice" : "Bob" ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  bool found = false;
  for (char i = 'a'; i <= 'z'; ++i) {
    found = false;
    for (int j = 0; j < S.length(); ++j) {
      if (i == S[j]) {
        found = true;
        break;
      }
    }
    if (!found) {
      cout << i << endl;
      break;
    }
  }
  if (found) cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
//        int nLen = String.valueOf(n).length();


        int[][] cnt = new int[9][9];

        int ans = 0;


        for (int i=1; i<=n; i++){
            int nLen = String.valueOf(i).length();

            if (String.valueOf(i).length()==1) {
                cnt[i-1][i-1]++;
                continue;
            }
            int top = i/(int)Math.pow(10, nLen-1);
            int bottom = i%10;
            if (top==0 || top==10 || bottom==0 || bottom==10) continue;
            cnt[top-1][bottom-1]++;
        }

        for (int i=0; i<9; i++){
            for (int j=0; j<9; j++){
                ans += cnt[i][j]*cnt[j][i];
            }
        }
        System.out.println(ans);

    }
}


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

int main() {
  string s;
  cin >>s;
  int cnt_a=0;
  int cnt_b=0;
  int cnt_c=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='a')cnt_a++;
    else if(s[i]=='b')cnt_b++;
    else cnt_c++;
  }
  if(abs(cnt_a-cnt_b)<=1&&abs(cnt_a-cnt_c)<=1&&abs(cnt_b-cnt_c)<=1){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

    

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define N 2000005
using namespace std;
typedef long long ll;
const int Mod = 1e9 + 7;

long long f[N], g[N];
char s[N];

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    int n;
    scanf("%s", s + 1);
    n = strlen(s + 1);
    if (s[1] == '0') f[1] = 1, g[1] = 0;
    else f[1] = 2, g[1] = 1;
    for (int i = 2; i <= n; ++i) {
        if (s[i] == '0') {
            f[i] = f[i - 1] % Mod,
            g[i] = g[i - 1] * 3 % Mod;
        } else {
            f[i] = f[i - 1] * 2 % Mod;
            g[i] = (f[i - 1] + g[i - 1] * 3 % Mod) % Mod;
        }
    }
    cout << (f[n] + g[n]) % Mod << endl; 
    return 0;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for(int i = 0; i < M; ++i){
    cin >> A[i];
    N -= A[i];
  }
  if(N < 0) cout << -1 << endl;
  else cout << N << endl;
}


Measured memory_bytes: 3636
while True:
    try:
        lst = list(map(int, input().split(',')))
        v2 = lst.pop()
        v1 = lst.pop()
        kp = sum(lst)*v1/(v1+v2)
        l = 0
        for num, i in enumerate(lst):
            l = l + i
            if l >= kp:
                print(num + 1)
                break

    except EOFError:
        break


Measured memory_bytes: 5604
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(((a + b) % 2) != 0) {
			System.out.println("IMPOSSIBLE");
		}else {
			System.out.println((a + b) / 2);
		}
	}
}


Measured memory_bytes: 21844
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c;
    int k;
    cin>>a>>b>>c;
    cin>>k;
    if(a<b) swap(a,b);
    if(a<c) swap(a,c);
    for(int i=1;i<=k;i++)
        a=a*2;
    cout<<a+b+c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26

const int N = 1e5 + 5;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    

    int x;
    cin >> x;
    vector<pair<int, int> > v;
    v.push_back({0, 0});
    for (int i = 1; i * i * i * i <= 1e18 / i; i++){
      v.push_back({pow(i, 5), i});
      v.push_back({pow(-i, 5), -i});
    }
    sort(v.begin(), v.end());
    for (int i = 1; i < v.size(); i++){
      for (int j = 0; j < i; j++){
        if (v[i].first - v[j].first == x){
          cout << v[i].second << " " << v[j].second << endl;
          return 0;
        }
      }
    }   
}

Measured memory_bytes: 4280
#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0; i <(n); i++)

int compint(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

int main(){
  int a,b,x;
  scanf("%d%d%d",&x,&a,&b);
  if(a>=b){
    printf("delicious\n");
    return 0;
  }else if(x+a>=b){
    printf("safe\n");
    return 0;
  }else{
    printf("dangerous\n");
    return 0;
  }
  return 0;
}


Measured memory_bytes: 1612
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] num = new int[100001];
		for(int i = 0;i < n;i++){
			int a = saori.saori_hayami();
			if(a != 0)num[a-1]++;
			num[a]++;
			num[a+1]++;
		}
		int ans = 0;
		for(int i = 0;i < num.length;i++){
			ans = Math.max(ans, num[i]);
		}
		System.out.println(ans);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21776
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//幅優先探索のテンプレ.デフォルトではstartからの距離を返す.
//graphは隣接リスト.startは探索開始地点
vector<int> bfs(vector<vector<int>> &graph, int start){
	queue<int> todo;
	vector<int> dist(graph.size(),-1);
	dist[start] = 0;
	todo.push(start);
	while(!todo.empty()){
		int now = todo.front();
		todo.pop();
		for (int i=0;i<graph[now].size();i++){
			int nxt = graph[now][i];
			if (dist[nxt] != -1) continue;
			dist[nxt] = dist[now] + 1;
			todo.push(nxt);
		}
	}
	return dist;
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b+c <= 21)
		cout << "win" << endl;
	else {
		cout << "bust" << endl;
	}
	return 0;
}

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

int main(void) {
  
  int input = 0;
  scanf("%d", &input);
  int change = input % 1000; 
  if (change > 0) {
    change = 1000 - change; 
    printf("%d\n", change);
  } else {
      printf("%d\n", change);
  }
  
  
  return 0; 
}

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

using namespace std;
int main() {
  string s;
  int n;
  cin >> n;
  cin >> s;
  char abc[26];
  for(int i = 0; i < 26; i++) {
    abc[i] = 'A' + i;
  }
  for(int i = 0; i < (int)s.length(); i++) {
    s[i] -= 'A';
    cout << abc[((int)s[i] + n) % 26];
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256