akhauriyash/Code-Regression huggingface dataset:
import sys

A = []

for i in range(3):
    A += [int(i) for i in input().split()]

P = [False for _ in range(9)]

isBingo = False

N = int(input())

for _ in range(N):
    b = int(input())
    for i in range(9):
        if A[i] == b:
            P[i] = True


for i in range(3):
    i *= 3
    if P[i] == P[i+1] == P[i+2] == True:
        isBingo = True

for i in range(3):
    if P[i] == P[i+3] == P[i+6] == True:
        isBingo = True

if (P[0] == P[4] == P[8] == True) or (P[2] == P[4] == P[6] == True):
    isBingo = True

if isBingo == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
//const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
vector<int> x,y,xx,yy;
int imos[5011][5011];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>m;
  for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    xx.push_back(a);
    x.push_back(a);
    yy.push_back(b);
    y.push_back(b);
  }
  x.push_back(-1000000001);
  y.push_back(-1000000001);
  x.push_back(1000000001);
  y.push_back(1000000001);
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  x.erase(unique(x.begin(),x.end()),x.end());
  y.erase(unique(y.begin(),y.end()),y.end());
  for(int i=0;i<n;i++){
    xx[i]=lower_bound(x.begin(),x.end(),xx[i])-x.begin();
    yy[i]=lower_bound(y.begin(),y.end(),yy[i])-y.begin();
  }
  h=(int)y.size();
  w=(int)x.size();
  for(int i=0;i<n;i++){
    imos[yy[i]][xx[i]]++;
  }
  for(int i=0;i<h;i++)for(int j=1;j<w;j++)imos[i][j]+=imos[i][j-1];
  for(int i=1;i<h;i++)for(int j=0;j<w;j++)imos[i][j]+=imos[i-1][j];
  for(int i=0;i<m;i++){
    int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
    auto xa=lower_bound(x.begin(),x.end(),x1);
    if(*xa>=x1)xa--;
    auto xb=lower_bound(x.begin(),x.end(),x2);
    if(*xb>x2)xb--;
    auto ya=lower_bound(y.begin(),y.end(),y1);
    if(*ya>=y1)ya--;
    auto yb=lower_bound(y.begin(),y.end(),y2);
    if(*yb>y2)yb--;
    x1=xa-x.begin();x2=xb-x.begin();y1=ya-y.begin();y2=yb-y.begin();
    cout<<imos[y2][x2]-imos[y2][x1]-imos[y1][x2]+imos[y1][x1]<<endl;
  }
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}







Measured memory_bytes: 101180
#include<stdio.h>

#define N 100000

