akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	cout << n * (n - 1ll) / 2 << endl;
	
	return 0;
}

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

int main(){
  int n;  cin >> n;
  vector<int> a(n);
  int cmax=-1, cnt;
  rep(i,n){
    int x;
    cin >> x;
    a[i] = x;
    cmax = max(cmax, x);
    if(cmax == x)
    cnt = i;
  }
  sort(a.begin(), a.end());
  rep(i,n){
    if(i==cnt) cout << a[n-2] << endl;
    else cout << a[n-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 2432
n, k = map(int, input().split())
table = [0.5+i*0.5 for i in range(1001)]
a = list(map(int, input().split()))

ans = sum([table[a[i]] for i in range(k)])
last = ans
for i in range(1, n-k+1):
    last = last - table[a[i-1]] + table[a[i+k-1]]
    ans = max(last, ans)
print(ans)

Measured memory_bytes: 75912
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 2000
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
#define ld long double
typedef long long int ll;
using  namespace std;
string s[mxn];
ll ans[mxn][mxn],n,m;
bool vis[mxn][mxn];
bool inside(ll x,ll y){
	if(x>=0&&x<n&&y>=0&&y<m&&vis[x][y]==0&&s[x][y]=='.')
	return 1;
	else
	return 0;
}
void bfs(ll x,ll y){
//	cout<<x<<" "<<y<<" "<<cr<<endl;
	deque<pair<ll,ll>>q;
	q.pb({x,y});
	vis[x][y]=1;
	while(!q.empty()){
		pair<ll,ll>k=q.front();
		q.pop_front();
		vis[k.fi][k.se]=1;
		for(ll i=-1;i<=1;i++){
			for(ll j=-1;j<=1;j++){
				if((abs(i)+abs(j))!=1)
				continue;
				if(inside(k.fi+i,k.se+j)){
					//vis[k.fi+i][k.se+j]=1;
				q.push_front({k.fi+i,k.se+j});
				ans[k.fi+i][k.se+j]=min(ans[k.fi+i][k.se+j],ans[k.fi][k.se]);
				}
		}
			}
		for(ll i=-2;i<=2;i++){
			for(ll j=-2;j<=2;j++){
				if(abs(i)+abs(j)==1||abs(i)+abs(j)==0)
				continue;
				if(inside(k.fi+i,k.se+j)){
					//vis[k.fi+i][k.se+j]=1;
				q.pb({k.fi+i,k.se+j});
				ans[k.fi+i][k.se+j]=min(ans[k.fi+i][k.se+j],ans[k.fi][k.se]+1LL);
			}
		}
	}
	}
}
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	ll i,j,si,sj,ei,ej;
	cin>>n>>m;
	cin>>si>>sj>>ei>>ej;
	for(i=0;i<n;i++)
	cin>>s[i];
	for(i=0;i<n;i++){
		for(j=0;j<m;j++)
		ans[i][j]=inf;
	}
	ans[si-1][sj-1]=0;
	bfs(si-1,sj-1);
	if(!vis[ei-1][ej-1])
	cout<<-1<<endl;
	else
	cout<<ans[ei-1][ej-1];
}


Measured memory_bytes: 19940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a[10],k;
    while(cin>>a[0]>>a[1]>>a[2]>>k)
    {
        while(k--)
        {
            sort(a,a+3);
            a[2]=2*a[2];
        }
        long long s=a[0]+a[1]+a[2];
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if(b == 1){
            System.out.println(0);
            return;
        }
        if(a == b){
            System.out.println(1);
            return;
        }
        int c = a;
        int out = 1;
        while(c < b){
            c += a - 1;
            out++;
        }
        System.out.println(out);
        scan.close();
    }
}


Measured memory_bytes: 27064
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#define mod 1000000007
using namespace std; 

int main(){
	int n,m; cin >> n >> m;
	if (m>=n) cout << "unsafe" << "\n";
	else cout << "safe" << "\n";	
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> vec(2*M);
  
  for(int i=0; i<2*M; i++){
    cin >> vec.at(i);
  }
  
  vector<int> number(N);
  
  for(int i=0; i<2*M; i++){
    number.at(vec.at(i)-1)++;
  }
  
  for(int i=0; i<N; i++){
    cout << number.at(i) << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
S, T = input().split()
ans = [0]*(N*2)
Scount = 0
Tcount = 1
for i in S:
    ans[Scount] = i
    Scount += 2
for j in T:
    ans[Tcount] = j
    Tcount += 2

print(''.join(ans))


Measured memory_bytes: 9032
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private static int[][] paper = new int[10][10];

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 128);
		String sLine;
		while ((sLine = reader.readLine()) != null) {
			droppingInk(sLine.charAt(0) & 0x0F, sLine.charAt(2) & 0x0F, sLine.charAt(4) & 0x0F);
		}
		calcResult();
	}

	private static void droppingInk(int x, int y, int size) {
		staining(x, y - 1);
		staining(x - 1, y);
		staining(x, y);
		staining(x + 1, y);
		staining(x, y + 1);
		if (size == 1) {
			return;
		}

		staining(x - 1, y - 1);
		staining(x + 1, y - 1);
		staining(x - 1, y + 1);
		staining(x + 1, y + 1);
		if (size == 2) {
			return;
		}

		staining(x, y - 2);
		staining(x - 2, y);
		staining(x + 2, y);
		staining(x, y + 2);
	}

	private static void staining(int x, int y) {
		if (x >= 0 && x < 10 && y >= 0 && y < 10) {
			paper[x][y]++;
		}
	}

	private static void calcResult() {
		int white = 0;
		int maxnoud = 0;
		for (int[] row : paper) {
			for (int colum : row) {
				if (colum == 0) {
					white++;
				} else if (colum > maxnoud) {
					maxnoud = colum;
				}
			}
		}
		System.out.println(white);
		System.out.println(maxnoud);
	}
}

