akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
int main()
{
    int n;
    cin>>n;
    vector<pair<int,bool> > v[20];
    for(int i=0;i<n;i++)
    {
        int k;
        cin>>k;
        for(int j=0;j<k;j++)
        {
            int x;
            bool y;
            cin>>x>>y;
            v[i].push_back({x-1,y});
        }
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        int p[20]={0};
        bool flag=1;
        for(int j=0;j<n;j++)
        {
            //cout<<"I"<<i<<'\n';
            if(i&(1<<j))
            {

                for(int k=0;k<v[j].size();k++)
                {
                    bool y=(1<<(v[j][k].F))&i;
                    //cout<<y<<' '<<v[j][k].S<<'\n';
                    if(v[j][k].S!=y)
                    {
                        flag=0;
                        //cout<<i<<'\n';
                        break;
                    }

                }
            }
            if(!flag) break;
        }
        if(flag) ans=max(ans,__builtin_popcount(i));
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 256
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 998244353;
 
////////////////////////////////////////////////////////////////////
 
const int N = 3e2 + 5;

int A[N], DP[N][N][N];

void Add(int &x, int y) {
	x += y;
	if (x >= MOD) x -= MOD;
}

int main() {
 
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	string S; cin >> S;
	int m = 1, o = 0;
	for (char c : S) if (c == '0') m++; else A[m - 1]++, o++;
	reverse(A, A + m);
	DP[0][0][0] = 1;
	for (int i = 0; i < m; i++) for (int j = 0; j <= o; j++) for (int k = 0; k <= o; k++) {
		if (!DP[i][j][k]) continue;
		for (int l = 0; l <= A[i] + k; l++) Add(DP[i + 1][j + max(A[i] - l, 0)][k + A[i] - l], DP[i][j][k]);
	}
	int k; cin >> k;
	k = min(k, o);
	int ans = 0;
	for (int i = 0; i <= k; i++) Add(ans, DP[m][i][0]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 30712
#include <iostream>
int main(){
    int a, b, c;
    std::cin >> a >> b >> c;
    int max = 0, sec = 0, min = 0;
    if(a > b){
        max = a;
        min = b;
    }else{
        max = b;
        min = a;
    }
    if(max < c){
        sec = max;
        max = c;
    }else if(min > c){
        sec = min;
        min = c;
    }else{
        sec = c;
    }
    std::cout << min << " " << sec << " " << max << std::endl;
}


Measured memory_bytes: 3068
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	    Scanner scanner = new Scanner(System.in);

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

}

Measured memory_bytes: 35528
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n,cnt=0;
  bool ans=true;
  std::cin >> n;
  ll a[200];

  for(int i=0; i<n; i++) std::cin >> a[i];
  while(ans){
    for(int i=0; i<n; i++){
      if(a[i]%2==0) a[i]/=2;
      else {
        ans=false; break;
      }
    }
    cnt++;
  }
  std::cout << cnt-1 << '\n';

  
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import numpy as np
import bisect
left = bisect.bisect_left
right = bisect.bisect_right

def question():
    n, q = list(map(int, input().split()))
    s = input()
    lr = [list(map(int, input().split())) for i in range(q)]
    a = [i for i in range(n-1) if s[i:i+2]=="AC"]

    for i in range(q):
        left_index = left(a, lr[i][0]-1)
        right_index = right(a, lr[i][1]-2)
        print(right_index - left_index)

question()

Measured memory_bytes: 39272
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

from collections import deque

M,K = LI()

if M == 0:
    if K == 0:
        print(0,0)
    else:
        print(-1)
    exit()

if M == 1:
    if K == 0:
        print(0,0,1,1)
    else:
        print(-1)
    exit()

if K >= 2**M:
    print(-1)
else:
    A = deque([K])
    for i in range(2**M):
        if i == K:
            continue
        else:
            A.appendleft(i)
            A.append(i)
    A.append(K)
    print(*A)

Measured memory_bytes: 56680
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
using ll = long long;
ll MOD = 1e9+7;


int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;
    if(a*b == 15){
        cout << "*" << endl;
    }else if(a+b == 15){
        cout << "+" << endl;
    }else{
        cout << "x" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int A,B,C;
  scanf("%d%d%d",&A,&B,&C);
  
  if(A>=B&&A>=C)
        printf("%d",B+C);
  else if(B>=A&&B>=C)
  		printf("%d",A+C);
  else
    printf("%d",A+B);
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    string x;
    cin >> x;

    for (int i = 0; i < n; i++) {
        x[i] -= '0';
    }

    int c = 0;
    for (int i = 0; i < n; i++) {
        c += x[i];
    }

    //各ビット位置についてc-1とc+1で割ったあまりを求める
    vector<int> a[2];
    int d[2];
    ll s[2] = {};
    for (int h = 0; h < 2; h++) {
        a[h] = vector<int>(n);
        d[h] = h == 0 ? c + 1 : c - 1;
        if (d[h] < 1) continue;
        int t = 1;
        for (int i = 0; i < n; i++) {
            t %= d[h];
            a[h][n - 1 - i] = t;
            s[h] += t * x[n - 1 - i];
            t *= 2;
        }
        s[h] %= d[h];
    }

    vector<int> f(c + 1, 0);
    for (int i = 1; i < c + 1; i++) {
        int k = 0, t = i;
        for (; t; k++) {
            t %= __builtin_popcountll(t);
        }
        f[i] = k;
        //cout << i << ' ' << k << endl;
    }

    for (int i = 0; i < n; i++) {
        int h = x[i], sgn = h == 0 ? 1 : -1;
        if (d[h] < 1) {
            cout << 0 << '\n';
        } else {
            int t = (s[h] + a[h][i] * sgn + d[h]) % d[h];
            cout << f[t] + 1 << '\n';
        }
    }

    //__builtin_popcountll

    return 0;
}

Measured memory_bytes: 5416
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = s[0];
        int q = s[1];
        Queue<string> que1 = new Queue<string>();
        Queue<int> que2 = new Queue<int>();
        for (int i = 0; i<n; i ++) {
            string[] str = Console.ReadLine().Split().ToArray();
            que1.Enqueue(str[0]);
            que2.Enqueue(int.Parse(str[1]));
        }
        int time = 0;
        while(que2.Count != 0) {
            if (que2.Peek()-q > 0) {
                time += q;
                que1.Enqueue(que1.Dequeue());
                que2.Enqueue(que2.Dequeue()-q);
            }
            else {
                time += que2.Dequeue();
                Console.WriteLine(que1.Dequeue() + " " + time);
            }
        }
    }
}


Measured memory_bytes: 21744
#include <bits/stdc++.h>
using namespace std;
 
// vector<int> vec(3); = vector<int> vec={0,0,0}
// vec.at()
// sort(num.begin(),num.end(), greater<int>());
// reverse(num.begin(),num.end());
 
// 切り上げ　a/b+1
//  1からNの総和　N*(N+1)/2
 
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;

  if(A*B > C*D){
  	cout << A*B << endl;
  }else{
    cout << C*D << endl;
  }
}

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 1e15;
const int MB = 30;
const int MOD = 1e9 + 7;

