akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
N = len(S)+1

ANS = [0]*N
for i in range(N-1):
    if S[i] == '<':
        ANS[i+1] = ANS[i]+1

for i in range(N-2,-1,-1):
    if S[i] == '>':
        ANS[i] = max(ANS[i],ANS[i+1]+1)

print(sum(ANS))


Measured memory_bytes: 93496
#D
D,N = map(int,input().split())
T = [int(input()) for i in range(D)]
ABC = [list(map(int,input().split())) for i in range(N)]

can = []
for t in T:
    mini = []
    for abc in ABC:
        a,b,c = abc
        if a <= t and t <= b:
            mini.append(c)
    mini.sort()
    can.append([mini[0],mini[-1]])

dp = [[0,0] for i in range(D)]
for i in range(1,D):
    o = can[i-1]
    m = can[i]
    dp[i][0] = max(dp[i-1][0]+abs(o[0]-m[0]),dp[i-1][1]+abs(o[1]-m[0]))
    dp[i][1] = max(dp[i-1][0]+abs(o[0]-m[1]),dp[i-1][1]+abs(o[1]-m[1]))

print(max(dp[D-1]))



Measured memory_bytes: 5616
A,B,C = input().split()

A = A[len(A)-1:len(A)]
Bf = B
Bl = B
Bf = Bf[0:1]
Bl = Bl[len(B)-1:len(B)]
C = C[0:1]

if A == Bf:
    if Bl == C:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Measured memory_bytes: 3064
n = int(input())
s = input()

turns = [s[1:].count('E')]

for i in range(1, n):
  if s[i] != s[i-1]:
    turns.append(turns[i-1])
  elif s[i] == 'E':
    turns.append(turns[i-1] - 1)
  else:
    turns.append(turns[i-1] + 1)
  
print(min(turns))

# E E で1減少
# W W で1増加
# E W, W E は変化なし

Measured memory_bytes: 15520
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <type_traits>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define NUMBERED( name, number ) NUMBERED2( name, number )
#define NUMBERED2( name, number ) name ## _ ## number
#define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n )
#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a ) ( remove_all_extents< decltype( a ) >::type * )a, ( remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( remove_all_extents< decltype( a ) >::type )
#define DRANGE( c, p ) begin( c ), begin( c ) + ( p ), end( c )

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 12 ) << fixed;

	int N;
	scanf( "%d", &N );

	static LL A[ 1 << 17 ], B[ 1 << 17 ];
	REP( i, N )
	{
		scanf( "%lld%lld", A + i, B + i );
	}

	LL res = 0;
	for ( int i = N - 1; 0 <= i; --i )
	{
		const LL m = ( A[i] + res ) % B[i];
		if ( m )
		{
			res += B[i] - m;
		}
	}
	
	printf( "%lld\n", res );
	fflush( stdout );

	return 0;
}


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

const ll INF = 1LL << 60;

ll N, K;
vector<ll> A, F;

int main() {
    cin >> N >> K;
    A.resize(N);
    F.resize(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> F[i];

    sort(A.begin(), A.end());
    sort(F.rbegin(), F.rend());

    ll left = -1, right = INF;
    while (right - left > 1) {
        ll middle = (left + right) / 2;

        bool ok = [&] {
            // K 回の修行で条件を満たせるか
            ll cnt = 0;
            for (int i = 0; i < N; i++) {
                cnt += max(0LL, A[i] - middle / F[i]);
            }
            // cout << cnt << endl;

            return cnt <= K;
        }();

        if (ok) {
            right = middle;
        } else {
            left = middle;
        }
    }

    cout << right << endl;
}

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

int main() {
  int x,y,z;
  cin >> x >> y >> z;

  int a;
  a = x;
  x = y;
  y = a;

  a = x;
  x = z;
  z = a;

  cout << x << " " << y << " " << z << endl;
}

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

int A[20],n;
int fact(int,int);
int main(){
  
  int i,q,*m;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  scanf("%d",&q);
  m=(int*)malloc(sizeof(int)*q);
  for(i=0;i<q;i++)
    scanf("%d",&m[i]);
  
  for(i=0;i<q;i++){
    if(1==fact(m[i],0))
      printf("yes\n");
    else
      printf("no\n");
  }
  
  return 0;
}

fact(int m,int start){
  int i,flag=0;
  for(i=start;i<n;i++){
    if(flag==1)
      break;
    if(A[i]==m)
      flag=1;
    else if(A[i]<m)
      flag=fact(m-A[i],i+1);
    else
      flag=0;
  }
  return flag;
}

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

using namespace std;

int n;
vector<int> g[100005], G[100005];
string s;
int depth[100005];

bool makedfs(int v, int prev)
{
	bool ret = false;
	if(s[v] == 'W') ret = true;
	for(int i = 0; i < g[v].size(); i++){
		if(g[v][i] == prev) continue;
		if(makedfs(g[v][i], v)){
			ret = true;
			G[v].push_back(g[v][i]);
			G[g[v][i]].push_back(v);
		}
	}
	return ret;
}

void dfs(int v, int prev, int dep)
{
	if( (s[v] == 'W') != (G[v].size() % 2) ) dep++;
	depth[v] = dep;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == prev) continue;
		dfs(G[v][i], v, dep);
	}
}

