akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string.h>
using namespace std;

int main(){
    string str1,str2,str3;
    int t_flag = 0;
    int p_flag = -1;

    cin >> str1 >> str2 >> str3;

    if(str1[0] == 'a'){
        str1.erase(str1.begin());
    }
    else if(str1[0] == 'b'){
        t_flag = 1;
        str1.erase(str1.begin());
    }
    else{
        t_flag = 2;
        str1.erase(str1.begin());
    }

    while(1){
        if(t_flag == 0){
            if(str1[0] == 'a'){
                if(str1[0] == '\0'){
                    p_flag = 0;
                    break;
                }
                t_flag = 0;
                str1.erase(str1.begin());
            }
            else if(str1[0] == 'b'){
                if(str1[0] == '\0'){
                    p_flag = 0;
                    break;
                }
                t_flag = 1;
                str1.erase(str1.begin());
            }
            else{
                if(str1[0] == '\0'){
                    p_flag = 0;
                    break;
                }
                t_flag = 2;
                str1.erase(str1.begin());
            }
        }
        else if(t_flag == 1){
            if(str2[0] == 'a'){
                if(str2[0] == '\0'){
                    p_flag = 1;
                    break;
                }
                t_flag = 0;
                str2.erase(str2.begin());
            }
            else if(str2[0] == 'b'){
                if(str2[0] == '\0'){
                    p_flag = 1;
                    break;
                }
                t_flag = 1;
                str2.erase(str2.begin());
            }
            else{
                if(str2[0] == '\0'){
                    p_flag = 1;
                    break;
                }
                t_flag = 2;
                str2.erase(str2.begin());
            }
        }
        else{
            if(str3[0] == 'a'){
                if(str3[0] == '\0'){
                    p_flag = 2;
                    break;
                }
                t_flag = 0;
                str3.erase(str3.begin());
            }
            else if(str3[0] == 'b'){
                if(str3[0] == '\0'){
                    p_flag = 2;
                    break;
                }
                t_flag = 1;
                str3.erase(str3.begin());
            }
            else{
                if(str3[0] == '\0'){
                    p_flag = 2;
                    break;
                }
                t_flag = 2;
                str3.erase(str3.begin());
            }
        }

        //cout << str1 << '\n' << str2 << '\n' << str3 << '\n' << '\n';
    }

    if(p_flag == 0){
        cout << "A\n";
    }
    else if(p_flag == 1){
        cout << "B\n";
    }
    else{
        cout <<"C\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	char A[1001],B[1001];
	int len_A,len_B;

	scanf("%s %s",A,B);

	for(len_A = 0; A[len_A] != '\0'; len_A++);
	for(len_B = 0; B[len_B] != '\0'; len_B++);

	int** dp = new int*[len_B+1];

	for(int row = 0; row <= len_B; row++){
		dp[row] = new int[len_A+1];
	}

	for(int col = 0; col <= len_A; col++){
		dp[0][col] = col;
	}

	for(int row = 1; row <= len_B; row++){
		dp[row][0] = row;
	}

	int cost;

	for(int row = 1; row <= len_B; row++){
		for(int col = 1; col <= len_A; col++){
			if(A[col-1] == B[row-1]){
				cost = 0;
			}else{
				cost = 1;
			}
			dp[row][col] = min(dp[row-1][col-1]+cost,min(dp[row-1][col]+1,dp[row][col-1]+1));
		}
	}

	printf("%d\n",dp[len_B][len_A]);

	return 0;
}



Measured memory_bytes: 7084
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        char[] c = str.toCharArray();
        for(int i = 0; i < str.length(); i++){
            if(Character.isUpperCase(c[i])){
                c[i] = Character.toLowerCase(str.charAt(i));
            }else if(Character.isLowerCase(c[i])){
                c[i] = Character.toUpperCase(str.charAt(i));
            }
        }
        StringBuilder sb = new StringBuilder();
        for(char letter: c){
            sb.append(letter);
        }
        System.out.println(sb);
    }
}


