akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

#define MAX_M (100000)
#define MAX_N (100000)
#define NUM_MOD (1000000007)

int main(int argc, char *argv[]) {
  // read inputs
  long n, m, xs[MAX_M], ys[MAX_N];
  scanf("%ld %ld", &n, &m);
  for (long j = 0; j < n; j++) {
    scanf("%ld", &xs[j]);
  }
  for (long i = 0; i < m; i++) {
    scanf("%ld", &ys[i]);
  }

  // solve
  long int_row = 0, int_col = 0;
  for (long i = 0; i < m - 1; i++) {
    int_row += (i + 1) * (m - (i + 1)) * (ys[i + 1] - ys[i]);
    int_row %= NUM_MOD;
  }
  for (long j = 0; j < n - 1; j++) {
    int_col += (j + 1) * (n - (j + 1)) * (xs[j + 1] - xs[j]);
    int_col %= NUM_MOD;
  }
  printf("%ld\n", (int_row * int_col) % NUM_MOD);

  return 0;
}


Measured memory_bytes: 1664
function Main(s) {
  var s = s.split("\n");
  var zero = s[0].split(" ").map(e => parseInt(e, 10));
  var t = s.slice(1, zero[0] + 1).map(e => parseInt(e, 10)).sort((a, b) => a - b);
  var cnt = 1;
  var c = zero[1];
  var start = 0;
  for (var i = 1; i < zero[0]; i++) {
    if (t[start] <= t[i] && t[i] <= t[start] + zero[2]) {
      c--;
      if (c === 0) {
        cnt++;
        c = zero[1];
        start = i;
      }
    } else {
      cnt++;
      c = zero[1];
      start = i;
    }
  }
  console.log(cnt);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 28612
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int n;
string s;
vector<int> ans;

void display() {
  rep(i, 0, n) {
    if (ans[i] == 0)
      cout << "S";
    else
      cout << "W";
  }
  cout << endl;
}

bool check(int t, int bef, int aft) {
  if (ans[t] == 0) {
    if ((s[t] == 'o' && ans[aft] == ans[bef]) ||
        (s[t] == 'x' && ans[aft] != ans[bef]))
      return true;
  } else {
    if ((s[t] == 'x' && ans[aft] == ans[bef]) ||
        (s[t] == 'o' && ans[aft] != ans[bef])) {
      return true;
    }
  }

  return false;
}

bool sol(int target, int bef_target) {
  ans[0] = target;
  ans[n - 1] = bef_target;
  int bef = n - 1;
  rep(i, 0, n - 2) {
    if ((s[i] == 'o' && ans[i] == 0) || (s[i] == 'x' && ans[i] == 1)) {
      ans[i + 1] = ans[bef];
    } else {
      ans[i + 1] = !ans[bef];
    }
    bef = i;
  }

  if (check(n - 1, n - 2, 0) && check(n - 2, n - 3, n - 1)) {
    display();
    return true;
  }
  return false;
}

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

  cin >> n >> s;

  ans.resize(n, -1);
  if (sol(0, 0))
    return 0;
  if (sol(0, 1))
    return 0;
  if (sol(1, 0))
    return 0;
  if (sol(1, 1))
    return 0;
  cout << "-1" << endl;
}


Measured memory_bytes: 976
import java.util.*;

public class Main {
	int h, w, n;
	char[][] map, input;
	boolean flag;
	