void solve() {
	int x;
	cin >> x;
	if (x >= 30) cout << "Yes";
	else cout << "No";
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, l;
  cin >> n >> l;
  int ans = 0;
  int c;
  if(l - 1 >= 0){
    for(int i = 2; i <= n; ++i) ans += l - 1 + i;
  }
  else {
    c = abs(l - 1) > n ? n : abs(l - 1); 
    for(int i = 1; i <= n; ++i){
      if(c == i) continue;
      ans += l - 1 + i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,C,K;
    cin >> N >> C >> K;
    int T[N];
    rep(i,N) cin >> T[i];
    sort(T,T+N);
    int ans=0;
    int p=0;
    int count=0;
    rep(i,N){
        if(count==0){
            count++;
            ans++;
            p=T[i];
        }else if(T[i]-p<=K){
            count++;
        }else{
            ans++;
            count=1;
            p=T[i];
        }

        if(count==C){
            count=0;
        }

    }
    cout << ans << endl;




}


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

long long N, M;
vector<long long> switchvec[10];
long long p[10];

int main(){
	cin >> N >> M;
	for(long long i = 0; i < M; i++){
		long long k;
		cin >> k;
		for(long long j = 0; j < k; j++){
			long long s;
			cin >> s;s--;
			switchvec[i].push_back(s);
		}
	}

	for(long long i = 0; i < M; i++){
		cin >> p[i];
	}

	long long ans = 0;
	for(long long pat = 0; pat < (1<<N); pat++){
		bool ok = true;

		for(long long i = 0; i < M; i++){
			long long switchcount = 0;
			for(long long j = 0; j < switchvec[i].size(); j++){
				long long s = switchvec[i][j];
				if((pat>>s) & 1) {
					switchcount++;
				}
			}
			if(switchcount%2 != p[i]){
				ok = false;
				break;
			}
		}

		if(ok){
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int *p, int *q){
  int tmp;
  tmp = *p;
  *p = *q;
  *q = tmp;
}

void quick_sort(int A[], int n){
  int i, j, pivot;
  if(n <= 1) return;

  pivot = A[n/2];
  A[n/2] = A[0];
  A[0] = pivot;
  for(i = j = 1; i < n; i++){
    if(A[i] <= pivot){
      swap(A+i, A+j);
      j++;
    }

  }
  swap(A, A+j-1);

  quick_sort(A, j-1);
  quick_sort(A+j, n-j);
}


int main(void){
  int n;
  int l[200];
  scanf("%d\n", &n);
  for(int i = 0; i < n; i++) scanf("%d", &l[i]);
  quick_sort(l, n);
  int x = 0;
  if(n >= 3){
    int s = 0;
    int t = 0;
    int r = 0;

    while(s < n - 2){
      t = s + 1;
      while(t < n - 1){
        if(l[s] != l[t]){
          r = t + 1;
          while(r < n){
            if(l[t] != l[r]){
              if(l[r] < l[s] + l[t]) x++;
            }
            r++;
          }
        }
        t++;
      }
      s++;
    }
  }

  printf("%d\n", x);
}

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

#define what_is(x) cout << #x << " is " << x << endl;
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 10
#define N 500001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX];
ll fact[MAX];

const long long INF64 = 1e18;
ll vpow(ll a,ll b,ll p){
    if(b==0)
        return 1;
    if(b==1)
            return a;
    ll temp=vpow(a,b/2,p);
    temp*=temp;
    temp%=p;
    if(b%2==0)
        return temp;
    temp=temp*a;
    temp%=p;
    return temp;
}

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


ll inverseMod(ll a,ll b,ll p){
    if(b==0)
        return 1;
    ll temp=vpow(b,p-2,p);
    ll ans=temp*a;
    ans%=p;
    return ans;
}
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
ll max(ll a, ll b)
{
    return a>b?a:b;
}

void factorial(){
    fact[0]=1;
    fact[1]=1;
    rep(i,2,MAX){
        fact[i]=(fact[i-1]*i);
        // fact[i]%=M;
    }
}
ll rand(ll a,ll b){
    return a+rand()%(b-a+1);
}

void solve(ll ttt)
{
    ll n,i,a,b,count=0;
    bool flag=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        if(a==b)
            count++;
        else
            count=0;
        if(count>=3)
            flag=1;
    }
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

int main(){
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    //
    //freopen("input1.txt","r",stdin);
    // freopen("output1.txt","w",stdout);
#endif
    ll t=1;
     //cin>>t;
    fix(12);
    rep(q,1,t+1){
         //cout<<"Case #"<<q<<": ";
         //cout<<"Test Case : "<<q<<endl;
         solve(q);
    }
    return 0;

}




Measured memory_bytes: 3652
import math
N, D = map(int, input().split())

lst = []
for _ in range(N):
    lst += [list(map(int, input().split()))]

# print (lst)

def length(lst1, lst2):
    d = 0
    for i in range(D):
        d += (lst1[i] - lst2[i]) ** 2
    return math.sqrt(d)

count = 0
for i in range(N):
    for j in range(i+1, N):
        a = length(lst[i], lst[j])
        if a ** 2 == (int(a)) ** 2:
            count += 1

print (count)

Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sn = new Scanner(System.in);
		int N = sn.nextInt();
		int A = sn.nextInt();
		int x[] = new int[52];
		long[][][] dp = new long[50+2][50+2][50*50+2];
		int max_x = -1;
		for(int i = 0;i < N;++i){
			x[i] = sn.nextInt();
			max_x = Math.max(x[i],max_x);
		}
		
		for(int j = 0; j <= N; ++j){
			for(int k = 0; k <= N; ++k){
				for(int s = 0; s <= N*N; ++s){
					dp[j][k][s] = 0;
				}
			}
			dp[j][0][0] = 1;
		}
		
		for(int j = 1; j <= N; ++j){
			for(int k = 1; k <= N; ++k){
				for(int s = 1; s <= N*max_x; ++s){					
					if(s < x[j-1]) dp[j][k][s] = dp[j-1][k][s];
					else{
						dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]];
					}					
				}
			}
		}
		/*
		for(int j = 0; j <= N ;++j){
			for(int s = 0; s <=  N*max_x; ++s){
				System.out.print(dp[j][1][s]);
				System.out.print(' ');
			}
			System.out.println();
		}
		*/
		long ans = 0;
		for(int k = 1; k <= N; ++k){
			ans += dp[N][k][k*A];
		}		
		System.out.println(ans);
	}
}


