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

#define MAX 1000

int main()
{
	char s[MAX];
	int k;
	int a;
	int i;
	
	scanf("%d", &k);
	scanf("%s", s);

	a = strlen(s);

	if (a <= k)
		printf("%s\n", s);
	else {
		for (i = 0; i < k; i++)
			printf("%c", s[i]);
		printf("...\n");
	}

	return 0;
}

Measured memory_bytes: 1644
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

signed main()
{
    int n,k,gcd=0;  cin>>n>>k;
    int a[n+1]; a[0]=k;
    for (int i=1;i<=n;i++) cin >> a[i] ; 
    sort(a,a+n+1);
    for (int i=0;i<n;i++)
        gcd=__gcd(gcd,a[i+1]-a[i]);
    cout << gcd << endl;
    return 0;
}


Measured memory_bytes: 4340
import java.util.*;


public class Main{ 
	static int height[]=new int[100001];
   public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	 int n=s.nextInt();
	 int m=s.nextInt();
	 ArrayList<ArrayList<Integer>> arr=new ArrayList<>(n+1);
	 for(int i=0;i<=n;i++) {
		 ArrayList<Integer> temp=new ArrayList<>();
		 arr.add(temp);
	 }
	 
	 for(int i=0;i<m;i++) {
		 int x=s.nextInt();
		 int y=s.nextInt();
		 arr.get(x).add(y);
	 }
	 boolean visited[]=new boolean[n+1];
	
	 for(int i=1;i<=n;i++) {
		 if(!visited[i])
	   dfs(arr,i,0,visited);
	 }
	 int ans=0;
	 for(int i=0;i<=n;i++) {
		 if(ans<height[i]) {
			 ans=height[i];
		 }
	 }
	 System.out.print(ans-1);
	 
   }
   public static void dfs(ArrayList<ArrayList<Integer>> arr,int start,int parent,boolean visited[]) {
	   visited[start]=true;
	  
	   
	   ArrayList<Integer> temp=arr.get(start);
	   for(int i=0;i<temp.size();i++) {
		   if(!visited[temp.get(i)]) {
			   dfs(arr,temp.get(i),start,visited);
		   }
	   }
	 
	   for(int i=0;i<temp.size();i++) {
		   height[start]=Math.max(height[start], height[temp.get(i)]);
	   }
	   height[start]=1+height[start];
	   
	   
   }
}

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

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;

#define min_3(a, b, c) min(a, min(b, c))
typedef long long ll;
const int mod = 1e9 + 7;

int main()
{
    const int MAX = 100;
    int n; cin >> n;
    vector<int> x(n), y(n), h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i] >> h[i];
    }
    
    for (int posY = 0; posY <= MAX; posY++)
    {
        for(int posX = 0; posX <= MAX; posX++){
            //頂点が確定してないとき-1
            //ダメだったら-2
            int H = -1;

            for (int i = 0; i < n; i++)
            {
                if(h[i] > 0){
                    int tmp = h[i] + abs(posY - y[i]) + abs(posX - x[i]);
                    if(H == -1) H = tmp; //まだ確定してないとき
                    else{
                        if(H != tmp){ //さっきのと違うのがでたら
                            H = -2;
                            break;
                        }
                    }
                }
            }

            if(H == -2) continue; //別の場所を探す
            
            for (int i = 0; i < n; i++)
            {
                if(h[i] == 0){
                    int dist = abs(posY - y[i]) + abs(posX - x[i]);
                    if(H > dist){ //h[i]が0にならないので
                        H = -2;
                        break;
                    }
                }
            }
            if(H == -2) continue;

            cout << posX << " " << posY << " " << H << endl;
            return 0;
        }
    }
    
}


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

int main(){
	ll n;
	cin >> n;
	std::vector<ll> v(n+1,0),dp(n+1,0);
	for(int i=1;i<=n;i++){
		cin >> v[i];
	}
	dp[1]=0;
	dp[2]=abs(v[1]-v[2]);
	for(int i=3;i<=n;i++){
		dp[i]= min(abs(v[i-2]-v[i])+ dp[i-2],abs(v[i-1]-v[i])+ dp[i-1]);
	}
	cout << dp[n] <<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)
#define N_MAX (200000+10)
using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

vector<int> X;
vector<int> A;
int N;

int main(void) {
    cin>>N;

    for(int i = 0;i < N;i++) {
        int a;
        cin>>a;
        A.push_back(a);
        X.push_back(a);
    }

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

    for(int i = 0;i < N;i++) {
        if(A[i] == X[N-1]) {
            cout<<X[N-2]<<endl;
        } else {
            cout<<X[N-1]<<endl;
        }
    }

    return 0;
}




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

