akhauriyash/Code-Regression huggingface dataset:
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall

BIG_NUM = 200000000000
MOD = 1000000007
EPS = 0.000000001
a,b,x = map(int,input().split())
if a*a*b/2 <= x:
    print(math.degrees(math.atan(2*(a*a*b-x)/(a*a*a))))
else:
    print(math.degrees(math.atan(a*b*b/(2*x))))


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

int main() {
 int A;
  int B;
  cin>>A>>B ;
 if(A+B>=A-B&&A+B>=A*B) 
   cout<<A+B<<endl;
  else if(A-B>=A+B&&A-B>=A*B)
    cout<<A-B<<endl;
  else if(A*B>=A+B&&A*B>=A-B)
  cout<<A*B<<endl;
}

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

#define ll long long
#define f(i,a,n) for (int i=a;i<n;i++)
typedef pair<ll, ll> pa;
const ll mod=1000000007;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s[n];
    unordered_map<string, ll> m;
    f(i, 0, n) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        m[s[i]]++;
    }
    ll ans = 0;
    for (pair<string, ll> p: m) {
        ans += ((p.second*(p.second - 1))/2);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 16036
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX_N=35;
int a[MAX_N]={0,1,1,1,2,1,2,1,5,2,2,1,5,1,2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(void){
	int n,i;
	scanf("%d",&n);
	cout<<a[n]<<"\n";
	return 0;
}

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

class suffix_array {
	// This is an O(n log^2 n) suffix array algorithm.
	// It uses hashing (modulo 2^64) so the hash value may collide.
private:
	int size_;
	std::string s;
	std::vector<unsigned long long> prefix_hash;
	std::vector<unsigned long long> powers;
public:
	suffix_array(std::string s_) : s(s_) {
		size_ = s.size();
		prefix_hash = std::vector<unsigned long long>(size_ + 1);
		powers = std::vector<unsigned long long>(size_ + 1);
		powers[0] = 1;
		for (int i = 0; i < size_; i++) {
			prefix_hash[i + 1] = prefix_hash[i] * 311 + (s[i] - 48);
			powers[i + 1] = powers[i] * 311;
		}
	}
	int hash_value(int l, int r) {
		return prefix_hash[r] - powers[r - l] * prefix_hash[l];
	}
	int lcp(int x, int y) {
		int l = -1, r = std::min(size_ - x, size_ - y) + 1;
		while (r - l > 1) {
			int m = (l + r) >> 1;
			if (hash_value(x, x + m) == hash_value(y, y + m)) l = m;
			else r = m;
		}
		return l;
	}
	std::vector<int> suffix_arrray() {
		std::vector<int> ret(size_ + 1);
		for (int i = 0; i <= size_; i++) ret[i] = i;
		std::sort(ret.begin(), ret.end(), [&](int i, int j) {
			int len = lcp(i, j);
			if (i + len == size_) return true;
			if (j + len == size_) return false;
			return s[i + len] < s[j + len];
		});
		return ret;
	}
};

long long N, H, c[100009], sa[100009]; string S;

long long solve(int num) {
	long long T = 0, sum = 0;
	for (int i = 0; i < N; i++) {
		while (T < S.size() && S[T] == '0') T++;
		long long U = T + num; U = min(U, N);
		sum += (U - i);
		T = max(T, (long long)(i + 1));
	}
	return sum;
}

int main() {
	cin >> N >> H >> S;
	c[0] = 1;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '0') c[i + 1] = c[i] + 1;
		else c[i + 1] = 1;
	}
	long long L = 0, R = N + 1, M, maxn = -1;
	for (int i = 0; i < 20; i++) {
		M = (L + R) / 2;
		long long p = solve(M);
		if (p < H) { maxn = max(maxn, M); L = M; }
		else { R = M; }
	}
	maxn++;
	if (maxn == 0) {
		cout << "0" << endl;
	}
	else {
		suffix_array L(S);
		vector<int>G = L.suffix_arrray();

		for (int i = 0; i < G.size(); i++) sa[G[i]] = i;

		vector<pair<int, int>>F;
		for (int i = 0; i < (int)S.size() - maxn + 1; i++) {
			if (S[i] == '0') continue;
			for (int j = 0; j < c[i]; j++) F.push_back(make_pair(sa[i], i));
		}
		sort(F.begin(), F.end());

		long long ss = solve(maxn - 1);
		int index = F[H - ss - 1].second;
		cout << S.substr(index, maxn) << endl;
	}
	return 0;
}