Measured memory_bytes: 17012
#include<iostream>
#include <bits/stdc++.h>
int main()
{
  int n,k,sum,vec[1000];
  sum =0;
  std::cin>>n>>k;
  for(int i=0;i<n;i++){
    std::cin>>vec[i];
  }
  std::sort(vec, vec+n);
  for(int i=0;i<k;i++){
    sum = sum + vec[i];
  }
  std::cout<<sum;
}
  


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std ;
 long long int m (  long long int a , float b )
{
	if ( a == 0 || b == 0 )	
	{
		return 0 ; 
	}
	int d = b * 100 ;
	long long int c = ( a * d) / (100) ;
	return c ;
}
int main ()
{
	 long long int a ;
	float b ;
	cin >> a >> b ;
	cout << m ( a ,b ) << endl;

}

Measured memory_bytes: 3712
n = int(input())

coms = list(map(int, input().split()))


sr = sorted(coms, reverse=True)

ans = 0
for i in range(n-1):
    if i == 0:
        ans += sr[0]
    else:
        nth = (i + 1) // 2
        ans += sr[nth]

print(ans)

Measured memory_bytes: 94224
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    int n;
    int next[];
    boolean used[];

    public void solve() throws IOException {
        int n = nextInt(), m = nextInt();
        if (Math.abs(m - n) > 1) {
            out.print(0);
            return;
        }
        long nf = 1;
        long mf = 1;
        long mod = 1000000000 + 7;
        for (long i = 2; i <= n; i++) {
            nf *= i;
            nf %= mod;
        }
        for (long i = 2; i <= m; i++) {
            mf *= i;
            mf %= mod;
        }
        if(n == m){
            out.print((((nf * mf) % mod) * 2) % mod);
        }else{
            out.print((nf * mf) % mod);
        }

    }


    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("queue.in"));
//            out = new PrintWriter(new File("queue.out"));
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i; i<N; i++) cin >> A[i];
  unordered_map<int, int> mp;
  for (int x: A){
    if (mp.find(x) == mp.end()) mp[x] = 1;
    else mp[x] += 1;
  }
  int ans = mp.size();
  int count = 0;
  for (auto x = mp.begin(); x != mp.end(); x++){
    if (x->second %2 == 0) count += 1;
  }
  if (count % 2 == 1) ans -= 1;
  cout << ans << endl;
}


Measured memory_bytes: 4772
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

void expand_minmax(tuple<int, int, int, int> &minmax, tuple<int, int, int, int> &result)
{
    get<0>(minmax) = min(get<0>(minmax), get<0>(result));
    get<1>(minmax) = min(get<1>(minmax), get<1>(result));
    get<2>(minmax) = max(get<2>(minmax), get<2>(result));
    get<3>(minmax) = max(get<3>(minmax), get<3>(result));
}

