akhauriyash/Code-Regression huggingface dataset:
// AOJ 0171: Dice Puzzle
// 2017.8.17 bal4u@uu
// 2017.12.29
// ?????????????????¢??¨??????????????????????????°

#include <stdio.h>

int rot[24][7] = {
	{ 0,1,2,3,4,5,6 },{ 0,1,3,5,2,4,6 },{ 0,1,4,2,5,3,6 },{ 0,1,5,4,3,2,6 },
	{ 0,2,6,3,4,1,5 },{ 0,2,3,1,6,4,5 },{ 0,2,1,4,3,6,5 },{ 0,2,4,6,1,3,5 },
	{ 0,3,1,2,5,6,4 },{ 0,3,2,6,1,5,4 },{ 0,3,5,1,6,2,4 },{ 0,3,6,5,2,1,4 },
	{ 0,4,1,5,2,6,3 },{ 0,4,2,1,6,5,3 },{ 0,4,5,6,1,2,3 },{ 0,4,6,2,5,1,3 },
	{ 0,5,1,3,4,6,2 },{ 0,5,3,6,1,4,2 },{ 0,5,4,1,6,3,2 },{ 0,5,6,4,3,1,2 },
	{ 0,6,2,4,3,5,1 },{ 0,6,3,2,5,4,1 },{ 0,6,5,3,4,2,1 },{ 0,6,4,5,2,3,1 } };

int con[8][7][2] = {{{0}},
	{{0},{0},{0},{0},{0,3},{0},{0}},		// ?????????????????¨??¢??????
	{{0},{0},{1,5},{0},{0},{0},{0}},
	{{0},{0},{0,5},{2,4},{0},{0},{0}},
	{{0},{0},{0},{0},{0},{0},{0,1}},
	{{0},{0},{0},{0},{4,3},{0},{1,1}},
	{{0},{0},{5,5},{0},{0},{0},{2,1}},
	{{0},{0},{4,5},{6,4},{0},{0},{3,1}}};

char dice[8][8];
char kari[8][8], f[9];
char tr[128];

int rec(int n)
{
	int i, j, k, cnt;
	char tbl[7][2], c;

	if (n == 8) return 1;
	for (i = 0; i < 8; i++) {
		if (f[i]) continue;
		cnt = 0;
		for (j = 1; j <= 6; j++) if (con[n][j][1]) {
			c = tr[kari[con[n][j][0]][con[n][j][1]]];
			for (k = 1; k <= 6; k++) {
				if (dice[i][k] == c) { tbl[cnt][0] = j, tbl[cnt++][1] = c; break; }
			}
			if (k > 6) goto next;
		}

		for (j = 0; j < 24; j++) {
			for (k = 1; k <= 6; k++) kari[n][k] = dice[i][rot[j][k]];
			for (k = 0; k < cnt; k++) {
				if (kari[n][tbl[k][0]] != tbl[k][1]) break;
			}
			if (k < cnt) continue;
			f[i] = 1;
			if (rec(n+1)) return 1;
			f[i] = 0;
		}
		next:;
	}
	return 0;
}

int main()
{
	int i, j, k;
	char buf[10];

	for (i = 0; i < 26; i++) tr['a'+i] = 'A'+i, tr['A'+i] = 'a'+i;

	while (1) {
		for (i = 0; i < 8; i++) {
			fgets(buf, 10, stdin);
			if (*buf == '0') return 0;
			for (j = 0; j < 6; j++) dice[i][j+1] = buf[j];
			f[i] = 0;
		}
		for (i = 0; ; i++) {
			if (i == 8) { puts("NO"); break; }
			f[i] = 1;
			for (j = 0; j < 24; j++) {
				for (k = 1; k <= 6; k++) kari[0][k] = dice[i][rot[j][k]];
				if (rec(1)) { puts("YES"); goto next; }
			}
			f[i] = 0;
		}
		next:;
	}
	return 0;
}

Measured memory_bytes: 1820
n, m = gets.chomp.split.map(&:to_i)
a = []
m.times do |i|
  a[i] = gets.chomp.to_i
end