class UnionFind{
    public:
        vector<int> par;
        vector<int> rank;

        UnionFind(int n){
            for(int i = 0; i < n; i++){
                par.push_back(i);
                rank.push_back(0);
            }
        }

        int find(int x){
            if(x == par[x])
                return x;
            else
                return par[x] = find(par[x]);
        }

        void unite(int x, int y){
            x = find(x);
            y = find(y);
            if(x == y) return;

            if(rank[x] < rank[y])
                par[x] = y;
            else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        bool same(int x, int y){
            return find(x) == find(y);
        }
};


struct edge { ll u, v, cost; };

bool comp(const edge &e1, const edge &e2){
    return e1.cost < e2.cost;
}

vector<edge> es;
int E;
int V;

//最小全域木  O(|E|*log|V|)
ll kruskal(){
    sort(es.begin(), es.end(), comp);
    UnionFind uf = UnionFind(V);
    ll res = 0;
    for(int i = 0; i < E; i++){
        edge e = es[i];
        if(!uf.same(e.u, e.v)){
            uf.unite(e.u, e.v);
            res += e.cost;
        }
    }   
    return res;
}

pair<ll, int> X[100100];
pair<ll, int> Y[100100];
int main(){
    cin >> V;
    REP(i,V){
        ll x, y;
        cin >> x >> y;
        x--, y--;
        X[i] = make_pair(x, i);
        Y[i] = make_pair(y, i);
    }
    sort(X, X+V);
    sort(Y, Y+V);

    for(int i = 1; i < V; i++){
        pair<ll, int> p0 = X[i-1];
        pair<ll, int> p1 = X[i];
        int idx0 = p0.second;
        int idx1 = p1.second;
        ll loc0 = p0.first;
        ll loc1 = p1.first;
        es.push_back((edge){idx0,idx1,loc1-loc0});
        E++;
    }
    for(int i = 1; i < V; i++){
        pair<ll, int> p0 = Y[i-1];
        pair<ll, int> p1 = Y[i];
        int idx0 = p0.second;
        int idx1 = p1.second;
        ll loc0 = p0.first;
        ll loc1 = p1.first;
        es.push_back((edge){idx0,idx1,loc1-loc0});
        E++;
    }

    ll ans = kruskal();

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11632
from collections import deque

N = int(input())
t = deque([0] * N)
x = deque([0] * N)
y = deque([0] * N)

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

N += 1
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)

for i in range(N-1):
    t_sub = t[i+1] - t[i]
    x_sub = abs(x[i+1] - x[i])
    y_sub = abs(y[i+1] - y[i])
    dist = x_sub + y_sub
    if dist > t_sub or t_sub % 2 != dist % 2:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 88016
#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
char s[N];
int a[N], len, sum, ans;

int main() {
	scanf("%s", s + 1), len = strlen(s + 1);
	for(int i = 1; i <= len; i++) a[i] = (s[len - i + 1] - '0') * 9;
	for(int i = 1; i <= len; i++) {
		a[i + 1] += a[i] / 10, a[i] %= 10, sum += a[i];
		if(i == len && a[len + 1]) ++len;
	}
	for(;;) {
		if(sum % 9 == 0 && sum <= ans * 9) { printf("%d\n", ans); return 0; }
		++ans;
		sum -= a[1], a[1] += 9;
		for(int i = 1; i <= len; i++) {
			if(a[i] < 10) { sum += a[i]; break; }
			sum -= a[i + 1], a[i + 1] += a[i] / 10, a[i] %= 10, sum += a[i];
			if(i == len && a[len + 1]) ++len;
		}
	}
	return 0;
}

Measured memory_bytes: 4608
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for((i)=0;(i)<(int)(a);(i)++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

ll bxp(ll x,ll n)
	{
    	ll res = 1;
        	while(n>0){
           	  if(n%2==1){
              	   res = (res*x);
            	}
                   x= (x*x);
                n/=2;
             }
         return res ;
        }
int main(){
        _ios;
        ll h;
        cin>>h;
        ll x = (log(h)) / (log(2));

        ll res = bxp(2,x+1) - 1;
        cout<<res<<endl;





return 0;
}







Measured memory_bytes: 640
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int i,n,x;
    cin >> n;
    
    for(i=1;i<=n;i++){
       if(i%3==0){
          cout << " " << i;
       }
       else{
           x = i;
           while(x!=0){
               if(x % 10 ==3){
                   cout << " " << i;
                   break;
               }
               x /= 10;
           }
       }
    }

    cout << endl; 
    return 0;
}


Measured memory_bytes: 3108
# coding: utf-8

N = int(input())
A = list(map(int, input().split()))

val_cnt = [0] * N

for i in range(N):
    val_cnt[A[i]-1] += 1


def comb2(n):
    return n * (n-1) // 2


base_sum = 0
for i in range(N):
    base_sum += comb2(val_cnt[i])

# print(base_sum)
# print(val_cnt)
# print()

for i in range(N):
    print(base_sum + comb2(val_cnt[A[i]-1]-1) - comb2(val_cnt[A[i]-1]))


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

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

