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

using namespace std;

struct TPoint {
    long long x, y;
};

long long sqr(long long a) {
    return a*a;
}

int main(int argc, char const *argv[]) {
    long long n, d;
    std::cin >> n >> d;
    std::vector<TPoint> p(n);
    for (int i = 0; i < n; i++)
        std::cin >> p[i].x >> p[i].y;
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (sqr(p[i].x) + sqr(p[i].y) <= sqr(d)) c++;
    }
    std::cout << c << '\n';
}


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

using namespace std;

int main() {
    int n, q;
    string s;
    cin >> n >> q >> s;

    vector<int> l(q), r(q);
    for (int i = 0; i < q; ++i) {
        cin >> l[i] >> r[i];
    }

    vector<int> d(n + 1,0);
    for (int i = 0; i < n; i++) {
        d[i + 1] = d[i];
        if (s.substr(i, 2) == "AC") d[i + 1]++;
    }

    for (int i = 0; i < q; ++i) {
        cout << d[r[i] - 1] - d[l[i] - 1] << endl;
    }
    return 0;
}


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

int main(){
    int A, B, T;
    cin>>A>>B>>T;

    int acum = A;
    int ans = 0;
    while(acum <= T){
        ans += B;
        //cout<<acum<<" "<<ans<<endl;
        acum += A;
    }
    cout<<ans<<endl;
    return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	long long X, i, ans;
	cin >> X;
	ans = X;
	for(i = 1; ; i++){
		long long s = (i * (i + 1)) / 2;
		if(s >= X){
			break;
		}
	}
	ans = min(X, i);
	printf("%lld\n", ans);
	return 0;
}

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



int main(){
    ios_base::sync_with_stdio(false);
    //freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    int size; cin >> size;
    map<string, int> mp;
    int mxBef = 0;
    while(size--){
        string str; cin >> str;
        mp[str]++;
        mxBef = max(mxBef,mp[str]);
    }
    for(auto it : mp){
        if(it.second == mxBef){
            cout << it.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 23808
#include "bits/stdc++.h"
using namespace std;
#define y1 xoxo
const int N=1e6+20;
int n,m,k,l,x1,y1,x2,y2;
string a[N];
vector <int> dp[N];
queue <pair <int,int>> q;
set <int> r[N],c[N];

bool invalid(int x,int y)
{
	return min(x,y)<0 or x>=n or y>=m or a[x][y]=='@';
}

void add(int x,int y,int d)
{
	q.push({x,y});
	dp[x][y]=d;
	r[x].erase(y);
	c[y].erase(x);
}

void right(int x,int y)
{
	int sx=x,sy=y,d=dp[x][y];
	while(1729)
	{
		auto it=r[x].upper_bound(y);
		if(it==r[x].end() or *it-sy>k) break;
		y=*it;
		if(invalid(x,y)) break;
		add(x,y,d+1);
	}
}

void down(int x,int y)
{
	int sx=x,sy=y,d=dp[x][y];
	while(1729)
	{
		auto it=c[y].upper_bound(x);
		if(it==c[y].end() or *it-sx>k) break;
		x=*it;
		if(invalid(x,y)) break;
		add(x,y,d+1);
	}
}

void left(int x,int y)
{
	int sx=x,sy=y,d=dp[x][y];
	while(1729)
	{
		auto it=r[x].upper_bound(y);
		if(it==r[x].begin()) break;
		it--;
		if(sy-*it>k) break;
		y=*it;
		if(invalid(x,y)) break;
		add(x,y,d+1);
	}
}

void up(int x,int y)
{
	int sx=x,sy=y,d=dp[x][y];
	while(1729)
	{
		auto it=c[y].upper_bound(x);
		if(it==c[y].begin()) break;
		it--;
		if(sx-*it>k) break;
		x=*it;
		if(invalid(x,y)) break;
		add(x,y,d+1);
	}
}

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

	cin>>n>>m>>k;
	cin>>x1>>y1>>x2>>y2;
	for(int i=0;i<n;i++) cin>>a[i];
	x1--,y1--,x2--,y2--;

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			dp[i].push_back(INT_MAX);
			r[i].insert(j);
			c[j].insert(i);
		}
	}

	add(x1,y1,0);
	while(not q.empty())
	{
		auto p=q.front();
		int x=p.first,y=p.second;
		q.pop();

		right(x,y);
		left(x,y);
		up(x,y);
		down(x,y);
	}

	if(dp[x2][y2]==INT_MAX) dp[x2][y2]=-1;
	printf("%d",dp[x2][y2]);
}