Measured memory_bytes: 7616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define M1 1000000007
#define M2 998244353
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define V(a) vector<a>
#define bn "\n"

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int t=1;
   // cin>>t;
	while(t--)
	{
	   int n;
	   cin>>n;
	   ll s=0;
	   for(int i=1;i<=n;i++)
	   {
	       if(i%3!=0 && i%5!=0 )
	       s=s+i;
	   }
	   cout<<s<<bn;
	}
	
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int now = 1;
  int cnt = 1;
  while(now <= N){
    now += pow(26, cnt);
    cnt++;
  }
  cnt--;
  now -= pow(26, cnt);

  N -= now;

  vector<int> ans(cnt, 0);
  while(N > 0){
    cnt--;
    ans[cnt] += N%26;
    N /= 26;
  }

  REP(i, ans.size()){
    char s = 'a'+ans[i];
    cout << s;
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 4060
//Classic
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"AA Baju Smit------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 1000000007
#define ciN cin
#define X INT_MAX
#define N INT_MIN
////////////////////////////////////////////////////////////////
void jabru() {
	int n; ciN >> n;
	if (n < 3) {
		cout << 0 << endl; return;
	}
	else if (n < 5) {
		cout << 1 << endl; return;
	}
	vll s(n, 0);
	s[0] = 0; s[1] = 0; s[2] = 1; s[3] = 1;
	s[4] = 1;
	for (int i = 5; i < n; i++) {
		int here = i + 1;
		int end = here - 3;
		ll ans = 1;
		for (int j = 3; j <= end; j++) {
			ans += s[j - 1] % mod;
			ans %= mod;
		}
		s[i] = ans % mod;
	}
	cout << s[n - 1] % mod << endl;

}

////////////////////////////////////////////////////////////////


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	//cin >> t;
	t = 1;
	while (t--)
		jabru();


	return 0;
}




Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int solve(){
    int n;
    ll x;
    cin >>n >>x;
    vector<ll> a(n);
    rep(i,n) cin >>a[i];
    sort(all(a));

    ll sum = 0;
    rep(i,n){
        if(sum+a[i] > x) return i;
        sum += a[i];
    }

    if(sum == x) return n;
    return n-1;
}

int main(){
    cout << solve() << endl;
    return 0;
}


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

typedef pair<long long, int> P;
struct edge{
    int to;
    int cost;
    edge(int to, int cost){
        this->to = to;
        this->cost = cost;
    }
};
struct D{
    vector< vector<edge> > graph;
    vector< long long > dist;

    void init(int size){
        dist.assign(size, 1e18);
        graph.assign(size, vector<edge>() );
    }

    void add_edge(int from, int to, int cost){
        graph[from].push_back(edge(to, cost));
    }

    void dijkstra(int from){
        priority_queue<P, vector<P>, greater<P> > q;
        dist[from] = 0;
        q.push(P(0, from));
        while(!q.empty()){
            P p = q.top();
            q.pop();
            int v = p.second;
            if(dist[v] < p.first)continue;
            for(int i = 0; i < graph[v].size(); i++){
                edge e = graph[v][i];
                if(dist[e.to] > dist[v] + e.cost){
                    dist[e.to] = dist[v] + e.cost;
                    q.push(P(dist[e.to], e.to));
                }
            }
        }
    }
};
int main(void){
    int n, m, s, t;
    long long ans = 1e15, q[100000];
    D yn, sn;
    cin >> n >> m >> s >> t;
    yn.init(n);
    sn.init(n);
    for(int i=0;i<m;i++){
        int v, u, a, b;
        cin >> v >> u >> a >> b;
        v--;
        u--;
        yn.add_edge(v, u, a);
        yn.add_edge(u, v, a);
        sn.add_edge(v, u, b);
        sn.add_edge(u, v, b);
        
        
    }
    yn.dijkstra(--s);
    sn.dijkstra(--t);
    
    for(int i=n-1;i>=0;i--){
        long long tmp = yn.dist[i] + sn.dist[i];
        ans = min(ans, tmp);
        //cout << i << "  " << tmp << endl;
        q[i] = 1e15-ans;
    }
    for(int i=0;i<n;i++){
        cout << q[i] << endl;
    }
}