int main(){
  int odd[N], even[N], i, n;

  scanf("%d", &n);
  if(n==1){
    scanf("%d", &n);
      printf("%d\n", n);
  }else if(n%2==0){
    for(i=0; i<n/2; i++){
      scanf("%d%d", &odd[i], &even[i]);
      //printf("%d\n", odd[1]);
    }
    // printf("%d\n", n/2-1);
    for(i=n/2-1; i>-1; i--){
      printf("%d ", even[i]);
    }
    for(i=0; i<n/2; i++){
      if(i==n/2-1){
	printf("%d\n", odd[i]);
      }else{
	printf("%d ", odd[i]);
      }
    } 
  }else{
    for(i=0; i<n/2; i++){
      scanf("%d%d", &odd[i], &even[i]);
      //printf("%d\n", odd[i]);
    }
    scanf("%d", &odd[i]);
    //printf("%d %d\n", odd[i], i);
    for(i=n/2; i>-1; i--){
      printf("%d ", odd[i]);
    }
    for(i=0; i<n/2; i++){
      if(i==n/2-1){
	printf("%d\n", even[i]);
      }else{
	printf("%d ", even[i]);
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 2816
def printTable(table):
    for i in range(len(table)):
        print(table[i], end='')
        if i != len(table)-1:
            print(' ', end='')
    print()


def insertionSort(table):
    for i in range(1, len(table)):
        min = table[i]
        j = i - 1
        while j >= 0 and min < table[j]:
            table[j + 1] = table[j]
            table[j] = min
            j += -1
        printTable(table)


number = int(input())
table = list(map(int, input().split()))
printTable(table)
insertionSort(table)


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

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


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

int main() {
	ll N,K;
	cin >> N >> K;
	ll ans = 0;
	if(K%2==1){
		ans = pow(N/K,3);
	} else {
		ll k = 0;
		ll k2 = 0;
		for(ll i=1;i<=N;i++){
			if(i%K == 0)k++;
			else if(i%K == K/2)k2++;
		}
		ans += pow(k,3);
		ans += pow(k2,3);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=110;
const int MAXM=110000;
int w[MAXN], v[MAXN];
long long f[MAXN][MAXM];
int main()
{
//	freopen("D.in", "r", stdin);
//	freopen("D.out", "w", stdout);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &w[i], &v[i]);
	for (int i=1; i<=n; i++)
		for (int j=0; j<=m; j++)
		{
			f[i][j]=f[i-1][j];
			if (j>=w[i]) f[i][j]=max(f[i][j], f[i-1][j-w[i]]+v[i]);
		}
	printf("%lld\n", *max_element(f[n], f[n]+m+1));
	return 0;
}

Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) ans++;
    }

    cout << ans << '\n';
}

Measured memory_bytes: 3608
#include <iostream>

using namespace std;

void solve()
{
	int A, B;
	cin >> A >> B;
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
	{
		cout << "Possible" << endl;
	}
	else
	{
		cout << "Impossible" << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],b[100005],c[100005],f=0;
long long fa[100005];
long long s=1;

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++)
    c[i]=min(a[i],b[i]);
  long long maxc=0;
  for(int i=0;i<=n-1;i++){
    maxc=max(maxc,c[i]);
    if(a[i]!=maxc)f=1;
  }
  maxc=0;
  for(int i=n-1;i>=0;i--){
    maxc=max(maxc,c[i]);
    if(b[i]!=maxc)f=1;
  }
  if(n==1&&a[0]!=b[0])f=1;
  if(f){
    cout<<0<<endl;
  }else{
    for(int i=1;i<n-1;i++)
      if(a[i]==a[i-1])fa[i]=1;
    for(int i=n-2;i>0;i--)
      if(b[i]==b[i+1]&&fa[i]){
	s=(s*min(a[i],b[i]))%1000000007;
      }
    cout<<s<<endl;
  }
  return 0;
}


Measured memory_bytes: 3328
import java.io.*;
import java.util.*;
public class Main {
static long[][] memo;
static int I,J;
static String h,s;
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
	   h=sc.nextLine();
	   s=sc.nextLine();
	   I=h.length();
	   J=s.length();
	   memo=new long[3003][3003];
	   for(long []a:memo)
		   Arrays.fill(a,-1);
	   solve(0,0);
	 //  System.out.println(memo[0][0]);
	   trace(0,0);
	}
	static long solve(int i, int j)
	{
		if(i >= I || j >= J)
		{
			return 0;
		}
		if(memo[i][j] != -1)	return memo[i][j];
		long opt1 = solve(i + 1, j);
		long opt2 = solve(i, j + 1);
		long opt3 = s.charAt(j) == h.charAt(i) ? solve(i + 1, j + 1) + 1 : 0;
		return memo[i][j] =(long) Math.max(opt1, Math.max(opt2, opt3));
	}
	static void trace(int i, int j)
	{
		if(i >= I || j >= J)	return;
		long opt2 = solve(i, j + 1);
		long opt1 = solve(i + 1, j);
		if(s.charAt(j) == h.charAt(i))
		{
			System.out.print(s.charAt(j));
			trace(i + 1, j + 1);
			return; 
		}
		else if(opt2 > opt1)
			trace(i, j + 1);
		else
			trace(i + 1, j);
	 
	}
//	static void trace(int i,int j) {
//		if(i==I || j==J)
//			return;
//		if(h.charAt(i)==s.charAt(j)) {
//			System.out.print(s.charAt(j));
//			trace(i+1,j+1);
//			return;
//		}
//		if(solve(i+1,j)>solve(i,j+1))
//			trace(i+1,j);
//		else
//			trace(i,j+1);
//	}
//	static long dp(int i,int j) {
//		if(i==I || j==J)
//			return 0;
//		if(memo[i][j]!=-1)
//			return memo[i][j];
//		long v=0;
//		if(h.charAt(i)==s.charAt(j))
//	        	v=1+dp(i+1,j+1);
//		return memo[i][j]=Math.max(v, Math.max(dp(i,j+1),dp(i+1,j)));
//	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 131148
def s():
 n=int(input())+1
 e=[input().split()for _  in[0]*~-n]
 p=[int(e[0][0])]+list(int(x[1])for x in e)
 m=[[0]*n for _ in[0]*n]
 for i in range(n):
  for r in range(n-i-1):
   c=r+i+1
   for j in range(r+1,c):
    x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
    if not 0<m[r][c]<=x:m[r][c]=x
 print(m[r][c])
if'__main__'==__name__:s()


Measured memory_bytes: 5712
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;

int l[7]={0,6,13,18,23,43,58};
int co[7][7]={
	0,300,500,600,700,1350,1650,
	300,0,350,450,600,1150,1500,
	500,350,0,250,400,1000,1350,
	600,450,250,0,250,850,1300,
	700,600,400,250,0,600,1150,
	1350,1150,1000,850,600,0,500,
	1650,1500,1350,1300,1150,500,0
};
int main(void){
	int s[2],h[2],m[2];
	int f[2];
	int ans;
	while(1){
		scanf("%d",&s[0]);
		if(s[0]==0)break;
		scanf("%02d%02d",&h[0],&m[0]);
		scanf("%d",&s[1]);
		scanf("%02d%02d",&h[1],&m[1]);
		for(int i=0;i<2;i++){
			if(h[i]<17 || h[i]==17 && m[i]<30)f[i]=0;
			else if(h[i]<19 || h[i]==19 && m[i]<=30)f[i]=1;
			else f[i]=2;
		}
		ans=co[s[0]-1][s[1]-1];
		if((f[0]==1 || f[1]==1) && abs(l[s[1]-1]-l[s[0]-1])<=40)ans=(co[s[0]-1][s[1]-1]+50)/100*50;
		printf("%d\n",ans);
	}
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("panasonic2020/panasonic2020_c.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;
using R = long double;

constexpr R EPS = 1E-14;

// r の(誤差付きの)符号に従って, -1, 0, 1 を返す.
int sgn(const R& r){ return (r > EPS) - (r < -EPS); }
// a, b の(誤差付きの)大小比較の結果に従って, -1, 0, 1 を返す.
int sgn(const R& a, const R &b){ return sgn(a - b); }

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll a, b, c;
  cin >> a >> b >> c;
  ll d = c - (a + b);
  string ans;
  if (d > 0 && d * d > 4 * a * b) {
    ans = "Yes";
  } else {
    ans = "No";
  }
  cout << ans << endl;
}

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

int main()
{
    string s, t;
    cin >> s;
    cin >> t;

    int sLength = s.length();
    int tLength = t.length();

    vector<vector<int>> dp(sLength + 1, vector<int>(tLength + 1));

    for(int i = 1; i <= sLength; i++)
    {
        for(int j = 1; j <= tLength; j++)
        {
            if(s[i - 1] == t[j - 1])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;        
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }     
        }
    }

    string ans;
    int i = sLength, j = tLength;
    
    while(i >= 1 && j >= 1)
    {
        if(s[i - 1] == t[j - 1])
        {
            ans += s[i - 1];
            i--;
            j--;
        }
        else
        {
            if(max(dp[i - 1][j], dp[i][j - 1]) == dp[i - 1][j])
            {
                i--;
            }
            else
            {
                j--;
            }     
        }

        //cout << i << " " << j << " " << ans << "\n";      
    }

    reverse(ans.begin(), ans.end());

    cout << ans;

    // for(int i = 0; i <= sLength; i++)
    // {
    //     for(int j = 0; j <= tLength; j++)
    //     {
    //         cout << dp[i][j] << " ";
    //     }

    //     cout << "\n";
    // }

    // cout << dp[sLength][tLength];

    return 0;
}

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

using namespace std;

int main()
{
  string s; cin >> s;
  if (s.size()==2)
  {
    if (s[0]==s[1]) cout << "1 2";
    else cout << "-1 -1";
  }
  else 
  {
    for (int i=0; i<s.size()-2; i++)
    {
      if (s[i]==s[i+1] || s[i]==s[i+2])
      {
        cout << i + 1 << " " << i + 3;
        return 0;
      }
    }
    cout << -1 << " " << -1;
  }
  return 0;
}

Measured memory_bytes: 512
cards=list()
suits=['S','H','C','D']
n=int(input())
for i in range(n):
    s,r=input().split()
    r=int(r)
    if s =='S':
        cards.append(0+r)
    elif s=='H':
        cards.append(13+r)
    elif s=='C':
        cards.append(26+r)
    elif s=='D':
        cards.append(39+r)

for i in range(1,53):
    if i not in cards:
        print(suits[(i-1)//13], (i-1)%13+1)


Measured memory_bytes: 5608
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;

typedef long long LL;
const int maxn = 75, MOD = 1000000009;

int n, N;
LL m;
map<LL, vector<LL> > s;

class Matrix {
public:
	LL val[maxn][maxn];
	Matrix() {
		memset(val, 0, sizeof(val));
	}

	Matrix operator*(const Matrix& c) const {
		Matrix res;
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				for (int k = 0; k < n; ++k) {
					res.val[i][j] += val[i][k] * c.val[k][j];
					res.val[i][j] = (res.val[i][j] + MOD) % MOD; //髦イ豁「遏ゥ髦オ蜈?エ?序荳コ雍滓焚?瑚凶荳埼怙隕?シ悟悉謗?+MOD"
				}
		return res;
	}

	Matrix& operator*=(const Matrix& c) {
		*this = *this * c;
		return *this;
	}

	Matrix Pow(LL k) { //霑泌屓one^k
		Matrix res = Zero();
		Matrix step = One();
		while (k) {
			if (k & 1)
				res *= step;
			k >>= 1;
			step *= step;
		}
		return res;
	}

	Matrix Zero() const {
		Matrix res;
		for (int i = 0; i < maxn; ++i)
			res.val[i][i] = 1;
		return res;
	}

	Matrix One() const {
		Matrix res;
		res.val[0][0] = res.val[0][1] = 1;
		res.val[n-1][n-1] = res.val[n-1][n-2] = 1;
		for (int i = 1; i < n - 1; ++i) {
			res.val[i][i-1] = res.val[i][i] = res.val[i][i + 1] = 1;
		}
		return res;
	}
};

int main() {
	int kcase = 0;
	while (scanf("%d%lld%d", &n, &m, &N) && n) {
		s.clear();
		for (int i = 0; i < N; ++i) {
			LL x, y;
			scanf("%lld%lld", &x, &y);
			s[--y].push_back(--x);
		}
		if (n == 1) {
			if (N) {
				printf("Case %d: 0\n", ++kcase);
			} else {
				printf("Case %d: 1\n", ++kcase);
			}
			continue;
		}
		Matrix res;
		res.val[0][0] = 1;
		LL now = 0;
		for (map<LL, vector<LL> >::iterator it = s.begin(); it != s.end(); ++it) {
			if (it -> first == 0) continue;
			res *= res.Pow((it -> first) - now);
			now = it -> first;
			for (int i = 0; i < (it -> second).size(); ++i) {
				res.val[0][(it -> second)[i]] = 0;
			}
		}
		res *= res.Pow(m - 1 - now);
		printf("Case %d: %lld\n", ++kcase, res.val[0][n - 1]);
	}
    return 0;
}

Measured memory_bytes: 1292
#include <iostream>

using namespace std;

int main()
{
long long n, m, dp[1005][1005];
char tab[1005][1005];


cin>>n>>m;
for(int i=1; i<=n; i++){
  for(int j=1; j<=m; j++){
    cin>>tab[i][j];
  }
}
dp[1][1]=1;
for(int i=1; i<=n; i++){
  for(int j=1; j<=m; j++){
    if(tab[i-1][j]=='.'){
      dp[i][j]=(dp[i][j]+dp[i-1][j])%1000000007;
    }
    if(tab[i][j-1]=='.'){
      dp[i][j]=(dp[i][j]+dp[i][j-1])%1000000007;
    }
  }
}

cout<<dp[n][m];

  return 0;
}


Measured memory_bytes: 9088
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,c = inpm()
    print(c,a,b)
    
if __name__ == "__main__":
    main()

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

using namespace std;
using ll = long long;

int main() {
#ifdef LOCAL
    freopen("in1.txt", "r", stdin);
    freopen("out1.txt", "w", stdout);
#endif


    int n;
    double d;
    cin>>n>>d;
    int num=0;
    for(int i=0;i<n;i++){
        double x,y;
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d)num++;
    }
    cout<<num;
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;

void solve(){
	int n,m;
	cin >> n >> m;
	vi idxs[m+1];
	int vals[n];
	for(int i =0;i<n;i++){
		int a,b;
		cin >> a >> b;
		if(a<=m){
			idxs[a].pb(i);
		}
		vals[i] = b;
	}
	multiset<int> mset;
	int ans = 0;
	// dbg(idxs);
	for(int i =1;i<=m;i++){
		for(auto e:idxs[i]){
			mset.insert(-vals[e]);
			// cout << i << " " << e << endl;
		}

		if(!mset.empty()){
			ans+= -*mset.begin();
			mset.erase(mset.begin());
		}
	}
	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 11400
N = int(input().strip())
A,B = map(int,input().strip().split())
Ps = list(map(int,input().strip().split()))

und_A = len(list(filter(lambda x:  x <= A, Ps)))
A2B =  len(list(filter(lambda x: A < x <= B, Ps)))
overB =  len(list(filter(lambda x: B < x, Ps)))

print(min(und_A,A2B,overB))


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

int main(){
    string s;
    cin >> s;
    bool ok=true;
    map<char,int>Map;
    for(int i=0;i<s.size();i++){
        Map[s[i]]++;
        if(Map[s[i]]==2)ok=false;
    }    
    if(ok)cout << "yes" << endl;
    else cout << "no" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    int total = 700;
    if(S[0] == 'o') total += 100;
    if(S[1] == 'o') total += 100;
    if(S[2] == 'o') total += 100;
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
  public static void main(String args[]) {
    Scanner input = new Scanner(System.in);

    int n = input.nextInt();

    int m[][] = new int[n][n];

    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            m[i][j] = 0;
        }
    }

    for(int i = 0;i < n;i++){
        int u = input.nextInt();
        int k = input.nextInt();
        for(int j = 0;j < k;j++){
            int l = input.nextInt();
            m[u - 1][l - 1] = 1;
        }
    }

    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            System.out.print(m[i][j]);
            if(j < n - 1)
                System.out.print(" ");
        }
        System.out.println("");
    }
  }
}

Measured memory_bytes: 34572
#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;

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())