int main(void)
{
	cin >> n;
	int u, v;
	for(int i = 0; i < n-1; i++){
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	cin >> s;
	s = "#" + s;
	
	int cnt = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'W') cnt++;
	}
	if(cnt <= 1){
		cout << cnt << endl;
		return 0;
	}
	
	int root;
	for(int i = 1; i <= n; i++){
		if(s[i] == 'W'){
			root = i;
			makedfs(i, -1);
			break;
		}
	}
	
	dfs(root, -1, 0);
	int max_i, max_val = 0;
	for(int i = 1; i <= n; i++){
		if(depth[i] > max_val){
			max_val = depth[i];
			max_i = i;
		}
	}
	dfs(max_i, -1, 0);
	max_val = 0;
	for(int i = 1; i <= n; i++){
		if(depth[i] > max_val){
			max_val = depth[i];
			max_i = i;
		}
	}
	
	cnt = 0;
	for(int i = 1; i <= n; i++){
		if( (s[i] == 'W') != (G[i].size() % 2) ) cnt++;
	}
	int N = 0;
	for(int i = 1; i <= n; i++) if(G[i].size()) N++;
	cout << 2*(N-1) + cnt - 2 * max_val << endl;
	return 0;
}

Measured memory_bytes: 17916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
  ll H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  ll ans = 60 * (H2 - H1) + (M2 - M1) - K;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	//private static final int BIG_NUM=2000000000;
	public static void main(String[]args){
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int H,W;
		String work[]=new String[2];
		
		while(true){
			try{
				work=br.readLine().split("[\\s]+");
				
				if(work[0].equals("0") && work[1].equals("0")){break;}	//両方とも0だったらループを抜ける.
				
				H=Integer.parseInt(work[0]);
				W=Integer.parseInt(work[1]);
				
				StringBuilder sb=new StringBuilder();
				for(int i=0; i<H; i++) {
					for(int j=0; j<W; j++) {
						if((i+j)%2==0){
							sb.append("#");
						}else {
							sb.append(".");
						}
					}
					sb.append(String.format("%n", ""));
				}
				System.out.println(sb);
			}catch(IOException e){
				e.printStackTrace();
			}
		}
	}
}


Measured memory_bytes: 26956
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();
		
		double[] e = new double[n];
		double s = 0;
		for(int i = 0; i < k; i++) {
			e[i] = (scan.nextDouble()+1)/2;
			s += e[i];
		}
		
		double max = s;
		for(int i = k; i < n; i++) {
			e[i] = (scan.nextDouble()+1)/2;
			s += e[i]-e[i-k];
			if(s > max) {
				max = s;
			}
		}
		
		System.out.println(max);
		

	}

}

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

