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

void __print(int x) {cerr << x;};void __print(long x) {cerr << x;};void __print(long long x) {cerr << x;};void __print(unsigned x) {cerr << x;};void __print(unsigned long x) {cerr << x;};void __print(unsigned long long x) {cerr << x;};void __print(float x) {cerr << x;};void __print(double x) {cerr << x;};void __print(long double x) {cerr << x;};void __print(char x) {cerr << '\'' << x << '\'';};void __print(const char *x) {cerr << '\"' << x << '\"';};void __print(const string &x) {cerr << '\"' << x << '\"';};void __print(bool x) {cerr << (x ? "true" : "false");}

#define int             long long
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define endl             '\n'
#define pb              push_back
#define all(x)          x.begin(),x.end()
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int string_to_int(string s){int ans = 0;int p=1;for(int i=s.size()-1;i>=0;i--){ans += (s[i]-'0')*p;p *= 10;}return ans;}

//DEBUGGING-LINES
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr <<'}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

void t_c_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif*/

	int n; cin >> n;
	int ans=0;
	int cnt = 1;
	for(int i=0;i<n;i++){
		int x; cin >> x;
		if(cnt%2 and x%2){
			ans++;
		}
		cnt++;
	}
	cout << ans << endl;
}

int32_t main()
{
	t_c_c();
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    deque<int> deq;
    rep(i,n){
        int x;
        cin >> x;
        if(i%2==0) deq.push_back(x);
        else deq.push_front(x);
    }
    if(n%2!=0) reverse(deq.begin(),deq.end());
    rep(i,n){
        if(i !=n-1) cout << deq[i] << " ";
        else cout << deq[i] << endl;
    } 
    return 0;
}

Measured memory_bytes: 2944
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
ans=[0]*n
for i in range(n):
    for j in range(m):
        ans[i]+=s[i][j]*c[j][0]
for r in ans:
    print(r)


Measured memory_bytes: 6036
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static int N;
        static int[,] Move;
        static int[,] dp;
        static void Main(string[] args)
        {
            var NW = Sarray();
            var N = NW[0];
            var W = NW[1];
            var v = new long[N];
            var w = new long[N];
            for (var i = 0; i < N; ++i)
            {
                var t = Sarray();
                w[i] = t[0];
                v[i] = t[1];
            }
            var V = v.Max() * N;
            var vw = new long[V + 1].Select(_ => long.MaxValue).ToArray();
            for (var i = 0; i < N; ++i)
            {
                for (var j = V; 0 < j; --j)
                {
                    if (vw[j] <= W && j + v[i] <= V)
                        vw[j + v[i]] = Min(vw[j + v[i]], vw[j] + w[i]);
                }
                vw[v[i]] = Min(w[i], vw[v[i]]);
            }
            var max = 0L;
            for (var i = 0; i < V + 1; ++i)
            {
                if (vw[i] <= W && max < i)
                    max = i;
            }
            WriteLine(max);
            
        }
    }
}

Measured memory_bytes: 14560
#include <bits/stdc++.h>
using namespace std;
long long n, w, a[100009], v[100009], dp[109][100009];
int main() {
    cin >> n;
	cin >> w;
    for(int i=1;i<=n;i++){
		cin>>a[i];
    	cin>>v[i];
	}
for(int i=0;i<w;i++)
    dp[0][i] = 0;
 
for (int i =1;i<= n;i++)
    for(int j =1 ;j<=w ;j++)
        if (a[i] > j )
            dp[i][j]=dp[i-1][j];
        else
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-a[i]] + v[i]);
cout<<dp[n][w];
}

Measured memory_bytes: 82176
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1000000007;

int main(){
    int N;
    while(cin >> N){
        vector<long long> dp(N+1, 0);
        dp[0] = 1;
        for(int i=0;i<N;i++){
            char c; cin >> c;
            if(c == '-') continue;
            vector<long long> next(N+1, 0);
            if(c == 'D'){
                for(int i=1;i<=N;i++){
                    next[i] += i * dp[i];
                    next[i] %= MOD;
                    next[i-1] += i * i * dp[i];
                    next[i-1] %= MOD; 
                }
            } else {
                for(int i=0;i<N;i++){
                    next[i] += i * dp[i];
                    next[i] %= MOD;
                    next[i+1] += dp[i];
                    next[i+1] %= MOD; 
                }
            }
            dp = next;
        }
        cout << dp[0] << endl;
    }
}


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