Measured memory_bytes: 24464
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N),C(N-1);
  rep(i,N){
    cin>>A[i];
    --A[i];
  }
  rep(i,N)cin>>B[i];
  rep(i,N-1)cin>>C[i];
  int ans=0;
  rep(i,N){
    ans+=B[A[i]];
    if(0<i&&A[i]==A[i-1]+1)ans+=C[A[i-1]];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <queue>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#define ll long long
#define N 1000000005
using namespace std;
int main()
{
   long long a,b;
   char op;
   scanf("%lld %c %lld",&a,&op,&b);
   if(op=='-')
   {
       printf("%d\n",a-b);
   }
   if(op=='+')
   {
       printf("%d\n",a+b);
   }
   return 0;
}


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

int main(int argc, char *argv[]) {
	int length_a = 0;
	int length_b = 0;
	int length_c = 0;
	int length_d = 0;

	std::cin >> length_a;
	std::cin >> length_b;
	std::cin >> length_c;
	std::cin >> length_d;

	int area_a = length_a * length_b;
	int area_b = length_c * length_d;

	int result = 0;
	if (area_a == area_b) {
		result = area_a;
	} else {
		result = (area_a > area_b) ? area_a : area_b;
	}
	std::cout << result << std::endl;
	return 0;
}


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

int main()
{
  int64_t N, a, ans = 0, n = 1;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> a;
    if (a == n)
      n++;
    else
      ans++;
  }
  cout << ((n == 1) ? -1 : ans) << endl;
}

Measured memory_bytes: 3588
N = int(input())
H = list(map(int, input().split()))

masu = H[:]

ans = 'Yes'
masu[0] -= 1
for i, h in enumerate(masu[:]):
    if i == 0:
        continue
    
    pre_h = masu[i-1]
    if pre_h < h:
        masu[i] -= 1
    elif pre_h == h:
        continue
    else:
        ans = 'No'
        break
print(ans)
#print(masu)

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    vector<pair<ll, ll>> pairs(n);
    REP(i, n) cin >> a[i] >> b[i];
    REP(i, n) pairs[i] = MP(b[i], a[i]);
    sort(ALL(pairs));
    ll t = 0;
    REP(i, n){
        t += pairs[i].S;
        if(t > pairs[i].F){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 9588
N,C = map(int,input().split())
T = [[0 for i in range(10**5+1)] for j in range(C)]

for i in range(N):
    s,t,c = map(int,input().split())
    T[c-1][s] += 1
    T[c-1][t] -= 1
for i in range(C):
    for j in range(10**5):
        T[i][j+1] += T[i][j]

ans = 0
for i in range(1,10**5+1):
    a = 0
    for j in range(C):
        if T[j][i] or T[j][i-1]:
            a += 1
    ans = max(ans,a)
print(ans)

Measured memory_bytes: 26800
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int f[1000005];
int ok[1000005];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a[i];
		if(ok[a[i]]) 
		{
			f[a[i]]=1;
		}
		else
		{
			ok[a[i]]=1;
			for(int j=a[i]*2;j<=1000000;j+=a[i])
			   f[j]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;++i)
	   if(!f[a[i]]) ++ans;
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 12144
N, K = map(int, input().split())
sunuke = []

for i in range(N):
    sunuke.append(0)

for j in range(K):
    
    d = int(input())
    numberL = input().split()
    numberI = []
    
    for l in range(len(numberL)):
        numberI.append(int(numberL[l]))
    
    for m in range(len(numberI)):
        sunuke[numberI[m]-1] = sunuke[numberI[m]-1] + 1   
       

count = 0        
for i in range(len(sunuke)):
    if sunuke[i] == 0:
        count = count + 1
        
print(count)
        

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

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ms(a, b) memset((a), (b), sizeof(a))
#define len(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <class T> void __f(const char* name, T&& a) {
    cerr << name << ": " << a << '\n';
}
template <class T, class... Ts> void __f(const char* names, T&& a, Ts&&... b) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << a << " /";
    __f(comma + 1, b...);
}

