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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 710;
const int MAX_S = 2010;

int S;
int dp[MAX_S];

signed main() {
    IOS;

    cin >> S;

    dp[S] = 1;
    for(int i = S; i >= 0; --i) {
        for(int j = 3; j <= S; ++j) {
            if(i - j < 0) { continue; }
            dp[i - j] += dp[i];
            dp[i - j] %= MOD;
        }
    }
    print(dp[0]);

    return 0;
}


Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, M) = ReadTuple<int,int>();
        if (N == M) WriteLine("Yes");
        else WriteLine("No");
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27524
s = input()
n = len(s)
l = ['A', 'C', 'G', 'T']
ans = [0]

for i in range(n):
  for j in range(n):
    p = s[i : j + 1]
    if all(c in l for c in p):
        ans.append(len(p)) 
print(max(ans))      

Measured memory_bytes: 9100
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

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

Measured memory_bytes: 4832
N = int(input())
h = [ int(x) for x in input().split(' ')]

def h_diff(i, j):
    return abs(h[i] - h[j])

min_v = [ 0 for x in range(N)]
for i in range(1, len(h)):
    min_v[i] = min_v[i-1] + h_diff(i, i-1)

pos = 0
for i in range(1, N):
    cand1 = min_v[i-1] + h_diff(i, i-1)
    cand2 = min_v[i-2] + h_diff(i, i-2) if i >= 2 else min_v[i] 
    min_v[i] = min(min_v[i], cand1, cand2)

print(min_v[N-1])

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

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

	int x = 1;
	for (int i = 1; i <= N; ++i) {
		int a = 2 * x;
		int b = x + K;
		x = (a < b) ? a : b;
	}

	cout << x << '\n';
	return 0;
}


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

long long N, A, B;
vector<long long> h;

bool check(long long m) {
    long long k = 0;
    for (int i = 0; i < N; i++) {
        long long H = h[i] - B * m;
        if (H <= 0) continue;
        k += (H + A - 1) / A;
    }
    return (k <= m);
}

