akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Main {
    private final int[][] search = new int[][]{
            {0, 1},
            {0, -1},
            {1, 1},
            {1, -1},
            {1, 0},
            {-1, 1},
            {-1, 0},
            {-1, -1}
    };

    public static void main(final String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        boolean b = true;
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (b) {
            b = runOnce(reader);
        }

        reader.close();
    }

    private boolean runOnce(final BufferedReader reader) throws IOException {
        final String[] params = reader.readLine().split(" ");
        final int x = Integer.parseInt(params[0]);
        final int y = Integer.parseInt(params[1]);
        if (x == 0 && y == 0) return false;

        final Map<Field, Boolean> fields = new HashMap<>();
        for (int i = 0; i < y; i++) {
            final String[] line = reader.readLine().split(" ");
            for (int j = 0; j < line.length; j++) {
                fields.put(new Field(i, j, line[j].equals("1")), line[j].equals("1"));
            }
        }
        int landCount = 0;
        while (true) {
            final Iterator<Field> iterator = fields.keySet().iterator();
            if (!iterator.hasNext()) {
                break;
            }
            final Field next = iterator.next();
            if (next.land) {
                searchLand(next, fields);
                landCount++;
            } else {
                fields.remove(next);
            }
        }
        System.out.println(landCount);
        return true;
    }

    private void searchLand(final Field field, final Map<Field, Boolean> fields) {
        fields.remove(field);

        final Field tmp = new Field(0, 0, true);
        for (final int[] s: search) {
            tmp.x = field.x + s[0];
            tmp.y = field.y + s[1];
            if(fields.containsKey(tmp)) {
                if (fields.get(tmp)) {
                    searchLand(tmp, fields);
                }
                fields.remove(tmp);
            }
        }
    }

    private final class Field {
        int x, y;
        boolean land;

        Field(final int x, final int y, final boolean land) {
            this.x = x;
            this.y = y;
            this.land = land;
        }

        @Override
        public int hashCode() {
            return x * 2 + y * 101 + (land ? 1 : 0);
        }

        @Override
        public boolean equals(final Object obj) {
            if (obj instanceof Field) {
                return ((Field) obj).x == this.x && ((Field) obj).y == this.y;
            }
            return super.equals(obj);
        }
    }
}

Measured memory_bytes: 33056
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class BROTN {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      string s; cin >> s;
      rep(i, s.size()) {
        int k = s[i] - 'A';
        k += n;
        k %= 26;
        cout << (char)('A' + k);
      }
      cout << endl;
    }
};

