akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
	string s; cin >> s;
	bool ok = true;
	rep(i, A - 1, D - 1) {
		if (s[i] == '#' && s[i + 1] == '#')ok = false;
	}
	if (ok&&C > D) {
		ok = false;
		rep(i, B - 2, D - 1) {
			if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.')ok = true;
		}
	}
	cout << (ok ? "Yes" : "No") << "\n";

	

	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
main(){
  string S;cin>>S;
  int n=S.size();
  if(n==2){
    if(S[0]==S[1])cout<<"1 2"<<endl;
    else cout<<"-1 -1"<<endl;
    return 0;
  }
  for(int i=0;i<n-2;i++){
    if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+1]==S[i+2]){
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }
  cout<<"-1 -1"<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition) cout << "Yes" << '\n'; else{ cout << "No" << '\n'; }
#define YES(condition) if(condition) cout << "YES" << '\n'; else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition) cout << "yes" << '\n'; else{ cout << "no" << '\n'; }




int main() {
    ll n;
    cin >> n;
    vector<ll> wheson(100005);
    REP(i, n){
        ll a;
        cin >> a;
        REP(j, 3){
            wheson[a + j]++;
        }
    }
    ll ans = -1;
    REP(i, 100005){
        ans = max(ans, wheson[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
N, T = map(int, raw_input().split())

min_c = 1001
for i in range(N):
    tmp_c, tmp_t = map(int, raw_input().split())
    if tmp_t <= T and tmp_c < min_c:
        min_c = tmp_c
if min_c == 1001:
    print 'TLE'
else:
    print min_c


Measured memory_bytes: 2568
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define INF 200000000

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

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

	double x1, x2, y1, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2;

	x3 = (x2 - x1) / sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
	y3 = (y2 - y1) / sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));

	int q;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		double px, py, px2, py2;
		cin >> px >> py;

		px2 = (px - x1);
		py2 = (py - y1);

		printf("%.10lf %.10lf\n", px + (x3*(px2*x3 + py2*y3) - px2) * 2, py + (y3*(px2*x3 + py2*y3) - py2) * 2);
	}

	return 0;
}


Measured memory_bytes: 3300
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    string s;
    cin >> s;

    int cand[2] = {0, 1};
    rep (i, 2)
    {
        rep (j, 2)
        {
            bool ok = true;
            vs32 ans(n);
            ans[0] = cand[i];
            ans[1] = cand[j];
            for (int k = 2; k < n; ++ k)
            {
                ans[k] = ans[k - 1] ^ ans[k - 2] ^ (s[k - 1] == 'x');
            }
            if ((ans[0] == ans[n - 1] ^ ans[n - 2] ^ (s[n - 1] == 'x')) && (ans[n - 1] == ans[0] ^ ans[1] ^ (s[0] == 'x')))
            {
                rep (k, n)
                {
                    cout << (ans[k] ? 'W' : 'S');
                }
                cout << "\n";
                return 0;
            }
        }
    }

    cout << "-1\n";
    return 0;
}



Measured memory_bytes: 924
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
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
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	l := scanInt()
	n, m := 0, 0
	u, v, w := []int{}, []int{}, []int{}
	b := 1
	for i := 19; i >= 0; i-- {
		if l>>uint(i)&1 == 1 {
			if n == 0 {
				n = i + 1
				m = i * 2
				for j := 1; j < n; j++ {
					u = append(u, j, j)
					v = append(v, j+1, j+1)
					w = append(w, 0, b)
					b *= 2
				}
			} else {
				m++
				u = append(u, i+1)
				v = append(v, n)
				w = append(w, b)
				b += 1 << uint(i)
			}
		}
	}

	fmt.Fprintln(wr, n, m)
	for i := 0; i < m; i++ {
		fmt.Fprintln(wr, u[i], v[i], w[i])
	}
}

