akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define inf 1e9
#define F first
#define S second
#define dbg(x) cout<<#x<<" value : "<<x<<"\n";
#define rep(i,j,k) for(int i = (j); i <= (k); i++)
#define rep__(i,j,k) for(int i = (j); i < (k); i++)
#define per(i,j,k) for(int i = (j); i >= (k); i--)
#define per__(i,j,k) for(int i = (j); i > (k); i--)
#define mst(a,b) memset(a,b,sizeof(a))
#define sf(n) scanf("%d",&n)
#define stf(n,m) scanf("%d%d",&n,&m)
#define pf(n) printf("%d\n",n)
#define slf(n) scanf("%lld",&n)
#define plf(n) printf("%lld\n",n)
priority_queue<int,vector<int>,greater<int> > q;
const int N=32010;
const int mod=1e9+7;
int n,m;
 main()
{
	sf(n);
	cout<<pow(n,3)<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>
#include <list>
using ll = long long;
using namespace std;
static ll imin = std::numeric_limits<ll>::min() / 2;
static ll imax = std::numeric_limits<ll>::max() / 2;
#define rep(i, n) for(ll i = 0; (i)<(n); ++(i))
#define rep1(i, n) for(ll i = 1; (i)<(n); ++(i))
#define rev_rep(i, n) for(ll i = (n) - 1; (i) >= 0; --(i))
#define range(a, i, b) for(ll i = (a); (i) < (b); ++(i))
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(ll i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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

ll fact(ll n){
  ll res=1;
  while(n>0){
    res*=n;
    n--;
  }
  return res;
}
    
ll pow(ll i, ll n){
  ll res=1;
  while(n>=0){
    res*=i;
    n--;
  }
  return res;
}

ll gcd(ll l, ll r){
  if(l<r){
    return gcd(r, l);
  }
  if(r == 0){
    return l;
  }
  return gcd(r, l % r);
}

template<class T>
vector<T> accum_sum(vector<T> a){
  vector<T> b(a.size() + 1);
  b[0] = a[0];
  rep(i, a.size()){
    b[i + 1] = b[i] + a[i];
  }
  return b;
}
constexpr ll mod = 1e9+7;

ll modfact(ll n){
  ll res=1;
  while(n>0){
    res %=mod;
    res*=n;
    n--;
  }
  return res%mod;
}
    
int main(int argc, char const* argv[])
{
  readl(n); readl(m);
  if (n-1==m || n+1==m) {
    cout<< modfact(n)*modfact(m) % mod << endl;
  }else if(n==m){
    cout<< (modfact(n)*modfact(m) % mod)  * 2 % mod<<endl;
  }else{
    cout<< 0 <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    s = input()

    g = []

    p = ' '
    o = 0
    for c in s:
        if p == c:
            o += 1 
        else:
            if p != ' ':
                g.append([p, o])
            o = 1
        p = c
    g.append([p, o])

    s = c = 0
    for i in g:
        if i[0] == '<':
            s += (i[1] * (2 * c + 1 + i[1])) // 2
            c += i[1]
        elif c < i[1]:
            s += (i[1] - c) + (i[1] * (i[1] - 1)) // 2
            c = 0
        else:
            s += (i[1] * (i[1] - 1)) // 2
            c = 0

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 71552
#include<stdio.h>

int main()
{
    int H, W, n, i, p;

    for(n = 0; ; n++)
    {
        scanf("%d %d", &H, &W);

        if(H == 0 && W == 0)
        {
            break;
        }

        for(i = 1; i <= H; i++)
        {
            for(p = 1; p <= W; p++)
            {
                printf("#");
                
                if(p == W)
                {
                    printf("\n");
                }
            }

            if(i == H)
            {
                printf("\n");
            }
        }

    }

    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for(int i = 0; m; i++){
        if(i == n) i = 0;
        if(a[0] > a[i]){
            sort(a.begin(), a.end());
            reverse(a.begin(), a.end());
            i = -1;
            continue;
        }
        a[i] /= 2;
        m--;
    }
    long long ans = 0;
    for(int i = 0; i < n; i++){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int n;
string s, t;

bool Read() {
  cin >> s;
  if (cin.eof())
    return 0;
  cin >> t;

  return 1;
}

void Process() {
  n = s.length();
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (s[i] != t[i])
      ans++;
  cout << ans << "\n";
}

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

  while (Read())
    Process();

  return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


int main(){
  int A,B,K;
  cin >> A >> B >> K;
  FOR(i,A,B+1){

    if(i < A+K)cout << i << endl;
    else if(i > B-K)cout << i << endl;


  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>
using namespace std;

int main() {
    string n;
    cin >> n;
    bool f = false;
    for (int i = 0; i < 3; i++) {
        if (n[i] == '7') {
            f = true;
        }
    }
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int Y,M,D;
  char c1,c2;
  cin >> Y >> c1 >> M >> c2 >> D;
  
  if(M <= 4){
    cout << "Heisei" << endl;
  }
  
  else {
    cout << "TBD" << endl;
  }
  
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define oo 1e8
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e6 + 5, M = 2 * N + 5;

int n, d;
int a[15][15];

int f(int x, int y){
    int total = 0;
    for(int i = 0 ; i < d ; ++i)
        total += ((a[x][i] - a[y][i]) * (a[x][i] - a[y][i]));
    int hna = sqrtl(1.0L * total);
    return (hna * hna == total);
}

int main(){
    scanf("%d%d", &n, &d);
    for(int i = 0 ; i < n ; ++i)
        for(int j = 0 ; j < d ; ++j)
            scanf("%d", &a[i][j]);
    int cnt = 0;
    for(int i = 0 ; i < n ; ++i)
        for(int j = i + 1 ; j < n ; ++j)
            cnt += f(i, j);
    printf("%d\n", cnt);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

int main()
  {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  LL res = 1;
  LD resd = 1;
  REP(i, n)
    {
    LL a;
    cin >> a;
    if(a == 0)
      {
      cout << 0 << endl;
      return 0;
      }
    res *= a;
    resd *= a;
    if(resd > 1e40)resd=1e20;
    }
  LL prog = 1;
  REP(i, 18)prog *= 10;


  if(resd > 4e18 || res > prog)
    {
    cout << -1 << endl;
    }
  else
    {
    cout << res << endl;
    }
  }



Measured memory_bytes: 3696
def out(bnum):
    print(' '+str(bnum['1f']).replace(',','')[1:10*2])
    print(' '+str(bnum['2f']).replace(',','')[1:10*2])
    print(' '+str(bnum['3f']).replace(',','')[1:10*2])
    
n = int(input())
b1 = {'1f': [0]*10, '2f': [0]*10, '3f': [0]*10}
b2 = {'1f': [0]*10, '2f': [0]*10, '3f': [0]*10}
b3 = {'1f': [0]*10, '2f': [0]*10, '3f': [0]*10}
b4 = {'1f': [0]*10, '2f': [0]*10, '3f': [0]*10}
for i in range(n):
    b, f, r, v = map(int,input().split())
    r -= 1
    if b == 1:
        b1[repr(f)+'f'][r] += v
    elif b == 2:
        b2[repr(f)+'f'][r] += v
    elif b == 3:
        b3[repr(f)+'f'][r] += v
    elif b == 4:
        b4[repr(f)+'f'][r] += v
out(b1)
print('#'*20)
out(b2)
print('#'*20)
out(b3)
print('#'*20)
out(b4)

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


void solve(string S){
    int count1 = 0;
    for (int i=0; i<S.length();i++) {
        if (i%2 != S[i] - '0') {
            count1 ++;
        }
    }
    int count2 = S.length() - count1;
    if (count1 >= count2) {
        cout << count2 << endl;
    } else {
        cout << count1 << endl;
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 512
import math
n = int(input())

sqn = int(math.sqrt(n))+1
count = 0
aset = [0]*(n+1)
for x in range(1,sqn):
    for y in range(x,sqn):
        for z in range(y,sqn):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                if x == y and y ==z:
                    aset[a] +=1
                else:
                    if x == y or y ==z:
                        aset[a] +=3
                    else:
                        aset[a] +=6

for i in range(1,n+1):
    print(aset[i])

Measured memory_bytes: 9460
n, k = map(int, input().split())
v = list( map(int, input().split()) )

m = min(n, k)
ans = -10**9
for l in range(m+1):
    for r in range(m-l+1):
        jry = v[:l]+v[-r:] if r>=1 else v[:l]
        t = k - l - r
        s = 0
        for i in sorted(jry):
            if i<0 and t>0:
                s += -i
                t -= 1
        ans = max(ans, sum(jry)+s)

print(ans)

Measured memory_bytes: 3064
import java.io.InputStream

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val m = nextInt()
    val a = IntArray(n) { nextInt() - 1 }

    val start = IntArray(m)
    val end = IntArray(2 * m)
    val endCost = LongArray(2 * m)

    var inRange = 0
    var cost = 0L

    (0..n - 2).forEach {
        val from = a[it]
        val to = if (a[it + 1] >= from) {
            a[it + 1]
        } else {
            a[it + 1] + m
        }
        start[from]++
        end[to]++
        endCost[to] += to - from.toLong() - 1
        if (m in (from + 1)..to) {
            inRange++
            cost += 1 + to - m
        } else {
            cost += to - from
        }
    }

    var best = cost
    (1 until m).forEach { x ->
        inRange -= end[x - 1]
        inRange -= end[x + m - 1]
        cost -= inRange
        cost += endCost[x - 1]
        cost += endCost[x + m - 1]
        if (x - 1 >= 0) {
            inRange += start[x - 1]
        }
        best = best.coerceAtMost(cost)
    }

    println(best)
}

val input = FastScanner()

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}

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

int c[405][405];
int visited[405][405] = {};
vector<pair<int,int>> v;

long long ans_w;
long long ans_bl;

vector<long long> aw,ab;

int dfs(int x, int y){
  if(visited[x][y]) return 0;
  
  visited[x][y] = 1;
  
  if(c[x][y] == 1) ++ans_bl;
  else ++ans_w;
    
  if(c[x+1][y] != c[x][y]) dfs(x+1, y);
  if(c[x-1][y] != c[x][y]) dfs(x-1, y);
  if(c[x][y+1] != c[x][y]) dfs(x, y+1);
  if(c[x][y-1] != c[x][y]) dfs(x, y-1);
}

int main(){
  int h,w;
  cin >> h >> w;
  
  string s;
  
  for(int i=1; i<=h; i++){
    cin >> s;
    for(int j=1; j<=w; j++){
      c[i][j] = (s[j-1]=='#') ? 0:1;
    }
  }
  
  for(int i=1; i<=h; i++){
    c[i][0] = c[i][1];
    c[i][w+1] = c[i][w];
  }
  
  for(int i=1; i<=w;i++){
    c[0][i] = c[1][i];
    c[h+1][i] = c[h][i];
  }
  
  long long answer = 0;
  
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      if(c[i][j] == 1){
        ans_w = 0;
        ans_bl = 0;
      
        dfs(i,j);
        answer += ans_w * ans_bl;
      }
    }
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 11520
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int a, b, q; cin >> a >> b >> q;
	vector<long long> s(a), t(b);
	rep(i, 0, a-1)cin >> s[i]; rep(i, 0, b-1)cin >> t[i];
	rep(_, 1, q)
	{
		long long x; cin >> x;
		long long res = 1LL << 60;
		int it = lower_bound(all(s), x) - s.begin();
		for (int i = max(0, it - 1); i < min(a, it + 1); ++i)
		{
			long long y = s[i];
			int it2 = lower_bound(all(t), y) - t.begin();
			for (int j = max(0, it2 - 1); j < min(b, it2 + 1); ++j)
			{
				res = min(res, abs(x - y) + abs(y - t[j]));
			}
		}

		it = lower_bound(all(t), x) - t.begin();
		for (int i = max(0, it - 1); i < min(b, it + 1); ++i)
		{
			long long y = t[i];
			int it2 = lower_bound(all(s), y) - s.begin();
			for (int j = max(0, it2 - 1); j < min(a, it2 + 1); ++j)
			{
				res = min(res, abs(x - y) + abs(y - s[j]));
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 2944
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

class Main {
	public static void main(String[] args) {
		List<Integer> A = new ArrayList<Integer>();
		Scanner scan = new Scanner(System.in);
		int q = scan.nextInt();
		int i = 0;
		while (i < q) {
			i++;

			int Cmd = scan.nextInt();
			switch (Cmd) {
			case 0:
				int x = scan.nextInt();
				pushBack(A, x);
				break;
			case 1:
				int p = scan.nextInt();
				randomAccess(A, p);
				break;
			case 2:
				popBack(A);
				break;
			default:
				break;
			}
		}
	}
	private static void pushBack(List<Integer> A, int x) {
		A.add(x);
	}
	private static void randomAccess(List<Integer> A, int p) {
		System.out.println(A.get(p));
	}
	private static void popBack(List<Integer> A) {
		A.remove(A.size() - 1);
	}
}



Measured memory_bytes: 140924
facs = []
M = 1000000007

def modulo(n):
    global facs
    facs = [1]*(n+1)
    last = 1
    for i in range(1,n+1):
        last = facs[i] = mulmod(last,i,M)
        
def mulmod(x,y,p):
    return x*y % p
def divmod(x,y,p):
    return mulmod(x,powmod(y,p-2,p),p)

def ncr(n,r):
    if n<r:
        return 0
    if n==r:
        return 1
    res = facs[n]
    res = divmod(res,facs[r],M)
    res = divmod(res,facs[n-r],M)
    return res

def powmod(x,y,p):
    if y==0:
        return 1
    elif y==1:
        return x % p
    elif (y%2)==0:
        return powmod(x,y//2,p)**2 % p
    else:
        return powmod(x,y//2,p)**2 * x % p
def resolve():
    n,m,k = map(int,input().split())
    modulo(2*10**5+5)
    kumi=ncr(n*m-2,k-2)
    ans = 0
    for i in range(1,n):
        ans = ans + ((i*(n-i)*m*m)%M)
    for i in range(1,m):
        ans = ans + ((i*(m-i)*n*n)%M)
    print(ans*kumi%M)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 41072
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False

while True:
    try:
        n=int(input())
    except:
        break
    print(sum(prime[2:n+1]))

Measured memory_bytes: 31900
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        ks: [[i64]; m],
        ps: [i64; m],
    }
    fn is_on(s: &[i64], p: i64, i: i64) -> bool {
        let mut count = 0;
        for s in s.iter() {
            if (i & (1 << (*s - 1))) != 0 {
                count += 1;
            }
        }
        count % 2 == p
    }
    let mut count = 0;
    for i in 0..(1 << n) {
        let mut ok = true;
        for (p_index, ks) in ks.iter().enumerate() {
            if !is_on(ks, ps[p_index], i) {
                ok = false;
                break;
            }
        }
        if ok {
            count += 1;
        }
    }
    println!("{}", count);
}


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

int main() {
int A,B;
string S;
cin>>A>>B>>S;
for(int i=0;i<S.size();i++){
	if(i==A){
		if(S[i]!='-'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	else{
		if(!(S[i]>='0' && S[i]<='9')){
			cout<<"No"<<endl;
			return 0;
		}
	}

	



}
	cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print_vector(vector<T> &vec)
{
    for (auto elem : vec)
    {
        cout << elem << endl;
    }
}
int main()
{
    int n;
    cin >> n;

    int special_moves;
    cin >> special_moves;

    vector<long long> enemy_hp(n);
    for (int i = 0; i < n; i++)
    {
        cin >> enemy_hp.at(i);
    }

    sort(enemy_hp.begin(), enemy_hp.end());

    long long ans = 0;
    for (auto i = 0; i < n - special_moves; i++)
    {
        ans += enemy_hp.at(i);
    }

    cout << ans;
}

Measured memory_bytes: 1792
/*
く__,.ヘヽ.　　　　/　,ー､ 〉
　　　　　＼ ', !-─‐-i　/　/´
　　　 　 ／｀ｰ'　　　 L/／｀ヽ､
　　 　 /　 ／,　 /|　 ,　 ,　　　 ',
　　　ｲ 　/ /-‐/　ｉ　L_ ﾊ ヽ!　 i
　　　 ﾚ ﾍ 7ｲ｀ﾄ　 ﾚ'ｧ-ﾄ､!ハ|　 |
　　　　 !,/7 '0'　　 ´0iソ| 　 |　　　
　　　　 |.从"　　_　　 ,,,, / |./ 　 |
　　　　 ﾚ'| i＞.､,,__　_,.イ / 　.i 　|
　　　　　 ﾚ'| | / k_７_/ﾚ'ヽ,　ﾊ.　|
　　　　　　 | |/i 〈|/　 i　,.ﾍ |　i　|
　　　　　　.|/ /　ｉ： 　 ﾍ!　　＼　|
　　　 　 　 kヽ>､ﾊ 　 _,.ﾍ､ 　 /､!
　　　　　　 !'〈//｀Ｔ´', ＼ ｀'7'ｰr'
　　　　　　 ﾚ'ヽL__|___i,___,ンﾚ|ノ
　　　　　 　　　ﾄ-,/　|___./
　　　　　 　　　'ｰ'　　!_,.
*/
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<fstream>
#include<sstream>
#include<stack>
#include<queue>
#include<map>
#include<deque>
#include<string>
#include<cstring>
#include<cmath>
#include<cctype>
#include<climits>
#include<algorithm>
#include<utility>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr front()
#define tp top()

typedef long long int ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> ppi;
typedef pair<int, pii> pip;

#define all(x) x.begin(),x.end()
#define CASE() for(int Case=1;Case<=Tc;Case++)
#define ITR(itr,it) for(__typeof((it).begin()) itr=(it).begin();itr!=(it).end();itr++)
#define iofast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define iofile freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)

const int adj[8][2]={{-1,0},{0,-1},{1,0},{0,1},{-1,-1},{-1,1},{1,1},{1,-1}};
const ll LLINF=9e18;
const int INF=2e9;
const int MOD=1e9+7;
const double EPS=1e-10;
const double PI=acos(-1);
const int SIZE=100005;

map<int,int> Mp;
int cnt=1;

int f(int N){
	
	// printf("%d, ", N);
	
	if(Mp[N]>0) return cnt;
	Mp[N]=cnt++;
	if(N%2==0) return f(N/2);
	if(N%2==1) return f(3*N+1);
	
}


int main (){
	
	int N;
	
	scanf("%d", &N);
	printf("%d\n", f(N));
	
	return 0;
}

Measured memory_bytes: 256
n, x, y = map(int, input().split())
l = [0 for i in range(n - 1)]
for i in range(n):
    for j in range(i + 1, n):
        l[min(j - i, abs(x - 1 - i) + abs(j - (y - 1)) + 1, abs(y - 1 - i) + abs(j - (x - 1)) + 1) -1] += 1
for i in range(n - 1):
    print(l[i])

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll  long long
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
int main()
{
    io;
    int n;
    cin >> n;
    int A[n],B[n];
    for(int i=0;i<n;i++)
    {
        cin >> A[i] >> B[i];
    }
    ll int one=1,two=1,mlt;
    for(int i=0;i<n;i++)
    {
        mlt=max((one+A[i]-1)/A[i],(two+B[i]-1)/B[i]);
        while(one>A[i]*mlt||two>B[i]*mlt)
        mlt++;
        one = A[i]*mlt;
        two = B[i]*mlt;
    }
    cout << one+two ;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

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

    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];

    ll ans = 0;
    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    rep(i, N) {
        int a = lower_bound(ALL(A), B[i]) - A.begin() - 1;
        int c = upper_bound(ALL(C), B[i]) - C.begin();

#ifdef DEBUG
        DUMP(i);
        DUMP2(a, c);
#endif

        if (a >= 0 && c >= 0) ans += ((ll)a+1) * (N - c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  // ios_base::sync_with_stdio(0);
  // cin.tie(0); cout.tie(0);
  int n,m;
  cin >> n >> m;
  vector<vector<int>> a(n);
  vector<int> inDegree(n,0);
  for(int i=0;i<m;i++) {
    int u,v; 
    cin >> u >> v;
    u--; v--;
    a[u].push_back(v);
    inDegree[v]++;
  }
  vector<int> dist(n,0);
  queue<int> q;
  for(int i=0;i<n;i++) {
    if (inDegree[i] == 0)
      q.push(i);
  }
  // cerr << "INDEGEREE: ";
  // for(auto e: inDegree) {
  //   cerr << e << ' ';
  // }
  // cerr << '\n';
  while(!q.empty()) {
    auto u = q.front();
    q.pop();
    // cerr << "Current: " << u+1 << '\n';
    for(auto child: a[u]) {
      inDegree[child]--;
      if (inDegree[child] == 0) {
        q.push(child);
        dist[child] = dist[u] + 1;
        // cerr << "Pushed: " << child+1 << '\n';
      }
    }
  }
  
  int ans = 0;
  for(int i=0;i<n;i++) {
    ans = max(ans,dist[i]);
    // cerr << dist[i] << ' ';
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 6528
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long ll;
const int maxn = 1e5 + 1e3;
using namespace std;

struct P {
    ll val, idx;
    P() {}
    P(ll v, ll i) : val(v), idx(i) {}
    bool operator < (P p) const {
        if(val != p.val) return val < p.val;
        return idx < p.idx;
    }
} p[maxn];
ll C[maxn];
ll a[maxn], n;

int main() {
    while(scanf("%lld", &n) != EOF) {
        memset(C, 0, sizeof C);
        for(int i = 1; i <= n; i++) {
            scanf("%lld", &a[i]);
            p[i].val = a[i];
            p[i].idx = i;
        }
        p[0].val = 0;
        ll id = n;
        sort(p + 1, p + n + 1);
        for(int i = n; i >= 1; i--) {
            if(p[i].val == p[i - 1].val) continue;
            id = min(id, p[i].idx);
            C[id] += (p[i].val - p[i - 1].val) * (n - i + 1);
        }
        for(int i = 1; i <= n; i++) printf("%lld\n", C[i]);
    }
    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n;
	cin >> n;
    int temp=n,sum=0;
    while(temp) sum+=(temp%10),temp/=10;
    if(n%sum==0) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
grid = [[v for v in input()[:-1]] for _ in range(H)]

Q = []
cnt = 0
for i in range(H):
    for j in range(W):
        if grid[i][j] == "#":
            Q.append([i, j])
            cnt += 1

DX = [-1, 1, 0, 0]
DY = [0, 0, -1, 1]
d = 0
# for _ in range(5):
while cnt < H*W:
    d += 1
    tmp = []
    #print("d->", d)
    # print(Q)
    # print(dist)
    # print(cnt)
    # print("-------")
    for x, y in Q:
        for dx, dy in zip(DX, DY):
            nx = x+dx
            ny = y+dy
            if 0 <= nx < H and 0 <= ny < W:
                if grid[nx][ny] == ".":
                    grid[nx][ny] = "#"
                    tmp.append([nx, ny])
                    cnt += 1
            else:
                continue
    Q = tmp
# print(dist)
print(d)


Measured memory_bytes: 172692
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include<omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(b / a, c) << endl;
	return 0;

}


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

using namespace std;

#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)

int main(){
  int a,b,ans;
  cin >> a >> b;
  if(a>b)
    ans = a + (a-1);
  else if(a<b)
    ans = b + (b-1);
  else
    ans = a + b;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, N) for (int i = x; i < (N); i++)
using namespace std;
int main()
{
    int A, B;
    cin >> A >> B;
    vector<int> ans(4);
    ans[0] = 1;
    ans[A] = 1;
    ans[B] = 1;
    rep(i, 0, 4)
    {
        if (ans[i] != 1)
        {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.math.*;
import java.math.*;
public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		//int a = sc.nextInt();
		// スペース区切りの整数の入力
		//int b = sc.nextInt();
		//int c = sc.nextInt();
		// 文字列の入力
		//String s = sc.next();
		//1文字ずつ
		//s.atChar(i);
		// 出力
		//System.out.println("");
		int count=0;
		int D=sc.nextInt();
		int N=sc.nextInt();
		if(N==100){
			N=N+1;
		}
		
		int x=(int)Math.pow(100, D)*N;
		System.out.println(x);
		
	}
}

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

long long s[410];
long long f[410][410];

void readll(long long &v){
	char c;
	while((c=cin.get())<'0' || c>'9');
	v=c^48;
	while((c=cin.get())>='0' && c<='9') v=(v<<3)+(v<<1)+(c^48);
}

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	
	int N;
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>s[i];
		s[i]+=s[i-1];
	}
	
	for(int i=2;i<=N;i++)
		for(int j=1;j<=N-i+1;j++){
			f[j][i+j-1]=1e18+0.5;
			for(int k=j;k<=i+j-2;k++)
				f[j][i+j-1]=((f[j][i+j-1]<f[j][k]+f[k+1][i+j-1])?
							f[j][i+j-1]:(f[j][k]+f[k+1][i+j-1]));
			f[j][i+j-1]+=s[i+j-1]-s[j-1];
		}
	return cout<<f[1][N]<<endl,0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long int





template <typename T> void max_self(T& a, T b) {

    a = max(a, b);

}



// dp[n][m]



bool first_row_or_column(pair<int,int> p) {

    return p.first == 0 || p.second == 0;

}



const int INF = 1e9 + 5;



int main() {

    string a, b;

    cin >> a >> b;

    vector<vector<pair<int,pair<int,int>>>> dp(a.length() + 1,

        vector<pair<int,pair<int,int>>>(b.length() + 1, {-INF,{0,0}}));

    dp[0][0] = {0, {0,0}};

    // dp[i][j] - the max total length so far

    for(int i = 0; i < (int) a.length(); ++i) {

        for(int j = 0; j < (int) b.length(); ++j) {

            if(a[i] == b[j]) {

                max_self(dp[i+1][j+1], make_pair(dp[i][j].first + 1, make_pair(i,j)));

            }

            max_self(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i,j)));

            max_self(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i,j)));

        }

    }

    pair<int,pair<int,int>> answer = {0,{0,0}};

    for(int i = 0; i <= (int) a.length(); ++i) {

        for(int j = 0; j <= (int) b.length(); ++j) {

            max_self(answer, make_pair(dp[i][j].first, make_pair(i, j)));

        }

    }

    string s;

    pair<int,int> cur = answer.second;

    while(!first_row_or_column(cur)) {

        int i = cur.first;

        int j = cur.second;

        pair<int,int> previous = dp[i][j].second; // a cell from which we came to (i,j)



        if(previous == make_pair(i - 1, j - 1)) {

            assert(a[i-1] == b[j-1]);

            s += a[i-1];

        }

        cur = previous;

    }

    //~ debug() << answer;

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

    cout << s << endl;

}


Measured memory_bytes: 106880
//
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    long t[n][3];
    for(int i = 0; i < n; i++){
        cin >> t[i][0] >> t[i][1] >> t[i][2];
        sort(t[i], t[i] + 3);
    }
    for (int i = 0; i < n; i ++) {
        //printf("(%ld, %ld, %ld)", t[i][0], t[i][1], t[i][2]);
        if(pow(t[i][0], 2) + pow(t[i][1], 2) == pow(t[i][2], 2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3220
using System;

namespace Atcoder_test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int x1, x2, y1, y2;
            string[] str = Console.ReadLine().Split(' ');
            x1 = int.Parse(str[0]);
            y1 = int.Parse(str[1]);
            x2 = int.Parse(str[2]);
            y2 = int.Parse(str[3]);

            int x_distance = x2 - x1;
            int y_distance = y2 - y1;

            int x3 = x2 - y_distance;
            int y3 = y2 + x_distance;
            int x4 = x1 - y_distance;
            int y4 = y1 + x_distance;

            Console.WriteLine(x3 + " " + y3 + " " + x4 + " " + y4);
        }
    }
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll n;
    cin>>n;
    string str;
    cin>>str;
    VL arr(26,0);
    fr(i,0,n)
    {
        arr[str[i]-'a']++;
    }
    ll prod=1;
    fr(i,0,26)
    {
        prod*=(arr[i]+1);
        prod%=mod;
    }
    prod+=(mod-1);
    prod%=mod;
    cout<<prod<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<":\n";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

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

using namespace std;

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> ii;
typedef pair<lli, lli> ll;

int main() {
	lli n, ans = 0;
	scanf("%lld", &n);
	for (lli i = 1; i <= n; i++)
		for (lli j = 1; j <= n; j++) {
			if (i * j >= n)
				break;
			ans++;
		}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3824
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  ll x; cin >> x;
  ll ng=-1, ok=100000;
  while(ok - ng > 1) {
    ll md = (ng + ok) / 2;
    if (md * (md+1) / 2 >= x) ok = md;
    else ng = md;
  }
  cout << ok << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] spot = new int[n + 2];
    spot[0] = 0;
    spot[n + 1] = 0;
    int totalPrice = 0;
    for (int i = 1; i <= n; i++) {
      spot[i] = sc.nextInt();
      totalPrice += Math.abs(spot[i] - spot[i - 1]);
    }
    totalPrice += Math.abs(spot[n]);
    for (int i = 1; i <= n; i++) {
      int delta = Math.abs(spot[i - 1] - spot[i + 1]) - Math.abs(spot[i] - spot[i - 1]) - Math.abs(spot[i + 1] - spot[i]);
      System.out.println(totalPrice + delta);
    }
   
   
  }
}

Measured memory_bytes: 67484
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> q, P, Y;
    vector<vector<int>> vq(n+1, q);
    rep(i, m){
        int p, y;
        cin >> p >> y;
        P.push_back(p);
        Y.push_back(y);
        vq[p].push_back(y);
    }

    rep2(i, 1, n+1){
        sort(vq[i].begin(), vq[i].end());
    }

    rep(i, m){
        int nowp = P[i], digp=0;
        while(nowp){
            nowp /= 10;
            digp++;
        }
        auto it = lower_bound(vq[P[i]].begin(), vq[P[i]].end(), Y[i]);
        int x = it - vq[P[i]].begin() + 1, digx=0;
        while (x) {
          x /= 10;
          digx++;
        }
        rep(j, 6-digp){
            cout << 0;
        }
        cout << P[i];
        rep(j, 6-digx){
            cout << 0;
        }
        cout << it - vq[P[i]].begin() + 1<< endl;
    }
    return 0;
}

Measured memory_bytes: 9548
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 使うマッチ棒の本数が等しい場合は大きい数だけ考えれば良い
A.sort(reverse=True)
s = set()
candidates = [] # [a, nums[a]]
for a in A:
  if nums[a] in s:
    continue
  s.add(nums[a])
  candidates.append([a, nums[a]])


dp1 = [0] * (N+1)
dp2 = [-1] * (N+1)
d = {}
for a, n in candidates:
  if n <= N:
    dp1[n] = 1
    dp2[n] = 0
    d[n] = a

for i in range(N+1):
  for a, n in candidates:
    if i >= n and dp1[i-n]:
      if dp1[i] < dp1[i-n] + 1:
        dp1[i] = dp1[i-n] + 1
        dp2[i] = i-n

ans = []
idx = N
while idx:
  next_idx = dp2[idx]
  ans.append(d[idx - next_idx])
  idx = next_idx

ans.sort(reverse=True)
print(''.join(list(map(str, ans))))

Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define SZ(v) ((int)(v).size())

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
	string s1, s2;
	cin >> s1 >> s2;
	if (s1.length() < s2.length()) cout << "LESS";
	else if (s1.length() > s2.length()) cout << "GREATER";
	else if (s1 < s2) cout << "LESS";
	else if (s1 > s2) cout << "GREATER";
	else cout << "EQUAL";
	cout << '\n';
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  int row = -1;
  int col = -1;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      string s;
      cin >> s;
      if (s == "snuke") {
	row = i;
	col = j;
      }
    }
  }
  cout << (char)(col + 'A') << (row + 1) << '\n';
  return 0;
}


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

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

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> X(N);
    rep(i, N)   std::cin >> X[i];

    // 全部の座標の全部の住人に対して体力を考える 
    double hp = DBL_MAX;
    rep(P, 100)
    {
        double tmp_hp = 0.0;
        // 体力を計算 
        rep(j, N)
        {
            double plus_hp = abs(X[j] - P); //  
            tmp_hp += plus_hp * plus_hp;
        }

//        printf("[%d:%f |%f]\n", P, tmp_hp, hp);

        // 体力が少ない座標を取る 
        if(tmp_hp < hp)
        {
            hp = tmp_hp;
        }
    }

    std::cout << hp << std::endl;

    return 0;
}

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

int main()
{
    std::string a;
    std::cin>> a;

    if( a == "SUN" )
    {
        std::cout<< 7;
    }
    else if( a == "MON" )
    {
        std::cout<< 6;
    }
    else if( a == "TUE" )
    {
        std::cout<< 5;
    }
    else if( a == "WED" )
    {
        std::cout<< 4;
    }
    else if( a == "THU" )
    {
        std::cout<< 3;
    }
    else if( a == "FRI" )
    {
        std::cout<< 2;
    }
    else if( a == "SAT" )
    {
        std::cout<< 1;
    }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		char[] s1 = s.toCharArray();
		if(Character.isUpperCase(s1[0])) {
			System.out.print("A");
		}else {
			System.out.print("a");
		}

	}

}


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

int main(){
    int r,D;
    cin >> r >> D;
    int x[11]={};
    
    cin >> x[0];
    
    for(int i = 0;i<10;i++){
        x[i+1]=r*x[i] - D;
        cout << x[i+1] <<endl;
    }

    
    

}

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

#define all(x) begin(x), end(x)
#define log(x) cout << (x) << endl
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i,a,b) for (int i = (int)a; i >= (int)b; --i)
#define loop(i,a,b) for(int i = (int)(a); i < (int)(b); ++i)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;


bool cmp_x(const pi& x, const pi& y) {
	return x.first < y.first;
}

bool cmp_y(const pi& x, const pi& y) {
	return x.second > y.second;
}

int main() {
	int n,x,y;
	cin >> n;

	vpi r(n), b(n);
	rep (i, n)cin>>x>>y,r[i]={x,y};
	rep (i, n)cin>>x>>y,b[i]={x,y};

	sort(all(r),cmp_y), sort(all(b),cmp_x);

	int c = 0;
	rep (i, n) {
		rep (j, n) {
			if (b[i].first>r[j].first && b[i].second>r[j].second) {
				c += 1;
				r[j] = {10000, 10000};
				break;
			}
		}
	}

	log(c);


	return 0;
}



Measured memory_bytes: 256
import Data.Functor

main = do
  n <- getRows <$> getContents
  mapM_ print $ map (sum4 [0..9]) n

sum4 :: [Int] -> Int -> Int
sum4 xs n = length [(a,b,c,d) | a <- xs, b <- xs, c <- xs, d <- xs, a + b + c + d == n]

getRows s = map (read :: (String -> Int)) $ lines s

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

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<vector<int>> CA(N, vector<int>(M+1));
  for (int i = 0; i < N; i++)
  {
      for (int j = 0; j <M+1; j++)
      {
          cin >> CA[i][j];
      }
  }

    
    int min=10000000;
    bool F=1;

  for (int tmp = 0; tmp < (1<<N); tmp++)
  {
    bitset<12> s(tmp);
    bool f=1;
    vector<int> JUK(M+1, 0);
    for (int i = 0; i < 12; i++)
    {
        if(s.test(i))
        {
            for (int j = 0; j < M+1; j++)
            {
                JUK[j] += CA[i][j];
            }
        }
    }
    for (int k = 1; k < M+1; k++)
    {
        if(JUK[k]<X) f=0;

    }
    if(f)
    {
        if(JUK[0]<min) min =JUK[0];
        F = 0;
    }
  }
  if(F){
    cout << -1 << endl;
    return 0;
  }
  cout << min << endl;

    return 0;
}



Measured memory_bytes: 3600