Measured memory_bytes: 68168
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};
int A[100010], B[100010];
ll ans[100010];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i];
		A[i]--; B[i]--;
	}
	ans[M - 1] = (ll)N * (N - 1) / 2;
	UnionFind uf(N);
	for (int i = M - 1; i > 0; i--) {
		ans[i - 1] = ans[i];
		if (!uf.issame(A[i], B[i])) ans[i - 1] -= (ll)uf.size(A[i]) * uf.size(B[i]);
		uf.merge(A[i], B[i]);
	}
	for (int i = 0; i < M; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 5188
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;


int main(void){
  
  int N,M,ans=0;
  vector<int> A,B;

  
  
  cin >> N;

  for(int i = 0; i < N-1 ;i++){
    int tmp;
    cin >> tmp;
    A.push_back(tmp);
  }

    for(int i = 0; i < N ;i++){
    B.push_back(0);
  }

  for(int i = 0; i < N-1 ;i++){
    B.at(A.at(i)-1)++;
  }

  for(int i = 0; i < N ;i++){
    cout << B.at(i) << endl;
  }
  

  return 0;
}




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

int main()
{
    string s1;
    cin >> s1;
    int q;
    cin >> q;
    string s2;
    rep(i, q)
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            swap(s1, s2);
        }
        else
        {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1)
            {
                s2 += c;
            }
            else
            {
                s1 += c;
            }
        }
    }
    reverse(s2.begin(), s2.end());
    cout << s2 << s1 << endl;
}