template <class T> bool mini(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef double db;
typedef pair<int, int> pi;
typedef pair<int, pi> ti;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ti> vti;
typedef vector<vpi> vvpi;

const int inf = (int)0x3f3f3f3f3f3f3f3f;
const int ninf = (int)0xc0c0c0c0c0c0c0c0;
const ll M = (ll)1e9 + 7;

main() {
//    freopen("CP.out", "w", stdout);
//    ios_base::sync_with_stdio(0); cin.tie(0);
    string s; cin >> s;
    deque<char> d(all(s));
    int q; cin >> q;
    int rev = 0;
    while (q--) {
        int t; cin >> t;
        if (t == 1) {
            rev ^= 1;
        } else {
            int f;
            char c;
            cin >> f >> c;
            if (!rev) {
                if (f == 2) d.push_back(c);
                else d.push_front(c);
            } else {
                if (f == 1) d.push_back(c);
                else d.push_front(c);
            }
        }
    }
    if (rev) reverse(all(d));
    for (char& c : d) cout << c;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int c[100010] = {};

int main() {

    int n; cin >> n;

    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        ++c[a];
    }

    if (n % 2 == 0) {
        for (int i = 0; i < n / 2; ++i) {
            if(c[2 * i + 1] != 2) {
                cout << 0 << endl;
                return 0;
            }
        }
    } else {
        if (c[0] != 1) {
            cout << 0 << endl;
            return 0;
        }

        for (int i = 1; i <= n / 2; ++i) {
            if(c[2 * i] != 2) {
                cout << 0 << endl;
                return 0;
            }
        }
    }

    int ans = 1;

    for (int i = 0; i < n / 2; ++i) {
        ans *= 2;
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
int main(void){
  long int n,count=0,s,i;
  scanf("%ld",&n);
  for(i=1;i<=n;i++){
    char a[100001];
    sprintf(a,"%d",i);
    s=strlen(a);
    if(s%2==1) count++;
  }
  printf("%ld",count);
  return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int a, b, x;
  cin >> a >> b >> x;

  if (x < a) cout << "NO" << "\n";
  else if (x > a + b) cout << "NO" << "\n";
  else cout << "YES" << "\n";

  return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, K;
  cin >> N >> K;
  
  ll ans = 0;
  for (int a = 1; a <= N; a++) {
    ll cb, cc;
    if (a % K == 0) {
      cb = cc = N / K;
    } else {
      cb = (N - (K - a%K)) / K + 1;
      cc = (N - a%K) / K + 1;
    }
    if ((2*a) % K == 0) {
      ans += cb * cc;
    }
  }
  cout << ans << endl;
	return 0;
}



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

int main() {
    int n, m, p, y;
    cin >> n >> m;
    vector<tuple<int, int, int>> v;
    for(int i = 0; i < m; ++i) {
        cin >> p >> y;
        v.push_back(make_tuple(p, y, i));
    }
    sort(v.begin(), v.end());
    int num = 1;
    get<1>(v[0]) = 1;
    for(int i = 1; i < m; ++i) {
        num++;
        if(get<0>(v[i]) != get<0>(v[i-1])) num = 1;
        get<1>(v[i]) = num;
    }
    for(int i = 0; i < m; ++i) swap(get<0>(v[i]), get<2>(v[i]));
    sort(v.begin(), v.end());
    for(int i = 0; i < m; ++i) 
        printf("%06d%06d\n", get<2>(v[i]), get<1>(v[i]));

    return 0;
}


Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
int main(){

  string a,b,c;
  cin >> a >> b >> c;
  char t = 'a';

  while (1) {


    if (t == 'a'&&a.empty()) {
      cout << "A" << endl;
      break;
    } else if (t == 'b'&&b.empty()) {
      cout << "B" << endl;
      break;
    } else if (c.empty()&&t == 'c') {
      cout << "C" << endl;
      break;
    }

    if (t == 'a') {//a
      t=a[0];
      a.erase(a.begin());
    } else if (t == 'b') {//b
      t=b[0];
      b.erase(b.begin());
    } else if (t == 'c'){//c
      t=c[0];
      c.erase(c.begin());
    }
  }

}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n;cin >> n;
    if(n==1){
        cout << 1 << endl;
        return 0;
    }
    vl a(n);
    rep(i,n)cin >> a[i];
    vl s(n-1);
    rep(i,n-1)s[i]=a[i+1]-a[i];
    int res = 0;
    if(s[0] > 0)res=1;
    else if(s[0]<0)res=-1;
    ll ans = 1;
    rep(i,n-1){
        if(s[i] == 0)continue;
        if(res*s[i]<0){
            ans++;
            res=0;
        }
        else res=s[i];
    }
    cout << ans << endl;
}


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

signed main()
{
  int N, K;
  int A[5005];
  bool dp1[5005][5005] = {0};
  int dp2[5005][5005] = {0};
  
  cin >> N >> K;
  for(int i = 1; i <= N; i++) cin >> A[i];
  
  dp1[0][0] = true; //左端から
  dp2[N + 1][0] = 1; //右端から

  for(int i = 1; i <= N; i++) {
    for(int j = 0; j <= K; j++) {
      if(dp1[i - 1][j]) {
	dp1[i][j] = true;
	if(j + A[i] <= K) {
	  dp1[i][j + A[i]] = true;
	}
      }
    }
  }

  for(int i = N; i > 0; i--) {
    for(int j = 0; j <= K; j++) {
      if(dp2[i + 1][j]) {
	dp2[i][j] = 1;
	if(j + A[i] <= K) {
	  dp2[i][j + A[i]] = 1;
	}
      }
    }
  }

  for(int i = 1; i <= N + 1; i++) {
    int sum = 0;
    for(int j = 0; j <= K; j++) {
      sum += dp2[i][j];
      dp2[i][j] = sum;
    }
  }
  
  int cnt = 0;
  for(int i = 1; i <= N; i++) {
    for(int j = 0; j < K; j++) {
      if(dp1[i - 1][j]) {
	int val = dp2[i + 1][K - j - 1], fr = K - j - A[i] - 1;
	if(fr >= 0) val -= dp2[i + 1][fr];
	if(val) {
	  cnt++; break;
	}
      }
    }
  }
  cout << N - cnt << endl;
  return 0;
}



Measured memory_bytes: 122624
#include<algorithm>
#include<cstdio>
#include<queue>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5;
int n, t;
int a[MAX_N];
vector<P> v;
priority_queue<P> q;

int main() {
    scanf("%d %d", &n, &t);
    int cnt = 0;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    
    int ma[n], mi[n];
    ma[n - 1] = a[n - 1]; mi[0] = a[0];
    for (int i = 1; i < n; i++) {
        mi[i] = min(a[i], mi[i - 1]);
        ma[n - i - 1] = max(a[n - i - 1], ma[n - i]);
    }
    
    int l = 0;
    for (int i = 0; i < n - 1; i++) l = max(a[i + 1] - mi[i], l);
    for (int i = 0; i < n; i++) q.emplace(a[i], n - i - 1);
    
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
        while (!q.empty() && q.top().second > n - i - 2) q.pop();
        if (q.empty()) break;
        if (q.top().first - a[i] == l) {
            ans++;
            q.pop();
        }
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 2552
Scanf.sscanf (read_line ()) "%d" (fun n ->
    let s = Array.init n (fun _ -> read_line ()) in
    let check1 sh =
        let rec loop y =
            let rec loop2 x =
                if x = n then true else
                    if s.(y).[(x + sh) mod n] = s.(x).[(y + sh) mod n] then loop2 (x + 1) else (
                        false
                    )
            in
            if y = n then true else
                if loop2 0 then loop (y + 1) else false
        in
        loop 0
    in
    let rec loop sh acc =
        if sh = n then acc * n else
            let acc = if check1 sh then acc + 1 else acc in
            loop (sh + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 4736
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   map<pii,int>m;
   for(int i=1;i<=n;i++)
   {
       string s=to_string(i);
       int x=s.length();
       int fd=s[0]-'0';
       int ld=s[x-1]-'0';
       m[{fd,ld}]++;
   }
   int ans=0;
   for(int i=0;i<10;i++)
   {
       for(int j=0;j<10;j++)
       {
           ans+=(m[{i,j}]*m[{j,i}]);
       }
   }
   cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N;
  int i;
  double en[10000000];
  char jb[10000000];
  double sum = 0;
  
  scanf("%d", &N);
  
  for(i = 0; i < N; i++){
    
    scanf("%lf %s", &en[i], &jb[i]);
    
    if(jb[i] == 'B') en[i] = en[i] * 380000.0; 
    
    sum += en[i];
    
  }
  
  printf("%.5f\n", sum);
  
  return 0;
}
  

Measured memory_bytes: 2176
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	String s = br.readLine().trim();
      	int n = s.length();
      	if(s.charAt(n-1) == 's'){
        	s = s + 'e';
          	s = s + 's';
        }
      	else{
        	s = s + 's';
        }
      	System.out.println(s);
    }
}

Measured memory_bytes: 36368
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
 
const int Maxn = 100010;
const int INF = (int) 1e9;
 
int dp[Maxn], h[Maxn];
 
int main() {
    int n, k;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    fill(dp, dp + Maxn, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < 3; ++j) {
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
 
    cout << dp[n - 1] << endl;
 
 
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n];
    unordered_map<int, ll> mp;
    rep(i, 0, n)
    {
        cin >> a[i];
        if (mp.find(a[i]) == mp.end())
        {
            mp.insert({a[i], 1});
        }
        else
        {
            int t = mp[a[i]];
            mp[a[i]]++;
        }
    }

    ll sum = 0;
    for (pair<int, ll> p : mp)
    {
        ll c = (p.second * (p.second - 1)) / 2;
        sum += c;
    }

    rep(i, 0, n)
    {
        ll t1 = ((mp[a[i]] - 1) * (mp[a[i]] - 2)) / 2;
        ll t2 = (mp[a[i]] * (mp[a[i]] - 1)) / 2;
        sum = sum - t2 + t1;

        cout << sum << endl;
        sum = sum + t2 - t1;
    }

    return 0;
}

Measured memory_bytes: 9544
#define _USE_MATH_DEFINES
 
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
	for (auto &i : a) {
		str >> i; 
	}
	return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    solve();    
}
 
const int INF = 1e18, MAXN = 3e5 + 10, MOD = 1e9 + 7;

void solve() {
	int n; cin >> n;
	string s;
	cin >> s;
	// n = len(s);

	int i = 0, cnt = 0;
	while (i < n) {
		cnt++;
		char tmp = s[i];
		while (i < n && tmp == s[i]) {
			i++;
		}
	}

	cout << cnt << endl;
}	

Measured memory_bytes: 512
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
c = [0] + list(map(int, input().split()))

ans = 0
before = 0
for num in range(1,n+1):
    ans += b[a[num]]
    if a[num] == before + 1:
        ans += c[a[num]-1]
    before = a[num]
print(ans)

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

class P
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int res = 0;
        for (int i = 0; i < N; i++)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            res += (x[1] - x[0]) + 1;
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 13268
import java.util.*;
import java.lang.*;
import java.math.*;

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

        int n = sc.nextInt();
        int[] height = new int[n];
        int[] cost = new int[n];
        for (int i = 0; i < n; i++) {
            height[i] = sc.nextInt();
        }
        cost[0] = 0;
        for (int i = 1; i < n; i++) {
            if (i == 1) {
                cost[i] = Math.abs(height[i]-height[i-1]);
            } else {           
                cost[i] = Math.min(cost[i-1] + Math.abs(height[i]-height[i-1]), 
                                    cost[i-2] + Math.abs(height[i]-height[i-2]));
            }
        }
        System.out.println(cost[n-1]);
        sc.close();
    }
}