int main() {
  int N, M, simeva = 0, eva = 0;
  
  cin >> N;
  
  vector<string> blue(N);
  vector<int> bluecou(N);
  
  for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
  }
  
  cin >> M;
  
  vector<string> red(M);
  vector<int> redcou(M);
  
  for (int i = 0; i < M; i++) {
    cin >> red.at(i);
  }
  
  
  for (int i = 0; i < N; i++) {
    
    for (int j = 0; j < N; j++) {
      if (blue.at(i) == blue.at(j)) bluecou.at(i)++;
    }
    
  }
  
  for (int i = 0; i < M; i++) {
    
    for (int j = 0; j < M; j++) {
      if (red.at(i) == red.at(j)) redcou.at(i)++;
    }
  }
  
  
  for (int i = 0; i < N; i++) {
    
    for (int j = 0; j < M; j++) {
      if (blue.at(i) == red.at(j)) {
        simeva = bluecou.at(i) - redcou.at(j);
        break;
      }
      else simeva = bluecou.at(i);
    }
    
    if (eva < simeva) eva = simeva;
    simeva = 0;
    
  }
  cout << eva << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	unsigned long k;
	cin >> s;
	cin >> k;
	unsigned long i, ans, len;
	len = s.length();

	if (k == 1) {
		ans = 0;
		for (i = 0; i < len - 1; i++) {
			if (s[i] == s[i + 1]) {
				ans++;
				s[i + 1] = '#';
			}
		}
		cout << ans << endl;
		return 0;
	}


	ans = 0;
	len = s.length();

	if (len == 1) {
		cout << k / 2 << endl;
		return 0;
	}

	if (s[0] != s[len - 1]) {
		for (i = 0; i < len; i++) {
			if (s[i] == s[i + 1]) {
				ans++;
				s[i + 1] = '#';
			}
		}
		ans = ans * k;
		cout << ans << endl;
		return 0;
	}

	long sentou;
	for (i = 0; i < len - 1; i++) {
		if (s[0] != s[i])break;
	}
	sentou = i;

	long saigo;
	for (i = len - 1; i >0; i--) {
		if (s[0] != s[i])break;
	}
	saigo = i;

	if (sentou > saigo) {
		ans = len * k / 2;
		cout << ans << endl;
		return 0;
	}

	for (i=sentou; i<saigo; i++) {
		if (s[i] == s[i + 1]) {
			ans++;
			s[i + 1] = '#';
		}
	}

	long sentousaigo = sentou + (len - saigo-1);
//	cout << ans << "/ " <<sentou << " / " << saigo-1 << " / " << sentousaigo << endl;
	ans = ans * k;
	ans += ((long)(sentousaigo / 2)) * (k - 1);
	ans += sentou / 2 + (len-saigo-1) / 2;

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


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define LL long long
const int MAXN=1e6;
const long long ONE=1;
LL A,B;
int prime[MAXN+5],visp[MAXN+5]={1,1},pcnt;
LL Gcd(LL x,LL y){
	if(x==0)return y;
	return Gcd(y%x,x);
}
int Cut(LL X){
	for(int i=1;i<=MAXN;i++){
		if(!visp[i])prime[++pcnt]=i;
		for(int j=1;j<=pcnt&&prime[j]*i<=MAXN;j++){
			visp[i*prime[j]]=1;
			if(i%prime[j]==0)break;
		}
	}
	int rt=1;
	for(int i=1;i<=pcnt&&ONE*i*i<=X;i++){
		if(X%prime[i]==0)rt++;
		while(X%prime[i]==0)X/=prime[i];
	}
	if(X!=1)rt++;
	return rt;
}
int main(){
	scanf("%lld%lld",&A,&B);
	LL D=Gcd(A,B);
	printf("%d\n",Cut(D));
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  vector<int>d(n);
  long long sum=0;
  for(int i=0;i<n;i++)
  {
    if(i==0)d[0]=abs(a[0]);
    else d[i]=abs(a[i]-a[i-1]);
    sum+=d[i];
  }
  sum+=abs(a[n-1]);
  for(int i=0;i<n;i++)
  {
    if(i==0)cout<<sum-d[i]-d[i+1]+abs(a[i+1])<<endl;
    else if(i==n-1)cout<<sum-d[i]-abs(a[n-1])+abs(a[i-1])<<endl;
    else cout<<sum-d[i]-d[i+1]+abs(a[i-1]-a[i+1])<<endl;
  }
  return 0;
}

Measured memory_bytes: 2048
State = Struct.new(:id, :his)

N, M = gets.split.map(&:to_i)
p = []
s = []
submit = []
status = Hash.new
pena = 0
corr = 0
tmp = []
M.times do |i|
  p[i], s[i] = gets.split
  p[i] = p[i].to_i
  # はじめての提出の場合
  if status[p[i]].nil?
    status[p[i]] = s[i]
    # 1回目のミス
    if status[p[i]] == 'WA'
      tmp[p[i]] = 1
    # 1回目でAC
    elsif status[p[i]] == 'AC'
      corr += 1
    end
  # 2回目以降の提出で，かつまだ解けてない問題について
  elsif status[p[i]] == 'WA'
    # 2回目以降のミス
    if s[i] == 'WA'
      tmp[p[i]] += 1
    # 2回目以降の提出でAC
    elsif s[i] == 'AC'
      status[p[i]] = 'AC'
      pena += tmp[p[i]]
      corr += 1
    end
  end
end

puts "#{corr} #{pena}"

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