ull power(int a,int b){
    ull r=1;
    while(b){
        if(b & 1){
            r=((r%mod)*(a%mod))%mod;
            b--;
        }
        a=((a%mod)*(a%mod))%mod;
        b>>=1;
    }
    return r;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,i;cin>>n;
    vi a(n);
    for(i=0;i<n;i++) cin>>a[i];
    vsort(a);
    int val;
    vi ans(n);
    if(n%2){
        //3- 0 2 2
        //5- 0 2 2 4 4
        //7- 0 2 2 4 4 6 6
        ans[0]=0;
        val=0;
        for(i=1;i<n;i+=2){
            ans[i]=val+2;
            ans[i+1]=val+2;
            val+=2;
        }}
        else{
            /*
            2-1 1
            4-1 1 2 2
            6-1 1 3 3 5 5*/
            val=1;
            for(i=0;i<n;i+=2){
                ans[i]=val;
                ans[i+1]=val;
                val+=2;
            }
        }
        //for(i=0;i<n;i++){cout<<ans[i]<<" ";}
        if(ans==a){
           /* 3-1*2
            5-1*2*2
            7-1*2*2*2
            2-2
            4-2*2
            6-2*2*2*/
    
            cout<<power(2,n/2)%1000000007;
        }
        else cout<<0;
        
        
    
    
    
   
    return 0;
}




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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m; cin>>n>>m;
    vector<pi> P(n);
    rep(i, n) cin>>P[i].fi>>P[i].se;
	sort(all(P));

	ll ans = 0;
	int idx = 0;
	priority_queue<int> q;
    for(int i=1; i<=m; i++){
		while(P[idx].fi<=i && idx<P.size()){
			q.push(P[idx++].se);
		}
		if (q.empty()) continue;
		int score = q.top(); q.pop();
		ans += score;
    }
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}