Measured memory_bytes: 58220
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N, M, K := ReadInt(), ReadInt(), ReadInt()
	A := ReadInts(N)
	B := ReadInts(M)

	ans := 0
	sumB := Sum(B...)
	b := M
	sumA := 0
	for a := 0; a <= N; a++ {
		for sumA+sumB > K && b > 0 {
			b--
			sumB -= B[b]
		}
		if sumA+sumB <= K {
			ans = Max(ans, a+b)
		}
		if a < N {
			sumA += A[a]
		}
	}
	fmt.Println(ans)
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

func Sum(slice ...int) int {
	sum := 0
	for _, v := range slice {
		sum += v
	}
	return sum
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

char s[500][500];
int main(){
	int n;scanf("%d",&n);
	rep(i,n)scanf("%s",s[i]);
	int cnt=0;
	rep(i,n){
		bool flag=true;
		rep(j,n)rep(k,n){
			if(s[(j+i)%n][k]!=s[(k+i)%n][j])flag=false;
		}
		if(flag)cnt+=n;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
 
public class Main{
	public void solve(){
		while(true){
			int M = nextInt();
			int MIN = nextInt();
			int MAX = nextInt();
			if(M == 0) break;
			int[] SCORE = new int[M];
			for(int i = 0; i < M; i++){
				SCORE[i] = nextInt();
			}
			int gap = 0;
			int ans = 0;
			for(int i = 0; i <= 10000; i++){
				int idx = 0;
				for(int j = 0; j < M; j++){
					if(SCORE[j] >= i){
						idx++;
					}else{
						break;
					}
				}
				if(MIN <= idx && idx <= MAX){
					int g = SCORE[idx - 1] - SCORE[idx];
					if(g > gap){
						ans = idx;
						gap = g;
					}
				}
			}
			out.println(ans);
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 30036
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll dx[4] = {0, 0, 1, -1};
ll dy[4] = {1, -1, 0, 0};

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n, m;
    cin >> n;
    ll s = 0;
    ll a[n];
    rep(i, n)
    {
        cin >> a[i]; s += a[i];
    }
    cin >> m;
    ll ans = s;
    rep(i, m)
    {
        ll x,y; cin >> x >> y; x--;
        cout << s - a[x]+y << endl;
    }

}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p;y = y>>1;x = (x*x) % p;} return res; } 
 
// Debug //
 
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
// Constants //
 
 
/*** Template Ends ***/
ll n;
ll a[100005][3],cache[100005][3];
ll happiness(ll n,ll prev)
{
    if(n<1)
      return 0;
    ll i;
    if(cache[n][prev]!=-1)
      return cache[n][prev];
    cache[n][prev]=INT_MIN;
    for(i=0;i<3;i++)
    {
      if(i!=prev)
        cache[n][prev] = max(cache[n][prev],happiness(n-1,i)+a[n][i]);
    }
    return cache[n][prev];
}
void solve()
{
  cin>>n;
  ll i,j;
  ll ans = INT_MIN;
  for(i=1;i<=n;i++)
    for(j=0;j<3;j++)
    {
      cin>>a[i][j];
      cache[i][j]=-1;
    }
  for(i=0;i<3;i++)
    ans=max(ans,happiness(n-1,i)+a[n][i]);
  cout<<ans;
}
 
int main(){ 
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
 
  return 0;
}

Measured memory_bytes: 11264
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>

using namespace std;
typedef long long ll;

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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j;
  
    ll k;
    vector<ll> d;

    ll Q,N;
    string S;
    cin>>N;
    ll aa[N];
    ans=N;
    for(i=0;i<N;i++){
        cin>>aa[i];
        for(j=0;j<i;j++){
            if(aa[i]<aa[j]){
                ans=ans-1;
                break;
            }
        }
    }
    

        cout<< ans << endl;

 
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main()
{	
	int n,k,h[112345];
	cin>>n>>k;
	int res=0;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
		res+=h[i]>=k;
	}
	cout<<res<<endl;
	return 0;
}




Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}


//2
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){

ios::sync_with_stdio(false);
cin.tie(0);
int k;
cin>>k;

long long int res=0;

for(int a=1;a<=k;a++){
for(int b=1;b<=k;b++){
for(int c=1;c<=k;c++){
res+=gcd(gcd(a,b),c);
}
}
}





cout<<res<<endl;

}