func pow(a, n int) int {
	res := 1
	for n > 0 {
		if n&1 == 1 {
			res *= a
		}
		a *= a
		n >>= 1
	}
	return res
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef pair<string, int> P;
map<string, int> m;

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

	queue<P> q;
	q.push(P("01234567", 0));
	m["01234567"] = 0;
	while(!q.empty()) {
		P p = q.front();
		q.pop();
		if(m[p.first] != p.second) continue;
		string s = p.first;
		int d[] = { 1, -1, 4, -4 };
		for(int i = 0; i < 8; i++) {
			if(s[i] != '0') continue;
			for(int j = 0; j < 4; j++) {
				if(d[j] == 1 && (i == 3 || i == 7)) continue;
				if(d[j] == -1 && (i == 0 || i == 4)) continue;
				if(d[j] == 4 && 4 <= i) continue;
				if(d[j] == -4 && i <= 3) continue;
				swap(s[i], s[i + d[j]]);
				if(m.find(s) == m.end() || p.second + 1 < m[s]) {
					m[s] = p.second + 1;
					q.push(P(s, p.second + 1));
				}
				swap(s[i], s[i + d[j]]);
			}
		}
	}

	string s;
	while(getline(cin, s)) {
		string ss;
		for(int i = 0; i < 8; i++) {
			ss += s[2 * i];
		}
		cout << m[ss] << endl;
	}
}

Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(0)=='A' && s.at(1)=='A' && s.at(2)=='A'){
    cout<<"No"<<endl;
  }
  else if(s.at(0)=='B' && s.at(1)=='B' && s.at(2)=='B'){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int dp[50];

int fib(int n){
    if(n == 0 || n == 1) return dp[n] = 1;
    if(dp[n] != -1) return dp[n];
    return dp[n] = fib(n-1) + fib(n-2);
}

int main(){
    int n, i;
    for(i=0; i<50; i++) dp[i] = -1;

    scanf("%d", &n);
    printf("%d\n", fib(n));

    return 0;
}


Measured memory_bytes: 2696
#include<stdio.h>
int main(void){
   int a[100], b[100], i, n, l, h, B;
   while (scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF) {
      h = 0;
      B = 0;
      for ( i = 0; i < 4; i++ ) {
         if ( a[i] == b[i] ) {
            h++;
         }
      }
      for ( i = 0; i < 4; i++ ) {
         for ( l = 0; l < 4; l++ ) {
            if ( i == l ) {
            } else if ( a[i] == b[l] ) {
               B++;
            }
         }
      }
      printf("%d %d\n", h, B);
   }
   return 0;
}

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

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

  ll n,k,x,y;
  cin>>n>>k>>x>>y;
  ll ans = 0;
  ans = x * (min(n,k));
  n = max(0ll,n-k);
  ans += n * y;
  cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#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 x, t;
  cin >> x >> t;
  int s = x - t;
  if (s < 0) cout << 0 << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,K; cin>>N>>K;
  vector<char> S(K);
  rep(i,0,K) cin>>S[i];
  REP(i,N,MOD){
    string X=to_string(i);
    bool flag=1;
    rep(j,0,X.size()){
      rep(k,0,K){
        if(X[j]==S[k]){
          flag=0;
          goto XYZ;
        }
      }
    }
    XYZ:
    if(flag){
      cout<<i<<endl;
      break;
    }
  }
  }


Measured memory_bytes: 256
//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2016
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

vector<int> adj[MAXN];
int n, gru[MAXN];
ll val[MAXN];

void dfs(int u, int p) {
	
	for (int i=0; i<sz(adj[u]); i++) {
		int v = adj[u][i];
		if (v == p) continue;
		dfs(v, u);
	}
	
	gru[u] = 0;
	int tot = 0;
	for (int i=0; i<sz(adj[u]); i++) {
		int v = adj[u][i];
		if (v == p) continue;
		tot ^= (gru[v] + 1);
	}
	
	gru[u] = tot;
	
//	for (int i=0; i<(n+59)/60; i++) val[i] = 0;
//	
//	for (int i=0; i<sz(adj[u]); i++) {
//		int v = adj[u][i];
//		if (v == p) continue;
//		int now = tot ^ (gru[v] + 1);
//		val[now/60] |= (1ll << (now % 60));
//	}
//	
//	for (int i=0; i<(n+59)/60; i++) {
//		if (val[i] != (1ll << i) - 1) {
////			if (u == 3) cout << (val[i] & (1ll << 0)) << endl;
//			for (int j=0; j<60; j++) {
////				if (u == 3) cout << (val[i] & (1ll << j)) << endl;
//				if ((val[i] & (1ll << j)) == 0) {
//					gru[u] = i * 60 + j;
//					return;
//				}
//			}
//		}
//	}
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

	cin >> n;
	for (int i=0; i<n-1; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}

	dfs(0, -1);
	
//	if (sz(adj[0]) == 1) cout << "Alice";
//	else {
//		int ans = 0;
//		for (int i=0; i<sz(adj[0]); i++) {
//			ans ^= gru[adj[0][i]];
//		}
//		if (ans) cout << "Alice";
//		else cout <<"Bob";
//	}
//	cout << gru[2] << endl;
	if (gru[0]) cout << "Alice";
	else cout << "Bob";
}