def solve(A: int, B: int):
    print(max(A+B,A-B,A*B))
    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()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a, b, c, ans, sum = 0, k;
	scanf("%d %d %d", &a, &b, &c);
	ans = c % b;
	sum = a;
	for(int i = 1; i <= b; i++)
	{
		if(sum % b == ans)
		{
			printf("YES\n");
			return 0;
			}
		sum = a;
		k = a * i;
		sum = sum + k;
		}
	printf("NO\n");
	return 0;

	}

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

using namespace std;

int main()
{
    long long int n;
    long long int ans = 0;

    cin >> n;

    for (int i = 1; i < n; i++) {
        ans += i;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    int N, M;
    cin >> N >> M;
    if(N == M) puts("Yes");
    else puts("No");
}


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

const int N = 300, Mo = 1e9 + 7;

std::vector<std::pair<int, int> > V[N]; 

int n, m;
long long f[N + 10][N + 10][N + 10], ans;

inline int read() {
    int x = 0, k = 1; char c = getchar();
    for (; c < 48 || c > 57; c = getchar()) k ^= (c == '-');
    for (; c >= 48 && c <= 57; c = getchar()) x = x * 10 + (c ^ 48);
    return k ? x : -x;
}

int main() {
    n = read(), m = read();
    for (int i = 1; i <= m; i++) {
        int l = read(), r = read(), x = read();
        if (r - l + 1 < x) {
            puts("0");
            return 0;
        }
        V[r].push_back(std::make_pair(l, x));
    }
    f[1][0][0] = 1;
    for (int i = 1; i <= n; i++) {
        int sz = V[i].size();
        for (int j = 0; j < sz; j++) {
            int l = V[i][j].first, x = V[i][j].second;
            for (int k = 0; k < i; k++)
                for (int p = 0; p <= std::max(0, k - 1); p++)
                    if (x == 1) {
                        if (l <= k)
                            f[i][k][p] = 0;
                    }
                    else if (x == 2) {
                        if (k < l || l <= p)
                            f[i][k][p] = 0;
                    }
                    else if (x == 3) {
                        if (p < l)
                            f[i][k][p] = 0;
                    }
        }
        if (i == n) 
            break;
        for (int j = 0; j < i; j++)
            for (int k = 0; k <= std::max(0, j - 1); k++)
                if (!f[i][j][k])
                    continue;
                else {
                    f[i + 1][j][k] = (f[i + 1][j][k] + f[i][j][k] + Mo) % Mo;
                    // (i + 1) == (i)

                    f[i + 1][i][k] = (f[i][j][k] + f[i + 1][i][k] + Mo) % Mo;
                    // (i + 1) == (j)
                    
                    f[i + 1][i][j] = (f[i + 1][i][j] + f[i][j][k] + Mo) % Mo;
                    // (i + 1) == (k)
                }
    }
    for (int i = 0; i < n; i++)
        for (int j = 0; j <= std::max(0, i - 1); j++)
            ans = (ans + f[n][i][j] + Mo) % Mo;
    printf("%lld\n", ans * 3LL % Mo);
    return 0;
}

Measured memory_bytes: 225536
n,h = map(int,input().split())

ken = []

res = 0

for i in range(n):
    a,b = map(int,input().split())
    ken.append((a,1))
    ken.append((b,0))

ken.sort(key = lambda x:x[0],reverse=True)


for d,f in ken:
    if f:
        if h%d:
            res += h//d + 1
        else:
            res += h//d
        h = 0
    else:
        res += 1
        h-=d
    if h<=0:
        print(res)
        exit(0)


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

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1.0/LINF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

class AX {
public:
    int A, B;
    void solve(std::istream& in, std::ostream& out) {
        in >> A >> B;
        int tmp = max(A + B, A - B);
        OUT(max(tmp, A * B));
    }
};


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


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
using namespace std;

int main() {

	long long N;
	long long K;
	cin >> N >> K;

	long long a = N / K;
	long long ans = min(abs(N - a * K), abs(N - (a + 1) * K));

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/11/20 07:34:59
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<int> A(n); for (auto& a:A) cin>>a;
  ll ans = 0;
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] == 0) {
      ans += sum/2;
      sum = 0;
    } else {
      sum += A[i];
    }
  }
  ans += sum/2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>