  double sum;
  
  rep(i,n){
      cin>>m;
      sum+=1/m; 

  }
  
  cout<<setprecision(10)<<1/sum<<endl;
}

Measured memory_bytes: 3788
#　解説確認後AC
#　問題解説参考サイト 「けんちょんの競プロ精進記録」 より
#  URL: https://drken1215.hatenablog.com/entry/2019/09/16/032000
#　優先度付きキュー 参考記事　「【Python】優先度付きキューの使い方【heapq】」
#　URL: https://qiita.com/ell/items/fe52a9eb9499b7060ed6

import heapq

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x: x*(-1), a)) # リストの要素を全てマイナス(最大値を取り出すため)
heapq.heapify(a) # 優先度付きキューへ
for _ in range(M):
    heapq.heappush(a,((heapq.heappop(a)*(-1))//2)*(-1)) # リストの最大値を取り出して割る2して挿入
print(abs(sum(a))) # abs()してマイナスを取り除く


Measured memory_bytes: 20232
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
import numpy as np
N,S = map(int,input().split())
MOD = 998244353
A = list(map(int,input().split()))
dp = np.zeros(S+1,dtype = np.int64)
dp[0] = 2
if A[0] <= S:
    dp[A[0]] = 1
for i in range(1,N):
    a = A[i]
    p = dp*2
    if a <= S:
        p[a:] += dp[:-a]
    p %= MOD
    dp = p
print(dp[S])

    





Measured memory_bytes: 27428
#include<stdio.h>
int main(void)
{
	int a,b,i,j,S,x[101],X,s[101];
	scanf("%d%d",&a,&b);
	for(i=0;i<a;i++){
		s[i]=0;
	}
	for(i=0;i<b;i++){
		scanf("%d",&x[i]);
	}
	for(i=0;i<b;i++){
		S=0;
		for(j=0;j<a;j++){
			scanf("%d",&X);	
			if(X==x[i]){
				s[j]++;
			}
			else{
				S++;
			}
		}
		s[x[i]-1]+=S;
	}
	for(i=0;i<a;i++){
		printf("%d\n",s[i]);
	}
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

    String msg = "No";
    if(N.charAt(0) == '9' || N.charAt(1) == '9')msg = "Yes";


    System.out.println(msg);

  }
}


Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int A = int.Parse (str[0]);
            int B = int.Parse (str[1]);
            int C = int.Parse (str[2]);

            str = Console.ReadLine ().Split (' ');
            int K = int.Parse (str[0]);

            for (int i = 0; i < K + 1; i++)
            {
                for (int j = i + 1; j < K + 2; j++)
                {
                    for (int k = j + 1; k < K + 3; k++)
                    {
                        if (Math.Pow (2, j - i - 1) * A < Math.Pow (2, k - j - 1) * B && Math.Pow (2, k - j - 1) * B < Math.Pow (2, K + 2 - k) * C)
                        {
                            Console.Write ("Yes");
                            return;
                        }
                    }
                }
            }
            Console.Write ("No");
        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

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

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

  int aa;
  long long a[n+1];
  for (int i = 0; i < n; i++) {
    scanf("%d", &aa);
    a[i] = aa;
  }

  for (int prev = 0, cur = k; cur < n; prev++, cur++) {
    if (a[cur] > a[prev]) printf("Yes\n");
    else printf("No\n");
  }

  return 0;
}



Measured memory_bytes: 5240
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)

#A
def A():
    n = I()
    b = LI()
    d = defaultdict(int)
    for i in b:
        d[i] += 1
    a = []
    ans = []
    return