int main() {
  long long int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<(b-b/c-b/d+b/__lcm(c,d))
         -((a-1)-(a-1)/c-(a-1)/d+(a-1)/__lcm(c,d));
  }

Measured memory_bytes: 256
import numpy as np

N, M = map(int, raw_input().split())

possible1 = []
possibleN = []

for i in range(M):
    a, b = map(int, raw_input().split())
    if a == 1:
        possible1.append(b)

    if b == N:
        possibleN.append(a)

product = set(possible1) & set(possibleN)

if len(product) != 0:
    print "POSSIBLE"
else:
    print "IMPOSSIBLE"






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

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)
#define H(x) cout << #x << " " << x << endl;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 2e5+4;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);

vi prv;
vi C;
int N;

int dp [NMAX];
int f (int i) {
    //cout << i << endl;
    if(i < 0) return 0;
    if(i == 0) return 1;
    int &res = dp[i];
    if(res != -1) return res;
    res = (f(i-1) + (prv[i] == i-1 ? 0 : f(prv[i])) ) % mod;
    return res;
}  

signed main(){
    fast_io();
    cin >> N;
    C.assign(N, 0);

    for(int &c : C) cin >> c;
    FOR(i, 0, NMAX) dp[i] = -1;
    prv.assign(N, -1);
    vi last(NMAX, -1);
    FOR(i, 0, N) {
        prv[i] = last[C[i]];
        last[C[i]] = i;
    }

    //for(int p : prv) cout << p << endl;


    cout << f(N-1);    
}


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