	void func(){
		boolean[][] f;
		boolean out;
		int cnt;
		
		while(true){
			drop();
			out = false;
			f = new boolean[h][w];
			for(int i=0;i<h;i++){
				for(int j=1;j<w;j++){
					cnt = 1;
					while(j<w && map[i][j-1]!='.' && map[i][j-1]==map[i][j]){
						j++;
						cnt++;
					}
					if(cnt>=n){
						for(int k=0;k<cnt;k++) f[i][j-1-k] = true;
					}
				}
			}
			for(int i=0;i<w;i++){
				for(int j=1;j<h;j++){
					cnt = 1;
					while(j<h && map[j-1][i]!='.' && map[j-1][i]==map[j][i]){
						j++;
						cnt++;
					}
					if(cnt>=n){
						for(int k=0;k<cnt;k++) f[j-1-k][i] = true;
					}
				}
			}
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(f[i][j]==true){
						map[i][j] = '.';
						out = true;
					}
				}
			}
			if(out==false) break;
		}
	}
	
	void drop(){
		int cnt;
		char[] a;
		
		for(int j=0;j<w;j++){
			cnt = 0;
			a = new char[h];
			Arrays.fill(a, '.');
			for(int i=0;i<h;i++){
				if(map[i][j]!='.'){
					a[cnt] = map[i][j];
					map[i][j] = '.';
					cnt++;
				}
			}
			for(int i=0;i<h;i++) map[i][j] = a[i];
		}
	}
	
	boolean finish(){
		boolean f = true;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(map[i][j]!='.') f = false;
				map[i][j] = input[i][j];
			}
		}
		return f;
	}
	
	void solve(){
		Scanner sc = new Scanner(System.in);
		h = sc.nextInt();
		w = sc.nextInt();
		n = sc.nextInt();
		map = new char[h][w];
		input = new char[h][w];
		for(int i=0;i<h;i++){
			input[h-1-i] = sc.next().toCharArray();
			Arrays.fill(map[i], ' ');
		}
		
		flag = finish();
		for(int i=0;i<h;i++){
			for(int j=0;j<w-1;j++){
				if(map[i][j]=='.' && map[i][j+1]=='.') continue;
				char a = map[i][j];
				map[i][j] = map[i][j+1];
				map[i][j+1] = a;
				func();
				flag = finish();
				if(flag==true) break;
			}
			if(flag==true) break;
		}
		
		if(flag==true) System.out.println("YES");
		else System.out.println("NO");
	}
	
	
	public static void main(String[] args) {
		new Main().solve();
	}	
}

Measured memory_bytes: 29028
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

const int MAX=510000;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int a,b,c;
  cin >> a >> b >> c;
  cout << c-min(a-b,c) << endl;
  return 0;
}

Measured memory_bytes: 3624
a, b ,c = map(int, input().split())

if a == 5 and b == 5 and c == 7:
    print("YES")
elif a == 5 and b == 7 and c == 5:
    print("YES")
elif a == 7 and b == 5 and c == 5:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using namespace std;
struct node{
	int i,num;
}A[110000];
bool cmp(node a,node b)
{
	return a.num<b.num;
}
int main()
{
	int N;
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		int t;
		cin>>t;
		A[i].i=i;
		A[i].num=t;
	}
	sort(A+1,A+N+1,cmp);
	for(int i=1;i<=N;i++)
	{
		cout<<A[i].i<<" ";
	}
} 