Measured memory_bytes: 960
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;

LL a[5050]; int n, x[55], y[55];
int main()
{
	int i, j, k;
	scanf("%d", &n);
	for(i = 1; i <= n; i ++)
		scanf("%d%d", &x[i], &y[i]);
	for(i = 1; i <= n; i ++){
		for(j = 1; j <= n; j ++){
			if(i == j) continue;
			a[++ a[0]] = (x[i] - x[j] + 2000000000ll) * 5000000000ll + (y[i] - y[j] + 2000000000ll);
		}
	}
	sort(a + 1, a + a[0] + 1);
	for(i = j = 1, k = 0; i <= a[0];){
		while(j <= a[0] && a[j] == a[i])
			j ++;
		k = max(k, j - i);
		i = j;
	}
	cout << n - k;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using ll=long long;
using namespace std;



int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

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

using namespace std;

int main() {
    int n,t; cin >> n >> t;
    vector<pair<int, int>> ct;
    for(int i=0; i < n; i++) {
        int a,b; cin >> a >> b;
        if(t >= b) {
            ct.push_back(make_pair(a,b));
        }
    }

    // sort(ct.begin(), ct.end());
    int ans = 10000; // INF
    for(int i=0; i < ct.size(); i++) {
        if(ans > ct[i].first) {
            ans = ct[i].first;
        }
    }

    if(ans != 10000) {
        cout << ans << endl;
    } else {
        cout << "TLE" << endl;
    }

}

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

int main(){
    int n;
    cin >> n;
    vll a(n);
    map<ll,ll> mp;
    map<ll,ll> mp2;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        mp[i+a[i]]++;
        mp2[i-a[i]]++;
    }
    ll ans=0;
    for(auto x:mp){
        ans+=x.second*mp2[x.first];
    }
    cout << ans << endl;
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b; cin >> a >> b;
  int ans = 0;
  for(int i = 1; i < a; i++){
    for(int j = 1; j <= 31; j++){
      if(i == j) ans++;
    }
  }
  for(int i = 1; i <= b; i++){
    if(a == i) ans++;
  }
  cout << ans << endl;
}


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