Measured memory_bytes: 251376
#include<iostream>
using namespace std;
int main() {
  int a, b, c, x = 0;
  cin >> a >> b >> c;
  for (int i = a; i <= b; i++) {
    if (c % i == 0) {
      x += 1;
    }
  }
  cout << x << endl;
  return 0;
}

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

signed main() {
	int k, x; cin >> k >> x;
	for (int i = x - k + 1; i <= x + k - 1; i++) {
		if (i != x - k + 1)cout << ' ';
		cout << i;
	}cout << endl;
}

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

int main() {
    cout<<fixed<<setprecision(7);
    int N;
    cin >> N;
  if (N%2 == 0) {
    cout << 0.5000000000<< endl;
  }
  else {
      double ans =(double) (((N-1)/2)+1)/N;
    cout << ans<< endl;
  }

}

Measured memory_bytes: 256
type Expression = (Int, Char, Int)

parse :: String -> Expression
parse s =
  let [a, op, b] = words s
  in (read a, head op, read b)

main :: IO ()
main = do
  (a, op, b) <- parse <$> getLine :: IO Expression
  print $ if op == '+' then a + b else a - b


Measured memory_bytes: 508
N = int(input())
T = [int(i) for i in input().split()]
L = [0]
for i in range(N):
    L.append(L[i] + T[i])
V = [int(i) for i in input().split()]

def VM(x, i): #x秒後に条件iがとり得る速度
    if 0 <= x <= L[i]:
        return V[i] + (L[i] - x)
    elif L[i] < x <= L[i+1]:
        return V[i]
    else:
        return V[i] + (x - L[i+1])

Search = [[] for i in range(N)] #設定された最高速度よりも小さくなり得る条件を探索
for i in range(N):
    for j in range(N):
        if i < j and V[i] - V[j] > L[j] - L[i+1]:
            Search[i].append(j)
        elif i > j and V[i] - V[j] > L[i] - L[j+1]:
            Search[i].append(j)

maxV = [float("inf") for i in range(2*L[-1]+1)]
for i in range(N):
    for j in range(2 * L[i], 2 * L[i+1] + 1):
        maxV[j] = min(V[i], j * 0.5, L[-1] - j * 0.5) #初期化
        for s in Search[i]:
            maxV[j] = min(maxV[j], VM(j * 0.5, s))
Ans = 0
for i in range(2*L[-1]):
    Ans += (maxV[i] + maxV[i+1])/4
print(Ans)

Measured memory_bytes: 4400
import itertools
n = int(input())
l = []
for i in range(1,n+1):
  l.append(i)
com = list(itertools.combinations(l,2))
cnt = 0
for i in range(len(com)):
  if com[i][0] % 2 == 0 and com[i][1] % 2 == 1 or com[i][0] % 2 == 1 and com[i][1] % 2 == 0:
    cnt += 1
print(cnt)

Measured memory_bytes: 3316
using System;
using System.Linq;