//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;



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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string o,e; cin >> o >> e;
  string ans = "";
  
  rep(i,o.size()){
    ans+=o[i];
    if(i<e.size()) ans+=e[i];
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3640
n=int(input())
a=list(map(int,input().split()))

ans=[0 for _ in range(n+1)]
t=[]
S=0

for i in range(n):
  b=n-i
  c=(n-i)*2
  ch=0
  while c<=n:
    ch+=ans[c]
    c+=b
    
  if ch%2==0:
    if a[b-1]==1:
      ans[b]+=1
      S+=1
      t.append(str(b))
  else:
    if a[b-1]==0:
      ans[b]+=1
      S+=1
      t.append(str(b))
      

print(S)
if S>0:
  
  print(' '.join(t))


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll D = 60;
    ll sum = 0, cnt;
    REP(i,0,D) {
        cnt = 0;
        REP(j,0,N) {
            if((A[j] >> i) & 1) ++cnt;
        }
        sum = (sum + ((1LL << i) % MOD) * (cnt * (N - cnt) % MOD)) % MOD;
    }
    _PR(sum);

    return 0;
}

/*



*/

Measured memory_bytes: 2560
import math
inpl = lambda: list(map(int,input().split()))
a, b, x = inpl()
V = a*a*b
d = V - x
if d*2 <= V:
    theta = math.atan(2*d/(a*a*a))