int main() {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    int sum = (c - a - 1) * 60 + 60 - b + d;
    cout << sum - k << endl;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main()
{
    int n;cin>>n;
    map<string,LL> mp;
    REP(i,n){
        string s;cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

bool is_prime(int x) {
  if (x <= 1) return false;
  for (int i = 2; i*i <= x; ++i) {
    if (x%i == 0) return false;
  }
  return true;
}

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

  int p = x;
  while (!is_prime(p)) p++;

  cout << p << endl;
  return 0;
}

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

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

	ll	a, b;
	cin >> a >> b;
	ll	lowest;
	lowest = min(a, b);
	ll	ans;
	ans = b - a;
	rep(i, N - 2)
	{
		ll	x;
		cin >> x;
		if (x - lowest > ans)
			ans = x - lowest;
		if (x < lowest)
			lowest = x;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3132
fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    val t = readInputLine().toCharArray()
    
    for (i in 0 until s.size) {
        var res = true
        for (j in i until i + s.size) {
            if (s[j % s.size] != t[j - i]) {
                res = false
                break
            }
        }
        if (res) {
            println("Yes")
            return
        }
    }
    
    println("No")
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> count(N,0);
    for(int i = 0;i<M;i++){
        int a,b;
        cin >> a >> b;
        count.at(a-1) += 1;
        count.at(b-1) += 1;
    }
    for(int i = 0;i<N;i++){
        cout << count.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
#reference : http://qiita.com/clarinet758/items/53e31ec10b873975438b
#reference : #1511943 Solution for ITP1_1_C: Rectangle by Signorte
# print "%d %d" % (s ,l) => ERROR

a, b = map(int, raw_input().split())

s = a * b
l = 2 * (a + b)

print "%s %s" % (str(s) ,str(l))

Measured memory_bytes: 6332
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(list)
for i in range(m):
  a, b = map(int, input().split())
  d[a].append(b)
ans = ''
for mid in d[1]:
  if ans == '':
    for goal in d[mid]:
      if goal == n:
        ans = 'POSSIBLE'
        break
if ans == '':
  ans = 'IMPOSSIBLE'
print(ans)

Measured memory_bytes: 48816
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
 
using namespace std;
 
inline int read()
{
	int x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}
 
const int N=500009;
const int K=25;  

int n,k,ind[N];
int p[N],q[N];
int ch[N*K][2],cnt[N*K],tot;
int to[N<<1],nxt[N<<1],beg[N],tots;
priority_queue<int,vector<int>,greater<int> > f;

inline void adde(int u,int v)
{
	to[++tots]=v;
	nxt[tots]=beg[u];
	beg[u]=tots;
}
 
inline void add(int x,int v)
{
	int now=0;
	cnt[now]+=v;
	for(int i=K,nxt;i>=0;i--)
	{
		if(!ch[now][(nxt=((x>>i)&1))])
			ch[now][nxt]=++tot;
		now=ch[now][nxt];
		cnt[now]+=v;
	}
}

inline int ranks(int x)
{
	int now=0,ret=0;
	for(int i=K,nxt;i>=0;i--)
	{
		if((nxt=((x>>i)&1)) && ch[now][0])
			ret+=cnt[ch[now][0]];
		now=ch[now][nxt];
	}
	return ret+1;
}

inline int query(int kth)
{
	if(kth>cnt[0])return -1;
	int now=0,ret=0,f=0;
	for(int i=K,nxt;i>=0;i--)
	{
		if(ch[now][0] && cnt[ch[now][0]]>=kth)
			nxt=0;
		else
		{
			nxt=1;
			if(ch[now][0])
				kth-=cnt[ch[now][0]];
			ret|=(1<<i);
		}
		now=ch[now][nxt];
	}
	return ret;
}

int main()
{
	if(fopen("data.in","r"))
	{
		freopen("data.in","r",stdin);
		freopen("data.out","w",stdout);
	}

	n=read();
	k=read();
 
	for(int i=1;i<=n;i++)
		q[p[i]=read()]=i;

	memset(ch,0,sizeof(ch));
	memset(cnt,0,sizeof(cnt));
	tot=0;

	for(int i=1;i<k;i++)
		add(p[i],1);
	for(int i=1;i<=n;i++)
	{
		if(i+k-1<=n)
			add(p[i+k-1],1);
		if(i>1)
			add(p[i-1],-1);

		int las=query(ranks(p[i])+1);
		if(las!=-1)
			adde(q[las],i),ind[i]++;
	}

	memset(ch,0,sizeof(ch));
	memset(cnt,0,sizeof(cnt));
	tot=0;

	for(int i=1;i<=n;i++)
	{
		add(p[i],1);
		if(i>k)
			add(p[i-k],-1);

		int las=query(ranks(p[i])+1);
		if(las!=-1)
			adde(q[las],i),ind[i]++;
	}

	for(int i=1;i<=n;i++)
		if(!ind[i])
			f.push(-i);
 
	int top=0;
	while(!f.empty())
	{
		int u=-f.top();
		p[++top]=u;
		f.pop();
		for(int i=beg[u];i;i=nxt[i])
			if(--ind[to[i]]==0)
				f.push(-to[i]);
	}
 
	for(int i=1;i<=n;i++)
		q[p[i]]=n-i+1;
	for(int i=1;i<=n;i++)
		printf("%d\n",q[i]);
	return 0;
}


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

int main() {
    int c[3][3];
    string flag ="Yes";
    for(int i = 0; i < 3;i++){
        for(int j = 0; j < 3;j++){
            cin >> c[i][j];
            }
    }
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            if(c[i][0]-c[j][0] == c[i][1]-c[j][1] &&
                c[i][1]-c[j][1] ==c[i][2]-c[j][2]){ 
                } else {
                    flag = "No";
                    }
                }
    }
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            if(c[0][i]-c[0][j] == c[1][i]-c[1][j] &&
                c[1][i]-c[1][j] == c[2][i]-c[2][j]){
                } else {
                    flag = "No";
                    }
                }
    }
    if(flag == "No"){
    cout << "No" << endl;    
    } else {
        cout << "Yes" << endl;
    }
}

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