signed main() {
  BROTN solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

constexpr int INF = numeric_limits<int>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

signed main() {
	int N;
	cin >> N;
	vector<string> S(N);
	REP(i, N) cin >> S[i];
  queue<int> que;
  que.push(0);
  vector<bool> used(N, false);
  used[0] = 1;
  vector<int> parity(N, -1);
  parity[0] = 0;
  while (que.size()) {
    int i = que.front();
    que.pop();
    REP(j, N) {
      if (S[i][j] == '1') {
        if (used[j]) {
          if (parity[i] == parity[j]) {
            cout << -1 << endl;
            return 0;
          }
        } else {
          que.push(j);
          used[j] = true;
          parity[j] = 1 - parity[i];
        }
      }
    }
  }
	vector<vector<int>> d(N, vector<int>(N));
	REP(i, N) REP(j, N) {
		d[i][j] = i == j ? 0 : S[i][j] == '1' ? 1 : INF;
	}
	REP(k, N) REP(i, N) REP(j, N) {
		d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	}
	int ans = 0;
	REP(i, N) REP(j, N) {
		if (d[i][j] < INF)
			ans = max(ans, d[i][j]);
	}
	cout << ans + 1 << endl;
}


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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;
//{
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
//}

#define debug_interval ','
#define dump_interval endl
#define debug_toggle 0

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
//}

ll n,ans,m;

int main(){
  cin>>n>>m;
  ans++;
  while(n*2<=m){
    ans++;
    n*=2;
  }
  dump(ans);
}

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

int main(){
  vector<int>vec(5);
  for(int i=0 ;i<5;i++){
  cin>>vec.at(i);
  }
  int k;
  cin>>k;
  sort(vec.begin(),vec.end());
  if(vec.at(4)-vec.at(0)>k)
    cout<<":("<<endl;
  else
    cout<<"Yay!"<<endl;  
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  
  int M = N%28;
  bool exist = false;
  repi(i,0,6) {
    repi(j,0,3) {
      if (M == 4*i+7*j) exist = true;
    }
  }
  
  cout << (exist ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N, W = [int(t) for t in input().split()]
item = [tuple(int(t) for t in input().split()) for _ in range(N)]

# value[u] = 容量uのときの最大価値
value = {0: 0}

for u in range(1, W + 1):
    value[u] = max([value[u - w] + v for v, w in item if u >= w] \
                 + [value[u - 1]])
print(value[W])



Measured memory_bytes: 6520
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int a = input.nextInt();
        int b = input.nextInt();
        if ((b - a) % 2 == 1) {
            System.out.println("Borys");
        } else {
            System.out.println("Alice");
        }
    }
}


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

int main(){
      string s;cin >> s;
      int n = s.length();
      int ans = 0;
      for(int i = 0;i < n / 2;i++){
            if(s[i] != s[n - i - 1])ans++;
      }
      cout << ans;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>

#define ll long long

int main()
{
    ll N, M;
    std::cin >> N >> M;

    std::vector<ll> H(N);
    std::vector<ll> A(M), B(M);
    for(ll i=0; i < N; i++) {
        std::cin >> H[i];
    }
    for(ll i=0; i < M; i++) {
        std::cin >> A[i] >> B[i];
    }

    std::vector<ll> data(N+1, 0);
    for(ll i=0; i < M; i++) {
        if(H[A[i]-1] > H[B[i]-1]) {
            if(data[A[i]] != -1) {
                data[A[i]] = 1;
            }
            data[B[i]] = -1;
        }
        else if(H[A[i]-1] < H[B[i]-1]){
            if(data[B[i]] != -1) {
                data[B[i]] = 1;
            }
            data[A[i]] = -1;
        }
        else {
            data[A[i]] = -1;
            data[B[i]] = -1;
        }
    }

    ll count = 0;
    for(ll i=1; i <= N; i++) {
        if(data[i] != -1) {
            count++;
        }
    }
    std::cout << count << std::endl;
}

Measured memory_bytes: 6412
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int n, m ,x; cin >> n >> m >> x;
    vector<int> c(n);
    ll ans = 1e10;
    vector<vector<int>> v(n, vector<int>(m));
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            cin >> v[i][j];
        }
    }
    for(int bit = 0; bit < (1 << n); bit++){
        vector<int> t(n, 0);
        ll sum = 0;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                sum += c[i];
                for(int j = 0; j < m; j++){
                    t[j] += v[i][j];
                }
            }
        }
        bool f = true;
        for(int i = 0; i < m; i++){
            if(t[i] < x)f = false;
        }
        if(f) ans = min(ans, sum);
        
    }
    if(ans == 1e10){
        cout << -1 << endl;
    }
    else cout << ans << endl;
    system("pause");
}


Measured memory_bytes: 3692
#include <stdio.h>

main(){
  char data1[1000], data2[1000], ans[1000];
  int i, j, k, n, a;
  int p1, p2, t;

  scanf("%d", &n);
  getchar();
  for(k=0;k<n;k++){
    p1=p2=t=a=0;
    for(i=0;i<100;i++){
      data1[i]=data2[i]=ans[i]='0';
    }
    for(i=0;;i++){
      if(i>80){
	t=1;
      }
      scanf("%c", &data1[i]);
      if(data1[i]=='\n') break;
    }
    data1[i]='0';
    p1=i;
    for(i=0;;i++){
      if(i>80){
	t=1;
      }
      scanf("%c", &data2[i]);
      if(data2[i]=='\n') break;
    }
    data2[i]='0';
    p2=i;
    if(t==1){
      printf("overflow\n");
      continue;
    }
    
    for(i=0, j=p1-1;j>=0;i++, j--){
      ans[i]=data1[j];
    }
    for(i=0;i<p1;i++){
      data1[i]=ans[i];
    }
    for(i=0, j=p2-1;j>=0;i++, j--){
      ans[i]=data2[j];
    }
    for(i=0;i<p2;i++){
      data2[i]=ans[i];
    }
    if(p1<p2) p1=p2;
    for(i=0;i<p1;i++){
      ans[i]=data1[i]-'0'-'0'+data2[i];
    }
    for(i=0;i<p1-1;i++){
      if(9<ans[i]){
	ans[i]-=10;
	ans[i+1]+=1;
      }
    }
    if(ans[p1-1]>9){
      ans[p1-1]-=10;
      ans[p1]=1;
      a=1;
    }
    if(a==1) p1++;
    if(p1>80){
      printf("overflow\n");
      continue;
    }
    for(i=0;i<p1;i++){
      ans[i]+='0';
    }
    for(i=p1-1;i>=0;i--){
      printf("%c", ans[i]);
    }
    printf("\n");
  }
  return 0;
}


      

