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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 100005;

int n, a[N];

int main() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	if (n % 3) {
		for (int i = 1; i <= n; ++i) {
			if (a[i]) {
				printStr("No");
				return 0;
			}
		}
		printStr("Yes");
		return 0;
	}
	std::sort(a + 1, a + 1 + n);
	int m = n / 3, s = 0;
	for (int i = 0; i < 3; ++i) {
		int v = a[i * m + 1];
		s ^= v;
		for (int j = i * m + 1; j <= (i + 1) * m; ++j) {
			if (a[j] != v) {
				printStr("No");
				return 0;
			}
		}
	}
	if (s) {
		printStr("No");
		return 0;
	}
	printStr("Yes");
}


Measured memory_bytes: 4704
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD

using namespace std;

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

int main() {
  string s;
  int K;
  cin >> s;
  cin >> K;

  int len = s.size();
  vector<string> strs;
  for (int i = 0; i < len; i++) {
    for (int j = 1; j <= 5; j++) {
      strs.push_back(s.substr(i, j));
    }
  }
  sort(strs.begin(), strs.end());
  strs.erase(unique(strs.begin(), strs.end()), strs.end());

  cout << strs[K-1] << endl;

  return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int gcd, lcm, a, b;

	while (cin >> a >> b){
		int ac, bc;
		ac = a;
		bc = b;
		if (bc > ac) swap(ac, bc);
			while (ac % bc != 0){
				ac %= bc;
			if (bc > ac) swap(ac, bc);
		}
		gcd = bc;
		lcm = a / gcd * b;
	
		cout << gcd << " " << lcm << endl;
		}
	return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18 + 5;

//PROBLEM LINK
//https://atcoder.jp/contests/dp/tasks/dp_e

int main(){
    ll n, w;
    scanf("%lld%lld", &n, &w);
    vector<ll> weight(n), value(n);
    for(int i = 0; i < n; i++)
        scanf("%lld%lld", &weight[i], &value[i]);
    
    ll sum = 0;
    for(int i = 0; i < n; i++)
        sum += value[i];
    
    vector<ll> dp(sum + 1, INF);
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = sum - value[i]; j >= 0; j--){
            dp[j + value[i]] = min(dp[j + value[i]], dp[j] + weight[i]);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= sum; i++){
        if(dp[i] <= w){
            ans = max(ans, (ll)i);
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}

Measured memory_bytes: 3992
#include <stdio.h>
#include <string.h>

int main(){
	char a[1000],b[1000];
	int c[1000];
	int i,j,k,l,m,n;
	scanf("%d",&n);
	for(i=0; i<n; i++){
		for(j=0; j<90; j++){
			a[j]='0';
			b[j]='0';
			c[j]=0;
		}
		scanf("%s",a);
		scanf("%s",b);
		j=strlen(a);
		k=strlen(b);
		//printf("j:%d\n",j);
		// for(j=0; j<90; j++){
		// 	if(a[j]=='\0'){
		// 		a[j]='0';
		// 		break;
		// 	}
		// }
		// for(k=0; k<90; k++){
		// 	if(b[k]=='\0'){
		// 		b[k]='0';
		// 		break;
		// 	}
		// }
		if(j>k)l=j;
		else l=k;
		for(m=l; m>0; m--){
			if(j-1>=0)c[m]+=a[j-1]-'0';
			if(k-1>=0)c[m]+=b[k-1]-'0';
			if(c[m]>=10){
				c[m]-=10;
				c[m-1]+=1;
			}
			j--;
			k--;
		}
		//printf(  "l:%d c:%d\n",l,c[0]);
		if(l>80||(l==80&&c[0]!=0))printf("overflow\n");
		else {
			if(c[0]!=0)printf("%d",c[0]);
			for(j=1; j<=l; j++)printf("%d",c[j]);
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 616
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        int p = n;

        long[] ans = new long[n];
        for(int i=1; i<p; i++) {
          long pow = 1;
          for(int j=p-1; j>=1; j--) {

            ans[j] += 1L*(-1*pow+p)*a[i];
            ans[j] += p;
            ans[j] %= p;
            pow = (pow*i) % p;
          }
        }

          ans[p-1] += 1L*(p-1)*a[0];
          ans[p-1] %= p;
          ans[0] += 1L*a[0];
          ans[0] %= p;
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) sb.append(ans[i]+ " ");
        out.println(sb.toString());
        // int n = Integer.parseInt(st.nextToken());

        out.close(); System.exit(0);
    }
    public static int exp(int base, int e, int mod) {
      if(e == 0) return 1;
      if(e == 1) return base;
      int val = exp(base, e/2, mod);
      int ans = (int)(1L*val*val % mod);
      if(e % 2 == 1)
        ans = (int)(1L*ans*base % mod);
      return ans;
    }
    public static int inv(int base, int mod) {
      return exp(base, mod-2, mod);
    }
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    string arr;
    cin>>arr;
int    flag=0,counter=0;
     if(arr[a]=='-')flag++;
     for(int i=0;i<arr.size();i++)
     {
         if(arr[i]>='0'&&arr[i]<='9')counter++;
     }
     if(flag>0&&counter+flag==a+b+1)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def gg(n):
	for i in range(n+1):
		#print(2*n, i*i+1)
		if 2*n == i*(i+1):
			return i+1
		if 2*n < i*(i+1):
			return -1
	return -1

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	g_num = gg(n)
	if g_num == -1:
		return 'No'
	print('Yes')
	print(g_num)
	n_num = g_num-1
	ggg=[]
	ggg.append(list(range(1, n_num+1)))
	next=n_num+1
	for ig in range(g_num-1):
		next_group=[]
		for ip, g in enumerate(ggg):
			next_group.append(g[len(ggg)-1])
		while len(next_group) < n_num:
			next_group.append(next)
			next+=1
		ggg.append(next_group)
	for g in ggg:
		print(n_num, *g)
	
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 75824
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int n,d;
  while(cin>>n>>d) {
    int w = 2*d+1;
    cout << (n+w-1)/w << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
 	
  int N;
  long sum = 0;
  
  scanf("%d",&N);
  
  for(int i = 1;i <= N;i ++){
    if(i % 3 == 0 || i % 5 == 0){
     	continue; 
    }else{
     	sum += i; 
    }
  }
  
  printf("%ld",sum);
  
  return 0;
}


Measured memory_bytes: 1736
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := "0" + Scan()
	dp := make([][2]int, len(n))
	dp[0][1] = 1
	for i := 1; i < len(n); i++ {
		m := stringToInt(string(n[i]))
		dp[i][0] = smaller(dp[i-1][0]+m, dp[i-1][1]+10-m)
		dp[i][1] = smaller(dp[i-1][0]+m+1, dp[i-1][1]+9-m)
	}
	fmt.Println(dp[len(n)-1][0])
}


Measured memory_bytes: 22056
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int t = 0;
    int x = 0;
    int y = 0;
    bool ans = true;
    for(int i = 0; i < n; i++){
        int t_next, x_next, y_next;
        cin >> t_next >> x_next >> y_next;
        int dt = t_next - t;
        int dx = x_next - x;
        int dy = y_next - y;
        ans &= (dt % 2 == (abs(dx) + abs(dy)) % 2) && (dt >= (abs(dx) + abs(dy)));
        t = t_next;
        x = x_next;
        y = y_next;
    }
    if(ans){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

//int N, T;
//vector<int> A;
//vector<set<int>> minset;
//vector<int> minvect;
//vector<int> resmin;
//
//int main() {
//	cin >> N >> T;
//	A.resize(N+1);
//	A[0] = 1e9+1;
//	for (int n = 1; n <= N; n++)cin >> A[n];
//	minset.resize(N + 1);
//	minvect.resize(N + 1);
//	minset[0].insert(A[0]);
//	minvect[0] = 0;
//	for (int n = 1; n <= N; n++) {
//		if (minvect[n - 1] > A[n]) {
//			minvect[n] = n;
//			minset[n].insert(n);
//		}
//		else if (minvect[n - 1] == A[n]) {
//			minvect[n] = minvect[n - 1];
//			minset[n] = minset[n - 1];
//			minset[n].insert(n);
//		}
//		else {
//			minvect[n] = minvect[n - 1];
//			minset[n] = minset[n - 1];
//		}
//	}
//	//1.各町で売る際の、利益単価最小を保存
//	resmin.resize(N + 1);
//	resmin[0] = A[0];
//	for (int n = 1; n <= N; n++) {
//		resmin[n] = A[n] - A[minvect[n - 1]];
//	}
//	//2.利益単価最小の最大を求める
//	int minmax = -(1e9)-1;
//	for (int n = 1; n <= N; n++) {
//		if (minmax < resmin[n])minmax = resmin[n];
//	}
//	//3.利益単価最小の最大値を取る町を順にみていく
//	int lasttown = 0;   //最後に見た町
//	set<int> seeing;   //リンゴを買う場所が同じ町たち
//	int ans = 0;
//	for (int town = 1; town <= N; town++) {
//		if (resmin[town] != minmax)continue;
//		//if (lasttown == 0) {
//		//	lasttown = town;
//		//	seeing.insert(town);
//		//}
//		////前見た町と同じ町で買っている
//		//else if (A[minvect[lasttown]] == A[minvect[town]]) {
//		//	lasttown = town;
//		//	seeing.insert(town);
//		//}
//		////前見た町と違う、より安く仕入れられる街で買っている
//		//else{
//		//	ans += min(seeing.size(),minset[lasttown].size());
//		//	lasttown = town;
//		//	seeing.clear();
//		//	seeing.insert(town);
//		//}
//		ans++;
//	}
//	//ans += min(seeing.size(), minset[lasttown].size());
//	cout << ans << endl;
//	return 0;
//}

int N, T;
vector<int> A;
vector<int> minvect;

int main() {
	cin >> N >> T;
	A.resize(N + 1);
	A[0] = 1e9 + 1;
	for (int n = 1; n <= N; n++) {
		cin >> A[n];
	}
	minvect.resize(N + 1);
	minvect[0] = A[0];
	for (int n = 1; n <= N; n++) {
		minvect[n] = min(minvect[n - 1], A[n]);
	}
	int maxben = -1e9 - 1;
	for (int n = 1; n <= N; n++) {
		maxben = max(maxben, A[n] - minvect[n - 1]);
	}
	int ans = 0;
	for (int n = 1; n <= N; n++) {
		if (A[n] - minvect[n - 1] == maxben)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int key;
 struct  Node *right,*left,*parent;
};

struct Node *root,*NIL;

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else {
      x=x->right;
    }
  }

  z->parent=y;
  if(y==NIL){
    root=z;
  }else {
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char input[10];

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%s",input);
    if(strcmp(input,"insert")==0){
      scanf(" %d",&x);
      insert(x);
    }
    else if(strcmp(input,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}



Measured memory_bytes: 25200
#include <iostream>
using namespace std;
int main(void){
    int  a[32]={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};
    int k;
    cin>>k;
    cout<<a[k-1]<<endl;
    
}


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

int main(){
  int x, y;
  while (true){
    cin >> x >> y;
    if (x == 0 && y == 0) break;
    if (x < y) cout << x << " " << y << endl;
    else cout << y << " " << x << endl;
  }
  return 0;
}

Measured memory_bytes: 2968
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;

 int main()
 {
   int n,m;
   while(cin>>n>>m)
   {
     int kk=1900*m+100*(n-m);
     long long int result=kk*(long long int)(pow(2,m));
     cout<<result<<endl;  
   }
   return 0;
 }
 


Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll ans = 0;
    while(x>=500){
        ans+=1000;
        x-=500;
    }
    while(x>=5){
        ans+=5;
        x-=5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i = 0;i < n;i++)cin >> a[i];

	int r = 0;
	int l = 0;
	for(int i = 0;i < n;i++){
		if(a[i] != 1)l++;
		else break;
	}

	for(int i = n-1;i >= 0;i--){
		if(a[i] != 1)r++;
		else break;
	}

	cout << (n-1+k-2) / (k-1) << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int n=cin.nextInt();
			if(n==0)break;
			int cnt=0;
			for(int i=1;i*i<n;i++){
				if(n%i==0){
					cnt+=i;
					if(n/i!=i&&n/i!=n)
						cnt+=n/i;
				}
			}
			if(n>cnt){
				System.out.println("deficient number");
			}
			else if(n<cnt){
				System.out.println("abundant number");
			}
			else{
				System.out.println("perfect number");
			}
		}
		
	}

}

Measured memory_bytes: 19932
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n),dif(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long sum=0;
  for(int i=0;i<n;i++){
    cin >> b[i];
    dif[i]=a[i]-b[i];
    sum+=dif[i];
  }
  if(sum<0) cout << -1 << "\n";
  else{
    sort(dif.begin(),dif.end());
    int bord;
    sum=0;
    for(int i=0;i<n;i++){
      if(dif[i]>=0){
	bord=i;
	break;
      }
      sum+=dif[i];
    }
    int j=0;
    while(sum<0){
      sum+=dif[n-1-j];
      j++;
    }
    cout << j+bord << "\n";
  }
  return 0;
}



Measured memory_bytes: 1408
N,L=map(int,input().split())

A=[]
total=0
min=1000
min_index=0
for i in range(N):
    a=L+i
    A.append(a)
    total+=a
    if abs(a) < min:
        min_index = i
        min=abs(a)
#print(total)
#print(A)
#print(min_index)
pie=total-A[min_index]
print(pie)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static int[] A;
    static int[] B;
    static int[] C;
    static void INPUT()
    {
        N = NextInt();
        A = LineInt();
        B = LineInt();
        C = LineInt();
    }
    static void OUTPUT()
    {
        var ans = B.Sum();
        var prev = int.MinValue;
        foreach (var i in A.Select(__ => __ - 1).ToArray())
        {
            ans += (i == prev + 1) ? C[prev]: 0;
            prev = i;
        }
        Console.WriteLine(ans);

    }

    static void Main(string[] args)
    {
#if DEBUG  
        TESTINPUT();
        INPUT();
#else
        INPUT();
#endif
        OUTPUT();
    }

    static void TESTINPUT()
    {
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 13524
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int N; cin >> N;
    int ans = 0;
    for(int i = 0; i < N; ++i){
        int a; cin >> a;
        while(a % 2 == 0){
            a /= 2;
            ++ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int ab,bc,ca;
    cin >> ab >> bc >> ca;
    cout << ab * bc / 2 << endl;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, m;
	cin >> n >> m;
	int temp, sum = 0;
	for (int i = 0; i < m; i++)
	{
		cin >> temp;
		sum = sum + temp;
	}
	if (n - sum >= 0)
	{
		cout << n - sum << "\n";
	}
	else
	{
		cout << -1 << endl;
	}
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;

int main() {
	int N;
	cin>>N;
	int A,count=0;
	REP(i,0,N){
		cin>>A;
		if(A%2) count++;
	}
	
	if(count%2==0){
		p("YES");
	}else{
		p("NO");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define ITER(c) __typeof((c).begin())
#define PB(e) push_back(e)
#define FOREACH(i, c) for(ITER(c) i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define PARITY(n) ((n) & 1)

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-10;

const int sz = 5050;
int S[sz][sz];

inline int get_idx(const vector<int> &ix, int x){
  return lower_bound(ALL(ix), x) - ix.begin();
}

int main(){
  int n, m;
  int x1, y1, x2, y2;
  cin >> n >> m;
  vector<int> x(n), y(n);
  REP(i, n) cin >> x[i] >> y[i];
  vector<int> ix = x;
  vector<int> iy = y;
  sort(ALL(ix));
  sort(ALL(iy));

  REP(i, n){
    int X = get_idx(ix, x[i]);
    int Y = get_idx(iy, y[i]);
    S[X+1][Y+1]++;
  }
  REP(i, n)REP(j,n){
    S[i+1][j+1] += S[i+1][j] + S[i][j+1] - S[i][j];
  }
  
  REP(i, m){
    cin >> x1 >> y1 >> x2 >> y2;
    x1 = get_idx(ix, x1);
    x2 = get_idx(ix, x2 + 1);
    y1 = get_idx(iy, y1);
    y2 = get_idx(iy, y2 + 1);
    cout << S[x2][y2] - S[x2][y1] - S[x1][y2] + S[x1][y1] << endl;
  }
  
  return 0;
}

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


public class Main{
	
	public static void main(String[] args){
	
	MyScanner sc = new MyScanner();
	out = new PrintWriter(new BufferedOutputStream(System.out));
	
	/**/
	
	String noun = sc.next();
	
	if(noun.charAt(noun.length() - 1) == 's'){
		noun = noun + "es";
	}else{
		noun = noun + "s";
	}
	
	System.out.println(noun);
	
	/**/
	 
	 out.close();	
	}
	
	public static PrintWriter out;
	
	public static class MyScanner{
		
		BufferedReader br;
		StringTokenizer st;
		
		public MyScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
	
}


Measured memory_bytes: 36604
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), T = sc.nextInt();
		Map<Integer,Integer> map = new TreeMap<>();
		for(; n > 0; n--) {
			int c = sc.nextInt(), t = sc.nextInt();
			if(t <= T) {
				map.put(c, t);
			}
		}
		List<Integer> list = new ArrayList<>(map.keySet());
		if(list.size() == 0)System.out.println("TLE");
		else System.out.println(list.get(0));
	}
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<1000000007>;
//using mint=ModInt<998244353>;

int N,M;
int S[2222],T[2222];

mint dp[2222][2222][2];
signed main(){
	cin>>N>>M;
	rep(i,N)cin>>S[i];
	rep(i,M)cin>>T[i];
	
	dp[0][0][0]=1;
	rep(i,N+1)rep(j,M+1){
		if(i+1<=N)dp[i+1][j][0]+=dp[i][j][0];
		dp[i][j][1]+=dp[i][j][0];
		if(j+1<=M)dp[i][j+1][1]+=dp[i][j][1];
		if(i<N&&j<M&&S[i]==T[j])dp[i+1][j+1][0]+=dp[i][j][1];
	}
	mint ans=0;
	rep(i,M+1)ans+=dp[N][i][0];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 38912
sx, sy, tx, ty = [int(n) for n in input().split()]
dx = tx - sx
dy = ty - sy
print('U'*dy+'R'*dx, end="")
print('D'*dy+'L'*dx, end="")
print('L'+'U'*(dy+1)+'R'*(dx+1)+'D', end="")
print('R'+'D'*(dy+1)+'L'*(dx+1)+'U')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1) - 1e9*300-1;
const int inf = -1*((1<<31)+1);

using namespace std;

ll A[303][303];
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<vector<bool>> A_n(N,vector<bool>(N));
	rep(i,N)rep(j,N){
		cin >> A[i][j];
	}
	rep(k,N)rep(i,N)rep(j,N){
		if(A[i][j] > A[i][k] + A[k][j]){
			cout << -1 << endl;
			return 0;
		}
		if(A[i][j] == A[i][k] + A[k][j] && A[i][k] > 0 && A[k][j] > 0){
			A_n[i][j] = true;
		}
	}
	ll ans = 0;
	for(int i=0; i<N; i++){
		for(int j=0; j<=i; j++){
			if(A_n[i][j] == false){
				ans += A[i][j];
			}
		}
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define mod 1000000007
#define mod1 1000000009
#define mod2 1000000021
#define INF 500001
#define MAX 1000000001
using namespace std;

/* 🐣🐥 */
char b[1001][1001];
int dp[1001][1001];
int main() {
	int n, m,ap=0;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%s", b[i]);
	}
	while (ap < n) {
		if (b[ap][0] == '#') break;
		dp[ap++][0] = 1;
	}
	ap = 0;
	while (ap < m ) {
		if (b[0][ap] == '#') break;
		dp[0][ap++] = 1;
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < m; j++) {
			if (b[i][j] == '#') continue;
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1])%mod;
		}
	}
	printf("%d", dp[n - 1][m - 1]);

	return 0;
}

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

ll f(ll n)
{
    n=(n&0x55555555)+(n>>1&0x55555555);
    n=(n&0x33333333)+(n>>2&0x33333333);
    n=(n&0x0f0f0f0f)+(n>>4&0x0f0f0f0f);
    n=(n&0x00ff00ff)+(n>>8&0x00ff00ff);
    n=(n&0x0000ffff)+(n>>16&0x0000ffff);
    return (n & 1);
}

int main(int argc, const char* argv[]) {
	ll n, m;
	cin >> n >> m;

	vector<ll> s(m);
	rep(i, m) {
		ll k;
		cin >> k;

		rep(j, k) {
			ll tmp;
			cin >> tmp;
			s[i] |= (1 << (tmp - 1));
		}

		//cerr << "RQR Pattern: " << bitset<10>(s[i]) << endl;
	}

	vector<ll> p(m);
	rep(i, m) {
		cin >> p[i];
	}

	ll ret = 0;
	rep(i, (1 << n)) {
		//cerr << "SWT Pattern: " << bitset<10>(i) << endl;

		bool flag = true;
		rep(j, m) {
			if(f(s[j] & i) != p[j]) {
				flag = false;
				continue;
			}
		}

		//debug(flag);

		if(flag) {
			++ret;
		}
	}

	cout << ret << endl;

	return 0;
}


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

using namespace std;

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

    vector<vector<pair<int, int>>> uvw(n, vector<pair<int, int>>());
    for (int i = 0; i < n - 1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        uvw[u - 1].push_back(make_pair(v - 1, w));
        uvw[v - 1].push_back(make_pair(u - 1, w));
    }

    vector<int> color(n, -1);
    color[0] = 0;

    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int top = que.front();
        que.pop();

        for (int i = 0; i < uvw[top].size(); i++) {
            if (color[uvw[top][i].first] == -1) {
                color[uvw[top][i].first] = (color[top] + uvw[top][i].second) % 2;
                que.push(uvw[top][i].first);
            }
        }
    }

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


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x3f
#define MAX_INF_VAL 0x3f3f3f3f
#define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f
#define pi 3.141592653589
#define eps 1e-6
//#define p 2173412051LL
//#define sz 2

using namespace std;

ll gcd( ll, ll );

int main() {
	ll x, y;
	scanf( "%lld%lld", &x, &y );
	printf( "%lld", x * y / gcd( x, y ) );
	return 0;
}

ll gcd( ll x, ll y ) {
	return y? gcd( y, x % y ): x;
}

Measured memory_bytes: 3756
/*
    quid-pro-quo: LOGIC for AC
    written by: codercell07
    LANG: C++ 11
    Problem: random
*/
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL)
#define testcases freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define ui unsigned int
#define ll long long
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sz(x) (int)x.size()
#define pq priority_queue /*maxim at top(max-heap)*/
#define pqmax priority_queue<int, vector<int>, greater<int>> /*minim at top(min-heap)*/
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define asc(x) sort(all(x))
#define desc(x) sort(all(x), greater<int>())
#define time_el (double)time/CLOCKS_PER_SEC
using namespace std;
const int MAX=2e6; //dummy, make sure change as per constraints
const ll M=1e9+7, inf=1e18;
const char nl='\n';
 