using namespace std;

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

#define pb push_back
#define mp make_pair

int n, m;
const int md = (int)(1e9) + 7;
int x[100010], y[100010];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 0; i < n; i++) cin >> x[i];
    for(int i = 0; i < m; i++) cin >> y[i];
    ll sum1 = 0;
    for(int i = 1; i < n; i++){
        ll len = x[i] - x[i - 1];
        ll cnt = 0;
        ll pos = 0;
        if(i <= (n - 1) / 2) pos = i;
        else pos = n - i;
        cnt = (1 + pos) * pos / 2;
        cnt += pos * (pos - 1) / 2;
        cnt += pos * (n - 2 * pos + 1);
        cnt -= pos;
        sum1 += len * cnt;
        sum1 %= md;
    }
    //cout << sum1 << endl;
    ll sum2 = 0;
    for(int i = 1; i < m; i++){
        ll len = y[i] - y[i - 1];
        ll cnt = 0;
        ll pos = 0;
        if(i <= (m - 1) / 2) pos = i;
        else pos = m - i;
        cnt = (1 + pos) * pos / 2;
        cnt += pos * (pos - 1) / 2;
        cnt += pos * (m - 2 * pos + 1);
        cnt -= pos;
        sum2 += len * cnt;
        sum2 %= md;
    }
    cout << (sum1 * sum2) % md << endl;
    return 0;
}

//2 1

