akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {
	    int a = nextInt();
	    int b = nextInt();	
	    int c = nextInt();	    
	    
	    if(a + b == c || b + c == a || c + a == b){
                out.println("Yes");
	    }else{
                out.println("No");	        
	    }

	}

	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 22996
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  int c = 0;
  while (a) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}

void solve() {
  int a, b;
  cin >> a >> b;
  cout << gcd(a, b) << endl;
}

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

int main() {
  string S = "";
  string T = "";
  cin >> S >> T;
  
  int count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3860
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
  int n,m;
  cin >> n >> m;
  int dif=abs(n-m);
  if(dif>=2)cout << 0 << endl;
  else{
      ll ans=1;
      if(n==m){
          for(int i=1;i<=n;i++){
              ans*=(i%MM);
              ans%=MM;
          }
          for(int i=1;i<=m;i++){
              ans*=(i%MM);
              ans%=MM;
          }
          ans*=2;
          ans%=MM;
          cout << ans << endl;
      }
      else{
          for(int i=1;i<=n;i++){
              ans*=(i%MM);
              ans%=MM;
          }
          for(int i=1;i<=m;i++){
              ans*=(i%MM);
              ans%=MM;
          }
          ans%=MM;
          cout << ans << endl;
      }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define min(a,b) ((a)<(b)?(a):(b))

int main(void) {
	int a, b, c, d;
	scanf("%d %d %d", &a, &b, &c);
	
	d = b;
	d += min(b + 1, c);
	d += min(a, c-min(b + 1,c));
	
	printf("%d\n", d);
	
	return 0;
}

Measured memory_bytes: 128
import sys
t_list = []
for i in sys.stdin.readlines():
    t_list.append(i.rstrip())
t_list.pop(0)

def solution(t_list):
    t_list.sort()
    ans_str = ""
    for i in t_list:
        ans_str += i
    return ans_str
    
def main():
    print(solution(t_list))
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
function main(input) {
    const [NK, As] = input.trim().split('\n')
    let [N, K] = NK.split(' ').map(n => Number(n))
    let A = As.split(' ').map(n => Number(n))

    for(let k = 0; k < K; k++) {
        const imos = new Array(N).fill(0)

        for(let i = 0; i < N; i++) {
            let [min, max] = [i - A[i], i + A[i] + 1]
            if(min < 0) min = 0
            imos[min]++
            imos[max]--
        }
        imos.length = N

        const newA = new Array(N).fill(0)
        let cur = 0
        for(let i = 0; i < N; i++) {
            cur += imos[i]
            newA[i] = cur
        }
        
        const is_same = A.every((a,i) => a === newA[i])
        if(is_same) break
        
        A = newA
    }

    console.log(A.join(' '))
}

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


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

int main(){
  
  int n;
  cin >> n;
  
  double x=2.0;
  
  if(n%2==0){
    cout << 1/x << endl;
  }else{
    cout << (n+1)/(x*n) << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=110;
inline int read(){
	int x=0,f=0,c=getchar();
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);putchar(x%10+'0');
}
int n,m,a[N],p[N];
ll res,ans,f[310][50];
ll work(){
	register int i,j,k;
	memset(f,0,sizeof(f));
	f[n*a[n-1]][0]=1;
	for(i=0;i<=n*m;i++)
	for(j=i;j<=n*m;j++)
	for(k=0;k<(1<<(n-1));k++)
	if(i%n&&!((k>>p[i%n-1])&1))
	f[min(n*m,max(j,i+n*a[p[i%n-1]]))][k|(1<<p[i%n-1])]+=f[j][k];
	return f[n*m][(1<<(n-1))-1];
}
int main(){
	//freopen("1.out","w",stdout);
	int i;
	n=read();m=read();
	for(i=0;i<n;i++)a[i]=read();
	sort(a,a+n);
	for(i=0;i<n-1;i++)p[i]=i;
	do{ans+=work();res++;}
	while(next_permutation(p,p+n-1));
	for(i=0;i<n-1;i++)res=res*m;
	printf("%.15lf\n",1.0*ans/res);
	return 0;
}

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

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

ll x[100100],y[100100],z[100100];

int main(void){
	int n,i,m,a;
	ll k;
	cin >> n;
	vector<int> v(n),u(n);
	iota(v.begin(),v.end(),0);
	for(i=0; i<n; ++i){
		cin >> x[i];
	}
	for(i=1; i<n; ++i){
		y[i] = x[i]-x[i-1];
	}
	cin >> m >> k;
	for(i=0; i<m; ++i){
		cin >> a;
		swap(v[a-1],v[a]);
	}
	while(k){
		if(k%2){
			for(i=1; i<n; ++i){
				z[i] = y[v[i]];
			}
			for(i=1; i<n; ++i){
				y[i] = z[i];
			}
		}
		for(i=1; i<n; ++i){
			u[i] = v[i];
		}
		for(i=1; i<n; ++i){
			v[i] = u[u[i]];
		}
		k /= 2;
	}
	for(i=1; i<n; ++i){
		x[i] = x[i-1] + y[i];
	}
	for(i=0; i<n; ++i){
		cout << x[i] << endl;
	}
	return 0;
}


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

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    long long ans = 0, tmp = 0;
    REP(i, N){
        if(A[i] > 0) tmp += A[i];
        if(A[i] == 0 or i == N-1){
            ans += tmp/2;
            tmp = 0;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
import itertools
from heapq import heappop, heappush
from collections import defaultdict
def main(t, num):
    num = list(str(num))
    d = defaultdict(int)
    if t < sum(map(int, num)):
        print("error")
        return
    q = [[0,[]]]
    itertools.product()
    fulls = itertools.product(range(2), repeat=len(num) - 1)
    for full in fulls:
        tmp = 0
        res = []
        b = 0
        f = False
        for i in range(len(num) - 1):
            if full[i]:
                res.append(i)
                tmp += int("".join(num[b: i + 1]))
                b = i + 1
        tmp += int("".join(num[b:]))
        a, b = heappop(q)
        a *= - 1
        if a == tmp: d[a] += 1
        if t >= tmp > a:
            a = tmp
            b = res
        heappush(q, [-a, b])
    a, b = heappop(q)
    a *= - 1
    if d[a] or a == 0:
        print("rejected")
    else:
        ans = []
        be = 0
        for i in b:
            ans.append(int("".join(num[be: i + 1])))
            be = i + 1
        ans.append(int("".join(num[be:])))
        print(a,*ans)

if __name__ == "__main__":
    while 1:
        t, num = map(int, input().split())
        if t == num == 0:
            break
        main(t, num)



Measured memory_bytes: 6044
from collections import Counter, defaultdict
def calc_comb(n):
    return (n * (n-1)) // 2

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
# calc nC2
sum_val = 0
for key in cnt.keys():
    if 3 <= cnt[key]:
        sum_val += calc_comb(cnt[key])
    elif cnt[key] == 2:
        sum_val += 1

for i in range(N):
    cnt[A[i]] -= 1
    if 2 <= cnt[A[i]]:
        res = sum_val - calc_comb(cnt[A[i]] + 1) + calc_comb(cnt[A[i]])
        print(res)
    elif cnt[A[i]] == 1:
        res = sum_val - 1
        print(res)
    else:
        print(sum_val)
    cnt[A[i]] += 1

Measured memory_bytes: 96588
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define isin(i,a,b) ((a) <= (i) && (i) < (b))
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll  = long long;
using unit= unsigned;
using ull = unsigned long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vvi = vector<vi>;
using vp  = vector<P>;
void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b){ if (a<b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if (b<a){ a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
constexpr double eps = 1e-10;
constexpr int inf = INT_MAX / 2;
constexpr ll infl = 1LL << 60;

void _main() {
  int N;
  cin >> N;
  vp ba(N);
  rep(i, 0, N) cin >> ba[i].se >> ba[i].fi;
  sort(all(ba));

  ll sum = 0;
  rep(i, 0, N) {
    sum += ba[i].se;
    if (sum > ba[i].fi) {
      puts("No");
      return;
    }
  }
  puts("Yes");
}

Measured memory_bytes: 1792
n=input()
k=int(input())
lenn=len(n)
dp=[[[0]*2 for i in range(k+1)] for j in range(lenn)]
dp[0][1][1]+=int(n[0])-1
dp[0][0][1]+=1
dp[0][1][0]+=1
for i in range(1,lenn):
  keta=int(n[i])
  for j in range(k):
    dp[i][j+1][1]+=dp[i-1][j][1]*9
    dp[i][j][1]+=dp[i-1][j][1]
    if keta>0:
      dp[i][j+1][1]+=dp[i-1][j][0]*(keta-1)
      dp[i][j+1][0]+=dp[i-1][j][0]
      dp[i][j][1]+=dp[i-1][j][0]
    else:
      dp[i][j][0]+=dp[i-1][j][0]
  dp[i][k][1]+=dp[i-1][k][1]
  if keta>0:
    dp[i][k][1]+=dp[i-1][k][0]
  else:
    dp[i][k][0]+=dp[i-1][k][0]
print(dp[lenn-1][k][1]+dp[lenn-1][k][0])

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

int main()
{
	int n;
	bool flag = true;
	cin >> n;

	int i, j;
	for(i = 1; i < 10; i++) {
		for(j = 1; j < 10; j++) {
			
			if (n == i * j) {
				cout << "Yes";
				flag = false;
				break;
			}
			
			}
		if (flag == false) {
			break;
		}
	}

	if (flag) {
		cout << "No";
	}

	
	return 0;


}

Measured memory_bytes: 256
import java.util.Scanner;

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

        String[] sum = {"SUN","MON","TUE","WED","THU","FRI","SAT"};


        String n = cin.next();

        // System.out.println(n instanceof String);


        // System.out.println(sum[6] instanceof String);


        for(int i=0;i<7;i++){
            // System.out.println(sum[i]);

            if(sum[i].equals(n)){
                System.out.println(7-i);
            }
        }
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String t = sc.next();

    int slen = s.length();
    int tlen = t.length();
    int keyStart = -1;
    loop: for (int i = 0; i < slen - tlen + 1; i++) {
      for (int j = 0; j < tlen; j++) {
        if (!(t.substring(j, j + 1).equals(s.substring(i + j, i + j + 1))
            || s.substring(i + j, i + j + 1).equals("?"))) {
          continue loop;
        }
      }
      keyStart = i;
    }
    if (keyStart == -1) {
      System.out.println("UNRESTORABLE");
    } else {
      StringBuilder sb = new StringBuilder(s);
      sb.replace(keyStart, keyStart + tlen, t);

      for (int i = 0; i < slen; i++) {
        if (sb.substring(i, i + 1).equals("?")) {
          sb.replace(i, i + 1, "a");
        }
      }

      System.out.println(sb);
    }

    sc.close();
  }

}

Measured memory_bytes: 21972
// Problem : C - pushpush
// Contest : AtCoder Regular Contest 077
// URL : https://atcoder.jp/contests/arc077/tasks/arc077_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define size(x) (int)x.size()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n;
bool re = 1;
deque<int> a;

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		if (re) a.push_back(x);
		else a.push_front(x);
		re ^= 1;
	}
	if (!re) reverse(a.begin(), a.end());
	for (auto x : a) cout << x << ' ';
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
#include<vector>
#include<map>
#include<iterator>
#include<algorithm>
#include<set>
using namespace std;
typedef long long int lli;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    lli n, t, i, j, x, y, flag, cnt, z, a, b;
    cin >> t;
    if(t<1000) cout << 1000-t << endl;
    else if(t>1000 && t<2000) cout << 2000-t << endl;
    else if(t>2000 && t<3000) cout << 3000-t << endl;
    else if(t>3000 && t<4000) cout << 4000-t << endl;
    else if(t>4000 && t<5000) cout << 5000-t << endl;
    else if(t>5000 && t<6000) cout << 6000-t << endl;
    else if(t>5000 && t<6000) cout << 6000-t << endl;
    else if(t>6000 && t<7000) cout << 7000-t << endl;
    else if(t>7000 && t<8000) cout << 8000-t << endl;
    else if(t>8000 && t<9000) cout << 9000-t << endl;
    else if(t>9000 && t<10000) cout << 10000-t << endl;
    else if(t>10000 && t<11000) cout << 11000-t << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>

//fast(?) Input
#define buf_sz 1<<24
char buf[buf_sz];
unsigned int nextint(){
	static int idx = 0;
	if(idx == 0)read(0, buf, buf_sz);
	unsigned int res = 0;
	while(idx<buf_sz && buf[idx]<'0' || '9'<buf[idx])idx++;
	while(idx<buf_sz && '0'<=buf[idx] && buf[idx]<='9'){
		res *= 10;
		res += buf[idx++] - '0';
	}if(idx>=buf_sz)exit(1);
	return res;
}

long data[1<<19];
void fen_add(int p, long x, int N){
	p++;
	while(p<=N){
		data[p-1] += x;
		p += p & -p;
	}
}
long fen_sum(int r){
	long s = 0;
	while(r > 0){
		s += data[r-1];
		r -= r & -r;
	}
	return s;
}
inline long fen_range(int l, int r){
	return fen_sum(r) - fen_sum(l);
}

int main(){
	int N = nextint(), Q = nextint();
	for(int i=0; i<N; i++)fen_add(i, nextint(), N);
	while(Q--){
		int t = nextint(), x = nextint(), y = nextint();
		if(t)printf("%ld\n", fen_range(x, y));
		else fen_add(x, y, N);
	}
	return 0;
}

Measured memory_bytes: 21296
using System;
using System.Linq;

namespace ABC126
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            //int n = int.Parse(s2);

            string s2 = "";
            int n1 = 0;
            for (int i = 0; i < 2; i++)
            {
                s2 += s1[i];
            }
            n1 = int.Parse(s2);

            string s3 = "";
            int n2 = 0;
            for (int i = 2; i < 4; i++)
            {
                s3 += s1[i];
            }
            n2 = int.Parse(s3);

            int flagA = 0;
            int flagB = 0;
            if (1 <= n1 && n1 <= 12)
                flagA = 0;
            else
                flagA = 1;

            if (1 <= n2 && n2 <= 12)
                flagB = 0;
            else
                flagB = 1;


            if (flagA == 0 && flagB == 0)
                Console.WriteLine("AMBIGUOUS");
            else if (flagA == 0 && flagB == 1)
                Console.WriteLine("MMYY");
            else if (flagA == 1 && flagB == 0)
                Console.WriteLine("YYMM");
            else if (flagA == 1 && flagB == 1)
                Console.WriteLine("NA");
        }
    }
}


Measured memory_bytes: 11092
s1 = input()
s2 = input()

cA = ord('a')

s1 = [ord(e) - cA for e in s1]
l1 = len(s1)
s2 = [ord(e) - cA for e in s2]
l2 = len(s2)

ans = 0
for l in range(1, min(l1, l2)+1):
    s = set()
    use = [0]*26

    for i in range(l-1):
        use[s1[i]] += 1
    for i in range(l-1, l1):
        use[s1[i]] += 1
        s.add(tuple(use))
        use[s1[i-l+1]] -= 1

    cnt = [0]*26
    for i in range(l-1):
        cnt[s2[i]] += 1
    for i in range(l-1, l2):
        cnt[s2[i]] += 1
        if tuple(cnt) in s:
            ans = l
            break
        cnt[s2[i-l+1]] -= 1
print(ans)

Measured memory_bytes: 8716
a, b, c = map(int, input().split())


def bs(n):
    a, b = 1, 10 ** 11
    while b - a > 1:
        c = (a + b) // 2
        if c ** 2 > n:
            b = c
        else:
            a = c
    return b


if a + b + bs(4 * a * b) <= c:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
using namespace std;
const int nmax=100005;
int p[nmax],viz[nmax],cyc[nmax],newp[nmax];
long long x[nmax],dif[nmax];
long long k,nr;
int n,i,j,xx,m;
int main()
{
    //freopen("data.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x[i];
    }
    for(i=1;i<n;i++)
        dif[i]=(x[i+1]-x[i]),p[i]=i;
    cin>>m>>k;
    for(i=1;i<=m;i++)
    {
        cin>>xx;
        swap(p[xx-1],p[xx]);
    }
    for(i=1;i<n;i++)
        if(!viz[i])
    {
        nr=0;xx=i;
        while(!viz[xx])
        {
            viz[xx]=1;
            cyc[nr++]=xx;
            xx=p[xx];
        }
        long long md=(k)%nr;
        for(j=0;j<nr;j++)
            newp[cyc[j]]=(cyc[(j+md)%nr]);
    }
    for(i=1;i<=n;i++)
    {
        if(i>1)x[i]=x[i-1]+dif[newp[i-1]];
        cout<<x[i]<<'\n';
    }
    return 0;
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

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

  int n; cin >> n;
  string s; cin >> s;

  int w = 0;
  for (char c : s) {
    w += c == 'W';
  }

  int cnt = 0;

  for (int i = 0; i < (n - w); ++i) {
    if (s[i] == 'W') ++cnt;
  }

  // RR...RW...WW

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3776
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        long K = Long.parseLong(sc.next());
        String[] sp = S.split("");
        int[] s = new int[sp.length];
        for(int i=0; i<sp.length; i++) {
            s[i] = Integer.parseInt(sp[i]);
        }
        int ans = 1;
        for(int i=0; i<K; i++) {
            if(s[i] == 1) {
            }else {
                ans = s[i];
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#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 N, X;
    cin >> N >> X;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }

    ll ans = 0;
    for (ll i = 1; i < N; i++) {
        if (A[i - 1] + A[i] > X) {
            ll r = (A[i - 1] + A[i]) - X;
            if (A[i] >= r) {
                A[i] -= r;
                ans += r;
            }
            else {
                A[i] = 0;
                A[i - 1] = r - A[i];
                ans += r;
            }
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
string s;
int n,f[1000005][2];
int dig(int x,bool t){
    if(!t) return s[x]-'0';
    if(x!=n) return 9-(s[x]-'0');
    return 10-(s[x]-'0');
}
int dfs(int x,bool t){
    int &res=f[x][t];
    if(res!=-1) return res;
    if(x==n+1) return res=0;
    res=min(dfs(x+1,t)+dig(x,t),dfs(x+1,t^1)+dig(x,t)+1);
    return res;
}
int main()
{
    fastio;
    cin>>s;
    n=s.size();
    s="0"+s;
    rep(i,0,n+1) f[i][0]=f[i][1]=-1;
    cout<<dfs(0,0)<<endl;
    return 0;
}

Measured memory_bytes: 71624
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int s, v, t;
  cin >> s >> v >> t;
  if (v * t >= s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF=1e18+2;
const int MX=100004;
int N, M, k;
ll arr[MX];
ll dp[51][51][2501];
int A;
ll f(int i, int take, int sum)
{
    if(i == N)
    {
        if(!take) return 0;
        return A*take == sum;
    }
    ll &ret=dp[i][take][sum];
    if(ret != -1) return ret;
    ret=f(i+1, take, sum);
    ret+=f(i+1, take+1, sum+arr[i]);
    return ret;
}
int main()
{
   cin>>N>>A;
   for(int i=0;i<N;i++) cin>>arr[i];
   memset(dp, -1, sizeof dp);
   cout<<f(0, 0, 0)<<"\n";
    return 0 ;
}





Measured memory_bytes: 51456
n,*a=map(int,open(0).read().split())
a=sorted([(j,i) for i,j in enumerate(a)])[::-1]
dp=[[-1]*(n+1) for _ in range(n+1)]
dp[0][0]=0
for m,(a_k,k) in enumerate(a):
  for i in range(m+1):
    j=m-i
    dp[i+1][j]=max(dp[i+1][j],dp[i][j]+a_k*abs(k-i))
    dp[i][j+1]=max(dp[i][j+1],dp[i][j]+a_k*abs(k-((n-1)-j)))
ans=0
for i in range(n+1):
  ans=max(ans,dp[i][n-i])
print(ans)

Measured memory_bytes: 100440
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int MAXN = 100000 + 10;

int n;
int a[MAXN];
int cnt[MAXN];

void Work()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i ++)
	{
		scanf("%d", &a[i]);
		cnt[a[i]] ++;
		cnt[a[i] + 1] ++;
		cnt[a[i] + 2] ++;
	}
	int ans = 0;
	for (int i = 0; i < MAXN; i ++)
		ans = max(ans, cnt[i]);
	printf("%d\n", ans);
}

int main()
{
	Work();
	return 0;
}


Measured memory_bytes: 896
M=10**9+7
o=lambda:map(int,raw_input().split())
n,k=o()
a=o()
dp=[[0]*256 for _ in [0]*(n+1)]
dp[0][0]=1
for i in range(n):
    _dp=dp
    for l in reversed(range(1,i+2)):
        for j in range(256):_dp[l][j]+=dp[l-1][a[i]^j]
    dp=_dp
p=[1]*(n+1)
for i in range(n):p[i+1]=p[i]*(i+1)%M
print sum([dp[l][k]*p[l] for l in range(1,n+1)])%M

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

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
 
int main(){
  ll N;
  cin >> N;
  ll ans = N-1;
  for(ll p = 2; p * p <= N; ++p){
    if(N % p != 0) continue;
    ll q = N / p;
    ll tmp = p + q - 2;
    ans = min(tmp, ans);
  }
  cout << ans << endl;
}


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

int main() {
    int N; cin >> N;
    int p[20];
    for (int i = 0; i < N; i++) cin >> p[i];

    int cnt = 0;
    for (int i = 1; i < N-1; i++) {
        int pmax = max({p[i-1], p[i], p[i+1]});
        int pmin = min({p[i-1], p[i], p[i+1]});
        if (pmax != p[i] && pmin != p[i]) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;

	cout << a * b << endl;
	return 0;
}

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

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

int main(void) {
	int n; cin >> n;
	vector<int> P(n), Q(n);
	rep(i, n) cin >> P[i];
	rep(i, n) cin >> Q[i];

	int a = 0, b = 0;
	for (int i = 0; i < n-1; i++) {
		if (P[i] != 1) {
			a += (P[i] - 1) * fac(n - i - 1);
		}
		if (Q[i] != 1) {
			b += (Q[i] - 1) * fac(n - i - 1);
		}
		for (int j = i + 1; j < n; j++) {
			if (P[i] < P[j]) {
				P[j]--;
			}
			if (Q[i] < Q[j]) {
				Q[j]--;
			}
		}
	}

	cout << abs(a - b) << endl;
}

Measured memory_bytes: 256
a=input().split()
b=[]
for i in range(len(a)):

	if a[i]=="+":

		b[len(b)-2]=b[len(b)-2]+b[len(b)-1];
		del b[len(b)-1]

	elif a[i]=="-":

		b[len(b)-2]=b[len(b)-2]-b[len(b)-1];
		del b[len(b)-1]

	elif a[i]=="*":

		b[len(b)-2]=b[len(b)-2]*b[len(b)-1];
		del b[len(b)-1]

	else:
		b.append(int(a[i]))

		
print(b[len(b)-1])


Measured memory_bytes: 5604
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<cmath>
#include<utility>
#include<cstdlib>
#include<bitset>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;                       

#define ll long long
#define pb push_back
#define mp make_pair

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const ll M = 1e9 + 7;

ll fastpo(ll a, ll x){
    if(x == 0) return 1ll;
    if(x == 1) return a;
    ll y = fastpo(a, x/2);
    if(x%2 == 0){
        return y*y;
    }
    return y*y*a;
}

ll inv(ll a, ll M){
    return fastpo(a, M-2);
}

ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return -1; 
    else
    { 
        ll res = (x%m + m) % m; 
        return res;
    } 
}


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

ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

int main(){
//    clock_t time_req;
//     time_req = clock();
    int n, k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for(int i=0; i<k; i++){
        ans += a[i];
    }
    cout<<ans<<endl;
    // time_req = clock()-time_req;
    // cout<<"Time taken: "<<(float)time_req/CLOCKS_PER_SEC<<"s"<<endl;
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    
    for(int i = 0; i < s.size(); ++i)
    {
        if(i % 2 == 0)
        {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 100000+2
int n,m;
int rank[MAXN],par[MAXN];
void input(){
	cin>>n>>m;
	for(int i=0;i<n;++i){
		rank[i]=0;
	}
	for(int j=0;j<n;++j){
		par[j]=j;
	}
}
int find(int x){
	if(x==par[x]) return x;
	else return par[x]=find(par[x]);
}
void tg(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y) return;
	else{
		if(rank[x]>rank[y]){
			par[y]=x;
		}
		else{
			par[x]=y;
			if(rank[x]==rank[y]) rank[y]++;
		}
	}
}
int main(){
	input();
	int xx,yy,zz;
	for(int i=0;i<m;++i){
	    cin>>xx>>yy>>zz;
	    if(xx==0) tg(yy,zz);
	    else{
	    	int l=find(yy),g=find(zz);
	    	if(l!=g) cout<<"0"<<endl;
	    	else cout<<"1"<<endl;
	    }
	}
	return 0;
}

Measured memory_bytes: 3164
N, K = gets.chomp.split(' ').map(&:to_i)

splits = Rational("1/#{N}")

puts 1.upto(N).map { |n|
  next splits if n >= K
  times = 0
  num = n
  while true
    num *= 2
    times += 1
    break times if num >= K
  end
  splits * (1/2r ** times)
}.reduce(:+).to_f

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder builder  =new StringBuilder();

		String[] str = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);
		int l = Integer.parseInt(str[2]);
		long[][] nm = new long[n][m];
		long[][] calc = new long[n][l];

		for (int i = 0; i < n; i++) {
			str = br.readLine().split(" ");
			for (int j = 0; j < m; j++) {
				nm[i][j] = Integer.parseInt(str[j]);
			}
		}
		for (int i = 0; i < m; i++) {
			str = br.readLine().split(" ");
			for (int j = 0; j < l; j++) {
				int ml = Integer.parseInt(str[j]);
				for (int k = 0; k < n; k++) {
					calc[k][j] += nm[k][i] * ml;
				}
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				if (j != 0)
					builder.append(" ");
				builder.append(calc[i][j]);
			}
			builder.append("\n");
		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 33096
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

int main()
{
    using namespace std;

    int a, b, x;
    cin >> a >> b >> x;

    if (x >= a && x <= a + b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}

const int M=200005;
int n;
ll two[M];
map<pll,ll> mp;

void f(ll &x,ll &y){
	if(y<0||x<0&&y==0) x*=-1,y*=-1;
}

int main(){
	cin>>n;
	two[0]=1;
	for(int i=1;i<M;i++) two[i]=two[i-1]*2%mod;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		if(x==0&&y==0){
			mp[{0,0}]++;
			continue;
		}
		else if(x==0) y=1;
		else if(y==0) x=1;
		else{
			ll g=gcd(abs(x),abs(y));
			x/=g,y/=g;
		}
		f(x,y);
		mp[{x,y}]++;
	}
	ll res=1,tmp=mp[{0,0}];
	mp.erase({0,0});
	set<pll> st;
	//cout<<tmp<<endl;
	for(auto p:mp){
		ll x=p.first.first,y=p.first.second,t=p.second;
		ll X=-y,Y=x;
		f(X,Y);
//		cout<<x<<' '<<y<<' '<<X<<' '<<Y<<' '<<t<<' '<<two[t]<<endl;
		st.insert({x,y});
		if(st.find({X,Y})!=st.end()) continue;
		if(mp.find({X,Y})==mp.end()) (res*=two[t])%=mod;
		else (res*=two[t]+two[mp[{X,Y}]]-1)%=mod;
	}
//	cout<<res<<endl;
	(res+=tmp)%=mod;
	cout<<(res+mod-1)%mod<<endl;
}

Measured memory_bytes: 30048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll A;
  int B, b;
  scanf("%lld %d.%d", &A, &B, &b);
  cout << A*(B*100+b)/100 << endl;
  return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<vector<int>> action = vector<vector<int>>(n, vector<int>(3));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> action[i][j];
        }
    }
    
    vector<vector<int>> dp = vector<vector<int>>(n, vector<int>(3, 0));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 3; j++) {
            if(i > 0) {
                switch(j) {
                    case 0:
                        dp[i][j] = action[i][j] + max(dp[i - 1][1], dp[i - 1][2]);
                        break;
                    case 1:
                        dp[i][j] = action[i][j] + max(dp[i - 1][0], dp[i - 1][2]);
                        break;
                    case 2:
                        dp[i][j] = action[i][j] + max(dp[i - 1][1], dp[i - 1][0]);
                        break;
                }
            }
            else {
                dp[i][j] = action[i][j];
            }
        }
    }
    
    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
    
    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4;

pair<double, double> circumscribed_circle_center( double ax, double ay, double bx, double by, double cx, double cy ) {
	double a1 = 2 * ( bx - ax );
	double b1 = 2 * ( by - ay );
	double c1 = sq( ax ) - sq( bx ) + sq( ay ) - sq( by );
	double a2 = 2 * ( cx - ax );
	double b2 = 2 * ( cy - ay );
	double c2 = sq( ax ) - sq( cx ) + sq( ay ) - sq( cy );
	double x = ( b1 * c2 - b2 * c1 ) / ( a1 * b2 - a2 * b1 );
	double y = ( c1 * a2 - c2 * a1 ) / ( a1 * b2 - a2 * b1 );
	return make_pair( x, y );
}

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%lf %lf %lf %lf %lf %lf", &x_1, &y_1, &x_2, &y_2, &x_3, &y_3 );
		pair<double, double> _point = circumscribed_circle_center( x_1, y_1, x_2, y_2, x_3, y_3 );
		double r = sqrt( sq( _point.first - x_1 ) + sq( _point.second - y_1 ) );
		printf( "%.3f %.3f %.3f\n", _point.first, _point.second, r );
	}
	return 0;
}