Measured memory_bytes: 16252
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(M)]

island = list(range(N))
counts = [1] * N
total = int((N * (N - 1)) / 2)
result = []

for c in reversed(data):
    ref0 = int(c[0]) - 1
    while island[ref0] != ref0:
        ref0 = island[ref0]
    ref1 = int(c[1]) - 1
    while island[ref1] != ref1:
        ref1 = island[ref1]

    if ref0 == ref1:
        root = min(ref0, ref1)
        pair = max(ref0, ref1)
        island[int(c[0]) - 1] = root
        island[int(c[1]) - 1] = root
        island[pair] = root
        result.append(0);
    else:
        root = min(ref0, ref1)
        pair = max(ref0, ref1)
        island[int(c[0]) - 1] = root
        island[int(c[1]) - 1] = root
        island[pair] = root
        result.append(counts[ref0] * counts[ref1]);
        counts[root] = counts[ref0] + counts[ref1]

res = [total]
for r in result:
    res.append((res[-1] - r))

print('\n'.join(reversed([str(x) for x in res][:-1])))


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

long long INF = - 1'000'000'000'000'000'000;

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

    struct edge {
        long long from, to, cost;
    };

    vector<edge> es(m);
    for (int i = 0; i < m; i++){
        cin >> es[i].from >> es[i].to >> es[i].cost;
    }

    vector<long long> distance(n, INF);
    distance[0] = 0;
    int cnt = 0;

    while (1){
        bool flag = false;
        for (int i = 0; i < m; i++){
            bool up = false;
            edge e = es[i];
            if (distance[e.from - 1] != INF && distance[e.to - 1] < distance[e.from - 1] + e.cost){
                distance[e.to - 1] = distance[e.from - 1] + e.cost;
                flag = true;
                if (cnt >= n - 1 && e.to == n){
                    cout << "inf" << endl;
                    exit(0);
                }
            }
        }
        cnt++;
        if (flag == false || cnt >= 2*n) break;
    }

    cout << distance[n - 1] << endl;
}

Measured memory_bytes: 256
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int main()
{
	int n;read(n);
	int i=max(1,sqrt(n)-100);
	for (;i*(i+1)<2*n;i++);
	
	cout<<i;
	return 0;
}









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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("30.txt", "r", stdin);

  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());

  int i = 0, j = 1;
  while (i < n / 2) {
    b[j] = a[i];
    i++;
    j += 2;
  }
  b[0] = a[i];
  i++;
  if (n % 2 != 0) {
    j--;
    b[j] = a[i];
    i++;
    j -= 2;
  } else {
    j -= 3;
  }
  while (j > 0) {
    b[j] = a[i];
    i++;
    j -= 2;
  }

  long long ans1 = 0;
  for (int i = 0; i < n - 1; ++i) {
    ans1 += abs(b[i] - b[i + 1]);
  }

  i = 0;
  j = 2;
  while (j < n) {
    b[j] = a[i];
    i++;
    j += 2;
  }
  b[0] = a[i];
  i++;
  if (n % 2 == 0) {
    j--;
    b[j] = a[i];
    i++;
    j -= 2;
  } else {
    j -= 3;
  }
  while (j > 0) {
    b[j] = a[i];
    i++;
    j -= 2;
  }

  long long ans2 = 0;
  for (int i = 0; i < n - 1; ++i) {
    ans2 += abs(b[i] - b[i + 1]);
  }

  cout << max(ans1, ans2) << "\n";
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    // H,W,h,wを取得
    int N = sc.nextInt(); //列数
    int M = sc.nextInt(); //行数
    int C = sc.nextInt(); //const
    int[][] A = new int[N][M];
    int[][] B = new int[M][1];
    for(int i=0;i<M;i++){
      B[i][0] = sc.nextInt();
    }
    for(int i=0;i<N;i++){
      for(int j=0;j<M;j++){
        A[i][j] = sc.nextInt();
      }
    }
    // 行列計算
    int[][] ansMat = new int[M][1];
    ansMat = multArray(A,B);
    // -c以上の数だけインクリメント
    int count = 0;
    // System.out.println(ansMat.length+" "+ansMat[0].length);
    for(int i=0;i<N;i++){
      if(ansMat[i][0]>-C){
        count++;
      }
    }
    // 出力
    System.out.println(count);
  }
  public static int[][] multArray(int a[][], int b[][]){
    int ay = a.length;
    int ax = a[0].length;
    int by = b.length;
    int bx = b[0].length;
    int[][] c = new int[ay][bx];
    if(ax!=by){
      return c;
    }
    // 行列積
    for(int i=0;i<ay;i++){
      for(int j=0;j<bx;j++){
        int sum = 0;
        for(int k=0;k<ax;k++){
          sum += a[i][k]*b[k][j];
        }
        c[i][j] = sum;
      }
    }
    return c;
  }
}