int binary_search() {
    long long m, l = 0, r = 2e9;

    while (r - l > 0) {
        m = (r + l) / 2;
        if (check(m)) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    return r;
}

int main() {
    cin >> N >> A >> B;
    A -= B;
    h.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    cout << binary_search() << endl;
}


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

int main() {
  string in;
  cin >> in;
  int a[4]={in[0]-'0',in[1]-'0',in[2]-'0',in[3]-'0'};
  int n=3;
  for(int bit=0;bit< (1<<n);bit++) {
    int ans=a[0];
    string temp;
    for(int i=0;i<n;i++) {
      if( (1<<i)&bit) {
        ans += a[i+1];
        temp += "+";
      }else{
        ans -= a[i+1];
        temp += "-";
      }
    }
    if(ans==7) {
      cout << a[0] << temp[0] << a[1] << temp[1] << a[2] << temp[2] << a[3] << "=7" << endl;
      return 0;
    }
  }
}

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

int main(void){
    int n,p[8],q[8];
    cin>>n;
    for(int i=0;i<n;i++) cin>>p[i];
    for(int i=0;i<n;i++) cin>>q[i];
    vector<int> v;
    for(int i=1;i<=n;i++) v.push_back(i);
    int count=0;
    int pp,qq;
    do{
        bool P=true,Q=true;
        for(int i=0;i<n;i++){
            if(p[i]!=v[i]) P=false;
            if(q[i]!=v[i]) Q=false;
        }
        if(P) pp=count;
        if(Q) qq=count;
        count++;
    }while(next_permutation(v.begin(),v.end()));
    cout<<abs(pp-qq)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	

	ll N;
	cin >> N;
	ll i = 1;
	while (i * i <=N) {
		i++;
	}
	cout << (i-1) * (i-1) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(x) x.begin(), x.end()
#define mset(a, b) memset(a, b, sizeof a)
#define rep(i, a, b) for(int i(a), i##_END_(b); i <= i##_END_; i++) 
#define drep(i, a, b) for(int i(a), i##_END_(b); i >= i##_END_; i--)
using namespace std;
template<class T> inline bool tomax(T &a, T b) {return a < b ? a = b, 1 : 0;}
template<class T> inline bool tomin(T &a, T b) {return b < a ? a = b, 1 : 0;}
typedef long long ll;
typedef double db;

int main() {
    int a;
    cin >> a;
    cout << 3 * a * a;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
    cin >> a >> b;
    if(a == b)
    {
        cout << "-1";
        return 0;
    }
    for(int i = 1;i <= 1e5;i++)
    {
        long long ans = a*i;
        if(ans % b != 0)
        {
            cout << ans;
            return 0;
        }
    }
    cout << "-1";
}


Measured memory_bytes: 256
/*
Author Shivam
*/
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i =a, i>=b;i--)
#define sz(x)       (int)x.size()
#define F			first
#define S			second
#define debug(x)	for(int i=0;i<x;i++) cout<<"##########"<<endl
#define M			1000000007 
#define int			long long int
#define lMax		LLONG_MAX
#define pii 		pair<int ,int >
#define	all(a)		a.begin(), a.end()
#define vi 			vector<int> 
#define vii 		vector<pii> 
#define ve          vector
#define endl		"\n"
#define double 		long double
#define couts		cout<<setprecision(12)<<fixed					
// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == > != precedence gretaer then & , << precedence greater than <= == => , 
//int chk, cnt, fl, pos, in, src, tar, val, res. dummy;  fill (myvector.begin(),myvector.begin()+4,5), freq;					
void solve()
{
	int n;
	cin>>n;
	string s[n];
	rep(i,0,n) cin>>s[i];

	int ans = 0;
	
	rep(i,0,n){
	queue<pii> q;
	q.push({i,1});
	int lvl=1;
	int vis[n], col[n];
	memset(vis, 0, sizeof(vis));
	vis[i]=1;
	memset(col, 0, sizeof(col));
	col[i]=1;
	while(!q.empty())
	{
		int c=q.size();
		while(c--)
		{	
			int v=q.front().F;
			q.pop();

			for(int i=0;i<n;i++)
			{
				if(s[v][i]-'0' && vis[i]==0)
				{
					if(col[v]==1) col[i]=2;
					else col[i]=1;
					vis[i]=lvl+1;
					q.push({i, lvl+1});

				} else if(col[i]==col[v] && s[v][i]-'0')
				{
					cout<<-1;
					return;
				}
			}
		}
		lvl++;
	}
	ans=max(ans, lvl-1);
	}

	cout<<ans<<endl;
}
signed main()
{
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		int t;
		t=1;
		while(t--)
		{
			solve();
		}
}	

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

void Main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    map<int, int> m;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[n-1-i];
        m[b[n-1-i]]++;
    }
    for (auto i: m) {
        if (i.second > n) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
    for (int i = 0; i < n; i++)
    {
        while (a[i] == b[i]) {
            int r = rand() % n;
            if (a[r] != b[i] && b[r] != b[i]) {
                swap(b[i], b[r]);
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (i != 0) cout << " ";
        cout << b[i];
    }
    cout << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll N, K, R, S, P;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

string T;

cin >> N >> K;
cin >> R >> S >> P;
cin >> T;

// 出す手が r==0 s==1 p==2 としてdpテーブル
vector<vector<ll>> dp(3,vector<ll>(N+1,0));

FOR(i,1,K+1){
    REP(j,3){
        if(T[i-1] == 'r'){
            dp[2][i] = P;
        }
        else if(T[i-1] == 's'){
            dp[0][i] = R;
        }
        else{
            dp[1][i] = S;
        }
    }
}
FOR(i,K+1,N+1){
    ll hands[3] = {dp[0][i-K],dp[1][i-K],dp[2][i-K]};
    ll bonus[3] = {0,0,0};

    if(T[i-1]=='r') bonus[2] = P;
    else if(T[i-1]=='s') bonus[0] = R;
    else bonus[1] = S;

    REP(j,3){
        if(j==0){
            dp[j][i] = max(hands[1],hands[2]) + bonus[j];
            //dp[j][i] = max(dp[0][i-K],max(dp[1][i-K],dp[2][i-K]+P));
        }
        else if(j==1){
            dp[j][i] = max(hands[0],hands[2]) + bonus[j];
            //dp[j][i] = max(dp[0][i-K]+R,max(dp[1][i-K],dp[2][i-K]));
        }
        else{
            dp[j][i] = max(hands[0],hands[1]) + bonus[j];
            //dp[j][i] = max(dp[0][i-K],max(dp[1][i-K]+S,dp[2][i-K]));
        }
    }
}

ll res = 0;

for(int i=0; i<K; i++){
        res += max(dp[0][N-i],max(dp[1][N-i],dp[2][N-i]));
}

//cout << ans[0] << ans[1] << ans[2] << "\n";
/*
REP(i,N){
    cout << dp[0][i+1] << "/" << dp[1][i+1] << "/" << dp[2][i+1] << "\n";
}
*/
cout << res << endl;

return 0;
}

Measured memory_bytes: 3664
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int digsum = digsum(i);
            if (a <= digsum && digsum <= b) {
                result += i;
            }
        }

        // 出力
        System.out.println(result);
    }

    public static int digsum(int num) {
        int sum = 0;
        while (num > 0) {
            sum += num % 10;
            num /= 10;
        }
        return sum;
    }
}


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