Measured memory_bytes: 1664
#include<stdio.h>
#include<string.h>
char c[101];
int main(){
	while(scanf("%s",c)){
		if(c[0]=='0')return 0;
		int count=0,a=0,b=0;
		for(int i=1;i<strlen(c);i++){
			if(c[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		printf("%d %d\n",a,b);
	}
}


Measured memory_bytes: 2684
def fac(num):
    count = 0
    for i in range(1, num+1):
        if num % i == 0:
            count += 1
    return count
N = int(input())

C = 0
for i in range(1, N+1, 2):
    if fac(i) == 8:
        C += 1

print(C)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;

int main(){
    int n,ma,mb;
    cin >> n >> ma >> mb;

    vector<vector<int> > dp(401, vector<int>(401, inf));
    dp[0][0] = 0;
    for(int i=0; i<n; i++){
        int a,b,c;
        cin >> a >> b >> c;
        vector<vector<int> > ndp(401, vector<int>(401, inf));
        for(int j=0; j<=400; j++){
            for(int k=0; k<=400; k++){
                if(dp[j][k] == inf) continue;
                ndp[j][k] = min(ndp[j][k], dp[j][k]);
                ndp[j+a][k+b] = min(ndp[j+a][k+b], dp[j][k]+c);
            }
        }
        dp = ndp;
    }

    int ans = inf;
    for(int i=1; ma*i<=400 && mb*i<=400; i++){
        ans = min(ans, dp[ma*i][mb*i]);
    }
    if(ans == inf){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}


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

int main(){
	ll x,k,d;
	cin >> x >> k >> d;
	if(x < 0) x = -x;
	if(x / d >= k){
		cout << x - k*d << endl;
	}else{
		ll t = x / d;
		if(t % 2 == k % 2){
			cout << x % d << endl;
		}else{
			cout << d - x % d << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3628
# ABC 106: B – 105
import itertools

n = int(input())

odd_primes = [3, 5, 7, 11, 13, 17, 19, 23]
the_number = 0

for comb in list(itertools.combinations(odd_primes, 3)):
    if comb[0] * comb[1] * comb[2] <= n:
        the_number += 1

for comb in list(itertools.combinations(odd_primes, 2)):
    if comb[0] ** 3 * comb[1] <= n:
        the_number += 1

print(the_number)

Measured memory_bytes: 3064
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int n;
  cin >> n;
  int freedom = 0;
  bool colors[8];
  REP(i, 8) {
    colors[i] = false;
  }

  REP(i, n) {
    int tmp;
    cin >> tmp;
    if(tmp <= 399) {
      colors[0] = true;
    } else if(tmp <= 799) {
      colors[1] = true;
    } else if(tmp <= 1199) {
      colors[2] = true;
    } else if(tmp <= 1599) {
      colors[3] = true;
    } else if(tmp <= 1999) {
      colors[4] = true;
    } else if(tmp <= 2399) {
      colors[5] = true;
    } else if(tmp <= 2799) {
      colors[6] = true;
    } else if(tmp <= 3199) {
      colors[7] = true;
    } else if(tmp >= 3200) {
      freedom++;
    }
  }

  int colorsCount = 0;
  REP(i, 8) {
    if(colors[i]) {
      colorsCount++;
    }
  }

  int maxAns = colorsCount + freedom;
  // if(maxAns > 8) {
  //   maxAns = 8;
  // }
  cout << max(colorsCount, 1) << " " << maxAns << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n];
		int sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
			a[i] = a[i] * 4 * m;
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] >= sum) {
				cnt++;
			}
		}
		if (cnt >= m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 22736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 220000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
vector<ll> divs(ll n){
	vector<ll>ret;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n){
				ret.push_back(i);
			}
			else{
				ret.push_back(i);
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}
void solve(){
	ll n,i,k;
	cin>>n;
	vector<ll>vec(n);
	map<ll,ll>freq;
	ll s=0;
	nfl(i,n){
		cin>>vec[i];
		freq[vec[i]]++;
		s+=vec[i];
	}
	ll q;
	cin>>q;
	while(q--){
		ll b,c;
		cin>>b>>c;
		s-=freq[b]*b;
		s+=freq[b]*c;
		freq[c]+=freq[b];
		freq[b]=0;
		cout<<s<<endl;
	}
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	


Measured memory_bytes: 9940
#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;
  cin >>N;
  vl A(N);
  vl B(N);
  vl C(N);
  rep(i,N) {
cin >>A.at(i);
  }
rep(i,N) {
cin >>B.at(i);
  }
  rep(i,N) {
cin >>C.at(i);
  }
  sort(all(A));
  sort(all(B));
  sort(all(C));
  ll sum=0;
 rep(i,N) {
  auto aIndex = lower_bound(A.begin(), A.end(), B.at(i)) - A.begin();
    auto cIndex = upper_bound(C.begin(), C.end(), B.at(i)) - C.begin();
 
    // cout << aIndex << " " << cIndex << endl;
 
    sum += (aIndex) * (N - cIndex);
  }
  cout<<sum<<endl;
}
    

  
  
  
  

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


int main(){
int a;
cin >> a;
cout << a+pow(a,2)+pow(a,3) << endl;




return 0;
}


Measured memory_bytes: 4152
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		double win=0;
		
		String K = Integer.toBinaryString(k);
		int count=0;
		for(int i=1;i<=n;i++){
			String s = Integer.toBinaryString(i);
			while(s.length()<K.length()) {
				s = s + "0";
				count++;
			}
			
			if(Integer.parseInt(s,2)<Integer.parseInt(K,2)) {
				count++;
			}
			
			win += 1/Math.pow(2,count);
			count=0;
		}
		
		
		System.out.println(win/n);
	}
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int64_t>t(n),a(n),b(n);
	for(int i=0,tmp;i<n;++i){
		cin>>tmp;
		t.at(i)=tmp;
	}
	a.front()=t.front(),b.back()=t.back();
	for(int i=1;i<n;++i){
		a.at(i)=a.at(i-1)+t.at(i);
		b.at(n-i-1)=b.at(n-i)+t.at(n-i-1);
	}
	int64_t ans=numeric_limits<int64_t>::max();
	for(int i=1;i<n;++i){
		ans=min(ans,abs(b.at(i)-a.at(i-1)));
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

int main(){
    int n; cin >> n;
    while(n--){
        int v[10];
        rep(i,10) cin >> v[i];
        bool ok = false;
        rep(mask,1<<10){
            int a=-1, b=-1;
            bool f = true;
            rep(i,10){
                if(mask>>i & 1){
                    if(a==-1 || a < v[i]) a = v[i];
                    else f = false;
                } else {
                    if(b==-1 || b < v[i]) b = v[i];
                    else f = false;
                }
            }
            if(f){
                ok = true;
                break;
            }
        }
        puts(ok ? "YES" : "NO");
    }
}

Measured memory_bytes: 1108
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)

//グローバル変数宣言
 ll p=0,q=0;//r=0;

int main()
{
  ll n,k,q;
  cin>>n>>k>>q;
  vl a(q),b(n);
  rep(i,q){
    cin>>a[i];
    b[a[i]-1]--;
    k--;
  }
  rep(i,n){
    if (k<=b[i])
    {
      print("No")
    }else print("Yes")
    //print(b[i])
  }
//print(k)
}

Measured memory_bytes: 4824
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

import fractions
a,b,c=LI()
d=fractions.gcd(a,b)
print(YN[c%d!=0])




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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.length()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>())
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////
	string a,b,c;
	cin >> a >> b >> c;
	cout << char(toupper(a[0])) << char(toupper(b[0])) << char(toupper(c[0])) << endl;

	
//////////////////////////////////////////////
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n;
	int a[100010];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int w = 0;
	for (int j=1;j<1000000;j++) {
		w = a[w] - 1;
		if (w == 1) {
			cout << j << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    ll n,ans=0;
    cin>>n;
    if(n%2==1){cout<<0<<endl; return 0;}
    ll x=10;
    ans+=n/x;
    while(n>=x){
        x*=5;
        ans+=n/x;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a <= 8 && b <= 8){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }
    }
}


Measured memory_bytes: 21716
package main

import "fmt"

func pow (x int) int {
	if x == 0 {
		return 1
	}
	ans := 1
	for i:=0 ; i<x ; i++{
		ans *= 10
	}
	return ans
}

func calc (dep int, mat []int, sum int, ans int) int {
//fmt.Println("calc: dep",dep,"sum",sum,"ans",ans)
	if dep < 10 {
		return ans+dep
	}
	if dep % 10 == 0{
		if sum <= mat[dep-10] {
//fmt.Println("dep10->0, go down")
			return calc(dep-10,mat,sum,ans+pow(dep/10)*(dep%10))
		} else {
//fmt.Println("dep10->0, go right")
			return calc(dep-9,mat,sum-mat[dep-10],ans+pow(dep/10)*(dep%10))
		}
	} else if dep % 10 == 9{
		if sum <= mat[dep-11] {
//fmt.Println("dep10->9, go left")
			return calc(dep-11,mat,sum,ans+pow(dep/10)*(dep%10))
		} else {
//fmt.Println("dep10->9, go down")
			return calc(dep-10,mat,sum-mat[dep-11],ans+pow(dep/10)*(dep%10))
		}
	} else {
		if sum <= mat[dep-11] {
//fmt.Println("dep10->else, go left")
			return calc(dep-11,mat,sum,ans+pow(dep/10)*(dep%10))
		} else if sum <= mat[dep-11] + mat[dep-10] {
//fmt.Println("dep10->else, go down")
			return calc(dep-10,mat,sum-mat[dep-11],ans+pow(dep/10)*(dep%10))
		} else {
//fmt.Println("dep10->else, go right")
			return calc(dep-9,mat,sum-mat[dep-10]-mat[dep-11],ans+pow(dep/10)*(dep%10))
		}
	}
}

func main(){
	var k,sum int
	fmt.Scan(&k)
	mat := make([]int,100) // i = i/10+1桁目がi%10
	for i:=0 ; i < 10; i++ {
		mat[i] = 1
	}
	for i := 10 ; i < 100 ; i++{
		if i%10 == 0{
			mat[i] = mat[i-10] + mat[i-9]
		} else if i%10 == 9 {
			mat[i] = mat[i-10] + mat[i-11]
		} else {
			mat[i] = mat[i-9] + mat[i-10] + mat[i-11]
		}
	}
/*
for i:=0 ; i<10 ; i++ {
	fmt.Println(mat[i*10:(i+1)*10])
}
*/
	for i:=0 ; i<100 ; i++ {
		if i%10 == 0{
			continue
		}
		sum += mat[i]
		if k <= sum {
//fmt.Println(i)
			fmt.Println(calc(i,mat,k-(sum-mat[i]),0))
			break
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int n;
    cin >> n;
    cout << 800 * n - 200*(n/15) << endl;
    return 0;
}


Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
   string S;
   cin>>S;
   int ans=0;
   rep(i,4){
       if(S[i]=='+'){
           ans++;
       }
       else{
           ans--;
       }
   }
   
    cout<<ans<<endl;
}

Measured memory_bytes: 3592
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int X = Integer.parseInt(in.readLine());
		if (X == 0) {
			System.out.println("1");
		} else {
			System.out.println("0");
		}
	}

	void calc() {
	}

	void showResult() {
	}
}


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

void Main() {
    // input
    int64_t a, b, c, d;
    cin >> a >> b >> c >> d;
    int64_t ans = INT64_MIN;

    // process
    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d); 

    // output
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#define LL long long
#define eps 1e-6
int main()
{
    LL a,b,c;
    double d;
    scanf("%lld%lf",&a,&d);
    d+=eps;//!!!如果只是单纯的*100的话有误差
    b=d*100;
    c=a*b/100;
    printf("%lld\n",c);
    return 0;
}

Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<ll> w(N);
    for(int i=0; i<N; i++) cin >> w[i];

    ll ans = 1000000000;

    ll s1 = 0, s2 = 0;
    for(int i=0; i<N-1; i++){
        ll s1 = 0, s2 = 0;
        for(int j=0; j<N; j++){
            if(j<=i) s1 += w[j];
            else s2 += w[j];
        }
        ans = min(ans, abs(s1-s2));
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 3005, MOD = 1e9 + 7;

int n, m, r[N], rightend[N], cnt1[N], f[N][N];
string s;

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n >> m >> s;
  int curl, curr;
  cin >> curl >> curr;
  for (int i = 2, nxl, nxr; i <= m; ++i) {
    cin >> nxl >> nxr;
    if (curl == nxl) curr = max(curr, nxr);
    else if (curr < nxr) {
      r[curl] = curr;
      curl = nxl; curr = nxr;
    }
  }
  r[curl] = curr;
  for (int i = 1; i <= n; ++i) {
    cnt1[i] = cnt1[i - 1] + (s[i - 1] == '1');
    rightend[i] = max(rightend[i - 1], r[i - 1]);
    r[i] = max({r[i], i, rightend[i]});
  }
  f[0][0] = 1;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      if (f[i][j] == 0) continue;
      int one = j + ((rightend[i] < r[i]) ? (cnt1[r[i]] - cnt1[rightend[i]]) : 0);
      if (one) (f[i + 1][one - 1] += f[i][j]) %= MOD;
      if (r[i] - i + 1 > one) (f[i + 1][one] += f[i][j]) %= MOD;
    }
  }
  cout << f[n + 1][0];
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	int vec[n];
	for(int i=0; i<n; i++)
		cin >> vec[i];
	int max=vec[0], count=1;
	for(int i=1; i<n; i++){
		if(vec[i]==max)
			count++;
		else if(vec[i]>max){
			max=vec[i];
			count++;
		}
	}
	cout << count << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int64_t memo[100];