int main(void)
{
	int a, b, c, min, mid, max;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b){
		if(b < c){
			min = a;
			mid = b;
			max = c;
		}else{
			max = b;
			if(a < c){
				min = a;
				mid = c;
			}else{
				min = c;
				mid = a;
			}
		}
	}else{
		if(c < b){
			min = c;
			mid = b;
			max = a;
		}else{
			min = b;
			if(a < c){
				mid = a;
				max = c;
			}else{
				mid = c;
				max = a;
			}
		}
	}
	printf("%d %d %d\n", min, mid, max);
	return 0;
}

Measured memory_bytes: 1024
import math
import itertools
import sys
n = int(input())
a = list(map(int, input().split()))
ans = 0
all = 0
for i in a:
    all += i
for i in a:
    all -= i
    ans += i*all
    if(ans > 10**9+7):
        ans %= 10**9+7
print(ans)


Measured memory_bytes: 33292
#include <strings.h>
#include <stdio.h>
#include <math.h>

int main(void) {                                                                
    int i, x, y, z, n, ana;                                                     
    double size;                                                                
                                                                                
    while (scanf("%d %d %d", &x, &y, &z), x) {                                  
        if (x >= y && x >= z)                                                   
            size = sqrt(y*y + z*z) / 2;                                         
        else if (y >= x && y >= z)                                              
            size = sqrt(x*x + z*z) / 2;                                         
        else                                                                    
            size = sqrt(y*y + x*x) / 2;                                         
        scanf("%d", &n);                                                        
        for (i = 0; i < n; i++) {                                               
            scanf("%d", &ana);                                                  
            if (size < ana)                                                     
                printf("OK\n");                                                             else                                                                
                printf("NA\n");                                                 
        }                                                                       
    }                                                                           
    return 0;                                                                   
}

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

int main(){
  int N;//how many items
  int M;//how many items can be selected
  vector<int> votes(N+1);//how many votes each items

  double criteria=0.0;//criteria of the item selection
  int selected_num=0;

  //input
  cin >>N >>M;
  for(int i=0; i<N; i++){
    cin >> votes.at(i);
    //cout << votes.at(i)<<" ";
    criteria += votes.at(i);
  }
  criteria /= M*4.0;

  //cout <<endl;
  //cout <<"criteria:"<<criteria <<endl;

  //judge
  for(int i=0; i<N; i++){
    if(votes.at(i)>=criteria){
      selected_num++;
      //cout <<i <<"th can be selected"<<endl;
    }
  }

  //output
  if(selected_num>=M) cout <<"Yes" <<endl;
  else cout <<"No" << endl;

}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


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

  if(n==0){
    cout<<1<<endl;
  }
  else if(n==1){
    cout<<2<<endl;
  }
  else if(n==2){
    cout<<1<<endl;
  }
  else{
    cout<<0<<endl;
  }

  return 0;
}


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

int main() {
    int N;  cin >> N;
    vector<long long> cnt(6);
    map<char, int> mp;
    mp['M'] = 1;  mp['A'] = 2;  mp['R'] = 3;  mp['C'] = 4;  mp['H'] = 5;
    for (int i = 0; i < N; ++i) {
        string s;  cin >> s;
        if (mp[s[0]]) ++cnt[mp[s[0]]];
    }
    long long ans = 0;
    for (int i = 1; i <= 5; ++i)
        for (int j = i + 1; j <= 5; ++j)
            for (int k = j + 1; k <= 5; ++k)
                ans += cnt[i] * cnt[j] * cnt[k];
    cout << ans << endl;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int k;
    cin >> k;
    string s;
    cin >> s;
    if(k >= s.size()) cout << s << endl;
    else{
        cout << s.substr(0,k)+"..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    int A, B;
    cin >> A >> B;
    if(!(A%3) || !(B%3) || !((A+B)%3)) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"iomanip"
using namespace std;
typedef long long ll;
const ll maxn=1e5+100;
ll a[maxn],b[maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>a[i];b[i]=a[i];
    }
    ll s1=0,s2=0,a1=0,a2=0;
    for(int i=0;i<n;++i)
    {
        if(i%2==0)
        {
            if(s1+a[i]<=0)
            {
                s1+=a[i];
                a1+=abs(1-s1);
                s1=1;
            }
            else s1+=a[i];
            if(s2+b[i]>=0)
            {
                s2+=b[i];
                a2+=abs(s2+1);
                s2=-1;
            }
            else s2+=b[i];
        }
        else
        {
            if(s1+a[i]>=0)
            {
                s1+=a[i];
                a1+=abs(s1+1);
                s1=-1;
            }
            else s1+=a[i];
            if(s2+b[i]<=0)
            {
                s2+=b[i];
                a2+=abs(1-s2);
                s2=1;
            }
            else s2+=b[i];
        }
    }
    cout<<min(a1,a2)<<'\n';
}




Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int N;
string s;

int main(){
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> s;
		if(s == "Y"){
			cout << "Four" << endl;
			return 0;
		}
	}
	
	cout << "Three" << endl;
}