Measured memory_bytes: 13952
// AOJ CGL_4_A Convex Hull
// 2018.5.3 bal4u

#include <stdio.h>
#include <stdlib.h>

typedef struct { int x, y; } PP;

PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
long long cross(PP a, PP b) { return (long long)a.x * b.y - (long long)a.y * b.x; }

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int cmp(PP *a, PP *b)
{
	if (a->y - b->y) return a->y - b->y;
	return a->x - b->x;
}

int convex_hull(int n, PP *ps, PP *po)
{
	int i, k, j = 0;

	qsort(ps, n, sizeof(PP), cmp);
	for (i = 0; i < n; i++) {
		while (j > 1 && cross(vsub(po[j-1], po[j-2]), vsub(ps[i], po[j-1])) < 0) j--;
		po[j++] = ps[i];
	}
	k = j;
	for (i = n - 2; i >= 0; i--) {
		while (j > k && cross(vsub(po[j-1], po[j-2]), vsub(ps[i], po[j-1])) < 0) j--;
		po[j++] = ps[i];
	}
	return j-1;
}

PP p[100005], poly[100005];

int main()
{
	int n, k, i;

	n = in();
	for (i = 0; i < n; i++) p[i].x = in(), p[i].y = in();
	k = convex_hull(n, p, poly);
	printf("%d\n", k);
	for (i = 0; i < k; i++) printf("%d %d\n", poly[i].x, poly[i].y);
	return 0;
}


