akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;

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

    vector<int> a(n, 0);
    vector<int> b(1000001, 0);
    vector<int> c(1000001, 1);
    

    rep(i, n){
        int x;
        cin >> x;
        a[i] = x;
        b[x]++;
    }
    
    sort(a.begin(), a.end());
    
    rep(i, n){
        
        if(c[a[i]] == 0) continue;
        if(i > 0 && a[i] == a[i - 1]) continue;
        
        for(int j = 2; j < 1000001; j++){
            if (j * a[i] > 1000000) break;
            c[a[i] * j] = 0;
        }
    }

    int count = 0;

    rep(i, n) if(b[a[i]] == 1 && c[a[i]] == 1) count++;
    
    cout << count << "\n";

    return 0;
}




Measured memory_bytes: 11552
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
int main(){
    const ll inf=1LL<<50;
    int N,M;
    ll L;
    cin>>N>>M>>L;
    vector<vector<P>> graph(N);
    REP(i,M){
        int a,b; 
        ll c;
        cin>>a>>b>>c;
        a--;b--;
        if(c>L) continue;
        graph[a].push_back(P(c,b));
        graph[b].push_back(P(c,a));
    }
    int Q;cin>>Q;
    vector<int> s(Q),t(Q);
    REP(i,Q){
        cin>>s[i]>>t[i];
        s[i]--;t[i]--;
    }
    vector<vector<P>> ans(N,vector<P>(N,P(inf,0)));
    REP(i,N) ans[i][i]=P(0,-L);
    priority_queue<PP,vector<PP>,greater<>> que;
    REP(k,N){
        ans[k][k]=P(0,-L);
        que.push(PP(P(0,-L),k));
        while(!que.empty()){
            PP p=que.top();que.pop();
            int u=p.second;
            if(ans[k][u]<p.first) continue;
            REP(j,graph[u].size()){
                int v=graph[u][j].second;
                ll a=ans[k][u].second+graph[u][j].first,b=0;
                if(a>0){
                    a=-L+graph[u][j].first;
                    b=1;
                }
                P alt=P(ans[k][u].first+b,a);
                if(alt<ans[k][v]){
                    ans[k][v]=alt;
                    que.push(PP(alt,v));
                }
            }
        }
    }
    REP(q,Q){
        if(ans[s[q]][t[q]].first==inf) cout<<-1<<endl;
        else cout<<ans[s[q]][t[q]].first<<endl;
    }
}


Measured memory_bytes: 5888
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	int count = 0;
	char C;
	cin >> S;
	C = S[0];
	for (int i = 1; i < S.size(); i++) {
		if (S[i] != C) count++;
		C = S[i];
	}
	cout << count;
}

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