Measured memory_bytes: 256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

char s[200], ss[200], t[200];
int main()
{
  scanf("%s%s", s, t);
  for (int j = 0; j <= strlen(s) - 1; j++)
  {
    for (int i = 0; i < strlen(s); i++)
    {
      ss[i] = s[(i + j) % strlen(s)];
    }
    if (strcmp(ss, t) == 0)
    {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}


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

ifstream in("test.in");
ofstream out("test.out");



int main(void)
{
    ios :: sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    string str;
    cin >> str;
    
    for (int i = 0; i < 8; ++i)
        str.pop_back();
    cout << str << endl;
    
    return 0;
}


Measured memory_bytes: 256
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef long long LL;
 
#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice
 
#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
 
LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}
 
template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}
 
const LL MaxN = 1 + 1e5;
 
LL n, a[MaxN], kq;
 
void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}
 
int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    if(n % 2){
        cout << 0 << endl;
        return 0;
    }
    n /= 2;
    LL k = 1;
    for(int i = 1 ; i <= 26 ; ++i){
        k *= 5;
        kq += (n / k);
    }
    cout << kq << endl;
 
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);

	if ((a <= 8 && a >= 1) && (b <= 8 && b >= 1))
		printf("Yay!");
	else
		printf(":(");

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main(){
    int n, t, h;
    char a[101], b[101];
    
    scanf("%d", &n);
    t = 0;
    h = 0;
    for (int i = 0;i < n; i++) {
        scanf("%s %s", a, b);
        if (strcmp(a, b) > 0) {
          t = t + 3;
        } else if (strcmp(a, b) < 0) {
            h = h + 3;
        } else {
            t = t + 1;
            h = h + 1;
            
    }
 }
 printf("%d %d\n", t, h);
 return 0;
}


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

int main() {
    int n;
    cin >> n;
    int ans = 1001001001;
    auto cnt = [](int n) {
        int ret = 0;
        while(n%2 == 0) {
            ret++;
            n /= 2;
        }
        return ret;
    };
    rep(i,n) {
        int a;
        cin >> a;
        ans = min(ans,cnt(a));
    }
    cout << ans << endl;
}

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

#define N 3

int main(){
  vector<int> num;
  int x;
  for(int i=0; i<N; i++){
    cin >> x;
    num.push_back(x);
  }
  sort(num.begin(),num.end());
  for(int i=0; i<N; i++){
    if(i==N-1)
      cout << num[i] << endl;
    else
      cout << num[i] << " ";
  }
  return 0;
}