Measured memory_bytes: 23764
#include <iostream>

#include <string>

using std::cin;
using std::cout;
using std::endl;

using std::string;

static string
solve(string const &S)
{
  bool check[26] = {false};
  for (auto it = S.begin(); it != S.end(); it++)
  {
    check[*it - 'a'] = true;
  }
  for (int i = 0; i < 26; i++)
  {
    if (!check[i])
    {
      return string(1, char('a' + i));
    }
  }
  return "None";
}

int
main()
{
  string S;
  cin >> S;
  cout << solve(S) << endl;
  return 0;
}


Measured memory_bytes: 512
use std::io::stdin;
use std::str::FromStr;
use std::cmp::max;
use std::cmp::min;

fn main(){
    let (a, b, c): (i64, i64, i64) = get_triple();
    let mx = max(max(a, b), c);
    let mn = min(min(a, b), c);
    let md = a + b + c - mn - mx;
    let rem = 3*mx - (a+b+c);
    if rem % 2 == 0 {
        println!("{}", rem / 2);
    } else {
        if 0 == (mx+mn)%2 {
            let d = (mx-md)/2 + (mx-md)%2;
            let md2 = md + d*2;
            println!("{}", d + (2*md2 - (mx+mn))/2);
        } else {
            let d = (mx-mn)/2 + (mx-mn)%2;
            let mn2 = mn + d*2;
            println!("{}", d + (2*mn2 - (mx+md))/2);
        }
    }
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}


Measured memory_bytes: 4352
import java.util.*;
import java.io.*;

public class Main {
    static final int MOD=1000000007;
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(f.readLine());
        int n = Integer.parseInt (st.nextToken());
        int m = Integer.parseInt (st.nextToken());
        char[][] arr=new char[n][m];

        for(int i=0;i<n;i++){
            arr[i]=f.readLine().toCharArray();
        }
        long dp[][]=new long[n][m];
        dp[0][0]=1;
        for(int i=1;i<n;i++){
            if(arr[i][0]=='#'){
                break;
            }
            dp[i][0]=1;
        }
        for(int i=1;i<m;i++){
            if(arr[0][i]=='#'){
                break;
            }
            dp[0][i]=1;
        }
        for(int i=1;i<n;i++){
            p:
            for(int j=1;j<m;j++){
                if(arr[i][j]=='#')continue p;
                dp[i][j]=dp[i-1][j]+dp[i][j-1];
                dp[i][j]%=MOD;

            }
        }
//        for(int i=0;i<n;i++){
//            System.out.println();
//            for(int j=0;j<m;j++){
//                System.out.print(dp[i][j]+" ");
//            }
//        }
        System.out.println(dp[n-1][m-1]);
        f.close();

        //print to System. out.println

    }

}


Measured memory_bytes: 37768
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <assert.h>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>                                    
#include <deque>                                    
#include <queue>
#include <iomanip>
#include <ctime>
#include <random>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;

 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, m, q, x[N], y[N], row[N], col[N];
map <int, int> used[N];
vector <pii> v1, v2;
 
inline void boost () {
   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
}