else:
    theta = math.atan(a*b*b/(2*x))
print(theta*(180/math.pi))

Measured memory_bytes: 38384
/**
  @file c.cpp
  @title
  @url https://atcoder.jp/contests/abc134/tasks/abc134_c
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

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

  vector<int> A(N, 0);
  vector<int> sorted(N, 0);
  REP(i, N) {
    cin >> A[i];
    sorted[i] = A[i];
  }

  sort(ALL(sorted), std::greater<int>());

  REP(i, N) {
    if (A[i] == sorted[0]) {
      cout << sorted[1] << "\n";
    } else {
      cout << sorted[0] << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 3200
n = int(input())
ans = ['a']
for j in ans:
  if len(j) < n:
    t = list(j)
    t.sort()
    c = ord(t[-1])
    #print(c)
    for i in range(97,c+2):
      l = str(j + chr(i))
      ans.append(l)
chk = []
for i in ans:
  if len(i) == n:
    chk.append(i)
for i in chk:
  print(i)

Measured memory_bytes: 15460
L,N,*x=`dd`.split.map &:to_i
y=[r=0]+x.map{|e|L-e}.reverse
x=[0]+x
sx=[0]
sy=[0]
N.times{|i|sx<<sx[i]+x[i+1];sy<<sy[i]+y[i+1]}
N.times{|i|
	j=N-i
	k=[i,j-1].min
	r=[
		r,
		x[i+1]+2*(sx[i]-sx[i-k]+sy[j-1]-sy[j-k-1-(j-1>k ? 1 : 0)]),
		y[j]+2*(sx[i]-sx[i-k-(i>k ? 1 : 0)]+sy[j-1]-sy[j-k-1])
	].max
}
p r

Measured memory_bytes: 30908
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int N=10001;
int a[N];
int n,m,p=1e9+7;
ll ans=0;
ll power(int a,int b){
	int sum=1;
	for (; b; b>>=1){
		if (b&1)	sum=1ll*sum*a%p;
		a=1ll*a*a%p;
	}
	return sum;
}
ll calc(int n,int x){
	ll sum=1;
	for (int i=n; i>=n-x+1; i--)	
		sum=1ll*sum*i%p;
	for (int i=1; i<=x; i++)
		sum=1ll*sum*power(i,p-2)%p;
	return sum;
}
int main(){
	int a,b;
	scanf("%d%d%d",&n,&a,&b);
	ans=((power(2,n)-calc(n,a)-calc(n,b)-1)%p+p)%p;
	printf("%lld\n",ans);
	return 0;	
}

Measured memory_bytes: 256
n = int(input())
lcmn = 1
def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a
def lcm(a, b):
    return a*b//gcd(a, b)
for _ in range(n):
    t = int(input())
    lcmn = lcm(lcmn, t)
print(lcmn)

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

using namespace std;
int main(){
    int n, t;
    double a;
    cin >> n >> t >> a;
    int h[n];
    for(int i = 0; i < n; i++) cin >> h[i];

    int index = 0;
    double tmp, tikai;
    tikai = t - h[0] * 0.006;

    for(int i = 1; i < n; i++) {
        tmp = t - h[i] * 0.006;
        if(abs(a - tikai) > abs(a - tmp)){
            tikai = tmp;
            index = i;
        }
    }
    cout << index + 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

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

int keta(ll x){
    int num = 0;
    while(x > 0){
        num++;
        x /= 10;
    }
    return num;
}

int main(){
    ll N;
    cin >> N;
    int ans = INT_MAX; 
    for(ll i = 1; i*i <= N; i++){
        if(N % i == 0){
            ll x = i;
            ll y = N/x;
            ans = min(ans, max(keta(x), keta(y)));
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI 3.141592653589793
#define vi vector<int>
inline double degcos(double ang) {return cos(ang*PI/180);}
inline double degsin(double ang) {return sin(ang*PI/180);}
#define for(i,j,k,in) for (int i = j; i < k; i += in)

/*---END OF TEMPLATE---*/