Measured memory_bytes: 0
import math
n=int(input())
a=100
for i in range (n):
	a=math.ceil(a*1.05)
#四捨五入
#d_new=int(round(d+1,-4))
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
#d_new=Decimal(int(d)).quantize(Decimal('1E4'), rounding=ROUND_HALF_UP)
#切り捨て
#math.floor(11/3)
d=a*1000
print(int(d))


Measured memory_bytes: 5668
#include <bits/stdc++.h>
#define rep(i, n) for (long i = 0; i < (n); ++i)

using namespace std;

void solve(long N, vector<string> S) {
  set<string> rewards;
  rep (i, N)
    rewards.emplace(S[i]);
  cout << rewards.size() << endl;
}

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

  long N;
  cin >> N;
  vector<string> S(N);
  for(int i = 0 ; i < N ; i++){
    cin >> S[i];
  }
  solve(N, move(S));
  return 0;
}


Measured memory_bytes: 25048
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
map<string,int> mp;
string sp[105];
int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n; ++i)
	{
		string s;
		cin>>s;
		sp[i] = s;
		if(mp[s])
		{
			printf("No\n");
			return 0;
		}
		mp[s] = 1;
		if(i > 1)
		{
			if(sp[i][0] != sp[i - 1].back())
			{
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#define DEBUG 0

/**
 * File    : D3.cpp
 * Author  : Kazune Takahashi
 * Created : 4/7/2019, 12:33:27 AM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

ll X[3];
ll K;
ll A[3][1010];
vector<ll> ans;
typedef tuple<int, int, int> point;
set<point> S;
typedef tuple<ll, point> D;
priority_queue<D> Q;

int main()
{
  for (auto i = 0; i < 3; i++)
  {
    cin >> X[i];
  }
  cin >> K;
  for (auto i = 0; i < 3; i++)
  {
    for (auto j = 0; j < X[i]; j++)
    {
      cin >> A[i][j];
    }
    A[i][X[i]] = -(ll)1e17;
    X[i]++;
  }
  for (auto i = 0; i < 3; i++)
  {
    sort(A[i], A[i] + X[i]);
    reverse(A[i], A[i] + X[i]);
  }
  Q.push(D(A[0][0] + A[1][0] + A[2][0], point(0, 0, 0)));
  S.insert(point(0, 0, 0));
  for (auto i = 0; i < K; i++)
  {
    ll v = get<0>(Q.top());
    ll x = get<0>(get<1>(Q.top()));
    ll y = get<1>(get<1>(Q.top()));
    ll z = get<2>(get<1>(Q.top()));
    Q.pop();
    cout << v << endl;
    for (auto j = 0; j < 3; j++)
    {
      if (j == 0)
      {
        x++;
      }
      else if (j == 1)
      {
        y++;
      }
      else
      {
        z++;
      }
      point p = point(x, y, z);
      if (S.find(p) == S.end())
      {
        Q.push(D(A[0][x] + A[1][y] + A[2][z], p));
        S.insert(p);
      }
      if (j == 0)
      {
        x--;
      }
      else if (j == 1)
      {
        y--;
      }
      else
      {
        z--;
      }
    }
  }
}


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

int main(){
    int n;
    cin>>n;
    vector< int > a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    //フレンドリーさが最大順に並べる
    sort(a.begin(),a.end(),greater<int>());
    queue<int> q;
    q.push(a[0]);
    long long ans = 0;
    for(int i=1;i<n;i++){
        int f = q.front();
        q.pop();
        ans += f;
        q.push(a[i]);
        q.push(a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4836
#include<iostream>
#include<climits>
#include<limits.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int sum=0;
	int s=INT_MIN;
	int a[2][n];
	for(int i=0;i<n;i++){
		cin>>a[0][i];
	}
	
	for(int i=0;i<n;i++){
		cin>>a[1][i];
	}
	for(int q=0;q<=n-1;q++){
		sum=0;
		for(int f=0;f<=q;f++){
			sum=sum+a[0][f];
		}
		for(int f=q;f<n;f++){
			sum=sum+a[1][f];
		}
		if(sum>=s) s=sum;
		
	}
	cout<<s;
	
	
	
	system("pause");
	return 0;
}

Measured memory_bytes: 504
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] sum = new long[n+1];
        for(int i = 1; i < n+1; i++){
            sum[i] = sum[i-1] + sc.nextInt();
        }
        Arrays.sort(sum);
        long ans = 0;
        int tmp = -1;
        long prev = sum[0];
        for(int i = 0; i < sum.length; i++){
            if(sum[i] == prev) tmp++;
            else{
                tmp = 0;
                prev = sum[i];
            }
            ans += tmp;
        }
        System.out.println(ans);
    }
}




Measured memory_bytes: 81820
#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>
#include <ctype.h> //toupper case
#include <tuple>


using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
const ll W = 1000000007;
const int alphacount = 26;
const string atcoyes = "Yes";
const string atcono = "No";



void omajinai() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
}

class Main{
public:
    
    int N ; ll W;
    std::map<ll,ll> AB;
    Main(){
        cin>>N>>W;
        REP(i,N){
            ll a, b;
            cin>>a>>b;
            map<ll, ll>::iterator it = AB.find(a);
            if(it!=AB.end()){
                AB[a]+=b;
            }else{
                AB.insert(make_pair(a,b));
            }
        }
    }
    
    ll _getans(ll w) const{
        ll ret = 0LL;
        for(pair<ll,ll> p : AB){
            if((w|p.first) == w ){
                ret += p.second;
            }
        }
        return ret;
    }
    
    ll getans() const{
        int maxketa = 0;
        while( (W>>(++maxketa))>0);
        ll ketamax = (1<<maxketa) -1;
        ll ret = _getans(W);
        for(int i = 1; i<maxketa;i++){
            const ll X = (W&( ketamax - (1<<i)))|((1LL<<(i))-1);
            if(X < W) ret = max(ret, _getans(X));
        }
        return ret;
    }
    
    void run(){
        cout<<getans()<<endl;
    }
};

#ifndef gtest
int main(){
    omajinai();
    Main().run();
    return 0;
}
#endif


Measured memory_bytes: 6528
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n'; cout << fixed << setprecision(10);

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	int n;
	cin >> n;
	vector<string> s(n+1,"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");
	vector<pair<int, string>> b(n);
	rep(i, n) { cin >> s[i]; }
	sort(s.begin(), s.end());
//	rep(i, n) cout << s[i] << endl;
	int cnt = 1;
	int y = 1;
	int j = 0;
	rep(i, n) {
		if (s[i] != s[i + 1]) {
			b[j] = make_pair( -cnt,s[i] );
			//cout << cnt;
			cnt = 1;

			++j;
		}
		else ++cnt;
	}
	vector<pair<int, string>> e(j);
	rep(i, j) {
		e[i] = b[i];
	}
	sort(e.begin(),e.end());
	cout << e[0].second << endl;
	rep2(i,1, j) {
		if (e[i - 1].first == e[i].first) cout << e[i].second << endl;
		else return 0;
	}

}



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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    int count=0;
    vector<int> sen(n + 1);
    sen.at(0) = abs(a.at(0));
   count+=sen.at(0);
  
    sen.at(n) = abs(a.at(n-1));
   count+=sen.at(n);
    for (int i = 1; i < n ; i++)
    {
        sen.at(i) = abs(a.at(i) - a.at(i-1));
        count+=sen.at(i);
    }
    vector<int> to(n);
    to.at(0)=abs(a.at(1));
    to.at(n-1)=abs(a.at(n-2));
    for(int i=1;i<n-1;i++){
        to.at(i)=abs(a.at(i-1)-a.at(i+1));
    }
    for(int i=0;i<n;i++){
        int xxx=count;
        count-=sen.at(i);
        count-=sen.at(i+1);
        count+=to.at(i);
        cout<<count<<endl;
        count=xxx;
    }

}


Measured memory_bytes: 2432
import sys
sys.setrecursionlimit(10**6)

d,n=map(int,input().split())

if d==0:
    if n==100:
        print(n+1)
        exit()
    print(n)
elif d!=0 and n==100:
    print((n+1)*100**d)
else:
    print(n*100**d)


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

int main(){
    string msg;
    while(cin >> msg){
        if( msg.length()%2 ){
            cout << "NA" << endl;
            continue;
        }
        string res = "";
        bool OK = true;
        for(int i = 0; i < msg.length(); i+=2){
            int x = msg[i]-'0', y = msg[i+1]-'0';
            if( x < 1 || x > 6 || y < 1 || y > 5 ){
                OK = false;
                break;
            }
            char z = (x-1)*5+(y-1)+'a';
            if( 'a' <= z && z <= 'z' ) res.append(1, z);
            else{
                if( z-'a' == 26 ) res.append(1,'.');
                if( z-'a' == 27 ) res.append(1,'?');
                if( z-'a' == 28 ) res.append(1,'!');
                if( z-'a' == 29 ) res.append(1,' ');
            }
        }
        if( OK ){
            cout << res << endl;
        }else{
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
#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)
typedef long long ll;
int main(){

	int x;
	cin >> x;
	if (x==3||x==5||x==7) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 200005
struct hh{
	int a,b;
	bool operator<(hh x)const{
		return b<x.b;
	}
}sk[M];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d%d",&sk[i].a,&sk[i].b);
	sort(sk+1,sk+n+1);
	for(int i=1,now=0;i<=n;++i){
		now+=sk[i].a;
		if(now>sk[i].b){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  int turn = 0;
  while(1){
    if(turn == 0){
      c = c - b;
      turn += 1;
    }else{
      a = a - d;
      turn -= 1;
    }
    if(a<=0) {
      cout << "No" << endl;
      break;
    }else if(c <= 0){
      cout << "Yes" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3624
from bisect import bisect_left
class BIT:
    def __init__(self,N):
        self.N=N
        self.bit=[0]*N
    def add(self,a,w):
        x=a
        while(x<self.N):
            self.bit[x]+=w
            x|=x+1
    def get(self,a):
        ret,x=0,a-1
        while(x>=0):
            ret+=self.bit[x]
            x=(x&(x+1))-1
        return ret
    def cum(self,l,r):
        return self.get(r)-self.get(l)

N,K=map(int,input().split())
a=[int(input()) for i in range(N)]
cum=[0]*(N+1)
for i in range(N):
    cum[i+1]=cum[i]+a[i]
B=[cum[i]-i*K for i in range(N+1)]

dic={}
li=sorted(B)
for i in range(N+1):
    dic[B[i]]=bisect_left(li,B[i])
bit=BIT(N+1)
ans=0
for i in range(N+1):
    ans+=bit.get(dic[B[i]]+1)
    bit.add(dic[B[i]],1)
print(ans)


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, ans =0;
	cin >>n;

	rep2(i,1,10) rep2(j,1,10){
		if(i*j == n){ puts("Yes"); return 0;}
	}
	cout << "No" <<"\n";
	return 0;
	
}


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

int main(){
  double a,b,h,m;
  cin >> a >> b >> h >> m;
  
  double k,ans;
  const double pi = 3.141592653589793;
  
  double t=60*h+m;
  k=abs(6*m-0.5*t);
  ans=pow(a,2)+pow(b,2)-2*a*b*cos(pi*k/180);
  
  printf("%16.15g",sqrt(ans));
}

Measured memory_bytes: 4192
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define pi pair<int, int>
#define endl "\n"

#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace __gnu_pbds;
using namespace std;

ll mod = 1e8;

ll add(ll a, ll b) { return (a % mod + b % mod) % mod; }
ll mul(ll a, ll b) { return (a % mod * b % mod) % mod; }
void debug(vector<int> a) {
    for(int i: a) cout << i << " ";
    cout << "\n";
}
// abc abc

int main() {
    fastio
    int n; cin >> n;
    string s;
    cin >> s;
    int len = n/2;
    if(n%2 != 0) {
        cout << "No";
        return 0;
    }
    bool f = true;
    for(int i=0; i<len; i++){
        if(s[i] != s[i+len]) f = false;
    }
    
    if(f) cout << "Yes" ;
    else cout << "No";
     

}

Measured memory_bytes: 256
using System;
using System.ComponentModel;

namespace atcoder_practice1
{
    class _086D0
    {


        static int[,] memo;
        static void Main()
        {
            string[] string_array;
            int N, K;
            string_array = Console.ReadLine().Split(' ');
            N = int.Parse(string_array[0]);
            K = int.Parse(string_array[1]);

            memo = new int[2*K + 1, 2*K + 1];

            for (int i=0;i < N; i++)
            {
                int x, y, x_, y_;
                string c;
                string_array = Console.ReadLine().Split(' ');
                x = int.Parse(string_array[0]);
                y = int.Parse(string_array[1]);
                c = string_array[2];

                if(c == "W")
                {
                    x += K;
                }

                x %= 2 * K;
                y %= 2 * K;

                x_ = x % K;
                y_ = y % K;

                if((x<K && y<K) || (x>=K && y >= K))
                {
                    imos(0, 0, x_ + 1, y_ + 1);
                    imos(x_ + K + 1, 0, 2 * K, y_ + 1);

                    imos(0, y_ + K + 1, x_ + 1, 2 * K);
                    imos(x_ + K + 1, y_ + K + 1, 2 * K, 2 * K);

                    imos(x_ + 1, y_ + 1, x_ + K + 1, y_ + K + 1);
                }
                else
                {
                    imos(x_ + 1, 0, x_ + K + 1, y_ + 1);
                    imos(x_ + 1, y_ + K + 1, x_ + K + 1, 2 * K);

                    imos(0, y_ + 1, x_ + 1, y_ + K + 1);
                    imos(x_ + K + 1, y_ + 1, 2 * K, y_ + K + 1);
                }
            }

            for (int i = 0; i < 2*K + 1; i++)
            {
                for (int j = 1; j < 2 * K + 1; j++)
                {
                    memo[i,j] += memo[i,j - 1];
                }
            }

            for (int i = 1; i < 2*K + 1; i++)
            {
                for (int j = 0; j < 2 * K + 1; j++)
                {
                    memo[i,j] += memo[i - 1,j];
                }
            }

            int m = 0;
            for (int i = 0; i < 2 * K; i++)
            {
                for (int j = 0; j < 2 * K; j++)
                {
                    m = Math.Max(m, memo[i,j]);
                }
            }

            Console.WriteLine(m);
        }

        static void imos(int x, int y, int x2, int y2 )
        {
            memo[x, y]++;
            memo[x, y2]--;
            memo[x2, y]--;
            memo[x2, y2]++;
        }

    }
}

Measured memory_bytes: 32952
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=1e5;
ll d[mm];
vector<ll> ans[mm];
ll dd[mm];
int main()
{
	ll n,m,i,j,x,a,k,z,p,u,o;
	cin>>n>>m>>x;
	for(i=0;i<n;i++)
	{
		scanf("%lld",&d[i]);
		for(j=0;j<m;j++)
		{
			scanf("%lld",&a);
			ans[i].push_back(a); 
		}
	}
	k=maxn;
	for(i=0;i<(1<<n);i++)
	{
		ll s=0;
		memset(dd,0,sizeof(dd));
		for(j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				s+=d[j];	
				for(z=0;z<ans[j].size();z++)
				{
					dd[z]+=ans[j][z];
				}
			}
		}
		p=0;
		for(j=0;j<m;j++)
		{
//			if(i==(1<<n)-1)
//			cout<<dd[j]<<' '<<s<<endl;
			if(dd[j]<x)
			p=1; 
		} 
		if(p==0)
		{
			k=min(k,s);
		}
	}
	if(k==maxn)
	printf("-1\n");
    else 
    printf("%lld\n",k);
	

}

Measured memory_bytes: 6956
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    long long int n;
    cin>>n;
    long long int a[n];
    for(long long int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    double ans=1.0*(a[1]+a[0])/2;
    for(long long int i=2;i<n;i++)
    ans=(ans+a[i])/2;
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3784
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer t = nil->next;
  for(t=nil->next; t!=nil; t=t->next){
    if(t->key == key){
      return t;
    }
  }
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  NodePointer t = nil->next;
  for(t=nil->next; t!=nil; t=t->next){
    if(t->key == key){
      deleteNode(t);
      break;
    }
  }
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil->next;
  x->prev = nil;

  nil->next = x;
  x->next->prev = x;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
        if ( com[6] == 'F' ) deleteFirst();
        else if ( com[6] == 'L' ) deleteLast();
      } else {
        delete(key); nd++;
      }
      size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 32940
import sys
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())

def solve():
	N = S()

	flag = False
	for n in N:
		num = int(n)
		if num == 7:
			flag = True

	if flag:
		print('Yes')
	else:
		print('No')


if __name__ == '__main__':
	solve()


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    string s,t;
    cin >>s>>t;
    
    //-----------------------------------
    int ans=0;
    rep(i,3){
        if(s[i]==t[i])ans++;
    }


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

Measured memory_bytes: 256
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

ll dp[3010][3010];
ll r[3010][3010];

void solve()
{
    IN(n, s);
    VIN(ll, a, n);
    ll m = 998244353;
    dp[0][0] = 1;
    rep(i, n) {
        rep(j, s+1) {
            (dp[i+1][j] += dp[i][j]*2) %= m;
            if (j >= a[i]) (dp[i+1][j] += dp[i][j-a[i]]) %= m; // a[i]をつかう
        }
    }
    rep(i, n) {
        rep(j, s+1) {
            r[i][j] = dp[i][j];
        }
    }
    cout << dp[n][s] << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 144744
package main

import "fmt"

func main() {
	scores := make([]string, 0)
	for {
		var m, f, r int
		fmt.Scan(&m, &f, &r)
		if m == -1 && f == -1 && r == -1 {
			break
		}
		point := m + f
		var s string
		if m == -1 || f == -1 {
			s = "F"
		} else if point >= 80 {
			s = "A"
		} else if 65 <= point && point < 80 {
			s = "B"
		} else if 50 <= point && point < 65 {
			s = "C"
		} else if 30 <= point && point < 50 {
			if r >= 50 {
				s = "C"
			} else {
				s = "D"
			}
		} else {
			s = "F"
		}
		scores = append(scores, s)
	}
	for i := range scores {
		fmt.Println(scores[i])
	}
}



Measured memory_bytes: 1128
N=int(input())
L=list(map(str,input().split()))
L1=[]
L2=[]

for i in range(N):
    if i%2==0:
        L1.append(L[i])
    else:
        L2.append(L[i])
if N%2==0:
    L2=L2[::-1]
    ans=" ".join(L2)
    ans=ans+" "+" ".join(L1)
    print(ans)
else:
    L1=L1[::-1]
    ans=" ".join(L1)
    ans=ans+" "+" ".join(L2)
    print(ans)

Measured memory_bytes: 27076
#include <stdio.h>
#include <vector>
#include<iostream>
#include<queue>
#include<memory.h>
using namespace std;

int const N = 2 * 1e5 + 1;
int n, m;
bool vis[N];
int cost[N], parent[N];
queue<int> qu;
vector<vector<int> > g;
void BFS(int src) {
  memset(vis, false, sizeof vis);
  memset(cost, 0, sizeof cost);
  memset(parent, -1, sizeof parent);

  qu.push(src);
  vis[src] = true;

  while(!qu.empty()) {
    int fr = qu.front();
    qu.pop();

    for(int i = 0; i < (int)g[fr].size(); ++i) {
      int u = g[fr][i];
      if(!vis[u]) {
        qu.push(u);
        vis[u] = true;
        cost[u] = cost[fr] + 1;
        parent[u] = fr;
      }
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);

  g.resize(n);

  for(int i = 0, a, b ; i < m; ++i) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    g[a].push_back(b);
  }

   BFS (0);

  if ( cost[n - 1] <= 2 && parent[ n - 1] != -1 )
	  puts("POSSIBLE");
  else
	  puts("IMPOSSIBLE");

  return 0;
}


Measured memory_bytes: 10616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100005];
ll fibo[100005];
const ll md = 1000000007;

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

    for(int i=0; i<m; i++) cin >> a[i];

    for(int i=1; i<m; i++){
        if( a[i] == (a[i-1]+1)) {
            cout << 0 << endl;
            return 0;
        }
    }
    fibo[0] = fibo[1] = 1;
    for(int i=2; i<n+2; i++) fibo[i] = (fibo[i-1]+fibo[i-2])%md;

    ll res=1;
    ll stp=0;
    for(int i=0; i<m; i++){
        if( (stp-1)==a[i] ) continue;
        res = res*(fibo[a[i]-stp-1]);
        res = res%md;
        stp = a[i]+1;
        //cerr << res << "," << stp << endl;;
    }
    res = res*(fibo[n-stp]);
    res = res%md;

    cout << res << endl;
    return 0;
}


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

#define int long long

using namespace std;

int a[100001];

 main () {
	ios_base::sync_with_stdio (0);
	cin.tie (0);  	
	int n;
	cin >> n;
	int mn = 1e9 + 7;
	int mx = 0;
	int kl = 0, kr = 0;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		mn = min (mn, a[i]);
		mx = max (mx, a[i]);
	}
	for (int i = 1;i <= n;i ++) {
		if (a[i] == mn) kl ++;
		if (a[i] == mx) kr ++;
	}
	if (mx > n - 1 || mx - mn > 1) {
		cout << "No";
		return 0;
	}
	if (mn == mx) {
		if (mn == n - 1) {
			cout << "Yes";
			return 0;
		}
		if (mn + mn <= n) {
			cout << "Yes";
			return 0;
		}         
		cout << "No";
		return 0;
	}      
	int A = mx;
	if (A >= kl + 1 && kr / 2 + kl >= A) {
		cout << "Yes";         	
	}
	else {
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 1024
import sys

x = int(input())

a_max = pow(10, 4)
b_max = pow(10, 4)

for a in range(a_max):
    for b in range(b_max):
        if pow(a, 5) - pow(b, 5) == x:
            print(a, b)
            sys.exit()
        elif pow(-a, 5) - pow(b, 5) == x:
            print(-a, b)
            sys.exit()
        elif pow(a, 5) - pow(-b, 5) == x:
            print(a, -b)
            sys.exit()
        elif pow(-a, 5) - pow(-b, 5) == x:
            print(-a, -b)
            sys.exit()

Measured memory_bytes: 68368
import java.util.Scanner;

public class Main {
	static final double MOD = 1000000007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[]A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		int[]B = new int[N];
		for(int i = 0; i < N; i++) {
			B[A[i]]++;
		}
		if(N % 2 == 1) {
			if(B[0] != 1) {
				System.out.println(0);
				System.exit(0);
			}
			for(int i = 1; i < N; i++) {
				if(B[i] != 2 && B[i] != 0) {
					System.out.println(0);
					System.exit(0);
				}
			}
			long ans = 1;
			for(int i = 0; i < N / 2; i++) {
				ans *= 2;
				ans %= MOD;
			}
			System.out.println(ans);
		}else {
			for(int i = 1; i < N; i++) {
				if(B[i] != 2 && B[i] != 0) {
					System.out.println(0);
					System.exit(0);
				}
			}
			long ans = 1;
			for(int i = 0; i < N / 2; i++) {
				ans *= 2;
				ans %= MOD;
			}
			System.out.println(ans);
		}
	}
}

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

int main()
{
    ll n,i,j,cnt=1,k,w=-100,b,h,m;
   /* freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    w=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]<=w)
        {
            cnt++;
            w=a[i];
        }
    }
    cout<<cnt;

	    return 0;
}


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

using namespace std;

int main(){

	int r,D,x2000;

	scanf("%d %d %d",&r,&D,&x2000);

	for(int i=1;i<=10;++i){
		printf("%d\n",r*x2000-D);
		x2000 = r*x2000-D;
	}

	return 0;
}

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

#define ll long long
#define endl long long
using namespace std;

ll arr[6];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    ll m;
    ll ans=0;
    cin >> n;
    for(int i=0; i<5; i++)
    {
        cin >> arr[i];
    }
    sort(arr, arr+5);
    cout << (n-1)/arr[0] + 5;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			map.put(i, a);
			A[i] = a;
		}
		sc.close();
		// System.out.println("--------------");
		Arrays.sort(A);
		for(int i = 0; i < N; i++) {
			int except = map.get(i);
			System.out.println(A[N - 1] == except ? A[N - 2] : A[N - 1]);
		}
	}
}	


Measured memory_bytes: 105012
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

struct Pos {
   int row, col;
   bool operator<(const Pos& p) const {
      if (row != p.row) return row < p.row;
      return col < p.col;
   }
};

struct FreqRow {
   int cnt, row;
   bool operator<(const FreqRow& f) const {
      if (cnt != f.cnt) return cnt > f.cnt;
      return row < f.row;
   }
};

#define MAXC 300004

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int R, C, M;
   cin >> R >> C >> M;

   vector<Pos> targets;
   REP(m, M) {
      int r, c;
      cin >> r >> c;
      targets.push_back({r, c});
   }

   vector<int> freqR(MAXC);
   map<int, VI> allC;
   for (Pos p : targets) {
      ++freqR[p.row];
      allC[p.col].push_back(p.row);
   }

   set<FreqRow> S;
   FOR(r, 1, R) {
      S.insert({freqR[r], r});
   }

   int res = 0;

   for (const auto& it : allC) {
      int nbombs_in_col = SZ(it.second);
      for (int r : it.second) {
         S.erase({freqR[r], r});
         --freqR[r];
         assert(freqR[r] >= 0);
         S.insert({freqR[r], r});
      }

      int nbombs_in_max_row = S.begin()->cnt;

      for (int r : it.second) {
         S.erase({freqR[r], r});
         ++freqR[r];
         S.insert({freqR[r], r});
      } 

      int cur = nbombs_in_col + nbombs_in_max_row;
      res = max(res, cur);
   }
   
   cout << res << endl;

   return 0;
}


Measured memory_bytes: 53564
#include <iostream>                                                      
#include <cstdio>                                                        
using namespace std;                                                     
                                                                         
int main() {                                                             
  while (true) {                                                         
    int H, W;                                                            
    cin >> H >> W;                                                       
    if (H==0 && W==0) {                                                  
      break;                                                             
    }                                                                    
    for (int i=0; i<H; i++) {                                            
      for (int j=0; j<W; j++) {                                          
        printf("#");                                                     
      }                                                                  
      printf("\n");                                                      
    }                                                                    
    printf("\n");                                                        
  }                                                                      
  return 0;                                                              
}                                                                        
                                                                         
                

Measured memory_bytes: 3024