Measured memory_bytes: 1248
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
	    Scanner cin = new Scanner(System.in);
	    int a, b, c;
	    a = cin.nextInt();
	    b = cin.nextInt();
	    c = cin.nextInt();
	    
	    int res = serch_divisor_number(a, b, c);
	
	    System.out.println(res);
	  }
	
	public static int serch_divisor_number(int a, int b, int c){
		int count = 0;
		for (int i = a; i <= b; i++){
			if (c % i == 0){
				count++;
			}
		}
		return (count);
	}
}

Measured memory_bytes: 26300
#include <cstdio>
#include <cstring>
using namespace std;
int main(void){
    // Your code here!
    char str[1001];
    
    while(1){
        scanf("%s",str);
        if(str[0]=='0') break;
        int sum=0;
        for(int i=0; i<strlen(str); i++){
            sum+=(str[i]-'0');
        }
        
        printf("%d\n",sum);
    }
    return 0;
}



Measured memory_bytes: 2716
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

set_s = list(set(s))
print( max(0,max(s.count(set_s[i])-t.count(set_s[i]) for i in range(len(set_s)))) )

Measured memory_bytes: 3060
s = gets.chomp
n = s.length

dp = Array.new(n) { Array.new(2 + 1, 0) }
dp[0][1] = dp[1][2] = 1