/*1 2 3 4 5
1 + 2 + 3 + 4 + 5 = 15
1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 = 24
1 + 2 + 3 + 2 + 3 + 4 + 3 + 4 + 5 = 27
1 + 2 + 3 + 4 + 2 + 3 + 4 + 5 = 24
1 + 2 + 3 + 4 + 5 = 15
*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    INT(m,f,b);
    if(m+f<b)out("NA");
    else if(m<b&&m+f>=b)out(b-m);
    else out(0);
}


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

int main()
{
    int n, x, y, z, sum;
    cin >> n;
    int arr[n + 1] = {0};
    for(x = 1; x*x <= n; x++){
        for(y = 1; x*x + y*y + x*y <= n; y++){
            for(z = 1; x*x + y*y + z*z + x*y + y*z + z*x <= n; z++){
                arr[x*x + y*y + z*z + x*y + y*z + z*x]++;
            }
        }

    }
    for(int i = 1; i < n + 1; i++){
        cout << arr[i] << endl;
    }


    return 0;
}

Measured memory_bytes: 3624
# 幅優先探索（BFS)
def calc_maze(maze, sh, sw):
    H = len(maze)
    W = len(maze[0])

    # 距離行列
    distance = []
    for i in range(H):
        distance.append([])
        for j in range(W):
            distance[i].append(-1)

    # 座標格納キュー
    # (H座標, W座標, 距離)
    queue = []
    # 初期ポジション格納
    queue.append((sh, sw))
    distance[sh][sw] = 0
    # 最大距離を格納
    max_distance = 0
    # 探索する場所がなくなるまで
    while queue:
        h, w = queue.pop(0)

        for i in range(0, 4):
            nh, nw = h + [1, 0, -1, 0][i], w + [0, 1, 0, -1][i]
            if (0 <= nh and nh < H and 0 <= nw and nw < W and maze[nh][nw] != '#' and distance[nh][nw] == -1):
                queue.append((nh, nw))
                distance[nh][nw] = distance[h][w] + 1
                # 最大距離更新
                if max_distance < (distance[h][w] + 1):
                    max_distance = distance[h][w] + 1
    return max(max(d) for d in distance)



def main():
    H, W = map(int, input().split())
    maze = []
    ans = 0

    for _ in range(H):
        l = list(input())
        maze.append(l)

    for j in range(W):
        for i in range(H):
            if maze[i][j] != "#":
                ans = max(ans, calc_maze(maze, i, j))
    print(ans)
    return 0
if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <stdio.h>
#define N 30000
int main(void){
    int n,i,j,k;
    int a[N];
    j=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        for(k=0;k<1;k++){
            if(i%3==0){
                a[j]=i;
                j++;
                break;
            }
            if(i%10==3){
                a[j]=i;
                j++;
                break;
            }
            if(i%100>=30 && i%100<=39){
                a[j]=i;
                j++;
                break;
            }
            if(i%1000>=300 && i%1000<=399){
                a[j]=i;
                j++;
                break;
            }  
            if(i%10000>=3000 && i%10000<=3999){
                a[j]=i;
                j++;
                break;
            }
            
        }
        
    }
    j=0;
    while(a[j]!=0){
        printf(" %d",a[j]);
        j++;
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2084
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pdd pair<d,d>
#define pdp pair<d,pdd>
#define pb push_back
#define pf push_front
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 103
#define inf LLONG_MAX
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//int mod=1e9+7;
//int mod=998244353;

signed main()
{
    SPEED

    int n;
    cin>>n;
    int h[n+1],dp[n+1]={0},i,j;
    for(i=1;i<=n;++i)
        cin>>h[i];
    dp[2]=abs(h[2]-h[1]);
    for(i=3;i<=n;++i)
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));

    cout<<dp[n];

    return 0;
}


Measured memory_bytes: 1792
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
    
int main(){
    ll N, K, a; cin >> N >> K;
    const ll m = 2000000;
    vl v(m, 0);
    for (ll i = 0; i < N; i++) {
        cin >> a;
        v[a]++;
    }
    
    sort(v.begin(), v.end(), greater<ll>());
    ll ret = 0;
    for (int i = 0; i < K; i++) {
        ret += v[i];
    }
    cout << N - ret << endstr;
    return 0;
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	stack<char> q;
	
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] == '0')
			q.push('0');
		else if(s[i] == '1')
			q.push('1');
		else if(s[i] == 'B')
			if(!q.empty())
				q.pop();
	}
	
	int n = q.size();
	
	if(n > 0)
	{
		stack<char> out;
	
		for(int i = 0; i < n; i++)
		{
			char temp = q.top();
			out.push(temp);
			q.pop();
		}
		
		for(int i = 0; i < n; i++)
		{
			printf("%c", out.top());
			out.pop();
		  }	
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,v,u,x,y,t,p,j;
ll a[205][205],f[405][205][205];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=1;i<=n;i++)for(j=1;j<=m;j++)cin>>a[i][j];
	for(i=1;i<=n+m-1;i++)
	{
		for(x=1;x<=n;x++)
		{
			for(y=1;y<=n;y++)
			{
				v=i-x+1,u=i-y+1;
				if(v<=0 || u<=0)continue;
				//cout<<x<<" "<<v<<" "<<y<<" "<<u<<endl;
				for(t=-1;t<1;t++)
				{
					for(p=-1;p<1;p++)
					{
						f[i][x][y]=max(f[i][x][y],f[i-1][x+t][y+p]);
					}
				}
				f[i][x][y]+=a[x][v]+a[y][u];
				if(x==y && v==u)f[i][x][y]-=a[x][v];
			}
		}
	}
	cout<<f[n+m-1][n][n]<<endl;
    return 0;
}

Measured memory_bytes: 131584
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  int a, b, c;
  cin >> a >> b >> c;

  if ((100*a+10*b+c)%4 == 0) pr("YES");
  else pr("NO");


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define N 4e7
#define nl "\n"
#define f first
#define s second
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back
#define vector<int> VI;
#define vector<long long> VII;

typedef long long ll;
typedef double db;

using namespace std;

int main()
{
    io;
    //freopen("in.txt" , "r" , stdin);
    //freopen("out.txt" , "w" , stdout);

    ///Let the showdown begin

    string str;
    int cnt;
    
    cin >> str;

    if(str[0] =='R' && str[1] == 'R' && str[2] == 'R')
        cnt = 3;
    else if((str[0] =='R' && str[1] == 'R' && str[2] == 'S') || (str[0] =='S' && str[1] == 'R' && str[2] == 'R'))
        cnt = 2;
    else if((str[0] =='S' && str[1] == 'S' && str[2] == 'S'))
        cnt = 0;
    else
        cnt = 1;

    cout << cnt << nl;

    ///Happily DONE
    return 0;
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using lint = long int;

int N;
int dp[10][10] = { 0 };
lint res = 0;


void digit_array(int n){
    int x;
    for(int i = 0; i <= n; i++){
        x = i;
        while(x >= 10) x /= 10;
        ++dp[x][i%10];
    }
}


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

    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++) res += dp[i][j] * dp[j][i];
    }

    cout << res << endl;
    return 0;

}


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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}


int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 10);
    for(ll i = 1;i <= n;i++){
        for(ll j = i;j <= n;j++){
            for(ll k = j;k <= n;k++){
                if(i * i + j * j + k * k + i * j + j * k + k * i > n){
                    break;
                }
                if(i == j && j == k){
                    a[i * i + j * j + k * k + i * j + j * k + k * i]++;
                }
                else if(i == j || j == k || k == i){
                    a[i * i + j * j + k * k + i * j + j * k + k * i] += 3;
                }
                else{
                    a[i * i + j * j + k * k + i * j + j * k + k * i] += 6;
                }
            }
        }
    }

    for(ll i = 0;i < n;i++){
        cout << a[i + 1] << "\n";
    }

    return 0;
}

Measured memory_bytes: 3708
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
  map<ll, vector<ll>> m;
  for(ll i=1; i<=N; i++) {
    vector<ll> v;
    m[i] = v;
  }
  for(ll i=0; i<M; i++) {
    m[a[i]].push_back(b[i]);
    m[b[i]].push_back(a[i]);
  }
  ll ans = 0;
  for(ll i=0; i<M; i++) {
    queue<ll> st;
    vector<ll> vi(N+1, 0);
    st.push(1);
    while(!st.empty()) {
      ll cur = st.front();
      vi[cur] = 1;
      st.pop();
      for(auto x: m[cur]) {
	if((a[i]==x and b[i]==cur) or (a[i]==cur and b[i]==x) or vi[x]==1) continue;
	st.push(x);
      }
    }
    ll f = 0;
    for(ll j=1; j<=N; j++)
      f+=vi[j];
    if(f!=N)
      ans++;
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> a(M);
  std::vector<long long> b(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&a[i]);
    scanf("%lld",&b[i]);
  }
  solve(N, M, std::move(a), std::move(b));
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int A;
	int B;
	int T;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&T);
	int o;
	int i;
	o=0;
	for(i=A;i<T+0.5;i=i+A){
		o=o+B;
	}
	printf("%d",o);
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			// solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();

		int resX = numN * 800;
		int resY = (numN / 15) * 200;

		out.println(resX - resY);
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 20564
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int k=in.nextInt();
        int a=in.nextInt();
        int b=in.nextInt();
        if(b/k*k>(a-1)/k*k)
        System.out.println("OK");
        else
            System.out.println("NG");
    }
}


Measured memory_bytes: 35580
#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))

using P = pair<int, int>;

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

    int n;
    cin >> n;
    vector< P > wv;
    int l, r;
    int p;
    rep (i, n)
    {
        cin >> l >> r >> p;
        for (int j = l; j <= r; ++j)
        {
            wv.emplace_back(j, p);
        }
    }

    vs32 dp(394, 0);
    rep (i, wv.size())
    {
        for (int j = wv[i].first; j <= 393; ++j)
        {
            dp[j] = MAX(dp[j], dp[j - wv[i].first] + wv[i].second);
        }
    }

    int m;
    cin >> m;
    vs32 w(m);
    rep (i, m)
    {
        cin >> w[i];
        if (dp[w[i]] == 0)
        {
            cout << "-1\n";
            return 0;
        }
    }

    rep (i, m)
    {
        cout << dp[w[i]] << "\n";
    }

    return 0;
}



Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0) , ios_base :: sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge()
{
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}

vector<ll> pyr;
void cal()
{
	for (ll h = 1; h < 100001; ++h)
	{
		ll val = (3 * h * h + h) / 2;
		pyr.pb((val));
	}
}


void go() {
	fast;
	ll n , k;
	cin >> n >> k;
	ll a[n];
	for (int i = 0; i < n; ++i)cin >> a[i];
	ll g[k + 1];
	for (int i = 0; i <= k; ++i)g[i] = -1;
	g[0] = 0;
	for (int i = 0; i < n; ++i) {
		g[a[i]] = 1;
	}
	for (int i = 1; i <= k; ++i)
	{
		if (g[i] != -1)continue;
		set<ll> s;
		for (int j = 0; j < n; ++j)
		{
			if (a[j] > i)break;
			//cout << a[j] << " ";
			//cout << g[i - a[j]] << ";";
			s.insert(g[i - a[j]]);
		}
		for (int j = 0; j < 102; ++j)
		{
			if (!s.count(j))
			{
				g[i] = j;
				break;
			}
		}
		//cout << i << " " << g[i] << endl;
	}
	if (g[k] == 0)cout << "Second";
	else cout << "First";
}


int main() {
	fast;
	//online_judge();
	//cout << 2332;
	go();
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
using namespace std;

int main()
{
    int n, m, i = 0, key = 0;
    string a, b;
    
    cin >> a >> b;
    
    n = a.size();
    m = b.size();
    
    if(n > m) {
        key = 1;
    } else if(n < m) {
        key = 2;
    }
    
    while((key == 0) && (i < n)) {
        
        if(a[i] > b[i]) {
            key = 1;
        } else if(a[i] < b[i]) {
            key = 2;
        }
        i++;
    }
    
    if(key == 0) {
        cout << "EQUAL\n";
    } else if(key == 1) {
        cout << "GREATER\n";
    } else if(key == 2) {
        cout << "LESS\n";
    }
    
    return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS

int main(int argc, char const *argv[])
{
	int a,b;
	int n,keta[5],cnt = 0;
	scanf("%d%d",&a,&b);
	for (int i = a; i <= b; ++i)
	{
	  n = i;
		for (int j = 4; j >= 0; --j)
		{
			keta[j] = n % 10;
		  n /= 10;
		}
		if(keta[0] == keta[4] && keta[1] == keta[3])	++cnt;
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
using System;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Collections.Generic;

//

namespace Kyoupro
{
    class Program
    {
        
        static void Main(string[] args)
        {    
            //整数の数を取得
            int N = int.Parse(Console.ReadLine());

            //空白区切り一行
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
            
            int count = 0;

            while(input.All(x => x%2 ==0))
            {
                input = input.Select(x => x/2);
                // foreach(var n in input)
                // {
                //     Console.Write("{0} ",n);
                // }
                // Console.WriteLine();
                count++;
            }

            Console.WriteLine(count);

        }
    }
}


Measured memory_bytes: 11348
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let v: Vec<u64> = s.trim().split(" ").map(|x| x.parse().unwrap()).collect();
    let mut x: u64 = v[0];
    let mut i: usize = 0;
    loop {
        if x > v[1] {break;}
        i += 1;
        x *= 2;
    }
    println!("{}", i);
}



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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    string s;
    cin >> s;
    vector<string> v = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    cout << 7 - distance(v.begin(), find(all(v), s)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

#define pbds tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 
const int mxN = 15; 
int p[mxN], num_of_lights_on[mxN];
vector<int> adj[mxN]; 
bool switches[mxN];
int n,m;

bool check(){
    memset(num_of_lights_on,0,sizeof(num_of_lights_on));
    FOR(i,m){
        for(auto neigh : adj[i]){
            num_of_lights_on[i] += switches[neigh];
        }
        if(num_of_lights_on[i]%2 != p[i]) return 0;
    }
    return 1;
}

void solve(){
    cin >> n >> m;
    FOR(i,m){
        int k; cin >> k;
        FOR(_,k){
            int s; cin >> s;
            --s;
            adj[i].pb(s);
        }
    }
    FOR(m) cin >> p[i];
    int ans = 0;
    FOR(i,pow(2,n)){
        FOR(j,n){
            switches[j] = (i >> j) & 1;
        }
        ans += check();
    }
    cout << ans;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	solve();
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
#define pb push_back
 const ll mod = 1000000007;

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

	vector<vector<int>> V(N);

	for(int i = 0; i < N-1; i++){
		ll a, b;
		cin >> a >> b;
		a--;b--;
		V[a].push_back(b);
		V[b].push_back(a);
	}

	queue<int> child; 

	ll s = K;

	int len = V[0].size();
	if(len >= K ){
		cout << 0 << endl;
		return 0;
	}

	for(int i = 0; i < len; i++){
		s *= K - 1 - i;
		s %= mod;
	}

	vector<bool> used(N, false);
	used[0] = true;

	for(int v: V[0]){
		child.push(v);
		used[v] = true;
	}

	while(child.empty() == false){
		int v = child.front();
		child.pop();
		len = V[v].size();

		for(int i = 0; i < len-1; i++){
			s *= K - 2 - i;
			s %= mod;
		}

		for(int w: V[v]){
			if(used[w] == false){
				child.push(w);
				used[w] = true;
			}
		}
	}

	cout << s << endl;

	return 0;
 }



Measured memory_bytes: 6520
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ArrayList<Integer> row = new ArrayList<>();
        ArrayList<Integer> col = new ArrayList<>();

        Scanner inp = new Scanner(System.in);

        int total = 0;

        int end = 1;
        while (end != 0) {
            int num1 = inp.nextInt();
            int num2 = inp.nextInt();

            if (num1 == 0 && num2 == 0) {
                end = 0;
            } else {
                row.add(num1);
                col.add(num2);

                total++;
            }
        }

        for (int i = 0; i < total; i++) {
            int ro = row.get(i);
            int co = col.get(i);

            for (int r = 0; r < ro; r++) {
                for (int c = 0; c < co; c++) {
                    if (c == 0 || c == co-1 || r == 0 || r == ro-1) {
                        System.out.print("#");
                    } else {
                        System.out.print(".");
                    }
                }

                System.out.print("\n");
            }
            System.out.print("\n");
        }
    }
}



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

n, a, b = [int(x) for x in input().split()]

if a == 0:
    print(0)
    sys.exit()

if b == 0:
    print(n)
    sys.exit()

ab = a + b

n_ab = n // ab

ans = n_ab * a

remain = n - ab * n_ab

ans += min(a, remain)

print(ans)

Measured memory_bytes: 38384
N,K=map(int,input().split())
p=list(map(int,input().split()))
for i in range(N):
    p[i]=(p[i]+1)/2
a=[0]
for i in range(N):
    a.append(a[-1]+p[i])
ans=0
for i in range(N-K+1):
    ans=max(ans,a[i+K]-a[i])
print(ans)


Measured memory_bytes: 32032
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int main(){

	ll N,tmp,sum,num;
	priority_queue<ll> Q;

	while(true){
		scanf("%lld",&N);
		if(N == 0)break;

		sum = 0;
		num = N;

		while(!Q.empty())Q.pop();

		for(int i = 0; i < N; i++){
			scanf("%lld",&tmp);
			sum += tmp;
		}

		for(int i = 0; i < N-1; i++){
			scanf("%lld",&tmp);
			Q.push(tmp);
		}

		while((num-1)*(sum+Q.top()) > num*sum){
			sum += Q.top();
			num--;
			Q.pop();
		}

		printf("%lld\n",num*sum);
	}
	return 0;
}

Measured memory_bytes: 3036
import time
import random
import math
def sigmoid(x):
  return 1/(1+math.exp(-x))
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=1000
while nt-st<1.50:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**2)-0.5)>random.random():
    os=ns
    ans=na
  
  


for i in ans:
  print(i+1)

Measured memory_bytes: 85100
N = int(input())

ABC = []

for i in range(N):
	abc = list(map(int,input().split()))
	ABC.append(abc)

dp = []

for i in range(N):
	dp.append([0,0,0])

dp[0] = ABC[0]

for i in range(N-1):
	for j in range(3):
		for k in range(3):
			if j!=k:
				dp[i+1][k] = max(dp[i+1][k], dp[i][j] + ABC[i+1][k])

print(max(dp[N-1]))

Measured memory_bytes: 47360
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll x,y;
        cin>>x>>y;
        if(x+y==2)cout<<1000000<<endl;
        else{
            x=4-x;
            y=4-y;
            chmax(x,0LL);
            chmax(y,0LL);
            cout<<(x+y)*100000<<endl;
        }
    }

Measured memory_bytes: 256
import sys
A=[]
ans=[False for _ in range(9)]
for _ in range(3):
    A.extend([int(i) for i in input().split()])
n=int(input())
b=[]
for _ in range(n):
    b.append(int(input()))
for i in range(9):
    if A[i] in b:
        ans[i] =True
        
rule=[(0,3,6),(1,4,7),(2,5,8),(0,4,8),(2,4,6),(0,1,2),(3,4,5),(6,7,8)]
for r in rule:
    for n in r:
        if ans[n]:
            pass
        else:
            break
    else:
        print("Yes")
        sys.exit()
else:
    print("No")
    sys.exit()

Measured memory_bytes: 38256
def main():
    s = input().rstrip()
    begin, end = 0, 0
    ans = 0
    for i in range(len(s)):
        if s[i] == "B":
            end = i
        else:
            end = i
            ans += end - begin
            begin += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define assem99 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define endll '\n'
#define sz(a) (int)(a).size()
#define RWFile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int dx[] = { 0, -1, 0, 1, -1, 1, -1, 1 };
int dy[] = { -1, 0, 1, 0, 1, -1, -1, 1 };
const int MOD = 1e8, N = 2e5 + 5, oo = 1e9;
const double pi = acos(-1);
using namespace std;

int main()
{
    assem99
    int n; cin>>n;
    int ans = oo;
    for(int i = 0; i < n; i++)
    {
        int a; cin>>a;
        int cnt = 0;
        while(a % 2 == 0)
        {
            cnt++;
            a /= 2;
        }
        ans = min(cnt, ans);
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}
template<typename T>
T lcm( T m, T n )
{
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    long long X,current=0,ans=0;

    cin >> X;

    for(long long i=1; i<=X; i++){
        current+=i;
        if(current<X){
            ans++;
        }
    }

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



Measured memory_bytes: 256
package main

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

var dp [3001][3001][4]int

func main() {
	R, C, K := ReadInt(), ReadInt(), ReadInt()
	grid := make([][]int, R+1)
	for i := 0; i <= R; i++ {
		grid[i] = make([]int, C+1)
	}
	for i := 0; i < K; i++ {
		r, c, v := ReadInt(), ReadInt(), ReadInt()
		grid[r][c] = v
	}

	for i := 1; i <= R; i++ {
		for j := 1; j <= C; j++ {
			for k := 0; k <= 3; k++ {
				dp[i][j][k] = dp[i][j-1][k]
				if k > 0 {
					dp[i][j][k] = Max(dp[i][j][k], dp[i][j-1][k-1]+grid[i][j])
					if k == 1 {
						for l := 0; l <= 3; l++ {
							dp[i][j][k] = Max(dp[i][j][k], dp[i-1][j][l]+grid[i][j])
						}
					}
				} else {
					dp[i][j][k] = Max(dp[i][j][k], dp[i-1][j][k])
				}
			}
		}
	}
	fmt.Println(Max(dp[R][C][:]...))
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 369088
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
int main(void){
    string S,T;
    cin>>S>>T;
    if(T.length()-S.length()==1 && T.substr(0,S.length())==S && isalpha(T[T.length()-1])!=0 && islower(T[T.length()-1])!=0) printf("Yes\n");
    else printf("No\n");
    return 0;
    
}

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

int main(){

	int H, W;

	cin >> H >> W;

	while( H != 0 && W != 0){			//W=0とH=0になるまで繰り返す
		for(int i = 1; i <= H; i++){		//縦軸に[＊]を増やして行く
			for(int j = 1; j <= W; j++){	//横軸に[＊]を増やして行く
				cout << ".#"[(i+j)%2 == 0];	// [#]のマークがあるときの条件を　[ この中に条件を入れる ]　※下記見て！！！
			}
			cout << endl ;
		}
		cout << endl;
		cin >> H >> W;
	}

	return 0;
}

// ※「,」と「#」が来る条件を考える。どちらか来たらどちらか来ない。「#」が来てるときは「i+j=偶数のとき」に気が付くのがポイント


Measured memory_bytes: 3104
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 1001001001
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main(){
    const int mod = 2019;
    ll l,r; cin >> l >> r;
    r = min(r, l+2019);
    ll ans = INF;
    for(ll i=l; i<=r; i++){
        for(ll j=i+1; j<=r; j++){
            ll temp = (i*j)%mod;
            ans = min(ans, temp);
        }
    }
    
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long;
using namespace std;
int a[3002][3002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s1=" ",s2=" ",s;
    cin>>s;
    s1+=s;
    cin>>s;
    s2+=s;
    //cout<<s1<<"\n";
    //cout<<s2<<"\n";
    
    for(int i=1;i<s1.size();i++)
    {
        for(int j=1;j<s2.size();j++)
        {
            
            if(s1[i]==s2[j])
             a[i][j]=1+a[i-1][j-1];
            else
             a[i][j]=max(a[i-1][j],a[i][j-1]);
        }
    }
    string ans;
     int i=s1.size()-1;
     int j=s2.size()-1;
      
        while(i>0&&j>0)
          {
                  if(s1[i]==s2[j])
                     {ans+=s1[i];i--;j--;}
    
    
                      else if(a[i][j-1]>a[i-1][j])
                         j--;
                      else
                         i--;
                
          }
     
     for(i=ans.size()-1;i>=0;i--)
     cout<<ans[i];
}

Measured memory_bytes: 35456
#include<iostream>
#include<sstream>

using namespace std;

string byeFront(string str) {
  string ans;
  for(int i=1; i<str.length(); i++) {
    ans += str[i];
  }
  return ans;
}

int toInt(string str) {
  int ans = 0;
  int tmp = 1;
  for(int i=0; i<str.length(); i++) {
    if(str[i] == 'm') {
      ans += tmp*1000;
      tmp = 1;
      //cout<<"m"<<endl;
    }
    else if(str[i] == 'c') {
      ans += tmp*100;
      tmp = 1;
      //cout<<"c"<<endl;
    }
    else if(str[i] == 'x') {
      ans += tmp*10;
      tmp = 1;
      //cout<<"x"<<endl;
    }
    else if(str[i] == 'i') {
      ans += tmp;
      tmp = 1;
      //cout<<"i"<<endl;
    }
    else {
      stringstream ss;
      ss<<str[i];
      ss>>tmp;
      //cout<<"++"<<endl;
    }
    //cout<<ans<<endl;
  }
  return ans;
}

string toMCXI(int num) {
  string ans, str;
  stringstream ss;
  ss<<num;
  ss>>str;
  
  string nextStr;
  if(str.length() == 4) {
    nextStr = "m";
  }
  else if(str.length() == 3) {
    nextStr = "c";
  }
  else if(str.length() == 2) {
    nextStr = "x";
  }
  else if(str.length() == 1) {
    nextStr = "i"; 
  }
  
  int orgLength = str.length();
  string strrr = str;
  for(int i=0; i<orgLength; i++) {
    //cout<<str[i]<<"!";
    if(str[i]!='0' && str[i]!='1') {
      ans += str[i];
      ans += nextStr;
    }
    else if(str[i] == '1') {
      ans += nextStr;
    }

    strrr = byeFront(strrr);
    if(strrr.length() == 3) {
      nextStr = "c";
    }
    else if(strrr.length() == 2) {
      nextStr = "x";
    }
    else {
      nextStr = "i";
    }
    //cout<<i<<" : "<<ans<<endl;
  }
  return ans;
}

int main() {
  /*
  string sampleStr = "m2ci";
  cout<<sampleStr<<endl;
  cout<<toInt(sampleStr)<<endl;
  cout<<toMCXI(toInt(sampleStr))<<endl;
  */

  int n;
  cin>>n;
  for(int i=0; i<n; i++) {
    string strA, strB;
    cin>>strA>>strB;
    int numA = toInt(strA);
    int numB = toInt(strB);
    //cout<<strA<<endl;
    //cout<<numA<<endl;
    cout<<toMCXI(numA+numB)<<endl;
  }
}

Measured memory_bytes: 1228