sum = Array.new(n+1, -2)
sum[0] = 1
a.each do |i|
  sum[i] = -1
end

1.upto(n) do |i|
  if i == 1
    if sum[i] == -1
      sum[i] = 0
    else
      sum[i] = 1
    end
  else
    if sum[i] == -1
      sum[i] = 0
    else
      sum[i] = sum[i-2] + sum[i-1]
    end
  end
  sum[i] %= 1000000007
end
p sum[n] % 1000000007


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

i64 dp[101][2][5];

void solve() {
  dp[0][0][0] = 1;
  string S;
  cin >> S;
  int n = S.size();
  int K;
  cin >> K;
  rep(i, n) rep(j, 2) rep(l, 4) rep(d, 10) {
    int dig = S[i] - '0';
    if (j == 0 && dig < d) break;

    int _i = i + 1;
    int _j = j == 0 && dig == d ? 0 : 1;
    int _l = d != 0 ? l + 1 : l;
    
    dp[_i][_j][_l] += dp[i][j][l];
  }
  cout << dp[n][0][K] + dp[n][1][K] << endl;
}


Measured memory_bytes: 256
s=input()

if s.count("N")==0 and s.count("S")==0:
    if s.count("W")>=1 and s.count("E")>=1:
        print("Yes")
        exit()

if s.count("W")==0 and s.count("E")==0:
    if s.count("N")>=1 and s.count("S")>=1:
        print("Yes")
        exit()

if s.count("W")>=1 and s.count("E")>=1 and s.count("N")>=1 and s.count("S")>=1:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys


def solve(N: int, T: int, A: int, H: "List[int]"):

    mindiff = float("Inf")
    mini    = 0
    for i,x in enumerate(H):
        diff = abs(A-(T-x*0.006))
        if diff < mindiff:
            mini = i
            mindiff = diff

    print(mini+1)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    H = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, T, A, H)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
nm = input()
n = int(nm.split()[0])
m = int(nm.split()[1])

x = list(map(int, input().split()))
y = list(map(int, input().split()))

ans = 0

ansx = 0
for k in range(1, n+1):
    ansx += (k-1)*x[k-1] - (n-k)*x[k-1]
ansx = ansx % (pow(10, 9) + 7)
 
ansy = 0
for k in range(1, m+1):
    ansy += (k-1)*y[k-1] - (m-k)*y[k-1]
ansy = ansy % (pow(10, 9) + 7)

ans = ansx * ansy
ans = ans % (pow(10, 9) + 7)

print(ans)


Measured memory_bytes: 18624
import java.io.*;

public class Main{
	public static void main(String[] args)throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder builder = new StringBuilder();
		
		while(true){
			String[] score = br.readLine().split(" ");
			int m = Integer.parseInt(score[0]);
			int f = Integer.parseInt(score[1]);
			int r = Integer.parseInt(score[2]);
			if( m==-1 && f==-1 && r==-1 ) break;
			
			if( m==-1 || f==-1 ){
				builder.append("F");
			}else{
				if( m+f >= 80 ) builder.append("A");
				else if( m+f >= 65 ) builder.append("B");
				else if( m+f >= 50 ) builder.append("C");
				else if( m+f >= 30 ){
					if( r >= 50 ) builder.append("C");
					else builder.append("D");
				}else builder.append("F");
			}
			
			
			builder.append("\n");
		}
		
		System.out.print(builder);
	}
}

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

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    int data[10];
    for(int j = 0; j < 10; j++) {
      cin >> data[j];
    }

    int b = 0;
    int c = 0;
    int flag = true;
    for(int j = 0; j < 10; j++) {
      if(data[j] > b) b = data[j];
      else if(data[j] > c) c = data[j];
      else {
	flag = false;
	break;
      }
    }
    if(flag) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    hs=LIST()
    ct=0
    for i in range(n):
        if max(hs[0:i+1])==hs[i]:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
import java.util.*;
  