ll apbmc(ll a, ll b, ll c){ a%=c; ll res=1; while(b){ if(b&1) res=res*a%c; a=a*a%c; b>>=1; } return res;}
ll apb(ll x, ll y){ ll temp; if(y==0) return 1;  temp=apb(x, y/2); if(y%2==0) return temp*temp;  else return temp*temp*x;}
 



void solve(){   
    //clock_t time;
    ll n; cin>>n;
    int cnt=0;
    for(ll i=1; i<n; i++){
        for(ll j=1; j<n, i*j<n; j++){
            if(i*j>=1 and i*j<n) cnt++;
        }
    }
    cout<<cnt;
}
int main(){
    fastio;
    // #ifndef ONLINE_JUDGE
    //     testcases;
    // #endif // !DEBUG
    cout<<fixed<<setprecision(10);
    
    //int t; cin>>t; while(t--) solve();    
    solve();

    return 0;
}
//points to check:
//  * check for constraints, mainly array!
//  * EDGE CASES
//  * check for integer overflow, use long long!
//  * learn, do, solve, share something, NOW!

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
 
bool from1[200050];
bool toN[200050];
 
int main() {
    int N, M;
    cin >> N >> M;
    for(int i = 1; i <= M; i++) {
        int a, b;
        cin >> a >> b;
        if(a == 1) from1[b] = true;
        if(b == N) toN[a] = true;
    }
    for(int i = 2; i < N; i++) {
        if(from1[i] and toN[i]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
using namespace std;
int a[10000],b[10000];
int main(){
	while(1){
		int i,n,m,l=0,s[501]={0},j;
		cin>>n>>m;
		if(n==0&&m==0)break;
		s[1]=3;
		for(i=0;i<m;i++){
		cin>>a[i]>>b[i];
		}
		for(i=0;i<m;i++){
			for(j=0;j<m;j++){
				if(s[a[j]]>0&&s[b[j]]<s[a[j]]-1)s[b[j]]=s[a[j]]-1;
				if(s[b[j]]>0&&s[a[j]]<s[b[j]]-1)s[a[j]]=s[b[j]]-1;
			}
		}
		for(i=2;i<=n;i++){
		if(s[i]!=0)l++;
		}
		cout<<l<<endl;
	}
	return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> vs;
    vector<int> a;
    vector<int> b;
    rep(i, h)
    {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    rep(i, h)
    {
        rep(j, w)
        {
            if (vs[i][j] == '#')
            {
                a.push_back(i);
                break;
            }
        }
    }
    rep(j, w)
    {
        rep(i, h)
        {
            if (vs[i][j] == '#')
            {
                b.push_back(j);
                break;
            }
        }
    }
    rep(i, a.size())
    {
        rep(j, b.size())
        {
            cout << vs[a[i]][b[j]];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import datetime
import string
import re
import math

aDic = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

N = int(input())
for i in range(N):
    aDic[input()] += 1

for page in aDic:
    print(page + ' x ' + str(aDic[page]))


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5 + 9, M = 1e6 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


#define neig(a, u, e, v) for(int v, e = (a).head[u] ; ~e and (v = (a).to[e], 1) ; e = (a).nxt[e])

struct Adj {
	int head[N], nxt[M], to[M], ne, n;
	void init(int n) {
		memset(head, -1, n * sizeof(head[0]));
		ne = 0;
		this->n = n;
	}
	void addEdge(int f, int t) {
		nxt[ne] = head[f];
		to[ne] = t;
		head[f] = ne++;
	}
	void addBiEdge(int f, int t) {
		addEdge(f, t);
		addEdge(t, f);
	}
	int addNode() {
		head[++n] = 0;
		return n;
	}
} adj;



int dp[N];

int dfs(int u){
    int &ret = dp[u];
    if(~ret)    return dp[u];

    ret = 0;
    neig(adj, u, e, v)
        ret = max(ret, dfs(v));

    ret++;

    return ret;
}


int n, m, u, v;

void go(int tc){
    cin >> n >> m;
    adj.init(n);
    for(int i = 0;i < m;i++){
        cin >> u >> v;  u--, v--;
        adj.addEdge(u, v);
    }

    memset(dp, -1, sizeof dp);

    int ans = 0;
    for(int i = 0;i < n;i++)
        ans = max(ans, dfs(i));

    cout << ans - 1;
}

int main(){
    init();

    int t, tc = 1;  t = 1;//cin >> t;
    while(t--)  go(tc++);

}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define fi                      first
#define se                      second
#define pb                      push_back
#define pbb                     pop_back
#define mp                      make_pair
#define pii     	            pair<int,int>
#define all(x)                  x.begin(), x.end()
#define mem(array, value)       memset(array, value, sizeof(array))
#define fastRead 	            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#ifdef Lollipop
    #define line                    cout << "\n===================\n"
    #define trace(...)              __f( #__VA_ARGS__ , __VA_ARGS__ )
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " = " << arg1 << "\n";
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " = " << arg1 << " , ";
    __f(comma + 1, args...);
    }
#else
    #define line
    #define trace(...)
#endif

int dx[] = {-1, 0, 1, 0},                  dy[] = {0, 1, 0, -1};
int n, m;
char grid[25][25];
int dist[25][25];

bool check(int x, int y)
{
    return (x >= 0 && x < n && y >= 0 && y < m && grid[x][y] != '#' && dist[x][y] == -1);
}

int solve(int x, int y)
{
    mem(dist, -1);
    queue<pii> Q;
    dist[x][y] = 0;
    int ret = 0;
    Q.push(mp(x, y));
    while (!Q.empty()){
        x = Q.front().fi;
        y = Q.front().se;
        Q.pop();
        ret = max(ret, dist[x][y]);
        for (int i = 0; i < 4; i++){
            int ax = x + dx[i];
            int ay = y + dy[i];
            if (check(ax, ay)){
                dist[ax][ay] = dist[x][y] + 1;
                Q.push(mp(ax, ay));
            }
        }
    }
    return ret;
}

int main ()
{
    #ifdef Lollipop
        freopen ("input.txt", "r", stdin);
        //freopen ("output.txt", "w", stdout);
    #endif
    //fastRead;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> grid[i][j];
        }
    }
    int res = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            if (grid[i][j] == '.'){
                res = max(res, solve(i, j));
            }
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
open System

let n = stdin.ReadLine() |> int64

let sq = float n |> Math.Sqrt |> int64

let rec f x = if n % x = 0L then (x , n / x) else f (x - 1L)

let g (x,y) = x + y - 2L

f sq
|>g
|>stdout.WriteLine

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define repi(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
using namespace std;
typedef long long ll;

int main() {
  int N; cin >> N;
  cout << (N + 110)/111*111 << endl;
  return 0;
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const K = parseInt(arg[0].split(" ")[0]);
    
    // lunlun数の集合を受け取り、次の桁のlunlun数の州法を返す
    const calcNext = (lunluns) => {
        let result = [];
        
        for(let val of lunluns) {
            for(let j=-1; j<=1; j++) {
                let add = (val % 10) + j;
                if(add >= 0 && add <= 9) {
                    result.push(val * 10 + add)
                }
            }
        }
 
        return result;
    }
    
    let all = []; // 全列挙したもの
    let current = []; 
    
    // 1桁のとき
    for(let v=1; v<10; v++) {
        current.push(v);
        all.push(v);
    }
    
    // 10桁のlunlun数まで出す
    for(let d=1; d<10; d++) {
        current = calcNext(current);
        
        for(let val of current) {
            all.push(val);
        }
    }
    
    // console.log("all:" + all);
    // console.log("cur:" + current);
    
    console.log(all[K-1]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 43280
while True:
    n = int(input())
    if n == 0:
        break
    p = "I" + "OI" * n
    m = int(input())
    s = input()
    c = 0
    i = 0
    while True:
        try:
            i += s[i:].index(p) + 1
            c += 1
        except:
            print(c)
            break


Measured memory_bytes: 7560