#B
def B():
    n = I()
    if n%2:
        ans = []
        for i in range(1,n+1):
            for j in range(1,n+1):
                if j != n-i and j != i:
                    ans.append((min(i,j),max(i,j)))
        ans = list(set(ans))
        print(len(ans))
        ans.sort()
        for i in ans:
            print(*i)
    else:
        ans = []
        for i in range(1,n+1):
            for j in range(1,n+1):
                if j != n+1-i and j != i:
                    ans.append((min(i,j),max(i,j)))
        ans = list(set(ans))
        print(len(ans))
        ans.sort()
        for i in ans:
            print(*i)
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 46192
from math import sin,cos,sqrt,radians
#a,b,C=int(input().split())
a,b,C=map(int,input().split())
print("{:.5f}".format(a*b*sin(radians(C))/2))
c2=a**2+b**2-a*b*2*cos(radians(C))
print("{:.5f}".format(a+b+sqrt(c2)))
print("{:.5f}".format(b*sin(radians(C))))


Measured memory_bytes: 5712
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
// const ll mod=998244353;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  if(n<r)return 0;
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // int codeforces;cin>>codeforces;while(codeforces--){
  ll i,j,N,res,ans=1;
  cin>>N;
  string s;
  cin>>s;
  vec v(26,1);
  rep(i,N)v[s[i]-'a']++;
  rep(i,26)(ans*=v[i])%=mod;
  (ans+=mod-1)%=mod;
  print(ans);
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
class Main {
    public void kami() {
                Scanner sc = new Scanner(System.in);
		int d,r;
		double f;
		double a = sc.nextInt();
		double b = sc.nextInt();
		
		d = (int)(a / b);
		r = (int)(a % b);
		f = a / b;
		
		
		System.out.printf("%d %1d %.5f ",d , r , f);

    }
	public static void main(String[] args ) {
    new Main().kami();
	}

}

Measured memory_bytes: 17388
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>
#include <utility>

#define repd(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

template <typename T>
void output(T,int);
int gcd(int a,int b);

int main(){
	//source
	int n;
	cin >> n;
	int a[n];
	rep(i,n){
		cin >> a[i];
	}
	int l[n];
	int r[n];

	l[0]=a[0];
	r[n-1]=a[n-1];
	repd(i,1,n){
		l[i]=gcd(l[i-1],a[i]);
		r[n-1-i]=gcd(r[n-i],a[n-1-i]);
	}
	int ans=r[1];
	repd(i,1,n-1){
		ans=max(ans,gcd(l[i-1],r[i+1]));
	}
	ans=max(ans,l[n-2]);
	cout << ans << endl;
	return 0;
}

