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

using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;

ll N;

int main()
{
    fio;
    cin >> N;
    ll ans = 0;
    ll top = sqrt(N);
    vector<ll> dv;
    for (ll f = 2; f <= top; ++f) {
        ll a = N / f;
        if (a * f == N) {
            dv.push_back(a);
            if (a != f)
                dv.push_back(f);
        }
    }

    for (int d : dv) {
        ll cur = N;
        while (cur % d == 0) {
            cur/= d;
        }
        if (cur % d == 1) {
            ++ans;
        }
    }

    top = sqrt(N - 1);
    for (ll f = 1; f <= top; ++f) {
        ll a = (N - 1) / f;
        if (a * f == N - 1) {
            ++ans;
            if (a != f)
                ++ans;
        }
    }
    cout << ans << endl;
    cerr << "Time : " << (double) clock() / (double) CLOCKS_PER_SEC << "s\n";
    return 0;
}

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

typedef long long ll;

using Graph = vector<vector<int>>;

int main() {
    int N, M;
    int ans = 0;
    cin >> N >> M;
    vector<ll>H(N);
    Graph G(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    
    for (int i = 0; i < N; i++) {
        int Max = H[i];
        bool check = true;
        for (int v : G[i]) {
            if (H[v] >= Max) {
                check = false;
                break;
            }
        }
        if (check) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int a[101][101];

int r, c;

int main(){
	cin.tie(0);
	
	cin>>r>>c;
	rep(i, r)rep(j, c)cin>>a[i][j];
	rep(i, r) {
	    rep(j, c)a[i][c] += a[i][j];
	}
	rep(i, c+1) {
	    rep(j, r)a[r][i] += a[j][i];
	}
	
	rep(i, r+1) {
	    rep(j, c+1) {
	        cout<<a[i][j];
	        if(j<c)cout<<' ';
	    }
	    cout<<endl;
	}
	
	return 0;
}



Measured memory_bytes: 3124
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

const p = 998244353

func Solve() {
  var N, S int
  NextInt(&N, &S)
  var A []int
  NextIntVec(&A)
  DP := make([][]int, N + 1)
  for i := range DP {
    DP[i] = make([]int, S + 1)
  }
  ans := 0
  for i, a := range A {
    for j, dp := range DP[i] {
      DP[i + 1][j] = dp % p
    }
    DP[i + 1][0]++
    if S < a { continue }
    ans += DP[i + 1][S - a] * (N - i) % p
    ans %= p
    for j := S - a; 0 <= j; j-- {
      DP[i + 1][j + a] += DP[i + 1][j]
    }
  }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 75520
import java.util.*;
import java.util.stream.IntStream;

public class Main {
    static int[] q;
    static int [][] a;
    static Map<Integer, Tuple> aMap = new HashMap<>();

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int h = scan.nextInt();
        int w = scan.nextInt();
        int d = scan.nextInt();
        a = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                int num = scan.nextInt();
                a[i][j] = num;
                aMap.put(num,new Tuple(i, j));
            }
        }
        int maxNum = h *w;
        q = new int[maxNum + 1];
        for (int s = 1; s <= d; s++) {
            q[s] = 0;
            for (int i = 1; i * d + s <= maxNum; i++) {
                Tuple from = aMap.get(s+d*i);
                Tuple to = aMap.get(s+d*(i-1));
                q[s+d*i] = q[s+d*(i-1)] + Math.abs(from.x - to .x) + Math.abs(from.y - to.y);
            }
        }

        int Q = scan.nextInt();
        for (int i = 0; i < Q; i++) {
            int l =scan.nextInt();
            int r =scan.nextInt();
            System.out.println(q[r] - q[l]);
        }
    }

    static class Tuple{
        int x;
        int y;
        Tuple(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}



Measured memory_bytes: 110704
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}
int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}







int main() {
  int A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  A=100*A;
  B=100*B;
  long x,y;
  vector<long>xx,yy;
  for(int i=0;i<F/100;i++){
    for(int j=0;j<F/100;j++){
      
      x=A*i+B*j;
      if(x<=F){
      xx.push_back(x);}
      

    }

  }
  for(int i=0;i<F;i++){
    for(int j=0;j<F;j++){
     
      
      y=C*i+D*j;
      if(y<=F){
      yy.push_back(y);}
      

    }
  }
  int res=-1,ress;
  for(int i=1;i<xx.size();i++){
    for(int j=0;j<yy.size();j++){
      if(xx[i]+yy[j]>F){
        continue;
      }
      if(xx[i]*E<100*yy[j]){
        continue;
      }
      if(res<0||res*yy[j]>ress*(xx[i]+yy[j])){
        res=yy[j]+xx[i];
        ress=yy[j];
      }

    }
  }
  printf("%d %d\n", res, ress);




  




  
  
}

  

  




Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int ac = 0, wa = 0, tle = 0, re = 0;
  for (int i = 0; i < N; i ++) {
    string check = "";
    cin >> check;
    if (check == "AC") {
      ac++;
    }
    if (check == "WA") {
      wa++;
    }
    if (check == "TLE") {
      tle++;
    }
    if (check == "RE") {
      re++;
    }
  }
  
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

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

int digit(long num){
  int d=0;
  while(num>0){
    d++;
    num/=10;
  }
  return d;
}

int main(){
  long N;
  cin>>N;
  long A,B;
  
  int ans=10;
  int a_dig=0,b_dig=0;
  //for(long i=1; i<=N; i++){
  for(long i=1; i<=sqrt(N); i++){
    //A=i;
    //B=N/A;
    if(N==i*(N/i)){
      //cout<<A<<" "<<B<<endl;
      a_dig=digit(i);
      b_dig=digit(N/i);
      //cout<<a_dig<<" "<<b_dig<<endl;
      int max_d=max(a_dig,b_dig);
      if(ans>max_d){
        ans=max_d;
      }
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;

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

    int num[N+1]={}, people[N+1]={};

    for (int i = 2; i < N+1; ++i)
    {
        cin >> num[i];    
    }
    for (int i = 2; i < N+1; ++i)
    {
        people[num[i]]++;    
    }

    for (int i = 1; i < N+1; i++)
    {
        cout << people[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 5144
#!/usr/bin/env python3
import sys


def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    import heapq
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    h = []
    heapq.heappush(h, [-(A[0]+B[0]+C[0]), 0, 0, 0])
    ans = []
    used = set()
    used.add((0, 0, 0))
    for _ in range(K):
        e, i, j, k = heapq.heappop(h)
        ans.append(-e)
        if i+1 < X and not (i+1, j, k) in used:
            used.add((i+1, j, k))
            heapq.heappush(h, [-(A[i+1]+B[j]+C[k]), i+1, j, k])
        if j+1 < Y and not (i, j+1, k) in used:
            used.add((i, j+1, k))
            heapq.heappush(h, [-(A[i]+B[j+1]+C[k]), i, j+1, k])
        if k+1 < Z and not (i, j, k+1) in used:
            used.add((i, j, k+1))
            heapq.heappush(h, [-(A[i]+B[j]+C[k+1]), i, j, k+1])
    for elem in ans:
        print(elem)





#def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
#    AB = []
#    for a in A:
#        for b in B:
#            AB.append(a+b)
#    AB.sort(reverse=True)
#    C.sort(reverse=True)
#    AB = AB[:K]
#    C = C[:K]
#    ABC = []
#    for ab in AB:
#        for c in C:
#            ABC.append(ab+c)
#    ABC.sort(reverse=True)
#    for i in range(K):
#        print(ABC[i])
#    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(X)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(Y)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(Z)]  # type: "List[int]"
    solve(X, Y, Z, K, A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5276
n,k = map(int,input().split())

count = 0

for i in range(k,n+2):
    most = (2 * n - i + 3) * i // 2
    least = (i + 1) * i // 2
    cases = most - least + 1
    count += cases
    count %= (10**9+7)

print(str(int(count)))

Measured memory_bytes: 9196
fun main() {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    val r = s.count { it == 'R' }
    val g = s.count { it == 'G' }
    val b = s.count { it == 'B' }

    val exclude = (0..n-3).sumBy { l ->
        (1..n).count { w ->
            val c = l + w
            val r = c + w
            r < n && s[l] != s[c] && s[c] != s[r] && s[r] != s[l]
        }
    }

    println(1L * r * g * b - exclude)
}

Measured memory_bytes: 36504
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<map>

using namespace std;

#define x first
#define y second
#define NMAX 100005

int n, d[NMAX];
int v[NMAX];
vector<int> tree[NMAX];

inline int cmp(const int& a, const int& b){
    if(d[a] == d[b])
        return a < b;
    return d[a] > d[b];
}

inline void dfs(int node){
    int lim = tree[node].size();
    for(int i = 0; i < lim; i++)
        dfs(tree[node][i]);
    sort(tree[node].begin(), tree[node].end(), cmp);
    for(int i = 0; i < lim; i++)
        d[node] = max(d[node], d[tree[node][i]] + i + 1);
}

int main (){
    
    scanf("%d",&n);
    
    for(int i = 2; i <= n; i++){
        scanf("%d", &v[i]);
        tree[v[i]].push_back(i);
    }
    
    dfs(1);
    
    printf("%d\n", d[1]);
    
    return 0;
}

Measured memory_bytes: 11776
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] num = str.split(" ", 0);
		int a = Integer.parseInt(num[0]);
		int b = Integer.parseInt(num[1]);

		//a??¨b???????????????b???????????§??????
		if(a < b){
		 System.out.println("a < b");

		//a???????????§??????
		}else if(a > b){
		 System.out.println("a > b");

		//a??¨b????????????
		}else{
		 System.out.println("a == b");
		}
	}

}

Measured memory_bytes: 24240
N = int(input())
W = [int(i) for i in input().split()]

ans = float('inf')
for i in range(1, N):
    left = W[:i]
    right = W[i:]
    sum_left = sum(left)
    sum_right = sum(right)
    ans = min(ans, abs(sum_left - sum_right))
print(ans)

Measured memory_bytes: 3060
s = list(input())
n = len(s)
ans = [0] * n
rs = []
ls = []

for i, c in enumerate(s):
    if c == 'R':
        rs.append(i)
    else:
        ls.append(i)

p = 0
for i, l in enumerate(ls):
    ans[l] += (l - p) // 2
    ans[l - 1] += (l - p) // 2
    if (l - p) % 2 == 1:
        ans[l - 1] += 1
    if l + 1 < n:
        p = l + 1

p = n - 1
rs = rs[::-1]
for i, r in enumerate(rs):
    ans[r] += (p - r) // 2
    ans[r + 1] += (p - r) // 2
    if (p - r) % 2 == 1:
        ans[r + 1] += 1
    if r - 1 >= 0:
        p = r - 1

print(*ans) 


Measured memory_bytes: 11032
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		int m,in;
		vvi d(n,vi());
		string s;
		vector<string> str;
		map<string,int> mp;
		int t[31]={};
		rep(i,0,n){
			cin>>s>>m;
			str.push_back(s);
			rep(j,0,m){
				cin>>in;
				d[i].push_back(in);
				t[in]++;
			}
		}
		rep(i,0,n){
			int tmp=0;
			rep(j,0,d[i].size()){
				tmp+=n+1-t[d[i][j]];
			}
			mp[str[i]]=tmp;
		}
		string name="";
		int MIN=10000;
		for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++){
			if(MIN>it->second){
				name=it->first;
				MIN=it->second;
			}
		}
		cout<<MIN<<" "<<name<<endl;
	}
}

Measured memory_bytes: 1244
#include<stdio.h>
#define MAX 1000

int main(){
    int n,i,j,u,k;
    int Adj[MAX][MAX];
    int v;

    scanf("%d",&n);
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            Adj[i][j]=0;
        }
    }

    for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
        scanf("%d",&v);
     Adj[u][v]=1;
        }
    }

    for(i=1;i<=n;i++){
        for (j=1; j<=n; j++){
            if(j>1) printf(" ");
           printf("%d",Adj[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2112
n=int(input())
A=list(map(int,input().split()))
m=10001
B=A[:]
C=[0]*m
for a in A:C[a]+=1
for i in range(1,m):C[i]+=C[i-1]
for j in A[::-1]:B[C[j]-1]=j;C[j]-=1
print(*B)


Measured memory_bytes: 224508
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// leave to tomorrow anything that can be done today
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    // cin.tie(0);
    ll a,b;
    cin>>a>>b;
    ll ans=-1;
    rep(i,1,100000){
        if((i*8)/100==a && i/10==b){
            ans=i;
            break;
        }
    }
    cout<<ans<<'\n';
    return 0;   
}   

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

inline int read();

string a;

int main()
{
    cin>>a;
    for(int s=0;s<a.size()-8;s++)cout<<a[s];
    cout<<endl;
    return 0;
}

inline int read() {
    int x=0;
    char c=getchar();
    bool flag=0;
    while(c<'0' || c>'9') {if(c=='-') flag=1; c=getchar();}
    while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+c-'0'; c=getchar();}
    return flag?-x:x;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin >>a>>b>>c>>d;
  if( abs( a - c ) <= d || (abs(a - b) <= d && abs(b - c) <= d) ) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
bool check(vector<int> v, int M){
    if (M==1){
        for (int i=1;i<v.size();i++) if (v[i] <= v[i-1]) return false;
        return true;
    }
    set<pair<int, int> > kek;
    for (int i=1; i < v.size(); i++){
        if (v[i] > v[i-1]) continue;
        while (kek.size()){
            auto it = kek.end();
            it--;
            if ((*it).first > v[i]) kek.erase(it);
            else break;
        }
        int j = v[i];
        while (true){
            if (j==0) return false;
            if (!kek.size()){
                kek.insert({j, 1});
                break;
            }
            auto it = kek.end();
            it--;
            if ((*it).first != j){
                kek.insert({j, 1});
                break;
            }
            if ((*it).second != M-1){
                pair<int, int> p = *it;
                p.second++;
                kek.erase(it);
                kek.insert(p);
                break;
            }
            kek.erase(it);
            j--;
        }
    }
   // cout << 123 << endl;
    return true;
}
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    srand(time(0));
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i < n; i++) cin >> v[i];
    int L = 0, R = 1e6;
    while (R-L>1){
        int M = (L+R)/2;
        bool res = check(v, M);
        if (res)R=M;
        else L=M;
    }
    cout << R;
}


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

using namespace std;

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

    for (int i = 0; i <= x; ++i)
    {
        if (2 * i + 4 * (x - i) == y)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3620
// C - Guess The Number
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define NG puts("-1")
#define OK cout<<i<<endl

int main(){
	int N,M; cin>>N>>M;
	// cout<<N<<" "<<M<<"\n";//
	int S[M];
	char C[M];
	rep(i,M){ cin>>S[i]>>C[i]; --S[i]; }
	// rep(i,M){cout<<S[i]<<" "<<C[i]<<'\n';}///

	int ans = 1000;
	rep(i,1000){
		string A = to_string(i);
		if(A.size() != N) continue;
		bool ok = true;
		rep(j,M){
			// cout<<A[S[j]]<<" "<<C[j]<<"\n";//
			if(A[S[j]]!=C[j]){ ok = false; break; }
		}
		if(ok){ OK; return 0; }
	}
	NG;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
f=0

for i in range(N-1, 1, -1):
    if H[i]-H[i-1] ==-1:
        H[i-1]-=1
    elif H[i]-H[i-1]>=0:
        continue
    else:
        f+=1
if f==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 63856
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl

using namespace std;
typedef long long  ll;

const long long MOD = 1e9+7;

int main(){
    string s;
    cin >> s;

    for(int i=0; i<s.size()/2; i++){
        if(s[i] != s[s.size()-1-i]){
            p("No");
            return 0;
        }
    }

    string mae = s.substr(0, s.size()/2);
//    string usiro = s.substr(s.size()/2, s.size()/2);

    for(int i=0; i<mae.size()/2; i++){
        if(mae[i] != mae[mae.size()-1-i]){
            p("No");
            return 0;
        }
    }

    p("Yes");
}

Measured memory_bytes: 256
//-------------
//include
//-------------
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <random>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef long long LL;
typedef  vector<int> VI;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(x) REP(i,SZ(x))cerr<<i<<x<<"="<<x[i]<<endl;
const int MOD = 1000000007;
int main()
{
	VI a;
	int N=0;
	cin >> N;
	REP(I, N)
	{
		int temp;
		cin >> temp;
		a.PB(temp);
	}
	set <int> b(a.begin(), a.end());
	VI c(b.begin(), b.end());
	cout << c[c.size() - 1] - c[0] << endl;
#ifdef _DEBUG
	while(1);
#endif
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	constexpr int num = 26;
	int D;
	vector<int> c(num);
	vector<int> t;
	vector<int> last(num);
	vector<vector<int>> s; 
	
	cin>>D;
	
	s.resize(D, vector<int>(num));
	t.resize(D, 0);
	
	for(int i = 0; i < num; i++){
		cin>>c[i];
	}
	
	for(int i = 0; i < D; i++){
		for(int j = 0; j < num; j++){
			cin>>s[i][j];
			
			if(s[i][t[i]] + last[t[i]] * c[t[i]] < s[i][j] + last[j] * c[j]) {
				t[i] = j;
			}
		}
		
		for(int j = 0; j < num; j++){
			if(j == t[i]) {
				last[j] = 0;
			} else {
				last[j]++;
			}
		}
	}
	
	for(int i = 0; i < D; i++){
		cout<<t[i]+1<<endl;
	}
	
	
	return 0;
}

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

int main(){
  int N,K,total;
  cin >> N >> K;
  total=1;
  for(int i=0;i<N;i++){
    if(total*2<=total+K)total*=2;
    else total+=K;
  }
  cout << total << endl;
}

Measured memory_bytes: 3592
H, W = map(int, input().split())
A = [input() for _ in range(H)]
mod = 7 + 10**9
DP = [[0 for w in range(W)] for h in range(H)]
for w in range(W):
    if A[0][w] == "#":break
    else: DP[0][w] = 1
for h in range(H):
    if A[h][0] == "#": break
    else: DP[h][0] = 1

for h in range(1, H):
    for w in range(1, W):
        if A[h][w] == ".":
            DP[h][w] = (DP[h-1][w] + DP[h][w-1]) % mod

print(DP[H-1][W-1])

Measured memory_bytes: 44628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
using namespace std;

int main(){
    string a,b; cin >> a >> b;
    string ab = a + b;
    int x = stoi(ab);

    for ( int i = 1 ; i <= 1000 ; i++){
        if( i*i == x){ cout << "Yes" << endl;
        return 0;}
    }
    cout << "No" << endl;
}

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

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<long long int> d(n), v(n);
    for (int i = 0; i < n; ++i) {
      cin >> d[i] >> v[i];
      long long int gcd = __gcd(d[i], v[i]);
      d[i] /= gcd;
      v[i] /= gcd;
    }

    long long int lcm = d[0], gcd = v[0];
    for (int i = 1; i < n; ++i) {
      lcm = lcm / __gcd(lcm, d[i]) * d[i];
      gcd = __gcd(gcd, v[i]);
    }

    for (int i = 0; i < n; ++i)
      cout << lcm / d[i] * v[i] / gcd << endl;
  }
  return 0;
}

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


bool vector_finder(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


int main() {
    ll N, M, C;

    cin >> N >> M >> C;

    vector<ll> B(M);

    for (ll i = 0; i < M; i++) {
      cin >> B.at(i);
    }
    
    ll ans = 0;
    ll tmp;

    for (ll i = 0; i < N; i++) {
      ll ac = C;

      for (ll j = 0; j < M; j++) {
        cin >> tmp;
        ac = ac + tmp * B.at(j);
      }

      if (ac > 0) ans++;
      
    }
    
    
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
A,B,C,X,Y = map(int,input().split())
Ans = 0
Z = min(X,Y)
if A+B < C*2:
    Ans = A*X+B*Y
else:
    Ans = min(C*2*Z + A*(X-Z) + B*(Y-Z), C*2*max(X,Y))

print(Ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(void){
    char x=0;
    char y=0;
    int X=0;
    int Y=0;

    cin >> x >> y;

    if(x=='A')X=10;
    else if(x=='B')X=11;
    else if(x=='C')X=12;
    else if(x=='D')X=13;
    else if(x=='E')X=14;
    else if(x=='F')X=15;

    if(y=='A')Y=10;
    else if(y=='B')Y=11;
    else if(y=='C')Y=12;
    else if(y=='D')Y=13;
    else if(y=='E')Y=14;
    else if(y=='F')Y=15;

    if(X>Y)cout << ">" << endl;
    else if(X<Y)cout << "<" << endl;
    else if(X==Y)cout << "=" << endl;

    return 0;
}


Measured memory_bytes: 256
s=raw_input()
n=len(s)
if n==2:
    if s[0]==s[1]:
        print 1,2
        quit()
    else:
        print -1,-1
        quit()
for i in xrange(n-2):
    if s[i]==s[i+1] or s[i]==s[i+2] or s[i+1]==s[i+2]:
        print i+1,i+3
        quit()
print -1,-1


Measured memory_bytes: 2692
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<int64_t>a(N);
  for(int i=0;i<N;i++)
    cin>>a.at(i);
  int64_t sum=0;
  for(int i=0;i<N;i++)
    sum+=a.at(i);
  if(sum<K)
    cout<<N<<endl;
  else{
  a.push_back(0);
    sort(a.begin(),a.end());
    int left=0;int right=N;
    while(1<right-left){
      int mid=left+(right-left)/2;
      vector<int64_t>B(N+1);
      for(int i=0;i<=N;i++)
        B.at(i)=a.at(i);
      B.erase(B.begin()+mid);
      vector<vector<bool>>dp(N+1,vector<bool>(K,false));
      dp[0][0]=true;
      for(int i=1;i<=N;i++){
      for(int j=0;j<K;j++){
      if(j<B.at(i-1))
        dp[i][j]=dp[i-1][j];
        else
          dp[i][j]=(dp[i-1][j] ||dp[i-1][j-B.at(i-1)]);
      }
      }int64_t A;
      for(int j=K-1;0<=j;j--){
      if(dp[N][j]){A=j;break;}
      
      }if(K<=A+a.at(mid))
        right=mid;
      else
        left=mid;
      
      }cout<<left<<endl;
     }
    return 0;
}

Measured memory_bytes: 3692
import java.util.Scanner;

public class Main {
	static int S;
	static int W;
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		S=sc.nextInt();
		W=sc.nextInt();
		if(S>W) {
			System.out.println("safe");
		}
		else {
			System.out.println("unsafe");
		}
	}
}


Measured memory_bytes: 35768
#include<stdio.h>
int main(){
	int x;
	int a;
	int b;
	scanf("%d %d %d", &x ,&a, &b);
	int r1satu;
	int r2dua;
	
	r1satu= x>=a? x-a : a-x;
	r2dua= x>=b? x-b : b-x;
	
	if(r1satu<r2dua){
		printf("A");
	}else{
		printf("B");
	}
	return 0;
}

Measured memory_bytes: 1644
N = int(input())
S = input()

w = [0] * (N+1)
cnt = 0
for i in range(N):
    if S[i] == 'W':
        cnt += 1
        w[i+1] = cnt
    else:
        w[i+1] = w[i]

e = [0] * (N+1)
cnt = 0
for i in range(N):
    if S[i] == 'E':
        cnt += 1
        e[i+1] = cnt
    else:
        e[i+1] = e[i]

L = []  
for i in range(1, N+1):
    num = w[i-1] + e[N] - e[i]
    L.append(num)

print(min(L))

Measured memory_bytes: 67804
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

priority_queue< P, vector<P>, greater<P> > pq;

bool ishaiku(int x, int y, int z){
	return ((x == 5) && (y == 7) && (z == 5));
}

int k,d[10];

bool iroha(int n){
	int dg,i;
	while(n > 0){
		dg = n%10;
		for(i=0; i<k; ++i){
			if(dg == d[i]){
				return false;
			}
		}
		n /= 10;
	}
	return true;
}

int main(void){
	int n,i;
	cin >> n >> k;
	for(i=0; i<k; ++i){
		cin >> d[i];
	}
	while(!iroha(n)){
		++n;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
            using namespace std;
            #define rep(i,b) for(i=0;i<b;++i)
            #define repp(i,a,b) for(i=a;i<b;++i)
            #define endl "\n"
            //#define LLONG_MAX 99999999999999
            typedef long long int lli;
            int main(){
                //ios_base::sync_with_stdio(false);
                //cin.tie(NULL);
                lli t,n,i,j,b,a,q,m,c,k;
                cin>>a>>b>>c>>k;
                if(k<=a){
                    cout<<k<<endl;
                    return 0;
                }
                if(k<=a+b){
                    cout<<a<<endl;
                    return 0;
                }
                lli d=k-a-b;
                cout<<a-d<<endl;

            }



Measured memory_bytes: 3620
h, w, d = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(h)]
q = int(input())
lr = [list(map(int, input().split())) for _ in range(q)]

a_and_pos = {}
for i in range(h):
    for j in range(w):
        a_and_pos[a[i][j]] = (i, j)

costs = [0]*(h*w+1)
for x in range(d+1, h*w+1):
    i_prev, j_prev = a_and_pos[x-d]
    i, j = a_and_pos[x]
    costs[x] = costs[x-d] + abs(i-i_prev) + abs(j-j_prev)
# print(costs)

for l, r in lr:
    print(costs[r] - costs[l])


Measured memory_bytes: 47720
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

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


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N,a[4]={};	cin>>N;
	while(N--){
		string T;	cin>>T;
		if(T=="AC")	a[0]++;
		else if(T=="WA")	a[1]++;
		else if(T=="TLE")	a[2]++;
		else a[3]++;
	}

	cout<<"AC x "<<a[0]<<endl;
	cout<<"WA x "<<a[1]<<endl;
	cout<<"TLE x "<<a[2]<<endl;
	cout<<"RE x "<<a[3]<<endl;



    return 0;
}




Measured memory_bytes: 3660
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.rmi.server.UnicastRemoteObject;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        HashMap<String, Long> h = new HashMap<>();
        String z[]=new String[n];

		int a[]=new int[26];

        for (int i = 0; i < n; i++) {
        	fill(a,0);
			char c[]=sc.nextString().toCharArray();
			for (int j = 0; j < c.length; j++) {
				a[c[j]-'a']++;
			}
			String s="";
			for (int j = 0; j < a.length; j++) {
				s+=a[j]==10?"a":a[j];
			}
			z[i]=s;
//			db(s);			
			if(h.containsKey(s)) {
				long e=h.get(s);
				h.put(s, e+1);
			} else 
				h.put(s, 1L);
		}
        long ans=0;
        for (int i = 0; i < z.length; i++) {
			if(h.containsKey(z[i])) {
				long x=h.get(z[i]);
				if(x>1) {
					ans+=x*(x-1)/2;
				}
				h.remove(z[i]);
			}
		}
        
        
        
        out.println(ans);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

class P {
	int x, y;
	P(int  x, int y) {
	  this.x=x;
	  this.y=y;
	}
}


//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return b-p.b;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 173576
def examA():
    H, W = LI()
    S = [LSI() for _ in range(H)]
    Alpha = [chr(ord('A') + i) for i in range(26)]
    for i in range(H):
        for j in range(W):
            if S[i][j]=="snuke":
                ans = str(Alpha[j]) + str(i+1)
    print(ans)
    return


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate
import sys



def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
nums = LI()
que = []
for k, v in Counter(nums).items():
    heappush(que, (-k, v))
for i, j in LIR(m):
    heappush(que, (-j, i))


ret = 0
ans = 0
while ret < n:
    k, v = heappop(que)
    ret += v
    ans += -k * v


print(ans + (ret - n) * k)

Measured memory_bytes: 98840
#include<stdio.h>
int main(void){
int h, m, s;
h = 0;
m = 0;
scanf("%d",&s);
	if(s >= 60){
		m = s / 60;
		s = s % 60;
		if(m >= 60){
			h = m / 60;
			m = m % 60;
		}
	}
printf("%d:%d:%d\n", h, m, s);
return 0;
}


Measured memory_bytes: 2048
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
anslist = []
for i in range(10**n):
  for j in range(len(sc)):
    k = sc[j][0]
    if len(str(i)) != n or str(i)[k-1] != str(sc[j][1]):
      break
  else:
    anslist.append(i)
if anslist:
  if anslist[0] == 0 and n != 1:
    print(10**(n-1))
  else:print(anslist[0])
else:print(-1)


Measured memory_bytes: 38384
from fractions import gcd
N = int(input())
A = [int(s) for s in input().split()]
ans = 0
L = [0] * (N)
R = [0] * (N)
for n in range(0, N):
    if n != N-1:
        L[n+1] = gcd(A[n], L[n])
        R[-(n+2)] = gcd(A[-(n+1)], R[-(n+1)])
for n in range(0, N):
    temp = gcd(L[n], R[n])
    ans = max(temp, ans)
print(ans)

Measured memory_bytes: 16124
#include <iostream>
#include <cassert>
using namespace std;
const long long mod = (1e9) + 7;

long long mod_pow(long long x, long long k){
  long long ret = 1;
  while(k > 0){
    if(k&1){
      ret *= x;
      ret %= mod;
    }
    x *= x;
    x %= mod;
    k /= 2;
  }
  return ret;
}

int main(){
  long long S;
  cin >> S;
  long long ans = 0;
  for(int i = 1; i <= S; ++i){
    long long i_ = S/i, r_ = S%i;
    //i が i_ 個
    if(((!r_) && (i-1 > 8 || 9*mod_pow(10,i-1) >= i_))){
      ans += ((9*mod_pow(10,i-1))%mod - i_ + 1 + mod)%mod;
      ans %= mod;
    }
    //長さ i の区間の個数
    //i_ がi - r 個、i_+1 が r 個
    if(r_ && (i_-1 > 8 || 9*mod_pow(10,i_-1) >= i-r_) && (i_ > 8 || 9*mod_pow(10,i_) >= r_)){
      ++ans;
      ans %= mod;
    }
  }
  
  //cerr << ans << endl;
  
  long long C[10], D[10];
  C[0] = 0;
  C[1] = 9;
  for(int i = 1; i < 9; ++i) C[i+1] = C[i]*10;
  for(int i = 0; i < 10; ++i) D[i] = 0;
  long long r = 1, l = 1, s = 0;
  while(S > s){
    if(s+C[r]*r <= S){
      s += C[r]*r;
      D[r] += C[r];
      C[r] = 0;
      ++r;
    }else{
      long long t = (S-s+r-1)/r;
      D[r] += t;
      C[r] -= t;
      s += t*r;
    }
  }
  while(l < r){
    while(s > S){
      if(s - S >= l*D[l]){
        s -= l*D[l];
        C[l] += D[l];
        D[l] = 0;
        ++l;
      }else{
        long long t = (s - S + l - 1)/l;
        C[l] += t;
        D[l] -= t;
        s -= t*l;
      }
    }
    //if(l >= r-1) break;
    if(l < r-1 && s == S){
      ++ans;
      ans %= mod;
    }
    if(!C[r]) ++r;
    --C[r];
    ++D[r];
    s += r;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

N = int(input().strip())

input_tuples = []
selected_tuple = None

for _ in range(N):
    x, y, h = [int(s) for s in input().strip().split()]
    if selected_tuple is None and h > 0:
        selected_tuple = ((x, y, h))
    else:
        input_tuples.append((x, y, h))

for cx in range(0, 101):
    for cy in range(0, 101):
        H = selected_tuple[2] + \
            abs(selected_tuple[0] - cx) + abs(selected_tuple[1] - cy)

        for x, y, h in input_tuples:
            if h != max(H - abs(x - cx) - abs(y - cy), 0):
                break
        else:
            break
        continue
    else:
        continue
    break

print("{} {} {}".format(cx, cy, H))


Measured memory_bytes: 3064
from itertools import product

N = input()
l = len(N)
a = int(N[0])
b = int(N[-1])

if l == 1:
    print(l)
    exit()
elif l == 2:
    print(9 + min(a, b) ** 2 * 2)
    exit()

N = N[1:-1]
table = [[0] * 10 for _ in range(10)]
for i in range(1, 10):
    table[i][i] = 1

for i, j in product(range(1, 10), repeat=2):
    table[i][j] += sum(10 ** (l - i) for i in range(3, l + 1))
    if i < a:
        table[i][j] += 10 ** (l - 2)
    elif i == a:
        if b < j:
            table[i][j] += sum((int(N[-i - 1])) * 10 ** i for i in range(l - 2))
        else:
            table[i][j] += sum((int(N[-i - 1])) * 10 ** i for i in range(l - 2)) + 1

answer = 0
for i, j in product(range(1, 10), repeat=2):
    answer += table[i][j] * table[j][i]
    # print(i, j, table[i][j], table[j][i])

print(answer)


Measured memory_bytes: 3444
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

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

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTA(a,n) sort(a,a+n)
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int h,w;
    cin >> h >> w;
  	string st[55];
  	REP(i,0,h){
      cin >> st[i];
    }
  	REP(i,0,h){
      REP(j,0,w){
      	if(st[i][j]=='.'){
          	st[i][j]++;
          	st[i][j]++;
        	if(i>0 && j>0) if(st[i-1][j-1]=='#')  st[i][j]++;
        	if(i>0) if(st[i-1][j]=='#')  st[i][j]++;
        	if(i>0) if(st[i-1][j+1]=='#')  st[i][j]++;
        	if(j>0) if(st[i][j-1]=='#')  st[i][j]++;
        	if(st[i][j+1]=='#')  st[i][j]++;
        	if(j>0) if(st[i+1][j-1]=='#')  st[i][j]++;
        	if(st[i+1][j]=='#')  st[i][j]++;
        	if(st[i+1][j+1]=='#')  st[i][j]++;
        }
      }
    }
    //処理
    //出力
    REP(i,0,h) cout << st[i] << ENT;
    return 0;
}

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


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

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

  int sum = 0;
  for (int i = 0; i < N.length(); i++) {
    sum += int(N[i]) - 48;
  }

  if (stoi(N) % sum == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main() {
char b ;
cin>> b ;
if(b=='A') { cout << 'T';}
else if(b=='C'){cout << 'G' ;}
else if(b=='G'){cout << 'C' ;}
else if(b=='T'){cout << 'A' ;}
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    cout<<fixed<<setprecision(12);
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int n;
    cin>>n;
    vector<int> a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    if(x1>x2){
        swap(x1,x2);swap(y1,y2);
    }
    if(y1>y2){
        y1=-y1;y2=-y2;
        rep(i,n)b[i]=-b[i];
    }
    vector<int> na,nb;
    rep(i,n){
        if(x1<=a[i] && a[i]<=x2 && y1<=b[i] && b[i] <= y2){
            na.push_back(a[i]);
            nb.push_back(b[i]);
        }
    }
    a.swap(na);b.swap(nb);
    n=a.size();
    vector<int> ord(n);
    rep(i,n)ord[i]=i;
    sort(ord.begin(),ord.end(),[&](int x,int y){
        return b[x]==b[y]?a[x]>a[y]:b[x]<b[y];
    });
    vector<ll> dp(n+1,longinf);
    dp[0]=-longinf;
    for(auto i:ord){
        auto itr = lower_bound(dp.begin(),dp.end(),a[i]);
        *itr = a[i];
    }
    int ans= 0;
    rep(i,n+1){
        if(dp[i]!=longinf)ans = i;
    }
    double dist = (x2-x1)+(y2-y1);
    dist *= 100;
    if(ans == min(y2-y1,x2-x1)+1){
        --ans;
        dist += (10*acos(-1)-20);
    }
    cout<<dist+(10*asin(1)-20)*ans<<endl;
    return 0;
}

Measured memory_bytes: 5996
#include <iostream>

using namespace std;

int main()
{
	int N,count = 0;
	cin >> N;
	int A[201];
	for (int j = 0; j < N; j++)
		cin >> A[j];
	while (true)
	{
		for (int i = 0; i < N; i++)
		{
			if (A[i] % 2 != 0)
				goto L;
			else A[i] = A[i] / 2;
		}
		count++;
	}
	L:
	cout << count << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve(){
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n+1);
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	vector<int> vis(n+1,0);
	vis[0] = 1;
	vis[1] = 1;
	deque<int>que;
	que.push_back(1);
	while(!que.empty()){
		int tm = que.size();
		while(tm--){
			int p = que.front();
			que.pop_front();
			for(auto item:g[p]){
				if(vis[item]) continue;
				vis[item] = p;
				// cout<<item<<endl;
				que.push_back(item);
			}
		}
	}
	// cout<<endl;
	bool f = true;
	for(int i=0;i<=n;i++){
		if(!vis[i]){
			f = false;
			break;
		}
	}
	if(f) cout<<"Yes"<<endl;
	else {
		cout<<"No"<<endl;
		return;
	}
	for(int i=2;i<=n;i++){
		cout<<vis[i]<<endl;
	}
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 10136
import sys

N = int(input())

if N % 2 == 1:
  print(0)
  sys.exit()
  

f = lambda x: x * f(x-2) if x>=2 else 1
# get_odd_even = lambda x: 'even' if x % 2 == 0 else 'odd'

#result = f(N)

#while result % j**e == 0:
#  e+=1
#print(e-1)

cnt = 0
cnt += N//10
#cnt += N//50
#cnt += N//250
#cnt += N//1250
#cnt += N//6250
#cnt += N//31250

j = 50
for e in range(1,25):
  cnt += N//(10*(5**e))

#print(result)
print(cnt)

Measured memory_bytes: 3060
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.IO

Public Class Program


    Public Shared Sub Main(args As String())

        Dim K As Integer = Integer.Parse(Console.ReadLine)
        Dim S As String = Console.ReadLine()

        If S.Length <= K Then
            Console.WriteLine(S)
        Else
            Console.WriteLine("{0}...", S.Substring(0, K))
        End If

    End Sub




End Class

Measured memory_bytes: 27468
#include <bits/stdc++.h>
using namespace std;
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
const int INF=1e9;

signed main(){
  int a,b,m;cin>>a>>b>>m;
  vector<int> A(a),B(b);
  for(int i=0;i<a;i++)cin>>A[i];
  for(int i=0;i<b;i++)cin>>B[i];
  int ans=INF;
  set<int> s,t;
  for(int i=0;i<a;i++)s.insert(A[i]);
  for(int i=0;i<b;i++)t.insert(B[i]);
  ans=*s.begin()+*t.begin();
  while(m--){
    int x,y,c;cin>>x>>y>>c;x--;y--;
    chmin(ans,A[x]+B[y]-c);
  }
  fin(ans);
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
//-std=c++11
#define print(x) printf("%.12f",x);
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define repr(i, n) for(int i=n-1;i>=0;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Repr(i,a,b) for(int i=a;i>=b;i--)
#define pii pair < int, int >
#define iter ::iterator
#define forit(a) for(it=a.begin();it!=a.end();it++)
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod = 998244353;
const int N = (int)2e5 + 5;

void solve(){
	int n;
	cin>>n;
	double d=n*1.0/3*1.0;
	print(d*1.0*d*1.0*d*1.0);

}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256