int64_t ryuka(int N){
if(N==0)return 2;
if(N==1)return 1;
if(memo[N] != 0)return memo[N];
int64_t ans;
ans=ryuka(N-1)+ryuka(N-2);
memo[N]=ans;
return ans;
}
int main(){
scanf("%d",&N);

printf("%ld\n",ryuka(N));
}





Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
 
void main()
{
    auto dp = new long[][](11, 1001);
    dp[0][0] = 1;
    foreach (i; 0..101) {
        foreach_reverse (j; i..1001) {
            foreach_reverse (k; 1..10) {
                dp[k][j] += dp[k-1][j-i];
            }
        }
    }
 
    while (1) {
        auto ns = readln.split.map!(to!int);
        if (!(ns[0] | ns[1])) break;
        dp[ns[0]][ns[1]].writeln;
    }
}

Measured memory_bytes: 1072
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
     
int main() {
  ll n, m, k, x=0, y=0 , z = 0, h,w, sum = 0, Max = -1, Min = 3e9+1;
  string u;
  bool ok=true;
  cin >> n >> m;
  pri(n*m);
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define MAX 1000000
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

/* ----------------------------------------------------------------------------------- */

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

/* ----------------------------------------------------------------------------------- */

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
	typedef string::iterator si;
	static void call(si it, si ed) {}
	template<typename T, typename ... aT>
	static void call(si it, si ed, T a, aT... rest) {
		string b;
		for(; *it!=','; ++it)
			if(*it!=' ')
				b+=*it;
		cout << b << "=" << a << " ";
		call(++it, ed, rest...);
	}
};