class Assignment {
  static void Main() {
    var input = Console.ReadLine().Trim().Split(' ');
    var A = int.Parse(input[0]);
    var B = int.Parse(input[1]);
    
    var answer = A - 2 * B;
    Console.WriteLine(answer > 0 ? answer : 0);
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll x;cin>>x;
    ll now=100;
    ll cnt=0;
    while(now<x){
        cnt++;
        now+=now/100;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3632
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

t = [0] * (n+1)

for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)

for i in range(q):
    l, r = lr[i][0]-1, lr[i][1]-1
    print(t[r] - t[l])


Measured memory_bytes: 32348
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#define mem(a,b) memset((a),(b),sizeof(a))
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-12;
const int MAX=20000+10;
const int EDGE=100000+10;//边的条数
typedef long long ll;
int main()
{
	int i,n,s,e,w;
	char a[1111];
	while(~scanf("%s",a))
	{
		n=s=e=w=0;
		for(i=0;i<strlen(a);i++)
		{
			
			if(a[i]=='N')
			{
				n=1;
			}
			else if(a[i]=='S')
			{
				s=1;
			}
			else if(a[i]=='E')
			{
				e=1;
			}
			else if(a[i]=='W')
			{
				w=1;
			}
		}
		if((n+s==2&&e+w==0)||(n+s==0&&e+w==2)||n+s+e+w==4) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int N,K;
double S[2<<17];
main()
{
	cin>>N>>K;
	S[0]=0;
	double ans=0;
	for(int i=1;i<=N;i++)
	{
		int p;cin>>p;
		S[i]=S[i-1]+(p+1)/2.;
		if(i>=K)ans=max(ans,S[i]-S[i-K]);
	}
	cout<<fixed<<setprecision(16)<<ans<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int answer = 0;
		for (int targetNum = 1; targetNum <= n; targetNum++) {
			int divisorCount = 0;
			if (targetNum % 2 == 0) {
				continue;
			}
			for (int i = 1; i <= targetNum; i++) {
				if (targetNum % i == 0) {
					divisorCount++;
				}
			}
			if (divisorCount == 8) {
				answer++;
			}
		}

		System.out.println(answer);

		sc.close();
	}
}

Measured memory_bytes: 23892
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll
void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i];
    rep(i,n)cin >> b[i];
    ll ca = 0, cb = 0;
    rep(i,n){
        if(a[i] > b[i])cb += a[i] - b[i];
        else{
            ca += (b[i] - a[i] + 1) / 2;
            if((a[i] + b[i]) % 2 == 1)cb++;
        }
    }
    YES(ca >= cb);
}

Measured memory_bytes: 384
#include<stdio.h>
#define LEN 100
#define INF 100000000
int  Q[LEN];
int G[LEN][LEN];
int head,tail;
int d[LEN];
int n;
void enqueue(int x){
  Q[tail] = x;
  tail = (tail+1) % LEN;
}
int dequeue(){
  int  x = Q[head];
  head = (head+1)%LEN;
  return x;
}
int enpty(){
  if(tail == head)return 1;
  else return 0;
}
void bfs(int s){
  int i;
  int u,v;
  enqueue(s);
  for(i=0;i<n;i++){
    d[i] = INF;
  }
  d[s] = 0;
  while(!enpty()){
    u = dequeue();
    for(v=0;v<n;v++){
      if(G[u][v] == 0)continue;
      if(d[v] != INF)continue;
      d[v] = d[u] + 1;
      enqueue(v);
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i+1,((d[i] == INF)? -1 : d[i]));
  }
}
int main(){
  int k,u,v;
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j] = 0;
    }
  }
 for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      G[u][v] = 1;
    }
  }
  bfs(0); 
  return 0;
}

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

using namespace std;

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

int main() {
  int N, T, pre, cur;
  cin >> N >> T;

  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> cur;
    if (i != 0) {
      sum += min(cur - pre, T);
    }
    pre = cur;
  }
  sum += T;

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] q = new int[n];
		Arrays.fill(q , 0);
		for(int i = 1 ; i < n ; i++){
			q[Integer.parseInt(sc.next()) - 1]++;
		}
		sc.close();
		for(int i = 0 ; i < n ; i++){
			ou.print(q[i] + "\n");
		}
		ou.flush();
	}
}

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

using namespace std;