int main()
{
    scanInt(N);
    scanInt(M);
    scanInt(Q);
    vector<vector<char>> board(N, vector<char>(M));
    loop(n, N){
        loop(m, M){
            board[n][m] = getchar() - '0';
        }
        getchar();
    }
    vector<vector<int>> node_s_sum(N + 1, vector<int>(M + 1, 0));
    for (int n = 1; n <= N; ++n){
        vector<int> temp_sum(M + 1, 0);
        for (int m = 1; m <= M; ++m){
            temp_sum[m] = temp_sum[m - 1] + board[n - 1][m - 1];
            node_s_sum[n][m] = node_s_sum[n - 1][m] + temp_sum[m];
        }
    }
    vector<vector<int>> edge_h_sum(N + 1, vector<int>(M + 1 - 1, 0));
    for (int n = 1; n <= N; ++n){
        vector<int> temp_sum(M + 1 - 1, 0);
        for (int m = 1; m <= M - 1; ++m){
            temp_sum[m] = temp_sum[m - 1] + static_cast<int>(board[n - 1][m - 1] && board[n - 1][m + 1 - 1]);
            edge_h_sum[n][m] = edge_h_sum[n - 1][m] + temp_sum[m];
        }
    }
    vector<vector<int>> edge_v_sum(N + 1 - 1, vector<int>(M + 1, 0));
    for (int m = 1; m <= M; ++m){
        vector<int> temp_sum(N + 1 - 1, 0);
        for (int n = 1; n <= N - 1; ++n){
            temp_sum[n] = temp_sum[n - 1] + static_cast<int>(board[n - 1][m - 1] && board[n + 1 - 1][m - 1]);
            edge_v_sum[n][m] = edge_v_sum[n][m - 1] + temp_sum[n];
        }
    }
    loop(q, Q){
        scanInt(n1);
        scanInt(m1);
        scanInt(n2);
        scanInt(m2);
        printf("%d\n",
               (node_s_sum[n2][m2] - node_s_sum[n2][m1 - 1] - node_s_sum[n1 - 1][m2] + node_s_sum[n1 - 1][m1 - 1])
               - (edge_h_sum[n2][m2 - 1] - edge_h_sum[n2][m1 - 1] - edge_h_sum[n1 - 1][m2 - 1] + edge_h_sum[n1 - 1][m1 - 1])
               - (edge_v_sum[n2 - 1][m2] - edge_v_sum[n2 - 1][m1 - 1] - edge_v_sum[n1 - 1][m2] + edge_v_sum[n1 - 1][m1 - 1]));
    }
}


Measured memory_bytes: 52864
#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

int N;
int A[100000 + 100];
int dp[100000 + 100][3];

int gcd(int a, int b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}

int solve() {
	dp[2][0] = gcd(A[0], A[1]);
	dp[2][1] = A[0];
	dp[2][2] = A[1];
	for (int i = 2; i < N; ++i) {
		dp[i + 1][0] = gcd(dp[i][0], A[i]);
		dp[i + 1][1] = max(gcd(dp[i][1], A[i]), dp[i][0]);
		dp[i + 1][2] = max(gcd(dp[i][2], A[i]), dp[i][0]);
	}
	return max(max(dp[N][0], dp[N][1]), dp[N][2]);
}

int main(void) {
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> A[i];
	cout << solve() << endl;
	return 0;
}

Measured memory_bytes: 1792
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    if N == 0:
        ans = "0"
    else:
        ans = ""
        while N != 0:
            q, r = divmod(N, -2)
            if r == 0:
                ans = "".join(["0", ans])
            else:
                ans = "".join(["1", ans])
            r = r + 2 if r < 0 else r
            N = (N - r) // -2

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9100
#include <iostream>

//线性查找元素时增加标记到末尾可减少比较次数
//不增加标记：判断是否到达序列末尾，判断是否找到元素 
// 增加标记：判断是否在末尾之前找到元素 ，末尾元素和目标元素值相同 

bool binarySearch(int a[], int key, int n)
{
	int up = n , down = 0;
	
	while (up > down) //不能等于，若上下相邻， 
	{
		int mid = (up + down) / 2;
	//	std::cout << "---------" << a[mid] << std::endl;
		if (a[mid] == key)
		return true;
		if (a[mid] > key)
		up = mid;//up可能不会被计算为mid，所以要用一个索引指向的值已经不是key的下标给up 
		//若上式为up = mid + 1,则有可能a[up] == key ，循环由于找不到正确的值，不断提高下限缩短范围
		//在某一次只剩下up和up-1 两者之和除以2得到up-1，下限上移一个循环条件不成立判定为找不到 
		if (a[mid] < key)
		down = mid + 1;	//相邻两个数之和除以2，的结果总是小的那一个所以 up不能为没检测过的 
	}
	return false;
}

int main()
{
	int a[100000 + 1];
	int n = 0;
	std::cin >> n;
	//if (n > 100000) return -1;
	for (int i = 0; i < n; ++i)
		std::cin >> a[i];
	int q = 0;
	std::cin >> q;
	//if (q > 5000) return -1;
	int sum = 0;
	for (int i = 0; i < q; ++i) {
		int t = 0;
		std::cin >> t;
		if (binarySearch(a, t, n)) 
		{
		//	std::cout << "t:" << t << std::endl;
			sum++;
		}
		
	}
	std::cout << sum << std::endl;
	return 0;
}