inline void Solve () {
   cin >> n >> m >> q;
   for (int i = 1; i <= q; i ++) cin >> x[i] >> y[i], row[x[i]] ++, col[y[i]] ++, used[x[i]][y[i]] = 1;
   for (int i = 1; i <= n; i ++) v1.pb ({row[i], i});
   for (int i = 1; i <= m; i ++) v2.pb ({col[i], i});
   sort (all (v1));
   sort (all (v2));
   reverse (all (v1));
   reverse (all (v2));
   while (v1[0].F != v1.back ().F) v1.ppb ();
   while (v2[0].F != v2.back ().F) v2.ppb ();
   int ans = v1[0].F + v2[0].F; 
   for (int i = 0; i < sz (v1); i ++)
      for (int j = 0; j < sz (v2); j ++)
         if (!used[v1[i].S].count (v2[j].S))
            cout << ans, exit (0);  
   cout << ans - 1;

}               
 
signed main () {                                       
  // #ifdef QWERTY
   //   freopen("input", "r", stdin);
   //#endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                 


Measured memory_bytes: 44400
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<stack>
#include<bitset>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string str;
	stack<llint>sta;
	while(cin>>str){
		if('0'<=str[0]&&str[0]<='9'){
			//数字
			llint suzi=0;
			for(auto it:str){suzi*=10;suzi+=it-'0';}
			sta.push(suzi);
		}else{
			llint mae,ato;
			ato=sta.top();sta.pop();
			mae=sta.top();sta.pop();
			if(str[0]=='+'){mae+=ato;}
			if(str[0]=='-'){mae-=ato;}
			if(str[0]=='*'){mae*=ato;}
			if(str[0]=='/'){mae/=ato;}
			sta.push(mae);
		}
	}
	cout<<sta.top()<<endl;
	return 0;
}


Measured memory_bytes: 3200
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    
    int n,a,b,sumA = 0,sumB = 0;
    
    
    while(1){
        cin >> n;
        if(!n) return 0;
        sumA = 0; sumB = 0;
        
        rep(i,0,n){
            cin >> a >> b;
            if(a > b){
                sumA += a+b;
            }
            else if(b > a){
                sumB += a+b;
            }
            else{
                sumA += a;
                sumB += b;
            }
        }
        cout << sumA << " " << sumB << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
//sum
int sum(vector<int> scores){
    int s=0;
    for(int i=0;i<scores.size();i++) s+=scores.at(i);
    return s;
}
//output
void output(int sum_a, int sum_b, int sum_c){
    cout<<sum_a*sum_b*sum_c<<endl;
}
//input
vector<int> input(int N){
    vector<int> vec(N);
    for(int i=0;i<N;i++) cin >> vec.at(i);
    return vec;
}
//main
int main(){
    int K,A,B;
    cin>>K>>A>>B;
    if(A%K==0||B%K==0){
        cout<<"OK";
        return 0;
    }else if(B==A){
        cout<<"NG";
        return 0;
    }else{
        for(int i=A+1;i<B;i++){
            if(i%K==0){
                cout<<"OK";
                return 0;
            }
        }
    }
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3632
#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 N;
    cin >> N;
    ll A, MOD = 1e9 + 7, ans = 0;
    vector<int> c(60, 0);
    rep(i, N) {
        cin >> A;
        rep(j, 60) {
            if (A & (1LL << j)) c[j]++; 
        }
    }
    rep(i, 60) {
        ans = (ans + ((((1LL << i) % MOD) * c[i]) % MOD) * (N - c[i])) % MOD;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))

a_sum = sum(a_list)
min_num = float("inf")
r = []

for i in range(1, N):
    if len(r) == 0:
        r.append(a_list[0])
    else:
        r.append(r[i-2] + a_list[i-1])

    x = r[i-1]
    y = a_sum - x
    if min_num >= abs(x-y):
        min_num = abs(x-y)
print(min_num)

Measured memory_bytes: 24632
#include <iostream>
#include <algorithm>
#include <functional>

int count[100001];

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

	for (int i = 0; i < n; ++i) {
		int a;
		std::cin >> a;

		++count[a];
		++count[a + 1];
		if (a != 0)
			++count[a - 1];
	}

	std::sort(count, std::end(count), std::greater<>{});

	std::cout << count[0] << std::endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip> 
#include <cstring>
#include <queue>
#include <stack> 
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
ll vis[200005];
int a[200005];
int n;
ll res;
int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		vis[a[i]]++;
	}
	for(int i = 1;i <= n;i++){
		res += (vis[i] * (vis[i] - 1) / 2);
	}
	for(int i = 1;i <= n;i++){
		if(vis[a[i]] > 1){
			printf("%lld\n",res - (vis[a[i]] - 1));
		}else{
			printf("%lld\n",res);
		}
	}
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <queue>
#include <math.h>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <ctype.h>
#include <cassert>
#include <stack>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <ctime>
#include <functional>
#include <ctime>
#include <limits>
#include <tuple>
#include <complex>