typedef long long ll;
ll N, A;
ll x[60];
ll dp[60][60][2510];
/*
// n枚目まででa枚選んで合計がb
ll Func(int n, ll a, ll b){
    if(dp[n][a][b] != 0){
        return dp[n][a][b];
    }
    if(b == 0){
        return 1;
    }
    if(n == 0){
        return 0;
    }
    ll res = 0;
    res += Func(n - 1, a, b);
    if(b >= x[n - 1]){
        res += Func(n - 1, a - 1, b - x[n - 1]);
    }
    return dp[n][a][b] = res;
}
*/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> A;

    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    dp[0][0][0] = 1;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            for(int k = 0; k < 2501; k++) {
	            if(dp[i][j][k]) {
	                dp[i+1][j][k] += dp[i][j][k];
	                dp[i+1][j+1][k+x[i]] += dp[i][j][k];
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <=N; i++) {
        ans += dp[N][i][i*A];
    }
    cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 59648
a, b = map(int, input().split())
while a > 0 or b > 0:
	for i in range(a):
		for j in range(b):
			if (i + j) % 2 == 0:
				print("#", end="")
			else:
				print(".", end="")
			if j == b - 1:
				print("")
	print("")
	a, b = map(int, input().split())



Measured memory_bytes: 7008
from collections import Counter
def main():
    S = Counter(input())
    ans = "Yes"
    if S["N"] > 0 or S["S"] > 0:
        if S["N"] == 0 or S["S"] == 0:
            ans = "No"
    if S["W"] > 0 or S["E"] > 0:
        if S["W"] == 0 or S["E"] == 0:
            ans = "No"
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#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 yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#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...);}

int main(){
    int n,k;
    in(n,k);
    double ans=0;
    int d;
    // i*2^j>=k
    for(int i=1;i<=n;i++){
        d=1;
        while(i*d<k){
            d*=2;
        }
        ans+=1/((double)d);
    }
    out(ans/n);
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int n, d=0;
int a[N];
map<int, int> m;

void quit()
{
	cout<<"Impossible";
	exit(0);
}

int32_t main()
{
	IOS;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		m[a[i]]++;
		d=max(d, a[i]);
	}	
	int odd=0;
	for(auto &it:m)
	{
		if(it.first==(d+1)/2)
		{
			if(d%2==0 && it.second!=1)
				quit();
			else if(d%2==1 && it.second!=2)
				quit();
			continue;
		}
		odd+=(it.second==1);
	}
	if(n%2==0 && odd>0)
		quit();
	if(n%2 && odd>1)
		quit();
	int prv=m.begin()->first;
	if(prv!=(d+1)/2)
		quit();
	for(auto &it:m)
	{
		if(it.first-prv>1)
		{
			cout<<"Impossible";
			return 0;
		}
		prv=it.first;
	}
	cout<<"Possible";
	return 0;
}


Measured memory_bytes: 256
S = list(input())
N = len(S)
child = [1]*N
move = [0]*N

for i in range(N):
  move[i] = 1 if S[i]=='R' else -1

for i in range(N-1,0,-1):
  if move[i-1] > 0:
    if move[i] > 0:
      move[i-1] += move[i]
      
for i in range(N-1):
  if move[i+1] < 0:
    if move[i] < 0:
      move[i+1] += move[i]

for i in range(N):
  if abs(move[i]) == 1:
    continue
  elif move[i] > 0:
    a = move[i]-1
    child[i+a + a% 2]+=1
    child[i]-=1
  else:
    a = i + move[i]
    child[a + ((-1)*move[i])% 2]+=1
    child[i]-=1
    
print(" ".join(map(str,child)))

Measured memory_bytes: 56972
N = int(input())
a = list(map(int, input().split()))
alst = [0] * 200005
cmb1 = [0] * 200005

for i in range(N):
    alst[a[i]] += 1

for i in range(N):
    cmb1[i + 1] = cmb1[i] + ((alst[i + 1] * (alst[i + 1] - 1)) // 2)

for i in range(N):
    tmp1 = (alst[a[i]] * (alst[a[i]] - 1)) // 2
    tmp2 = ((alst[a[i]] - 1) * (alst[a[i]] - 2)) // 2
    ans = cmb1[N] - tmp1 + tmp2
    print(ans)

Measured memory_bytes: 26140
#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;
	vector<int> ns(n);
	rep(i, n) cin >> ns.at(i);
	int count = 0;
	for(int i=2; i<n; i++){
      if(ns.at(i-2) < ns.at(i-1) && ns.at(i-1) < ns.at(i)) count++;
      if(ns.at(i-2) > ns.at(i-1) && ns.at(i-1) > ns.at(i)) count++;
    }
	cout << count << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        int n = r.nextInt();
        ArrayList<int[]> list = new ArrayList<int[]>();
        for(int i = 1; i <= n; i++){
            list.add(new int[]{i, r.nextInt()});
        }
        Collections.sort(list, new Sort());
        for(int i = 0; i < n; i++){
            pw.print(list.get(i)[0] + " ");
        }

        pw.close();
    }

    static class Sort implements Comparator<int[]>{
        public int compare(int[] a, int[] b){
            return a[1] - b[1];
        }
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

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

struct edge {
    int to;
};

int N;
int dfs(int n, vector<vector<edge>>& E, vector<int>& dist, vector<bool>& visited, bool& hasCycle) {
    if (dist[n] != -1)
        return dist[n];

    visited[n] = true;
    int ret = 0;
    for (edge e : E[n]) {
        if (dist[e.to] == -1 && visited[e.to]) {
            hasCycle = true;
            continue;
        }
        ret = max(ret, dfs(e.to, E, dist, visited, hasCycle) + 1);
    }

    return dist[n] = ret;
}

int main() {
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N - 1, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N - 1; j++) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    vector<vector<edge>> E(N * N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j + 1 < N - 1; j++) {
            int now = min(i, A[i][j]) * N + max(i, A[i][j]);
            edge e;
            e.to = min(i, A[i][j + 1]) * N + max(i, A[i][j + 1]);
            E[now].push_back(e);
        }
    }

    vector<int> dist(N * N, -1);
    vector<bool> visited(N * N, false);
    bool hasCycle = false;
    for (int i = 0; i < N; i++) {
        int root = min(i, A[i][0]) * N + max(i, A[i][0]);
        dfs(root, E, dist, visited, hasCycle);
    }

    if (hasCycle) {
        cout << -1 << endl;
    } else {
        cout << *max_element(dist.begin(), dist.end()) + 1 << endl;
    }
}