Measured memory_bytes: 3452
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifndef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void solve()
{
	int n;
	cin >> n;
	vector<int> v(n), a(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i], a[i] = v[i];
	sort(a.begin(), a.end());
	int max1 = a[n - 1], max2 = a[n - 2];
	for (int i = 0; i < n; ++i)
	{
		if (v[i] == max1)
		{
			cout << max2 << "\n";
		}
		else
		{
			cout << max1 << "\n";
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 4764
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    // 頂点数と辺数
    int N; cin >> N ;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < N; ++i) {
        int a , b;
        cin >> a >> b;
        a = a - 1;
        if(b != 0){
        for(int j = 0; j < b; j++){
            int e1;
            cin >> e1;

            e1 = e1 - 1;
        //    G[e1].push_back(a);
            G[a].push_back(e1);
        }
        }

    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない
            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    for (int v = 1; v <= N; ++v) cout << v << " " << dist[v - 1] << endl;
}


Measured memory_bytes: 3148
import java.util.Scanner;



public class Main {


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

		S=S.replace("eraser","");
		S=S.replace("erase", "");
		S=S.replace("dreamer","");
		S=S.replace("dream", "");




		if(S.length()==0) {
			System.out.println("YES");

		}else {
			System.out.println("NO");

		}


	}
}


Measured memory_bytes: 29712
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b>c+d){
    cout<<"Left"<<endl;
  }
  else if(a+b==c+d){
    cout<<"Balanced"<<endl;
  }
  else{
    cout<<"Right"<<endl;
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

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

    int ans = 0;
    FOR(i,1,50001) {
        int x = i * 1.08;
        if (x == n) {
            ans = i;
            break;
        } else if (x > n) break;
    }

    if (ans == 0) cout << ":(" << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll solve (vector<ll> &a, ll i, ll n, vector<ll> &dp)
{
    if (i == n)
    {
        return 0;
    }

    if (dp[i] != -1)
    {
        return dp[i];
    }

    int c1 = INT_MAX;
    int c2 = INT_MAX;

    if (i + 1 <= n)
    {
        c1 = abs (a[i + 1] - a[i]) + solve (a, i + 1, n, dp);
    }

    if (i + 2 <= n)
    {
        c2 = abs (a[i + 2] - a[i]) + solve (a, i + 2, n, dp);
    }

    /*for(int i=1;i<=n;i++){
        cout<<dp[i]<<" ";
    }
    cout<<endl<<"*********************************"<<endl;*/
//cout<<c1<<" "<<c2<<endl;
    return dp[i] = min (c1, c2);
}
ll solve2 (vector<ll> a, int n)
{
    vector<ll> dp (n + 1);
    dp[n] = 0;

    for (int i = n - 1; i >= 1; i--)
    {
        int c1 = INT_MAX;
        int c2 = INT_MAX;

        if (i + 1 <= n)
        {
            c1 = abs (a[i + 1] - a[i]) + dp[i + 1];
        }

        if (i + 2 <= n)
        {
            c2 = abs (a[i + 2] - a[i]) + dp[i + 2];
        }

        dp[i] = min (c1, c2);
    }

    return dp[1];
}
int main()
{
    ll n;
    cin >> n;
    vector<ll> a (n + 1);

    for (int i = 1; i <= n; i++)
    {

        cin >> a[i];
    }

    //vector<ll> dp(n+1,-1);
    //cout<<solve(a,1,n,dp)<<endl;
    cout << solve2 (a, n) << endl;

    return 0;
}


Measured memory_bytes: 5556
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        private static int count = 0;
        private const int Size = 3;

        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
            int N = line[0], A = line[1], B = line[2], C = line[3];

            var bamb = new int[N];
            for (var i = 0; i < N; i++)
            {
                bamb[i] = int.Parse(Console.ReadLine());
            }

            var cal = new Calc() { A = A, B = B, C = C, N = N, L = bamb };
            Console.WriteLine(cal.DfsR(0, 0, 0, 0));
        }
    }

    public class Calc
    {
        public int N { get; set; }
        public int A { get; set; }
        public int B { get; set; }
        public int C { get; set; }
        public int[] L { get; set; }

        public int DfsR(int cur, int a, int b, int c)
        {
            // 終了条件
            // 配列の末尾までいったら終了
            if (cur == N)
            {
                // 終了時点でabcのいずれかに0が含まれていれば対象外なのであり得ない数値(十分に大きい)を入れておく(10^9)
                // ゼロを含まない場合はa + b + cの差を足して最後に30を引く
                // 何故30を引くかというと、下の方で再帰呼び出ししている時に実際は合成してなくても+10をしているから
                // 例えばAに1本、Bに1本、Cに1本使ってるときは+10が3回されてるから
                // 実際は合成してないのに+30になってる
                // それを補正しているのが-30
                // これによって1本(合成無し)と合成あり(2本以上)を分けて考える必要が無くなっている
                // これを自分で考え付くかというと難しい。。。
                if (Math.Min(Math.Min(a, b), c) > 0)
                    return Math.Abs(a - A) + Math.Abs(b - B) + Math.Abs(c - C) - 30;
                else
                    return (int) Math.Pow(10, 9);
            }

            // 第一引数はインデックス、探索のノードを進めていくもの
            // Not Use
            var ret0 = DfsR(cur + 1, a, b, c);
            // Use A
            var ret1 = DfsR(cur + 1, a + L[cur], b, c) + 10;
            // Use B
            var ret2 = DfsR(cur + 1, a, b + L[cur], c) + 10;
            // Use C
            var ret3 = DfsR(cur + 1, a, b, c + L[cur]) + 10;

            return Math.Min(Math.Min(Math.Min(ret0, ret1), ret2), ret3);
        }
    }
}