template<typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int gcd(int a,int b){
	if(b==0){
		return a;
	}
	if(a>b){
		return gcd(b,a%b);
	}else{
		return gcd(a,b%a);
	}
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_HW = 105;
char a[MAX_HW][MAX_HW];
bool wi[MAX_HW],wj[MAX_HW];

int main()
{
	int H,W;
	bool check = true;
	cin >> H >> W;
	rep(i,H)
	{
		check = true;
		rep(j,W)
		{
			cin >> a[i][j];
			if (a[i][j] == '#') check = false;
		}
		wi[i] = check;
	}

	rep(j,W)
	{
		check = true;
		rep(i,H)
		{
			if (a[i][j] == '#') check = false;
		}
		wj[j] = check;
	}

	rep(i,H)
	{
		bool output = false;
		rep(j,W)
		{
			if (!wi[i] && !wj[j])
			{
				cout << a[i][j];
				output = true;
			}
		}
		if (output) cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

ll comb(int n, int r) {
    if(n == 0) return 0;
  vector<vector<long long>> v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v[n][r];
}

int main(){
    string s;
    int k;
    cin >> s;
    cin >> k;
    int n = sz(s);
    ll ans = 0;

    if(k==3){
        if(n <= 3){
        int nn = atoi(s.c_str());
        if(nn < 111){
            puts("0");
            return 0;
        }
        }
    }
    if(k==2){
        if(n <= 2){
        int nn = atoi(s.c_str());
        if(nn < 11){
            puts("0");
            return 0;
        }
        }
    }

    rep(i,0,n-2){
        if(s[i] == '0')continue;
        if(k==0)break;
        int zan = n - (i+1);
        // cout << comb(zan,k)*pow(9,k) + comb(zan,k-1)*(int)(s[i]-'1')*pow(9,k-1) << endl;
        ans += comb(zan,k)*pow(9,k) + comb(zan,k-1)*(int)(s[i]-'1')*pow(9,k-1);
        k--;
    }
    if(k==0){
        ans++;
    }else{
        if(k==1){
            if(s[n-1] == '0') ans += 0;
            else ans += (int)(s[n-1] - '0');
        }else{

        }
    } 

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int h, w, k;
bool is_valid(vector<string> &grid) {
	int black = 0;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (grid[i][j] == '#') {
				++black;
			}
		}
	}

	if (black == k) {
		return true;
	}

	return false;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin >> h >> w >> k;

	vector<string> grid(h);
	for (int i = 0; i < h; ++i) {
		cin >> grid[i];
	}

	int choices = 0;
	for (int i = 0; i < (1 << h); ++i) {
		for (int j = 0; j < (1 << w); ++j) {
			vector<string> copy = grid;
			for (int l = 0; l < h; ++l) {
				if (i & (1 << l)) {
					for (int m = 0; m < w; ++m) {
						copy[l][m] = 'r';
					}
				}
			}

			for (int l = 0; l < w; ++l) {
				if (j & (1 << l)) {
					for (int m = 0; m < h; ++m) {
						copy[m][l] = 'r';
					}
				}
			}

			if (is_valid(copy)) {
				++choices;
			}
		}
	}

	cout << choices << "\n";

	return 0;

}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>

int main() {
	int a, b, c;
	std::cin >> a >> b;
	c = b;
	while (true) {
		int flag = 0;
		for (int i = 0;i <=b/10000;i++) {
			c = b;
			c -= 10000 * i;
			if (i == a&&c == 0) {
				std::cout << i << ' ' << 0 << ' ' << 0 << std::endl;
				flag += 1;
				break;
			}
			if (c > 5000 * (a - i)) {
				continue;
			}
			for (int j = 0;j <= b/5000;j++) {
				int c = b;
				c -= 10000 * i + 5000 * j;
				if (i + j == a&&c == 0) {
					std::cout << i << ' ' << j << ' ' << 0 << std::endl;
					flag += 1;
					break;
				}
				for (int k = 0;k<=b/1000;k++) {
					int c = b;
					c -= 10000 * i + 5000 * j + 1000 * k;
					if (i + j + k == a&&c == 0) {
						std::cout << i << ' ' << j << ' ' << k << std::endl;
						flag += 1;
						break;
					}
				}
				if (flag == 1) {
					break;
				}
			}
			if (flag == 1) {
				break;
			}
		}
		if (flag == 0)
			std::cout << -1 << ' ' << -1 << ' ' << -1 << std::endl;
		break;
	}
	return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;



int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n),sum(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    for(ll i=0;i<n;i++){
        if(i==0)sum[i]=a[i];
        else sum[i]=sum[i-1]+a[i];
    }
    sort(sum.begin(),sum.end());
    ll ans=0;
    for(ll i=0;i<n;){
        ll j=i;
        ll x=sum[j];
        while(true){
            if(i==n)break;
            if(sum[j]==sum[i])i++;
            else break;
        }
        ll num=i-j;
        if(x==0){
            ans+=num+num*(num-1)/2;
        }
        else ans+=num*(num-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,m,k,x,t,maxx=0;
	cin>>n>>m>>k;
	int a[n+1],b[m+1];
	a[0]=0,b[0]=0;
	
	for(int i=1;i<=n;i++){
		cin>>x;
		a[i]=a[i-1]+x;
	}
	
	for(int i=1;i<=m;i++){
		cin>>x;
		b[i]=b[i-1]+x;
	}
	
	int L=0,R=n+m,lastf,lastr;
	
	while(L<=R){
		lastf=L,lastr=R;
		bool f=false;
		int Mid=(L+R)/2;
		for(int i=0;i<=min(n,Mid);i++)
			if(Mid-i<=m){
				t=a[i]+b[Mid-i];
				if(t<=k){
					maxx=max(maxx,Mid);
					f=true;
					break;
				}
			}
		
		if(f) 
            L=Mid;
		else 
            R=Mid;
        
		if(lastf==L && lastr==R){
			f=false;
			for(int i=0;i<=min(n,R);i++)
				if(R-i<=m){
					t=a[i]+b[R-i];
					if(t<=k){
						cout<<max(maxx,R)<<endl;
						return 0;
					}
				}
			L=R+1;
		}
	}
	
	cout<<maxx<<endl;
	return 0;
}

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

int main() {
	int n;
	double s[10001], m, a;

	while(1) {
		m = 0;
		a = 0;
		scanf("%d", &n);
		if (n == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			scanf("%lf", &s[i]);
			m += s[i];
		}
		m = m / n;

		for (int i = 0; i < n; i++) {
			a = a + (s[i] - m) * (s[i] - m);
		}
		a = a / n;
		printf("%.8lf\n", sqrt(a));

	}

	return 0;
}


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

int main()
{
	int h1, h2, h3;
	cin >> h1;
	cin >> h2;
	cin >> h3;
	if (h1 >= h2)
	{

		int t = h1;
		h1 = h2;
		h2 = t;
	}
	for (int i = h1; i <= h2; i++)
	{
		if (i == h3)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> num(n);
	int f=0;
	for(int i=0;i<n;i++){
		cin >> num.at(i);
		if(num.at(i)%2==0){
			if(num.at(i)%3!=0&&num.at(i)%5!=0){
				f=1;
			}
		}
	}
	if(f==0){
		cout << "APPROVED" << endl;
	}else{
		cout << "DENIED" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int N,K,X,Y;cin>>N>>K>>X>>Y;
    if(N<=K){
        cout<<X*N<<endl;
    }else{
        cout<<X*K+Y*(N-K)<<endl;
    }
}

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

int main() {
  
  int N,A;cin>>N>>A;
  
  int ans;
  
  ans=N%500;
  
  if(ans<=A){
    cout<<"Yes"<<endl;
  }  
  
  else if(N<=A){
    cout<<"Yes"<<endl;
  }  
  
  else{
    cout<<"No"<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ld long double
        #define int long long
        #define print(t) cout << "Case #" << t << ": ";
        int32_t main()
        {
            tani_nachi_ke  
            
            
            int n,m,k;
            cin >> n >> m >> k;
            string s[n];
            for(int i = 0; i < n; i++)
                cin >> s[i];

            int row[n+10] = {0};
            int col[m+10] = {0};
            int total = 0;
            for(int i = 0; i < n; i++)
            {
                int count = 0;
                for(int j = 0; j < m; j++)
                {
                    if(s[i][j] == '#')
                    {
                        total++;
                        count++;
                    }
                }   
                row[i] = count;
            }
          
            for(int i = 0; i < m; i++)
            {
                int count = 0;
                for(int j = 0; j < n; j++)
                {
                    if(s[j][i] == '#')
                        count++;
                }   
                col[i] = count;
            }

            int ans = 0;
            for(int i = 0; i < (1<<n); i++)
            {
                for(int j = 0; j < (1<<m); j++)
                {
                    int cur = 0;

                    for(int l = 0; l < n; l++)
                    {
                        if(i&(1<<l))
                        {
                            cur += row[l];
                        }
                    }
                    for(int l = 0; l < m; l++)
                    {
                        if(j&(1<<l))
                            cur += col[l];
                    }

                    for(int l = 0; l < n; l++)
                    {
                        for(int r = 0; r < m; r++)
                        {
                            if(i&(1<<l))
                            {
                                if(j&(1<<r))
                                {
                                    if(s[l][r] == '#')
                                        cur--;
                                }
                            }
                        }
                    }
                    if(cur + k == total)
                        ans++;
                }
            }
            cout << ans << '\n';






           return 0;
        }
          

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

const int N = 200005, mod = 1e9+7;
int n, a[N], dt[N], s[N];

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        if(a[i] == a[i-1]) {
            i--;
            n--;
        }
    }
    dt[n+1] = 1;
    s[a[n]] = 1;
    for(int i=n;i>=1;i--) {
        dt[i] = s[a[i]];
        s[a[i-1]] = (s[a[i-1]] + dt[i]) % mod;
    }
    printf("%d\n", dt[1]);
}


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

int main() {
    int data;
    cin >> data;
    int s1,s2,s3;
    s1 = data/100;
    s2 = (data-s1*100)/10;
    s3 = data-s1*100-s2*10;
    int count;
    count = s1+s2+s3;
    cout << count << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

// header area

int main(){
    int N; cin >> N;
    int count_ac=0;
    int count_wa=0;
    int count_tle=0;
    int count_re=0;

    rep(i, N){
        string tmp;
        cin >> tmp;
        if(tmp == "AC") count_ac++;
        if(tmp == "WA") count_wa++;
        if(tmp == "TLE") count_tle++;
        if(tmp == "RE") count_re++;
    }

    cout << "AC x " << count_ac << endl;
    cout << "WA x " << count_wa << endl;
    cout << "TLE x " << count_tle << endl;
    cout << "RE x " << count_re << endl;

    return 0;
}

Measured memory_bytes: 3632
N ,W = map(int,input().split())
w = [0] * N
v = [0] * N
dp = [[0] * (W + 1) for i in range(N + 1)]
for i in range(N):
    w[i],v[i] = map(int,input().split())

for j in range(W + 1):
    for i in range(N):
        if j - w[i] >= 0:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i])
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])
print(dp[N][W])
    

Measured memory_bytes: 146968
#include<iostream>
using namespace std;
int main(){
int a,b,emp;
for(int i=1;;i++){
cin>>a>>b;
if(a==0&&b==0)break;
if(a>b){
emp=a;
a=b;
b=emp;
cout<<a<<" "<<b<<endl;}
else cout<<a<<" "<<b<<endl;
}
return 0;
}

Measured memory_bytes: 3040
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<cstring>
using namespace std;
int n,a[100005],res;
int read(){
    int ans=0,f=1;
    char ch=getchar();
    while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){ans=ans*10+ch-'0';ch=getchar();}
    return ans*f;
}
int main(){
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) 
		if (a[i]==i) {swap(a[i],a[i+1]);res++;}
	cout<<res;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int INF_INT = 1e9;

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 TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int x;
    cin >> x;
    cout << abs(x - 1) << endl;
    return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),h = n / 3600,m = n % 3600 / 60,s = n % 60;
        System.out.printf("%d:%d:%d\n",h,m,s);
        sc.close();
    }

}

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

