akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int[] a = new int[3];
		for(int i = 0 ; i < 3 ; i++) a[i] = Integer.parseInt(sc.next());
		if(a[0] % 2 > a[1] % 2){
			int e = a[0];
			a[0] = a[1];
			a[1] = e;
		}
		if(a[1] % 2 > a[2] % 2){
			int e = a[1];
			a[1] = a[2];
			a[2] = e;
		}
		if(a[0] % 2 > a[1] % 2){
			int e = a[0];
			a[0] = a[1];
			a[1] = e;
		}
		int yono = 0;
		if(a[0] % 2 == 1){
		}else if(a[1] % 2 == 1){
			yono++;
			a[1]++;
			a[2]++;
		}else if(a[2] % 2 == 1){
			yono++;
			a[0]++;
			a[1]++;
		}
		for(int i = 0 ; i < 3 ; i++) a[i] /= 2;
		int max = Math.max(a[0] , Math.max(a[1] , a[2]));
		for(int i = 0 ; i < 3 ; i++) yono += (max - a[i]);
		ou.print(yono + "\n");
		ou.flush();
    }
}

Measured memory_bytes: 38508
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

int main(void){
    int n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    std::string outPut = "";
    char temp = s.at(0);

    for(int i = 1; i <= n-2; i++){
        if(temp == s.at(i)){
            continue;
        }
        else{
            outPut += temp;
            temp = s.at(i);
        }
    }

    if(temp == s.at(n-1)){
        outPut += temp;
    }
    else{
        outPut += temp;
        outPut += s.at(n-1);
    }

    int ans = outPut.size();
    std::cout << ans << std::endl;

    return 0;
}

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

using namespace std;

using ll = long long;

int main()
{
  int n;
  cin >> n;
  vector<int> all(n);
  map<int, int> odds;
  for (int i = 0; i < n; ++i)
  {
    int buf;
    cin >> buf;
    all[i] = buf;
    if (i & 1)
    {
      odds[buf]++;
    }
  }
  sort(all.begin(), all.end());
  for (int i = 0; i < n; ++i)
  {
    if (i & 1)
    {
      odds[all[i]]--;
    }
  }
  int ans = 0;
  for (auto &p : odds)
  {
    if (p.second > 0)
    {
      ans += p.second;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5376
N,X,M = map(int,input().split())

order = []
hist = [0] * M

for i in range(N):
    if hist[X]:
        j = order.index(X)
        rem = N-i
        d,m = divmod(rem,i-j)
        for k in order[j:]:
            hist[k] += d
        for k in order[j:j+m]:
            hist[k] += 1
        break
    order.append(X)
    hist[X] += 1
    X = (X*X)%M

ans = 0
for i,h in enumerate(hist):
    ans += i*h
print(ans)

Measured memory_bytes: 13548
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

int main() {
  uint32_t A, B;
  cin >> A >> B;
  cout << (A ^ B) << endl;

  return 0;
}


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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
const int64 mod = 2 * 1000000007;
const int K = 2000;
const int KK = 2 * K + 1;

int col[KK][KK];
int64 dp[KK][KK];

void add(int64 &a, int64 b){
    a += b;
    if (a >= mod)
        a -= mod;
}

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

    int n; cin >> n;

    int64 answer = 0;

    vector<pii> points(n);

    for (int i = 0; i < n; ++i){
        int x, y; cin >> x >> y;
        col[K - x][K - y]++;
        col[K + x][K + y]--;
        points[i] = {x, y};

        // add(answer, nk[2 * x + 2 * y][2 * x]);
    }

    sort(points.begin(), points.end(), [&](pii &a, pii &b){
        return a.first + a.second < b.first + b.second;
    });

    vector<int64> nk(1, 1);
    for (int i = 1, j = 0; j < n; ++i){
        vector<int64> nnk(i + 1, 0);
        nnk[0] = nnk.back() = 1;

        for (int k = 1; k < i; ++k){
            add(nnk[k], nk[k]);
            add(nnk[k], nk[k - 1]);
        }

        while (j < n && 2 * (points[j].first + points[j].second) == i){
            add(answer, nnk[2 * points[j].first]);
            j++;
        }

        nk.swap(nnk);
    }

    answer = mod - answer;

    if (answer == mod)
        answer = 0;

    for (int i = 0; i < KK; ++i)
        for (int j = 0; j < KK; ++j){
            if (col[i][j] > 0) dp[i][j] = col[i][j];

            if (i) add(dp[i][j], dp[i - 1][j]);
            if (j) add(dp[i][j], dp[i][j - 1]);

            while (col[i][j]++ < 0)
                add(answer, dp[i][j]);
        }

    cout << answer / 2 << endl;

    return 0;
}

Measured memory_bytes: 189568
import numpy as np

N, M = map(int, input().split())
array = np.zeros([M, N])
for i in range(M):
    l = list(map(int, input().split()))
    for j in l[1:]:
        array[i, j-1] = 1
p = np.array(list(map(int, input().split())))
count = 0
for i in range(1<<N):
    array_i = array.copy()
    for j in range(N):
        if i&(1<<j):
            array_i[:, j-1] = 0
    if sum(array_i.sum(1)%2 == p)==M:
        count += 1
print(count)

Measured memory_bytes: 26956
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int A, B, N, i, j, ans = 0;
  cin >> A >> B >> N;
  ans = (N >= B - 1)? A * (B - 1) / B - A * ((B - 1) / B) :
    (A * N / B - A * (N / B));
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
// #include <queue>
// #include <map>

using namespace std;

namespace atcoder {
namespace {

[[gnu::unused]] bool check()
{
  return false;
}

template<typename T>
vector<T> getN(istream& in, const unsigned int N)
{
  vector<T> seq;
  for (auto i = 0u; i < N; ++i) {
    T x;
    in >> x;
    seq.push_back(x);
  }
  return seq;
}

int solve(istream& in)
{
  int N;
  vector<int> Ws;
  in >> N;
  for (auto i = 0; i < N; ++i) {
    int w;
    in >> w;
    Ws.push_back(w);
  }

  vector<long> Sums;
  partial_sum(Ws.begin(), Ws.end(), back_inserter(Sums));
  const auto tot = Sums[N - 1];
  for_each(Sums.begin(), Sums.end(), [tot](auto& e) {const auto other = tot - e; e = abs(e - other); });
  return *min_element(Sums.begin(), Sums.end());
}

[[gnu::unused]] void test()
{
  {
    constexpr auto str = R"(
3
1 2 3
)";
    stringstream in{str};
    assert(solve(in) == 0);
  }
  {
    constexpr auto str = R"(
4
1 3 1 1
)";
    stringstream in{str};
    assert(solve(in) == 2);
  }
}

} // namespace
} // namespace atcoder

