akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc174/tasks/abc174_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) { cin >> A[i]; }
    sort(ALL(A));
    // 二分探索
    int ng = 0, ok = 1e9;
    // 全ての丸太を長さtarget以下にする
    auto fn = [&](int target) {
        int cnt = 0;
        REP(i, N) {
            // 例えば長さ7を7以下にするなら切らなくていい。
            // 7未満にするなら1回切るように数える。
            cnt += DIV(A[i], target) - 1;
            if (cnt > K) {
                break;
            }
        }
        return cnt <= K;
    };
    while (ok - ng > 1) {
        int mid = (ng + ok) / 2;
        (fn(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;

    return 0;
}


Measured memory_bytes: 4656
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i;
    double prod=1,sum=0;
    cin>>n;
    double arr[n];
    for(i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    sum=arr[0];
    for(i=1;i<n;i++)
        sum=(sum+arr[i])/2;
    cout<<sum<<endl;
    return 0;
}


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

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

    int ans = 1;
    char past = s[0];
    for(int i = 1; i < n; i++){
        if(past != s[i]){
            past = s[i];
            ans++;
        }
    }

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

Measured memory_bytes: 3740
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    double R,G;
    cin >> R >> G;
    
    double ans;
    ans = 2*G -R;

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

Measured memory_bytes: 256
def rotate_matriz(s, x, y):
    ex = [[""] * x for _ in range(y)]
    for i in range(x):
        for j in range(y):
            ex[j][i] = s[i][j]
    return ex


def pprint(s, n):
    for i in range(n):
        print("".join(s[i]))


def check(s, n):
    ex = []
    ct = 0
    for i in range(n):
        if "#" in s[i]:
            ex.append(s[i][:])
        else:
            ct += 1
    return ex, n - ct


h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
b, h = check(a, h)
b = rotate_matriz(b, h, w)
b, w = check(b, w)
b = rotate_matriz(b, w, h)
pprint(b, h)


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

int main(){
	int time,totaltime;
        for(int i=0;i<4;i++){
         cin>>time;
         totaltime+=time;
         }
        int x,y;
         x=totaltime/60;
         y=totaltime-x*60;
         cout<<x<<'\n'<<y<<'\n';
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>

using namespace std;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    int cnt = 0;
    while(1){
        a[0] += 2;
        if(a[2] < a[0]){
            a[0] -= 2;
            break;
        }
        cnt++;
    }
    while(1){
        a[1] += 2;
        if(a[2] < a[1]){
            a[1] -= 2;
            break;
        }
        cnt++;
    }
    if(a[0] == a[2] && a[1] == a[2]){
        cout << cnt;
    }else{
        if(a[0] == a[1]){
            cout << cnt + 1;
        }else{
            cout << cnt + 2;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  
  if (A < B && A != 1) {
    cout << "Bob" << endl;
  } else if (A > B && B != 1) {
    cout << "Alice" << endl;
  } else if (A == B) {
    cout << "Draw" << endl;
  } else if (A == 1) {
    cout << "Alice" << endl;
  } else {
    cout << "Bob" << endl;
  }
    
}

Measured memory_bytes: 256
n, k=map(int, input().split())
plist = list(map(int, input().split()))
now=sum(plist[:k])
answer=now
#print(now)
for i in range(n-k):
    now-=plist[i]
    now+=plist[i+k]
    if now>=answer:
        answer=now

print((k+answer)/2)

Measured memory_bytes: 71792
#include <iostream>
#include <string>

using namespace std;

int main() {
	// your code goes here
	int n, m; cin >> n >> m;
	string s;
	
	for(int i=0; i<n; i++){
		cin >> s;
		for(int i=0; i<2; i++){
			cout << s << endl;
		}
	}
	
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

n, m, l = map(int, input().split())

A = []
B = []

# ??????A???????´?
for i in range(n):
    row = list(map(int, input().split()))
    A.append(row)

# ??????B???????´?
for i in range(m):
    row = list(map(int, input().split()))
    B.append(row)


C = []
for i in range(n):
    row = []
    for j in range(l):
        s = 0
        for k in range(m):
            s += A[i][k] * B[k][j]
        row.append(s)
    C.append(row)

for r in range(n):
    print(' '.join(map(str, C[r])))

Measured memory_bytes: 8812
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

void strtoint(char *, int *);

int main(void){
	int n, d;
	int **x;
	int y;
	int i, j, k, counter = 0;
	char *tmp;
	scanf("%d %d", &n, &d);

	x = (int **)malloc(sizeof(int *) * n);
	tmp = (char *)malloc(sizeof(char) * 5*d);
	for(i = 0; i < n; i++) x[i] = (int *)malloc(sizeof(int) * d);
		
	for(i = 0; i < n; i++){
		scanf("\n");
		scanf("%[^\n]", tmp);
		strtoint(tmp, x[i]);
	}
	for(i = 0; i < n - 1; i++){
		for(j = i + 1; j < n; j++){
			y = 0;
			for(k = 0; k < d; k++){
				y += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
			}
			if(ceil(sqrt(y)) == floor(sqrt(y))) counter++;
		}
	}
	printf("%d\n", counter);
	for(i = 0; i < n; i++) free(x[i]);
	free(x);
			
	return 0;
	
}

void strtoint(char *tmp, int *x){
	int i = 0, j = 0, c = 0;
	
	while(tmp[i] != '\0'){
		if(('0' <= tmp[i] && tmp[i] <= '9') || tmp[i] == '-'){
			i++;
		}
		else{
			x[c++] = atoi(tmp + j);
			j = i++;
		}
	}
	x[c] = atoi(tmp + j);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}

int main(){
    int N;cin>>N;
    vector<int>A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    ll ans=A.at(0);
    for(int i=0;i<N;i++){
        ans=gcd(A.at(i),ans);
    }
    cout<<ans<<endl;


}


Measured memory_bytes: 3692
#include <iostream>

using namespace std;
int main() {
    char r, g, b;
    cin >> r >> g >> b;

    int n = (r - '0') * 100 + (g - '0') * 10 + (b - '0');
    cout << (n % 4 == 0 ? "YES" : "NO") << endl;

    return 0;
}

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define s second
#define vec vector<int>


using namespace std;

const int N = (int) 1e6 + 10;
//const int K = (int) N * N;
const int mod = (int) 998244353;


ll a, b, c, d;

int solve() {
	if (b > d || b > a)
		return 0;
	if (c >= b) 
		return 1;
	a %= b;
	if (c < a) 
		return 0;
	map<ll, ll> w;
	ll g = __gcd(b, d);
	ll start = a;
	/*
	c < a + g * k < b
	
	c < a + g * k
	a + g * k < b
	
	c - a < g * k
	g * k < b - a

	k < (b - a) / g
	k > (c - a) / g 
	*/ /*
	for (int i = -100000; i <= 100000; i++) {
		if (c < a + i * g && a + i * g < b)
			return 0;
	}
	return 1; */

	if ((c - a) / g + 1 <= (b - a + g - 1) / g - 1) return 0;
	return 1;
	while (1) {
		if (w[a]) return 1;
		assert((a - start) % g == 0);
		w[a] = 1;
		a += d;
		a %= b;
		if (c < a) 
			return 0;
	}
	return -1;
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int t;
	cin >> t;
	while (t--) {
		cin >> a >> b >> c >> d;
		int ans = solve();
		if (ans == 0) cout << "No";
		else if (ans == 1) cout << "Yes";
		else cout << "?";
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        map<int, int> mp;
        for(int i = 1; i < n; i++){
            int x;
            cin >> x;
            mp[x]++;
        }
        for(int i = 1; i <= n; i++){
            cout << mp[i] << '\n';
        }
    }
}

Measured memory_bytes: 47080
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(System.Console.ReadLine());
            int b = int.Parse(System.Console.ReadLine());
            int c = int.Parse(System.Console.ReadLine());
            int x = int.Parse(System.Console.ReadLine());
            int count = 0;
            for(int i = 0; i <= a; i++)
            {
                for(int j = 0; j <= b; j++)
                {
                    for(int k = 0; k <= c; k++)
                    {
                        if (500 * i + 100 * j + 50 * k == x) count++;
                    }
                }
            }
            System.Console.WriteLine(count);
        }
    }
}

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

using namespace std;


int main()
{
    int n,j,a;
    cin>>n;
    vector<int > v;
    for(int i=0;i<n;i++) {cin>>a; v.push_back(a);  }
    for(int i=0;i<n;i++)
    {

        for(j=i-1; j>=0;j--)
        {
            if (v[j]>v[j+1]) swap(v[j],v[j+1]);
        }
        for(int j=0;j<n;j++) { if (j>0) cout<<" "; cout<<v[j];}
        cout<<endl;

    }


}

Measured memory_bytes: 3068
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 200000000
#define mod 1000000007
#define INF2 1000000000000000000
int H, W;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int d[51][51];
string S[51];
int bfs() {
    rep(i, 51) rep(j, 51) d[i][j] = INF;
    d[0][0] = 0;
    queue<pair<int, int>> que;
    que.push({0, 0});
    while(que.size()) {
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        rep(i, 4) {
            int xx = x + dx[i];
            int yy = y + dy[i];
            if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
            if(S[xx][yy] == '#') continue;
            if (d[xx][yy] == INF) {
                d[xx][yy] = d[x][y] + 1;
                que.push({xx, yy});
            }
        }
    }

    return d[H - 1][W - 1];
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    rep(i, H) cin >> S[i];
    int ans = 0;
    rep(i, H) rep(j, W) if(S[i][j] == '.') ans++;
    int t = bfs();
    if (t >= INF) {
        cout << -1 << endl;
    } else {
        cout << ans - t - 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string s,t;
int n;
int main(void){
    cin>>n;
    cin>>s>>t;
    for(int i=0;i<n;i++){
        cout<<s[i]<<t[i];
    }
    cout<<endl;

}


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

int main() {
  int N, A, B, S = 0, T = 0;
  cin >> N >> A;
  for(int i = 0; i < 100; i++){
    if(A % 2 == 1){
      break;
    }
        A = A / 2;
        S++;
    
  }
    for(int j = 0; j < N - 1; j++){
            cin >> B;
      for(int k = 0; k < 100; k++){
      if(B % 2 == 1){
        break;
      }
        B = B / 2;
        T++;
    }
    if(S > T){
      S = T;
    }
    T = 0;
    }
    cout << S;
  }


Measured memory_bytes: 256
using System;

class prog{
  static void Main(){
    
    int a = int.Parse(Console.ReadLine());
    int b = int.Parse(Console.ReadLine());
    int c = int.Parse(Console.ReadLine());
    int x = int.Parse(Console.ReadLine());
    
    int ans = 0;
    for(int i = 0; i <= a ; i++){
      for(int j = 0; j <= b; j++){
        for(int k = 0; k <= c; k++){
          if(500 * i + 100 * j + 50 * k == x) ans++;
        }
      }
    }
    
    Console.WriteLine(ans);
    
  }
}
          

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n, m;
  cin >> n >> m;
  V<int> c(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    c[a]++;
    c[b]++;
  }
  bool ans = true;
  rep(i, n) {
    if (c[i] % 2 != 0) ans = false;
  }
  if (ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    STR(N);
    if(N[0]=='7' || N[1]=='7' || N[2]=='7'){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

   
}

Measured memory_bytes: 3532
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [-a[i] for i in range(n)]
heapq.heapify(a)
for i in range(m):
    test = heapq.heappop(a)
    heapq.heappush(a, -(-test // 2))
print(-sum(a))

Measured memory_bytes: 14180
#include <iostream>
#include <vector>

using namespace std;

int dit[100005];
int dio[100005];
vector<int> g[100005];
vector<int> ans;
void dfs(int v, int prev, int d, bool a) {
  if(a) dit[v] = d;
  else dio[v] = d;

  for(int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if(u != prev) {
      dfs(u,v,d+1,a);
    }
  }
  if(a && g[v].size() == 1) ans.push_back(v);
  return;
}

int main() {
  int n,u,v;
  cin >> n >> u >> v;
  u--; v--;
  for(int i = 0; i < n - 1; i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  if(g[u].size() == 1 && g[u][0] == v) {
    cout << 0 << endl;
    return 0;
  }
  
  dfs(u,-1,0,true);
  dfs(v,-1,0,false);
  int tmp = 0;
  for(int i = 0; i < ans.size(); i++) {
    if(dio[ans[i]] > dit[ans[i]]) {
    tmp = max(tmp,dio[ans[i]]);
    }
  }
  cout << tmp - 1<< endl;
}
  


Measured memory_bytes: 11776
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        Console.WriteLine(N*N);

    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 11092
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  7 20:52:12 2019

@author: YudNK
"""

N,A,B = map(int, input().split())

train = A * N
taxi = B

if train > taxi:
    print(taxi)
else:
    print(train)
    

Measured memory_bytes: 2940
n, m = map(int, input().split())
listA=[]
listB=[]
index1=0
while index1 < n:
    a = list(input())
    listA.append(a)
    index1+=1
index2=0
while index2 < m:
    b = list(input())
    listB.append(b)
    index2+=1


yesFlag=0
index1=0
while index1 < n-m+1 and yesFlag == 0:
    index2=0
    while index2 < n-m+1 and yesFlag == 0:
        indexTate = index1
        flag=0
        while indexTate < index1+m and yesFlag == 0:
            indexYoko = index2
            while indexYoko < index2+m and yesFlag == 0:
                if listA[indexTate][indexYoko] == listB[indexTate-index1][indexYoko-index2]:
                    indexYoko+=1
                else:
                    flag=1
                    break
            if flag == 1:
                break
            elif flag == 0 and indexTate == index1+m-1:
                yesFlag=1
                print("Yes")
            else:
                indexTate+=1
        index2+=1
    index1+=1
if yesFlag == 0:
    print("No")

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int Com(int n, int k) {
	int x=1, y=1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

signed main() {
	string s;
	cin >> s;
	rep(i, s.size()) {
		cout << "x";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>

using namespace std;

int main(void){
	int n,lim;
	bool isprime[1000001];
	memset(isprime,true,sizeof(isprime));
	isprime[1] = false;
	for(int i=2;i<1000001;i++){
		if(isprime[i] == true){
			for(int j=2;j*i<1000001;j++){
				isprime[i*j] = false;
			}
		}
	}
	
	
	while(cin >> n >> lim){
		if((n|lim) == 0) break;
		vector<int> v;
		int tmp;
		bool creatable[lim+1];
		memset(creatable,false,sizeof(creatable));
		creatable[0] = true;
		
		for(int i=0;i<n;i++){
			cin >> tmp;
			v.push_back(tmp);
		}
		for(int i=0;i<lim;i++){
			if(creatable[i]){
				for(int j=0;j<v.size();j++){
					if(i+v[j] <= lim){
						creatable[i+v[j]] = true;
					}
				}
			}
		}
		
		for(int i=lim;i>=0;i--){
			if(i==0){
				cout << "NA" << endl;
				break;
			}
			if(isprime[i] && creatable[i]){
				cout << i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 2856
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

// b^k???q????´???°??¨?????????

//?????§??¬?´???°
int gcd(int a, int b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int p, q; cin >> p >> q;
  q /= gcd(p, q);
  int qq = q;
  int ans = 1;
  for(int i = 2; i * i <= qq; i++) {
    if(q % i == 0) {
      while(q % i == 0) {
        q /= i;
      }
      ans *= i;
    }
  }
  if(q > 1) ans *= q;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3208
import heapq

n = int(input())
A = list(map(int,input().split()))

Q0 = []
Q1 = []
Ana = [0] * (3*n)

M = [[A[n+i], n+i] for i in range(2*n)]
M.sort() 

msum = sum([M[i][0] for i in range(n)])
ans = sum(A[:n]) - msum
ans0 = ans
#print(ans0)

for i in range(n):
    heapq.heappush(Q0, A[i])
    heapq.heappush(Q1, [M[n+i][0], M[n+i][1]])
    Ana[M[n+i][1]] = 1

for i in range(n):
    #print("i",i, Q0,Q1,Ana)
    if Ana[n+i] == 0:
        heapq.heappush(Q0, A[n+i])
        ans0 += A[n+i] * 2
        ochi = heapq.heappop(Q0)
        ans0 -= ochi
        agari = heapq.heappop(Q1)
        while Ana[agari[1]] == 0:
            agari = heapq.heappop(Q1)
        Ana[agari[1]] = 0
        ans0 -= agari[0]
    else:
        Ana[n+i] = 0
        heapq.heappush(Q0, A[n+i])
        ans0 += A[n+i]
        ochi = heapq.heappop(Q0)
        ans0 -= ochi
    #print(ans0)
    ans = max(ans, ans0)


saigo = sum((sorted(A[:n*2]))[n:]) - sum(A[n*2:])
#print(saigo)

ans = max(ans, saigo)

print(ans)

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.1415926535
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{
    int n,x;
    cin>>n>>x;
    int a[100000]={0};
    a[0]=1;
    int sum=0;
    ffor(i,0,n)
    {
        int y;
        cin>>y;
        sum+=y;
        a[sum]=1;
    }
    int ans=0;
    ffor(i,0,x+1) ans+=a[i];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
template <typename T, typename U>
T max(T x, U y)
{
    return x>y ? x : y;
}
template <typename T, typename U>
T min(T x, U y)
{
    return x<y ? x : y;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,k;cin >> a >> b >> k;
    if(k<=a)cout << a-k <<" "<< b;
    else if(k-a<=b)cout << 0 << " " << b-(k-a);
    else cout << "0 0";
    }

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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス //
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

// 関数 //
int gcd(int a, int b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

// End of Template //

int main() {

	int N;
	cin >> N;

    cou(x2(N));


}

Measured memory_bytes: 256
N,L=map(int,input().split())
s = N*L
for i in range (N+1):
    s += i
s -= N
K=[]
for i in range(1,N+1):  
    K.append(L+i-1)
if 0 <= K[0]:
    s -= K[0]
elif K[0]<0 and K[N-1]>0:
    s = s
else:
    s -= K[N-1]
print(s)

Measured memory_bytes: 9012
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn main() {
    let mut v = read_vec::<usize>();
    v.sort();
    println!("{}",v[2] - v[0]);
}


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

int main() {
   int K, N;
   cin >> K >> N;
   vector<int> A(N+1, 0);
   for(int i=1; i<N+1; i++){
       cin >> A.at(i);
   }
vector<int> dis(N+1);
for(int i=0; i<N; i++){
    dis.at(i)=A.at(i+1)-A.at(i);
}
dis.at(N)=K-A.at(N)+A.at(1);
int c = *max_element(dis.begin(), dis.end());
cout << K-c << endl;
    return 0;
}



Measured memory_bytes: 1792
//12/11アルゴリズム
#include<iostream>
using namespace std;

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

    if(n==0)break;

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

    int avarage=sum/n;
    int poor=0;

    for(int i=0;i<n;i++){
      if(a[i]<=avarage){
        poor++;
      }
    }

    cout<<poor<<endl;
  }
  return 0;
}



Measured memory_bytes: 3140
#include<iostream>
using namespace std;
int ans,a[200000+5],b[200000+5];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=n;i>=1;i--){
		int k=i,tmp=0,flag=0,wei=0;
	    for(int j=i;j<=n;j+=k){ 
	    	if(b[j]==1){
	    		tmp++;
			}
			else if (b[j]==0&&flag==0){
				wei=j;
				flag=1;
			}
			
		}
		tmp%=2;
			if(tmp!=a[i]){
				if(wei==0){
					cout<<-1<<endl;
					return 0;
				} 
				b[wei]=1;
				//cout<<i<<endl;
			}
	}
	for(int i=1;i<=n;i++){
		if(b[i]==1){
			ans++;
		}
	}
	cout<<ans<<endl;
		for(int i=1;i<=n;i++){
		if(b[i]==1){
			cout<<i<<' ';
		}
	}
}

Measured memory_bytes: 2432
import numpy as np

def main():
    H, W = map(int, input().split())
    s = [input() for i in range(H)]
    
    diffs = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
    for y in range(H):
        anstr = ''
        for x in range(W):
            if s[y][x] == '#':
                anstr += '#'
                continue
            count = 0
            for dx, dy in diffs:
                if (x + dx < 0) or (x + dx > W - 1) or (y + dy < 0) or (y + dy > H - 1):
                    continue
                if s[y + dy][x + dx] == '#':
                    count += 1
            anstr += str(count)
        print(anstr)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 20192
#include<iostream>
using namespace std;
int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int y = d - b;
	if (y >= 0) {
		int x = c - a;
		cout<<60 * x + y - e;
	}
	else {
		y += 60;
		int x = c - a - 1;
		cout << 60 * x + y - e;
	}
}


Measured memory_bytes: 3636
#include <iostream>
#include <string.h>
using namespace std;
int main(void){
    // Your code here!
    char S[1001], T[1001];
    scanf("%s",S);
    scanf("%s",T);
    
    int sl, tl;
    sl = strlen(S);
    tl = strlen(T);
    //printf("sl = %d, tl = %d\n",sl,tl);
    
    int count;
    int min = 1001;
    
    for(int i = 0; i < sl-tl+1; i++)
    {
        count = 0;
        for(int j = 0; j < tl; j++)
        {
            if(T[j] == S[i+j])
                count++;
        }
        count = tl -count;
        min = (min>count)? count:min;
    }
    
    printf("%d\n", min);
}


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

int main(){
    int n;
    cin >> n;
    for(ll a=-118;a<=119;a++) {
        for(ll b=-119;b<=118;b++){
            if(a*a*a*a*a - b*b*b*b*b == n){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int[] arr = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k=scan.nextInt();
        System.out.println(arr[k-1]);
    }
}

Measured memory_bytes: 20948
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

ll p[51];
ll sum[51];

ll func(ll n, ll x){
  if(n == 0) return 1;
  if(x == 0) return 0;
  ll ans = 0LL;
  
  if(x == 1) return 0;
  else if(x <= sum[n-1] + 1) ans += func(n-1,x-1);
  else if(x == sum[n-1] + 2) ans += p[n-1]+1;
  else if(x >= sum[n-1] + 3 && x <= sum[n] - 1) ans += p[n-1]+1+func(n-1,x-1-sum[n-1]-1);
  else ans += p[n];
  return ans;
}

int
main(void){  
  ios_base::sync_with_stdio(false);

  ll n, x;

  cin >> n >> x;

  p[0] = 1LL;
  sum[0] = 1LL;
  
  FOR(i, 1, 51){
    p[i] = 2*p[i-1] + 1;
    sum[i] = 2*sum[i-1] + 3;
  }

  //REP(i, n+1) cout << sum[i] << endl;

  cout << func(n, x) << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
import math
x=int(input())
ans=0
if x<=3:
    print(1)
    exit()
for i in range(2,int(math.sqrt(x)//1)+1):
    j=2
    tmp=i**j
    while tmp<x:
        tmp=i**j
        j+=1
        if tmp<=x and tmp>ans:
            ans=tmp
print(ans)  

Measured memory_bytes: 62056
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

		String W = sc.nextLine();
		String T = "";
		String end = "END_OF_TEXT";


		int ans = 0;

		while (!(T.equals(end))) {
			T = sc.next();
			Pattern ptn = Pattern.compile(W, Pattern.CASE_INSENSITIVE);
			Matcher mc = ptn.matcher(T);
			if(mc.matches()){
				ans++;
			}
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 26284
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll S;
    cin >> S;
    ll r = S%(1000000000);
    r = ll(1000000000) - r;
    r %= 1000000000;
    ll q = (S+r)/(1000000000);
    cout << "0 0 1000000000 1 " << r << " " << q << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int a,b;


void odd_or_even(int a,int b){
  if(a*b%2==1){
    printf("Odd");
  }else{
    printf("Even");
  }
  return;
}

int main(void){
  scanf("%d%d", &a, &b);
  odd_or_even(a,b);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue;    //cost, vertex(行き先)
using namespace std;

#define MODULE 1000000007
#define MP make_pair
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

typedef pair<int, int> P;
typedef long long LL;


/*struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];*/


//-----Template---------

int main(){
    multiset<pair<int,int>,std::greater<pair<int,int>> > memo;
    int k=0,t=0,tmpA=0,last=-1;
    bool flag=false;
    int counter=0;
    ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
    cin>>k>>t;
    for (int i = 0; i < t; ++i) {
        cin>>tmpA;
        memo.insert(MP(tmpA,i));
    }
    for (int i = 0; i < k; ++i) {
        flag=false;
        for (auto it=memo.begin();it!=memo.end();it++) {
            if(it->second!=last && it->first>0){
                last=it->second;
                pair<int,int> p=MP(it->first,it->second);
                memo.erase(p);
                memo.insert(MP(p.first-1,p.second));
                flag=true;
                break;
            }
            /*
            if(e.first!=last && e.second>0){    //残ってて，前回のと違うのがあれば
                last=e.first;
                memo[e.first]--;
                flag=true;
                break;
            }*/
        }
        //もし上でなければ残ってるのはlastしかない
        //バグりそう
        if (!flag){
            //auto it=memo.begin();
            //memo[last]--;
            for (auto e:memo) {
                if(e.second==last){
                    pair<int,int> p=e;
                    memo.erase(p);
                    memo.insert(MP(p.first-1,p.second));
                }
            }
            counter++;
        }
    }
    cout<<counter<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int x = int.Parse(Console.ReadLine());
			long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			for (long i = 0; i < 1000; i++) {
				for (long j = 0; j < 1000; j++) {
					if (i * i * i * i * i - j * j * j * j * j == x) {
						//System.Diagnostics.Debug.WriteLine($"{i * i * i * i * i - j * j * j * j * j} = {i}^5 - {j}^5");
						Console.WriteLine($"{i} {j}");
						return;
					}
					if (i * i * i * i * i - -j * -j * -j * -j * -j == x) {
						//System.Diagnostics.Debug.WriteLine($"{i * i * i * i * i - -j * -j * -j * -j * -j} = {i}^5 - {-j}^5");
						Console.WriteLine($"{i} {-j}");
						return;
					}
				}
			}

		}

	}
}


Measured memory_bytes: 27452
import sys
input = sys.stdin.readline

N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353

DP=[0]*(S+1)

# 多項式の考え方が分かりやすい.
# 多項式を使わないなら,
# DP[j] := 終端がiになる区間について, S=jのときのF(*,i)の和
# を更新していくと考えれば良いのかな...

DP[0]=1
ANS=0
for a in A:
    for i in range(S-a,-1,-1):
        DP[i+a]+=DP[i]
    DP[0]+=1
    ANS+=DP[S]
    
print(ANS%mod)

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const int V=500*500;

int H,W,N;
// ????????????????????????
int p[V];

// ???????????????1?¬???????
inline int cv(int y, int x)
{
    return y*W+x;
}

// ?¬???????????????????
int f[20][V];

int main()
{
    scanf(" %d %d %d", &H, &W, &N);

    rep(i,H)rep(j,W)
    {
        int r,c;
        scanf(" %d %d", &r, &c);
        f[0][cv(i,j)] = cv(r,c);
    }
    rep(i,N)
    {
        int r,c;
        scanf(" %d %d", &r, &c);
        p[i] = cv(r,c);
    }

    for(int i=1; i<20; ++i)rep(j,V) f[i][j] = f[i-1][f[i-1][j]];

    int l=0,r=2*H*W;
    while(r-l>1)
    {
        int m=(l+r)/2;
        vector<int> ct(V,0);
        rep(i,N)
        {
            int now = p[i];
            rep(j,20)if(m>>j&1) now = f[j][now];

            ++ct[now];
        }

        bool ok=true;
        rep(i,V)if(ct[i]>1) ok=false;

        if(ok) l=m;
        else r=m;
    }

    if(r==2*H*W) r=-1;
    printf("%d\n", r);
    return 0;
}

Measured memory_bytes: 24612
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int e8 = in.nextInt();
        int sq = in.nextInt();
        in.close();
        String ans = (e8 < 9 && sq < 9) ? "Yay!" : ":(";
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nk = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var s = Console.ReadLine();
            var result = "";
            for (var i = 0; i < s.Length; i++)
            {
                result += (i + 1 == nk[1] ? Char.ToLower(s[i]) : s[i]);
            }
            Console.WriteLine(result);
        }
    }
}


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

int main() {
	int N;
	cin >> N;
	set<int> A;
	rep(i, N) {
		int a;
		cin >> a;
		A.insert(a);
	}
	cout << (N == A.size() ? "YES" : "NO") << endl;
	return 0;
}


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

using namespace std;

const int MaxN = 2e5 + 25;
const int INF = 1e9;

int a[MaxN];
int dp[MaxN][5];

int cost(int t, int x)
{
    if(t == 0 || t == 4)
        return x;
    if(t == 1 || t == 3)
    {
        if(x == 0)
            return 2;
        if(x % 2 == 1)
            return 1;
        return 0;
    }
    if(t == 2)
    {
        if(x == 0 || x % 2 == 0)
            return 1;
        return 0;
    }
}

void up(int & x, int y)
{
    if(x > y)
        x = y;
}


int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    int n;
    cin >> n;

    for(int i = 1; i <= n; ++i)
        for(int j = 0; j < 5; ++j)
            dp[i][j] = INF;

    for(int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        for(int prev = 0; prev < 5; ++prev)
        {
            for(int nxt = prev; nxt < 5; ++nxt)
            {
                up(dp[i][nxt], dp[i - 1][prev] + cost(nxt, a[i]));
            }
        }
    }

    int ans = INF;
    for(int i = 0; i < 5; ++i)
        ans = min(ans, dp[n][i]);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  ll x,now=100,cnt=0;
  cin>>x;
  while(x>now)
  {
    now*=1.01;
    cnt++;
  }
  cout<<cnt;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Scanner;

public class Main {

	// he, his, hat は全て't'より若い文字コードを持つ
	private static final int[] PATTEN_THE_ = { 0, -12, -15 };
	private static final int[] PATTEN_THIS = { 0, -12, -11, -1 };
	private static final int[] PATTEN_THAT = { 0, -12, -19, 0 };

	private static enum WORD {
		THE_, THIS, THAT, OTHER
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		// Scanner sc;
		// ArrayList<String> words;
		String[] words;

		while ((line = br.readLine()) != null) {
			// sc = new Scanner(line);
			// words = new ArrayList<String>();
			// while (sc.hasNext()) {
			// words.add(sc.next());
			// }
			words = line.split(" ");
			for (String word : words) {
				String check = word.replace(".", "");
				WORD pattern = WORD.OTHER;
				int shift;
				if (check.length() == 3) {
					pattern = checkPattern(check, PATTEN_THE_);
				} else if (check.length() == 4) {
					pattern = checkPattern(check, PATTEN_THIS);
					if (pattern != WORD.THIS)
						pattern = checkPattern(check, PATTEN_THAT);
				}
				if (pattern == WORD.THE_ || pattern == WORD.THIS
						|| pattern == WORD.THAT) {
					shift = getNumberOfShift(word.charAt(0));
					System.out.println(decode(line, shift));
					break;
				}
			}
		}
	}

	public static WORD checkPattern(String word, int[] pattern) {

		WORD result = WORD.OTHER;

		boolean isMatch = false;

		int first = word.charAt(0);
		for (int i = 1; i < word.length(); i++) {
			int target = (int) word.charAt(i);
			if (target > first)
				target -= 26;
			if (target - first == pattern[i]) {
				isMatch = true;
			} else {
				isMatch = false;
				break;
			}
		}
		if (isMatch) {
			if (pattern == PATTEN_THE_)
				result = WORD.THE_;
			if (pattern == PATTEN_THIS)
				result = WORD.THIS;
			if (pattern == PATTEN_THAT)
				result = WORD.THAT;
		}
		return result;
	}

	public static int getNumberOfShift(char charOft) {
		int result;
		result = (int) (charOft - 't');
		return result;
	}

	public static String decode(String line, int shift) {
		char[] c = line.toCharArray();
		for (int i = 0; i < c.length; i++) {
			if (c[i] >= 'a' && c[i] <= 'z') {
				c[i] = (char) (c[i] - shift);
				if (c[i] < 'a')
					c[i] = (char) (c[i] + 26);
				if (c[i] > 'z')
					c[i] = (char) (c[i] - 26);
			}
		}
		return String.valueOf(c);

		// StringBuilder sb = new StringBuilder();
		// for (int i = 0; i < line.length(); i++) {
		// char ch = line.charAt(i);
		// if (ch >= 'a' && ch <= 'z') {
		// ch = (char) ((int) ch - shift);
		// if (ch < 'a')
		// ch = (char) ((int) ch + 26);
		// if (ch > 'z')
		// ch = (char) ((int) ch - 26);
		// }
		// sb.append(ch);
		// }
		// return sb.toString();
	}
}

Measured memory_bytes: 16912