int main(void){
  int i=0,n,c=0;cin>>n;
  vector<ll> maxa(0);
  vector<ll> a(n);
  rep(i,n){
    cin>>a[i];
  }
  while(i<n){
    if(a[i]>=a[i+1]&&i!=n-1){
      c++;
    }
    else{
      maxa.push_back(c);
      c=0;
    }
   i++; 
  }
  sort(maxa.begin(), maxa.end());
  reverse(maxa.begin(), maxa.end());
  cout<<maxa[0]<<endl;
}

Measured memory_bytes: 2168
import java.util.Scanner;

public class Main {
	//087A - Buying Sweets

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

		int X = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		System.out.println( (X - A) % B );
	}
}

Measured memory_bytes: 22100
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <vector>
struct s1
{
    char name[100];
};
int main()
{

    int w,h;
    cin>>h>>w;
    s1 s[h];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>s[i].name[j];
        }
    }
    for(int i=0;i<h*2;i++)
    {
        for(int j=0;j<w;j++)
        {
            cout<<s[i/2].name[j];
        }
        cout<<endl;
    }
    return 0;
}


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

using namespace std;

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

  int n, p;
  string s;

  cin >> n >> p >> s;

  vector<int> f(p);
  f[0] = 1;

  long long ans = 0;

  if (p == 2 || p == 5) {
    for (int i = 0; i < s.size(); i++) {
      if ((s[i] - '0') % p == 0) {
        ans += i + 1;
      }
    }
    cout << ans << "\n";
    return 0;
  }

  reverse(s.begin(), s.end());
  
  int cur_r = 0;
  int cur_p_10 = 1;

  for (auto c: s) {
    cur_p_10 = cur_p_10 * 10 % p;
    cur_r = cur_r + cur_p_10 * (c - '0') % p;
    if (cur_r >= p) {
      cur_r -= p;
    }
    ans += f[cur_r];
    f[cur_r]++;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 720
//解説すごいなー

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	pair<int, int> XY[200000];
	int saidai = 0;
	int saishou = 1e9;
	int saidai2 = 0;
	int saishou2 = 1e9;
	rep(i, N) {
		int x = getint();
		int y = getint();
		if (x > y) swap(x, y);
		saidai = max(saidai, y);
		saidai2 = max(saidai2, x);
		saishou = min(saishou, x);
		saishou2 = min(saishou2, y);
		*(XY + i) = mp(x, y);
	}
	ll kotae = 1ll * (saidai - saishou2) * (saidai2 - saishou);

	sort(XY, XY + N);

	int saidai3 = saidai2;
	int saishou3 = 1e9;
	int mae = saishou;
	rep(i, N) {
		if ((*(XY + i)).first != mae) {
			kotae = min(kotae, 1ll * (saidai - saishou) * (saidai3 - min((*(XY + i)).first, saishou3)));
		}
		saidai3 = max(saidai3, (*(XY + i)).second);
		saishou3 = min(saishou3, (*(XY + i)).second);
		mae = (*(XY + i)).first;
	}
	kotae = min(kotae, 1ll * (saidai - saishou) * (saidai3 - saishou3));
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 1e16
#define MOD 1000000007
ll dx[]={1,0,-1,0};
ll dy[]={0,1,0,-1};
ll n0,m0;
double dp[3002][3002]={0.000000000};
ll mark[3002][3002]={0};
double fun(double v1[])
{
    //memset(dp, 0.0, sizeof(dp));
    dp[0][0]=1.000000000;
    for(int i=1;i<=n0;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0) dp[i][j]=dp[i-1][j]*(1-v1[i]);
            else dp[i][j]=dp[i-1][j]*(1-v1[i])+dp[i-1][j-1]*(v1[i]);
        }
    }
    double aa=0.0;
    for(int i=(n0+1)/2;i<=n0;i++)
    aa+=dp[n0][i];
    return aa;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d,e,f,n,m,k,t,q;
    t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        n0=n,m0=m;
        double v1[n+1];
        //memset(dp,0,sizeof(dp));
        for(int i=0;i<n;i++)
        {
            cin>>v1[i+1];
            //cout<<v1[i];
        }
        double aa=fun(v1);
        cout<< fixed << setprecision(10)<<aa;
        
    }
    return 0;
}