int main()
{
	int N, answer = 0;
	cin >> N;
	vector<int> d(N);
	for (int count = 0; count < N; count++)
	{
		cin >> d.at(count);
	}
	for (int count = 0; count < N; count++)
	{
		for (int index = count + 1; index < N; index++)
		{
			answer += d.at(count) * d.at(index);
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <array>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>

int main ()
{
  int A[3][3];
  for (int i=0; i<3; ++i)
    for (int j=0; j<3; ++j)
      std::cin >> A[i][j];

  const int NIL = 0;

  int N, b;
  std::cin >> N;
  for (int n=0; n<N; ++n)
    {
      std::cin >> b;
      for (int i=0; i<3; ++i)
        {
          for (int j=0; j<3; ++j)
            {
              if (b == A[i][j])
                {
                  A[i][j] = NIL;
                  break;
                }
            }
        }
    }

  bool ans = false;
  for (int i=0; i<3; ++i)
    {
      int sum = 0;
      for (int j=0; j<3; ++j)
        sum += A[i][j];
      if (sum == NIL)
        {
        ans = true;
        break;
        }
    }

  if (!ans)
    {
    for (int i = 0; i < 3; ++i) {
      int sum = 0;
      for (int j = 0; j < 3; ++j)
        sum += A[j][i];
      if (sum == NIL)
        {
        ans = true;
        break;
        }
    }
    }

  if (!ans)
    {
      auto sum = 0;
      for (int i=0; i<3; ++i)
        sum += A[i][i];
      if (sum == NIL)
        {
          ans = true;
        }
      else
        {
          auto sum = A[0][2] + A[1][1] + A[2][0];
          if (sum == NIL)
            ans = true;
        }
    }

  if (ans) std::cout << "Yes\n";
  else std::cout << "No\n";
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (n, m) = i::u2();
    let ab = i::uv2(m);

    let mut set = vec![HashSet::new(); n + 1];
    for i in 0..m {
        let (a, b) = ab[i];
        set[a].insert(b);
        set[b].insert(a);
    }

    let mut memo = HashSet::new();
    let mut q = VecDeque::new();
    let mut ans = vec![0; n + 1];
    q.push_back(1);
    while q.len() > 0 {
        let cur = q.pop_front().unwrap();
        for c in &set[cur] {
            if memo.contains(&c) {
                continue;
            }
            memo.insert(c);
            ans[*c] = cur;
            q.push_back(*c);
        }
    }
    println!("{}", "Yes");
    for i in 2..=n {
        println!("{}", ans[i]);
    }
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 22448
import java.io.IOException;
import java.util.Scanner;

/**
 * <pre>
 * NumberOfIsland
 *
 * ??¶?????°???????????????
 * </pre>
 *
 * @author ?????????????????§???
 *
 */
public class Main{

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

		while (sc.hasNext()) {
			boolean map[][] = new boolean[12][12];
			for (int cnt1 = 0; cnt1 < map.length; cnt1++) {
				char[] row = sc.next().toCharArray();
				for (int cnt2 = 0; cnt2 < map[0].length; cnt2++) {
					map[cnt1][cnt2] = (row[cnt2] == '1');
				}
			}
			int ans = 0;
			for (int cnt1 = 0; cnt1 < map.length; cnt1++) {
				for (int cnt2 = 0; cnt2 < map[0].length; cnt2++) {
					if (map[cnt1][cnt2]) {
						test(cnt1, cnt2,map);
						ans++;
					}
				}
			}
			System.out.println(ans);
		} // ?????????????????????
	}// ?????????????????????????????????

	private static void test(int mh, int mw, boolean[][] map) {
		map[mh][mw] = false;
		int move_h[] = { 1, 0, -1, 0 };
		int move_w[] = { 0, 1, 0, -1 };
		for (int cnt = 0; cnt < move_h.length; cnt++) {
			int tmp_h = mh + move_h[cnt];
			int tmp_w = mw + move_w[cnt];
			if (0 <= tmp_h && 0 <= tmp_w && tmp_h < map.length && tmp_w < map[0].length && map[tmp_h][tmp_w])
				test(tmp_h, tmp_w,map);
		}
	}
}// ??????????????????????????????

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


using namespace std;

const int INF = 1000000;

int main(){
    char s[3][3];

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)cin >>s[i][j];
    }

    cout << s[0][0] << s[1][1] << s[2][2] <<endl;


}


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

int main(){
  int ans = 0;
  string s;
  cin >> s;
  if (s.at(0) == '1') ans ++;
  if (s.at(1) == '1') ans ++;
  if (s.at(2) == '1') ans ++;
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
char s[1000][1001];
typedef pair<int,int> P;
P ko1[1000*1000],ko2[1000*1000];
int main(void)
{
	int i,j,k,l,n,cnt,h,w,p1,p2,xx,yy,x,y;
	int dx[8]={-1,-1,-1,0,0,1,1,1},dy[8]={-1,0,1,-1,1,-1,0,1};
	scanf("%d %d",&h,&w);
	for(i=0;i<h;i++)	scanf("%s",s[i]);
	p1=0;
	for(i=0;i<h;i++)	{
		for(j=0;j<w;j++)	{
			if(s[i][j]!='.')	{
				cnt=0;
				for(k=0;k<8;k++)	{
					xx=j+dx[k];	yy=i+dy[k];
					if(s[yy][xx]=='.')	cnt++;
				}
				if(cnt>=s[i][j]-'0')	{
					ko1[p1].first=i;	ko1[p1].second=j;
					p1++;
				}
			}
		}
	}
	n=0;
	if(p1!=0)	{
		while(1)	{
			p2=0;
			for(i=0;i<p1;i++)	{
				if(i==0	|| (i!=0 && !(ko1[i].first==ko1[i-1].first && ko1[i].second==ko1[i-1].second))){
					y=ko1[i].first;	x=ko1[i].second;
//					printf("y=%d x=%d\n",y,x);
					cnt=0;
					for(k=0;k<8;k++)	{
						yy=y+dy[k];	xx=x+dx[k];
						if(s[yy][xx]=='.')	cnt++;
					}
					if(cnt>=s[y][x]-'0')	{
//						printf("y=%d x=%d\n",y,x);
						ko2[p2].first=y;	ko2[p2].second=x;
						p2++;
					}
				}
			}
//			printf("p2=%d\n",p2);
			if(p2==0)	break;
			n++;
			p1=0;
			for(i=0;i<p2;i++)	{
				y=ko2[i].first;	x=ko2[i].second;
				s[y][x]='.';
			}
			for(i=0;i<p2;i++)	{
				y=ko2[i].first;	x=ko2[i].second;			
				for(k=0;k<8;k++)	{
					yy=y+dy[k];	xx=x+dx[k];	
					if(s[yy][xx]!='.')	{
						ko1[p1].first=yy;	ko1[p1].second=xx;
						p1++;
					}
				}
			}
			sort(ko1,ko1+p1);
		}
	}
	printf("%d\n",n);
	return 0;
}


Measured memory_bytes: 19184
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    string p = "keyence";
    if(s == p){
        puts("YES");
        return 0;
    }
    int n = SZ(s);
    for(int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            string t = s;
            t.erase(i, j - i + 1);
            if(t == p){
                cout << "YES";
                exit(0);
            }
        }
    }
    puts("NO");
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

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

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

    long long lcm = T[0];
    for (int i = 0; i < N - 1; i++) {
        long long x, a, b, r;
        a = max(lcm, T[i + 1]);
        b = min(lcm, T[i + 1]);

        if (a % b == 0) {
            lcm = a;
            continue;
        }
        else {
            r = a % b;
            while (r != 0) {
                a = b;
                b = r;
                r = a % b;
            }

            lcm = max(lcm, T[i + 1]) / b * min(lcm, T[i + 1]);
        }
    }

    cout << lcm << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n,i;
  scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    if(p[i]%2 != 0){
      return 0;
    }
  }

  int max=p[0];

  for(i=1;i<n;i++){
    if(max < p[i]){
      max = p[i];
    }
  }

  int s,flag = 0;
  for(i=0;i<n;i++){
    if(flag != 1 && p[i] == max){
      p[i] = 0;
      flag = 1;
    }
    s += p[i];
  }

  s += max/2;

  printf("%d\n",s);
  return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

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

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    while (N > 0) {
        int tmp = N%10;
        N /= 10;
        if (tmp == 7) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  ll l = 1,r = 1;
  rep(i,n){
    int lin,rin;cin>>lin>>rin;
    ll tmp1 = l/lin + !!(l%lin);
    ll tmp2 = r/rin + !!(r%rin);
    ll m = max(tmp1,tmp2);
    l = m*lin;
    r = m*rin;
  }
  print(l+r);
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define RFOR(i,s,e) for(int (i) = (s);(i) >= (e);(i)--)
#define rep(i,n) FOR(i,0,n-1)
#define MOD 1000000007 

int a[100100];

signed main(){
	int n;cin>>n;
	rep(i,n) cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	
	int iti=0, ni=0;
	int pre = -1;
	for(int loop = 0;loop < n;loop++)
	{
		int i = a[loop];
		if(i==0) break;
		
		if(pre == -1 || pre != i) pre = i;
		else
		{
			if(iti == 0) iti = i;
			else if(ni == 0) ni = i;
			pre = -1;
		}
	}
	
	cout << iti*ni;
}

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(false);
    int r; cin >> r;
    cout << fixed << setprecision(2) << (double)r*2*PI << endl;
    return 0;
}



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