using namespace std;

#define snd second
#define fst first
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define left _left
#define right _right

const ld pi = acos(-1.0l);

template<typename T>
T abs(T x) {
    return x > 0 ? x : -x;
}

template<typename T>
T sqr(T x) {
    return x * x;
}

template<typename T>
void chmin(T &x, T y) {
    x = min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
    x = max(x, y);
}

template<typename U, typename V>
ostream &operator<<(ostream &s, const pair<U, V> &x) {
    s << "(" << x.fst << ", " << x.snd << ")";
    return s;
}

template<typename U>
ostream &operator<<(ostream &s, const vector<U> &x) {
    s << "[";
    bool was = false;
    for (auto it : x) {
        if (was) {
            s << ", ";
        }
        was = true;
        s << it;
    }
    s << "]";
    return s;
}

template<typename U>
ostream &operator<<(ostream &s, const set<U> &x) {
    s << "{";
    bool was = false;
    for (auto it : x) {
        if (was) {
            s << ", ";
        }
        was = true;
        s << it;
    }
    s << "}";
    return s;
}

template<int sz>
ostream operator<<(ostream &s, const bitset<sz> &x) {
    for (int i = 0; i < sz; i++) {
        s << x[i];
    }
    return s;
}


//-----------------------------------------------------------------------------

const int maxn = 2e5 + 5;
int a[maxn];

int main() {
    srand(time(NULL));

    retry:
#ifdef LOCAL
    //gen();
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("lock.in", "r", stdin);
    //freopen("lock.out", "w", stdout);
#endif

    int n, m;
    scanf("%d %d", &n, &m);

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

    for (int i = 0; i < n - 1; i++) {
        if (a[i] + a[i + 1] >= m) {
            vector<int> ans;
            ans.pb(i);
            for (int j = i + 1; j < n - 1; j++) {
                ans.pb(j);
            }
            for (int j = i - 1; j >= 0; j--) {
                ans.pb(j);
            }
            reverse(ans.begin(), ans.end());
            printf("Possible\n");
            for (int x : ans) {
                printf("%d\n", x + 1);
            }
            return 0;
        }
    }

    printf("Impossible\n");

    return 0;
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

const ll MX = 1e18;

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

  int n;
  cin >> n;
  ll ans = 1;
  bool ok = false;
  rep(i,n) {
    ll a;
    cin >> a;
    if(a == 0) {
      cout << 0 << endl;
      return 0;
    }
    if(ok || __int128(ans)*a > MX) {
      ok = true;
    }
    ans *= a;
  }
  if(ok) cout << -1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

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

  int p;
  if (b / 100 > 0) p = 3;
  else if (b / 10 > 0) p = 2;
  else p = 1;
  
  int num = a * pow(10, p) + b;
  int sq = (int)sqrt(num);
  if (num == sq * sq) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int ans=0;
	for(int i=0;i<s.size();i++)	
		if(s[i]!=t[i])
			ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3920
#include<cstdio>
#include<algorithm>
using namespace std;
double D[3010][3010];
int n;
int main() {
	int i, j;
	D[0][0] = 1;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		double p;
		scanf("%lf", &p);
		for (j = 0; j < i; j++) {
			if (D[i - 1][j] < 1e-40)D[i - 1][j] = 0;
			D[i][j + 1] += D[i - 1][j] * p;
			D[i][j] += D[i - 1][j] * (1-p);
		}
	}
	double res = 0.0;
	for (i = n / 2 + 1; i <= n; i++)res += D[n][i];
	printf("%.15f\n", res);
}

Measured memory_bytes: 68992
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#define pb push_back()
using namespace std;
const int maxn=1e6+10;
int n,x,num[maxn];
int main()
{
	scanf("%d",&n);
	for (int i=2;i<=n;i++) scanf("%d",&x),num[x]++;
	for (int i=1;i<=n;i++) printf("%d\n",num[i]);
return 0;
}

Measured memory_bytes: 4600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 100005;