int main(){
  string s;
  cin >> s;
  if(s=="a" || (s=="i" || (s=="u" ||( s=="e" || s=="o")))){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string.h>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
#include<set>
#include<array>
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; }



#define rep(n) for(int i=0;i<n;i++)
typedef pair<int, int> pii;

typedef long long ll;
typedef pair<ll, ll>pll;
const int MOD = 1000000007;
const int INF = 1 << 29;



int main() {
	
	vector<int> cnt(101,-1) ;
	long long k;
	int ans = 0,a;
	char s[101];
	cin >> s;

	cin >> k;
	int j = 0;
	cnt[0] = 0;
	int end = strlen(s) - 1;
	for (int i = 0; i < end; i++) {
		if (s[i] == s[i + 1]) {
			cnt[j]++;
		}
		else {
			j++;
			cnt[j]=0;
		}
		a=j;
	}
	
	for (int i = 1; i<a; i++) {
		ans += (cnt[i] + 1) / 2;
		
	}

	if (cnt[0] == end) {
		cout << strlen(s)*k / 2 << endl;
	}
	else if(s[0]==s[end]) {
		cout << ans*k + (cnt[0]+1) / 2 + (cnt[a]+1) / 2 + (cnt[0] + cnt[a]+2) / 2 * (k - 1) << endl;
	}
	else {
		cout << ans * k + (cnt[0] + 1) / 2 * k + (cnt[a] + 1) / 2 * k << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int A, B;
  cin >> A >> B;
  
  if(A == 1){
    A = 14;
  }
  if(B == 1){
    B = 14;
  }
  
  if(A > B){
    cout << "Alice" << endl;
    return 0;
  }
  
  if(B > A){
    cout << "Bob" << endl;
    return 0;
  }
  
  cout << "Draw" << endl;
}

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

const int INF = 1e+9;

int main(){
  int h,n;
  int a[10010],b[10010];
  cin >> h >> n;
  for(int i = 0 ; i < n ; i ++){
    cin >> a[i] >> b[i];
  }
  int dp[20010];
  for(int i = 0 ; i < 20010 ; i ++){
    dp[i] = INF;
  }
  dp[0] = 0;
  for(int i = 0 ; i < n ; i ++){
    for(int j = a[i] ; j < 20010 ; j ++){
      dp[j] = min( dp[j] , dp[j-a[i]]+b[i] );
    }
  }
  int ret = INF;
  for(int i = h ; i < 20010 ; i ++){
    ret = min( ret , dp[i] );
  }
  cout << ret << endl;
}

Measured memory_bytes: 384
//************************************JAI SAI RAM*************************************** 
// ED ROUND 85 DIV 2 PROBLEM D HARD TO THINK OF and hard TO IMPLEMENT .
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n";
#define pair pair<ll,ll> 
ll MAX=LLONG_MAX;
ll MIN=LLONG_MIN;
ll P=1000000007;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i,j,k,l,m,n,o,p,q,r,s,t,x,a[500],tt=0;
    cin>>n;
    k=(n*(n+1)/2);
    l=(n/3);
    m=(n/5);
    t=(n/15);
    x=(k-3*((l*(l+1)))/2-5*((m*(m+1))/2)+15*((t*(t+1))/2));
    cout<<x<<endl;
    return 0;
}  
    


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

vector<ll>relation[20], money(20, 1);

int main() {
	ll k;
	cin >> k;
	ll ans = 0;
	for (ll i = 1;i <= k;++i) {
		for (ll j = 1;j <= k;++j) {
			ll res = gcd(i, j);
			for (ll l = 1;l <= k;++l) {
				ans += gcd(res, l);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int n, a, count=0;
    cin >> n;
    for(int i=1;i<=n;i++) {
        cin >> a;
        if(i%2!=0&&a%2!=0) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
//#define mod 1000000007LL
#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n] ;
    rep(i ,0, n) cin >> a[i] ;
    int cnt = 0 ;
    rep(i, 1, n-1) {
        if((a[i] > a[i-1] && a[i] < a[i+1]) || (a[i] < a[i-1] && a[i] > a[i+1])) cnt++ ;
    }
    cout << cnt << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 256
//
// Created by Yuta Sato on 3/15/20.
//

#include <iostream>

void BigOrSmall(int a, int b){
    if (a < b){
        std::cout << "a < b" << std::endl;
    }
    else if (a > b){
        std::cout << "a > b" << std::endl;
    }
    else{
        std::cout << "a == b" << std::endl;
    }
}

void Range(int A, int B, int C){
    if ( A < B && B < C){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}

void SortUp(int A[], const size_t nelem){
    int temp = 0;
    for (int j = 1; j < nelem; j++) {
        for (int i = 0; i < nelem - j; i++) {
            if (A[i] > A[i + 1]) {
                temp = A[i];
                A[i] = A[i + 1];
                A[i + 1] = temp;
            }
        }
    }
//    std::cout << A[0] << " " << A[1] << " " << A[2] << std::endl;
}

void IncludeOrExclude(int W, int H, int X, int Y, int R){
    int H_max = Y + R;
    int W_max = X + R;
    int H_min = Y - R;
    int W_min = X - R;
    if (H >= H_max && W >= W_max && W_min >= 0 && H_min >= 0)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
}

//int main(){
//    // ---------------------------
//    // ITP_1_2_A:
//    int a, b;
//    std::cin >> a >> b;
//    BigOrSmall(a,b);
//    // ---------------------------
//
//    // ---------------------------
//    // ITP_1_2_A
//    // ---------------------------
//
//    // ---------------------------
//    // ITP_1_2_A
//    // ---------------------------
//
//    // ---------------------------
//    // ITP_1_2_A
//    // ---------------------------
//}


int main(){
    // ---------------------------
    // ITP_1_2_A: Small, Large, or Equal
//    int a, b;
//    std::cin >> a >> b;
//    BigOrSmall(a,b);
    // ---------------------------

    // ---------------------------
    // ITP_1_2_B: Range
//    int a, b, c;
//    std::cin >> a >> b >> c;
//    Range(a,b,c);
    // ---------------------------

    // ---------------------------
    // ITP_1_2_C: Sorting Three Numbers
//    int a[3] = {4, 2, 1};
//    std::cin >> a[0] >> a[1] >> a[2];
//    const size_t nelem = sizeof(a) / sizeof(a[0]);
//    SortUp(a, nelem);
//    std::cout << a[0] << " " << a[1] << " " << a[2] << std::endl;
    // ---------------------------

    // ---------------------------
    // ITP_1_2_D: A Circle In The Box
    int W, H, x, y, r;
    std::cin >> W >> H >> x >> y >> r;
    IncludeOrExclude(W, H, x, y, r);
    // ---------------------------


    return 0;
}


Measured memory_bytes: 3096
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!
 
const gcdArr = function(arr) {
  let gcdres = gcd(arr[0], arr[1])
  for (let i=2; i<arr.length; i++) {
    gcdres = gcd(gcdres, arr[i])
  }
  return gcdres
}
 
function gcd_impl(n,m) {
        for( let i = 0; i < 10; ++i ) {
                let t = n - m;
                let q = m > t;
                n = q ? m : t;
                m = q ? t : m;
                if( m == 0 ) { return n; }
        }
        return gcd_impl( m, n % m );
}
 
function gcd( n, m ) {
        return n > m ? gcd_impl( n, m ) : gcd_impl( m, n );
}
 
const Main = (p)=>{
	// 1行目がinput[0], 2行目がinput[1], …に入る
	
	let t = parseInt(p);//p.split(" ").map(Number);
	//文字列から10進数に変換するときはparseIntを使います
	//出力
	
	console.log(p*2*3.14115);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int gcd(int a,int b);

int main(int argc, char** argv) {

    int a;
    int b;
    scanf("%d", &a);
    scanf("%d", &b);  
    printf("%d\n", gcd(a,b));
    return 0;
}

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


Measured memory_bytes: 2124
#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  char b;
  cin >> b;
  if (b == 'A')
    cout << "T";
  else if (b == 'T')
    cout << "A";
  else if (b == 'G')
    cout << "C";
  else
    cout << "G";
  cout << endl;
}

Measured memory_bytes: 384
n, m, x = map(int, input().split())
c, a = [0] * n, [0] * n
for i in range(n):
    c[i], *a[i] = map(int, input().split())
l = []
b = [[a[j][i] for j in range(n)] for i in range(m)]
nums = [("0"*n + bin(i)[2:])[-n:] for i in range(1, 2 ** n)]
s = [sum(i) for i in b]

for i in nums:
    if min(sum(k[j]*int(i[j]) for j in range(len(i))) for k in b) >= x:
        l.append(sum(c[j]*int(i[j]) for j in range(len(i))))
print(min(l) if l else -1)

Measured memory_bytes: 9460
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();//人数
        int a = sc.nextInt();//一人当たりの電車の値段
        int b = sc.nextInt();//全員でタクシーに乗った値段
        
        int sum = a * n;
        
        if(b>=sum){
            System.out.println(sum);
        }else{
            System.out.println(b);
        }
        
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int first=0,second=0,third=0;
		
		for(int i = 0;i < 10;i++){
			int temp = scan.nextInt();
			if(first < temp){
				third = second;
				second = first;
				first = temp;
			}else if(second < temp){
				third = second;
				second = temp;
			}else if(third < temp){
				third = temp;
			}
		}
		System.out.println(first + "\n" + second + "\n" + third);
	}
}

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

int main() {
    // input
    string C1, C2;
    cin >> C1 >> C2;

    // solve
    bool flag = false;
    if (C1[0] == C2[2] && C1[1] == C2[1] && C1[2] == C2[0]) flag = true;

    // output
    cout << (flag ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
S=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 9200
#include <iostream>
using namespace std;
int main(void){
    int N, L, sum, ret=0;
    std::cin >> N >> L;
    sum = (2*L + N-1) * N / 2;
    if(L < 0){
        if(N-1 < -L)
            ret = sum - (L+N-1);
        else
            ret = sum;
    }else{
        ret = sum - L;
    }
        
    std::cout << ret << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	static int n, m;
	static char[][] a;
	static boolean[][] ok;
	static int[] dx = new int[] { -1, 0, 1, 0, -1, -1, 1, 1 };
	static int[] dy = new int[] { 0, 1, 0, -1, -1, 1, -1, 1 };
	static int A, B, C;

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		if (n % 2 == 1) {
			for (int i = 1; i <= m; i++) {
				pw.println(i + " " + (n - i + 1));
			}
		} else {
			int odd = (m + 1) / 2;
			for (int i = 1; i <= odd ; i++) {
				pw.println(i + " " + (n - i + 1));
			}
			for (int i = odd+1; i <= m; i++) {
				pw.println(i + " " + (n - i));
			}
		}

		pw.flush();
	}

}


Measured memory_bytes: 43360
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);

    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vi p(a);
    vi q(b);
    vi r(c);

    rep(i,a){
        cin>>p[i];
    }

    rep(i,b){
        cin>>q[i];
    }

    rep(i,c){
        cin>>r[i];
    }

    sort(all(p));
    reverse(all(p));
    sort(all(q));
    reverse(all(q));
    sort(all(r));
    reverse(all(r));

    int ans=0;
    priority_queue<int,vi,greater<int>> qa,qb;
    rep(i,x){
        ans+=p[i];
        qa.push(p[i]);
    }
    rep(i,y){
        ans+=q[i];
        qb.push(q[i]);
    }

    int itr=0;
    while(itr<c){
        int rs=r[itr];
        if(qa.empty()&&qb.empty()||qa.size()&&qb.size()&&rs<=qa.top()&&rs<=qb.top()) break;

        if(qb.empty()&&rs<=qa.top()||qa.empty()&&rs<=qb.top()) break;

        if(qa.size()&&qb.size()&&rs>=qa.top()&&rs>=qb.top()){
            if(qa.top()>qb.top()){
                ans-=qb.top();
                qb.pop();
                ans+=rs;
            }else{
                ans-=qa.top();
                qa.pop();
                ans+=rs;
            }
        }else if(qb.empty()||qa.size()&&rs>=qa.top()){
            ans-=qa.top();
            qa.pop();
            ans+=rs;
        }else {
            ans-=qb.top();
            qb.pop();
            ans+=rs;
        }
        itr++;
    }


    cout<<ans<<endl;



}

Measured memory_bytes: 4852
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

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

int main()
{
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    rep(bi, n){
        ll ai = distance(a.begin(), lower_bound(a.begin(), a.end(), b[bi]));
        ll ci = distance(upper_bound(c.begin(), c.end(), b[bi]), c.end());
        ans += ai * ci;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4520
n,m=map(int,input().split())
stu=[]
far=[]
plc=[]
for i in range(n):
    a,b=map(int,input().split())
    stu.append([a,b])
for i in range(m):
    c,d=map(int,input().split())
    plc.append([c,d])
for i in range(n):
    far=[]
    for j in range(m):
        far.append(abs(stu[i][0]-plc[j][0])+abs(stu[i][1]-plc[j][1]))
    print(far.index(min(far))+1)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    ll n, m, d;
    cin >> n >> m >> d;
    double ans = 0;
    if (d == 0) {
        ans = 1.0 * (m - 1) / n;
    } else {
        ans = 1.0 * (m - 1) * 2 * (n - d) / n / n;
    }

    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<Pi> r(n),b(n);
    rep(i,n){
        cin>>r[i].fi>>r[i].se;
    }
    rep(i,n){
        cin>>b[i].fi>>b[i].se;
    }
    sort(begin(r),end(r),greater<Pi>());
    int ans=0;
    vector<bool> used(n,false);
    for(auto [rx,ry]:r){
        int ind=-1,y=INF;
        rep(i,n){
            if(used[i]) continue;
            auto [bx,by]=b[i];
            if(bx<rx || by<ry) continue;
            if(chmin(y,by)){
                ind=i;
            }
        }
        if(ind!=-1){
            used[ind]=true;
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <climits>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  int cnt = 0;
  REP(i, n) {
    int j;
    cin >> j;
    if (j % 2 == 0) {
      cnt++;
    }
  }
  cout << pow(3, n) - (pow(2, cnt)) << endl;
}
////////////////////////////////////////////////


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
int main() {

    int x,a;
    cin >> x >> a;
    
    if(x<a) cout<<0<<endl;
    else    cout<<10<<endl;

 return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int n;
    ll tmp;
    vector<ll> A;
    cin >> n;
    REP(i,0,n){
        cin >> tmp;
        A.push_back(tmp);
    }
    ll res=0;
    REP(i,0,n-1){
        if(i==0){
            res=A[i]-A[i+1];
            continue;
        }
        if(i%2==0){
            res-=A[i+1];
        }else{
            res+=A[i+1];
        }
    }

    vector<ll> ans(n);
    ans[0] = res;
    REP(i,1,n) ans[i]=(A[i-1]*2-ans[i-1]);

    REP(i,0,n){
        if(i!=n-1){
            cout << ans[i] << " ";
        }else{
            cout << ans[i] << endl;
        }
    }
}

Measured memory_bytes: 3060
s = input()

l = []
tmp = 0
d = 'R'
for x in s:
    if x == d:
        tmp += 1
    else:
        l.append(tmp)
        tmp = 1
        d = x
else:
    l.append(tmp)
res = []
for i in range(0, len(l), 2):
    a, b = l[i:i+2]
    c = a + b
    if c % 2 == 0:
        p = q = c // 2
    else:
        p, q = c // 2 + 1, c // 2
        if (a > b and a % 2 == 0) or (a < b and b % 2 == 1):
            p, q = q, p

    res += [0] * (a-1) + [p] + [q] + [0] * (b-1)

print(*res)


Measured memory_bytes: 11280
s = gets
args  = s.split('/')
y = args[0].to_i
m = args[1].to_i
d = args[2].to_i
if y >= 1989 && y < 2019
  print 'Heisei'
elsif y == 2019
  if m < 4
    print 'Heisei'
  elsif m == 4 && d <= 30
    print 'Heisei'
  else
    print 'TBD'
  end
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N;
    cin >> N;
    vector<int> arr(N, 0);
    for(int i = 0; i < N; i++)
        cin >> arr[i];
    for(int i = 0; i < N; i++) {
        if (i > 0) {
            if (arr[i-1] > arr[i]) {
                cout << "No" << endl;
                return 0;
            } else if (arr[i-1] == arr[i]) {
                arr[i] += 1;
            } else {
                // do nothing
            }
        }
        arr[i] -= 1;
        // cout << arr[i] << " ";
    }
    cout << "Yes" << endl;
    return 0;
}



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

int main() {
  long long A,B,X;
  cin >> A >> B >> X;
  if (!(A==0) && !(B==0)){
    cout << B/X-(A-1)/X << endl;
  }
  else if(A==0 && !(B==0)){
    cout << B/X+1 << endl;
  }
  else {
    cout << 1 << endl;
  }
}


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

#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;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 18000;
const int OFFSET = 9000;
const int N = 5000;

vi dx, dy;
bool dpx[N][MAX], dpy[N][MAX];

int main() {
	string s;cin>>s;
	int x,y;cin>>x>>y;

	bool x_dir=true;
	int last_t=-1;
	rep(i,s.size()){
		if(s[i]=='F') continue;
		if (x_dir) dx.push_back(i-last_t-1);
		else dy.push_back(i-last_t-1);
		last_t=i;
		x_dir=!x_dir;
	}
	if(x_dir) dx.push_back(s.size()-last_t-1);
	else dy.push_back(s.size()-last_t-1);

	int x_max=dx[0]+OFFSET, x_min=dx[0]+OFFSET;
	rep1(i,dx.size()-1) {x_max+=dx[i];x_min-=dx[i];}
	rep(i,dx.size()+1) for(int j=x_min;j<=x_max;j++) dpx[i][j]=false;
	dpx[0][dx[0]+OFFSET]=true;
	rep1(i,dx.size()-1) {
		for(int j=x_min;j<=x_max;j++) {
			if(x_min<=j-dx[i]&&dpx[i-1][j-dx[i]]) dpx[i][j]=true;
			if(j+dx[i]<=x_max&&dpx[i-1][j+dx[i]]) dpx[i][j]=true;
		}
	}

	int y_max=OFFSET, y_min=OFFSET;
	rep(i,dy.size()) {y_max+=dy[i];y_min-=dy[i];}
	rep(i,dy.size()+1) for(int j=y_min;j<=y_max;j++) dpy[i][j]=false;
	dpy[0][OFFSET]=true;
	rep(i,dy.size()) {
		for(int j=y_min;j<=y_max;j++) {
			if(y_min<=j-dy[i]&&dpy[i][j-dy[i]]) dpy[i+1][j]=true;
			if(j+dy[i]<=y_max&&dpy[i][j+dy[i]]) dpy[i+1][j]=true;
		}
	}

	if(dpx[dx.size()-1][x+OFFSET]&&dpy[dy.size()][y+OFFSET])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}


Measured memory_bytes: 142080
#include <bits/stdc++.h>
using namespace std;;
#define llong long long
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
llong gcd(llong n, llong m){
    llong ans;
    while(true){
        if(n<m) swap(n,m);
        n = n%m;
        if(n==0){
            ans = m;
            break;
        }
    }
    return ans;
}
int main(){
    int n; cin >> n;
    llong ans = 1;
    llong tmp;
    for(int i =0; i<n; i++){
        cin >> tmp;
        ans = ans / gcd(ans, tmp) * tmp;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

char C;

int main()
{
    cin >> C;
    char next = C + 1;
    cout << next << endl;
}


Measured memory_bytes: 256
n = int(input())
arr = [0]*(10**6+2)
for _ in range(n):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    b = min(b,n)
    arr[a] += 1
    if b+1<=n:
        arr[b+1] -= 1
for i in range(n):
    arr[i+1] += arr[i]
res = -float('inf')
for i,j in enumerate(arr[:n+1][::-1]):
    if (n-i)<=j:
        res = max(res,n-i)
print(max(res,0))



Measured memory_bytes: 17984
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n,c = map(int,input().split())
    d = [list(map(int,input().split())) for i in range(c)]
    cmat = [list(map(int,input().split())) for i in range(n)]
    t = [[0]*c for i in range(3)]
    ans = float("inf")
    for i in range(n):
        for j in range(n):
            t[(i+j)%3][cmat[i][j]-1] += 1
    for i in range(c):
        for j in range(c):
            if i != j:
                for k in range(c):
                    if i != k and j != k:
                        subans = 0
                        for l in range(c):
                            subans += d[l][i]*t[0][l]+d[l][j]*t[1][l]+d[l][k]*t[2][l]
                        ans = min(subans,ans)
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
    

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

bool search(const string& s, const int n, const int m) {
  if (n <= m) {
    cout << n;
    return true;
  }
  for (int i = m; i > 0; --i) {
    if (s[n - i] == '1')
      continue;
    if (search(s, n - i, m)) {
      cout << " " << i;
      return true;
    } else {
      return false;
    }
  }
  return false;
}

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

  if (!search(s, n, m))
    cout << "-1";
  cout << "\n";

  return 0;
}


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

int main() {
	string a,b;
	cin>>a>>b;
	int c,d;
	cin>>c>>d;
	string f;
	cin>>f;
	if(f == a) c--;
	else d--;
	cout<<c<<" "<<d<<endl;
	return 0;
}


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

int main() {
  int N; cin >> N;
  if (N == 1) {
    cout << "Yes" << endl;
    cout << 2 << endl;
    cout << 1 << " " << 1 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  int K = -1;
  for (int i = 1; i*(i-1) <= 2*N; i++) {
    if (i*(i-1) == 2*N) K = i;
  }
  if (K == -1) { cout << "No" << endl; return 0; }
  vector<vector<int>> S(K, vector<int>(K-1));
  int num = 1;
  for (int i = 0; i < K-1; i++) {
    for (int j = i; j < K-1; j++) {
      S.at(i).at(j) = num;
      S.at(1+j).at(i) = num;
      num++;
    }
  }
  cout << "Yes" << endl;
  cout << K << endl;
  for (int i = 0; i < K; i++) {
    cout << K-1 << " ";
    for (int j = 0; j < K-1; j++) cout << S.at(i).at(j) << " ";
    cout << endl;
  }
}

Measured memory_bytes: 2176