akhauriyash/Code-Regression huggingface dataset:
s = int(input())
if s<=10**9:
    print(0,0,0,1,s,0)
    exit()
bx=10**9
by=1
ay=int(s/(10**9))
while True:
    ax = ay*bx-s
    if ax >= 0 and ax <= 10**9:
        break
    else:
        ay+=1
print(0,0,bx,by,ax,ay)

Measured memory_bytes: 38384
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    n, m = list(map(int, readline().split()))
    ab = [list(map(int, readline().split())) for _ in range(m)]
    ans = [0] * m
    uf = UnionFind(n)
    inconvenience = (n * (n - 1)) // 2

    for i in range(m - 1, -1, -1):
        ans[i] = inconvenience
        u, v = ab[i]
        u, v = u - 1, v - 1
        if uf.same(u, v):
            pass
        else:
            x, y = uf.size(u), uf.size(v)
            inconvenience -= x * y
            uf.union(u, v)

    print(*ans, sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 101852
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n){
        int cnt = 0;
        for(char c='a'; c<='z'; c++){
            bool l = false, r = false;
            rep(j,i){
                if(s[j] == c) l = true;
            }
            FOR(j,i,n){
                if(s[j] == c) r = true;
            }
            if(l&&r) cnt++;
        }
        if(ans<cnt) ans = cnt;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, a;
  cin >> n >> a;
  int x[n+1], maxV=0;
  for ( int i = 1; i <= n; i++){
    cin >> x[i];
    maxV = max(maxV, x[i]);
  }

  int xn = 2500; 
  long long dp[n+1][n+1][xn+1];
  for ( int i = 0; i <= n; i++){
    for ( int j = 0; j <= n; j++){
      for ( int k = 0; k <= xn; k++){
        if ( i == 0 && j == 0 && k == 0){
          dp[i][j][k] = 1;
        } else if ( i >= 1 && k < x[i]){
          dp[i][j][k] = dp[i-1][j][k];
        } else if (i >= 1 && j >= 1 && k >= x[i]){
          dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]];
        } else {
          dp[i][j][k] = 0;
        }
      }
    }
  }

  long long ans = 0;
  for ( int i = 1; i <= n; i++){
    ans += dp[n][i][i*a];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 51072
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main(){

	int n, q;
	cin >> n >> q;
	vector< priority_queue<int> > a(n);
	int querynum = 0;
	while (querynum < q) {
		int var1;
		cin >> var1;
		if (var1 == 0) {
			int var2, var3;
			cin >> var2 >> var3;
			a[var2].push(var3);
		}
		else if (var1 == 1) {
			int var2;
			cin >> var2;
			if (!a[var2].empty())  cout << a[var2].top() << endl;
		}
		else {
			int var2;
			cin >> var2;
			if (!a[var2].empty()) a[var2].pop();
		}
		querynum++;
	}
	
	return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin >> n;
    vi v(n);

    for(auto &z : v)
        cin >> z;

    map<ll, ll> m;
    ll ans = 0LL;

    for(int i = 0; i < n; ++i)
    {
        ll razlika = i + 1LL - v[i];
        ans += m[razlika];
        ++m[v[i]+i+1];
    }

    //for(auto [key, value] : m)
    //{
        //cout << key << ' ' << value << '\n';
    //}

    cout << ans << '\n';

    return 0;
}



Measured memory_bytes: 26472
#include<stdio.h>

int main(void){
    
    int data;
    int a,b,c;
    
    scanf("%d",&data);
    
    a = data / 3600;
    
    b = (data % 3600) / 60;
    
    c = (data % 3600) % 60;
    
    printf("%d:%d:%d\n",a,b,c);
    
    return 0;
}


Measured memory_bytes: 2128
#include <iostream>
#include <queue>
#include <algorithm>
#include <climits>
#include <stack>
#include <vector>
#include <random>
#include <string.h>
#include <stdio.h>
#include <iomanip>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define oo 1e18
using namespace std;
typedef long long ull;
typedef pair<int, int> ii;
typedef pair<long double, int> id;
typedef pair<long long, long long> llp;
const int N = 3*1e3+1;
int n, m, t, k;
double dp[N][N], p[N];
// Let dp[n][K] is the probability of getting K heads with n last coins
int main() {
    //freopen("ee.inp", "r", stdin);
    //freopen("ee.OUT", "w", stdout);
    fastIO;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>p[i];

    dp[1][0] = 1-p[1], dp[1][1] = p[1];
    for(int i=2;i<=n;i++) {
        dp[i][0] = dp[i-1][0]*(1-p[i]); // calculate probability of getting 0 heads
        dp[i][i] = dp[i-1][i-1]*p[i]; // calculate probability of getting i heads with i last coins
    }
    // calculate : probability of getting j heads with i first coins
    /*
        if we choose i to be head, we have this formula : dp[i-1][j-1]*p[i]
        if we choose i to be tail, we have this formula : dp[i-1][j]*(1-p[i])
        from here we can calculate dp[i][j], just simply add 2 of the above formulas to dp[i][j]
    */
    for(int i=2;i<=n;i++) for(int j=1;j<i;j++) dp[i][j] =   dp[i-1][j-1]*p[i] + // if we choose i to be head
                                                            dp[i-1][j]*(1-p[i]); // if we choose i to be tail
    double ans = 0;
    for(int i=n/2+1;i<=n;i++) ans+=dp[n][i];
    cout << setprecision(10) << ans;
}


Measured memory_bytes: 49940
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int N=20005;
int n,m,tot,fa[N],dep[N],son[N],q[N],tl,a[N],b[N],rev[N],del[N],c[N],ans;
vector<int>E[N],vec,G[N];
void dfs(int u,int f){
	fa[u]=f;dep[u]=dep[f]+1;
	for(int v:E[u])if(v!=f)dfs(v,u),++son[u];
}
void add(int u,int v){
	while(u!=v)
		if(dep[u]>dep[v])++c[u],u=fa[u];
		else ++c[v],v=fa[v];
}
void dfs2(int u){
	swap(a[u],b[u]);
	for(int v:G[u])dfs2(v);
}
int main(){
	scanf("%d%d",&n,&m);tot=m;
	for(int i=1,x,y;i<n;++i){
		scanf("%d%d",&x,&y);
		E[x].push_back(y);
		E[y].push_back(x);
	}
	dfs(1,0);
	for(int i=1;i<=m;++i){
		scanf("%d%d",&a[i],&b[i]);
		add(a[i],b[i]);vec.push_back(i);
	}
	for(int i=1;i<=n;++i)if(!son[i])q[++tl]=i;
	for(int i=1;i<=n;++i){
		int u=q[i];vector<int>tmp;
		for(int j=0;j<vec.size();++j)
			if(a[vec[j]]==u||b[vec[j]]==u)
				tmp.push_back(vec[j]),vec.erase(vec.begin()+j),--j;
		while(tmp.size()>=2){
			int p=tmp.back();tmp.pop_back();
			int q=tmp.back();tmp.pop_back();
			if(a[p]!=u)dfs2(p);
			if(b[q]!=u)dfs2(q);
			if(a[q]!=b[p]){
				a[++tot]=a[q];b[tot]=b[p];
				vec.push_back(tot);
				G[tot].push_back(p);G[tot].push_back(q);
				del[p]=del[q]=1;
//				printf("%d -> %d\n",tot,p);
//				printf("%d -> %d\n",tot,q);
			}
		}
		if(tmp.size()){
			int p=tmp.back();tmp.pop_back();
			if(a[p]!=u)dfs2(p);
			if(fa[u]!=b[p]){
				a[++tot]=fa[u];b[tot]=b[p];
				vec.push_back(tot);
				G[tot].push_back(p);del[p]=1;
//				printf("%d -> %d\n",tot,p);
			}
		}
		ans+=min(2,c[u]);
		if(!--son[fa[u]])q[++tl]=fa[u];
//		for(int j=1;j<=tot;++j)
//			printf("(%d,%d) rev=%d\n",a[j],b[j],rev[j]);
//		puts("");
//		for(auto j:vec)printf("%d ",j);
//		puts("");puts("");
	}
//	for(int i=1;i<=tot;++i)if(!del[i])dfs2(i);
	printf("%d\n",ans);
	for(int i=1;i<=m;++i){
		if(rev[i])swap(a[i],b[i]);
		printf("%d %d\n",a[i],b[i]);
	}
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

int main() {
  unsigned long N;
  std::cin >> N;
  std::vector<long long> A(N);
  for (unsigned i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  long long ans = 0;
  for (unsigned i = 0; i + 1 < N; ++i) {
    A[i + 1] += A[i];
  }
  std::unordered_map<long long, long long> map;
  map.insert(std::make_pair(0ll, 0ll));
  for (auto i : A) {
    if (map.find(i) != map.end()) {
      map[i] += 1;
    } else {
      map.insert(std::make_pair(i, 0ll));
    }
  }
  for (auto i : map) {
    if (i.second > 0) {
      ans += (i.second * (i.second + 1)) / 2;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 12796
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  int h, w;
  cin >> h >> w;
  string a[h];
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < h; i++) {
    cout << a[i] << endl;
    cout << a[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int x;
  vector <int> vc;
  int i;
  for(i==0;i<3;i++){
    cin>>x;
    vc.push_back(x);
  }
  sort(vc.begin(),vc.end());
  cout<<vc[2]-vc[0];
  return 0;
}


Measured memory_bytes: 256
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for i in range(n)]
mincost = 10**111

for i in range(2**n):
  li = [0]*m
  cost = 0
  count = 0
  for j in range(n):
    if (i >> j) & 1:
      cost += ca[j][0]
      for k in range(m):
        li[k] += ca[j][1+k]
  for l in range(m):
    if li[l] >= x:
      count += 1
  if count == m:
    mincost = min(cost,mincost)
    
if mincost == 10**111:
  print(-1)
else:
  print(mincost)

Measured memory_bytes: 9240
s=input()
q=int(input())
for i in range(q):
    com=input().split(" ")
    if(com[0]=="print"):
        a=int(com[1])
        b=int(com[2])
        print(s[a:b+1])
    if(com[0]=="reverse"):
        a=int(com[1])
        b=int(com[2])
        s=s[:a]+s[a:b+1][::-1]+s[b+1:]
    if(com[0]=="replace"):
        a=int(com[1])
        b=int(com[2])
        s=s[:a]+com[3]+s[b+1:]


Measured memory_bytes: 5616
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

class UnionFind(object):
    def __init__(self, n, recursion = False):
        self._par = list(range(n))
        self._size = [1] * n
        self._recursion = recursion

    def root(self, k):
        if self._recursion:
            if k == self._par[k]:
                return k
            self._par[k] = self.root(self._par[k])
            return self._par[k]
        else:
            root = k
            while root != self._par[root]: root = self._par[root]
            while k != root: k, self._par[k] = self._par[k], root
            return root

    def unite(self, i, j):
        i, j = self.root(i), self.root(j)
        if i == j: return False
        if self._size[i] < self._size[j]: i, j = j, i
        self._par[j] = i
        self._size[i] += self._size[j]
        return True

    def is_connected(self, i, j):
        return self.root(i) == self.root(j)

    def size(self, k):
        return self._size[self.root(k)]

def resolve():
    n, q = map(int, input().split())
    uf = UnionFind(n)

    for _ in range(q):
        t, u, v = map(int, input().split())
        if t == 0:
            uf.unite(u, v)
        else:
            print(int(uf.is_connected(u, v)))
resolve()

Measured memory_bytes: 75532
#include <stdio.h>

int main(void){
    int N;
    int flag = 0;
    scanf("%d", &N);
    int A[9][9];
    for (int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            A[i - 1][j - 1] = i * j;
            if(N == A[i - 1][j - 1]){
                puts("Yes");
                flag = 1;
            }
            if(flag){
                break;
            }
        }
        if(flag){
            break;
        }
    }
    if(!flag){
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 128
R, G, B, N =list(map(int, input().split()))
# R = 13
# G = 1
# B = 4
# N = 3000
X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N//X+1):
    for j in range(N+1):
        tmp = X*i+Y*j 
        if (tmp>N): break
        cnt += ((N-tmp)%Z == 0)
print(cnt)


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

const long long INF = 1LL << 60;

int main() {
  int a, b, c, d, e, f, saidai =-1,max_sw=0,max_s=0;
  cin >> a >> b >> c >> d >> e >> f;
  
  for(int i=0;i<=f/(100*a);i++){
    for(int j=0;j<=f/(100*b);j++){
      if(i==0 && j==0)
        continue;
      for(int k=0;k<=f/c;k++){
        for(int l=0;l<=f/d;l++){
          if((i*a*100+j*b*100+k*c+l*d) > f)
    	    continue;
      	  if((c*k+d*l) > e*(i*a+j*b))
            continue;
          if(saidai < (c*k+d*l)*100000/(100*a*i+100*b*j)){
            saidai = (c*k+d*l)*100000/(100*a*i+100*b*j);
            max_sw= 100*a*i+100*b*j+c*k+d*l;
            max_s = c*k+d*l;
          }
        }
      }
    }
  }
    
    cout << max_sw << " " << max_s << endl;
}

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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != 0) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// Combination

ll modcomb(ll n, ll r)
{
  if(n < r) return 0;
  ll res = fact(n);
  (res *= ppow(fact(r), M-2)) %= M;
  (res *= ppow(fact(n-r), M-2)) %= M;
  return res;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find
// Find()
int parent[N], ran[N];

int find(int x)
{
    if(parent[x]==x)return x;
    else return parent[x]=find(parent[x]);
}
// Union()
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;

    if(ran[x]<ran[y])
        parent[x]=y;
    else{
        parent[y]=x;
        if(ran[x]==ran[y])ran[x]++;
    }
}

// Main Code
ll c[N];

int main()
{
  ll n;
  cin>>n;
  fact(n+2);
  ll d;
  rep(i, 0, n+1)
  {
    int x;
    cin>>x;
    x--;
    if(c[x] == 0) c[x] = i+1;
    else
    {
      d = n - i + c[x];
      break;
    }
  }
  rep(k, 1, n+2)
  {
    cout<<(modcomb(n+1, k) - modcomb(d-1, k-1) + M) % M<<endl;
  }
  return 0;
}


Measured memory_bytes: 7168
import fractions
a,b,c,d=map(int,input().split())
length=b-a+1
lcm = c * d // fractions.gcd(c, d)
tmp=int(length-b//c+(a-1)//c-b//d+(a-1)//d+b//lcm-(a-1)//lcm)
print(tmp)

Measured memory_bytes: 5048
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int k, p[5];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	for (int i = 0; i < 5; ++i)
		cin >> p[i];
	
	cin >> k;
	if (p[4] - p[0] <= k)
		cout << "Yay!" << endl;
	else
		cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef vector<int> vi;

int main() {FIN
    
    int i = 0;
    vi dd(6), ns = {0, 1, 5, 4}, we = {0, 2, 5, 3};
    string c;
    for (i = 0; i < dd.size(); i++)
        cin >> dd[i];
    cin >> c;
    for (i = 0; i < c.size(); i++) {
        if (c[i] == 'N') {
            ns[0] = ns[1], ns[2] = ns[3];
            ns[1] = we[2], ns[3] = we[0];
            we[0] = ns[0], we[2] = ns[2];
        } else if (c[i] == 'S') {
            ns[0] = ns[3], ns[2] = ns[1];
            ns[1] = we[0], ns[3] = we[2];
            we[0] = ns[0], we[2] = ns[2];
        } else if (c[i] == 'W') {
            we[0] = we[1], we[2] = we[3];
            we[1] = ns[2], we[3] = ns[0];
            ns[0] = we[0], ns[2] = we[2];
        } else {
            we[0] = we[3], we[2] = we[1];
            we[1] = ns[0], we[3] = ns[2];
            ns[0] = we[0], ns[2] = we[2];
        }
    }
    cout << dd[ns[0]] << "\n";
    
    return 0;
}


Measured memory_bytes: 3208
//#define _GLIBCXX_DEBUG
//#include "atcoder/all"
//using namespace atcoder;
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


void solve() {
}

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

    int K;
    cin >> K;
    for (int i = 0; i < K; i++) {
        cout << "ACL";
    }
    cout << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef vector<int> VI;
typedef VI::iterator VII;
typedef pair<int, int> PII;
typedef vector<PII> VP;

int n, m, h, k;
bool bar[1010][1010];
int score[1010][1010];
bool isscore[1010][1010];
VP ab;
int ans;

int main()
{
  while(true){
    scanf("%d%d%d%d", &n, &m, &h, &k);
    if(!n && !m && !h && !k)
      break;
    
    memset(bar, false, sizeof bar);
    memset(score, 0, sizeof score);
    memset(isscore, false, sizeof isscore);
    ab.clear();
    ans = 0;

    for(int i = 1; i <= n; i++)
      scanf("%d", &score[h - 1][i]);
    
    for(int i = 1; i <= m; i++){
      int a, b;
      scanf("%d%d", &a, &b);
      bar[b][a] = true;
      ab.push_back(make_pair(a, b));
    }
    
    for(int i = h - 1; i >= 1; i--)
      for(int j = 1; j <= n; j++){
	if(bar[i][j])
	  score[i - 1][j + 1] = score[i][j];
	else if(bar[i][j - 1])
	  score[i - 1][j - 1] = score[i][j];
	else
	  score[i - 1][j] = score[i][j];
      }

    for(int i = 1; i <= k; i++){
      int now = i;      
      for(int j = 0; j <= h - 1; j++){
	if(bar[j + 1][now])
	  now += 1;
	else if(bar[j + 1][now - 1])
	  now -= 1;
	
	isscore[j + 1][now] = true;
      }
    }

    int standard;
    for(int i = 1; i <= n; i++)
      if(isscore[h - 1][i])
	ans += score[h - 1][i];
    standard = ans;

    for(int i = 0; i < m; i++)
      if(isscore[ab[i].second][ab[i].first] && !isscore[ab[i].second][ab[i].first + 1])
	ans = min(ans, standard - score[ab[i].second][ab[i].first] + score[ab[i].second][ab[i].first + 1]);
      else if(!isscore[ab[i].second][ab[i].first] && isscore[ab[i].second][ab[i].first + 1])
	ans = min(ans, standard - score[ab[i].second][ab[i].first + 1] + score[ab[i].second][ab[i].first]);
    /*
    for(int i = 0; i < h; i++){
      for(int j = 1; j <= n; j++)
	cout << isscore[i][j] << " ";
      cout << endl;
      }*/
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 8060
s = str(input())
l = list(s)

for i in range(1 << len(s)-1):
    li = ''
    
    for j in range(len(s)):
        li += l[j]
        if j == len(s)-1:
            continue
        if i & (1 << j):
            li += '+'
        else:
            li += '-'
#     print(li)
    r = eval(li)
    if r == 7:
        break
        
print(li+'=7')

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll n;
  scanf("%lld",&n);
  vector<ll> p(n);
  for(int i = 0 ; i < n ; i++){
    scanf("%lld",&p[i]);
  }
  ll ans=0;
  for (int i=1; i<n-1; i++) {
    if ((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i+1]<p[i]&&p[i]<p[i-1])) ans++;
  }
  cout << ans << endl;
}

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


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = INT_MAX / 2;

int K, T;
VI as;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> K >> T;
	rep (i, T) {
		int a;
		cin >> a;
		as.pb(a);
	}
	if (T == 1) {
		cout << as[0] - 1 << endl;
		return 0;
	}
	sort(rall(as));
	VI ans;
	rep (i, as.size() - 1) {
		int a = 0, b = 0;
		rep (j, i + 1) {
			a += as[j];
		}
		REP (j, i + 1, as.size()) {
			b += as[j];
		}
		ans.pb(abs(a - b));
	}
	sort(all(ans));
	cout << max(ans[0] - 1, 0) << endl;
	return 0;
}



Measured memory_bytes: 256
import collections


N = int(input())
A = list(map(int, input().split()))
Q = int(input())
cnt = collections.Counter(A)

s = 0
for k, v in cnt.items():
    s += int(k) * v
for i in range(Q):
    BC = list(map(int, input().split()))

    if BC[0] in cnt:
        if BC[1] in cnt:
            cnt[BC[1]] += cnt[BC[0]]
            s += int(BC[1]) * cnt[BC[0]]
            s -= int(BC[0]) * cnt[BC[0]]
            del cnt[BC[0]]
        else:
            cnt[BC[1]] = cnt[BC[0]]
            s += int(BC[1]) * cnt[BC[0]]
            s -= int(BC[0]) * cnt[BC[0]]
            del cnt[BC[0]]
    print(s)


Measured memory_bytes: 21280
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,m,ans=0;
  cin>>n>>m;
  long x[m],check[m];
  for(int i=0; i<m; i++)
    cin>>x[i];
  sort(x,x+m);
  for(int j=0; j<m-1; j++)
    check[j]=x[j+1]-x[j];
  sort(check,check+m-1);
  for(int k=0; k<m-n; k++)
    ans+=check[k];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,k = li()
print(n-k+1)

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

\
int main (){
    
  int a,b,t;
  int ans,n;
  int v[50];
  int c[50];
  
  scanf("%d",&n);
  
  for(int i = 0;i < n;i++){
    scanf("%d",&v[i]);
   }
   for(int i = 0;i < n;i++){
    scanf("%d",&c[i]);
   }

	for(int i = 0;i < n;i++){
      if(0 < v[i] - c[i]){
        ans += v[i] -c[i];
        }
  }
  printf("%d",ans);
      return 0;
  
}



Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author jcg
 */

#include <bits/stdc++.h>

#include <bits/stdc++.h>


using std::vector;

vector<int> strategy_function(const vector<vector<int>> &g)
{
	vector<int> label(g.size());
	std::function<int(int)> dfs = [&](int u)
	{
		label[u] = -1;
		int used = 0, more = 0;
		for (int v : g[u])
			if (!label[v])
			{
				int mask = dfs(v);
				more |= mask & used;
				used |= mask;
			}
		for (int k : {1, 2, 4, 8, 16})
			more |= more >> k;
		++more;
		int possible = ~used & -more;
		label[u] = possible & -possible;
		used |= label[u];
		used &= -label[u];
		return used;
	};
	dfs(0);
	return label;
}


class DUninity
{
public:
    void solve(std::istream& in, std::ostream& out)
    {
        using std::vector;

        int n;
        in >> n;

        vector<vector<int>> g(n);
        for (int i = 1; i < n; ++i)
        {
            int u, v;
            in >> u >> v;
            --u, --v;
            g[u].emplace_back(v);
            g[v].emplace_back(u);
        }

        auto label = strategy_function(g);
        out << std::__lg(*std::max_element(label.begin(), label.end())) << '\n';
    }
};


int main()
{
    std::ios_base::sync_with_stdio(0);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    in.tie(0);
    DUninity solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 11776
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N + 1);
    vector<bool> b(N + 1, false);
    FOR(i, 1, N + 1, 1) {
        cin >> a[i];
    }
    int res = 0;
    RFOR(i, N, 1, 1) {
        int cnt = 0;
        FOR(j, 1, N / i + 1, 1) {
            cnt += b[i * j];
        }
        if (cnt % 2 != a[i]) {
            b[i] = true;
            res++;
        }
    }
    cout << res << endl;
    FOR(i, 1, N + 1, 1) {
        if (b[i]) {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1792
/**
 * File    : B.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-3-4 21:01:04
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  int N;
  cin >> N;
  string S[120];
  for (auto i = 0; i < N; i++)
  {
    cin >> S[i];
  }
  for (auto i = 0; i < N; i++)
  {
    if (S[i] == "Y")
    {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
int main (){
double x1, x2, y1, y2,p;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);

p=(x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
p=sqrt(p);
printf("%f",p);

return 0;
}


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

int main(){
  int n,k,p;
  int ans;
  
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> k >> p;
    ans=0;
    for(int i=0;i<k;i++){
      ans++;
      if(ans>p){
	ans=1;
      }
    }
    cout << ans << '\n';
  }

  return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
#define dump(a) cout << (a) << endl;
typedef long long ll;

int main() {
    int h, w;
    cin >> h >> w;
    char f[100][100] = {};
    int white, black;
    white = black = 0;
    for( int i = 0; i < h; i++ ) {
        for( int j = 0; j < w; j++ ) {
            cin >> f[i][j];
            if( f[i][j] == '.' ) white++;
            else if( f[i][j] == '#' ) black++;
        }
    }
    int d[100][100] = {};
    for( int i = 0; i < h; i++ ) for( int j = 0; j < w; j++ ) d[i][j] = 1e9;
    d[0][0] = 0;
    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));
    int nx[4] = {0, 1, 0, -1}, ny[4] = {1, 0, -1, 0};
    while( !q.empty() ) {
        pair<int, int> a = q.front();
        q.pop();
        for( int i = 0; i < 4; i++ ) {
            if( a.first+ny[i] < 0 || a.first+ny[i] >= h || a.second+nx[i] < 0 || a.second+nx[i] >= w) continue;
            if( d[a.first+ny[i]][a.second+nx[i]] > d[a.first][a.second]+1 && f[a.first+ny[i]][a.second+nx[i]] == '.' ) {
                d[a.first+ny[i]][a.second+nx[i]] = d[a.first][a.second]+1;
                q.push(make_pair(a.first+ny[i], a.second+nx[i]));
            }
        }
    }
    if( d[h-1][w-1] == 1e9 ) {
        dump(-1);
    }
    else {
        dump(white - d[h-1][w-1] - 1);
    }
    return 0;  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

int main(){
  ll N, K;

  cin >> N >> K;

  if(K == 0){
    cout << N * N << endl;
    return 0;
  }

  ll ans = 0;

  REP(i, K+1, N+1){ // till i == N+1
    ll d = N / i;
    ll rem = N % i;

    ans += d * (i - K);

    //cout << "+:" << d * (i - K) << ", rem:" << rem-K << endl;
    if(rem >= K){
      ans += rem - K + 1;
    }
  }

  cout << ans << endl;

  return 0;
}


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

const int maxn = 100010;

int a[maxn];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	for(int i = 1; i <= n; ++ i) cin >> a[i];
	cout << (n + k - 3) / (k - 1) << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

char a[100][100],b[100][100];

int main(void){
    ll n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
            cin>>b[i][j];
        }
    }
    bool ans=false;
    for(int i=0;i<=n-m;i++){
        for(int j=0;j<=n-m;j++){
            bool kari=true;
            for(int h=0;h<m;h++){
                for(int w=0;w<m;w++){
                    if(a[i+h][j+w]!=b[h][w]){
                        kari=false;
                    }
                }
            }
            if(kari) ans=true;
        }
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

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

  V<int> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) b[i] = abs(a[i]);

  rep(i, n - 1) {
    if (a[i] < 0) {
      a[i] = -1 * a[i];
      a[i + 1] = -1 * a[i + 1];
    }
  }
  ll ans = 0;
  rep(i, n) ans += b[i];

  auto z = find(a.begin(), a.end(), 0);
  if (a.back() < 0 && z == a.end()) {
    auto m = minmax_element(b.begin(), b.end());
    ans -= *m.first * 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3996
a1, a2, a3 = map(int, input().split())
 
ans1 = abs(a1 - a2) + abs(a2 - a3)
ans2 = abs(a1 - a3) + abs(a3 - a2)
ans3 = abs(a2 - a1) + abs(a1 - a3)
 
print(min(ans1, ans2, ans3))

Measured memory_bytes: 2940
c=input()
l=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
print(l[l.index(c)+1] if c!='z' else 'a')

Measured memory_bytes: 2940
#include<cstdio>
#include<complex>

using namespace std;
typedef complex<double> xy;

const double eps=0.0001;
bool eq(double a, double b) {
    return abs(a-b) < eps;
}
double dot(xy a, xy b) {
    return (a*conj(b)).real();
}
double cross(xy a, xy b) {
    return (a*conj(b)).imag();
}

int main(void) {
    while(true) {
        int n;
        scanf("%d",&n);
        if(!n) break;

        int tm;
        scanf("%d",&tm);
        xy txy[100];
        for(int j=0; j<tm; j++) {
            double x,y;
            scanf("%lf%lf",&x,&y);
            txy[j] = xy(x,y);
        }
        for(int i=1; i<=n; i++) {
            int m;
            scanf("%d",&m);
            xy nxy[100];
            for(int j=0; j<m; j++) {
                double x,y;
                scanf("%lf%lf",&x,&y);
                nxy[j] = xy(x,y);
            }

            bool flag1,flag2;
            flag1=flag2=(tm==m);

            for(int j=0; j+1<m; j++) {
                if(!eq(norm(txy[j+1]-txy[j]), norm(nxy[j+1]-nxy[j])))
                    flag1 = false;
            }
            for(int j=0; j+2<m; j++) {
                if(!eq(cross(txy[j+2]-txy[j+1], txy[j+1]-txy[j]), cross(nxy[j+2]-nxy[j+1], nxy[j+1]-nxy[j])))
                    flag1 = false;
            }
            for(int j=0; j+1<m; j++) {
                if(!eq(norm(txy[j+1]-txy[j]), norm(nxy[m-1 - (j+1)]-nxy[m-1 - j])))
                    flag2 = false;
            }
            for(int j=0; j+2<m; j++) {
                if(!eq(cross(txy[j+2]-txy[j+1], txy[j+1]-txy[j]), cross(nxy[m-1 - (j+2)]-nxy[m-1 - (j+1)], nxy[m-1 - (j+1)]-nxy[m-1 - j])))
                    flag2 = false;
            }
            if(flag1 || flag2) printf("%d\n",i);
        }
        printf("+++++\n");
    }
    return 0;
}

Measured memory_bytes: 1096
#include <cstdio>
#include <vector>
using namespace std;

vector<int> primeList = {2, 3}; 

int isPrime(int a) {
    for (vector<int>::iterator it = primeList.begin(); it != primeList.end(); it++) {
        if (a % *it == 0) { 
            return 0;
        }
    }
    return 1;
}

int main() {
    int n;
    scanf("%d", &n);

    printf("%d ", 2);
    int count = 1;

    for (int i = 1; count < n ; i++) {
        if (isPrime(6 * i - 1)) {
            primeList.push_back(6 * i - 1);
            if (i % 5 == 0) { 
                printf("%d ", 6 * i - 1);
                count++;
            }
        }
        if (isPrime(6 * i + 1)) {
            primeList.push_back(6 * i + 1);
        }
    }
    printf("\n");
    return 0;
}

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

int main(void){
    
    string s;
    ll n=0, r=0, l=0, rl=1;
    
    cin >> s;
    
    n = s.size();
    vector<ll> a(n, 0);
    
    for(ll i=0; i<=n-1; i++){
        
        if(s.at(i)=='R'){
            
            a.at(rl-1) += l/2;
            a.at(rl) += l - l/2;
            l = 0;
            
            r += 1;
            
        } else if(s.at(i)=='L'){
            
            if(r>=1){
                
                rl = i;
                
            }
            
            a.at(i-1) += r - r/2;
            a.at(i) += r/2;
            r = 0;
            
            l += 1;
            
        }
        
    }
    
    a.at(rl-1) += l/2;
    a.at(rl) += l - l/2;
    
    for(ll i=0; i<=n-2; i++){
        
        cout << a.at(i) << " ";
        
    }
    
    cout << a.at(n-1);
    
    return 0;
    
}

Measured memory_bytes: 1408
import java.util.Scanner;
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();
        if (a <b&&b<c)
            System.out.println("Yes");
        else
            System.out.println("No");
}
}


Measured memory_bytes: 26212
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let p: Vec<u32> = (0..n).map(|_| read()).collect();

    let mut ans = 0;
    for i in 1..n - 1 {
        if (p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i + 1] < p[i] && p[i] < p[i - 1]) {
            ans += 1;
        }
    }

    println!("{}", ans);
}

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

#define FOR(x,y,z) for(int x=y,x##_=z;x<=x##_;++x)
#define DOR(x,y,z) for(int x=y,x##_=z;x>=x##_;--x)
#define FOR_(x,y,z,s) for(int x=y,x##_=z;x<=x##_;x+=s)
#define FOR__(x,y,z) for(int x=y,x##_=z;x<=x##_;x<<=1)
#define EOR(x,y) for(int x##_=head[x],y=edge[x##_].e;x##_;y=edge[x##_=edge[x##_].to].e)
#define EGOR(x,y,z) for(int x##_=head[x],y=edge[x##_].e,z=edge[x##_].c;x##_;y=edge[x##_=edge[x##_].to].e,z=edge[x##_].c)

#define clr(x,y) memset(x,y,sizeof(x))
#define szf(x) sizeof(x)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)

#define read2(x,y) read(x),read(y)
#define read3(x,y,z) read(x),read(y),read(z)
#define read4(x,y,z,w) read3(x,y,z),read(w)
#define reads(str) sf("%s",str)

#define ts (*this)
#define sf scanf
#define pf printf

#define ll long long
#define ull unsigned long long
#define db double
#define ct clock_t
#define ck() clock()
#define rd rand()
#define rmx RAND_MAX
#define RD T*(rd*2-rmx)


using namespace std;

template<class T>bool tomin(T &x,T y){return y<x?x=y,1:0;}
template<class T>bool tomax(T &x,T y){return x<y?x=y,1:0;}
template<class T>void read(T &x){
    char c;
    x=0;
    int f=1;
    while(c=getchar(),c<'0'||c>'9')if(c=='-')f=-1;
    do x=(x<<3)+(x<<1)+(c^48);
    while(c=getchar(),c>='0'&&c<='9');
    x*=f;
}

const db Pi=acos(-1);
const int maxn=2e5+5;
int n;
int A[maxn];
int main(){
    srand(time(NULL));
    read(n);
    int mx[3]={0};
    FOR(i,1,n){
        read(A[i]);
        if(tomax(mx[0],A[i])){
            mx[1]=i;
            mx[2]=1;
        }else if(mx[0]==A[i])mx[2]++;
    }
    if(mx[2]==1){
        FOR(i,1,mx[1]-1)pf("%d\n",mx[0]);
        int mmx=0;
        FOR(i,1,n)if(A[i]<mx[0])tomax(mmx,A[i]);
        pf("%d\n",mmx);
        FOR(i,mx[1]+1,n)pf("%d\n",mx[0]);
    }else{
        FOR(i,1,n)pf("%d\n",mx[0]);
    }
    return 0;
}


Measured memory_bytes: 2432
import sys
input = sys.stdin.readline

def matDot(A,B,MOD):
    N,M,L = len(A),len(A[0]),len(B[0])
    
    res = [[0]*L for i in range(N)]

    for i in range(N):
        for j in range(L):
            s = 0
            for k in range(M):
                s = (s + A[i][k]*B[k][j]) % MOD
            res[i][j] = s
    
    return res

def matPow(A,x,MOD):
    N = len(A)
    res = [[0]*N for i in range(N)]
    
    for i in range(N):
        res[i][i] = 1
    
    for i in range(x.bit_length()):
        if (x>>i) & 1:
            res = matDot(res,A,MOD)
        A = matDot(A,A,MOD)
    
    return res

def main():
    n,k = map(int,input().split())
    mod = 10**9+7

    a = []
    for i in range(n):
        a.append(list(map(int,input().split())))

    b = matPow(a,k,mod)

    ans = 0
    for i in range(n):
        for j in range(n):
            ans = (ans+b[i][j])%mod

    print(ans)

if __name__ == "__main__":
    main()

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

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

	int ans = 0;
	for (int a = 1; a < n;a++) {
		int b, c;
		b = n / a;
		c = n % a;
		if (c == 0) {
			b -= 1;
			ans += b;
		}
		else ans += b;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3632
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<double,LL> P;

int N;
double L;
int main() {
	cout.precision(17);
	cin >> N >> L;
	double sum=0;
	LL sumv=0;
	deque<P> q;
	for(int i=0;i<N;i++){
		double t;
		LL v;
		cin >> t;
		cin >> v;
		sum+=t*v;
		sumv+=v;
		while(q.size()&&q.back().first>t&&v<L){
			//cerr << t << ", " << v << endl;
			if(q.back().second+v>=L){
				t=(v*t+(L-v)*q.back().first)/L;
				q.back().second-=L-v;
				v=L;
			}
			else{
				auto v2=v+q.back().second;
				t=(v*t+q.back().second*q.back().first)/v2;
				v=v2;
				q.pop_back();
			}
		}
		//cerr << t << ", " << v << endl;
		q.push_back(P(t,v));
		while(sumv>L){
			if(sumv-q.front().second>=L){
				sumv-=q.front().second;
				sum-=q.front().first*q.front().second;
				q.pop_front();
			}
			else{
				LL d=sumv-L;
				sumv-=d;
				sum-=q.front().first*d;
				q.front().second-=d;
			}
		}
		cout << sum/L << endl;
	}

	return 0;
}



Measured memory_bytes: 17680
using System;
class Program
{
    static void Main(string[] args)
    {
        int[] array = GetTwoInt();
        int count = 0;

        for(int i = 0; i < array[0]; i++)
        {
            int[] point = GetTwoInt();
            if(Math.Sqrt((((double) point[0]) * point[0]) + (((double)point[1]) * point[1])) <= array[1])
            {
                count++;
            }
        }

        Console.WriteLine(count);

      
    }

    static int[] GetTwoInt()
    {
        var s = Console.ReadLine().Split(' ');
        return new int[2] { int.Parse(s[0]),int.Parse(s[1])};
    }
}




Measured memory_bytes: 40680