Measured memory_bytes: 2992
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<limits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define vi  vector<int>
#define ll long long
#define pb push_back
#define ff first
#define ss second 
#define rep(n) for(int i=0; i<n ; i++)
#define input(n) for(int i=0; i<n ; i++){cin>>arr[i];}
#define output(n) for(int i=0; i<n ; i++){cout<<arr[i]<<" ";}
#define tc int t; cin>>t; while(t--)
using namespace std;
int32_t main()
{
	int n;
	cin>>n;
	
	int w;
	cin>>w;

	long long int weight[n];
	long long int value[n];

	rep(n)
	{
		cin>>weight[i];
		cin>>value[i];
	}

	long long int dp[n+1][w+1];

	memset(dp,0,sizeof(dp));


	for(int i=1; i<=n ; i++)
	{
		for(int j=1; j<=w ; j++)
		{
			if(j >= weight[i-1])
			{
				dp[i][j] = max(dp[i-1][j],dp[i-1][j - weight[i-1]]+value[i-1]);
			}
			else
				dp[i][j]= dp[i-1][j];

		}
	}

	

	cout<<dp[n][w]<<endl;




	

	return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include<cstring>
#include<list>
#include <stack>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include <string>
const int MAXN = 2000 * 100 + 6;
typedef long long LL;
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("E:\\input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
#endif
	int i, j;
	LL ans;
	char ins[20];
	int n,x;
	list<int>data;
	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		scanf("%s", ins);
		if(ins[0]=='i'){
			scanf("%d", &x);
			data.push_front(x);//insert
		}
		else if (ins[6] == 'F')data.pop_front();
		else if (ins[6] == 'L')data.pop_back();
		else if(ins[0]=='d'){
			scanf("%d", &x);
			for (auto it = data.begin(); it != data.end(); it++) {
				if (*it == x) {
					data.erase(it);
					break;
				}
			}
		}
	}
	i = 0;
	for (auto it : data) {
		if (i++)printf(" ");
		printf("%d",it);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 34440
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
    
        N,M=map(int,input().split())
        L=[0]*N
        for i in range(M):
            a,b=map(int,input().split())
            L[a-1]+=1
            L[b-1]+=1
        for i in range(N):
            if L[i]%2==1: return 'NO'
        return 'YES'
    print(main())
        


    
resolve()

Measured memory_bytes: 42476
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second > b.second; }

signed main() {
    string s;cin>>s;ll n=s.size();

    vl abc(26);
    rep(i,n)abc[s[i]-'a']++;

    ll ans=n*(n-1)/2; //n文字の組み合わせの総和から
    rep(i,26)ans -= abc[i] * (abc[i]-1) / 2; //同じ文字の組み合わせ総和を引く
    cout<<ans+1<<endl;
}

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

int main(){
    string s;
    cin >> s;
    vector<int> ans(26);
    for(int i = 0; i < (int)s.size(); i++)
    {
        int t = s[i]-'a';
        ans[t]++;
    }
    string p = "yes";
    for(int i = 0; i < 26; i++)
    {
        if(ans[i] > 1) p = "no";
    }
    cout << p << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int A,B,count=1;
    cin>>A>>B;
    if(B==1){
        cout<<0<<endl;
        return 0;
    }
    for(int i=1; ;i++){
        count+=A-1;
        if(count>=B){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int n;
    string value;
    cin >> n;
    rep(i, n){
        string arare;
        cin >> arare;
        if(arare == "Y"){
            value = "Four";
            break;
        }
        else value = "Three";
    }
    cout << value << endl;
}

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

mod = int(1e9+7)

dp = [0] * (N)
dp[0] = 1
# dp[i] : i番目までの通り数

Amax = max(A)
Aleft, Tright = -1, -1
Tmax = max(T)
for i in range(N):
  if Amax == A[i]:
    Aleft = i
    break
for i in range(N-1,-1,-1):
  if Tmax == T[i]:
    Tright = i
    break
if Aleft > Tright:
  print(0)
  exit(0)
if A[-1] != T[0]:
  print(0)
  exit(0)
  
for i in range(1,N-1):
  if A[i-1] < A[i] or T[i] > T[i+1]:
    dp[i] = dp[i-1]
  else:
    dp[i] = dp[i-1] * min(A[i], T[i]) % mod
  
print(dp[N-2])


Measured memory_bytes: 18924
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    string s;
    bool f=1;
    cin>>s;
    rep(i,n/2){
        if(s[i]!=s[i+n/2])f=0;
    }
    if(s.size()%2==1)f=0;
    cout<<(f?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;



 class Main{
     
    static long counts[][][];
    
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
         try{
             String line;
             while((line=br.readLine())!=null){if(line.isEmpty())break;
                 
                 String[] split = line.split(" ");
                 int n=Integer.parseInt(split[0]);int s=Integer.parseInt(split[1]);
                 if(n==0&&s==0)break;
                 counts=new long[n+1][102][s+1];
                 for(int i=0;i<n+1;i++)for(int j=0;j<102;j++)for(int k=0;k<s+1;k++)counts[i][j][k]=-1;
                func(n,-1,s);
                System.out.println(counts[n][0][s]);
             }
         }catch(Exception e){}
         
     }
     
     static long func(int n, int prev,int s){
         //System.out.println(n+" "+prev+" "+s+" aa");
         if(s>=0&&n>=0)
         if(counts[n][prev+1][s]!=-1){//System.out.println(counts[n][prev+1][s]);
         return counts[n][prev+1][s];}
         if(n==0&&s==0){//System.out.println("r1");
         return 1;}
         if(s<0||n<=0){//System.out.println("r0");
         return 0;}
         
         long _count=0;
         for(int i=prev+1;i<=100-(n)+1;i++ ){
             //System.out.println("i- "+prev+1+" - "+(100-n+1)+" at"+i);
             _count+=func(n-1,i,s-i);
             //System.out.println("c+"+n+" "+prev+" "+s+" "+_count);
         }
         counts[n][prev+1][s]=_count;//System.out.println("count+"+_count+"at"+n+" "+prev+" "+s+" ");
         return _count;
     }
 }

Measured memory_bytes: 71724
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const int MAX_N=1e5;
const ll INF=1e18;
int N,K;
ll x[MAX_N];

int main(){
	cin>>N>>K;
	REP(i,N){
		cin>>x[i];
	}
	ll ans=INF;
	REP(i,N-K+1){
		ll temp;
		if (x[i+K-1]<=0){
			temp=-x[i];
		}else if (x[i]>=0){
			temp=x[i+K-1];
		}else{
			temp=min(-x[i],x[i+K-1])+x[i+K-1]-x[i];
		}
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

ll check(ll x) {
    if (x == 0) return 0;
    ll count = 0;
    ll y = x;
    while (y > 0) {
        if (y % 2 == 1) count++;
        y /= 2;
    }
    return x % count;
}

int main() {

    ll N;
    cin >> N;
    string X;
    cin >> X;

    ll pop_X = 0;
    rep(i,N) if (X[i] == '1') pop_X++;
    vector<ll> mod_plus(N, 0), mod_minus(N, 0);
    mod_plus[0] = 1 % (pop_X + 1);
    for (ll i = 1; i < N; i++) mod_plus[i] = mod_plus[i - 1] * 2 % (pop_X + 1);
    if (pop_X > 1) {
        mod_minus[0] = 1 % (pop_X - 1);
        for (ll i = 1; i < N; i++) mod_minus[i] = mod_minus[i - 1] * 2 % (pop_X - 1);
    }
    ll mp = 0, mm = 0;
    rep(i,N) {
        if (X[N - i - 1] == '1') {
            mp += mod_plus[i];
            mm += mod_minus[i];
        }
    }

    rep(i,N) {
        if (X[i] == '0') {
            ll s = (mp + mod_plus[N - i - 1]) % (pop_X + 1);
            ll count = 1;
            while (s > 0) {
                s = check(s);
                count++;
            }
            cout << count << endl;
        } else {
            if (pop_X == 1) {
                cout << 0 << endl;
                continue;
            }
            ll s = (mm - mod_minus[N - i - 1] + pop_X - 1) % (pop_X - 1);
            ll count = 1;
            while (s > 0) {
                s = check(s);
                count++;
            }
            cout << count << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 6824
#逆元

from fractions import gcd


def main():

  n=int(input())

  a=list(map(int,input().split()))
  mod=10**9+7

  b=0
  for i in a:
      b+=pow(i,mod-2,mod)


  L=1
  def lcm(x,y):
      return x//gcd(x,y)*y

  for i in a:
      L=lcm(L,i)


  print(L*b%mod)

  
main()


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

void shuffle(string &s, int h)
{
  string left = s.substr(0, h);
  string right = s.substr(h, s.size() - h);
  s = right + left;
}

int main()
{
  vector<string> A;
  while (1)
  {
    string s;
    cin >> s;
    if (s == "-")
    {
      break;
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; i++)
    {
      int h;
      cin >> h;
      shuffle(s, h);
    }
    A.push_back(s);
  }
  for (int i = 0; i < A.size(); i++)
  {
    cout << A.at(i) << endl;
  }
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a,x=0,y=0;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a&1) x++;
        else if(a%4==0) y++;
    }

    if(x+y==n) x--;
    if(y>=x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <random>
#include <time.h>
#include <cassert>
using namespace std;

int main(){

	string C;
	cin >> C;

	for(int i=0;i<C.size();i++){
		if(C[i]>='D'){
			char Caesar = (C[i] - 'D'+'A');
			cout << Caesar;
		}
		else if(C[i]<'D'){
			char Caesar = (C[i] - 'A' + 'X');
			cout << Caesar;
		}
		//cout << 'C[i]' << endl;
	}
	cout << endl;

	return 0;

}


Measured memory_bytes: 3156
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;


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


Measured memory_bytes: 3632
N, A = map(int, input().split())
y = [int(i) - A for i in input().split()]
y = [0] + y
X = max(max(y) + A,A)
dp = []
for i in range(N+1):
	dp.append([])
	for j in range(2*N*X+1):
		if i == 0 and j == N*X:
			dp[i].append(1)
		elif i >= 1 and (j - y[i] < 0 or j - y[i] > 2*N*X):
			dp[i].append(dp[i-1][j])
		elif i >= 1 and 0 <= j - y[i] and j - y[i] <= 2*N*X:
			dp[i].append(dp[i-1][j]+dp[i-1][j-y[i]])
		else:
			dp[i].append(0)
print(dp[N][N*X]-1)

Measured memory_bytes: 5740
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 5999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

int s[114514];
int main() {
	int n,ans = 0;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		if (a > 100000)ans++;
		else s[a]++;
	}
	REPO(i, 100000) {
		if (s[i] >= i)ans += s[i] - i;
		else ans += s[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

int mod = 1000003;

/////////////         modの計算
long long mod_adjust(long long a) {//	余りをとる(0～mod-1に調整する)
	if (a > mod) {
		return a % mod;
	}
	if (a < 0) {
		a *= -1;
		a %= mod;
		return mod - a;
	}
	return a;
}
int mod_adjust(int a) {//	余りをとる(0～mod-1に調整する)
	return (int)mod_adjust((long long)a);
}
int mod_add(int a, int b) {//	足し算
	a = mod_adjust(a), b = mod_adjust(b);
	long long k = a % mod; k += b % mod; k %= mod;
	return (int)k;
}
int mod_sub(int a, int b) {//	引き算
	long long k = mod_adjust((long long)a); k += mod_adjust((long long)b); k %= mod;
	return (int)k;
}
int mod_multi(int a, int b) {//	掛け算
	long long k = mod_adjust((long long)a); k *= mod_adjust((long long)b); k %= mod;
	return (int)k;
}
int mod_inv(int a) {//	逆元
	a = mod_adjust(a);
	if (a == 1) { return 1; }
	long long p = mod, q = a, m = 0, n = 1, r, c;

	while (q > 1) {
		r = p % q;
		c = p / q;
		c = mod_adjust(m - n * c);
		p = q, m = n, q = r, n = c;
	}
	return n;
}
int mod_div(int a, int b) {//	割り算
	return mod_multi(a, mod_inv(b));
}
int mod_pow(int x, int n) {//	累乗(logNオーダーなので速い)
	x = mod_adjust(x);
	n = n % (mod - 1);
	if (n < 0) {
		return mod_pow(mod_inv(x), -n);
	}
	if (n == 0) {
		return 1;
	}
	if (n == 1) {
		return mod_adjust(x);
	}
	if (n % 2 == 0) {
		int k = mod_pow(x, n / 2);
		return mod_multi(k, k);
	}
	else {
		int k = mod_pow(x, n / 2);
		return mod_multi(mod_multi(k, k), x);
	}
}

int* factorial = NULL;			//	階乗
int* factorial_inv = NULL;		//	階乗の逆元

//	階乗を事前に計算しておく関数。
//	Nはmod_combination(n, r)で呼び出されうる最大の数。
void calc_factorial(int N) {////////////////////////// 初めに必ず呼び出すこと！！！
	N = min(mod - 1, N);
	factorial = new int[N + 1];
	factorial_inv = new int[N + 1];

	factorial[0] = 1;
	factorial_inv[0] = 1;
	for (int i = 1; i <= N; i++) {
		factorial[i] = mod_multi(factorial[i - 1], i);
		factorial_inv[i] = mod_inv(factorial[i]);
	}
}
int mod_combination(int n, int r) {//	nCr	を計算する
	if (n < 0 || r < 0 || r > n) { return 0; }
	return mod_multi(factorial[n], mod_multi(factorial_inv[n - r], factorial_inv[r]));
}

int main() {
	calc_factorial(mod);

	int Q; cin >> Q;
	for (int q = 0; q < Q; q++) {
		int x, d, n; cin >> x >> d >> n;

		x = x % mod, d = d % mod;

		if (d == 0) {
			cout << mod_pow(x, n) << endl;
			continue;
		}
		x = mod_div(x, d);
		int a = x - 1, b = x + n - 1;
		if (b >= mod) { cout << 0 << endl; continue; }

		int prod = mod_div(factorial[b], factorial[a]);
		prod = mod_multi(prod, mod_pow(d, n));

		cout << prod << endl;
	}
	return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
ll dp[100100][13];

int main() {
    string s;
    cin >> s;
    map<char,int> mp;
    for (int i = 0; i < s.size(); ++i) {
        mp[s[i]]++;
    }
    for(auto x:mp){
        if(x.second %2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[210][210];
signed main() {
    int N; cin >> N;
    vector<int> v;
    for(int i=0; i<N; i++) {
        char c; cin >> c;
        if(c == 'U') v.push_back(1);
        if(c == 'D') v.push_back(0);
    }

    N = v.size();
    dp[0][0] = 1;
    for(int i=0; i<N; i++) {
        int p = v[i];
        for(int j=0; j<=i; j++) {
            if(p == 0) {
                // DOWN (その人を空いている場所に / 保留していた人をそこに入れても良い)
                if(j > 0) (dp[i+1][j-1] += dp[i][j] * j * j) %= MOD;
                (dp[i+1][j  ] += dp[i][j] * j) %= MOD;
            }
            if(p == 1) {
                // UP (その人は保留に / 保留していた人をそこに入れても良い)
                (dp[i+1][j+1] += dp[i][j]) %= MOD;
                (dp[i+1][j  ] += dp[i][j] * j) %= MOD;
            }
        }
    }
    cout << dp[N][0] << endl;
    return 0;
}



Measured memory_bytes: 3420
str = list(map(int, input().split()))
a = str[0]
b = str[1]
i = 1
if a < b:
  big = b
  small = a
else:
  big = a
  small = b

while i != 0:
  i = big % small
  big = small
  small = i

print (int(a*b/big))

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


int main() {
    string S;
    string T;
    cin >> S;
    cin >> T;

    int num_S = S.size();
    int num_T = T.size();
    
    vector<vector<int>> dp(num_S + 1, vector<int>(num_T + 1, 0));
    for (int i = 1; i < num_S + 1; i++) {
        for (int j = 1; j < num_T + 1; j++) {
            if (S[i - 1] == T[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    
    int num_ans = dp[num_S][num_T];
    int i = num_S - 1;
    int j = num_T - 1;
    string ans = "";

    while (num_ans > 0) {
        if (S[i] == T[j]) {
            ans += S[i];
            i--;
            j--;
            num_ans--;
        }
        else if (dp[i + 1][j + 1] == dp[i][j + 1]) {
            i--;
        }
        else {
            j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

Measured memory_bytes: 38552
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#define ll long
#define INF 1000000000
#define N 10000000
using namespace std;

int main(){
    ll n;
    cin>>n;
    map<string,ll> data;
    
    ll count=0;
    
    for (ll i=0; i<n; i++){
        string s;
        cin>>s;
        if (data[s]==0) count++;
        data[s]++;
    }
    
    cout<<count<<endl;
}

Measured memory_bytes: 19148
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<queue>
#include<string.h>
int main(){
 int a,b,h,m;
 scanf("%d%d%d%d",&a,&b,&h,&m);
  
 double arg=30*h+(double)m/2.0-6*m;
 double ans=sqrt(a*a+b*b-2*a*b*cos((double)3.1415926535*arg/180));
 printf("%.12f\n",ans);
  
return 0;}

Measured memory_bytes: 4260
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;
signed main() {
	int N, A, B;
	cin >> N >> A >> B;

	cout << min(N * A, B) << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<queue>
#include<utility>
#include<cmath>
#define MP make_pair
using namespace std;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef priority_queue<PII, VP, greater<PII> > LOWQ;

int n, m, k;
int a[100000], b[100000], l[100000];
int s[3000];

int dist[3001];
VP road[3001];
bool checked[3001];
LOWQ q;

int ans = 0;

void dijk()
{
  for(int i = 0; i < m; i++){
    road[a[i]].push_back(MP(l[i], b[i]));
    road[b[i]].push_back(MP(l[i], a[i]));
  }

  for(int i = 0; i < k; i++)
    q.push(MP(0, s[i]));

  while(!q.empty()){
    PII now = q.top();
    q.pop();

    if(!checked[now.second]){
      checked[now.second] = true;
      dist[now.second] = now.first;
      for(int i = 0; i < road[now.second].size(); i++){
	q.push(MP(now.first + road[now.second][i].first, road[now.second][i].second));
      }
    }
  }
  
  return;
}

int main()
{
  cin >> n >> m >> k;
  for(int i = 0; i < m; i++)
    cin >> a[i] >> b[i] >> l[i];
  for(int i = 0; i < k; i++)
    cin >> s[i];

  dijk();

  for(int i = 1; i <= n; i++)
    ans = max(ans, dist[i]);

  for(int i = 0; i < m; i++){
    int diff = abs(dist[a[i]] - dist[b[i]]);
    if(diff < l[i]){
      int x = (l[i] - diff) / 2 + max(dist[a[i]], dist[b[i]]);
      if((l[i] - diff) % 2)
	ans = max(ans, x + 1);
      else
	ans = max(ans, x);
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7180
// C - Sqrt Inequality 2020/03/14
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    uint64 a , b , c;
    cin >> a >> b >> c;
    int64 d = c - a - b;
    if(( d > 0 ) && ( d * d > 4 * a * b )) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d) {
        cout<<"Left"<<endl;
    } else if(a+b<c+d) {
        cout<<"Right"<<endl;
    } else{
        cout<<"Balanced"<<endl;
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main() {
	int N,K;
	cin>>N>>K;
	int ans=0;
	for(int i=0;i<N;i++){
		int c;
		cin>>c;
		ans+=2*min(abs(c),abs(K-c));
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::*;

// const MOD: i32 = 1000000007;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let s1: String = read().unwrap();
    let s2: String = read().unwrap();
    let s3: String = read().unwrap();

    println!("{}{}{}", &s1[0..1], &s2[1..2], &s3[2..3]);

}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	cout<<a-b-1<<endl;
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
}

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

#define int long long
typedef pair<int, int> P;
typedef pair<P, int> Pi;

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

  priority_queue<Pi> q1, q3;
  priority_queue<Pi, vector<Pi>, greater<Pi> > q2, q4;    
  for ( int i = 0; i < n; i++ ) {
    int l, r;
    cin >> l >> r;
    q1.push(Pi(P(l, r), i));
    q3.push(Pi(P(l, r), i));
    q2.push(Pi(P(r, l), i));
    q4.push(Pi(P(r, l), i));
  }

  int ans = 0;
  {
    bool used[n] = {0};
    int cnt = 0;
    int now = 0;
    while ( cnt < n ) {
      Pi p;
      if ( cnt%2 ) {      
	while ( 1 ) {
	  p = q1.top(); q1.pop();
	  if ( used[p.second] ) continue;
	  break;
	}
      } else {
	while ( 1 ) {
	  p = q2.top(); q2.pop();
	  if ( used[p.second] ) continue;
	  break;
	}
      }
      //ans += abs(now-p.first.first);
      int l = min(p.first.first, p.first.second);
      int r = max(p.first.first, p.first.second);
      if ( l <= now && now <= r ) {
	
      } else if ( r <= now ) {
	ans += now-r;
	now = r;
      } else {
	ans += l-now;
	now = l;
      }
      used[p.second] = true;
      cnt++;
    }
    ans += abs(now);
  }
  
  {
    int ans2 = 0;
    bool used[n] = {0};
    int cnt = 0;
    int now = 0;
    while ( cnt < n ) {
      Pi p;
      if ( cnt%2 == 0 ) {      
	while ( 1 ) {
	  p = q3.top(); q3.pop();
	  if ( used[p.second] ) continue;
	  break;
	}
      } else {
	while ( 1 ) {
	  p = q4.top(); q4.pop();
	  if ( used[p.second] ) continue;
	  break;
	}
      }
      int l = min(p.first.first, p.first.second);
      int r = max(p.first.first, p.first.second);
      if ( l <= now && now <= r ) {
	
      } else if ( r <= now ) {
	ans2 += now-r;
	now = r;
      } else {
	ans2 += l-now;
	now = l;
      }
      used[p.second] = true;
      cnt++;
    }
    ans2 += abs(now);
    ans = max(ans, ans2);
  }

  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 11980
#!/usr/bin/env python3
import sys


def solve(N: int, h: "List[int]"):
    dp = [float("inf")] * 10 ** 6
    h = h + [0] * 10 ** 6

    dp[0] = 0
    for i in range(N):
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
    print(dp[N - 1])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    h = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, h)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38260
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
   IOS

  int l, r, d;
  cin >> l >> r >> d;
  int ans = (r/d) - (l-1)/d;
  cout << ans << endl;
  



  

  

  
  
  
  

  
  
  
    


  


  
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int64_t X;
  cin >> X;
  int A, B;
  for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        A = i;
        B = j;
      }
    }
  }
  for (int i = 0; i < 100; i++) {
    for (int j = -100; j < 0; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        A = i;
        B = j;
      }
    }
  }
  for (int i = -100; i < 0; i++) {
    for (int j = -100; j < 0; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        A = i;
        B = j;
      }
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+5;
/*
int main()
{

    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin>>n;
    vector<int> dp(3);

    //  dp[i] - the total cost such that we did activity i on the last considered day
    for(int day=0 ; day<n ; ++day)
    {
        vector<int> new_dp(3,0);
        vector<int> c(3);
        for(auto &i:c)            cin>>i;
        for(int i=0 ; i<3 ; i++)
        {
            for(int j=0 ; j<3 ; ++j)
            {
                if(i!=j)
                    new_dp[j] = max(new_dp[j], dp[i]+c[j]);
            }
            cout<<"                                 ";
            for(auto k:new_dp)                cout<<k<<" "; cout<<endl;
        }
        dp = new_dp;
    }
    cout<<max({dp[0],dp[1],dp[2]});
}
*/

int main()
{ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin>>n;
    vector<int> dp(3);

    for(int day=0 ; day<n ; day++)
    {
        vector<int> c(3);
        vector<int> new_dp(3);
        for(auto &k:c)  cin>>k;

        for(int i=0 ; i<3 ; i++)
        {
            for(int j=0 ; j<3 ; ++j)
            {
                if(i!=j)
                    new_dp[j] = max(new_dp[j] , dp[i] + c[j]);
            }
            //cout<<"   \t\t\t  ";            for(auto k:new_dp)                cout<<k<<" "; cout<<endl;
        }
        dp = new_dp;
    }
    cout<<max({dp[0],dp[1],dp[2]});

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int m;
	cin >> m;
	cout << 24 - m + 24 << endl;
	return 0;
}

Measured memory_bytes: 256