akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] h = new int[N];
		for (int i=0;i<N;i++) {
			h[i]=sc.nextInt();
		}

		int[] dp = new int[N];
		dp[0]=0;
		dp[1]=Math.abs(h[1]-h[0]);
		for (int i=0;i<N-2;i++) {
			dp[i+2]=Math.min(dp[i]+Math.abs(h[i+2]-h[i]),dp[i+1]+Math.abs(h[i+2]-h[i+1]));
		}
		System.out.println(dp[N-1]);
	}
}

Measured memory_bytes: 50976
#include<bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
//階乗
long long factorial(int n){
  long long ans = 1;
  for(int i = 2; i <= n; i++){
    ans *= i;
    ans %= mod;
  }
  return ans;
}
//順列
long long P(int n, int m){
  long long ans = 1;
  for(int i = m + 1; i <= n; i++){
    ans *= i;
    ans %= mod;
  }
  return ans;
}
//除算に必要
long long power(int n, int m){
  if(m==0){
    return 1;
  }else if(m % 2 == 0){
    long long tmp = power(n, m / 2);
    return (tmp * tmp) % mod;
  }else{
    return (n * power(n, m - 1)) % mod;
  }
}
//組み合わせ
long long C(int n, int m){
  //P(n,n-m)を
  //m!で割る
  //つまり、m!のmod-2乗をかける
  return (P(n, n - m) * power(factorial(m), mod - 2)) % mod;
}
int main(){
  int N, M;
  cin >> N >> M;
  unordered_map<int, int> c;
  for(int i = 2; M != 1; i++){
    while(M % i == 0){
      if(c.find(i)!=c.end()){
        c[i]++;
      }else{
        c[i]=1;
      }
      M /= i;
    }
  }
  long long ans = 1;
  for(auto ce:c){
    ans = (ans * (C(ce.second + N - 1, ce.second) % mod)) % mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
    int n, d, i, j, k, ans = 0;
    scanf("%d%d", &n, &d);
    double x[n][d];
    for ( i = 0; i < n; i++ ) {
        for ( j = 0; j < d; j++ ) {
            scanf("%lf", &x[i][j]);
        }
    }
    double dist = 0;
    for ( i = 0; i < n - 1; i++ ) {
        for ( j = i + 1; j < n; j++ ) {
            dist = 0;
            for ( k = 0; k < d; k++ ) {
                dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            dist = sqrt(dist);
            if ( ceil(dist) == floor(dist) ) {
                ans++;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  int  a, b, d, X, Y;
  double  c;
//  long long  a, b, c, d, X, Y;
  int D, G;
  //char s[101][101]={};
  char sv[101]={};
  char ss[101]={};
//  char s_temp[101]={};
  char t[11]={};
//  char s[10000000000000000001]={};
  char s[2][100001]={};
  int len=0;
//  int N, M;
//  int A[1000000001]={};
  long long  A[101]={};
//  long int A[1001]={};
  long long  B[101]={};
  long long  C[101]={};
  int i,j,k;
  int flag=0;
  int tmp=0;
  int min=1000;
  int cnt=0;
  double ans=1000;
  int max=0;

  int  Cen_X=0;
  int  Cen_Y=0;
  long long  H=0;
  
  //  int ans=0;
  int str_len=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int ans_o[1001]={};
  double N[1001]={};
  int ans_e[100001]={};
  
//  scanf("%lld %lld", &a, &b);
  scanf("%s", &t);
  cnt = strlen(t);
  //printf("%d\n",cnt);
  for(i=0;i<cnt-2;i++){
    tmp=(t[i]-'0')*100;
    tmp=tmp+(t[i+1]-'0')*10;
    tmp=tmp+(t[i+2]-'0')*1;
    if(min>abs(753-tmp)) min=abs(753-tmp);
//  printf("%d\n",min);
  }
      
//  if(flag==0)   printf("TLE\n");
  printf("%d\n",min);
  
return 0;
}


Measured memory_bytes: 128
// ConsoleApplication2.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include <iostream>
#include <string>
using namespace std;

//ABC 080 B

int findSumOfDigits(int N) {
	int sum = 0;
	while (true) {
		sum += N % 10;
		N /= 10;
		if (N < 1) break;
	}
	return sum;
}


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

	int sum = findSumOfDigits(N);

	if (N % sum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

mod = int(10 ** 9 + 7)


def comb(n, k):
    res = 1
    for i in range(k):
        res *= n - i
    for i in range(k):
        res //= k - i
    return res

for i in range(1, k + 1):
    if i > n - k + 1:
        print(0)
    else:
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % mod)

Measured memory_bytes: 43740
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

bool dfs(vector<int>::iterator iter, vector<int>::iterator end, int left, int right) {
  if(iter == end) return true;
  bool res = false;
  if(*iter > left) res |= dfs(iter + 1, end, *iter, right);
  if(*iter > right) res |= dfs(iter + 1, end, left, *iter);
  return res;
}

bool solve() {
  vector<int> a(10);
  for(int i = 0;i < 10;i++) cin >> a[i];
  return dfs(begin(a), end(a), 0, 0);
}

int main() {
  int t;
  cin >> t;
  for(int i = 0;i < t;i++) {
    if(solve()) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}



Measured memory_bytes: 2992
#include <iostream>
#include<algorithm>
#include<vector>
#include<string>
#include <sstream>      // std::ostringstream
using namespace std;
vector<string> split_s(const string &str, char sep);
vector<int> split_i(const string &str, char sep);
bool exhaustive_searcher(vector<int> list, int subtracted);

int main()
{
  string line;
  getline(cin, line);
  int n = stoi(line);
  getline(cin, line);
  vector<string> Ast = split_s(line, ' ');
  vector<int> A;
  for(string ast:Ast)
  {
    A.push_back(stoi(ast));
  }
  getline(cin, line);
  int q = stoi(line);

  getline(cin, line);
  vector<string> Mst = split_s(line, ' ');
  for(string mst:Mst)
  {
    if (exhaustive_searcher(A,stoi(mst)))
    {
      printf("yes\n");
    }
    else
    {
      printf("no\n");
    }
  } 
}
bool exhaustive_searcher(vector<int> list,int subtracted){
  if (subtracted<0)
  {
    return false;
  }
  if(subtracted==0){
    return true;
  }
  if(list.size()==1){
    if(list[0]==subtracted){
      return true;
    }
    else
    {
      return false;
    }
  }
  vector<int>copied;
  //サイズを合わせないとSegmentation Error
  copied.resize(list.size()-1);
  copy_n(list.begin()+1,list.size()-1, copied.begin());

  //含む
  return exhaustive_searcher(copied,subtracted-list[0])||
  //含まない
  exhaustive_searcher(copied,subtracted);
}
vector<string> split_s(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
vector<int> split_i(const string &str, char sep)
{
  vector<int> veci;
  vector<string> vecs = split_s(str, sep);
  for(string s:vecs)
  {
    veci.push_back(stoi(s));
  }
  return veci;
}


Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000

int main() {
	int x, ans = 1;
	for (int i = 0; i < 5; i++) {
		cin >> x;
		if (x == 0) break;
		ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3568
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

const int maxh = 185, maxw = 185, maxans = 16;

int16_t dp[maxh + 1][maxh][maxw][maxans + 1];
uint8_t dp_cut[maxh + 1][maxh][maxw][maxans + 1];

int main() {
  int h, w;
  scanf("%d %d", &h, &w);
  vector<string> field(h, string(w, ' '));
  for (int y = 0; y < h; ++y)
    scanf(" %s", &field[y][0]);
  for (int size = 1; size <= h; ++size)
    for (int y0 = 0; y0 + size <= h; ++y0) {
      const int y1 = y0 + size - 1;
      for (int x0 = w - 1; x0 >= 0; --x0) {
        int16_t &ans0res = dp[size][y0][x0][0];

        if (size == 1) {
          if (x0 + 1 < w && field[y0][x0] == field[y0][x0 + 1]) {
            ans0res = dp[size][y0][x0 + 1][0];
          } else {
            ans0res = x0;
          }
        } else if (size == 2) {
          if (field[y0][x0] != field[y0 + 1][x0]) {
            ans0res = x0 - 1;
          } else {
            ans0res = min(dp[1][y0][x0][0], dp[1][y0 + 1][x0][0]);
          }
        } else {
          ans0res = min(dp[size - 1][y0][x0][0], dp[size - 1][y0 + 1][x0][0]);
        }

        for (int ans = 1; ans <= maxans; ++ans) {
          int16_t &result = dp[size][y0][x0][ans];
          uint8_t &result_cut = dp_cut[size][y0][x0][ans];
          result = dp[size][y0][x0][ans - 1];

          if (size == 1) {
            result_cut = y0;
          } else {
            int best_res = -2;
            int best_res_cut_y = -2;

            for (int cut_y = max(y0, (int)dp_cut[size - 1][y0][x0][ans]);
                 cut_y <= dp_cut[size - 1][y0 + 1][x0][ans] && cut_y + 1 <= y1;
                 ++cut_y) {
              int res = min(dp[cut_y - y0 + 1][y0][x0][ans - 1],
                            dp[y1 - (cut_y + 1) + 1][cut_y + 1][x0][ans - 1]);
              if (res > best_res) {
                best_res = res;
                best_res_cut_y = cut_y;
              }
            }
            assert(best_res != -2);

            result = max((int)result, best_res);
            result_cut = best_res_cut_y;
          }

          result = max((int)result,
                       dp[size][y0][x0][ans - 1] == w - 1 ? w - 1 :
                       dp[size][y0][dp[size][y0][x0][ans - 1] + 1][ans - 1]);
        }
      }
    }

  int ans = 0;
  while (ans + 1 <= maxans && dp[h][0][0][ans] < w - 1)
    ++ans;
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 315136
#include <stdio.h>

int main(){
    char number[1001];
    int i, sum;
    while(1){
        scanf("%s", number);
        if(number[0]==48)break;
        sum=0;
        for(i=0;number[i]!='\0';i++){
            sum+=number[i] - 48;
        }
        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 2604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int H, W;
string S[2000];

int sum[2001][2001][4]; //0:left, 1:right, 2:down, 3:up

int main() {
	cin >> H >> W;
	REP(i, H) cin >> S[i];
	
	REP(i, H) {
		sum[i][0][0] = S[i][0] == '.';
		FOR(j, 1, W) sum[i][j][0] = S[i][j] == '.' ? sum[i][j - 1][0] + 1 : 0;
		
		sum[i][W - 1][1] = S[i][W - 1] == '.';
		FOR(j, 1, W) sum[i][W - 1 - j][1] = S[i][W - 1 - j] == '.' ? sum[i][W - j][1] + 1 : 0;
	}
	
	REP(j, W) {
		sum[0][j][3] = S[0][j] == '.';
		FOR(i, 1, H) sum[i][j][3] = S[i][j] == '.' ? sum[i - 1][j][3] + 1 : 0;
		
		sum[H - 1][j][2] = S[H - 1][j] == '.';
		FOR(i, 1, H) sum[H - 1 - i][j][2] = S[H - 1 - i][j] == '.' ? sum[H - i][j][2] + 1 : 0;
	}
	
	int ans = 0;
	REP(i, H) REP(j, W) if (S[i][j] == '.') {
		int cur = 1;
		REP(k, 4) cur += sum[i][j][k];
		chmax(ans, cur - 4);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  double tmp, ans=0;
  for(int i=0;i<n;i++){
    cin >> tmp;
    ans += 1/tmp;
  }
  cout << setprecision(15) << 1/ans << endl;
}

Measured memory_bytes: 3736
def func(n, A):
    flag = True
    count = 0
    i = 0
    while (flag):
        flag = False
        for j in reversed(range(i+1, n)):
            if (A[j] < A[j-1]):
                A[j], A[j-1] = A[j-1], A[j]
                flag = True
                count += 1
        i += 1
    print (" ".join(map(str, A)))
    print (count)

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


Measured memory_bytes: 5600
#include<stdio.h>
int prime[11111],ptr=0;
void prime_number(void){
	int i,j,flag;
	prime[ptr++]=2;prime[ptr++]=3;
	for(i=5;ptr<=10474;i+=2){
		flag=0;
		for(j=1;prime[j]*prime[j]<=i;j++){
			if(i%prime[j]==0){flag=1;break;}
		}
		if(!flag){prime[ptr++]=i;}
	}
}
int main(void){
	int i,j,n,k,ans;
	prime_number();
	while(1){
		scanf("%d",&n);
		ans=0;ptr=0;
		if(n==0)break;
		for(i=0;i<n;i++){ans+=prime[i];}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define MOD (1000000007ll)
typedef pair<int, int> P;

queue<P> q;

int mp[55][55];
bool done[55][55];

int main(void){
	int h,w,i,j,ans=0;
	P tmp;
	string s[55];
	fill(mp[0],mp[55],-1);
	fill(done[0],done[55],false);
	cin >> h >> w;
	for(i=0; i<h; i++){
		cin >> s[i];
		for(j=0; j<w; j++){
			if(s[i][j] == '.'){
				mp[i+1][j+1] = INF;
				ans++;
			}
		}
	}
	mp[1][1] = 1;
	q.push(P(1,1));
	while(!q.empty()){
		tmp = q.front();
		q.pop();
		i = tmp.first;
		j = tmp.second;
		if(done[i][j]){
			continue;
		}
		done[i][j] = true;
		if(mp[i-1][j]!=-1 && !done[i-1][j]){
			mp[i-1][j] = min(mp[i-1][j],mp[i][j]+1);
			q.push(P(i-1,j));
		}
		if(mp[i+1][j]!=-1 && !done[i+1][j]){
			mp[i+1][j] = min(mp[i+1][j],mp[i][j]+1);
			q.push(P(i+1,j));
		}
		if(mp[i][j-1]!=-1 && !done[i][j-1]){
			mp[i][j-1] = min(mp[i][j-1],mp[i][j]+1);
			q.push(P(i,j-1));
		}
		if(mp[i][j+1]!=-1 && !done[i][j+1]){
			mp[i][j+1] = min(mp[i][j+1],mp[i][j]+1);
			q.push(P(i,j+1));
		}
	}
	cout << ((done[h][w])?(ans-mp[h][w]):-1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 110;
const int MAX_W = 10100;
int n, W;
int w[MAX_N], v[MAX_N];
int dp[MAX_N+1][MAX_W+1];

int main() {
    cin >> n;
    cin >> W;
    rep(i,n){
        cin >> v[i] >> w[i];
    }
    

    drep(i,n){
        rep(j,W+1){
            if(j<w[i]){
                dp[i][j] = dp[i+1][j];
            }else{
                dp[i][j] = max(dp[i+1][j], dp[i+1][j-w[i]] + v[i]);
            }
        }
    }

    cout << dp[0][W] << endl;
    return 0;
}
 
 



Measured memory_bytes: 7016
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x) (x.begin(),x.end()) 
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 
 
int32_t main(){
  fast; 
/*  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif 
    */
  int T=1; //cin>>T; 
  while(T--){

    int n,d,a; cin>>n>>d>>a;  int sum=0; 
    vpii h(n); for(int i=0;i<n;i++) { int x,y; cin>>x>>y; h[i]={x,y}; sum+=y; } 


    SORT(h); int ans =0; 
    vi pfx(n+1); 

    int j=0; //int ans=0;  
    for(int i=0;i<n;i++){
        while(j<n && h[j].ff<=h[i].ff+2*d) j++; 

        int val=(h[i].sec-pfx[i]*a+a-1)/a; 
            val=max(val,(int)0); 
        ans+=val;    
        pfx[i]+=val; 
        pfx[j]-=val;    
        pfx[i+1]+=pfx[i]; 
    }

    cout<<ans<<endl; 

  }
    


  return 0; 
} 


Measured memory_bytes: 7960
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(n:i64 a:i64 b:i64));
    let mut a = a;
    let mut b = b;
    loop {
        //aは大きく、bは小さくなるように
        if a + 1 != b {
            a += 1;
        } else if a != 1 {
            a -= 1;
        } else {
            return "Borys".to_string();
        }

        if b - 1 != a {
            b -= 1;
        } else if b != n {
            b += 1;
        } else {
            return "Alice".to_string();
        }
    }
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "5 2 4" => "Alice",
    test2: "2 1 2" => "Borys",
    test3: "58 23 42" => "Borys",
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
#define VI vector<int>
#define VL vector<LL>
#define VII vector< vector<int> >
#define VLL vector< vector<LL> >
#define VS  vector<string>
#define VSS vector< vector<string> >
#define PII pair<int,int>
#define PIS pair<int,string>
#define PSI pair<string,int>
#define PLL pair<LL,LL>
const LL MOD = 1000000007;
const LL INF = 1e16;
LL facctorialMethod(int k);
int main(){
    string s,rev_s;
    cin >> s;
    rev_s = s;
    reverse(rev_s.begin(), rev_s.end());
//    cout << rev_s.substr(0,1) << endl;
    if(rev_s.substr(0,1) == "s"){
        s = s + "es";
    }else{
        s = s + "s";
    }
    cout << s << endl;

    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = k; i < (int)(n); i++)
const int maxN = int(1e5 + 10);
int e[maxN] = {}, o[maxN] = {};
int num[maxN] = {};
using ll = long long;

int main() {
    int x, y;
    cin >> x >> y;
    cout << x + y / 2 << endl;
    return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

#define MAX 1000000

bitset<MAX> prime;
vector<int> primeList;

void sieve() {
    prime.set();
    prime[0] = prime[1] = 0;
    primeList.push_back(2);
    for (int i=4; i<MAX; i+=2)
        prime[i] = 0;
    for (int p=3; p<MAX; p+=2)
        if (prime[p]) {
            primeList.push_back(p);
            for (int i=p; i<=(MAX-1)/p; i+=2)
                prime[i*p] = 0;
        }
}

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

    sieve();

    int n;
    cin >> n;
    bool ok = true;
    int g = 0;
    set<int> st;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        g = __gcd(g, a);
        if (ok) {
            for (int p : primeList) {
                if (p > a / p)
                    break;
                if (a % p == 0) {
                    ok &= !st.count(p);
                    st.insert(p);
                    while (a % p == 0)
                        a /= p;
                }
            }
            if (a > 1) {
                ok &= !st.count(a);
                st.insert(a);
            }
        }
    }

    cout << (ok ? "pairwise coprime" : g == 1 ? "setwise coprime" : "not coprime") << "\n";

    return 0;
}


Measured memory_bytes: 7460
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds; 
using namespace std;
 
#define ld long double
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define int long long
#define ull unsigned long long 
#define pii pair<int,int>
#define vii vector<int>
#define f first
#define s second
#define endl "\n"
#define all(container) container.begin(), container.end()
#define onlyunique(v) v.erase(unique(all(v)), v.end());
 
#define TRACE
#ifdef AYUSH
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const unordered_set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const ordered_set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << '{'<<v.first << ' ' << v.second << '}'; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero)
 
int const mod = 1e9+7;
int const inf = 1e18;
 
int power(int x, int y, int mod = 2e18){ int ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
int modinv(int a, int m){return power(a, m-2, m);}
const ld PI = 3.1415926535897932384626433832795;

void solve() {
    string n; cin >> n;
    int m = 0;
    for(auto x: n) {
        m += x - '0';
        m %= 9;
    }
    cout << (m == 0 ? "Yes\n" : "No\n");
}
signed main() {
    IOS
    int t = 1, T = 1;
    // cin>>t;
    while (t--) {
        // cout<<"Case #"<<T<<": ";
        solve();
        // ++T;
    }
    return 0;
}

Measured memory_bytes: 3784
use std::io;

fn main() {
    let (n, m) = {
        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();
        let nm = line.split_whitespace().map(|s| s.parse().unwrap()).collect::<Vec<i64>>();
        (nm[0], nm[1])
    };

    let a = if m > n * 2 {
        let x = m - n * 2;
        x / 4 + n
    } else {
        m / 2
    };

    print!("{:?}", a);
}


Measured memory_bytes: 4352
import java.util.*;

import static java.util.Arrays.sort;

public class Main {
    static Scanner sc;


    public static void main(String[] args) {
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] l = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
        }
        sort(l);
        int ans = 0;
        for (int a = 0; a < n; a++) {
            for (int b = a+1; b < n; b++) {
                for (int c = b + 1; c < n; c++) {
                    if(l[c] >= l[a] + l[b]) break;
                    if(l[b] < l[a] + l[c] && l[a] < l[b] + l[c]) {
                        ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 27400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a,b,c,d,sum=0,x,y,z,w,v;
  vector<string>vec(2);
  vec.at(0)='+';
  vec.at(1)='-';
  cin>>a;
  d=a%10;
  c=((a-b)/10)%10;
  b=(a/100)%10;
  a/=1000;
  rep(i,2){
    sum=a;
    if (i==0) {
      sum+=b;
    }
    else{
      sum-=b;
    }
    w=sum;
    rep(j,2){
      sum=w;
      if (j==0) {
        sum+=c;
      }
      else{
        sum-=c;
      }
      v=sum;
      rep(k,2){
        sum=v;
        if (k==0) {
          sum+=d;
          if (sum==7) {
            x=i;
            y=j;
            z=k;
          }
        }
        else{
          sum-=d;
          if (sum==7) {
            x=i;
            y=j;
            z=k;
          }
        }
      }
    }
  }
  cout<<a<<vec.at(x)<<b<<vec.at(y)<<c<<vec.at(z)<<d<<"=7"<<endl;
}



Measured memory_bytes: 256
num_line = input().split(" ")
x_num = int(num_line[0])
y_num = int(num_line[1])
num = int(num_line[2])

tangle = [[1]*x_num for i in range(y_num)]

#print(tangle)

for i in range(num):
    line = input().split(" ")
    x_tem = int(line[0])
    y_tem = int(line[1])
    index = int(line[2])
    
    if(index == 1):
        for j in range(y_num):
            for k in range(x_tem):
                tangle[j][k] = 0
        #print(tangle)            
        
    elif(index == 2):
        for j in range(y_num):
            for k in range(x_num - x_tem):
                tangle[j][k + x_tem] = 0
        #print(tangle)
        
    elif(index == 3):
        for j in range(y_tem):
            for k in range(x_num):
                tangle[j][k] = 0
        #print(tangle)
        
    else:
        for j in range(y_num - y_tem):
            for k in range(x_num):
                tangle[j + y_tem][k] = 0
        #print(tangle)
        
result = 0
for i in range(y_num):
    for j in range(x_num):
        result += tangle[i][j]
        
print(result)

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

ll tx,ty,n,x[1009],y[1009];
double d[1009][1009],dis[1009],r[1009];

ll jo2(ll x){return x*x;}

int main(){
    cin>>x[0]>>y[0]>>tx>>ty>>n;
    x[n+1]=tx;
    y[n+1]=ty;
    rep(i,n)cin>>x[i+1]>>y[i+1]>>r[i+1];
    
    rep(i,n+2){
        dis[i]=1e18;
        rep(j,n+2){
            d[i][j]=max(0.0,sqrt(jo2(x[i]-x[j])+jo2(y[i]-y[j]))-r[i]-r[j]);
        }
    }

    dis[0]=0.0;
    priority_queue<pair<double,ll>,vector<pair<double,ll>>,greater<pair<double,ll>>> que;
    que.push({0.0,0});
    while(!que.empty()){
        int V=que.top().second;
        double D=que.top().first;
        que.pop();
        if(dis[V]<D)continue;
        rep(i,n+2)if(dis[i]>D+d[V][i]){
            dis[i]=D+d[V][i];
            que.push({dis[i],i});
        }
    }
    printf("%.10f\n",dis[n+1]);
}

Measured memory_bytes: 14064
//Shunji Lin 08-144505
#include <iostream>
#include <string>

using namespace std;

int reachable = 0;

void DFS(bool grid[20][20], bool visited[20][20],  int row_pos, int col_pos, int H, int W);

void DFS_aux(bool grid[20][20], bool visited[20][20], int row_pos, int col_pos, int H, int W) {
  if (grid[row_pos][col_pos] && !visited[row_pos][col_pos]) {
    DFS(grid, visited, row_pos, col_pos, H, W);
  }
    
}
	 
void DFS(bool grid[20][20], bool visited[20][20], int row_pos, int col_pos, int H, int W) {
  visited[row_pos][col_pos] = true; //mark as visited
  reachable += 1; // increase reachable count

  //do all four actions (up, left, down, right), unless corner cases
  if (!(row_pos == 0)) {
    DFS_aux(grid, visited, row_pos-1, col_pos, H, W); //up
  }
  if (!(col_pos == 0)) {
    DFS_aux(grid, visited, row_pos, col_pos-1, H, W); //left
  }
  if (!(row_pos == H-1)) {
    DFS_aux(grid, visited, row_pos + 1, col_pos, H, W); //down
  }
  if (!(col_pos == W-1)) {
    DFS_aux(grid, visited, row_pos, col_pos + 1, H , W); //right
  }
}


int main() {
  while (true) {
    bool grid[20][20] = {{false}};
    bool visited[20][20] = {{false}};
    reachable = 0;
    int man_row = -1, man_col = -1;
    int W, H;
    cin >> W >> H;
    if (W == 0 && H == 0) break;
    for (int i = 0; i < H; i++) {
      string line;
      cin >> line;
      for (int j = 0; j < W; j++) {
	if (line[j] == '@') {
	  grid[i][j] = true;
	  man_row = i;
	  man_col = j;
	} else if (line[j] == '.') {
	  grid[i][j] = true;
	}
      }
    }
    /*
    //print out grid
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
	if (grid[i][j] == true) {
	  cout << 'b';
	} else if (grid[i][j] == false) {
	  cout << 'r';
	} 
      }
      cout << endl;
    }
    */
    
    DFS(grid, visited,  man_row, man_col, H, W );
    cout << reachable << endl;
  }
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
string s;
long long ans1,ans2;
int main(){
	cin>>s;
	for(int i =0;i<s.size();i++){
		if(i%2==0){
			if(s[i]=='0')ans1++;
		}
		else if(s[i]=='1')ans1++;
	}
	for(int i =0;i<s.size();i++){
		if(i%2==1){
			if(s[i]=='0')ans2++;
		}
		else if(s[i]=='1')ans2++;
	}
	cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0384
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] vs = RArInt();
            int a = vs[0], n = vs[1], m = vs[2];

            int res = 0;
            for (int i = 1; i < m; i++)
            {
                int powN = (int)Math.Pow(i, n);
                if (powN > m) break;
                else
                {
                    int digitsSum = powN.ToString().Select(x => int.Parse(x.ToString())).Sum();
                    if ((int)Math.Pow(digitsSum + a, n) == powN) res++;
                }
            }
            Console.WriteLine(res);
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



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

int L[101];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < 2 * N; i++) cin >> L[i];
    sort(L, L + 2 * N);
    int ans = 0;
    for (int i = 0; i < 2 * N; i += 2) ans += L[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
taro = 0
hanako = 0

for i in range(n):
    t,h = input().split()

    if t > h:
        taro +=3
    elif t < h:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro,hanako)


Measured memory_bytes: 5592
import collections

n,m = (int(x) for x in input().split())
d = [[] for i in range(n)]
ans = [0]*n
check = [0]*n
for i in range(m):
    a,b= (int(x) for x in input().split())
    d[a-1].append(b)
    d[b-1].append(a)

q = collections.deque()
q.append(1)

while len(q)!=0:
    v = q.popleft()
    for j in d[v-1]:
        if check[j-1]==0:
            check[j-1] = 1
            ans[j-1] = v
            q.append(j)

flag = True
for i in range(1,n):
    if check[i]==0:
        flag = False

if flag:
    print("Yes")
    for i in range(1,n):
        print(ans[i])
else:
    print("No")


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

int main(){
	int h[3], n;
	double R[3], r, min;
	while (cin >> h[0] >> h[1] >> h[2]) {
		if (h[0] == 0 && h[1] == 0 && h[2] == 0) { break; }
		R[0] = pow(h[0], 2) + pow(h[1], 2);
		R[1] = pow(h[0], 2) + pow(h[2], 2);
		R[2] = pow(h[1], 2) + pow(h[2], 2);
		min = R[0];
		if(min>R[1]){
			min = R[1];
		}
		if(min>R[2]){
			min = R[2];
		}
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> r;
			r = pow(2 * r, 2);
			if(r > min){
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}

	}
	return 0;
}

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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

// p < q
bool compare_pair(intpair p, intpair q) {
    auto [w1, s1] = p;
    auto [w2, s2] = q;
    return s1 * (w2 + s2) <= s2 * (w1 + s1);
}

signed main(){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    
    set<int> waterlist, sugarlist;
    for(int i = 0; 100 * a * i <= f; i++){
        for(int j = 0; (100 * a * i) + (100 * b * j) <= f; j++){
            waterlist.insert((100 * a * i) + (100 * b * j));
        }
    }
    for(int i = 0; c * i <= f; i++){
        for(int j = 0; (c * i) + (d * j) <= f; j++){
            sugarlist.insert((c * i) + (d * j));
        }
    }
    
    intpair ans = {1,0};
    for(int water : waterlist){
        for(int sugar : sugarlist){
            if(water + sugar > f) continue;
            if(sugar > e * (water / 100)) continue;
            auto p = make_pair(water, sugar);
            // ans <= now
            if(compare_pair(ans, p)) ans = p;
        }
    }
    
    cout << ans.first + ans.second << ' ' << ans.second << endl;
}

Measured memory_bytes: 3704
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] a = new int[n];

    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
      if (i >= k) {
        if (a[i] > a[i - k]) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
      }
    }

  }
}

Measured memory_bytes: 60460
N = int(input())
A = list(map(int, input().split()))

m = 0

for i in range(N):
    if A[i] < 0:
        m += 1
        A[i] = -A[i]

if m % 2 == 0:
    print(sum(A))
else:
    print(sum(A) - 2 * min(A))

Measured memory_bytes: 19940
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define endl '\n'
using namespace std;


void solve(){
    int n,d;
    cin>>n>>d;
    long long dd = d*1LL*d;
    vector<pair<int,int>> vi;
    vi.reserve(n);
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        if((x>d)||(y>d)) continue;
        vi.push_back({x,y});
    }
    int ans = 0;
    rep(i,0,vi.size()){
        if((vi[i].first*1LL*vi[i].first + vi[i].second*1LL*vi[i].second)<=dd) ans++;
    }
    cout<<ans;
    return ;
}
int main(int argc, const char* argv[]){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t;
    // cin>>t;
    t = 1;
    while(t--)
        solve();
    return 0;
}

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

int main()
{
  char c[3][3];
  for(int i=0; i<3; ++i)
  {
    for(int j=0; j<3; ++j)
    {
      cin >> c[i][j];
    }
  }
  for(int i=0; i<3; ++i)
    cout << c[i][i];
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

Vi dp(100020,-1);
void solve(){
    int n;
    cin >> n;
    Vi a(n);
    rp(i,n) cin >> a[i];
    rp(i,n){
        if(dp[0]<a[i]) {
            dp[0]=a[i];
            continue;
        }
        ll mid, ok = 0, ng = n;
        while(abs(ok-ng)>1){
            mid = (ok+ng)/2;
            if(dp[mid]>=a[i])ok = mid;
            else ng = mid;
        }//midではなくokを使わないとバグる!
        dp[ng]=a[i];
    }
    ll ctr=0;
    rp(i,n+1){
        if(dp[i]>=0)ctr++;
    }
    print(ctr);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 4776
n,m = map(int,input().split())
a = [input() for i in range(n)]
b = [input() for j in range(m)]
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        count = 0
        for k in range(m):
            for l in range(m):
                if b[k][l] == a[i+k][j+l]:
                    count += 1
        if count == m*m:
            ans = "Yes"
            break

print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
    int t,k;
    cin>>t>>k;
    int a[t];
    for(int i=0;i<t;i++)cin>>a[i];
    sort(a,a+t);
    int sum=0;
    for(int i=0;i<k;i++)sum+=a[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3224
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a == 2){
		a = 2;
	}
	else if(a == 4 || a == 6 || a == 9 || a == 11){
		a = 1;
	}
	else{
		a = 0;
	}
	
	if(b == 2){
		b = 2;
	}
	else if(b == 4 || b == 6 || b == 9 || b == 11){
		b = 1;
	}
	else{
		b = 0;
	}
	
	if(a == b){
		cout << "Yes" <<endl;
	}
	else{
		cout << "No" <<endl;
	}
	
 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  int n;
  string a,b,c;
  cin >> n >> a >> b >> c;
  int cnt = 0;
  for(int i = 0;i < n;i++) {
    if(a[i] == b[i] && b[i] == c[i]) {}
    else if(a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) {
      cnt++;
    }
    else {
      cnt += 2;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef long long ijt;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void) {
	ijt h, w; cin >> h >> w;
	if (h % 3 == 0 or w % 3 == 0) {
		cout << 0 << endl;
		return 0;
	}
	ijt ans = INF;
	for (ijt i = 1; i < h; i++) {
		vector<ijt> a(3);
		a[0] = w * i;
		a[1] = (h - i)*(w / 2);
		a[2] = (h - i)*(w - w / 2);
		sort(all(a));
		mins(ans, a[2] - a[0]);
	}
	for (ijt i = 1; i < w; i++) {
		vector<ijt> a(3);
		a[0] = h * i;
		a[1] = (w - i)*(h / 2);
		a[2] = (w - i)*(h - h / 2);
		sort(all(a));
		mins(ans, a[2] - a[0]);
	}
	mins(ans, h);
	mins(ans, w);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
//#define Mfc_Tanzim
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ff first
#define ss second
#define all(v) (v.begin(), v.end())
#define pi acos(-1.0)
#define FastRead ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define bug(a) cerr << #a << " : " << a << endl
#define pq dp
using namespace std;
const ll mx = 4444444444;

ll posx[] = {1,-1, 0, 0};
ll posy[] = {0, 0, 1,-1};

int main()
{
    FastRead

#ifdef Mfc_Tanzim
    freopen("input.txt","r", stdin);
    // freopen("output.txt","w", stdout);
#endif /// Mfc_Tanzim

    ll t=1, n, k, m, a, b, c, d;
    //cin >> t;

    while(t--){
              cin >> n;
              vector<ll>v(n);
              ll ans = 0;
              for(auto &i: v){
                      cin >> i;
              }
              //sort all(v);
              for(ll i=0; i<n; i++){
                     for(ll j=i+1; j<n; j++){
                              for(ll k=j+1; k<n; k++){
                                       set<ll>s;
                                       s.insert(v[i]);
                                       s.insert(v[j]);
                                       s.insert(v[k]);
                                       if(s.size()!=3){
                                               continue;
                                       }
                                       if(v[i]+v[j]>v[k]&&v[i]+v[k]>v[j]&&v[j]+v[k]>v[i]){
                                              ans++;
                                              //cout << i+1 << " " << j+1 << " " << k+1 << endl;
                                       }
                              }
                     }
              }
              cout << ans << endl;

    }
    return 0;
}



Measured memory_bytes: 3660
import math
def is_square(N):
    return math.sqrt(N) - int(math.sqrt(N)) == 0

def get_divisor_count(N):
    divisor_count = 0
    for i in range(1,int(math.sqrt(N))+1):
        if N%i == 0:
            divisor_count += 1
    return divisor_count*2 if is_square(N) == False else divisor_count*2 - 1
if __name__ == "__main__":
    N = int(input())
    count = 0
    for i in range(1,N+1,2):
        if get_divisor_count(i) == 8:
            count += 1
    print(count)

Measured memory_bytes: 9184