const int LINE = 1000000;

int main(){
    int K, X;
    std::cin >> K >> X;
    // Xが右端のとき
    for(int i = X - K + 1; i < X; i++){
        if(i >= -LINE) std::cout << i << " ";
    }

    std::cout << X;

    // Xが左端のとき
    for(int i = X + 1; i < X + K; i++){
        if(X > LINE) break;
        std::cout << " " << i;
    }
    std::cout << std::endl;

    return 0;
}


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

int main() {
	int N, M, X, Y;
	std::cin >> N >> M >> X >> Y;

	// X, Yも分断対象
	int maxX = X;
	for(int i = 0; i < N; i++) {
		int x;
		std::cin >> x;
		if(x > maxX) {
			maxX = x;
		}
	}

	int minY = Y;
	for(int i = 0; i < M; i++) {
		int y;
		std::cin >> y;
		if(y < minY) {
			minY = y;
		}
	}

	const bool answer = maxX >= minY;

	std::cout << (answer ? "War" : "No War") << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

typedef long long ll;

using namespace std;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    long long a[N]; for (int i = 0; i < N; ++i) cin >> a[i];

    long long L[N]; 
    L[0] = a[0];
    for (int i = 1; i < N; ++i)  L[i] = GCD(L[i-1], a[i]);

    long long R[N]; 
    R[N-1] = a[N-1];
    for (int i = N-2; i >= 0; --i)  R[i] = GCD(R[i+1], a[i]);

    long long res = R[1];
    for (int i = 1; i < N; ++i) res = max(res, GCD(L[i-1], R[i+1]));
    res = max(res, L[N-2]);
    cout << res << endl;

}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define cc(a) cout << a << endl;
#define msg(a,b) cout << a << " : " << b << endl;
#define msg2(a,b,c) cout << a << " : " << b << " : " << c << endl;
#define msg3(a,b,c,d) cout << a << " : " << b << " : " << c << " : " << d << endl;
int main(){
    long long int n,t,c,T,mn;
    cin >> n >> T;
    vector<pair<long long int, long long int> > vec;
    while(n--){
        cin >> c >> t;
        vec.push_back(make_pair(c,t));
    }
    sort(vec.begin(), vec.end());
    for(int i=0;i<vec.size();i++){
        if(vec[i].second<=T){
            cout << vec[i].first<< endl;
            return 0;
        }
    }
    cout << "TLE" << endl;

    return 0;
}


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

long long int dp[55][55][2510];
int main(){
  int n,a;
  cin >>n >>a;
  int x[55];
  for(int i=1;i<=n;i++)
    cin>>x[i];
  
  x[0]=51;
  
  dp[0][0][0]=1;
  
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      for(int k=0;k<=n*a;k++){
        
        if(i>=1 && x[i]>k) dp[i][j][k]=dp[i-1][j][k];
        
        else if(i>=1 && j>=1 && k>=x[i])dp[i][j][k]=dp[i-1][j-1][k-x[i]]+dp[i-1][j][k];
        
        else if(i==0 && j==0 && k==0)dp[i][j][k]=1;
      }
    }
  }
  
  long long int ans=0;
  for(int i=1;i<=n;i++){
    ans+=dp[n][i][i*a];
             }
  cout << ans <<endl;
  
}


Measured memory_bytes: 54400
from sys import stdin
n = int(stdin.readline().rstrip())
K=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(K[n-1])

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

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

int main()
{   
    int n,i; cin >> n >> i;
    cout << n-i+1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast()    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
	fast()
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int min;
	int x=h1*60 + m1;
	int y=h2*60 +m2;

	if(y-x==0)
	min=60;
	else
	min=y-x;
	
	
	if(min<=k)
	cout<<0<<"\n";
	
	else
	cout<<min-k<<"\n";
}

Measured memory_bytes: 3644
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N, M, K = map(int, input().split())
result = 0 # max
a_time = list(map(int, input().split()))
b_time = list(map(int, input().split()))

sum = 0

a_num = 0
for i in range(N):
    sum += a_time[i]
    a_num += 1
    if sum > K:
        sum -= a_time[i]
        a_num -= 1
        break