int ary[1010][3];
int main(){
	priority_queue<int> que;
	int N;
	cin>>N;
	int a;
	for(int i=1;i<=N;i++){
		for(int j=0;j<=2;j++){
			cin>>a;
			que.push(a);
		}
		for(int j=0;j<=2;j++){
			ary[i][j]=que.top();
			que.pop();
		}
	}
	for(int i=1;i<=N;i++){
		if(ary[i][0]*ary[i][0]==ary[i][1]*ary[i][1]+ary[i][2]*ary[i][2]){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3052
#include <stdio.h>
#define N 100000

int Partition(int, int);
int A[N];

main()
{

  int n,i,tmp,k;
 

  scanf("%d",&n);

  for(i = 0; i < n; i++){

    scanf("%d",&A[i]);

  }
  
 k = Partition(0, n-1);
  for(i = 0; i < k; i++){
    printf("%d ",A[i]);

  }
  printf("[%d] ",A[k]);
for(i = k+1; i < n; i++){
    printf("%d",A[i]);
    if(i < n-1){
      printf(" ");
    }
  }

  printf("\n");
  return 0;
}


int Partition(p, r)
{

  int i,j,x,tmp;
 
 


  x = A[r];
  i = p-1;

  for(j = p; j <= r-1; j++){
    if(A[j] <= x){
      i = i+1;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
      
    }
  }
  
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;

}

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

char op[] = {'+', '-', '*'};
int n[16];

int cal (int n1, int n2, int t) {
    if (t == 0) return (n1 + n2);
    else if (t == 1) return (n1 - n2);
    else return (n1 * n2);
}

bool C (int a, int b, int c, int d, int i, int j, int k) {
    int t1 = cal(cal(a,b,i),cal(c,d,k),j); //cout << t1 << endl;
    int t2 = cal(cal(cal(a,b,i),c,j),d,k); //cout << t2 << endl;
    int t3 = cal(a,cal(b,cal(c,d,k),j),i); //cout << t3 << endl;
    int t4 = cal(a,cal(cal(b,c,j),d,k),i); //cout << t4 << endl;
    int t5 = cal(cal(a,cal(b,c,j),i),d,k); //cout << t5 << endl << endl;
    if (t1 == 10) {
        cout << "((" << a << " " << op[i] << " " << b << ") " << op[j] << " (" << c << " " << op[k] << " " << d << "))" << endl; 
    } else if (t2 == 10) {
        cout << "(((" << a << " " << op[i] << " " << b << ") " << op[j] <<  " " << c <<") " << op[k] << " " << d << ")" << endl; 
    } else if (t3 == 10) {
        cout << "(" << a << " " << op[i] << " (" << b << " " << op[j] << " (" << c << " " << op[k] << " " << d << ")))" << endl;  
    } else if (t4 == 10) {
        cout << "(" << a << " " << op[i] << " ((" << b << " " << op[j] << " " << c << ") " << op[k] << " " << d << "))" << endl;
    } else if (t5 == 10) {
        cout << "((" << a << " " << op[i] << " (" << b << " " << op[j] << " " << c << ")) " << op[k] << " " << d << ")" << endl;
    } else return false;
    return true;
}

int main()
{
    while (cin >> n[1] >> n[2] >> n[4] >> n[8]) {
         bool f = true;
         if (!(n[1] || n[2] || n[4] || n[8])) break;
         // 3箇所の演算子に対して総当たりをして、それぞれの括弧の付け方について考える
         // DPの方が良いかも

         for (int n1 = 1; n1 < (1 << 4); n1 <<= 1)
             for (int n2 = 1; n2 < (1 << 4); n2 <<= 1)
                 for (int n3 = 1; n3 << (1 << 4); n3 <<= 1)
                     for (int n4 =1; n4 < (1 << 4); n4 <<= 1)
                         if ((n1 | n2 | n3 | n4) == (1 << 4) - 1) 
                             for (int i = 0; i < 3; i++) {
                                 for (int j = 0; j < 3; j++) {
                                     for (int k = 0; k < 3; k++) {
                                         if (C(n[n1], n[n2], n[n3], n[n4], i, j, k)) {
                                             f = false;
                                             goto bbb;
                                         }
                                     }
                                 }
                             }
    bbb:;
         if (f) cout << "0" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1164
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

SUM = C
CNT = 0

for i in range(N):
    for j in range(M):
        SUM = SUM + A[i][j] * B[j]
    if SUM > 0:
        CNT = CNT + 1
    SUM = C

print(CNT)

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

int main()
{
    ll x;
    cin >> x;
    ll a=100;
    ll ans =0;
    while(a<x){
        a+=(a*0.01);
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import std.stdio;
import std.string;
import std.algorithm;
import std.conv;
import std.array;

void main()
{
    foreach(line; stdin.byLine)
    {
        auto nm = line.chomp.split.map!(to!int).array.sort;
        if(nm[0] == 0 && nm[1] == 0) return;
        writefln("%s %s", nm[0], nm[1]);
    }
}

Measured memory_bytes: 1240
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

struct Number {
    long long num;
    long long  count;
    Number(long long  num, long long count){
        this->num = num;
        this->count = count;
    }
    bool operator<(const Number &rs)const{
        return this->count < rs.count;
    }
};

int main(){
    long long n,k,tmp,count = 0;
    cin >> n >> k;
    vector<long long> v(200000,0);
    priority_queue<Number> pq;

    for(long long i =0;i<n;i++){
        cin >> tmp;
        v[tmp]++;
    }
    for(long long i =0;i<n;i++){
        pq.push(Number(i,v[i]));
    }
    for(long long i=0;i<k;i++){
        count += pq.top().count;
        pq.pop();
    }
    cout << n - count << endl;
}


Measured memory_bytes: 7920
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    rep(i, n) {
        int a;
        cin >> a;
        --a;
        g[i].push_back(a);
    }
    int ans = 0;
    rep(i, n) {
        for ( auto v : g[i] ) {
            for ( auto u : g[v] ) {
                if ( u == i ) ++ans;
            }
        }
    }
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 5760
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, K = get_ints

num = 0
K.step(N+1) do |k|
  num += k * N - k * k + k + 1
end

puts num % (10**9 + 7)


Measured memory_bytes: 14432
# coding: utf-8
# Your code here!
x,n = map(int,input().split())
if n==0:
    print(x)
else: 
    nums = list(map(int,input().split()))
    flag = 0
    i = 0
    while flag==0:
        if not x-i in nums:
            print(x-i)
            flag = 1
            break
        if not x+i in nums:
            print(x+i)
            flag = 1
        i += 1

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,R;
  cin >> N >> R;
  
  if(N >= 10){
    
    cout << R << endl;
    
  }
  
  else{
    
    int K = N;
    
    cout << R + 100 * ( 10 - K ) << endl;
    
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str;
 
  int count = 0;
  int last;
  last = str.size()-1;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) != str.at(last-i)) {
      count++;
    }
  }
 
  cout << count/2 << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
n = int(input())
g = [[] for _ in range(n)]

for _ in range(n-1):
    u,v,w = map(int,input().split())
    g[u-1].append((v-1,w))
    g[v-1].append((u-1,w))
    
ans = [0] * n

def dfs(v,p,c):
    ans[v] = c
    for i in g[v]:
        if i[0] != p:
            if i[1] % 2 ==0:
                dfs(i[0],v,c)
            else:
                dfs(i[0],v,1-c)

dfs(0,-1,0)

for i in ans:
    print(i)

Measured memory_bytes: 79408
# -*- coding: utf-8 -*-
# ABC155_C
import collections

N = int(input())
s = [str(input()) for _ in range(N)]

S = collections.Counter(s)
M = S.most_common()[0][1]
S = sorted(S.most_common())

for i in range(len(S)):
    if S[i][1] == M:
        print(S[i][0])


Measured memory_bytes: 50268
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, m, k;
vector<int> g[MAXN] ;
bool used[MAXN] ;
vector<int> comp;
int cnt_comp;
int cnt_adj[MAXN], com[MAXN], ans[MAXN], sz[MAXN];

void dfs(int v) {
    used[v] = true ;
    comp.push_back(v);
    for (size_t i = 0; i < (int) g[v].size(); ++i) {
        int to = g[v][i];
        if (!used[to])
            dfs(to);
    }
}

void find_comps() {
    for (int i = 0; i < n ; ++i)
        used [i] = false;
    for (int i = 0; i < n ; ++i)
        if (!used[i]) {
            comp.clear();
            dfs(i);
            for (size_t j = 0; j < comp.size(); ++j) {
            	com[comp[j]] = cnt_comp;
			}
			sz[cnt_comp++] = comp.size();
        }
}

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--; y--;
		g[x].push_back(y); g[y].push_back(x);
		cnt_adj[x]++; cnt_adj[y]++;
	}
	find_comps();
	for (int i = 0; i < n; i++) {
		ans[i] = sz[com[i]] - 1 - cnt_adj[i];
	}
	for (int i = 0; i < k; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--; y--;
		if (com[x] == com[y]) {
			ans[x]--; ans[y]--;
		}
	}
	for (int i = 0; i < n; i++) {
		printf("%d ", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int main(){
    int n, W;
    while(cin>>n>>W){
        vi wt(n), val(n);
        forn(i,n)
            cin>>wt[i]>>val[i];
        
        vvl dp(n+1, vl(W+1));
        fore(i,1,n+1){
            fore(w,1,W+1){
                dp[i][w] = dp[i-1][w];
                if(w-wt[i-1]>=0)
                    max_self(dp[i][w], dp[i-1][w-wt[i-1]] + val[i-1]);
            }
        }

        cout<<dp[n][W]<<endl;

    }
    return 0;
}

Measured memory_bytes: 80256
from collections import deque
n,m=map(int,input().split())
E=[[] for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  E[a].append(b)
  E[b].append(a)
dist=[10**7]*n
dist[0]=0
seen=[0]*n
seen[0]=1
stack=deque([0])
while stack:
  u=stack.popleft()
  for v in E[u]:
    if seen[v]!=1:
      dist[v]=min(dist[u]+1,dist[v])
      seen[v]=1
      stack.append(v)
if dist[n-1]==2:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 88396
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

//DPバージョン
int main(void){
    int N,Ma,Mb;
    scanf("%d %d %d",&N,&Ma,&Mb);
    int A[50],B[50],C[50];
    int dp[41][41*11*11*2];
    //dp[i][j]=m i番までの薬品を使ってM_a*b-M_b*a(絶対値N(=40)*Ma,Mb(=10)*max(a),max(b)(=10)=4000以下)=Jにしたときの最低のコストがmということを表す
    //Jについては、添字jについてJ=k-N*10*10とする。(kは0以上2*N*10*10以下 )
    rep(i,N)rep(j,N*10*10*2+1)dp[i][j]=INF;
    rep(i,N){
        scanf("%d %d %d",&A[i],&B[i],&C[i]);
        if(i==0){
            dp[i][N*100]=0;
            dp[i][N*100+Ma*B[i]-Mb*A[i]]=C[i];
        }
    }
    rep(i,N){
        rep(k,2*100*N+1){
            //i-1番めまでは一切使わない時の例外処理
            dp[i][ N*100+Ma*B[i]-Mb*A[i] ]=min(C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
            if(i<N-1){
                if(dp[i][k]==0)continue;//i番目までは全く使っていないものについては上で処理するので継承しない
                int newJ=Ma*B[i+1]-Mb*A[i+1];
                //i+1を使う時
                dp[i+1][k+newJ]=min(dp[i][k]+C[i+1], dp[i+1][k+newJ] );
                //i+1を使わない時
                dp[i+1][k]=min(dp[i][k],dp[i+1][k]);
            }
            
        }
    }
    
    if(dp[N-1][N*100]>=INF||dp[N-1][N*100]<=0)printf("%d\n",-1);
    else printf("%d\n",dp[N-1][N*100]);
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int h,w;
cin>>h>>w;
vector<vector<char>> a(h,vector<char>(w));
set<int> use_i,use_j;

rep(i,h){
    rep(j,w){
        cin>>a[i][j];
        if(a[i][j]=='#'){
            use_i.insert(i);
            use_j.insert(j);
        }
    }
}
rep(i,h){
    bool out=false;
    rep(j,w){
        if(use_i.count(i)&&use_j.count(j)){
            cout<<a[i][j];
            out = true;
        }
    }
    if(out)cout<<endl;
}
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;


int main(){
  int x;
  cin >> x;
  print(x*x*x);

  return 0;
}





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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;


#define F first
#define S second

#define ERR 1e-9

#if !ONLINE_JUDGE && !EVAL
    #define dbg_var(x) cerr << #x << ": " << x << "\n";
    #define dbg_iter(x, y) cerr  << #x << ": " << print_iterable(x, y) << "\n";
#else
    #define dbg_var(x)
    #define dbg_iter(x, y)
#endif // ONLINE_JUDGE

template <typename T1, typename T2>
string print_iterable( T1 begin_iter, T2 end_iter){
    bool first = true;
    stringstream res;
    res << "[ ";
    for(; begin_iter != end_iter; ++begin_iter){
        if(!first) res << ", ";
        first = false;
        res << *begin_iter;
    }
    res << " ]";
    return res.str();
}

void aggMax(int & res, int x){ if(x > res)res = x; }
void aggMin(int & res, int x){ if(x < res)res = x; }

int II(){ int i; cin >> i; return i; }
void OI(int i){ cout << i; }

// constraints
#define MAXN 1000000

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

    int H = II(), W = II();
    int h = II(), w = II();

    OI(H*W-h*W-w*(H-h));

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++){
            list.add(scanner.nextInt());
        }
        scanner.close();
        int count = 0;
        int min = list.get(0);
        for(int i=0; i<list.size(); i++){
            if(list.get(i).compareTo(min)==1){
                continue;
            }
            count += 1;
            min = list.get(i);
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 91644
#include<bits/stdc++.h>
using namespace std;
int x,y,ans,n,h[1000];


int  main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>h[i];

    for(int i=0;i<n;i++){
        for(int u=0;u<i;u++){
            if(h[i]<h[u])break;
            if(i==u+1)ans++;
        }
    }
    cout<<ans+1<<endl;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	_Bool yoko[5][4];
	_Bool tate[4][5];
	int i, j;
	int c;
	int muki;	//0 ue 1 migi 2 sita 3 hidari
	int nx, ny;
	
	i = j = 0;
	while (1) {
		scanf("%d", &c);
		for( j = 3; j >= 0; j--) {
			yoko[i][j] = c % 10;
			c /= 10;
		}
		if( i == 4)
			break;
		scanf("%d", &c);
		for( j = 4; j >= 0; j--) {
			tate[i][j] = c % 10;
			c /= 10;
		}
		i++;
	}
	
	nx = ny = 0;
	muki = 1;
	while( muki != 3 || nx != 0 || ny != 0) {
		muki = muki-1 < 0 ? 3 : muki-1;
		for (i = 0; i < 3; i++) {
			if( muki == 0 && ny > 0 && tate[ny-1][nx]) {
				ny--;
				printf("U");
				break;
			}
			if( muki == 1 && nx < 4 && yoko[ny][nx]) {
				nx++;
				printf("R");
				break;
			}
			if( muki == 2 && ny < 4 && tate[ny][nx]) {
				ny++;
				printf("D");
				break;
			}
			if( muki == 3 && nx > 0 && yoko[ny][nx-1]) {
				nx--;
				printf("L");
				break;
			}
			muki = ++muki % 4;
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 564
height,width=map(int,input().split())
masu = []
for i in range(height):
    a = input()
    if "#" in a:
        masu.append(a)
N = [0]*width
for i in masu:
    for j in range(width):
        if i[j] == "." : N[j] += 1
number = []
for i in range(width):
    if N[i] != len(masu) : number.append(i)
result=[]
for i in range(len(masu)):
    a = ""
    for j in number:
        a+=masu[i][j]
    result.append(a)
for i in result:
    print(i)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  string s,t;
  cin >> s >> t;
  vector<set<int>> w(26);
  rep(i,s.size()) w.at(s.at(i)-'a').insert(i);
  bool ck = true;
  ll ans = 0;
  int x=-1;
  int y,z;

  rep(i,t.size()){
    y=t.at(i)-'a';
    
    if(w.at(y).empty()){ 
      ck=false;
      break;
    }
    else{
      auto zz=w.at(y).lower_bound(x);
      if(zz==w.at(y).end()){
        ans++;
        x=*begin(w.at(y));
        x++;
      }
      else{
        x=*w.at(y).lower_bound(x)+1;
      }
    }
  }
  
  ans= ans*s.size() + x ;
  if(ck) cout << ans << endl;
  else cout << -1 << endl;
  
}


Measured memory_bytes: 5120
N = gets.to_i
ABC = N.times.map { gets.split.map(&:to_i) }

dp = Array.new(N + 1) { Array.new(3, 0) }

(N-1).downto(0) do |i|
  3.times.each do |j|
    max_pt = 0
    3.times.each do |k|
      max_pt = dp[i+1][k] if j != k && max_pt < dp[i+1][k]
    end
    dp[i][j] = ABC[i][j] + max_pt
  end
end

puts dp[0].max


Measured memory_bytes: 25980
#include<iostream>
using namespace std;
int main(){
	int A,B,C,D;
	int E;
	int ANS;
	cin>>E;
	A=E/1000;
	E%=1000;

	B=E/100;
	E%=100;

	C=E/10;
	E%=10;
	D=E;

	
	for(int b=-1;b<2;b+=2){
		for(int c=-1;c<2;c+=2){
			for(int d=-1;d<2;d+=2){
				ANS=A + B*b + C*c + D*d;
				if(ANS==7){
					cout<<A;
					if(b==1){
						cout<<"+"<<B;
					}else{
						cout<<"-"<<B;
					}
					if(c==1){
						cout<<"+"<<C;
					}else{
						cout<<"-"<<C;
					}
					if(d==1){
						cout<<"+"<<D;
					}else{
						cout<<"-"<<D;
					}
					cout<<"="<<"7"<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

def kock(n,p1x,p1y,p2x,p2y):
    if n == 0:
        return

    sx = (2 * p1x + 1 * p2x) / 3
    sy = (2 * p1y + 1 * p2y) / 3
    tx = (1 * p1x + 2 * p2x) / 3
    ty = (1 * p1y + 2 * p2y) / 3
    ux = (tx - sx)*math.cos(math.pi/3) - (ty - sy)*math.sin(math.pi/3) + sx
    uy = (tx - sx)*math.sin(math.pi/3) + (ty - sy)*math.cos(math.pi/3) + sy

    kock(n-1,p1x,p1y,sx,sy)
    print("%f %f"%(sx,sy))
    kock(n-1,sx,sy,ux,uy)
    print("%f %f"%(ux,uy))
    kock(n-1,ux,uy,tx,ty)
    print("%f %f"%(tx,ty))
    kock(n-1,tx,ty,p2x,p2y)
#    print("%f %f"%(p2x,p2y))

n = int(input())
p1x = 0; p1y = 0; p2x = 100; p2y = 0
print("%f %f"%(p1x,p1y))
kock(n,p1x,p1y,p2x,p2y)
print("%f %f"%(p2x,p2y))



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

int main() {
  int N;
  cin >> N;
  vector<int> ps;
  for(int i = 1; i <= N; ++i) {
    ps.push_back(i);
  }
  vector<int> as(N);
  vector<int> bs(N);
  for(int i = 0; i < N; ++i) {
    cin >> as[i];
  }
  for(int i = 0; i < N; ++i) {
    cin >> bs[i];
  }
  int a = 0;
  int b = 0;
  int idx = 0;
  do {
    if(equal(ps.begin(), ps.end(), as.begin())) {
      a = idx;
    }
    if(equal(ps.begin(), ps.end(), bs.begin())) {
      b = idx;
    }
    idx++;
  } while(next_permutation(ps.begin(), ps.end()));
  cout << abs(b - a) << endl;
  return 0;
}

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

using namespace std;

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

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

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B, C;
	set<int> s;
	cin>>A>>B>>C;
	
	s.insert(A);
	s.insert(B);
	s.insert(C);
	
	cout<<yn(s.size() == 2)<<endl;
	
	return 0;
}

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

template<class Monoid> struct SegmentTree {
    using func = function<Monoid(Monoid, Monoid)>;
    int n;
    Monoid ie;
    func f;
    vector<Monoid> node;

    SegmentTree(){};
    SegmentTree(int n, Monoid ie, func f) : n(n), ie(ie), f(f) {
        const int cn = n;
        n = 1; while(n < cn)  n *= 2;
        node.assign(2*n, ie);
    }

    void update(int i, Monoid x) {
        i += n;
        node[i] = x;
        while(i /= 2)  node[i] = f(node[2*i], node[2*i+1]);
    }

    // [l, r)
    Monoid query(int l, int r) {
        l = max(l, 0);  r = min(n, r);
        if(l >= r)  return ie;

        Monoid res = ie;
        for(l += n, r += n; l != r; l /= 2, r /= 2) {
            if(l % 2)  res = f(res, node[l++]);
            if(r % 2)  res = f(res, node[--r]);
        }
        return res;
    }

    Monoid operator[](int i) {
        assert(0 <= i && i < n);
        return node[i+n];
    }
};

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

    vector<lint> a(n);
    for(lint i=0; i<n; i++)  cin >> a[i];

    sort(begin(a), end(a));

    // 幸福度の最低値で二分探索する
    // check(x) : 幸福度がx以上の組(x, y)の個数がm以上である
    auto check = [&](lint x) {
        lint sum = 0;
        for(lint i=0; i<n; i++) {
            auto cnt = end(a) - lower_bound(begin(a), end(a), x - a[i]);
            sum += cnt;
            if(sum >= m)  break;
        }
        return (sum >= m);
    };

    lint ok = 0;
    lint ng = 1e12;
    while(abs(ok - ng) > 1) {
        lint mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    SegmentTree<lint> seg(n, 0, plus<lint>());
    for(lint i=0; i<n; i++) {
        seg.update(i, a[i]);
    }

    // ok + 1　以上のものは全て足す
    lint ans = 0;
    for(lint i=0; i<n; i++) {
        lint left = lower_bound(begin(a), end(a), (ok+1) - a[i]) - begin(a);
        lint right = end(a) - begin(a);

        ans += a[i] * (right - left) + seg.query(left, right);
        m -= (right - left);
    }

    cout << ans + m * ok << endl;
}

Measured memory_bytes: 3072
def f(x):
    alp='abcdefghijklmnopqrstuvwxyz'
    keta=1
    saidai=26
    while saidai<x:
        keta+=1
        saidai+=26**keta
        
    out=[0]*keta
    for i in range(keta):
        x-=26**i
        
    for i in range(keta):
        tmp=x//26**(keta-i-1)
        out[i]+=tmp
        x-=tmp*26**(keta-i-1)
        
    out=[alp[out[i]] for i in range(keta)]
    return out

N=int(input())
print(''.join(f(N)))

Measured memory_bytes: 9160
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
int a,b,c,d,p,x,y,s;
cin>>a>>b>>c>>d>>p;

    x=a*p;
    y=b;
	if( c<p)y=b+(p-c)*d;
    s=x;
    if( x>y)s=y;
    cout<<s<<endl;
    }

Measured memory_bytes: 3100
#include<iostream>
#include <bits/stdc++.h>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include <string>
#include <math.h>
#include <queue>
#include <stack>
typedef long long int ll;
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int main(){
    while(1){
        int n,k; cin >>n>>k;
        if(n==0&&k==0)break;
        vector<int> a(n);
        for(int i=0;i<n;i++){
            cin >>a[i];
        }
        int ans=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                if(a[i]+a[j]<=k)ans=max(ans,a[i]+a[j]);
            }
        }
        if(ans==0)cout << "NONE" << endl;
        else{cout << ans << endl;}
    }
}


Measured memory_bytes: 3064
loop do
  n = gets.to_i
  k = gets.to_i
  break if (n|k)==0
  cs = Array.new
  n.times{
    cs << gets.chomp
  }
  ns = Array.new
  cs.permutation(k).to_a.each{|ary|
    ns << ary.join
  }
  puts ns.uniq.size
end

Measured memory_bytes: 5240
import java.util.*;

class Main{

    int[][] tetoris;
    int[] height;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt();
            if(n==0) break;

            tetoris = new int[5001][5];
            height = new int[5];

            int num = 1;
            for(int i=0; i<n; i++){
                int d = sc.nextInt();
                int p = sc.nextInt();
                int q = sc.nextInt()-1;
                if(d==1) down(q, p);
                else for(int j=0; j<p; j++) down(q, 1);
            }

            int cnt = 0;
            for(int i=0; i<=5000; i++) for(int j=0; j<5; j++) if(tetoris[i][j]==1) cnt++;

            System.out.println(cnt);
        }
    }

    void down(int pos, int length){
        int max = height[pos]+1;
        for(int i=0; i<length; i++) max = Math.max(max, height[pos+i]+1);
        
        for(int i=0; i<length; i++){
            tetoris[max][pos+i] = 1;
            height[pos+i] = max;
        }

        int maxH = 0;
        for(int j=0; j<5; j++) maxH = Math.max(maxH, height[j]);

        for(int i=0; i<=max; i++){
            boolean boo = true;
            for(int j=0; j<5; j++) if(tetoris[i][j]==0) boo = false;
            
            if(boo){
                for(int j=i; j<=maxH; j++) for(int k=0; k<5; k++) tetoris[j][k] = tetoris[j+1][k];

                Arrays.fill(height, 0);
                for(int j=0; j<5; j++){ 
                    for(int k=maxH; k>=0; k--){
                        if(tetoris[k][j]==0) continue;
                        height[j] = k;
                        break;
                    }
                }
                max--;
            }
        }        
    }

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

Measured memory_bytes: 28764
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

struct Node {
  int parent = -1;
  vector<int> children;
  int depth = -1;
};

vector<Node> nodes;

void calcChildrenDepth(int id) {
  for (int child : nodes[id].children) {
    nodes[child].depth = nodes[id].depth + 1;
    calcChildrenDepth(child);
  }
}

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

  int nodeCount;
  cin >> nodeCount;
  nodes.resize(nodeCount);

  for (int i = 0; i < nodeCount; ++i) {
    int id, childCount;
    cin >> id >> childCount;
    for (int j = 0; j < childCount; ++j) {
      int childID;
      cin >> childID;
      nodes[childID].parent = id;
      nodes[id].children.push_back(childID);
    }
  }
  int rootID = 0;
  for (int i = 0; i < nodeCount; ++i) {
    if (nodes[i].parent == -1) {
      rootID = i;
      break;
    }
  }

  nodes[rootID].depth = 0;
  calcChildrenDepth(rootID);

  for (int i = 0; i < nodes.size(); ++i) {
    cout << "node " << i << ": parent = " << nodes[i].parent << ", depth = " << nodes[i].depth << ", ";
    if (i == rootID) {
      cout << "root, ";
    } else if (nodes[i].children.empty()) {
      cout << "leaf, ";
    } else {
      cout << "internal node, ";
    }
    cout << "[";
    auto& children = nodes[i].children;
    for (int j = 0; j < children.size(); ++j) {
      if (j != 0) {
        cout << ", ";
      }
      cout << children[j];
    }
    cout << "]" << endl;
  }
}



Measured memory_bytes: 7468
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int S[101], n, i;
    
    cin >> n;
    
    for(i = 0; i < n; i++){
        cin >> S[i];
    }
    
    for(i = 0; i < n; i++){
        int a = n - 1 - i;
        
        if(i == 0)
        cout << S[a];
        
        else
        cout << " " << S[a];
    }
    cout << endl;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int n;
int k;
int d[100100];
int a[100100];
int sum[100100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		scanf("%1d",&d[i]);
	for(int i=1;i<=n;i++)
		a[i]=d[i]^d[i-1];
	for(int i=1;i<=n;i++)
		sum[i]=sum[i-1]+a[i];
	int b=0;
	int res=0;
	for(int i=1;i<=n;i++){
		b^=a[i];
		int tmp=upper_bound(sum+1,sum+n+1,(k*2-!b+sum[i]))-sum;
		res=max(res,tmp-i);
	}
	cout<<res<<endl;
	return 0;
}


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

int main()
{
  int h,w;
  char JOI[101][101];
  int sum[101][101];

  cin>>h>>w;
  for(int i=0;i<101;i++)for(int j=0;j<101;j++)sum[i][j]=-1;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>JOI[i][j];
      if(JOI[i][j]=='c')sum[i][j]=0;
    }
  }

  for(int i=0;i<h;i++){
    for(int j=1;j<w;j++){
      if(sum[i][j-1]!=-1 && sum[i][j]==-1)sum[i][j]=sum[i][j-1]+1;
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w-1;j++)cout<<sum[i][j]<<" ";
    cout<<sum[i][w-1]<<endl;
  }

  return 0;
}

Measured memory_bytes: 1208
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanInt() int {
	sc.Scan(); a,_ := strconv.Atoi(sc.Text()); return a
}

func scanInt64() int64 {
	sc.Scan(); a,_ := strconv.ParseInt(sc.Text(),10,64); return a
}

func scanFloat64() float64 {
	sc.Scan(); a,_ := strconv.ParseFloat(sc.Text(),64); return a
}

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanString() string {
	sc.Buffer(make([]byte, 10000), 1000000)
	sc.Scan(); return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e); if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr); wr.Flush()
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)

	n := scanInt()

	val := n - n%2 + 1

	fmt.Println(n*(n-1)/2-n/2)

	for i := 1; i < n+1; i++ {
		for j := i+1; j < n+1; j++ {
			if i+j == val {
				continue
			}

			fmt.Fprintln(wr, i,j)
		}
	}
	wr.Flush()
}


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

using namespace std;

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

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

    int K, res;
    cin >> K;
    res = 0;

    for (int i = 1; i <= K; ++i) {
        for (int j = 1; j <= K; ++j) {
            for (int k = 1; k <= K; ++k) {
                res += gcd(gcd(i, j), k);
            }
        }
    }

    cout << res << endl;

}




Measured memory_bytes: 3652
#!/usr/bin/env python3 ## -*- python -*-
from collections import deque

def main():
    s = deque()
    s.extend(input())
    q = int(input())
    head = "l"
    for i in range(q):
        d = input()
        if d[0] == "1":
            if head == "l":
                head = "r"
            else:
                head = "l"
        else: # 2
            dd = d.split()
            f = int(dd[1])
            c = dd[2]
            if f == 1:
                if head == "l":
                    s.appendleft(c)
                else:
                    s.append(c)
            else: # f == 2
                if head == "l":
                    s.append(c)
                else:
                    s.appendleft(c)

    if head == "r":
        s.reverse()
    ans = ''.join(s)
    print(ans)
main()

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

using namespace std;

int main(int argc, const char *argv[]) {
  string ans;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      char c;
      cin >> c;
      if (i == j) {
        ans += c;
      }
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

#include<string>

using namespace std;

int main(){

  while(1){

    string s;

    int count=0;

    cin >> s;

    int judge[10000]={};

    for(int i=0;i<s.size();i++){

      if((s[i]=='q')||(s[i]=='w')||(s[i]=='e')||(s[i]=='r')||(s[i]=='t')||(s[i]=='a')||(s[i]=='s')||(s[i]=='d')||(s[i]=='f')||(s[i]=='g')||(s[i]=='z')||(s[i]=='x')||(s[i]=='c')||(s[i]=='v')||(s[i]=='b'))judge[i]=0;

      else judge[i]=1;

      if((1<=i)&&(judge[i-1]!=judge[i])) count++;

    }

    if(s[0]=='#')break;

    cout << count << endl;

  }
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define ALL(a)  (a).begin(),(a).end()

int main(){
    int n,ans;
    cin >> n;
    if(n%111==0) ans = (n/111)*111;
    else ans = (n/111 + 1)*111;
    cout << ans << endl;
}

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

void Main()
{
    int n, m;
    cin >> n >> m;
    int a = n*(n-1)/2 + m*(m-1)/2;
    cout << a << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  int N,C;
  cin>>N>>C;
  vector<vector<int>> D(C+1,vector<int>(C+1));
  for(int i(1);i<=C;i++){
    for(int j(1);j<=C;j++){
      cin>>D[i][j];
    }
  }
  int cnt[3][31] = {0};
  for(int i(1);i<=N;i++){
    for(int j(1);j<=N;j++){
      int c;
      cin>>c;
      cnt[(i+j)%3][c]++;
    }
  }
  int ans(INFint);
  for(int i(1);i<=C;i++){
    for(int j(1);j<=C;j++){
      for(int k(1);k<=C;k++){
        if(i == j || j == k || k == i) continue;
        int tmp(0);
        for(int l(1);l<=C;l++){
          tmp += D[l][i]*cnt[0][l];
          tmp += D[l][j]*cnt[1][l];
          tmp += D[l][k]*cnt[2][l];
        }
        ans = min(ans,tmp);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 * @author k17075kk
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int i = 0;
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int d = x / y;
        int r =  x % y;
        double f = 1.0 * x / y;
        System.out.println(d+" "+r+" " + String.format("%.8f", f));
    }
}


Measured memory_bytes: 26536
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		double result = 0;
		result = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
		System.out.printf("%.8f%n", result);
		sc.close();
	}
}


Measured memory_bytes: 28084
/**
   Author      : Md Jubayer Hossen Jame
   Study       : CSE, BRUR
   Date        : 22 November 2k19
   Source      : AtCoder Beginner Contest 145
   Problem link: https://atcoder.jp/contests/abc145/tasks/abc145_b
   Algorithm   :

**/

#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    if(n % 2)
    {
        cout << "No" << endl;
    }
    else
    {
        int half = n / 2;
        string temp = "";
        for(int i = 0; i < half; ++i)
        {
            temp += s[i];
        }
        temp += temp;
        if(temp == s)
        {
            cout << "Yes\n";
        }
        else
        {
            cout << "No\n";
        }
    }
    return 0;
}




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

int main() {
	int n;
	cin >> n;
	int ans = 0, p, max = 0;
	for (int i = 0; i < n; i++) {
		cin >> p;
		ans += p;
		if (p > max)max = p;
	}
	ans -= max / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int x,y;
        if(S.charAt(0) == S.charAt(1)) {
            x=2; y=3;
        } else if(S.charAt(0) == S.charAt(2)) {
            x=1; y=3;
        } else if(S.charAt(0) == S.charAt(3)) {
            x=1; y=2;
        } else {
            System.out.println("No");
            return;
        }
        if(S.charAt(x) != S.charAt(y)) {
            System.out.println("No");
            return;
        }
        if(S.charAt(0) == S.charAt(x)) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
        return;
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) ;
#define MOD 1000000007
#define ll long long 
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define ff first
#define ss second

using namespace std;

int n ;
int h[100010];
ll dp[100010];

int main(){   

fastio
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt","w", stdout);
// #endif

cin>>n;
for(int i =1 ; i<= n ;i++)cin>>h[i];

dp[1]=0;
dp[2]=abs(h[2]-h[1]);
for(int  i =3; i<=n  ;i++){
	dp[i]= min(dp[i-1]+abs(h[i] - h[i-1]) , dp[i-2] + abs(h[i] -h[i-2]));
}
cout<<dp[n];

return 0;
}


Measured memory_bytes: 1408
n, q = map(int, input().split())
A = list(map(int, input().split()))
seglen = 1
while seglen <= 2*n:
    seglen *= 2
offset = seglen//2
tree = [0] * seglen

def add(idx, x):
    idx += offset
    tree[idx] += x
    while idx > 1:
        idx //= 2
        tree[idx] = tree[2*idx] + tree[2*idx+1]

def sum_range(l, r):
    l += offset
    r += offset
    ret = 0
    while l < r:
        if l%2 == 1:
            ret += tree[l]
            l += 1
        l //= 2

        if r%2 == 1:
            ret += tree[r-1]
            r -= 1
        r //= 2
    return ret

for idx, a in enumerate(A):
    add(idx, a)

for _ in range(q):
    t, x, y = map(int, input().split())
    if t == 0:
        add(x, y)
    else:
        print(sum_range(x, y))

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

const string sY = "Yes", sN = "No";

int main(){
  int N,M,tmp;
  cin >> N >> M;
  rep(i,M){
    cin >> tmp;
    N = __gcd(N,tmp);
  }
  cout << ((N==1)?sY:sN) << endl;
  return 0;
}

Measured memory_bytes: 1196
/*

Coded by peyha X

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int NMAX=2999+1;
int n;
double dp[NMAX][NMAX],proba[NMAX];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	
	for(int i=1;i<=n;i++){
		cin >> proba[i];
		//cout << proba[i] << endl;
	}
	
	dp[0][0]=1.;
	double ans=0.;
	for(int tirage=1;tirage<=n;tirage++){
		for(int heads=0;heads<=tirage;heads++){
			dp[tirage][heads]=0.;
			if(heads>0){
				dp[tirage][heads]+=proba[tirage]*dp[tirage-1][heads-1];
			}
			dp[tirage][heads]+=(1.-proba[tirage])*dp[tirage-1][heads];
			
			if(tirage==n && heads>=n-heads){
				ans+=dp[tirage][heads];
			}
			//cout << (1.-proba[tirage])*dp[tirage-1][heads] << ' ' << (proba[tirage]) << ' ';
		}
		//cout << endl;
	}
	cout << setprecision(15) << ans << '\n';
	
}


Measured memory_bytes: 68992
#include<bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
const int N = 2e6+100;
pair<int,int> cnt[N];
int main(){
	int n;
	cin>>n;
	vector<string> s(n+1);
	vector<pair<int,int> > pos,neg;
	rep(i,1,n){
		int minn=0;// I should have -minn opening brackets before take it
		int balance=0;// after take it ,  i can add balance to sum
		cin>>s[i];
		for(char c:s[i]){
			if(c=='(') ++balance;
			else --balance;
			minn=min(minn,balance);
		}
		int need=-minn,get=balance;
		if(balance>=0) pos.push_back({need,get});
		else{
			neg.push_back({need,get});
		}
	}
	sort(pos.begin(),pos.end());
	sort(neg.begin(),neg.end(),[](const pair<int,int> a,const pair<int,int> b){
		return a.first+a.second>b.first+b.second;
	});
	int now=0;
	for(auto v:pos){
		if(now<v.first){
			cout<<"No"<<endl;
			return 0;
		}
		now+=v.second;
	}
	for(auto v:neg){
		if(now<v.first){
			cout<<"No"<<endl;
			return 0;
		}
		now+=v.second;
	}
	if(now){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 42524