////////////////////////////////////////////////////////////////
int main()
{
  using namespace atcoder;
  // test();
  cout << solve(cin) << '\n';
}


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

int main(){
  int m,d;
  cin >> m >> d;
  
  int i,s;
  s=0;
  for(i=1;i<=d;i++){
    int t,o;
    o=i%10;
    t=i/10;
    if(t>=2&&o>=2&&t*o<=m){
      s++;
    }
  }
  
  cout << s << endl;
}

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

int main()
{
	int N, W, H, X, Y, S, T;
	while (cin >> N, N) {
		cin >> W >> H;
		vector< vector<bool> > field(W, vector<bool>(H, false));
		for (int i = 0; i < N; i++) {
			cin >> X >> Y;
			field[X - 1][Y - 1] = true;
		}
		cin >> S >> T;
		int res = 0, temp;
		for (int i = 0; i <= W - S; i++) {
			for (int j = 0; j <= H - T; j++) {
				temp = 0;
				for (int k = 0; k < S; k++) {
					for (int l = 0; l < T; l++) {
						if (field[i + k][j + l])
							temp++;
					}
				}
				if (temp > res)
					res = temp;
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
   string S;
   cin>>S;
   if(S[0]==S[1]||S[2]==S[3]||S[1]==S[2]){cout<<"Bad"<<endl;}
   else{cout<<"Good"<<endl;}
return 0;}

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

#define int long long

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

int N;
int a[100000];

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(a, a + N);
    if (a[N - 1] - a[0] > 1) {
        cout << "No" << endl;
        return 0;
    } else if (a[0] == a[N - 1] && a[0] + 1 == N) {
        cout << "Yes" << endl;
        return 0;
    }
    int plus_one = 0;
    for (int i = N - 1; i >= 0; i--) {
        if (a[i] == a[N - 1]) {
            plus_one++;
        }
    }
    if (0 < (a[N - 1] - N + plus_one) * 2 && (a[N - 1] - N + plus_one) * 2 <= plus_one) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,k,n,r,s,p,ans=0;
    map<int,bool>mp;
    cin >> n >> k;
    char str[n+5];
    cin >> r >> s >> p;
    cin >> str+1;
    for(i=1;i<=n;i++)
    {
        if(i > k)
        {
            if(str[i] != str[i-k])
            {
                if(str[i] == 'r')ans+=p;
                else if(str[i] == 's')ans+=r;
                else ans+=s;
            }
            else
            {
                if(str[i] == 'r')
                {
                    if(mp.find(i-k) == mp.E)mp[i]=true;
                    else ans+=p;
                }
                else if(str[i] == 's')
                {
                    if(mp.find(i-k) == mp.E)mp[i]=true;
                    else ans+=r;
                }
                else
                {
                    if(mp.find(i-k) == mp.E)mp[i]=true;
                    else ans+=s;
                }
            }
        }
        else
        {
            if(str[i] == 'r')ans+=p;
            else if(str[i] == 's')ans+=r;
            else ans+=s;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 2688
#include<stdio.h>

int main() {
	int length = 0;
	int height = 0;
	int area = 0;
	int cir = 0;

	scanf("%d %d", &length, &height);
	area = length*height;
	cir = 2*(length + height);

	printf("%d %d\n", area, cir);

	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int n, a[2000];

int solve(int i, int m){
  int res;
  
  if(m == 0) return 1;
  if(i >= n) return 0;

  res = solve(i + 1, m) || solve(i + 1, m - a[i]);
  return res;
}


int main(){
  int q, m, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) scanf("%d", &a[i]);
  scanf("%d", &q);
  for(i = 0 ; i < q ; i++){
    scanf("%d", &m);
    if(solve(0, m)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}


Measured memory_bytes: 2108
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long N;
	cin >> N;

	string s;
	//cin >> s;

	//int A[5]
	//sort(A, A + 5);

	if (N <= 599)
	{
		cout << "8" << endl;
	}
	else if (N <= 799)
	{
		cout << "7" << endl;
	}
	else if (N <= 999)
	{
		cout << "6" << endl;
	}
	else if (N <= 1199)
	{
		cout << "5" << endl;
	}
	else if (N <= 1399)
	{
		cout << "4" << endl;
	}
	else if (N <= 1599)
	{
		cout << "3" << endl;
	}
	else if (N <= 1799)
	{
		cout << "2" << endl;
	}
	else if (N <= 1999)
	{
		cout << "1" << endl;
	}

}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

int main(){
    int n,m,x; cin >> n >> m >> x;
    int toll[n+10];
    rep(i,n) toll[i] = 0;
    
    rep(i,m) {
        int x;
        cin >> x;
        toll[x] = 1;
    }
    
    int ans = 0;
    int ans0 = 0;
    int ansn = 0;
    for (int i = 0; i<x; i++) {
        ans0 += toll[i];
    }
    
    for (int i=x; i<n; i++) {
        ansn += toll[i];
    }
    
    ans = min(ans0,ansn);
    
    cout << ans << endl;
}







Measured memory_bytes: 256
let input = ''

process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(chunk) {
  input += chunk
})
process.stdin.on('end', function() {
  input = input.trim().split('\n')
  main()
})

function main() {
    for(i=0; i<input.length; i++) {
        if(i>200) {
            return
        }
         let input_line = input[i].split(' ')
         let a = parseInt(input_line[0])
         let b = parseInt(input_line[1])
         if(0 > a || b > 1000000) {
             return
         }
         console.log((a + b).toString().length)
    }
}


Measured memory_bytes: 16560
import java.util.Scanner;

/**
 *
 * @author ena000078
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if ((b - a) == (c - b)){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll M;
    cin >> M;
    ll sum = 0;
    ll len = 0;
    for (ll i = 0; i < M; i++) {
        ll d, c;
        cin >> d >> c;
        len += c;
        sum += c * d;
    }

    cout << (len - 1) + (sum - 1) / 9 << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    dp = [i for i in range(N + 1)]
    pow6 = 6
    while pow6 <= N:
        for i in range(N + 1):
            if i + pow6 > N:
                break
            dp[i + pow6] = min([dp[i + pow6], 1 + dp[i]])
        pow6 *= 6
    pow9 = 9
    while pow9 <= N:
        for i in range(N + 1):
            if i + pow9 > N:
                break
            dp[i + pow9] = min([dp[i + pow9], 1 + dp[i]])
        pow9 *= 9
    print(dp[N])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector> 
#include <string>

using namespace std;
const int MAXN = 1e3 + 10;
struct node
{
	int nxt, id;
	node(int a, int b)
	{
		nxt = a;
		id = b;
	}
	node() {}
};
int n, m, tim;
int vis[MAXN];
int res[MAXN][MAXN][2];
int u[MAXN * MAXN], v[MAXN * MAXN];
vector <node> edge[MAXN];
inline void _read(int &x)
{
	x = 0;
	char t = getchar();
	while (!isdigit(t)) t = getchar();
	while (isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
inline void dfs(const int &now, const int fa, const int &b, const int &f)
{
	vis[now] = tim;
	res[fa][now][f] = b;
	register int len = edge[now].size();
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, fa, b, f);
}
inline void solve(const int & now)
{
	tim++; vis[now] = tim;
	register int len = edge[now].size();
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, now, edge[now][i].id, 0);

	reverse(edge[now].begin(), edge[now].end());

	vis[now] = ++tim;
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, now, edge[now][i].id, 1);
}
int main(int argc, char **Argv)
{
	_read(n), _read(m);
	for (register int i = 1; i <= m; i++)
	{
		_read(u[i]), _read(v[i]);
		edge[u[i]].push_back(node(v[i], i));
	}
	for (register int i = 1; i <= n; i++)
		solve(i);
	for (register int i = 1; i <= m; i++)
	{
		if ((res[v[i]][u[i]][0] != 0) ^ 0 ^ (res[u[i]][v[i]][0] != i || res[u[i]][v[i]][1] != i))
			puts("diff");
		else
			puts("same");
	}
	return 0;
}

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long low = 2, high = 2;
  for (int i = n - 1; i >= 0; --i) {
    long long newLow = ((low - 1) / a[i] + 1) * a[i];
    long long newHigh = high / a[i] * a[i] + a[i] - 1;
    if (high / a[i] * a[i] < low) {
      cout << -1 << endl;
      return 0;
    }
    low = newLow;
    high = newHigh;
  }
  cout << low << ' ' << high << endl;
  return 0;
}


Measured memory_bytes: 640
import bisect
s = input()
t = input()
moji = {}
for i in range(len(s)):
    if s[i] in moji.keys():
        moji[s[i]].append(i)
    else:
        moji[s[i]] = [i]

now = -1
kaisu = 0
flag = True
for i in range(len(t)):
    if t[i] in moji.keys():
        basho = moji[t[i]]
        lenbasho = len(basho)
        nowindex = bisect.bisect_right(basho, now)
        if nowindex == lenbasho:
            now = basho[0]
            kaisu += 1
        else:
            now = basho[nowindex]
    else:
        flag = False
        break
if flag:
    ans = kaisu * len(s) + now + 1
    print(ans)
else:
    print(-1)



Measured memory_bytes: 7668
function Main(input) {
	var tmp = input.split("\n");
	var a = Number.parseInt(tmp);
  var b = findPrime(a);
	console.log('%s', b);
}

function findPrime(x) {
  for (var i = x;; i++) {
    if (isPrime(i)) {
      return i;
    }
  }
}

function isPrime(x) {
  for (var i = 2; i < x; i++) {
    if (x % i === 0) {
      return false;
    }
  }
  return true;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 20936
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<vector>
using namespace std;
#define ll long long int
#define INF 0x3f3f3f3f
int main()
{
	int t;
	scanf("%d", &t);
	double x = 0, y = 0;
	while (t--) {
		double tmp;
		string str;
		cin >> tmp;
		cin >> str;
		if (str == "JPY") x += tmp;
		else y += tmp;
	}
	x += 380000.0*y;
	printf("%.6f\n", x);
	return 0;
}
//_CRT_SECURE_NO_WARNINGS

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int N; cin >> N; string S; cin >> S;
  //o と x 
  vector<bool> assign(N);
  
  //trueが羊、falseが狼を表す。　最初の２つを決めて、その後矛盾がないかを調べていく
 
for(int k = 0; k < 4; k++){
   //4通り試す
   if(k==0){ assign[0] = true; assign[1] = true;}
   if(k==1){ assign[0] = true; assign[1] = false;}
   if(k==2){ assign[0] = false; assign[1] = true;}
   if(k==3){ assign[0] = false; assign[1] = false;}
  
      bool flag = true;      
  
  for(int i = 0; i < N; i++){
    
    if(i == 0){
      if(assign[0]){ 
        if(S[0] == 'o'){ assign[N-1] = assign[1];}
        else{ assign[N-1] = !assign[1];} }
      else{
        if(S[0] == 'o'){ assign[N-1] = !assign[1];}
        else{ assign[N-1] = assign[1];} }
      
      
        }
    
    else if( i < N-2){ 
      //この間は埋めていくだけ
      if(assign[i]){
        if(S[i] == 'o'){ assign[i+1] = assign[i-1];}
        else{ assign[i+1] = !assign[i-1];} }
      else{
        if(S[i] == 'o'){ assign[i+1] = !assign[i-1];}
        else{ assign[i+1] = assign[i-1];} }
    }
   
    else{ // i == N-2とN-1にて、整合するかを確かめる
      
      if( i == N-2){
        
        if(assign[N-2]){
          if(S[N-2] == 'o'){ 
            if( assign[N-1] != assign[N-3]){ flag = false;}}
          else{
            if(assign[N-1] == assign[N-3]){ flag = false;}}
        }
        else{
         
          if(S[N-2] == 'o'){
            if( assign[N-1] == assign[N-3]){ flag = false;}}
          else{
            if( assign[N-1] != assign[N-3]){ flag = false;}}
        }
      }
      else{ // i == N-1のとき
      
        if(assign[N-1]){
          if(S[N-1] == 'o'){
            if( assign[N-2] != assign[0]){ flag = false;}}
          else{
            if( assign[N-2] == assign[0]){ flag = false;}}
        }
        else{ 
          if(S[N-1] == 'o'){
            if( assign[N-2] == assign[0]){ flag = false;}}
          else{
            if( assign[N-2] != assign[0]){ flag = false;}}
        }
      }
     
      if(flag && i == N-1){
        for(int i = 0; i < N; i++){
          if(assign[i]){cout<< "S";} else{ cout << "W";}}
     
        cout << endl; return 0;}
     
    }// i == N-2/N-1かっこ閉じ
 
  }// i - かっことじ

}// k- かっことじ
  
  cout << -1 << endl; return 0;}
          
            
          
                                     
          
            
        
          
      
          
  
  

Measured memory_bytes: 512
import sys
readline=sys.stdin.readline
 
N=int(readline())
A = [None] * N
B = [None] * N
for i in range(N):
  A[i],B[i] = map(int,readline().split())

A = sorted(A)
B = sorted(B)

if N % 2 == 1:
  # 奇数の場合
  Amid = A[N // 2]
  Bmid = B[N // 2]
  print(Bmid - Amid + 1)
else:
  # 偶数の場合
  Amid = (A[N // 2] + A[(N // 2) - 1])
  Bmid = (B[N // 2] + B[(N // 2) - 1])
  print(int(Bmid - Amid) + 1)


Measured memory_bytes: 27080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned ui;
typedef unsigned long long ul;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef pair<ul, ul> puu;
typedef vector<int> vi;
#define pb push_back
#define fi first
#define se second
#define ls (i << 1)
#define rs (i << 1 | 1)
#define mid (l + r >> 1)
#define enum(i, j, k) for(int i = j; i <= (k); i ++)
#define open(i, j, k) for(int i = j; i <  (k); i ++)
#define dec(i, j, k)  for(int i = j; i >= (k); i --)
#define ae(x) for(node *p = h[x]; p; p = p->nxt)
#define mfil(x, k) memset(x, k, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
#define fio(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout)
template <class T> bool chkmin(T &x, T y)
{ return y < x ? (x = y, true) : false; }
template <class T> bool chkmax(T &x, T y)
{ return y > x ? (x = y, true) : false; }
struct __init { __init()
{
    ios::sync_with_stdio(false); cin.tie(0);
    cout.precision(16); cout << fixed;
    srand(time(0) ^ ui(ul(new char)));
} } static __init__;
/* default code ends here */

const int maxn = 2e5 + 10;
int H, W, n;
pii pos;
int aa[maxn], bb[maxn];

int trans(char c)
{
    switch(c)
    {
        case 'L' : return 0;
        case 'R' : return 1;
        case 'U' : return 2;
        case 'D' : return 3;
    }
    return -1;
}

void yes()
{
    cout << "YES\n";
    exit(0);
}
void no()
{
    cout << "NO\n";
    exit(0);
}

int M, m;
int a[maxn], b[maxn];
int l[maxn], r[maxn];
void solve()
{
    //cerr << "A" << endl;
    dec(i, n, 1)
    {
        l[i] = l[i + 1];
        if(a[i] == -1)
            l[i] ++;
        if(b[i] == 1)
            l[i] --;
        if(a[i] == -1)
            chkmax(l[i], 1);
        else
            chkmax(l[i], 0);

        r[i] = r[i + 1];
        if(a[i] == 1)
            r[i] ++;
        if(b[i] == -1)
            r[i] --;
        if(a[i] == 1)
            chkmax(r[i], 1);
        else
            chkmax(r[i], -1);
    }

    if(m - l[1] < 1 || m + r[1] > M)
        no();

    /*cerr << "B" << endl;
    enum(i, 1, n)
        cerr << l[i] << ' ' << r[i] << endl;*/
    enum(i, 1, n)
        if(l[i] + r[i] >= M)
            no();
}

int main()
{
    cin >> H >> W >> n >> pos.fi >> pos.se;
    string foo;
    cin >> foo;
    enum(i, 1, n)
        aa[i] = trans(foo[i - 1]);
    cin >> foo;
    enum(i, 1, n)
        bb[i] = trans(foo[i - 1]);
    
    M = W;
    m = pos.se;
    enum(i, 1, n)
    {
        a[i] = aa[i] < 2 ? (aa[i] == 0 ? -1 : 1) : 0;
        b[i] = bb[i] < 2 ? (bb[i] == 0 ? -1 : 1) : 0;
    }
    solve();

    M = H;
    m = pos.fi;
    enum(i, 1, n)
    {
        a[i] = aa[i] >= 2 ? (aa[i] == 2 ? -1 : 1) : 0;
        b[i] = bb[i] >= 2 ? (bb[i] == 2 ? -1 : 1) : 0;
    }
    solve();

    yes();
    return 0;
}

Measured memory_bytes: 5272
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B && B == C) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import copy

ab = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

n = int(input())

value = ['a']
for i in range(10):
    if len(value[0]) == n:
        break
    tmp_value = copy.copy(value)
    value = []
    for v in tmp_value:
        for j in range(n):
            value.append(v + ab[j])
            if ab[j] not in v:
                break
for v in value:
    print(v)


Measured memory_bytes: 14656
# -*- coding: UTF-8 -*-
# ABC138_C

import math

N = int(input())

inputV = input("")
arrayV = [int(n) for n in inputV.split()]
arrayV.sort(reverse=True)

value = 0
pow = 1
for i in arrayV:
    value = value + i * math.pow(2, -pow)
    pow = pow + 1

value = value + arrayV[N - 1] * math.pow(2, -N)

print(value)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i;
	cin>>n;
	vector<int> arr(n);
	for(i=0;i<n;++i)
		cin>>arr[i];
	vector<int> dp(n);
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(i=2;i<n;++i)
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	cout<<dp[n-1];
	return 0;
}


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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> b(m);
	for (int i = 0; i < m; i++)
		cin >> b[i].second >> b[i].first;
	sort(b.begin(), b.end());
	int ans = 0, c = 0;
	for (pair<int, int> t : b)
		if (c <= t.second)
		{
			c = t.first;
			ans++;
		}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

long lcmf(long n, long m) {
  long a, b, x, y, tmp, r;

  a = n;
  b = m;
  if(a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  x = a;
  y = b;

  r = a % b;
  while(r!=0) {
    a = b;
    b = r;
    r = a % b;
  }
  return(x / b * y);
}

int main(void) {
  long n, lcm, i;
  long t[100];

  scanf("%ld", &n);

  for(i = 0; i < n;i++) {
    scanf("%ld", &t[i]);
  }

  lcm = t[0];
  for(i = 0; i < n; i++) {
    lcm = lcmf(lcm, t[i]);
  }
  printf("%ld\n", lcm);
  return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp2[300000][60]={};
int main() {
	string s,t,u;
	cin>>s>>t;
	int a,b;
	cin>>a>>b>>u;
	if(s==u)a--;
	if(t==u)b--;
	cout<<a<<" "<<b;
	return 0;
}


Measured memory_bytes: 3968
from copy import copy
n, k = map(int, input().split())
a = [int(i) - 1 for i in input().split()]
ans = 0
while k:
    if k & 1:
        ans = a[ans]
    c = [a[a[i]] for i in range(n)]
    a = copy(c)
    k >>= 1
print(ans + 1)

Measured memory_bytes: 33260
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
using namespace std;

int main(){
    vector<int> A;

    long int N,K;
    vector<int> P;
    long int Psum[1001];
    long double Pex[1001];
    Psum[0]=0;
    Pex[0]=0;
    for(int i=1;i<=1000;i++){
        Psum[i]=1+i;
        Pex[i]=double(Psum[i])/2;
    }
    int p;
    cin>>N>>K;
    for(long int i=0;i<N;i++){
        cin>>p;
        P.push_back(p);
    }
    long double sum=0;
    long double max_sum=0;
    int count=0;
    for(long int i=0;i<K;i++)sum+=P[i];
    max_sum=sum;
    for(long int i=1;i<=N-K;i++){
        sum=sum-P[i-1]+P[i+K-1];
        if(sum>max_sum){
            count=i;
            max_sum=sum;
        }
    }
    sum=0;
    for(int i=0;i<K;i++){
        sum+=Pex[P[count+i]];
    }
    cout << setprecision(10);

    cout<<sum<<endl;



}

Measured memory_bytes: 1400
#include <stdio.h>
#define M 100
int main() {
    int i,j,a,b,n,g[M], m[M][M],u;
    scanf("%d",&n);
    
    for (i=1;i<=n;i++)
    {
        scanf("%d%d",&g[i-1],&g[i]);
    }
    for(i=1;i<=n;i++) m[i][i]=0;
    for(b=2;b<=n;b++)
    {
        for(i=1;i<=n-b+1;i++)
        {
            j=i+b-1;
            m[i][j]=10000000;
            for (a=i;a<=j-1;a++)
            {
                u=m[i][a]+m[a+1][j]+g[i-1]*g[a]*g[j];
                if(m[i][j]>u) m[i][j]=u;
            }
        }
    }
    printf("%d\n",m[1][n]);
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    
    long x,y,i,k,X,Y,n,count;
    
    count=0;
    cin>>n;
    bool flug=true;
    for (i=1;i<=n;i++)
    {
        cin>>x;
        y=sqrt(x);
        flug=true;
        for (k=2;k<y+1;k++)
        {
            if(x/k*k==x)
            {
                flug=false;
            }
            
        }
        if(flug==true)
        {
            count+=1;
            
        }
        
    }
   
    cout<<count<<endl;
        
    
    
}



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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef pair<int,int> pii;

int N;
int A[300010];
pii dp[300010];

int main()
{
    cin >> N;
    int K = (1 << N);
    for(int i = 0; i < K; i++)cin >> A[i];
    A[K] = -1;

    for(int i = 1; i < K; i++)dp[i] = mk(K, K);

    for(int i = 1; i < K; i++)
    {
        int cnt = 0;
        for(int j = 0; j < N; j++)if(i & (1 << j))cnt++;
        if(cnt == 1)
        {
            int idx = 0;
            if(A[0] > A[i])idx = 0;
            else idx = i;
            dp[i] = mk(idx,i - idx);
        }
        else
        {
            for(int j = 0; j < N; j++)if(i & (1 << j))
            {
                pii tmp = dp[i ^ (1 << j)];
                vector<pii> v;
                v.push_back(mk(A[dp[i].fi],dp[i].fi));
                v.push_back(mk(A[dp[i].se],dp[i].se));
                v.push_back(mk(A[tmp.fi],tmp.fi));
                v.push_back(mk(A[tmp.se],tmp.se));
                v.push_back(mk(A[i],i));
                sort(v.begin(),v.end());
                v.erase(unique(v.begin(), v.end()), v.end());
                reverse(v.begin(), v.end());
                dp[i] = mk(v[0].se, v[1].se);
            }
        }
    }

    int MAX = 0;
    for(int i = 1; i < K; i++)
    {
        MAX = max(MAX,A[dp[i].fi] + A[dp[i].se]);
        printf("%d\n",MAX);
    }

    return 0;
}


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

using namespace std;
using ll = long long;

const int N = 2e5 + 5;

struct SegmentTree {
    ll t[N << 2];
    
    void init(int u, int b, int e) {
        if (b == e) {
            t[u] = 0;
            return;
        }
        int mid = (b + e) >> 1;
        init(u << 1, b, mid);
        init(u << 1 | 1, mid + 1, e);
        t[u] = max(t[u << 1], t[u << 1 | 1]);
    }

    void upd(int u, int b, int e, int i, ll x) {
        if (i < b or e < i) return;
        if (i <= b and e <= i) {
            t[u] = x;
            return;
        }
        int mid = (b + e) >> 1;
        upd(u << 1, b, mid, i, x);
        upd(u << 1 | 1, mid + 1, e, i, x);
        t[u] = max(t[u << 1], t[u << 1 | 1]);
    }

    ll query(int u, int b, int e, int i, int j) {
        if (j < b or e < i) return 0LL;
        if (i <= b and e <= j) return t[u];
        int mid = (b + e) >> 1;
        ll p1 = query(u << 1, b, mid, i, j);
        ll p2 = query(u << 1 | 1, mid + 1, e, i, j);
        return max(p1, p2);
    }
} t;

int main() { 
    ios_base::sync_with_stdio(false); 
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> h(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    vector<ll> dp(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> dp[i];
    }
    for (int i = 1; i <= n; i++) {
        if (h[i] == 1) {
            t.upd(1, 1, n, h[i], dp[i]);
            continue;
        }
        dp[i] += 1LL * t.query(1, 1, n, 1, h[i] - 1);
        t.upd(1, 1, n, h[i], dp[i]);
    }
    cout << *max_element(dp.begin(), dp.end()) << '\n';
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,i,x,y,p=0;
    cin>>a>>b;
    for(i=1;i<=100000;i++)
    {
        if(((i*8)/100)==a && ((i*10)/100)==b)
        {
            cout<<i<<endl;
            return 0;
        }
    }
        cout<<-1<<endl;

}


Measured memory_bytes: 256
N,K = map(int,input().split())

vals = list(map(int,input().split()))

ans = -99999999999
for modosi in range(K + 1):
	for tridashi in range(K + 1 - modosi):
		for tridashi_pos_r in range(tridashi + 1):
			tridashi_pos_l = tridashi - tridashi_pos_r
			if tridashi_pos_l + tridashi_pos_r > N:
				tridashi_pos_r = N
				tridashi_pos_l = 0
			
			use_vals = list(vals[:tridashi_pos_r])
			if tridashi_pos_l != 0:
				use_vals += list(vals[-tridashi_pos_l:])
			use_vals.sort()
			minus_idx = min(len([a for a in use_vals if a < 0]),modosi)
			
			val = sum(use_vals[minus_idx:])
			if val > ans:
				ans = val
print(ans)

Measured memory_bytes: 49752
#include<cstdio>
#include<cstring>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
const int maxn = 10;

typedef struct Node{
	int a[maxn];
	int step;
}Node;

int arr[maxn],start[maxn];//start arr 分别是开始和目标状态 
int cnt;//记录map的值 
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};
map<int,int>mp;

int bfs(){
	queue<Node>que;
	Node node;
	memcpy(node.a,start,sizeof(start));
	node.step = 0;
	que.push(node);
	while(!que.empty()){
		//for()...
		node = que.front();
		que.pop();
		int index;
		for(int i = 0; i<9; i++){
			if(node.a[i] == 0) index = i;
		}
		int r = index/3;
		int c = index%3;
		for(int i = 0; i<4; i++){
			int nr = r + dx[i];
			int nc = c + dy[i];
			if(0<=nr && nr<3 && 0<=nc && nc<3){
				Node node_new;
				int index_new = nr*3 + nc;
				int sum = 0;
				memcpy(node_new.a,node.a,sizeof(node.a));				
				swap(node_new.a[index],node_new.a[index_new]);
				for(int j = 0; j<9; j++){
					sum = sum*10 + node_new.a[j];
				}
				if(mp[sum] == 0){
					mp[sum] = cnt++;
					node_new.step = node.step+1;
					if(memcmp(arr,node_new.a,sizeof(arr)) == 0){
						return node_new.step;
					}
					que.push(node_new);
				}
			}
		}
		//if !vis[i] ...que.push
	}
}
int main()
{
	int sum1 = 0, cnt = 0, sum = 0;
	for(int i = 1; i<=8; i++){
		sum1 = sum1*10 + i;
		start[i-1] = i; 
	}
	sum1 = sum1*10;
	start[8] = 0;
	mp[sum1] = cnt++;
	for(int i = 0; i<9; i++){
		scanf("%d",&arr[i]);
		sum = sum*10 + arr[i];
	}
	if(sum == sum1) printf("0\n");
	else{
		printf("%d\n",bfs());
	}
	
	return 0;
}


Measured memory_bytes: 11728
#!/usr/bin/env ruby
x, n = gets.chomp.split(" ").map(&:to_i)
p = gets.chomp.split(" ").map(&:to_i)

return puts x if p.empty? || !p.include?(x)

diff = 1

while true
  if !p.include?(x - diff)
    puts x - diff
    break
  elsif !p.include?(x + diff)
    puts x + diff
    break
  end
  diff += 1
end


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
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; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int r,g,b,n;
	cin >> r >> g >> b >> n;

	int cnt = 0; 
	rep(i, (n / r) + 1){
		rep(j, (n / g) + 1){
			if(((n - (i * r + j * g)) % b == 0) && n >= (i * r + j * g)){
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    double A, B;
    cin >> A >> B;
    for (int i = 0; i <= 1009; i++)
    {
        if (floor((double)(i * 0.08)) == A && floor((double)(i * 0.1)) == B)
        {
            cout << i << endl;
            return 0;
        }

    }

    cout << -1 << endl;
    
    return 0;
}

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

struct MaximumHeap {
  vector<int> data;
  int n;
  MaximumHeap(int n): data(n), n(n) {}
  void heapfy(int node) {
    int left = 2 * node + 1;
    int right = 2 * node + 2;
    int largest = -1;
    // 左の子，自分，右の子で最大のノードを選ぶ
    if (left < n && data[left] > data[node]) {
      largest = left;
    } else {
      largest = node;
    }
    if (right < n && data[right] > data[largest]) {
      largest = right;
    }
    if (largest != node) { // 自分以外が大きい場合取替
      swap(data[node], data[largest]);
      heapfy(largest);
    }
  }
  void build() {
    for (int i = n / 2; i >= 0; i--) {
      heapfy(i);
    }
  }
};


int main(void) {
  int h;
  cin >> h;
  MaximumHeap maxheap(h);
  for (int i = 0; i < h; i++) {
    cin >> maxheap.data[i];
  }
  maxheap.build();

  for (int i = 0; i < h; i++) {
    cout << " " << maxheap.data[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 4644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll x;
  cin >> x;
  cout << 10 - x / 200 << endl;
}

Measured memory_bytes: 3624
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.math.*;
import java.io.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = 3;
        String S = sc.next();
        int c=0, ans = 0;
        for(int n=0; n<N; n++){
            if(S.charAt(n)=='R') c++;
            else c=0;

            ans = Math.max(c, ans);
        }
        
        System.out.println(ans);


    }
}


Measured memory_bytes: 35552
#include <iostream>

using namespace std;

int b[101],a[4][4],d1(0),d2(0),t,n;

int main()
{
    for (int i(1); i<=3; i++)
        for (int j(1);j<=3; j++)
            cin >> a[i][j];
    cin >> n;
    for (int i(1); i<=n; i++)
        {
            cin >> t;
            b[t]++;
        }
    for (int i(1); i<=3; i++)
    {
        d1=0;
        d2=0;
        for (int j(1); j<=3; j++)
        {
            if (b[a[i][j]]>0) d1++;
            if (b[a[j][i]]>0) d2++;
        }
        if (d1==3 || d2==3)
        {
            cout << "Yes" ;
            return 0;
        }
    }
    d1=0;d2=0;
    for (int i(1); i<=3; i++)
        {
            if (b[a[i][i]]>0) d1++;
            if (b[a[i][3-i+1]]>0) d2++;
        }
    if (d1==3 || d2==3)
         {
            cout << "Yes" ;
            return 0;
        }
    cout <<"No";
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <string.h>

using namespace std;

char S[100];

int main(int argc, char** argv) {
    cin >> S;
    bool c1 = S[0] == 'A';

    int count = 0;
    for (int i = 2; i < strlen(S) - 1; i++) if (S[i] == 'C') count++;
    bool c2 = count == 1;

    count = 0;
    for (int i = 0; i < strlen(S); i++) if (S[i] <= 'Z') count++;
    bool c3 = count <= 2;

    //cout << c1 << endl;
    //cout << c2 << endl;
    //cout << c3 << endl;
    if (c1 && c2 && c3)
        cout << "AC" << endl;
    else
        cout << "WA" << endl;
}


Measured memory_bytes: 256
def main():
    N = 1000 - int(input())
    while N != 1000:
        ans = 0
        while N >= 500:
            ans += 1
            N -= 500
        while N >= 100:
            ans += 1
            N -= 100
        while N >= 50:
            ans += 1
            N -= 50
        while N >= 10:
            ans += 1
            N -= 10
        while N >= 5:
            ans += 1
            N -= 5
        while N >= 1:
            ans += 1
            N -= 1
        print(ans)
        N = 1000 - int(input())

if __name__ == '__main__':
    main()


Measured memory_bytes: 5592
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <string.h>
#include <bits/stdc++.h>
#include <math.h>

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//b問題
//上面v[0]と前面v[1]が与えられるので、右側v[2]を答える


// 5		v[4]
//413	v[3]v[0]v[2]
// 2		v[1]
// 6		v[5]

//N
//	  v[4]				v[0]
//v[3]v[0]v[2]	→	v[3]v[1]v[2]
//	  v[1]				v[5]
//	  v[5]				v[4]

//S
//	  v[4]				v[5]
//v[3]v[0]v[2]	→	v[3]v[4]v[2]
//	  v[1]				v[0]
//	  v[5]				v[1]

//E
//	  v[4]				v[4]
//v[3]v[0]v[2]	→	v[5]v[3]v[0]
//	  v[1]				v[1]
//	  v[5]				v[2]

//W
//	  v[4]				v[4]
//v[3]v[0]v[2]	→	v[0]v[2]v[5]
//	  v[1]				v[1]
//	  v[5]				v[3]


class dice
{
public:
	void init(int _dice[6])
	{
		for(int i = 0; i < 6; ++ i)
		{
			v[i] = _dice[i];
		}
	}

	void getDateArray(int input[6]) {
	  	input[0] = v[0];
		input[1] = v[1];
		input[2] = v[2];
		input[3] = v[3];
		input[4] = v[4];
		input[5] = v[5];
	}


	void mov(char c)
	{
		int buf;
		//北方向
		if(c == 'N')
		{
			buf = v[0];
			v[0] = v[1];
			v[1] = v[5];
			v[5] = v[4];
			v[4] = buf;
		}
		else if(c == 'S')
		{
			buf = v[0];
			v[0] = v[4];
			v[4] = v[5];
			v[5] = v[1];
			v[1] = buf;		
		}
		else if(c == 'E')
		{
			buf = v[0];
			v[0] = v[3];
			v[3] = v[5];
			v[5] = v[2];
			v[2] = buf;	
		}
		else if(c == 'W')
		{
			buf = v[0];
			v[0] = v[2];
			v[2] = v[5];
			v[5] = v[3];
			v[3] = buf;				
		}
	}
// 5		v[4]
//413	v[3]v[0]v[2]
// 2		v[1]
// 6		v[5]

	int migi[5] = {1,2,4,3,1};
	//上面v[0]固定で前面v[?]が与えられるので、右側v[?]を答える
	int find_right(int front)
	{
		int res = -1;

		REP(i,4)
		{
			if(front == v[migi[i]])
			{
				res = v[migi[i+1]];
			}
		}
		return res;
	}

	//指定の値を上面
	int tadasu(int up)
	{
		
		//初期位置
		if(v[0] == up) return 0;

		string kororin = "WWNWW";
		REP(i,kororin.size())
		{
			mov(kororin[i]);
			if(v[0] == up) return 0;
		}
		return -1;
	}


	int sameDice(int in[6])
	{

		string kororin = "NNNNWNNNWNNNENNNENNNWNNN";
		for(int i = 0; i < kororin.size(); ++i)
		{
			mov(kororin[i]);
			for(int j = 0; j < 6; j++){
                if(in[j] != v[j])
                    break;
                if(j == 5)
                    return 0;
			}

		}

		return -1;
	}
int operator[](size_t i){return v[i];}
private:
	int v[6];
};

int main(){
    //std::ifstream in("resource/input.txt");
    //std::cin.rdbuf(in.rdbuf());

	int n;
	cin >> n;

	dice d[n];

	REP(i,n)
	{
		int _dice[6];
		REP(i,6)
		{
			cin >> _dice[i];
		}
		//サイコロの作成
		d[i].init(_dice);
	}

	//対称となる3組が一致すればよい??
	//0-5
	//1-4
	//2-3


	string res = "Yes";

	//すべてが異なる場合はYES

	for(int i = 0; i < n; ++i)
	{
		for(int j = i + 1; j < n; ++j)
		{
			int tarDice[6];
			d[j].getDateArray(tarDice);

			if(d[i].sameDice(tarDice) == 0)
			{
				res = "No";
				break;
			}
		}
		if(res == "No")break;
	}



	cout << res << endl;
    //cout << fixed << setprecision(5) << dm << endl;
	//std::printf("%.5f¥n", res);
	
	return 0;
}




Measured memory_bytes: 3200
# a,b,cの袋の中のキャンディーの個数を整数で入力
a,b,c = map(int,input().split())
# 袋から出さずに2つの同じ数に分けられるならYes、ダメならNo
if a + b == c or a + c == b or b + c ==a:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9084
# -*- coding: utf-8 -*-
import copy
import collections

H, W = list(map(int, input().split()))

c = []
for i in range(10):
    c += [list(map(int, input().split()))]

A = []
for i in range(H):
    A += list(map(int, input().split()))

mincost = {}
for i in range(10):
    mincost[i] = c[i][1]

copy_mincost = {}
while mincost != copy_mincost:
    copy_mincost = copy.deepcopy(mincost)
    for i in range(10):
        for j in range(10):
            if mincost[j] > mincost[i] + c[j][i]:
                mincost[j] = mincost[i] + c[j][i]

co = collections.Counter(A)
ans = 0

for i in range(0, 10):
    ans += co[i] * mincost[i]

print(ans)


Measured memory_bytes: 4104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll m=1e9+7;
ll n;
ll a,b;
ll ksm(ll n,ll p){
    if(p==1) return n%m;
    if(p%2==1) return n*ksm(n,p-1)%m;
    ll t=ksm(n,p/2);
    return t*t%m;
}
ll niyuan(ll n,ll k){
    ll x=1,y=1,i;
    for(i=0;i<k;i++){
        x=x*(n-i)%m;
        y=y*(i+1)%m;
    }
    return x*ksm(y,m-2)%m;
}
int main()
{
    cin>>n>>a>>b;
    ll ans=0;
    ans=ksm(2,n)-1;
    ans-=niyuan(n,a);
    ans-=niyuan(n,b);
    cout<<(ans%m+m)%m;
    return 0;
}

Measured memory_bytes: 256