public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
        new TEST().doIt();
    }
    class TEST{
    	String c[] = {"S","H","C","D"};
        void doIt(){
        	int n = sc.nextInt();
        	boolean t[][] = new boolean [4][13];
        	for(int i = 0;i < n;i++){
        		String str = sc.next();
        		int num = sc.nextInt();
        		for(int j = 0;j < 4;j++){
        			if(str.equals(c[j])){
        				t[j][num-1] = true;
        			}
        		}
        	}
        	for(int i = 0;i < 4;i++){
        		for(int j = 0;j < 13;j++){
        			if(!t[i][j])System.out.println(c[i]+" "+(j+1));
        		}
        	}
        }
    }
}

Measured memory_bytes: 26140
#include<bits/stdc++.h>
#define     FAST            ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;

int main()
{

    ll n,M=1e9+7;
    cin>>n;
    ll ar[n];

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

    ll sm=0,ans=0;

    for(int i=n-1,j=n-2;j>=0;i--,j--)
    {
        sm=(sm%M+(ar[i]%M));


        ans=((ans%M)+(ar[j]*sm)%M)%M;






        //cout<<sm<<endl;
        //cout<<ans<<endl;
    }


    cout<<ans<<endl;






    return 0;
}


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

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

using namespace std;


signed main(){
  int A, B, T;
  int kaisu;
  cin>>A>>B>>T;
  kaisu = T/A;
  cout << kaisu*B << endl;
  return 0;
}


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