int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //ifstream fin("data.in");
    //ofstream fout("data.out");
    int x;
    cin >> x;
    int tot = 0;
    tot += 1000* (x/500);
    x = x % 500;
    tot += 5 * (x/5);
    cout << tot;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define int ll
using pint = pair<int,int>;
using Graph = vector<vector<int>>;
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 1e10; //10^10
const double PI = acos(-1.0L);
/*mod逆元*/long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template< typename T >T mod_pow(T x, T n, T p=MOD) {T ret = 1;while(n > 0) {if(n & 1) (ret *= x) %= p;(x *= x) %= p;n >>= 1;}return ret;}
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}

//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n,k; cin >> n >> k;
    int ans = k;
    REP(i,n-1) ans*=(k-1);
    out(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (1000000007)
#define PI 3.14159265358979323846

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first > b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

i64 My_Comb(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  k = (n / 2 < k) ? n - k : k;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}

i64 My_Pow(u64 a, u64 n, i64 m) {
  u64 tmp = n, calc = 1;
  while (tmp > 0) {
    if (tmp % 2) {
      tmp--;
      calc *= a;
      calc %= m;
    } else {
      a *= a;
      a %= m;
      tmp /= 2;
    }
  }
  return calc;
}

class UnionFind {
 public:
  vector<u64> Par;
  vector<u64> sz;

  UnionFind(u64 n);
  u64 root(u64 x);
  bool same(u64 x, u64 y);
  void unite(u64 x, u64 y);
  u64 size(u64 x);
};

UnionFind::UnionFind(u64 n) {
  Par.resize(n);
  sz.assign(n, 1);
  for (u64 i = 0; i < n; ++i) Par[i] = i;
}

u64 UnionFind::root(u64 x) {
  if (Par[x] == x) {
    return x;
  } else {
    return Par[x] = root(Par[x]);
  }
}

bool UnionFind::same(u64 x, u64 y) { return root(x) == root(y); }

u64 UnionFind::size(u64 x) { return sz[root(x)]; }

void UnionFind::unite(u64 x, u64 y) {
  x = root(x);
  y = root(y);
  if (x == y) return;
  if (sz[x] < sz[y]) swap(x, y);
  sz[x] += sz[y];
  Par[y] = x;
}

template <typename T>
i64 BinSearch(vector<T>& V, i64 comp) {
  i64 l = 0, r = V.size() - 1;
  if (V[l] > V[r]) swap(l, r);
  if (V[l] >= comp) return l;
  if (V[r] <= comp) return r;
  while (abs(r - l) > 1) {
    i64 index = (l + r) / 2;
    if (V[index] == comp)
      return index;
    else if (V[index] > comp)
      r = index;
    else
      l = index;
  }
  if (abs(V[l] - comp) < abs(V[r] - comp))
    return l;
  else
    return r;
}

int main() {
  cout << setprecision(18);
  i64 A, B;
  cin >> A >> B;
  cout << A * B << endl;

  return 0;
}

Measured memory_bytes: 3628
x1, y1, x2, y2 = map(int, input().split())

v23 = (-(y2 - y1), x2 - x1)
x3 = x2 + v23[0]
y3 = y2 + v23[1]

v34 = (-(y3 - y2), x3 - x2)
x4 = x3 + v34[0]
y4 = y3 + v34[1]

print(x3, y3, x4, y4)

Measured memory_bytes: 3060