int main(){
	int n;
	cin >> n;
	ll m = MOD;
	ll par = 0;
	ll sum = 0;
	cu(i,0,n){
		ll x;
		cin >> x;
		if(x < 0)par^=1;
		m = min(m,abs(x));
		sum += abs(x);
	}
	cout << (sum - (par?2*m:0)) << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int dis(int l, int r, const vector<P> &A) {
  return abs(A[l].first - A[r].first) + abs(A[l].second - A[r].second);
}
int main() {
  int H, W, D;
  cin >> H >> W >> D;
  vector<P> A(H * W + 10);
  REP(i, H) REP(j, W) {
    int a;
    cin >> a;
    A[a] = P(i + 1, j + 1);
  }
  vector<vector<int>> m(D);
  REP(i, D) {
    int a = i;
    if (a == 0) a = D;
    while (a <= H * W) {
      m[i].push_back(a);
      a += D;
    }
  }
  vector<vector<ll>> wa(D);
  REP(i, D) {
    wa[i].push_back(0);
    REP(j, m[i].size() - 1) {
      wa[i].push_back(dis(m[i][j], m[i][j + 1], A) + wa[i][j]);
    }
  }
  int Q;
  cin >> Q;
  REP(i, Q) {
    int l, r;
    cin >> l >> r;
    cout << -wa[l % D][(l - 1) / D] + wa[r % D][(r - 1) / D] << endl;
  }
}

Measured memory_bytes: 13588
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
int size;
vector<int> mark;

// dfs
void dfs(const Graph &G,int v,int label){
  // vを訪問済みにする
  seen[v] = true;
  size++;
  mark[v] = label;
  // vから行ける各頂点next_vについて
  for(auto next_v:G[v]){
    // next_vが探索済であれば無視
    if(seen[next_v]) continue;
    // 再帰的に探索
    dfs(G,next_v,label);
  }
}

int main(){
  // 頂点数
  int n;
  cin >> n;
  int m,k;
  cin >> m >> k;

  // グラフ入力受け取り（無向グラフ）
  Graph G(n+1);
  Graph B(n+1);

  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  for(int i=0;i<k;i++){
    int c,d;
    cin >> c >> d;
    B[c].push_back(d);
    B[d].push_back(c);
  }


  seen.assign(n+1,false);
  mark.assign(n+1,0);
  map<int,int> mp;
  for(int i=1;i<=n;i++){
    if(!seen[i]){
      size = 0;
      dfs(G,i,i);
      mp.insert(make_pair(i,size));
    }
  }

  for(int i=1;i<=n;i++){
    int ans;
    ans = mp[mark[i]] - 1 - G[i].size();
    for(int j=0;j<B[i].size();j++){
      if(mark[B[i][j]] == mark[i]){
        ans--;
      }
    }
    cout << ans;
    if(i != n) cout << " ";
    else cout << endl;
  }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll n, k;
  cin >> n;
  ll a[n + 1];

  ll i, j;
  for(i = 1; i <= n; i++){
    cin >> k;
    a[k] = i;
  }
  for(i = 1; i <= n; i++){
    cout << a[i] << ' ';
  }
  cout << '\n';


  ktj();
}


Measured memory_bytes: 1664
# coding : UTF-8
from sys import stdin

N,T = map(int,stdin.readline().rstrip().split())
#ct_list = [ list(map(int,stdin.readline().rstrip().split())) for i in range(N) ]
c_list = []
for i in range(N):
    C = stdin.readline().rstrip().split()
    if int(C[1]) <= T:
        c_list.append(int(C[0]))

def main():
    print( "TLE" if len(c_list) == 0 else min(c_list) )

if __name__ == '__main__' :
    main()

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll a[5];
  ll ans = 0;
  REP(i,5){
    ll in;
    cin >> in;
    a[i] = in%10;
    ans += in - a[i];
  }
  sort(a,a+5);
  ll mi = 10;
  REP(i,5){
    if(a[i]==0) continue;
    mi = min(mi,a[i]);
    ans += 10;
  }
  if(mi!=10){
    ans -= 10;
    ans += mi;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        double x1 = scan.nextDouble();
        double y1 = scan.nextDouble();
        double x2 = scan.nextDouble();
        double y2 = scan.nextDouble();

        double beki = Math.pow(x2-x1, 2) + Math.pow(y2-y1, 2);

        System.out.println(Math.sqrt(beki));
    }
}