Measured memory_bytes: 71424
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[3010];
int dp[3010][3010][2];
int cum[3010];

int dfs(int l, int r, int x) {
	if (dp[l][r][x] != INF)return dp[l][r][x];
	if (l == r) {
		dp[l][r][x] = a[l];
		return a[l];
	}
	int ma = -INF;
	ma = max({ ma,a[l] - dfs(l + 1,r,1 - x),a[r] - dfs(l,r - 1,1 - x) });
	dp[l][r][x] = ma;
	return ma;
}

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cum[i] += a[i];
		if (i)cum[i] += cum[i - 1];
	}
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			dp[i][j][0] = INF;
			dp[i][j][1] = INF;
		}
	}
	cout << dfs(0, n - 1, 0) << endl;
}

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

int main() {
    int h,w;cin>>h>>w;
    int a[h][w];rep(i,h)rep(j,w)a[i][j]=0;
    rep(i,h){
        string s;cin>>s;
        rep(j,w)if(s[j]=='#'){
            a[i][j]=-100;
            rep(k,3)rep(l,3){
              if(i-1+k>=0 && i-1+k<h && j-1+l>=0 && j-1+l<w) ++a[i-1+k][j-1+l];
            }
        }
    }
    rep(i,h){
        rep(j,w){
        if(a[i][j]<0)cout<<'#';
        else cout<<a[i][j];
        }
        cout<<endl;
    }
	return 0;
}