Measured memory_bytes: 47488
#include <bits/stdc++.h>
using namespace std;
int n,a[200005];
bool check(int x){
    int t=1;
    for(int k=1;k<=n;k++){
            if(x==t && t==a[k])
            return true;
        if(a[k]==t)
            t++;

    }
    return false;
}
int main(){
cin>>n;
for(int k=1;k<=n;k++)
    cin>>a[k];
int l=1,r=n;
while(r-l>1){
   int mid=(l+r)/2;
   if(!check(mid))
        r=mid;
   else l=mid;
}
int pas=-1;
if(check(l))
    pas=l;
if(check(r))
    pas=r;
    if(pas==-1)
        cout<<pas;
    else
cout<<n-pas;
return 0;
}



Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func read(s string, i int) int {
	res, _ := strconv.Atoi(s[i : i+1])
	return res
}

func main() {
	sc.Split(bufio.ScanWords)
	a := nextInt()
	sc.Scan()
	s := sc.Text()
	b := read(s, 0)*100 + read(s, 2)*10 + read(s, 3)
	fmt.Println(a * int64(b) / 100)
}


Measured memory_bytes: 1760
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using pii = pair<int, int>;
int n, m;
bool ok[3][3];
int num[3][3];

int32_t main()
{
    for (int i = 0; i<3; i++)
        for (int j = 0; j<3; j++)
            cin >> num[i][j];
    cin >> n;
    while(n--)
    {
        int x;
        cin >> x;
        for (int i = 0; i<3; i++)
        {
            for (int j = 0; j<3; j++)
            {
                if (x == num[i][j])
                    ok[i][j] = true;
            }
        }
    }
    for (int i = 0; i<3; i++)
    {
        if (ok[i][0] && ok[i][1] && ok[i][2])
        {
            cout << "Yes\n"; return 0;
        }
    }
    for (int i = 0; i<3; i++)
    {
        if (ok[0][i] && ok[1][i] && ok[2][i])
        {
            cout << "Yes\n"; return 0;
        }
    }
    if (ok[0][0] && ok[1][1] && ok[2][2])
    {
        cout << "Yes\n"; return 0;
    }
    if (ok[2][0] && ok[1][1] && ok[0][2])
    {
        cout << "Yes\n"; return 0;
    }
    cout << "No\n"; return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL dp[105][100005];
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N, C;
  cin >> N >> C;
  int w[105], v[105];
  memset(dp, 0x7f, sizeof(dp));
  for (int i = 1; i <= N; ++i) cin >> w[i] >> v[i];
  int ans = 0;
  dp[0][0] = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = 100000; j >= 0; --j)
      {
        if (v[i] > j) dp[i][j] = dp[i - 1][j];
        else dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
        if (dp[i][j] <= C) ans = max(ans, j);
        }
  cout << ans << endl;
  return 0;
}
/*
#include<cstdio>
#include<cstring>
#include<algorithm>
const int MAXN=100010;
long long f[110][MAXN];
int n,w[110],v[110];

int main(){
        memset(f,0x7f,sizeof(f));
        long long p;scanf("%d%lld",&n,&p);
        for(int i=1;i<=n;i++)
                scanf("%d%d",&w[i],&v[i]);
        f[0][0]=0;
        for(int i=1;i<=n;i++)
                for(int j=0;j<=100000;j++){
                        if(j-v[i]<0)
                                f[i][j]=f[i-1][j];
                        else
                                f[i][j]=std::min(f[i-1][j],f[i-1][j-v[i]]+w[i]);
                        // printf("(%d %d)%lld\n",i,j,f[i][j]);
                }
        for(int i=100000;~i;i--)
                if(f[n][i]<=p){
                        printf("%d\n",i);
                        return 0;
                }
        return 0;
}
*/