1.upto(n - 1) do |i|
  if s[i - 1] != s[i]
    # 1 -> 1
    dp[i][1] = [dp[i - 1][1], dp[i - 1][2]].max + 1
  else
    # 1 -> 2
    dp[i][1] = dp[i - 1][2] + 1
  end

  if i >= 3 && s[i - 3..i - 2] != s[i - 1..i]
    # 2 -> 2
    dp[i][2] = [dp[i - 2][1], dp[i - 2][2]].max + 1
  else
    # 2 -> 1
    dp[i][2] = dp[i - 2][1] + 1
  end
end

puts [dp[n - 1][1], dp[n - 2][2]].max


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

typedef long long ll;
const int N = 1033;
int n;
ll x[N], y[N];
void solve(ll &x, ll &y, ll d) {
  ll man = 1ll << 55;
  int t = 0;
  if (abs(x - d) + abs(y) < man) man = abs(x - d) + abs(y), t = 1;
  if (abs(x + d) + abs(y) < man) man = abs(x + d) + abs(y), t = 2;
  if (abs(x) + abs(y - d) < man) man = abs(x) + abs(y - d), t = 3;
  if (abs(x) + abs(y + d) < man) man = abs(x) + abs(y + d), t = 4;
  if (t == 1) putchar('R'), x -= d;
  if (t == 2) putchar('L'), x += d;
  if (t == 3) putchar('U'), y -= d;
  if (t == 4) putchar('D'), y += d;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    if (abs(x[1] + y[1] + x[i] + y[i]) & 1) return puts("-1"), 0;
  }
  int d = !(abs(x[1] + y[1]) & 1);
  printf("%d\n", 31 + d);
  for (int i = 30; ~i; i--) {
    printf("%lld ", 1ll << i);
  }
  if (d) printf("1 ");
  puts("");
  for (int i = 1; i <= n; i++) {
    for (int j = 30; ~j; j--) {
      solve(x[i], y[i], 1ll << j);
    }
    if (d) solve(x[i], y[i], 1);
    puts("");
  }
}


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