Measured memory_bytes: 13396
from collections import deque
H,W=map(int,input().split())
N=int(input())
a=list(map(int,input().split()))

#print(a)
j=1
for i in range(H):
    x=deque()
    while len(x)<W:
        if i%2==0:
            a[j-1]-=1
            x.append(str(j))
        else:
            a[j-1]-=1
            x.appendleft(str(j))
        if a[j-1]==0:
            j+=1
    A=" ".join(list(x))
    print(A)

Measured memory_bytes: 3572
//#define NDEBUG

#include <bits/stdc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define F first
#define S second
#define B back()
#define FR front()
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}
#define pii pair<int, int>
#define pll pair<ll, ll>
#define tiii tuple<int, int, int>
#define mt make_tuple
#define gt(t, i) get<i>(t)

//#define TEST

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

int main(){
    StarBurstStream

    int n, m;
    cin >> n >> m;

    int ac = 0, wa = 0;
    vector<bool> a(n + 1);
    vector<int> w(n + 1);

    for(int i = 0; i < m ;i++){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC"){
            if(!a[p]) ac++, a[p] = true;
        }
        else if(!a[p]) w[p]++;
    }
    for(int i = 1; i <= n; i++) if(a[i]) wa += w[i];

    cout << ac << " " << wa << "\n";

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int main()
{
	ll a,b,c;
	cin>>a>>b>>c;
	ll d=c-a-b;
	if(d<=0)
	{
		printf("No\n");
		return 0;
	}
	d=d*d;
	
	ll e=a*b;
	if(e>(d/4ll))
	{
		printf("No\n");
		return 0;
	}
	if(e==(d/4ll)&&(4ll*e==d))
	{
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}

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

string S;
int dp[1 << 26];
int N;
int INF = 100000000;

int main()
{
    cin >> S;

    int N = S.size();

    for(int i = 1; i < (1 << 26); i++)dp[i] = INF;

    int now = 0;
    for(int i = 0; i < N; i++)
    {
        now ^= (1 << (S[i] - 'a'));
        int tmp = dp[now] + 1;
        for(int j = 0; j < 26; j++)tmp = min(tmp, dp[now ^ (1 << j)] + 1);
        dp[now] = min(dp[now], tmp);
        if(i == N - 1)cout << tmp << endl;
    }

    return 0;
}


Measured memory_bytes: 262660
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
unsigned int MOD = 1e9+7;

int pow2(long long x, int n) {
	long long ans = 1;
	while (n > 0) {
		if ((n & 1) == 1)ans = ans * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return ans;
}

int comb(int a, int b){
	if (a - b < b) return comb(a, a - b);
	long long mul = 1;
	long long div = 1;
	for (int i = 0; i < b; i++){
		mul *= (a - i);
		div *= (i + 1);
		mul %= MOD;
		div %= MOD;
	}
	int ans = mul * pow2(div, MOD - 2) %MOD;
	return ans; 
}

int main(void){
    long long n,m,ans;
    ans = 1;
    cin >> n >> m;
    long long m2 = m;
    for(int i = 2;i*i<=m2;i++){
        int memo = 0;
        while(m%i == 0){
            m /= i;
            memo++;
        }
        ans *= comb(memo+n-1,memo);
        ans %= MOD;
        if(i>=3)i++;
    }
    if(m!=1)ans = n*ans%MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    int h, w, m;
    cin >> h >> w >> m;
    vector<int> hs(h), ws(w);
    set<P> s;
    rep(i, m) {
        int r, c;
        cin >> r >> c;
        --r; --c;
        hs[r]++;
        ws[c]++;
        s.emplace(r, c);
    }
    int mh = 0;
    int mw = 0;
    rep(i, h) mh = max(mh, hs[i]);
    rep(j, w) mw = max(mw, ws[j]);
    vector<int> is, js;
    rep(i, h) if(mh == hs[i]) is.pb(i);
    rep(j, w) if(mw == ws[j]) js.pb(j);
    int ans = mh + mw;
    for(int i : is) {
        for(int j : js) {
            if(s.count(P(i, j))) continue;
            cout << ans << endl;
            return 0;
        }
    }
    --ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23788
from fractions import gcd
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
if K>max(A):
    print("IMPOSSIBLE")
    exit()

for i in range(N-1):
    if i==0:
        G=gcd(A[0],A[1])
    else:
        G=gcd(G, A[i+1])
#print(G)
if K%G==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 16240
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
    	new C().doIt();
    }
    class C{
    	void doIt(){
    		int cnt = 1;
            while(true){
                int n = sc.nextInt();
                if(n == 0) break;
                double [] xlist = new double[n * 2];
                double [] ylist = new double[n * 2];
                Point2D [] Fplist = new Point2D[n * 2];
                Point2D [] Lplist = new Point2D[n * 2];
                for(int i = 0; i < n; i++){
                    double x = sc.nextDouble();
                    double y = sc.nextDouble();
                    double r = sc.nextDouble();
                    Fplist[i] = new Point2D.Double(x - r,y - r);
                    Lplist[i] = new Point2D.Double(x + r,y + r);
                    xlist[i * 2] = x - r;xlist[i * 2 + 1] = x + r;
                    ylist[i * 2] = y - r;ylist[i * 2 + 1] = y + r;
                }
                Arrays.sort(xlist);
                Arrays.sort(ylist);
                 
                boolean [][] map = new boolean[ylist.length -1][xlist.length -1];
                for(int i = 0; i < n; i++){
                	Point2D fp = new Point2D.Double(Arrays.binarySearch(xlist, Fplist[i].getX()),Arrays.binarySearch(ylist, Fplist[i].getY()));
                	Point2D lp = new Point2D.Double(Arrays.binarySearch(xlist, Lplist[i].getX()),Arrays.binarySearch(ylist, Lplist[i].getY()));
//                    System.out.println(fx+" "+lx+" "+fy+" "+ly);
                    for(int j = (int)fp.getY(); j < (int)lp.getY(); j++){
                        for(int k = (int)fp.getX(); k < (int)lp.getX(); k++){
                            map[j][k] = true;
                        }
                    }
                }
                double ans = 0.0;
                for(int i = 0; i < map.length; i++){
//                	System.out.println(map.length+" "+map[i].length);
                    for(int j = 0; j < map[i].length; j++){
                        if(map[i][j]){
                            double X = xlist[j + 1] - xlist[j];
                            double Y = ylist[i + 1] - ylist[i];
//                            System.out.println(xlist[j + 1]+" "+xlist[j]+" "+ylist[i + 1]+" "+ylist[i]);
                            double area = X * Y;
                            ans += area;
                        }
                    }
//                    System.out.println();
                }
                
                
//                for(int i = 0; i < map.length; i++){
//                    for(int j = 0; j < map[i].length; j++){
//                    	System.out.print(map[i][j] ? 0:1);
//                    }
//                    System.out.println();
//                }
                System.out.printf("%d %.2f\n",cnt++, ans);
            }
        }
    }
}

Measured memory_bytes: 39248
import java.util.*;
public class Main{
	public static char[] str,front={'(','[','{'},back={')',']','}'};
	public static int i,len;
	public static int check(int n){
		while(i<len){
			for(int j=0;j<3;j++){
				if(str[i]==front[j]){
					i++;
					if(check(j)==0){
						return 0;
					}
				}
				else if(str[i]==back[j]){
					if(j==n){
						return 1;
					}
					else{
						return 0;
					}
				}
			}
			i++;
		}
		if(n!=3){
			return 0;
		}
		return 1;
	}
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(true){
			String s=sc.nextLine();
			len=s.length();
			if(len==1&&s.charAt(0)=='.'){
				break;
			}
			i=0;
			str=s.toCharArray();
			if(check(3)==1){
				System.out.println("yes");
			}
			else{
				System.out.println("no");
			}
		}
	}
}