Measured memory_bytes: 85664
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int[] a = new int[N];
        int count = 0;
        for(int i = 1; i<=N; i++){
            count += i;
            //System.out.println(i);
        }
            System.out.println(count);
    }
}


Measured memory_bytes: 21844
<?php
$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$k = (int)$input[1];

$input = explode(' ', trim(fgets(STDIN)));
$r = (int)$input[0];
$s = (int)$input[1];
$p = (int)$input[2];

$t = trim(fgets(STDIN));

$counter = [
	"r" => $p,
	"s" => $r,
	"p" => $s,
];

$sum = 0;

for ($i=0; $i < $k; $i++) { 
	$dup = false;
	for ($j=$i; $j < $n; $j+=$k) { 
		if ($j == $i) {
			$sum += $counter[$t[$j]];
		}else{
			if ($prev != $t[$j] || $dup == true) {
				$sum += $counter[$t[$j]];
				$dup = false;
			}else{
				$dup = true;
			}
		}
		// echo $j . ": " . $t[$j] . PHP_EOL;
		// echo $sum . PHP_EOL;
		$prev = $t[$j];
	}
}
echo $sum;

Measured memory_bytes: 4728
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int A,B;

signed main(){

    in(A,B);
    out((A+B)%24);

    return 0;
}


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