int main() {
  int N, D;
  cin >> N >> D;
  D = 2*D + 1;
  if(N%D == 0){
    cout << N / D << endl;
  }
  else{
    int ans;
    ans = N / D + 1;
    cout << ans << endl;
  }
}


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


using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e3 + 5;
bool isPrime[MAXN];
void sevie() {
    memset(isPrime, 1, sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for (ll i = 2; i * i <= MAXN; i++) {
        if (isPrime[i]) {
            for (ll j = i * 2; j <= MAXN; j += i) {
                isPrime[j] = 0;

            }
        }
    }
}
ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}
//__builtin_popcount ();
bool isPrim(int n) {
    if (n == 1 || n == 0)
        return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0)
            return false;
    }
    return true;
}


int arr[101][101];
int main() {
    FAST
int n;
    cin>>n;
    if(n<10)
    return cout<<n,0;
    for(int i=1;i<=n;i++)
    {
        int l=i/fastPow(10,(int)log10(i));
        int r=i%10;
        arr[l][r]++;
    }
    ll ans=0;
    for(int i=0;i<=9;i++)
    {
        for(int j=0;j<=9;j++)
        {
            ans+=(arr[i][j]*arr[j][i]);
        }
    }
    cout<<ans<<endl;
return 0;
}


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

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

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

inline void ain(vector<int>& a,int n){
   for(int i = 0;i < n;i++)scanf("%d",&a[i]);
}
inline void ainl(vector<ll>&a,int n){
   for(int i = 0;i < n;i++)scanf("%lld",&a[i]);
}
template<class T>inline void aout(vector<T> a){
   int sz = a.size();
   cout << "[ ";
   for(int i = 0;i < sz;i++){
      if(i != sz-1)cout << a[i] << ", ";
      else cout << a[i];
   }
   cout << " ]" << endl;
}

int main(){
    int n;cin >> n;
    for(int i = 1;i <= 9;i++){
        if(n % i == 0 and n/i >= 1 and n / i <= 9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256