Measured memory_bytes: 42292
import sys
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

A, B, C = mi()

if A < C < B or B < C < A:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
bool judge(int x)
{
    int t=x%10;
    x/=10;
    while(x)
    {
        if(x%10!=t) return false;
        x/=10;
    }
    return t;
}
int main()
{
    int x;
    scanf("%d",&x);
    for(int i=x;;i++)
    {
        if(judge(i)) {cout<<i<<endl;return 0;}
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int X,A,B;
    string str[] = {"delicious","safe","dangerous"};
    cin >> X >> A >> B;
    if(B-A <= 0)cout << str[0] << endl;
    else if(B-A <= X)cout << str[1] << endl;
    else cout << str[2] << endl;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())

length = -(-(b-a+1)//2)

#print(length)

t = a

if k >= length:
	for i in range(b-a+1):
		print(t)
		t = t + 1

else:
	for i in range(k):
		print(t)
		t = t + 1
		
	t = b - k + 1
	for i in range(k):
		print(t)
		t = t +1


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

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

ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    int a,b,m;
    cin >> a >> b >> m;
    vector<int> p(a);
    vector<int> q(b);
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    int ans = *min_element(p.begin(),p.end()) + *min_element(q.begin(),q.end());
    rep(i,m){
        int x,y,c;
        cin >> x >> y >>c;
        x--;
        y--;
        chmin(ans,p[x]+q[y]-c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(b<=a){
        cout << "delicious" << endl;
    }else if(b<=a+x){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }

    return 0;
}

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

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i*i <= x; i++) {
		if (x%i == 0) return false;
	}
	return true;
}

int main(void) {
	int x;
	cin >> x;

	int p = x;
	while (!is_prime(p)) p++;

	cout << p << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>){
    val N = readLine()!!.toInt()
    var alys =  (0..N-1).map{readLine()!!.split(" ").map{it.toLong()}.let { Pair(it[0] - it[1], it[1] + it[0]) }}
    var k = -100000000000
    var a = 0

    val alys_sort = alys.sortedBy { it.second }

    for(aly in alys_sort){
       if(aly.first >= k){
           a++
           k = aly.second
       }
    }
    println(a)
}

Measured memory_bytes: 88452
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
using ll = long long;
using namespace std;

signed main() {
	ll n, m, cnt = 0; cin >> n >> m; string s; cin >> s;
	rep(i, s.size()) {
		if (i != 0 && s[i - 1] == s[i]) { cnt++; }
	}
	cout << min(n - 1, cnt + (m * 2)) << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n,d,x;
    cin>>n>>d>>x;
    REP(i,n){
        int a;
        cin>>a;
        x+=(d+a-1)/a;
    }
    cout<<x<<endl;
    return 0;
}


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

template <typename T>
void print(const T &v);

int main()
{
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll x, y;
        cin >> x >> y;
        ll dist = x * x + y * y;
        if (dist <= d * d)
        {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
};

Measured memory_bytes: 3620
#include<stdio.h>
int main(void)
{
	double r, x, y;
	scanf("%lf", &r);
	x=(double)r*(double)r*3.141592653589;
	y=((double)r+(double)r)*3.141592653589;
	printf("%f %f\n", x, y);
	return 0;
}


Measured memory_bytes: 2604
#include<iostream>
#include<string>
#define MOD ((int)1e9 + 7)
using namespace std;
int line[26];
int main() {
	int N;
	cin >> N;
	string str;
	cin >> str;
	for (int i = 0; i < str.size(); ++i) {
		++line[str[i] - 'a'];
	}
	long long ans = 1;
	for (int i = 0; i < 26; ++i) {
		ans = (ans * (line[i] + 1)) % MOD;
	}
	cout << (ans + MOD - 1) % MOD << endl;
	return 0;
}

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

int prime[5144],size;

bool isPrime(int x){
	for(int i=0;i<size && prime[i]<=sqrt(x);i++){
		if(x % prime[i] == 0) return false;
	}
	return true;
}

void mkPrime(void){
	size = 1;
	prime[0] = 2;

	for(int i=3;i<50100;i+=2){
		if(isPrime(i)){
			prime[size++] = i;
		}
	}
}

int main(void){
	int i,x;

	mkPrime();

	while(cin>>x){
		for(i=0;prime[i]<x;i++);

		if(x == prime[i]){
			cout<<prime[i-1]<<" "<<prime[i+1]<<endl;
		}
		else{
			cout<<prime[i-1]<<" "<<prime[i]<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
long long q , h , s , d;
long long n;
long long ans;
int main(){
	scanf("%lld %lld %lld %lld" , &q , &h , &s , &d);
	scanf("%lld" , &n);
	n *= 4LL;
	h = min(h , q + q);
	s = min(s , h + h);
	d = min(d , s + s);
	ans = 0;
	ans += (n / 8) * d;
	n %= 8;
	ans += (n / 4) * s;
	n %= 4;
	ans += (n / 2) * h;
	n %= 2;
	ans += (n / 1) * q;
	n %= 1;
	printf("%lld\n" , ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>

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

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

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

ll modadd(ll a,ll b,ll mod=MOD){
    return (a%mod+b%mod)%mod;
}

ll modsub(ll a,ll b,ll mod=MOD){
    a%=mod;
    b%=mod;
    if(a>=b) return a-b;
    else return mod-b+a;
}

ll modmul(ll a,ll b,ll mod=MOD){
    return ((a%mod)*(b%mod))%mod;
}

ll modpow(ll a, ll n,ll mod=MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll moddiv(ll a,ll b,ll mod=MOD) {
    return modmul(a, modpow(b, mod-2));
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string L;
    cin>>L;
    ll N=L.size();
    
    vvll dp(N,vll(2));//j=0:a+bがL未満確定
    for(int i=0;i<N;i++){
        int X=L[i]-'0';
        if(i==0){
            //X==1
            dp[i][0]=1;//0,0
            dp[i][1]=2;//1,0
        }else{
            if(X==1){
                dp[i][0]=modadd(modmul(dp[i-1][0],3),dp[i-1][1]);
                dp[i][1]=modmul(dp[i-1][1],2);
            }else{
                dp[i][0]=modmul(dp[i-1][0],3);
                dp[i][1]=dp[i-1][1];
            }
        }
    }
    cout<<modadd(dp[N-1][0],dp[N-1][1])<<endl;
    
    return 0;
}


Measured memory_bytes: 5840
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int main() {
    int N,D,X; cin >> N >> D >>X;
    map<int,int> C;
    REP(i,N) {
        int n = 0;
        int a; cin >> a;
        while(1) {
            if(n*a+1 > D) break;
            if(C.count(n*a+1)) C[n*a+1]++;
            else C[n*a+1] = 1;
            n++;
        }
    }
    int sum = 0;
    for(auto res:C) {
        sum += res.second;
    }
    sum += X;
    cout << sum << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(3 * N);
    for(int i=0; i<3*N; ++i) cin >> a[i];

    priority_queue<int, vector<int>, greater<int>> que;
    long long sum = 0;
    vector<long long> left(N + 1);

    for(int i=0; i<2*N; ++i) {
        que.push(a[i]);
        sum += a[i];
        if(i >= N) {
            sum -= que.top();
            que.pop();
        }
        if(i >= N - 1) left[i - (N - 1)] = sum;
    }

    priority_queue<int> Q;
    sum = 0;
    vector<long long> right(N + 1);

    for(int i=3*N-1; i>=N; --i) {
        Q.push(a[i]);
        sum += a[i];
        if(i < 2*N) {
            sum -= Q.top();
            Q.pop();
        }
        if(i <= 2*N) right[i - N] = sum;
    }

    long long res = -1001001001001001001;
    for(int i=0; i<=N; ++i) res = max(res, left[i] - right[i]);
    cout << res << endl;
}

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

#define M_PI 3.14159265358979323

int main()
{
	int a, b, x;
	scanf("%d %d %d", &a, &b, &x);

	if (1.0 * x / a / a / b > 0.5) {
		printf("%lf", atan2((a * a * b - x) * 2.0 / a / a, a) / M_PI * 180.0);
	}
	else {
		printf("%lf", atan2(b, 2.0 * x / b / a) / M_PI * 180.0);
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <cmath>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
# define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))

string makestring(int x)
{
    stringstream ss;
    ss << x;
    return ss.str();
}

int main()
{


    int n, m;
    cin >> n >> m;
    vector<int> r;
    int t1, t2;
    vector<int> v;
    r.push_back(1);
    v.push_back(1);
    for(int i = 1; i < n; i++){
        r.push_back(0);
        v.push_back(1);
    }
    for(int i = 0; i < m; i++){
        cin >> t1 >> t2;
        t1--;
        t2--;
        v[t1]--;
        v[t2]++;
        if(r[t1]==1){
            if(v[t1]==0){
                r[t1]=0;
            }
            r[t2]=1;
        }
        /*for(int j = 0; j < n; j++){
            cout << r[j] << " ";
        }
        cout << endl;*/
    }
    int c=0;
    for(int i = 0; i < n; i++){
        c += r[i];
    }
    cout << c;




    return 0;
}













Measured memory_bytes: 1276
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
D = 1000000007
dp = [1]*(N+1)
for i in a:
    dp[i] = 0
for i in range(2, len(dp)):
    if dp[i]==0:
        continue
    dp[i] = dp[i-1] + dp[i-2]
print(dp[-1]%D)

Measured memory_bytes: 460020
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vint pe(n);
  REP(i,1,n+1){
    pe[i-1]=i;
  }
  sort(all(pe));
  int a,b;
  vint p(n),q(n);
  rep(i,n){
    cin>>p[i];
  }
  rep(i,n){
    cin>>q[i];
  }
  int count=1;
  bool flag=false,flag2=false;
  do{
    if(p==pe && !flag){
      flag=true;
      a=count;
    }
    if(q==pe && !flag2){
      flag2=true;
      b=count;
    }
    count++;
  }while(next_permutation(all(pe)));
  cout<<abs(a-b)<<'\n';
  return(0);
}


Measured memory_bytes: 256