using namespace std;
int main(){
    int a;
    cin >> a;
    string s;
    cin >> s;
    
    if(a<3200) cout << "red" << endl;
    else cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
///****In the name of Allah, most Gracious, most Compassionate****//

#include <bits/stdc++.h>
using namespace std;

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

#define ALL(a) a.begin(), a.end()
#define FastIO ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr)
#define IN freopen("input.txt","r+",stdin)
#define OUT freopen("output.txt","w+",stdout)

#define DBG(a) cout<< #a <<" --> "<<(a)<<endl
#define NL cout<<"\n"

template < class T1,class T2>
ostream &operator <<(ostream &os,const pair < T1,T2 > &p)
{
    os<<"{"<<p.first<<","<<p.second<<"}";
    return os;
}

const int N=3e5+5;
const int oo=1e9+7;

int cnt[N];
int val[N];
int dp[1<<16];
int rec(int mask)
{
    if(mask==0) return 0;
    if(dp[mask]!=-1) return dp[mask];
    int &ret = dp[mask]  = oo;
    for(int j=1; j<=15; j++)
    {
        if(mask & (1<<j) == 0) continue;
        for(int k=j+1; k<=15; k++)
        {
            if(mask &(1<<k)  )
            {
//                DBG(mask & (1<<k));
                int to = j^k;
                int tomask = mask^(1<<j)^(1<<k);


                bool jog =tomask&(1<<to);
                tomask = tomask^(1<<to);
//                DBG(mask);
//                DBG(tomask);
//
//                DBG(j);
//                DBG(k);
//                DBG(to);
//                DBG(bitset<16> (mask));
//                DBG(bitset<16> (tomask));
//                NL;
//                assert(__builtin_popcount(mask)> __builtin_popcount(tomask));
                ret = min(ret, 1 + rec(tomask) + jog);
            }
        }
    }
    return ret;
}
int32_t main()
{
    FastIO;
    int n;
    cin>>n;
    for(int i=1; i<=n-1; i++)
    {
        int u,v,a;
        cin>>u>>v>>a;
        val[u]^=a;
        val[v]^=a;
    }
//    for(int i=0; i<n; i++) cout<<val[i]<<" ";
//    NL;
    for(int i=0; i<n; i++)
        cnt[val[i]]++;

    int ans  = 0, mask = 0, jor = 0;
    for(int i=1; i<=15; i++)
    {
        ans+=cnt[i]/2;
        cnt[i]%=2;
        if(cnt[i])
            mask|=(1<<i), jor^=i;
    }
    memset(dp ,  -1 , sizeof dp);
    ans+=rec(mask);
    cout<<ans<<'\n';
}


Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();

        final Map<Integer, Boolean> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            final int a = scanner.nextInt();
            if(map.get(a) != null){
                System.out.println("NO");
                return;
            }else{
                map.put(a,true);
            }
        }
        System.out.println("YES");
    }
}


