akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n = 3;
    int k;
    vector<int> m(n);
    vector<vector<long long> > v(n);
    for(int i=0; i<n; ++i)
        cin >> m[i];
    cin >> k;
    for(int i=0; i<n; ++i){
        v[i].resize(m[i]);
        for(int j=0; j<m[i]; ++j)
            cin >> v[i][j];
        sort(v[i].rbegin(), v[i].rend());
    }

    long long init = 0;
    for(int i=0; i<n; ++i)
        init += v[i][0];

    priority_queue<pair<long long, vector<int> > > pq;
    set<vector<int> > history;
    pq.push(make_pair(init, vector<int>(n, 0)));
    history.insert(vector<int>(n, 0));
    while(--k >= 0){
        long long sum;
        vector<int> index;
        tie(sum, index) = pq.top();
        pq.pop();
        cout << sum << endl;

        for(int i=0; i<n; ++i){
            if(index[i] == m[i] - 1)
                continue;
            vector<int> index2 = index;
            ++ index2[i];
            if(history.find(index2) == history.end()){
                long long sum2 = sum - v[i][index[i]] + v[i][index2[i]];
                pq.push(make_pair(sum2, index2));
                history.insert(index2);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }

int N,a[3010];

int dp[3010][3010];
const int INF=1e18;

int rec(int i,int j)
{
    if(i==j) return 0;
    if(dp[i][j]!=INF) return dp[i][j];

    int res;
    if(N%2==(j-i)%2){
        res=max(rec(i+1,j)+a[i],rec(i,j-1)+a[j-1]);
    }else{
        res=min(rec(i+1,j)-a[i],rec(i,j-1)-a[j-1]);
    }
    return dp[i][j]=res;
}   
    
signed main()
{   
    cin>>N; 
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            dp[i][j]=INF;
        }
    }
    cout<<rec(0,N)<<endl;
}  

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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n && i <= 200; i += 2)
    {
        int c = 0;
        for (int j = 1; j <= i; j++) if (i % j == 0) c++;
        if (c == 8) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 384
import itertools
import math
N = int(input())
xy = []
for _ in range(N):
    xy.append(list(map(int,input().split())))
    
alls = list(itertools.permutations(range(1,N+1))) #順列全て
def length(X,Y): #XとYの距離
    l = math.sqrt((X[0]-Y[0])**2 + (X[1]-Y[1])**2)
    return l
Nk = math.factorial(N) #Nの階乗

L = 0
for i in range(Nk):
    l = 0
    for j in range(N-1):
        c1 = xy[alls[i][j]-1]
        c2 = xy[alls[i][j+1]-1]
        l += length(c1,c2)
    L += l
    
print(L/Nk)

Measured memory_bytes: 48108
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
int main()
{
    lld n;
    cin>>n;
    lld ar[n],i;
    for(lld i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    lld m=INT_MAX;
    lld ctr=0;
    for(i=0;i<n;i++)
    {
        if(ar[i]<m)
            ctr++;
            m=min(m,ar[i]);
    }
    cout<<ctr<<endl;
}


Measured memory_bytes: 1792
INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[len(S)][5])

Measured memory_bytes: 62428
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}
void sort(int A[],int n){
  int i,j,v;
  for(i=1;i<=n;i++){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    
    A[j+1]=v;
    trace(A,n);
  }
}
int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
 
  sort(A, n);
 
  return 0;
}

Measured memory_bytes: 608
#include <iostream>

using namespace std;