int main(){
  int N,count = 0;
  cin >> N;
  int arr[N];
  string y = "yes";


  for(int i = 0;i < N;i++){
    cin >> arr[i];
  }

  while(y == "yes"){
    for(int i = 0;i < N;i++){
      if(arr[i]%2 == 0){
        arr[i] /= 2;
      }else{
        y = "no";
      }
    }
    if(y == "yes"){
        count += 1;
      }
      // cout << y << endl;
  }
  cout << count << endl;
  return 0;
}

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


int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int s = 0;
    for(int i = 1; i <= n; ++i) {
        int t = i, x = 0;
        while(t) {
            x += t % 10;
            t /= 10;
        }
        if(a <= x and x <= b) s += i;
    }
    printf("%d\n", s);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll N;
  ll K;
  cin >>N>>K;
  if (K%2!=0) {
    ll x1=0;
    ll x2=0;
    ll x3=0;
    
    ll count=N/K;
    cout<<count*count*count<<endl;
    return 0;
  }

  
  else if(K%2==0) {
    
    ll k=K/2;
    ll half=N/k-(N/K);
    ll full=N/K;
    
    cout<<half*half*half+full*full*full<<endl;
  }
}
    
    
 

Measured memory_bytes: 256
k,x = map(int,input().split())
a = []
if x-k+1<-1000000:
  i = -1000000
else:
  i = x-k+1
while i<=x+k-1:
  a.append(i)
  if i >= 1000000:
    break
  i += 1
print(*a)

Measured memory_bytes: 3060
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define pb push_back
#define mp make_pair
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;



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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
	d.resize(G.size());
	REP(i, d.size())d[i] = INF;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(make_pair(0, s));
	while (!q.empty()) {
		P a = q.top();
		q.pop();
		if (d[a.second] < a.first)continue;
		REP(i, G[a.second].size()) {
			Edge e = G[a.second][i];
			if (d[e.to] > d[a.second] + e.cap) {
				d[e.to] = d[a.second] + e.cap;
				q.push(make_pair(d[e.to], e.to));
			}
		}
	}
}

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

	ll n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;

	Graph g0(n);
	Graph g1(n);
	REP(i, m) {
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--; v--;
		add_edge(g0, u, v, a, true, a);
		add_edge(g1, u, v, b, true, b);
	}

	Array d0, d1;
	Dijkstra(g0, s, d0);
	Dijkstra(g1, t, d1);

	vector<P> d(n);
	REP(i, n) {
		d[i].first = d0[i] + d1[i];
		d[i].second = i;
	}
	sort(all(d));
	ll now = 0;
	REP(i, n) {
		while (d[now].second < i) now++;
		cout << 1000000000000000-d[now].first << endl;
	}
	return 0;
}


Measured memory_bytes: 22652