Measured memory_bytes: 100632
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

vector<pair<pair<string,int>,int>> d;
int N;

int main() {

	scanf("%d", &N);
	rep(i, N) {
		char S[128];
		int P;
		scanf("%s%d", S, &P);
		d.push_back({ { S,-P },(int)i + 1 });
	}

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


	rep(i, N)
		printf("%d\n", d[i].second);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long INF = 1LL<<60;
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; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

ll waa(ll a) {
    if(a%2==0) {
        return (a+1)*(a/2);
    }else {
        return (a+1)*(a/2)+(a+1)/2;
    }
}
int main() {
    vector<int> v;
    string s; cin >> s;
    ll cnt = 1;
    REP(i,1,s.size()) {
        if(s[i]!=s[i-1]){
            v.push_back(cnt);
            cnt = 1;
        }else cnt++;
    }
    if(cnt) v.push_back(cnt);
    
    ll ans = 0;

    if(s[0]=='>') {
        ans += waa(v[0]);
        v.erase(v.begin());
    }
    int l = (int)v.size();
    v.push_back(0);
    for(int i = 0; i < l; i+=2){
            ans += waa(max(v[i],v[i+1]));
            ans += waa(min(v[i],v[i+1])-1);
        }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define int long long
int Q, n, a, b, c, d, k;

signed main() {
    cin >> Q;
    while (Q--) {
        cin >> a >> b >> c >> d;
        n = a + b, k = (max(a, b) - 1) / (min(a, b) + 1) + 1;
        int l = 0, r = n + 1;
        while (l <= r) {
            int m = (l + r) >> 1;
            int A = a - m / (k + 1) * k - m % (k + 1);
            int B = b - m / (k + 1);
            if (B <= A * k) l = m + 1;
            else r = m - 1;
        }
        int A = a - l / (k + 1) * k - l % (k + 1);
        int B = b - l / (k + 1);
        r = l + B - A * k + 1;
        for (int i = c; i <= min(d, l); i++)
            putchar(i % (k + 1) ? 'A' : 'B');
        for (int i = max(c, l + 1); i <= d; i++)
            putchar((i - r) % (k + 1) ? 'B' : 'A');
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 384
import std.stdio, std.string, std.conv;
import std.algorithm, std.array, std.range;
auto solve(string S_) {
    auto NM=S_.split.map!(to!int)();
    immutable N=NM[0], M=NM[1];
    auto A=new int[][N];
    foreach(ref a;A) a=readln.split.map!(to!int).array();
    auto c=new int[M+1];
    foreach(a;A) ++c[a[0]];
    int m=N; bool[int] s;
    foreach(r;0..M) {
        int k=-1,j=-1;
        foreach(int i,v;c) if(k<v) k=v,j=i;
        m=min(m,k);
        if(r+1>=M) break;
        s[j]=true;
        foreach(ref a;A) while(a[0] in s) --c[a[0]], a.popFront, ++c[a[0]];
    }
    return m;
}
void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }

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

void print2DArray(vector<vector<int>> A)
{
    for(auto x : A)
    {
        for(auto y : x) cout<< y <<" ";
        cout<<endl;
    }
    cout<<endl;
}

int main()
{
    int n;
    cin>>n;
    vector<vector<int>> tmp(n, vector<int>(3));
    for(int i = 0; i < n; i++)
    {
        cin>>tmp[i][0]>>tmp[i][1]>>tmp[i][2];
    }

    vector<vector<int>> dp(n, vector<int>(3));
    dp[0][0] = tmp[0][0];
    dp[0][1] = tmp[0][1];
    dp[0][2] = tmp[0][2];

    for(int i = 1; i < n; i++)
    {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + tmp[i][0];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + tmp[i][1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + tmp[i][2];
    }
    // print2DArray(dp);

    int ans = max( max(dp[n-1][0], dp[n-1][1]) , dp[n-1][2]);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 11136
import math
N = int(input())
ans=0
for i in range(1,int(math.sqrt(N)+1)):
    if i==N:
        continue
    if N//(N//i-1)!=N%((N//i-1)):
        continue
    else:
        #print(i,N//i-1,N//(N//i-1),N%((N//i-1)))
        ans+=N//i-1
print(ans)


Measured memory_bytes: 40300
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a,b;
int t[1001];

int main(void){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=0;i<n;i++){
		scanf("%d",&t[i]);
	}
	sort(t,t+n);
	int cnt=0;
	int l=lower_bound(t,t+n,a)-t;
	int r=lower_bound(t,t+n,b)-t;
	printf("%d\n",l+n-r);
	return 0;
}

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

using namespace std;

const int N = 1e5;
const int oo = INT_MAX;
int arr[N + 5][3];
int dp[N + 5][3];
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }

    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for (int i = 1; i < n; i++)
    {
        dp[i][0] = arr[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = arr[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = arr[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
    }

    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]);

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;


int main()
{
  string x;
  cin >> x;
  for(int i=0;i<3;i++) {
    int res = x[i] == '1' ? 9:1;
    cout << res;
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int a,b,c,d,e;
   scanf("%d",&a);
   
   b=a/3600;
   c=a%3600;
   d=c/60;
   e=c%60;
  
   
   printf("%d:%d:%d\n",b,d,e);
   return 0; 
}


Measured memory_bytes: 2100
# coding: utf-8
N = int(input())
d = {}
alp = "abcdefghijklmnopqrstuvwxyz"
cnt = {}
for s in alp:
    cnt[s] = 0
for i in range(N):
    d[i] = {}
    s = input()
    for j in range(len(alp)):
        d[i][alp[j]] = 0
    for j in range(len(s)):
        d[i][s[j]] += 1
for s in alp:
    l = []
    for k in d.keys():
        l.append(d[k][s])
    cnt[s] = min(l)
ans = ""
# print(cnt)
for a in alp:
    ans += a * cnt[a]
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
int main(void) {
  int a;
  int b;
  scanf("%d", &a);
  scanf("%d", &b);

  if (a <= b) {
    for (int i = 0; i < b; i++) {
      printf("%d", a);
    }
  } else {
    for (int i = 0; i < a; i++) {
      printf("%d", b);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 1652
#include<stdio.h>
#include<math.h>

int main(void){
	int i,n;
	long long int num=1,tmp1=1,tmp2=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		num*=10;
		if(num>1000000007){
			do{
				num-=1000000007;
			}while(num>=1000000007);
		}
		//printf("%lld\n",num);
	}
	for(i=0;i<n;i++){
		tmp1*=8;
		if(tmp1>1000000007){
			do{
				tmp1-=1000000007;
			}while(tmp1>=1000000007);
		}
		//printf("%lld\n",tmp1);
	}
	for(i=0;i<n;i++){
		tmp2*=9;
		if(tmp2>1000000007){
			do{
				tmp2-=1000000007;
			}while(tmp2>=1000000007);
		}
		//printf("%lld\n",tmp2);
	}
	
	num=num+tmp1-tmp2*2;
	if(num<0){
		do{
			num+=1000000007;
		}while(num<0);
	}else if(num>=1000000007){
		do{
			num-=1000000007;
		}while(num>=1000000007);
	}
	printf("%lld",num);
	return 0;
}

Measured memory_bytes: 1732
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    print(pow(n/3,3))

main()

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

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

    int res = x;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        for (int j = 1; j <= d; j += a) {
            res++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
n=int(input())
ans=[0]*n
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      a=x**2+y**2+z**2+x*y+y*z+z*x
      if 1<=a<=n:
        ans[a-1]+=1
for a in ans:
  print(a)

Measured memory_bytes: 9300
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int s = 0;
	if (a > b)
		s = 2 * a - 1;
	else if (b > a)
		s = 2 * b - 1;
	else if (a == b)
		s = 2 * a;
	cout << s << endl;
}

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

using namespace std;

int main() {

    int ans = 1e9+7;

    int n;
    cin >> n;
    vector<int> a(n);

    for (int i=0; i<n; ++i) cin >> a[i];

    for (int c=-100; c<=100; ++c) {
        int sum=0;
        for (int i=0; i<n; ++i) {
            sum += (a[i]-c)*(a[i]-c);
        }
        ans=min(ans,sum);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int left[100];
long long int solve(int n, int right) {
  long long int dp[100][21];
  int i, j, index;
  for (i = 0; i < 100; i ++) for (j = 0; j < 21; j ++) dp[i][j] = 0;
  dp[1][left[0]] = 1;
  for (i = 2; i <= n; i ++) {
    for (j = 0; j < 21; j ++) {
      index = j + left[i - 1];
      if (index < 21) dp[i][index] += dp[i - 1][j];
      index = j - left[i - 1];
      if (index > -1) dp[i][index] += dp[i - 1][j];
    }
  }
  return dp[n][right];
}
int main() {
  int n, right;
  int i;
  scanf("%d", &n);
  for (i = 0; i < n - 1; i ++) scanf("%d", &left[i]);
  scanf("%d", &right);
  printf("%lld\n", solve(n - 1, right));
  return 0;
}

Measured memory_bytes: 616
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (win, osx, linux)
 * Author: step_by_step
 * Time: 2020-02-16 20:55:45
**/

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 200000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

ll bin_pow(ll a, ll p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        p >>= 1;
    }
    return res;
}

ll rev(ll x) {
    return bin_pow(x, MOD - 2);
}

ll fact[N], rfact[N];

void init() {
    fact[0] = 1;
    rep(i, 1, N) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    rfact[N - 1] = rev(fact[N - 1]);
    repb(i, N - 2, -1) {
        rfact[i] = rfact[i + 1] * (i + 1) % MOD;
    }
}

ll Binom(int n, int k) {
    return fact[n] * rfact[k] % MOD * rfact[n - k] % MOD;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    init();
    int n, A, B, C;
    cin >> n >> A >> B >> C;
    ll ans = 0;
    ll average = 100 * rev(A + B) % MOD;
    ll a = A * rev(A + B) % MOD, b = B * rev(A + B) % MOD;
    //cout << average << endl;
    rep(m, 0, n) {
        ll cnt = (n + m) * average % MOD;
        ll p1 = bin_pow(a, n) * bin_pow(b, m) % MOD;
        ans = (ans + cnt * p1 % MOD * Binom(n + m - 1, m)) % MOD;

        ll p2 = bin_pow(b, n) * bin_pow(a, m) % MOD;
        ans = (ans + cnt * p2 % MOD * Binom(n + m - 1, m)) % MOD;
    
        //cout << p1 << " " << p2 << endl;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3328
// RAKSHIT KADAM
 
//  -- Declare array globally...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// find_by_order returns iterator to  element present at that index...
// order_of_key returns no. of elements having value stricktly less than that given in the order_of_key();
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000003
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 200006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500066;



void solve()
{
    ll a,b;cin>>a>>b;
    ll c;cin>>c;
    cout<<b/c-(a-1)/c<<endl;
}
 
signed main()
{
   Need_for_speed(activated);
 
//satisfy
//    {
//  solve();
//   }
 
    solve();
    return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
const ll MOD=1e9+7;
using namespace std;

int main(){
  ll x,y;
  cin >> x >> y;
  if(x*y>0){
    if(x<=y) cout << llabs(y-x) << endl;
    else cout << llabs(y-x)+2 << endl;
  }else if(x*y<0){
    cout << llabs(x+y)+1 << endl;
  }else{
    if(x<0){
      cout << llabs(x+y) << endl;
    }else if(y<0){
      cout << llabs(x+y)+1 << endl;
    }else if(x>0){
      cout << llabs(x+y)+1 << endl;
    }else{
      cout << llabs(x+y) << endl;
    }
  }
}

Measured memory_bytes: 256
//総和
/*
int t_sum(int x) {
int sum = 0;
while (x > 0) {
sum += x % 10;
x = x / 10;
}
return sum;
}
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#include <iomanip>
#define MAX_N 100
#define INF 10000000

using namespace std;

string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int n,a,b,c;
string s,t;

void solve(){
	int ans = a*b - a - b + 1;
	cout << ans << endl;
}

int main() {
	cin >> a>>b;
	solve();
	return 0;
}

Measured memory_bytes: 256