i = a_num
j = 0
while i >= 0:
    while sum < K and j < M:
        sum += b_time[j]
        j += 1
    if sum > K:
        j -= 1
        sum -= b_time[j]
    if result < i + j:
        result = i + j
    i -= 1
    sum -= a_time[i]

print(result)


Measured memory_bytes: 42312
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int x = (c-1)/b+1;
    int y = ((a-1)/d)+1;

    string ans = "Yes";
    if (y<x) ans = "No";
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

string s;
map<string ,int> sarray;

bool dfs(string ts, int pos){
  if(pos == ts.size()){
    return true;
  }
  bool flag = false;
  map<string ,int>::iterator it = sarray.begin();
  while(it != sarray.end()){
    if(pos + (*it).second <= ts.size()){
      if(ts.substr(pos, (*it).second) == (*it).first){
        //cout<<(*it).first<<endl;
        if(dfs(ts, pos + (*it).second)){
          flag = true;
        }
      }
    }
    it++;
  }
  return flag;
}


int main() {

  cin>>s;

  sarray.insert(map<string ,int>::value_type("dream", 5));
  sarray.insert(map<string ,int>::value_type("dreamer", 7));
  sarray.insert(map<string ,int>::value_type("erase", 5));
  sarray.insert(map<string ,int>::value_type("eraser", 6));


  if(dfs(s, 0)) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


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

int find_sum_of_digits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(void) {
  int N, A, B;
  cin >> N >> A >> B;

  int total;
  for (int i = 1; i <= N; i++) {
    int sum_digit = find_sum_of_digits(i);
    if (sum_digit >= A && sum_digit <= B) {
      total += i;
    }
  }

  cout << total << endl;
  return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 998244353;

const ll com_max = 510000;

ll fac[com_max], inv[com_max], finv[com_max];

void com_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for (ll i = 2; i < com_max; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

ll com(ll n, ll k) {
    if (n < k) {
        return 0;
    }
    if (n < 0 || k < 0) {
        return 0;
    }

    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

ll rec_square(ll a, ll b) {
    // return a^b
    ll ans = 1;
    ll base = a;
    while (b != 0) {
        if (b & 1) {
            ans *= base;
            ans %= mod;
        }
        base *= base;
        base %= mod;
        b >>= 1;
    }
    return ans % mod;
}

int main() {
source:
    ll n, m, k;
    cin >> n >> m >> k;

    ll ans = 0;
    com_init();
    rep(i, k + 1) {
        ll temp = m * rec_square(m - 1, n - i - 1);
        temp %= mod;
        temp *= com(n - 1, i);
        temp %= mod;

        ans = (ans + temp) % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 15572
#include<bits/stdc++.h>
#define ll long long
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
ll mo=1e9+7;
ll mod(ll n){
	return (n%mo+mo)%mo;
}
ll modadd(ll a,ll b){
	return mod(mod(a)+mod(b));
}
using namespace std;
int main(){
	nes;
	int n;
	cin>>n;
	ll f1=1,f2=2,f3=1;
	for(int i=0;i<n;++i){
		f1=mod(f1*mod(10));
		f2=mod(f2*mod(9));
		f3=mod(f3*mod(8));
	}
	ll res=mod(mod(f1+f3)-f2);
	cout<<res;
	return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
long long n,ans;
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++)ans+=i;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int a,b,c,k,ans;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	if(k%2==0)
	{
		ans=a-b;
	}
	else
	{
		ans=b-a;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>

#include <map>
#include <math.h>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <stdint.h>

#include <experimental/optional>

namespace asl
{
    
    long long floor_sum(long long n, long long m, long long a, long long b)
    {
        long long ans = 0;
        if (a >= m)
        {
            ans += (n - 1) * n * (a / m) / 2;
            a %= m;
        }
        if (b >= m)
        {
            ans += n * (b / m);
            b %= m;
        }

        long long y_max = (a * n + b) / m, x_max = (y_max * m - b);
        if (y_max == 0)
            return ans;
        ans += (n - (x_max + a - 1) / a) * y_max;
        ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
        return ans;
    }

} 

#include <tuple>

namespace asl
{
    typedef long long i64;
    
} 

#include <random>

#include <utility>

#define endl '\n'

using namespace std;
using namespace asl;

void solve()
{
    i64 n, m, a, b;
    cin >> n >> m >> a >> b;
    cout << floor_sum(n, m, a, b) << endl;
}

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

    int t;
    cin >> t;

    for (int i = 1; i <= t; ++i)
    {
        solve();
    }

    return 0;
}




Measured memory_bytes: 3640
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    if(s.equals("Sunny")) System.out.println("Cloudy");
    if(s.equals("Cloudy")) System.out.println("Rainy");
    if(s.equals("Rainy")) System.out.println("Sunny");
  }
}


Measured memory_bytes: 20948
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)

int main() {
	string s, t;
	ll ans=0;
	in(s);
	in(t);
	rep(i, 0, 3) {
		if (s[i] == t[i]) {
			ans++;
		}
	}
	outn(ans);
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
L = [0] * (100001)
s = sum(A)
for a in A:
    L[a] += 1
Q = int(input())
for _ in range(Q):
    B, C = map(int, input().split())
    L[C] += L[B]
    s += L[B] * (C-B)
    L[B] = 0
    print(s)


Measured memory_bytes: 20920
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,s;
  cin >> n;
  for(int i=0;i<n;i++){
    int a=0,b=0,flg=0;
    for(int j=0;j<10;j++){
      cin >> s;
      if(s > a) a=s;
      else if(s > b) b=s;
      else flg=1;
    }
    printf("%s\n",flg==0?"YES":"NO");
  }
}

Measured memory_bytes: 1116
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a1.extend(a2)
a1.extend(a3)
N = int(input())
b = [0]*N
for i in range(N):
  b[i] = int(input())
  if b[i] in a1:
    b1 = b[i]
    a1 = [0 if a1[j]==b1 else a1[j] for j in range(len(a1))]
n = sum(k==0 for k in a1)
if n >= 3:
  if n >= 7:
    print('Yes')
  elif a1[0]==a1[1]==a1[2] or a1[3]==a1[4]==a1[5] or a1[6]==a1[7]==a1[8] \
    or a1[0]==a1[3]==a1[6] or a1[1]==a1[4]==a1[7] or a1[2]==a1[5]==a1[8] \
    or a1[0]==a1[4]==a1[8] or a1[2]==a1[4]==a1[6]:
      print('Yes')
  else:
    print('No')
else:
  print('No')

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

#define LL long long
#define LD long double

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	LL n;
	cin >> n;
	deque<LD> v(n);
	for (LL i = 0; i < n; i++)
		cin >> v[i];
	sort(v.begin(),v.end());
	while (v.size() > 1){
		LD x = v[0];
		LD y = v[1];
		v.pop_front();
		v.pop_front();
		v.push_front((x+y)/2);
	}
	cout << fixed << setprecision(12) << v[0] << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  string x, y;
  cin >> x >> y;
  string ans;
  if(x < y) ans = '<';
  if(x == y) ans = '=';
  if(x > y) ans = '>';

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


Measured memory_bytes: 3504
#include <iostream>
using namespace std;
int main(){
	int S = 0;
	int h = 0;
	int m = 0;
	int s = 0;
	cin >> S;
	h = S / 3600;
	m = S / 60 - h * 60;
	s = S - h * 3600 - m * 60;
	cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var dict = new Dictionary<char, int>();
            dict['N'] = 0;
            dict['S'] = 0;
            dict['E'] = 0;
            dict['W'] = 0;

            for (var i = 0; i < s.Length; i++)
                dict[s[i]]++;

            var isOk = true;

            if (dict['N'] > 0 && dict['S'] == 0
                || dict['S'] > 0 && dict['N'] == 0
                || dict['E'] > 0 && dict['W'] == 0
                || dict['W'] > 0 && dict['E'] == 0)
                isOk = false;

            Console.WriteLine(isOk ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13152
#include<stdio.h>
int main()
{
    int n,i,ara[102],count=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&ara[i]);
    for(i=1;i<=n;i=i+2)
    {
        if(ara[i]%2==1)
            count++;
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int x,k;
	cin>>x>>k;
	int arr[x];
	
	for(int i=0;i<x;i++)
    	cin>>arr[i];
    	
    long long int dp[x];
    dp[0]=0;
    
    for(int i=1;i<x;i++){
	
    	long long int min=1000000002;
    	
    	for(int j=i-1; (j>=i-k && j>=0) ;j--){
    		
    		long long int y = dp[j]+abs(arr[j]-arr[i]);
    		
    		if(y<min)
    			min=y;
    	}
    	dp[i]=min;
	}
    
	cout<<dp[x-1];
}

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


int main(void){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int t = 0;
    int ans = 0;
    for(int i = 0;i < n;i++){
        switch(s[i]){
            case 'I':
                t++;
                ans = max(ans,t);
                break;
            case 'D':
                t--;
                break;
            default:
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,k=map(int,input().split())
uf=UnionFind(n)
for i in range(k):
  a,b,c=map(int,input().split())
  uf.union(a-1,b-1)
print(uf.group_count())

Measured memory_bytes: 80492