/* ----------------------------------------------------------------------------------- */


void solve() {
	ll n;
	cin >> n;
	string ans = "";
	while(n) {
		ll k = n / 26;
		ll z = n % 26;
		if(z == 0) {
			ans += (char) 'z';
			k--;
		} else {
			ans += (char) ('a' + z - 1);
		}
		n = k;
	}
	for (int i = ans.size() - 1; i >= 0; i--) {
		cout << ans[i];
	}
	cout << endl;
}

int main() {
	solve();

	// __test {
	// 	solve();
	// }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define lp(i, n) for (int i = 0; i < (int)n; ++i)
#define read(n) scanf("%d", &n)
using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
int n, g;
int p[N], c[101][101], dp[101][N];
int solve(int idx, int sm){
    if (sm >= g)
        return 0;
    if (idx > n)
        return 1e9;
    int &ret = dp[idx][sm];
    if (ret != -1) return ret;
    ret = 1e9;
    for (int i = 1; i <= p[idx]; i++){
        ret = min(ret, solve(idx + 1, sm + ((idx * 100 * i) + c[idx][i])) + i);
        ret = min(ret, solve(idx + 1, sm));
    }
    return ret;
}
int main(){
   scanf("%d%d", &n, &g);
   lp(i, 101)
        lp(j, N)
            dp[i][j] = -1;
   lp(i, n){
        scanf("%d", &p[i + 1]);
        scanf("%d", &c[i + 1][p[i + 1]]);
   }
   printf("%d", solve(1, 0));
    return 0;
}



Measured memory_bytes: 394752
//Solution By SlavicG
#include <bits/stdc++.h>
using namespace std;
 
#define ll                          long long
 
#define forn(i,n)                   for(int i=0;i<n;i++)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
	
#define pb                          push_back
#define sz(a)                       (int)a.size()
#define mp                          make_pair
 
#define   endl                       "\n"
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
int main()
{
	unordered_map<int,bool> ac;
	unordered_map<int,int> f;
	int n,m;
	cin >> n >> m;
	int cnt  = 0;
	int wa = 0;
	for(int i = 0;i<m;i++)
	{
		int a; string c;
		cin >> a >> c; 
		if(!ac[a])
		{
			if(c == "AC"){
				cnt++;
				wa += f[a];
				ac[a] = true;
			}else{
				f[a]++;
			}
		}
	}
	cout << cnt << " " << wa << endl;
}

Measured memory_bytes: 11236
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    int min = Integer.MAX_VALUE;
    for(int i = 0; i < s.length() - 2; i++){
      int num = Integer.parseInt(s.substring(i, i + 3));
      int diff = Math.abs(num - 753);
      
      if(diff < min){
        min = diff;
      }
    }
    System.out.println(min);
  }
}

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