Measured memory_bytes: 3164
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
signed main(){
	
	int a,b,c;
	cin>>a>>b>>c;
	if((a<=c && c<=b) || (a>=c && c>=b))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MOD 1000000007
#define MAX 400005
#define PMAX 55
#define PRECISION 0.00000000001
#define INF 2000000000
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
pair<long long,long long> p;
int main()
{
    int n,i;
    long long d;
    scanf("%d %lld",&n,&d);
    d=d*d;
    int c=0;
    for(i=0;i<n;i++)
    {
        scanf("%lld %lld",&p.first,&p.second);
        if(p.first*p.first+p.second*p.second<=d) c++;
    }
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 3808
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;

int cal1();
int cal2();
int cal3();

int index;
string s;

int getNum(){
	int n = 0;
	for (; '0' <= s[index] && s[index] <= '9'; index++) n = n * 10 + s[index] - '0';
	return n;
}

int cal1(){
	int ret = cal2();
	while (1){
		if (s[index] == '+') {
			index++;
			ret += cal2();
		}
		else if (s[index] == '-') {
			index++;
			ret -= cal2();
		}
		else return ret;
	}
}

int cal2(){
	int ret = cal3();
	while (1){
		if (s[index] == '*') {
			index++;
			ret *= cal3();
		}
		else if (s[index] == '/') {
			index++;
			ret /= cal3();
		}
		else return ret;
	}
}

int cal3(){
	int ret = 0;
	int old = index;
	if (s[index] == '('){
		index++;
		ret = cal1();
		index++;
	}
	else {
		ret = getNum();
	}
	return ret;
}

int main(){
	int n;
	cin >> n;
	getchar();
	for (int i = 0; i < n; i++){
		index = 0;
		getline(cin, s);
		s.pop_back();
		cout << cal1() << endl;
	}
	return 0;
}

Measured memory_bytes: 3004
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
typedef long long ll;
int main(void)
{
// c>b>a
	ll a,b,c,k;
	cin>>c>>b>>a>>k;
	ll a1=a,b1=b,c1=c;
	ll k1=k;
	while(k1>0) a1*=2,k1--;
	bool ok=false;
	for(ll i=0;i<=k;i++)
	{
		if(a1>b1&&b1>c1) ok=true;
		a1/=2,b1*=2;
	}
//	cout<<a1<<" "<<b1<<endl;
//	if(a1>b1&&b1>c1) ok=true;
	if(ok) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL N, M, K; cin >> N >> M >> K;
  vector<LL> A(N + 1), B(M + 1);
  LL n = 1, m = 1;
  A[0] = 0, B[0] = 0;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int i = 1; i <= M; i++) cin >> B[i];

  LL sum = 0;
  for (; n <= N; ++n) {
    if (sum + A[n] > K) break;
    sum += A[n];
  }
  --n;
  LL cnt_max = n;

  for (; m <= M; ++m) {
    sum += B[m];
    while (sum > K && n > 0) {
      sum -= A[n];
      --n;
    }
    if (sum <= K) cnt_max = max(cnt_max, n + m);
  }
  cout << cnt_max << endl;
}


Measured memory_bytes: 6416
/* 
 * Author: pawanmsr
 */

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;

// Macro //
#define X first
#define Y second
#define pii pair<int,int>
#define pll pair<ll,ll>

// Global //

// Functions //

// Main //
int main(int argc, char const *argv[])
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    
    /* code */
    int r; cin >> r;
    static float pi = 3.141593;
    cout << 2 * pi * r << endl;
    return 0;
}


Measured memory_bytes: 3780
using AtCoderBeginnerContest130.Questions;
using AtCoderBeginnerContest130.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest130.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var nx = inputStream.ReadIntArray();
            var n = nx[0];
            var x = nx[1];
            var l = inputStream.ReadIntArray();

            var total = 0;
            for (int bounce = 0; bounce < l.Length; bounce++)
            {
                total += l[bounce];
                if (total > x)
                {
                    yield return bounce + 1;
                    yield break;
                }
            }

            yield return n + 1;
        }
    }
}


namespace AtCoderBeginnerContest130
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest130.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest130.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 1000005;

int x, n;

int t[MAXN], p[MAXN], q[MAXN], l[MAXN];
int main(){
	scanf("%d %d",&x,&n);
	l[0] = x;
	for(int i=1; i<=n; i++){
		scanf("%d",&t[i]);
		int del = t[i] - t[i-1];
		tie(p[i], q[i], l[i]) = make_tuple(p[i-1], q[i-1], l[i-1]);
		if(i & 1){
			int dx = min(del, q[i]);
			q[i] -= dx;
			del -= dx;
			dx = min(del, l[i]);
			p[i] += dx;
			l[i] -= dx;
		}
		else{
			int dx = min(del, x - q[i] - l[i]);
			q[i] += dx;
			del -= dx;
			dx = min(del, l[i]);
			q[i] += dx;
			l[i] -= dx;
		}
	//	printf("%d %d %d\n", p[i], q[i], l[i]);
	}
	int qr;
	scanf("%d",&qr);
	for(int i=0; i<qr; i++){
		int ti, v; scanf("%d %d",&ti,&v);
		int pos= upper_bound(t, t + n + 1, ti) - t - 1;
		int now = 0;
		if(v <= p[pos]) now = q[pos];
		else now = q[pos] + min(l[pos], v - p[pos]);
		ti -= t[pos];
		if(pos % 2 == 0) now = max(0, now - ti);
		else now = min(x, now + ti);
		printf("%d\n", now);
	}

}



Measured memory_bytes: 11904
h,n = map(int,input().split())
a = [0]*n
c = [0]*n
for i in range(n):
  a[i],c[i] = (map(int,input().split()))
x = [10**10 for i in range(h+1)]
x[0] = 0
for i in range(1,h+1):
  for j in range(0,n):
    if(a[j] > i):
      x[i] = min(x[i],c[j])
    else:
      x[i] = min(x[i],x[i-a[j]]+c[j])
print(x[h])