Measured memory_bytes: 3612
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k, ans int
	fmt.Scan(&n, &k)
	l := make([]int, n)
	for i := range l {
		fmt.Scan(&l[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(l)))
	for i := 0; i < k; i++ {
		ans += l[i]
	}
	fmt.Println(ans)
}


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

int main()
{
    int s;
    cin >> s;
    int hour = s / (60 * 60);
    int minute = (s - (hour * 60 * 60)) / 60;
    int second = (s % (60 * 60)) % 60;
    cout << hour << ':' << minute << ':' << second << endl;
    return 0;
}



Measured memory_bytes: 3096
import numpy as np
from bisect import bisect_right

n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = list(map(int, input().split()))

ac = np.cumsum(a)
bc = np.cumsum(b)
ans = 0

# print(ac)
# print(bc)

for i in range(n+1):
    if k < ac[i]:
        break
    time = k - ac[i]
    j = bisect_right(bc, time)
    ans = max(ans, j + i)

print(ans)


Measured memory_bytes: 59588
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int K;
    string S;
    cin >> K >> S;
    if (S.size() <= K) cout << S << endl;
    else cout << S.substr(0, K) << "..." << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}


//#########################################



int main() {
int a=D(),b=D();
int x=b;
int cnt=1;
while(x>0){
    x/=10;
    cnt*=10;



}
    double n=(double)(a*cnt)+b;
double ans=sqrt(n);
long long ans1=sqrt(n);
 if(ans==ans1){

     cout<<"Yes";

 } else
     cout<<"No";


}


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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll r; cin >> r;
  cout << (r < 1200 ? "ABC" : r < 2800 ? "ARC" : "AGC") << endl;
  return 0;
}



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

int gcd(int x,int y){
  int r;
  if(x<y) swap(x,y);

  while(y>0){
    r = x%y;
    x = y;
    y = r;
  }
  return x;
}

int main(){
  int a,b;
  cin >> a >> b;
  cout << gcd(a,b) << endl;
  return 0;
}


Measured memory_bytes: 3132