int top, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop() {
  top--;
  return S[top + 1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];

  while(scanf("%s", s) != EOF){
    if (s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if (s[0] == '-') {
      b = pop();
      a = pop();
      push(a - b);
    } else if (s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());

  return 0;
}


Measured memory_bytes: 2724
N=int(input())
X=list(map(int,input().split()))
X_sum=sum(X)
ans=0
ans_ant=0
P=int(X_sum/N)
P_ant=int(X_sum/N)+1
for i in range(N):
    ans+=(X[i]-P)**2
    ans_ant+=(X[i]-P_ant)**2
print(min(ans,ans_ant))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

#define rep(i,n) for(int i = 0;i < n;i++)
#define int long long
const int INF = 1e18;

int mypow(int x, int n) {
	int res = 1;
	while (n > 0) { 
		if (n & 1)res = res * x;	
		x = x * x;
		n >>= 1;
	}
	return res; 
}

string tostr(int n) {
	stringstream ss;
	ss << n;
	return ss.str();
}

//solve(i) i???????????°?????????????????????????§??????????
int solve(int m) {
	auto s = tostr(m);
	int n = s.size();
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int now = (i == n) ? m-1 : mypow(10, i)-1;
		int pre = mypow(10, i - 1)-1;
		int s3 = now / 3 - pre / 3;
		int s5 = now / 5 - pre / 5;
		int s15 = now / 15 - pre / 15;

		ans += i * (now - pre - s3 - s5 + s15);
		ans += (s3 + s5) * 4;
	}
	
	return ans;
}

string FizzBuzz(int m) {
	if (m == 0)return "";
	if (m % 3 == 0 && m % 5 == 0) {
		return "FizzBuzz";
	}
	if (m % 3 == 0) {
		return "Fizz";
	}
	if (m % 5 == 0) {
		return "Buzz";
	}
	return tostr(m);
}

signed main() {
	int s;
	cin >> s;
	s--;
	int l = 0, r = INF;
	while (r - l > 1) {
		int m = (l + r) / 2;
		if (solve(m) > s) {
			r = m;
		}
		else {
			l = m;
		}
	}
	s -= solve(r - 1);
	string st = FizzBuzz(r - 1);
	while (st.size() < s + 20) {
		st += FizzBuzz(r++);
	}
	cout << st.substr(s, 20) << endl;
	
	return 0;
}

Measured memory_bytes: 3224
function solve()
    n, k = [parse(Int, x) for x in split(readline())]
    sol = 0
    for l=k:n+1
        maxsum = l*(2n-l+1)÷2
        minsum = l*(l-1)÷2
        sol += maxsum - minsum + 1
        sol %= 1_000_000_007
    end
    return sol
end

println(solve())


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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int main() {
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	int ans = 2 * n;
	int maxx = 0;
	fori(i, 0, n) {
		int cur = 0;
		fori(j, 0, n) {
			if(t[j] != s[i + j]) {
				break;
			}
			cur++;
		}
		maxx = max(maxx, cur);
	}
	
	printf("%d\n", ans - maxx);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[17];
ll dp[17][150][2];
int sums=0;
ll getsum(int ind, int n, int sum, bool flag){
    if(ind>=n) return sum;
    
    int limit=9;
    if(!flag) limit= arr[ind];
    //flag=true means earlier ther is some smaller digit used so we can take till 9 this time;
    if(dp[ind][sum][flag]!=-1) return dp[ind][sum][flag];
    
    ll res=0;
    for(int i=0;i<=limit;i++){
        if(flag || i<limit)
            res= max(res, getsum(ind+1, n, sum+i, true ));
        else 
            res= max(res, getsum(ind+1, n, sum+i, false));
    }
    return dp[ind][sum][flag]= max(res,dp[ind][sum][flag]);
}

int main(){
    int t=1;
    while(t--){
        ll x; cin >> x;
        string a= to_string(x);
        
        int s=0;
        for(int i=0;i<a.size();i++)for(int j=0;j<150;j++)for(int k=0;k<2;k++) 
            dp[i][j][k]=-1;
        
        for(int i=0;i<a.size();i++) {arr[i]=a[i]-'0'; s += arr[i];}
        ll left=getsum(0, a.size(), 0, 0);

        // for(int i=0;i<b.size();i++)for(int j=0;j<150;j++)for(int k=0;k<2;k++) 
        //     dp[i][j][k]=-1;
        
        // for(int i=0;i<b.size();i++) arr[i]=b[i]-'0';
        // ll right=getsum(0, b.size(), 0, 0);

        // ll ans=right-left+s;
        cout << left << endl;
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

	ll cnt=0;
	for(int i=1; i<=n-1; i++) cnt+=(n-1)/i;
	cout<<cnt<<endl;
	return 0;
}


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

int main() {
	int n, m, X, Y;
	cin >> n >> m >> X >> Y;
	int x[105], y[105];

	for (int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	for (int i = 0; i < m; ++i) {
		cin >> y[i];
	}

	int xmax = x[0];
	for (int i = 1; i < n; ++i) {
		if (x[i] > xmax) xmax = x[i];
	}
	int ymin = y[0];
	for (int i = 1; i < m; ++i) {
		if (y[i] < ymin) ymin = y[i];
	}

	if (xmax >= ymin) {
		cout << "War" << endl;
		return 0;
	}

	for (int i = xmax + 1; i <= ymin; ++i) {
		if (X < i && i <= Y) {
			cout << "No War" << endl;
			return 0;
		}
	}
	cout << "War" << endl;
	
}

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

using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        sum += a.at(i);
    }

    if (sum % ((ll)n * (n + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }
    
    int k = sum / ((ll)n * (n + 1) / 2);
    
    vector<int> diff(n);
    for (int i = 0; i < n; i++) {
        diff.at(i) = a.at((i + 1) % n) - a.at(i);
    }

    for (int i = 0; i < n; i++) {
        diff.at(i) -= k;
        
        if (0 < diff.at(i) || -diff.at(i) % n != 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define ii pair<int,int>
#define mod 1000000007
#define endl '\n'
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return ans;
}

void sieve(int n){
	bool prime[n+1];
	memset(prime,true,sizeof(prime));
	for(int p=2;p*p<=n;p++){
		if(prime[p]){
			for(int i=p*p;i<=n;i+=p)
				prime[i]=false;
		}
	}
	for(int p=2;p<=n;p++){
		if(prime[p])
			cout<<p<<" ";
	}
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		vector<int> adj[n+1];
		for(int i=0;i<m;i++){
			int p,q;
			cin>>p>>q;
			adj[p].push_back(q);
			adj[q].push_back(p);
		}
		int dist[n+1];
		int ans[n+1];
		memset(ans,-1,sizeof(ans));
		memset(dist,-1,sizeof(dist));
		dist[1]=0;
		queue<int> q;
		q.push(1);
		while(q.empty()==false){
			int i = q.front();
			q.pop();
			for(auto j:adj[i]){
				if(dist[j] == -1 || dist[j]>dist[i] + 1){
					q.push(j);
					dist[j] = dist[i] + 1;
					ans[j] = i;
				}
			}
		}
		for(int i = 2; i<=n; i++){
			if(ans[i] == -1){
				cout<<"No";
				return 0;
			}
		}
		cout<<"Yes"<<endl;
		for(int j =2; j<=n; j++){
			cout<<ans[j]<<endl;
		}
	}
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		long L = sc.nextLong();
		long R = sc.nextLong();
		if (R < 2019) {
			long min = (L * R) % 2019;
			for (long i = L; i < R; i++) {
				for (long j = i + 1; j <= R; j++) {
					long cal = (i * j) % 2019;
					min = Math.min(min, cal);
				}
			}
			System.out.println(min);
			return;
		} else {
			int q = 1;
			boolean contain = false;
			while (q * 2019 <= R) {
				if (L <= q * 2019 && R >= 2019 * q) {
					contain = true;
					break;
				}
				q++;
			}
			if (contain) {
				System.out.println(0);
				return;
			} else {
				long min = (L * R) % 2019;
				for (long i = L; i < R; i++) {
					for (long j = i + 1; j <= R; j++) {
						long cal = (i * j) % 2019;
						min = Math.min(min, cal);
					}
				}
				System.out.println(min);
				return;
			}
		}
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

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

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

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

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

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

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 22868
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sum[] = new long[n + 1];
        for (int i = 0; i < n; i++) {
            sum[i + 1] = sum[i] + sc.nextLong();
        }
        long count = 0;
        Arrays.sort(sum);
        long tmp = sum[0];
        long tmpc = 1;
        for (int i = 1; i <= n; i++) {
            if (sum[i] == tmp) {
                tmpc++;
            } else {
                if (tmpc != 1) {
                    count += tmpc * (tmpc - 1) / 2;
                }
                tmp = sum[i];
                tmpc = 1;
            }
        }
        if (tmpc != 1) {
            count += tmpc * (tmpc - 1) / 2;
        }
        System.out.println(count);
    }
}


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

string str[]={" ","',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"};

int main(){
    string s;
    
    while(cin >> s){
        int len = s.size();
        
        int k = 0;
        if(s[len-1]!='0'){
            s += '0';
            k = 1;
        }
        
        string ans = "";
        for(int i = 0 ; i < len+k ; i++){
            int cnt = 1, j;
            for(j = i+1 ; j < len+k ; j++){
                if(s[i] != s[j]) break;
            }
            if(s[i] == '0'){
                if(j==i+2) ans += " ";
                else if(j==i+3) ans += "  ";
            }
            else{
                ans += str[s[i]-'0'][j-i-1];
            }
            i += j-i-1;
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>
#include <tuple>

using namespace std;


int main(){
	string s;
	cin >> s;
	int lval = 0;
	int best = 100000;
	for (int i = 0; i<s.length(); ++i) {
		lval = (lval % 100) * 10;
		lval += atoi(s.substr(i,1).c_str());
		best = min(best,abs(753 - lval));
	}
	cout << best << endl;;
	return 0;
}

Measured memory_bytes: 256