int main(){

	int n;
	vector<int> a(210);
	cin >> n;
	int ans=100;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for(int i = 0; i < n; i++)
	{
		int num = 0;
		while(a[i] > 0){
			if(a[i] % 2 == 0){
				num++;
				a[i]/=2;
			}
			else break;
		}
		ans = min(ans, num);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<deque>
#include<string>
#include<math.h>
using namespace std;
#define ll long long int 






int main() {
	

	int n;

	cin >> n;

	cout << (double)(2.0*3.1416*n) << endl;

	

	return 0;
}

Measured memory_bytes: 3784
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)
#define INT_MAX (2147483647)

using namespace std;

struct SegmentTree {
    int n;
    vector<int> dat;

    SegmentTree(int _n) {
        n = 2;
        while (n < _n) n *= 2;
        dat.resize(n * 2);

        for (int i = 0; i < 2 * n - 1; ++i) dat[i] = INT_MAX;
    }

    void update(int k, int a) {
        k += n - 1;
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }

    int find(int a, int b) { return query(a, b, 0, 0, n); }

    int query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INT_MAX;

        if (a <= l && r <= b) {
            return dat[k];
        } else {
            int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};

int N, Q;

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

    cin >> N >> Q;
    SegmentTree seg(N);

    while (Q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            seg.update(x, y);
        } else {
            cout << seg.find(x, y + 1) << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 4884
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  ll X; cin >> X;
  ll ans = X / 11 * 2;

  X %= 11;
  if (X == 0) cout << ans << endl;
  else if (X <= 6) cout << ans + 1 << endl;
  else cout << ans + 2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
kl,al = [],[]
for _ in range(n):
	k,*a = list(map(int,input().split()))
	kl.append(k)
	al.append(a)
ans = [0]*(m+1)
cnt = 0
for i in range(n):
	for j in range(kl[i]):
		inx = al[i][j]
		ans[inx] += 1
for t in range(m+1):
	if ans[t] == n:
		cnt += 1
print(cnt)

Measured memory_bytes: 9132
#include<bits/stdc++.h>
#define int long long int  //comment for large arrays
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define INF 10000000000000001
#define all(x) (x).begin(),(x).end()
#define LB(v,x) (lower_bound(all(v),x) - v.begin()) 
#define UB(v,x) (upper_bound(all(v),x) - v.begin())
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(int i=s;i<n;i++)
#define print(v) for(auto it:v) cout<<it<<" "; cout<<endl 
using namespace std;


signed main()
{
	fastio(0);
	int n;
	cin>>n;
	int a[n+1],dp[n+1][n+1];
	loop(i,1,n+1) 
	{
		cin>>a[i];
		dp[i][i] = a[i];
	}
	for(int i=n;i>0;i--)
		for(int j=i+1;j<=n;j++)
			dp[i][j] = max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]);
	cout<<dp[1][n]<<endl;
	return 0;		
}

Measured memory_bytes: 70656
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = int(1e5);
int N, p[MAX_N];

void solve() {
    ll ans = 0;
    REP(i, N) {
        if (i != p[i]) continue;
        if (p[i + 1] == i + 1) {
            ans += 1;
            swap(p[i], p[i + 1]);
        } else if (p[i - 1] == i - 1) {
            ans += 1;
            swap(p[i], p[i - 1]);
        } else {
            ans += 1;
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> N;
    REP(i, N) {
        cin >> p[i];
        p[i]--;
    }
    solve();
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

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

                int N = scan.nextInt();
                int K = scan.nextInt();

                int[] A = new int[N];
                int[] B;

                for (int i = 0; i < N; i++) {
                	A[i] = scan.nextInt();
                }

                scan.close();

                if (K >= 100) {

                	for (int k = 0; k < N; k++) {
                    	System.out.print(N + " ");
                    }

                    System.out.println();

                } else {

	                for (int j = 0; j < K; j++) {

	                	B = new int[N];

	                	for (int n1 = 0; n1 < N; n1++) {

	                		if (n1 - A[n1] > 0) {
	                			B[n1 - A[n1]]++;
	                		} else {
	                			B[0]++;
	                		}

	                		if (n1 + A[n1] + 1 < N) {
	                			B[n1 + A[n1] + 1]--;
	                		}

	                	}

	                	for (int n2 = 0; n2 < N-1; n2++) {
	                		B[n2+1] += B[n2];

	                	}

	                	A = B;

	                }

	                for (int k = 0; k < N; k++) {
	                	System.out.print(A[k] + " ");
	                }

	                System.out.println();

                }

        }

}

Measured memory_bytes: 63236
def f(S):
    source_str = 'abcdefghijklmnopqrstuvwxyz'
    a = [0] * len(source_str)
    for i in range(len(a)):
        a[i] = S.count(source_str[i])
    
    n = 1
    for i in range(len(a)):
        n *= (a[i] + 1)


    return n

def g(S):
    fs = f(S)
    N = int(1e9) + 7
    return (fs + N - 1) % N




N = int(input())
S = input()

print(g(S))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    ll n, K;
    cin >> n >> K;

    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    
    typedef std::pair<ll, ll> pair;
    vector<pair> p;
    rep(i, n) p.push_back(pair(a[i], b[i]));
    sort(all(p), [](const pair& lhs, const pair& rhs) {
        return lhs.first < rhs.first;
    });

    rep(i, n) {
        ll x = p[i].first;
        ll cnt = p[i].second;
        if (K <= cnt) {
            put(x);
            return 0;
        }
        K -= cnt;
    }

    return 0;
}

Measured memory_bytes: 6880
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

std::vector<int> prime;
void MakePrime(int n) {
	prime.emplace_back(2);
	for (int i = 3; i < n; i += 2) {
		bool a = false;
		for (int j = 3; j <= std::sqrt(i); j += 2) {
			if (i%j == 0) {
				a = true;
			}
		}
		if (a == false) {
			prime.emplace_back(i);
		}
	}
}

int C;

int main() {
	int n;
	while (cin >> n&&n) {
		prime.clear();
		MakePrime(n * 2);
		C = 0;
		for (int i = 0; i < prime.size(); i++) {
			if (prime[i] > n) {
				C++;
			}
		}
		cout << C << endl;
	}
}

Measured memory_bytes: 3256
#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)

using namespace std;
typedef pair<int, int> pii;

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

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

    ll sum = 0;
    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            sum += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }

    cout << sum;
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,T;
  cin >> N >> T;
  vector<int> c(N),t(N);
  for(int i=0;i<N;i++){cin >> c[i] >> t[i];}
  int cost=1001;
  for(int i=0;i<N;i++){
    if(c[i]<cost && t[i]<=T){cost=c[i];}
  }
  if(cost==1001){cout << "TLE" << endl;}
  if(cost<1001){cout << cost << endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define push_back pb
#define make_pair mp
using ll =  long long;
const int INF = 0x3f3f3f3f;
const int MAX_N = 2e5+10;

int K, X;
void solve()
{
	for(int i=max(X-K+1, -1000000); i<=min(X+K-1,1000000); ++i){
		cout << i << " ";
	}
	cout << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> K >> X;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007

int euclidean_gcd(int a, int b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}



void solve(void)
{ 
 
 int A,B;
 cin>>A>>B;
 int GCD = euclidean_gcd(A,B);

 cout<<A*B/GCD<<endl;

  
  
  return;  
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
def sep(Nf, Mf):
    mm = [[] for _ in range(9)]
    for m in range(len(Nf)):
        for i in range(9):
            if Nf[m] == i+1:
                mm[i].append(Mf[m])
    return mm


def ssort(L, N, M):
    for i in range(len(N)-1):
        x = N[i+1:].index(min(N[i+1:])) + i + 1
        if N[i] > N[x]:
            L[i], L[x] = L[x], L[i]
            N[i], N[x] = N[x], N[i]
            M[i], M[x] = M[x], M[i]


def bsort(L, N, M):
    for i in range(len(N)-1):
        for j in range(len(N)-1-i):
            if N[j] > N[j+1]:
                L[j], L[j+1] = L[j+1], L[j]
                N[j], N[j+1] = N[j+1], N[j]
                M[j], M[j+1] = M[j+1], M[j]


n = int(input())
L = list(input().split())
N = [int(i[1]) for i in L]
M = [i[0] for i in L]
marks = ['S', 'H', 'C' ,'D']
Lb, Nb, Mb = L[:], N[:], M[:]
bsort(Lb, Nb, Mb)
print(' '.join(Lb))
if sep(N, M) == sep(Nb, Mb):
    print('Stable')
else:
    print('Not stable')

Ls, Ns, Ms = L[:], N[:], M[:]
ssort(Ls, Ns, Ms)
print(' '.join(Ls))
if sep(N, M) == sep(Ns, Ms):
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 5628
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))


int main(){
    int N;cin>>N;
    vector<int>A(N);
    REP(i,N)cin>>A[i];
    int cnt=0;
    REP(i,N){
        if(i%2==0&&A[i]%2==1)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main(){

  int n, a,b,c,d, X, Y;

  cin >> n >> a >> b >> c >> d;

  for(int i = 1; i > 0; ++i){
    if(n <= a * i){
      X = b * i;
      break;
    }
  }

  for(int i = 1; i > 0; ++i){
    if(n <= c * i){
      Y = d * i;
      break;
    }
  }
  if(X > Y){
    cout << Y << endl;
  }else cout << X << endl;


  
    
  return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>

int main(void)
{
 long A,B,K;
 scanf("%ld%ld%ld",&A,&B,&K);

  if(A>=K){
    A=A-K;
    printf("%ld ",A);
    printf("%ld",B);
   }

  else if (A+B>=K){
           printf("0 ");
           printf("%ld\n",B-(K-A));
   }
  else {
       printf("0 ");
       printf("0\n");
  }
  return 0;
}


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

using namespace std;

int main()
{
	int n, c=0;
	cin>>n;
	int arr[n];
	for(int i=0; i<n; i++)
	cin>>arr[i];
	for(int i=0; i<n; i++)
	{
		if((i+1)%2!=0 && arr[i]%2!=0)
		c++;
	}
	cout<<c;
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g,h,i,j;
    int n,tc,sum=0,ans;
    cin>>n;
    int ar[n];
    for(i=0; i<n; i++)
    {
        cin>>ar[i];
        sum=sum+ar[i];
    }
    ans=sum-n;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

struct edge { int u, v, cost; };

bool comp_edge(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

struct UnionFind {
    vector<int> par; // par[i]: iの親の番号

    UnionFind(int N) : par(N) { // 最初はすべてが根であるとして初期化
        REP(i, N) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る: root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

const int MAX_E = 100000;

int V, E;
int s, t, w;

edge es[MAX_E];

int main() {
    cin >> V >> E;
    REP(i, E) {
        cin >> s >> t >> w;
        es[i] = edge{.u = s, .v = t, .cost = w};
    }
    sort(es, es + E, comp_edge);
    UnionFind tree(V);
    int sum_cost = 0;
    REP(i, E) {
        if (tree.same(es[i].u, es[i].v)) continue;
        tree.unite(es[i].u, es[i].v);
        sum_cost += es[i].cost;
    }
    PRINT(sum_cost);
    return 0;
}


Measured memory_bytes: 4348
// Generic_AdjList
#include <iostream>
#include <unordered_map>
#include <map>
#include <list>
#include <queue>
#include <climits>
using namespace std;
int cnt;
template<typename T>
class Graph{
	unordered_map<T,list<T> > adjList;

	void DFSHelper(T src,map<T,bool> &visited,int &ans){
		visited[src] = true;
		ans++;
		for(auto node:adjList[src]){
			if(!visited[node]){
				DFSHelper(node,visited,ans);
			}
		}
	}	
public:
	void addEdge(T u,T v,bool bidir=true){
		adjList[u].push_back(v);
		if(bidir){
			adjList[v].push_back(u);			
		}
	}

	

	void DFS(T src){
		map<T,bool> visited;
        int ans=0;
		int component = 1;
		DFSHelper(src,visited,ans);
        cnt=ans;
		for(auto node:adjList){
			if(!visited[node.first]){
                ans=0;
				DFSHelper(node.first,visited,ans);
				component ++;
                cnt=max(cnt,ans);
			}
		}
		

		//cout<<endl;
	}
};


int main(){
    cnt=0;
	Graph<int> g;
    int n,m;
    cin>>n>>m;
    while(m--)
    {
        int u,v;
        cin>>u>>v;
        g.addEdge(u,v);
    }
	g.DFS(1);
    cout<<cnt<<endl;
	return 0; 
}

Measured memory_bytes: 58188
#include<stdio.h>


int A[500000];
int n;

void maxHeapify(int);

int main(){

  int i;

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

  for(i=n/2;i>=1;i--)maxHeapify(i);

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


void maxHeapify(int i){
  int l,r,largest,tmp;

  l = 2*i;
  if(l<=n&&A[l]>A[i])
    largest = l;
  else largest = i;
  
  if(n>2*i){
    r = 2*i+1;
    if(A[r]>A[largest])largest = r;
  }

  if(largest != i){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }

  
}

  

Measured memory_bytes: 2548
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);++i)
#define erep(i,j,n) for(int i=(j);i<=(n);++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	string s;
	cin >> s;
	rep(bit, 0, 1 << 3) {
		int res = s[0] - '0';
		string ans;
		ans += s[0];
		rep(i, 0, 3) {
			if (bit&(1 << i)) {
				res += s[i + 1] - '0';
				ans += "+";
			}
			else {
				res -= s[i + 1] - '0';
				ans += "-";
			}
			ans += s[i + 1];
		}
		if (res == 7) {
			cout << ans << "=7\n";
			return 0;
		}
	}
}

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

using namespace std;
using ll = long long;
template<class V, int ME> class BIT {
public:
	V bit[1<<ME];
	V operator()(int e) {if(e<0) return 0;V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
	void add(int e,V v) { e++; while(e<=1<<ME) bit[e-1]+=v,e+=e&-e;}
};
BIT<ll,20> sum;
int main() {
    int n,q;
    cin>>n>>q;
    string str;
    cin>>str;
    for(int i=0;i<n-1;++i){
        if(str[i] == 'A' && str[i+1] == 'C')sum.add(i+1,1);
    }
    for(int i=0;i<q;++i){
        int x,y;
        cin>>x>>y;
        x--;
        y--;
        cout << sum(y) - sum(x) << endl;
    }
    return 0;
}



Measured memory_bytes: 6016
n, x, m = map(int, input().split())

tmp = []

while True:
    tmp.append(x)
    x = pow(x, 2, m)
    if x in tmp:
        break

k = 0
while True:
    if tmp[k] == x:
        break
    k += 1

if k > n:
    print(sum(tmp[:n]))
else:
    t = k
    a = (n - k) // (len(tmp) - k)
    s = (n - k) % (len(tmp) - k)
    print(sum(tmp[:k]) + sum(tmp[k:]) * a + sum(tmp[k: k + s]))





Measured memory_bytes: 67564
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]

int main(){
    int n; cin >> n;
    set<int> st;
    rep(i,n){
        int a; cin >> a;
        st.insert(a);
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		String[] h=new String[51];
		for(int i=0;i<51;i++){
			h[i]="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
		}
		int st=0;
		int ite=0;
		for(int end=st+t.length()-1;end<s.length();end++){
			st=end-t.length()+1;
			//System.out.println(st+" "+end);
			for(int i=0;i<t.length();i++){
				if(s.substring(st+i,st+i+1).equals("?")){
				}else if(!t.substring(i,i+1).equals(s.substring(st+i,st+i+1))){
					break;
				}

				if(i==t.length()-1){
					//String buf="";
					h[ite]="";
					for(int j=0;j<s.length();j++){
						if(st<=j&&j<=end){
							h[ite]+=t.substring(j-st,j-st+1);
						}else{
							String buff=s.substring(j,j+1);
							if(buff.equals("?")){
								h[ite]+="a";
							}else{
								h[ite]+=buff;
							}
						}

					}
					ite++;
				}
			}
		}

		Arrays.sort(h);
		if(h[0].equals("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz")){
			System.out.println("UNRESTORABLE");
		}else{
			System.out.println(h[0]);

		}

	}

}

Measured memory_bytes: 22996
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



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

    int w = 0,r = n-1;
    int ans  = 0;
    while(1){
	while(s[w] != 'W' && w < n)w++;
	if(w == n)break;

	while(s[r] != 'R' && 0 <= r)r--;
	if(r == -1)break;
	if(w >= r )break;
	
	swap(s[w],s[r]);
	ans++;
	//	P(s);
    }
    P(ans);
    return  0;
}


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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int X = nextInt();
		int T = nextInt();




		System.out.printf("%.3f\n",(double)X/T);

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long solve(long long k){
  int ans=0;
  while(k){
    ans++;
    k/=10;
  }
  return ans;
}
int main(){
  long long n;
  cin >> n;
  long long ans=10;
  rep(i,100000){
    long long u=i+1;
    if(n%u==0){
      ans=min(ans,max(solve(u),solve(n/u)));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <math.h>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
unsigned long long MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h>>w;
    vector<vector<char>> vec(h, vector<char>(w));
    rep(i,h){
        string s;
        cin >> s;
        rep(j,w){
            vec[i][j] = s[j];
        }
    }
    V H;
    V W;
    rep(i,h){
        bool Ha = true;
        rep(j,w){
            if(vec[i][j]=='#'){
                Ha = false;
              
            }
        }
        if(Ha)
            H.push_back(i);
    }
    rep(i, w)
    {
        bool Ha = true;
        rep(j, h)
        {
         
            if (vec[j][i] == '#')
            {
              
                Ha= false;
            }
        }
        if (Ha)W.push_back(i);
    }
    
    rep(i,h){
        rep(j,w){
            if(binary_search(all(H),i)||binary_search(all(W),j)){
                continue;
            }
            cout << vec[i][j];
        }
        if (i!=h && !binary_search(all(H), i+1))
            cout << endl;
    }
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, M) = nextIntList()
    val array = Array(M) {
        val (P, Y) = nextIntList()
        intArrayOf(P, Y)
    }
    val counter = IntArray(N + 1) { 0 }
    val sorted = array.sortedBy { it[1] }
    sorted.forEach {
        counter[it[0]]++
        it[1] = counter[it[0]]
    }
    array.forEach {
        pw.printf("%06d%06d\n", it[0], it[1])
    }
}


Measured memory_bytes: 130780
MODULE qSortMod
      implicit none
      interface qSort
        module procedure :: i16qSort
      end interface
      contains
      
      pure recursive function i16qSort( a ) result( r )
          !ref
          !https://t.doujin-constant.net/
          !post/143374686394/fortranをより使いこなしたquick-sort
          !
          !left is smaller!
        implicit none
        integer(16),intent(in) :: a(:)
        integer(16) :: r( size(a) )
        !integer(16),allocatable :: r(:) !is OK
        integer(16) :: sample(3),len,i,j
        
        len = size(a)
        if( len>1 )then
          sample(1) = a(1)
          sample(2) = a(len/2)
          sample(3) = a(len)
          !select median
          do i = 1,2
            do j = 2,3
              if( sample(i)>sample(j) )then
                len = sample(i) !len is buffer
                sample(i) = sample(j)
                sample(j) = len
              end if
            end do
          end do
          
          r = [ qSort( pack( a(:),a(:)< sample(2) ) ), &
                       pack( a(:),a(:)==sample(2) )  , &
                qSort( pack( a(:),a(:)> sample(2) ) ) ]
        else
          r = a
        end if
      end function i16qSort
      
      END MODULE qSortMod
      
      
      PROGRAM piyo
      use qSortMod
      IMPLICIT NONE
      integer(16) :: n,k
      integer(16),allocatable :: a(:)
      integer(16) :: ans,ant,post,i
      
      read*,k,n
      allocate( a(n) )
      read*,a
      
      a = qSort( a )
      
      if( n==2 )then
        print*,abs( a(2)-a(1) );stop
      end if
      
      
      ans = k
      do i = 1,n-1
        ans = min( ans,k-(a(i+1)-a(i)) )
      end do
      !i=n
      ans = min( ans,a(n)-a(1) )
      
      print*,ans
      
      !debugg
    !  print*,k,n
    !  print*,a
      
      
      END PROGRAM

Measured memory_bytes: 14752
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1e9+7 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

ll n ;
string str ;

bool DFS(string &s,char c){
	s += c ;
	ll sz = s.size() ;
//	cout << s << " " << sz << endl ;
	if(sz<=2){
		if(DFS(s,'S')) return true ;
		else if(DFS(s,'W')) return true ;
		else{
			s.pop_back() ;
			return false ;
		}
	}
	ll p = (sz==n+2?0:sz-2) ;
	if(s.at(p)=='S'){
		if(str.at(p)=='o'&&s.at(sz-3)!=s.at(sz-1)){
			s.pop_back() ;
			return false ;
		}
		if(str.at(p)=='x'&&s.at(sz-3)==s.at(sz-1)){
			s.pop_back() ;
			return false ;
		}
	}else{
		if(str.at(p)=='x'&&s.at(sz-3)!=s.at(sz-1)){
			s.pop_back() ;
			return false ;
		}
		if(str.at(p)=='o'&&s.at(sz-3)==s.at(sz-1)){
			s.pop_back() ;
			return false ;
		}
	}
	if(sz==n){
//		cout << "sz==n" << endl ;
		if(DFS(s,s.at(0))) return true ;
		else{
			s.pop_back() ;
			return false ;
		}
	}
	if(sz==n+1){
//		cout << "sz==n+1" << endl ;
		if(DFS(s,s.at(1))) return true ;
		else{
			s.pop_back() ;
			return false ;
		}
	}
	if(sz==n+2){
//		cout << "sz==n+2" << endl ;
		s.pop_back() ;
		s.pop_back() ;
		cout << s << endl ;
		return true ;
	}
	if(sz<n){
//		cout << "sz<n" << endl ;
		if(DFS(s,'S')) return true ;
		else if(DFS(s,'W')) return true ;
		else{
			s.pop_back() ;
			return false ;
		}
	}
}

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

	cin >> n ;
	cin >> str ;
	string s ;
	if(DFS(s,'S')) return 0 ;
	s = "" ;
	if(DFS(s,'W')) return 0 ;
	cout << -1 << endl ;
}


Measured memory_bytes: 6992
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!
    
    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {
        
            count += card[j][i] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")
    
}

main()





Measured memory_bytes: 13496
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair <int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\n';

void solve() {
    string s;
    cin >> s;
    string str = "abcdefghijklmnopqrstuvwxyz";
    int l = s.size(), ara[26] = {0};
    for(int i = 0; i < l; ++i){
        for(int j = 0; j < 26; ++j){
            if(s[i] == str[j]){
                ara[j]++;
            }
        }
    }
    for(int j = 0; j < 26; ++j){
        if(ara[j] % 2 != 0){
            cout << "No" << nl;
            return;
        }
    }
    cout << "Yes" << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3636