Measured memory_bytes: 28068
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    sa += 'A';
    sb += 'B';
    sc += 'C';
    char ans = 'a';
    while (sa.size() > 0 && sb.size() > 0 && sc.size())
    {
        if (ans == 'a')
        {
            ans = sa[0];
            sa.erase(sa.begin());
        }
        else if (ans == 'b')
        {
            ans = sb[0];
            sb.erase(sb.begin());
        }
        else
        {
            ans = sc[0];
            sc.erase(sc.begin());
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define CIN(x) int x;cin>>x;
#define COUT(x) cout<<(x)<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define P pair<int,int>
#define V vector<int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    string s;
    cin>>s;
    s[5]=' ';
    s[13]=' ';
    COUT(s);
    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a == b + c || b == a + c || c == a + b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int num=0;
    unsigned char sign[4];
    cin >> sign;
    for(int i=0;i<4;i++)
    {
        if(sign[i] == '+')
            num++;
        if(sign[i] == '-')
            num--;
    }
    cout << num;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,d;cin>>h>>w>>d;
  int a[h][w];
  vector<pair<int,pair<int,int>>>v={};
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
      pair<int,int> p1=make_pair(i,j);
      pair<int,pair<int,int>> p2=make_pair(a[i][j],p1);
      v.push_back(p2);
    }
  }
  sort(v.begin(),v.end());
  int c[h*w+1];
  for(int i=0;i<h*w-d;i++){
    int is=v[i].second.first;
      int js=v[i].second.second;
      int ig=v[i+d].second.first;
      int jg=v[i+d].second.second;
    c[i+1]= abs(is-ig)+abs(js-jg);
  }
  int b[d][(h*w)/d+1];
  for(int i=0;i<d;i++){
    for(int j=0;j<(h*w)/d+1;j++){
      if(i+j*d>h*w)b[i][j]=0;
      else{
        if(j==0)b[i][j]=0;
        if(i==0&&j==1)b[i][j]=0;
        b[i][j]=b[i][j-1]+c[d*(j-1)+i];
      }
    } 
  }
  int q;cin>>q;
  int l[q],r[q];
  for(int i=0;i<q;i++)cin>>l[i]>>r[i];
  for(int i=0;i<q;i++){
    int ama=l[i]%d;
    int shol=l[i]/d;
    int shor=r[i]/d;
    cout<<b[ama][shor]-b[ama][shol]<<endl;
  }
}

Measured memory_bytes: 4084
N = int(input())
a = []

for n in range(1,N+1):
    S, P= map(str, input().split())
    P = int(P)
    a.append([S, P, n])

a = sorted(a, key=lambda x: (x[0], -x[1]))

for i in range(N):
    print(a[i][2])

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	t = zeros(Int,n)
	for i in 1:n
		t[i] = readline() |> parseInt
	end
	println(lcm(t))
end

main()

Measured memory_bytes: 111316
package main

import (
	"fmt"
	"sort"
)

var cs = []int{9, 2, 5, 5, 4, 5, 6, 3, 7, 6}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	as := make([]int, m)
	for i := range as {
		fmt.Scan(&as[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(as)))

	reachable := make([]bool, n+1)
	digits := make([]int, n+1)
	reachable[0] = true

	for i := range reachable {
		for _, a := range as {
			j := i - cs[a]
			if j >= 0 && reachable[j] {
				if v := digits[j] + 1; v > digits[i] {
					digits[i] = v
					reachable[i] = true
				}
			}
		}
	}

	for i := n; i != 0; {
		for _, a := range as {
			j := i - cs[a]
			if j >= 0 && reachable[j] && digits[j]+1 == digits[i] {
				fmt.Print(a)
				i = j
				break
			}
		}
	}
	fmt.Println("")
}


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

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

    vector<int> A(N);

    long total_vote = 0;
    rep(i, N)
    {
        cin >> A[i];
        total_vote += A[i];
    }

    int selected = 0;

    rep(i, N)
    {
        if (A[i] * 4 * M >= total_vote)
        {
            selected += 1;
        }
    }

    if (selected >= M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


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

using namespace std;

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

Measured memory_bytes: 256