Measured memory_bytes: 43840
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	ll n,k;
	cin>>n>>k;
	if(n<k)
	{
		cout<<min(n,abs(n-k))<<'\n';
	}
	else if(n==k)
	{
		cout<<0<<'\n';
	}
	else
	{
		ll d = n/k;
		n = n - d*k;
		cout<<min(n,abs(k-n))<<'\n';
	}
}


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

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

    if(n < 105){
        cout << 0 << endl;
    }else if(n >=105 && n < 135){
        cout << 1 << endl;
    }else if(n >= 135 && n < 165){
        cout << 2 << endl;        
    }else if(n >= 165 && n < 189){
        cout << 3 << endl;
    }else if(n >= 189 && n < 195){
        cout << 4 << endl;
    }else{
        cout << 5 << endl;
    }
}

Measured memory_bytes: 256
n,x = map(int,input().split())
if x==n*2-1 or x==1:
    print('No')
else:
    print('Yes')
    ans = []
    if n==2:
        print(1,2,3)
        exit()
    elif x==2:
        ans = [x+1,x,x-1,x+2]
    else:
        ans = [x-1, x, x+1, x-2]
    cnt = 0
    i = 1
    while cnt<n-2:
        if i in ans:
            i+=1
            continue
        else:
            print(i,end=' ')
            cnt+=1
            i+=1
    for j in ans:
        print(j,end=' ')
    while i<2*n:
        if i in ans:
            i+=1
            continue
        print(i,end=' ')
        i+=1



Measured memory_bytes: 4560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
	class Program
	{
		static void Main(string[] args)
		{

            int[] AB = Console.ReadLine().Split().Select(int.Parse).ToArray();

            if (AB[0] == 1 || AB[1] == 1)
            {
                if (AB[0] == AB[1])
                {
                    Console.WriteLine("Draw");
                }else
                {
                    if (AB[0] == 1)
                    {
                        Console.WriteLine("Alice");
                    }else
                    {
                        Console.WriteLine("Bob");
                    }
                }
            }else
            {
                if (AB[0] == AB[1])
                {
                    Console.WriteLine("Draw");
                }
                else if (AB[0] > AB[1])
                {
                    Console.WriteLine("Alice");
                }else
                {
                    Console.WriteLine("Bob");
                }
            }
		}
	}
	
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int digit_sum(int n){
   if(n < 10)  return 1;
   return digit_sum(n/10) + 1;
}
int main()
{
    int N;
    cin >> N;
    int cnt = 0;
    rep2(i, 1, N+1)
    {
        if(digit_sum(i)%2 != 0) ++cnt;
    }

    cout << cnt << endl;
    return 0;
}

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

int main() {
  string s,t;
  cin>>s>>t;
  if(t.size() != s.size() + 1)
    cout<<"No";
  else {
   int i = 0;
   for(i =0; i < s.size();i++){
     if(s[i] != t[i])
       break;
   }
    if(i!= s.size())
      cout<<"No";
    else cout<<"Yes";
  }
}

Measured memory_bytes: 3604
def resolve():
    def n_len(a, b):
        a = str(a)
        b = str(b)
        res = max(len(a), len(b))
        return res

    N = int(input())

    ans = 10**9+1
    i = 1
    while i*i <= N:
        if N%i == 0:
            a = i
            b = N//i
            ans = min(ans, n_len(a, b))
        i += 1
    print(ans)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC079C solver = new ABC079C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC079C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String S = in.next();
            int A = S.charAt(0) - '0';
            int B = S.charAt(1) - '0';
            int C = S.charAt(2) - '0';
            int D = S.charAt(3) - '0';
            int[] ABCD = new int[]{A, B, C, D};

            int loop = 1 << 3;
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < loop; i++) {
                sb.setLength(0);
                sb.append(A);
                int ans = A;
                for (int j = 0; j < 3; j++) {
                    if (((i >> j) & 1) == 0) {
                        sb.append('+');
                        ans += ABCD[j + 1];
                    } else {
                        sb.append('-');
                        ans -= ABCD[j + 1];
                    }
                    sb.append(S.charAt(j + 1));
                }
                if (ans == 7) {
                    sb.append("=7");
                    out.println(sb.toString());
                    return;
                }
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int max_value=0;
	int count=0;
	for(int i=0;i<n;i++){
		int temp;
		cin>>temp;
		if(temp>=max_value){
			count++;
			max_value=temp;
		}
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<long long,bool> Pair;

int main(){

double R;

cin >> R;

cout << 2.0*R*M_PI << endl;

return 0;

}

Measured memory_bytes: 3776