int main(void) {
    int n;

    cin >> n;

    for (int i = 0; i <= n/7; i++) {
        if ((n-7*i)%4 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())

if n == 1:
    print("Yes")
    exit()

h = list(map(int, input().split()))
highest = h[-1]
for hi in h[-2::-1]:
    if hi - highest >= 2:
        print("No")
        exit()
    elif hi - highest == 1:
        pass
    else:
        highest = hi
print("Yes")


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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

int use[10000][750];

int main(){
  int n, m;
  while(cin >> n >> m and n + m){
    memset(use, 0, sizeof(use));
    vector<int> logs[m];
    int machine[m] = {0};
    int r; cin >> r;
    REP(i, r){
      int tr, nr, mr, sr; cin >> tr >> nr >> mr >> sr;
      mr--;
      if(sr){
        if(machine[mr] == 0) logs[mr].push_back(tr);
        machine[mr]++;
      }else{
        machine[mr]--;
        if(machine[mr] == 0) logs[mr].push_back(tr);
      }
    }
    REP(i, m) REP(j, logs[i].size()){
      int from = logs[i][j] - 540;
      int to = logs[i][++j] - 540;
      for(int k = from+1; k < to+1; k++) use[i][k] = 1;
    }
    REP(i, m) REP(j, 749) use[i][j+1] += use[i][j];
    int q; cin >> q;
    REP(i, q){
      int ts, te, mq;
      cin >> ts >> te >> mq;
      mq--;
      cout << use[mq][te-540] - use[mq][ts-540] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 32728
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int N = s.length();
    int zero_count = 0,one_count=0;
    rep(i,N){
        if(s[i]=='0') zero_count++;
        else one_count++;
    }
    cout << min(one_count,zero_count) * 2 << nn;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

template <typename T> ostream& operator<<(ostream& out, vector<T> &v){
  for (int i = 0; i < (int)v.size(); i++) {
    out<<v[i]<<' ';
  }
  return out;
}

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

  int n, k;
  cin >> n >> k;
  vector<int> ans(n);
  while(k--){
    int d; cin >> d;
    while(d--){
      int num; cin >> num;
      ans[num - 1]++;
    }
  }
  int final = 0;
  for(int i = 0; i < n; i++){
    if(ans[i] == 0){
      final++;
    }
  }
  cout << final;

  return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int[] x = new int[a];

		int max = 0;
		int counter = -1;
		int answer = 0;
		for(int i =0; i<a; i++) {
			x[i] = sc.nextInt();

		}
		for(int i=0; i<a; i++) {
			if(x[i]>max) {
			max = x[i];
			counter = i;
			}
		}

		for(int i=0; i<a; i++) {
			if(i == counter) answer = answer + x[i]/2;
			else answer = answer + x[i];

		}

		System.out.print(answer);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }
#define output(x) cout << x << endl;

bool compare(const pair<int, int>& F, const pair<int, int>& S) {
    return F.second < S.second;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> bridge;
    int a, b;
    for (int i = 0; i < M; ++i) {
        cin >> a >> b;
        bridge.emplace_back(make_pair(a, b));
    }
    sort(bridge.begin(), bridge.end(), compare);

    int ans = 0;
    int temp = 0;
    for (int i = 0; i < M; ++i) {
        if(bridge[i].first < temp) continue;
        ++ans;
        temp = bridge[i].second;
    }

    cout << ans << endl;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(abs(a-b)%2 == 0) cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
ll const mod = 998244353;
const ll MAX = 300000;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
int main() {
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    vs ans;

    rep(i, 26) {
        char now = (char)(i + 'a');
        rep(j, n) {
            if (now == s[j]) {
                string t;
                for (int a = 0; a < k && a + j < n; a++) {
                    t += s[j + a];
                    ans.push_back(t);
                }
            }
        }
        sort(ans.begin(), ans.end());
        ans.erase(unique(ans.begin(), ans.end()), ans.end());
        if (ans.size() >= k)break;

    }

    
    cout << ans[k - 1] << endl;


    return 0;
}

Measured memory_bytes: 1660
a,b,c,d=map(int,input().split())
C=b//c
D=b//d
import fractions
CD=b//(c*d//(fractions.gcd(c,d)))
B=b-C-D+CD
C_=(a-1)//c
D_=(a-1)//d
C_D_=(a-1)//(c*d//(fractions.gcd(c,d)))
A=a-1-C_-D_+C_D_
print(B-A)


Measured memory_bytes: 5232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int N = rei();
	cout << (N-rei()+1)*(N-rei()+1) << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

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

int main(void){
    int N,A;
    cin>>N>>A;
    while(N>=500)
        N-=500;

    if(N<=A){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>

using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int tmp = (h2 * 60 + m2) - (h1 * 60 + m1) - k;
    cout << max(tmp, 0) << endl;
}

Measured memory_bytes: 3636
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int l,r;
  cin >> l >> r;

  bool f = false;
  FOR(i,l,r+1){
    if(i%2019 == 0) {f = true; break;}
  }
  if(f) cout << 0 << endl;
  else{
    int ans = 2019;
    FOR(i,l,r){
      FOR(j,i+1,r+1) ans = min(ans,i%2019*j%2019);
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=2e5+51;
struct Edge{
	ll to,prev;
};
Edge ed[MAXN];
ll n,tot,from,to;
ll last[MAXN],x[MAXN],dp[MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
inline void addEdge(ll from,ll to)
{
	ed[++tot].prev=last[from];
	ed[tot].to=to;
	last[from]=tot;
}
inline void dfs(ll node,ll fa)
{
	dp[node]=0;
	for(register int i=last[node];i;i=ed[i].prev)
	{
		if(ed[i].to!=fa)
		{
			dfs(ed[i].to,node);
			if(!dp[ed[i].to]&&x[node]>x[ed[i].to])
			{
				dp[node]=1;
			}
		}
	}
}
int main()
{
	n=read();
	for(register int i=1;i<=n;i++)
	{
		x[i]=read();
	}
	for(register int i=1;i<n;i++)
	{
		from=read(),to=read();
		addEdge(from,to),addEdge(to,from);
	}
	for(register int i=1;i<=n;i++)
	{
		memset(dp,0,sizeof(dp)),dfs(i,0);
		if(dp[i])
		{
			printf("%d ",i);
		}
	}
}

Measured memory_bytes: 1152
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

def int_input():
    return int(input())


def print_ans(string):
    print(string)
    exit()

def yes():
    print("Yes")
    exit()

def no():
    print("No")
    exit()



K=int_input()
A,B=input_int_list()

if B<K:
    print_ans("NG")
else:
    for i in range(A,B+1):
        if i%K==0:
            print_ans("OK")

print_ans("NG")


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const int mod=772002;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
//LL powmod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
LL dp[55][55][2600];
int x[55];
int main()
{
    int n,a;
    cin>>n>>a;
    for(int i=1;i<=n;i++) cin>>x[i];
    dp[0][0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<i;j++){
            for(int k=0;k<=2500;k++){
                if(dp[i-1][j][k]){
                    dp[i][j+1][k+x[i]]+=dp[i-1][j][k];
                    dp[i][j][k]+=dp[i-1][j][k];
                }
            }
        }
    }
    LL ans=0;
    for(int i=1;i<=n;i++) ans+=dp[n][i][i*a];
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9600
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int r,g,b,n;
    cin >> r >> g >> b >> n;

    long pattern = 0;
    for(int ri = 0 ; ri <= (n / r) ; ri++){
        for(int gi = 0; gi <= (n / g) ; gi++){
            int left = n - ri * r -gi * g;
            if(left < 0){
                continue;
            }
            if(left % b == 0){
                pattern++;
            }
        }
    }

    cout << pattern << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  int K, N;
  cin >> N >> K >> S;
  K--;
  if (S.at(K) == 'A')S.at(K) = 'a';
  if (S.at(K) == 'B')S.at(K) = 'b';
  if (S.at(K) == 'C')S.at(K) = 'c';
  cout << S << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str;
	cin>>str;
	vector<string> w({"Sunny","Cloudy","Rainy","Sunny"});
  	for(int i=0;i<3;i++)
    {
      if(w[i]==str)
      {
        cout<<w[i+1]<<endl;
        return 0;
      }
    }
}
  

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, string c = ", ") {
  for (auto i : v) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

vector<vector<int>> m(105, vector<int>(105));
signed main()
{
  int h = in(), w = in();
  string table[h];
  rep(i, h) fill(m[i].begin(), m[i].end(), -1);
  rep(i, h) cin >> table[i];
  rep(i, h){
    rep(j, w){
      if (table[i][j] == 'c') m[i][j + 1] = 0;
      else if (m[i][j] != -1) m[i][j + 1] = m[i][j] + 1;
    }
  }
  rep(i, h){
    reps(j, 0, w){
      if (j != 0) cout << " ";
      cout << m[i][j + 1];
    }
    cout << endl;
  }

  return (0);
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
 
int main() {
	int a;
	string s;
	cin >> a >> s;
	if (a < 3200) cout << "red" << endl;
	else cout << s << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n), s(n + 1, 0);
  rep(i, n) cin >> a[i];
  sort(all(a));
  rep(i, n) s[i + 1] = s[i] + a[i];
  ll ans = 1;
  for(ll i = n - 2; i >= 0; i--) {
    if(s[i + 1] * 2 < a[i + 1]) break;
    ans++;
  }
  cout << ans << endl;
}

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

int main() {
	string s;
	cin>>s;
	set<char> m;
	set<char>::iterator itr;
	for(int i=0;i<s.size();i++){
		m.insert(s[i]);
	}
	if(m.size()==2){
		itr=m.begin();
		int count=0;
		for(int i=0;i<s.size();i++){
			if(*itr==s[i]) count++;
		}
		if(count==2) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv;
import std.string;
import std.algorithm, std.container.rbtree;

void main()
{
    auto buf = readln.chomp.split.to!(size_t[]);
    immutable
        as = buf[0],
        bs = buf[1],
        qs = buf[2];
    auto
        a = as.readArray.redBlackTree,
        b = bs.readArray.redBlackTree,
        q = qs.readArray;
    foreach (dummy; [-100_0000_0000, +200_0000_0001])
    {
        a.insert(dummy);
        b.insert(dummy);
    }
    foreach (query; q)
    {
        auto
            ar = a.upperBound(query).front,
            al = a.lowerBound(query).back,
            br = b.upperBound(query).front,
            bl = b.lowerBound(query).back;
        debug stderr.writefln("%d:%d:%d %d:%d:%d",
                al, query, ar, bl, query, br);
        auto
            ll = query - al.min(bl),
            rr = ar.max(br) - query,
            rl = (ar < br) ?
                ((ar - query) + ar - bl) :
                ((br - query) + br - al),
            lr = (al < bl) ?
                ((query - bl) + (ar - bl)) :
                ((query - al) + (br - al));
        debug stderr.writefln("<<%d >>%d ><%d <>%d",
                ll, rr, rl, lr);
        ll.min(rr).min(rl).min(lr).writeln;
    }
}

long[] readArray(in size_t n)
{
    auto ret = new long[n];
    foreach (ref elem; ret)
        elem = readln.chomp.to!long;
    return ret;
}


Measured memory_bytes: 20732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;


#define LETS_GET_SCHWIFTY ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
#define ff              first
#define ss              second
#define int             long long
#define ll              long long
#define ld              long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}
#define show(arr,x,y)   for(int i=x;i<=y;i++){cout<<arr[i]<<" ";}cout<<"\n"
#define sz(x)           (int)x.size()
#define db(x)           cout<<x<<"\n";

const int N = 2e5 + 5;

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define deb(...)
#endif

	
//////////////////////////////code//////////////////////////////

int n;
vector<ld> arr;
vector<vector<ld> >dp;

ld sol(int i,int j)
{
    if(i==n)
    {
      if(j <= n/2)
      return 1.0;
      else
      return 0.0;
    }
    
    if(dp[i][j]!=-1.0)
     return dp[i][j];
    
    ld a1 = 1.0 ,a2 = 1.0;
    
    if(j-1>=0)
    a1 = arr[i]*sol(i+1,j-1);
    
    a2 = (1.0-arr[i])*sol(i+1,j);
    
    return dp[i][j] = (a1+a2);
}



void solve()
{
  //  cout << "-------------------" << "\n";

    cin>>n;
    
    dp = vector<vector<ld> >(n+1,vector<ld>(n+1,-1.0));
    arr = vector<ld>(n+1);
    
    for(int i=0;i<n;i++)
    cin>>arr[i];
    
    ld ans = 0.0;
    
    ans = sol(0,n);
   
   cout<<ps(ans,10)<<"\n";
    
 

  //  cout << "-------------------" << "\n";

}

int32_t main()
{

    LETS_GET_SCHWIFTY;

    int t = 1;
    //cin >> t;

    while (t--)
        solve();

}

// check out for following mistakes-
// if using pb operation on vector and then trying to access index..check if sizeof that vec could remain 0 only
// is using prime sieve make sure it fits
// when using factorial template or combinatorics make sure that you edit fillfac fun values and array values


Measured memory_bytes: 144808
#include <stdio.h>
#define max(a,b) ((a) > (b) ? (a) : (b))
int main()
{
 int a, b, c;
 scanf("%d%d%d", &a, &b, &c);
 int maxVal = max(max(a,b),max(b,c));
 if(maxVal == a)
 {
  if(maxVal - b == c)
   printf("Yes");
  else
   printf("No");
 }
 else if(maxVal == b)
 {
  if(maxVal - a == c)
   printf("Yes");
  else
   printf("No");
 }
 else if(maxVal == c)
 {
  if(maxVal - b == a)
   printf("Yes");
  else
   printf("No");
 }
 else
  printf("No");
 putchar(10);
 fflush(stdout);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
    ll N;
    cin>>N;
    ll i=1;
    while(i*i<=N) {
        i+=1;
    }
    
    i--;
    cout<<i*i<<endl;

   

    }

Measured memory_bytes: 3648
// AtCoder154 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

int main() {

    int n, i, m;
    int* a; // 動的メモリの先頭アドレス用のポインタ
    int sum = 0;
    assert(scanf("%d %d", &n, &m) == 2);

    // malloc:確保したメモリの先頭アドレスを返す
    a = (int*)malloc(sizeof(int) * m);
    for (i = 0; i < m; i++) {
        assert(scanf("%d", &a[i]) == 1);
        sum += a[i];
    }

    sum = n - sum;
    if (sum >= 0) {
        printf("%d", sum);
    }
    else {
        printf("-1");
    }
    free(a);

    return 0;
}

Measured memory_bytes: 1764
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pb push_back
#define F first
#define S second
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define one(x) cout<<#x<<" : "<<x<<endl;
#define two(x,y) cout<<#x<<" : "<<x<<" , "<<#y<<" : "<<y<<endl;
#define three(x,y,z) cout<<#x<<" : "<<x<<" , "<<#y<<" : "<<y<<" , "<<#z<<" : "<<z<<endl;
#define PI acos(-1)
const int M = 1000000007;
const int N=3e5+5;


signed main()
{
    double x;
    cin >> x;
    double a = x/3;
    cout<<setprecision(10)<<a*a*a<<endl;
}




Measured memory_bytes: 256
use proconio::{input, fastout};
use std::collections::BTreeMap;

#[fastout]
fn main() {
    input! {
        n: usize, k: usize,
        arr: [(usize, usize); n],
    }

    let mut bmap: BTreeMap<usize, usize> = BTreeMap::new();
    for (a,b) in arr {
        if let Some(x) = bmap.get_mut(&a) {
            *x += b;
        } else {
            bmap.insert(a, b);
        }
    }

    let mut j = 0;
    for (a, b) in bmap {
        j += b;
        if j>=k { println!("{}", a); break; }
    }
}


Measured memory_bytes: 6424
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
 
n = int(input())
#n = [int(i) for i in readline().split()]
 
g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append(b-1)
    g[b-1].append(a-1)
 

#from collections import deque

cnt = [-1]*n
parent = [-1]*n

q = [0]
order = []
while q:
    v = q.pop()
    order.append(v)
    for c in g[v]:
        if parent[v] != c:
            parent[c] = v
            q.append(c)

MOD = 10**9+7

pow2 = [1]
for i in range(n):
    pow2.append(pow2[-1]*2%MOD)


num = [0]*n
ans = 0
for v in reversed(order):
    res = 1
    nokori = n-1
    for c in g[v]:
        if c != parent[v]:
            nc = num[c]+1
            res += pow2[nc] - 1
            num[v] += nc
            nokori -= nc
            #print(c,v,nc)
    res += pow2[nokori] - 1
    #print(res,nokori)
    ans += pow2[n-1]-res 

#print(parent)
#print(num)
#print(pow2)

R = (MOD+1)//2

print(ans*pow(R,n,MOD)%MOD)


            
            
        
    
    






Measured memory_bytes: 94548
#include <iostream>

using namespace std;

int main(void)
{
	int R[200000], n;
	int maxv, maxR;

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> R[i];
	}
	
	maxR = R[n-1];
	maxv = R[n-1]-R[n-2];
	
	for(int i=2;i<n+1;i++){
		maxv = max(maxv, maxR - R[n-i]);
		maxR = max(maxR, R[n-i]);
	}
	
	cout << maxv << endl;
	return 0;
}

Measured memory_bytes: 1940
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



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

  int ans=K;
  for(int i=1;i<N;i++){
    ans*=K-1;
  }

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


Measured memory_bytes: 256
import bisect
s = input()
t = input()

l = len(s)
d = dict()
for i in range(l):
    if s[i] in d.keys():
        d[s[i]].append(i+1)
    else:
        d[s[i]] = [i+1]

ans = 0
now = 0
for i in t:
    if i not in d.keys():
        print(-1)
        exit()

    a = bisect.bisect_right(d[i], now)
    if a == len(d[i]):
        now = d[i][0]
        ans += l
    else:
        now = d[i][a]

print(ans + now)


Measured memory_bytes: 7668
#include <stdio.h>

int main() {
    int N, a, b, y=0;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        a = N % i;
        if (a == 0) {
            b = N / i;
            if ((i <= 9) && (b <= 9)) {
                y = 1;
            }
        }
    }
    if (y == 1) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner; 
 
 
 public class Main { 
 	public static void main(String[] args) { 
 		Scanner scn = new Scanner(System.in); 
 	int n = scn.nextInt(); 
		int debt = 100; 
 		for (int i = 0; i < n; i++) { 
 			debt = (int)Math.ceil(debt * 1.05); 
		} 
		System.out.println(debt * 1000); 
 	} 
} 

Measured memory_bytes: 25992
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  int k;
  cin>>n>>k;
  if(k<=(int)ceil((double)n/2))cout<<"YES";
  else cout<<"NO";

  return 0;
}


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

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

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

	int tmp = vec[0]; 
	int ans = 1;
	for (int i = 1; i < n; i++) {
		if (vec[i] <= tmp) {
			tmp = vec[i];
			++ans;
		}
	}

	cout << ans;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define N 100
void swap(int *, int *);

int main(void){
  int i, j, n, a[N], c=0;
  scanf("%d", &n);
  for(i=0; i < n; i++) scanf("%d", &a[i]);
  for(i=0; i < n; i++){
    
    for(j = n - 1; j > i; j--){
      if(a[j] < a[j-1]){
	swap(&a[j],  &a[j-1]);
	  c++;
      }
    }
  printf("%d", a[i]);
  if(i < n-1) printf(" ");
  }

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

void swap(int *a, int *b){
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = min(b - 1, n);
  cout << a * x / b << endl;
  return(0);
}


Measured memory_bytes: 3608
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1001001001;

int main() {
	int n;
	cin >> n;
	map<string,int> data;
	rep(i, n) {
		string s;
		cin >> s;
		data[s]++;
	}
	vector<pair<int, string>> a;
	for (auto c : data) {
		//now = {int , string}
		auto now = make_pair(c.second, c.first);
		a.push_back(now);
	}
	sort(a.begin(), a.end());
	int m = a.size();
	int max = a[m - 1].first;
	stack<string> ans;
	rep(i, m) {
		if (a[m - i - 1].first == max) {
			ans.push(a[m - i - 1].second);
		}
	}
	while (!ans.empty()) {
		cout << ans.top() << endl;
		ans.pop();
	}
}

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

signed main(){
  int N,K;
  cin>>N>>K;
  if(K%2){
    cout<<(N/K)*(N/K)*(N/K)<<endl;
  }
  else{
    int a=N/K;
    int ans=a*a*a;
    if(N-(N/K)*K>=K/2)a++;
    ans+=a*a*a;
    cout<<ans<<endl;
  }
}


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

public class Main {

    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int arr[] = new int[n];
        for(int i=0; i<n; i++) arr[i] = sc.nextInt();
        for(int i=k,j=0; i<n; i++,j++){
            if(arr[i] > arr[j]) out.println("Yes");
            else out.println("No");
        }
    }

    private static int lcm(int a, int b) {

        return (a * b) / gcd(a, b);
    }

    private static int gcd(int a, int b) {

        if (b == 0)
            return a;

        return gcd(b, a % b);
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in, out);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

class Pair {
    int x, y;

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

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

class Tuple implements Comparable<Tuple> {
    int x, y, z;

    public Tuple(int x, int y, int z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public int compareTo(Tuple t) {
        if (this.z == t.z) {
            if (this.y == t.y) {
                return t.x - this.x;
            } else return t.y - this.y;
        } else
            return this.z - t.z;
    }


}

Measured memory_bytes: 56132
"""
A - Frog 1
"""

import numpy as np

class DP():
    def __init__(self):
        pass
    
    def chmin(self, a, b):
        if a>b:
            return b
        else:
            return a
        
    def chmax(self):
        if a<b:
            return b
        else:
            return a
        
# K = int(input())
N = int(input())
cost_list = list(map(int, input().split()))
# cost_list = [2, 9, 4, 5, 1, 6, 10]
# N = len(cost_list)
K = 2

dpfun = DP()
dp = np.ones(N) * np.inf
# INF = 2**60
# dp = [INF]*N
" 初期条件 "
dp[0] = 0

for i in range(1, N, 1):
    if i==1:    
        dp[i] = dpfun.chmin(dp[i], dp[i-1] + abs(cost_list[i] - cost_list[i-1]))
    else:
        for j in range(1, K+1, 1):
            dp[i] = dpfun.chmin(dp[i], dp[i-j] + abs(cost_list[i] - cost_list[i-j]))
print(int(dp[-1]))

Measured memory_bytes: 22804
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,l,r)for(int i=(int)l;i<(int)r;i++)
#define rep(i,n)Rep(i,0,n)
typedef long long lld;
typedef long double Lf;
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define N 100001

int main() {
	lld a,ans=0;Lf b;
	scanf("%lld%Lf", &a,&b);
	if (!a || !b)printf("0");
	else {
		lld a100,a10,a1,a01,a02,b100, b10, b1;
		b100 = b;
		b10 = (b - b100) * 10;
		b1 = (int)(b * 100) % 10;
		a100 = a;
		a10 = a / 10;
		a1 = a / 100;
		a02 = (a % 10) * b1;
		a01 = ((a % 100) / 10) * b1 + (a % 10) * b10;
		ans += (a02 + a01 * 10) / 100;
		ans += a100 * b100 + a10 * b10 + a1 * b1;
		printf("%lld", (lld)(a*b));
		//printf("%lld %lld %lld %lld %lld %lld\n",b100,b10,b1,a100,a10,a1);
		//printf("%lld", ans);
	}
}

Measured memory_bytes: 1752
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  int Max = a[0], Min = a[0];
  for(int i = 1; i < N; i++){
    Max = max(Max,a[i]);
    Min = min(Min,a[i]);
    //cout << Max << " " << Min << endl;
  }
  cout << Max - Min << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
for bit in range(1<<len(s)-1):
  f = s[0]
  
  for i in range(len(s)-1):
    if (bit>>i) & 1:
      f += '+'
    else:
      f += '-'
    f += s[i+1]
  
  if eval(f) == 7:
    print(f+'=7')
    exit()

Measured memory_bytes: 9040
object Main{
  def main(args: Array[String]){
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString("\n");
      println(solve(input).trim());
    }
  }

  def solve(input:String):String={
    if(f(input.toList.reverse)){
      "YES"
    }else{
      "NO"
    }
  }

  def f(s:List[Char]):Boolean={
    s match{
      case List('m','a','e','r','d',x @ _*)=>f(x.toList)
      case List('r','e','m','a','e','r','d',x @ _*)=>f(x.toList)
      case List('e','s','a','r','e',x @ _*)=>f(x.toList)
      case List('r','e','s','a','r','e',x @ _*)=>f(x.toList)
      case List()=>true
      case _=>false
    }
  }
 
  val tests=List("""erasedream""" -> """YES""",
    """dreameraser""" -> """YES""",
"""dreamerer"""->"""NO""");
 
  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}.zipWithIndex.map{case ((input,outputExpect),i)=>{
      val output=solve(input).trim();
      s"test${i+1}:"+(if(output==outputExpect){
        "Passed"
      }else{
        s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
      })
    }}.mkString("\n");
  }
}

Measured memory_bytes: 35424
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/**
*   author: j o s e m a g o
*   user: m a m i s a k i
**/
using namespace std;

/***PLANTILLA***/

using namespace __gnu_pbds; //*st.find_by_order(1);  st.order_of_key(p);
#pragma GCC optimize ("Ofast")
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mset(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define sz(x) ((int)(x).size())
#define rsz resize
#define ln "\n"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef double dbl;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(0.0);
const int MOD = 1000000007;

string tostring(auto a){
    stringstream ss;ss<<a;string s = ss.str();
    return s;
}

/**Mi Debug**/
#define var(x) cout<<#x<<" = ";
#define db(x) cout<<#x<<" = "<<x<<"\n";
void dbvector(vector<auto>&v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}
void dbmapa(map<auto,auto>mp){
   for(auto x : mp) cout<<"{"<<x.first<<":"<<x.second<<"} ";cout<<"\n";
}
void dbstring(string v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}

/***********Code***************/

const int JJJ = 100100;










int main(){

  //freopen("input.in","r",stdin);
  //freopen("input.out","w",stdout);

    ios_base::sync_with_stdio(0); cin.tie(0);

    ll a,b;
    cin >> a >> b;
    cout<<a*b;
    







    return 0;
}


Measured memory_bytes: 3648