akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

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

	ll n, a, b; cin >> n >> a >> b;
	
	if (a == b) {
		cout << 1 << endl;
	} else {
		if (n == 1 || a > b) {
			cout << 0 << endl;
			return 0;
		}
		ll smin = (n-1)*a + b, smax = (n-1)*b + a;
		cout << smax-smin+1 << endl;
	}
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_120
{
    class B
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int a = n[0], b = n[1], K = n[2];

            int counter = 0;
            int index = 100;
            while (counter < K)
            {
                if (a % index == 0 && b % index == 0) counter++;
                index--;
            }

            Console.WriteLine(index + 1);
        }


    }
}


Measured memory_bytes: 13268
#include <stdio.h>
int GCD(int,int);
int main()
{
  int com=0; /*comは最大公約数*/
  int a,b;

  scanf("%d%d",&a,&b);

  com = GCD(a,b);

  printf("%d\n",com);
  return 0;
}

int GCD(int a,int b) /*ユークリットの互除法*/
{
  if(b==0) return a;
  return GCD(b,a%b);
}

Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define mod 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

using namespace std;

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

int main() {
	long long N,K;
	cin>>N>>K;
	long long A[2001];
	rep(i,0,N)cin>>A[i];

	long long before=0,after=0;
	rep(i,0,N)rep(j,0,N){
		if(A[i]>A[j]){
			if(i<j)before++;
			else after++;
		}
	}

	long long ans=0;
	long long c1=((K*(K+1)/2)%mod);
	long long c2=((K*(K-1)/2)%mod);

	ans+=((before*c1)%mod);
	ans+=((after*c2)%mod);
	ans%=mod;

	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 0
//#define int ll
using namespace std;

typedef vector<int> vi;
typedef unsigned long long ull;

signed main(){
    string T,P;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> T >> P;
    ull nhash=0;
    ull _b=1000000007;
    for(int i=0;i<(int)P.size();i++){
        nhash=(nhash+P[i])*_b;
    }
    vector<ull> hash,pow;
    int sz = T.length();
    hash.assign(sz+1,0);
    pow.assign(sz+1,0);
    pow[0]=1;
    for(int i=0;i<sz;i++){
        pow[i+1]=pow[i]*_b;
    }
    for(int i=0;i<sz;i++){
        hash[i+1]=(hash[i]+T[i])*_b;
    }
    rep(i,(int)T.size()-(int)P.size()+1) {
        if((hash[i+(int)P.size()]-hash[i]*pow[(int)P.size()]) == nhash) {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 19780
def main():

    a,b,m = map(int, input().split())

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

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

    min_pair = a_list[a_list.index(min(a_list))] + b_list[b_list.index(min(b_list))]

    m_list = []
    for i in range(m):
        x,y,c = map(int, input().split())
        if a_list[x-1]+b_list[y-1]-c <= min_pair:
            min_pair = a_list[x-1]+b_list[y-1]-c

    print(min_pair)


if __name__ == '__main__':
    main()



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

int main() {
	string s1,s2;
	cin >> s1 >> s2;

	int d[s1.length()+1][s2.length()+1];
	for(int i=0; i<s1.length()+1; i++){
		d[i][0]=i;
	}
	for(int i=0; i<s2.length()+1; i++){
		d[0][i]=i;
	}
	
	for(int i=1; i<s1.length()+1; i++){
		for(int j=1; j<s2.length()+1; j++){
			int cost=1;
			if(s1[i-1]==s2[j-1]){cost=0;}
			
			d[i][j]=min(d[i-1][j]+1, min(d[i][j-1]+1, d[i-1][j-1]+cost));
		}
	}
	
	cout << d[s1.length()][s2.length()] << endl;
	return 0;
}

Measured memory_bytes: 7064
n,m,l=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
b=[list(map(int,input().split())) for _ in range(m)]
[print(*x) for x in [[sum(j*k for j,k in zip(x,y)) for y in zip(*b)] for x in a]]

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


int main(void)
{
  int n,w[100],i,j,k,a,b,ans,s1,s2;
  cin>>n;
  s1=0;s2=0;
  for(i=0;i<n;i++)
  {
    cin>>w[i];
  }
  i=0;
  j=n-1;
  while(1)
  { 

    if(s1<=s2){s1+=w[i];i++;}
    else{s2+=w[j];j--;}
    
    if(i==j)
    { 
      if(s1<=s2){s1+=w[i];i++;}
      else{s2+=w[j];j--;}
      break;
    }

  }
  cout<<abs(s1-s2)<<endl;
  
}

Measured memory_bytes: 3552
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	bool flag[4] = { false ,false, false, false };

	for (size_t i = 0; i < 4; i++) {
		size_t N;
		scanf("%zu", &N);
		if (i < 3) {
			scanf(" ");
		}

		if (N == 1) {
			flag[0] = true;
		}
		else if (N == 9) {
			flag[1] = true;
		}
		else if (N == 7) {
			flag[2] = true;
		}
		else if (N == 4) {
			flag[3] = true;
		}
	}

	puts((flag[0] && flag[1] && flag[2] && flag[3] ? "YES" : "NO"));

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int w, h; char c; cin >> w >> h >> c;
	std::vector<std::string> s(h, std::string(w, '.'));
	s[h / 2][w / 2] = c;
	s[0] = s[h - 1] = std::string(w, '-');
	for(int i = 0; i < h; i++) s[i][0] = s[i][w - 1] = '|';
	s[0][0] = s[h - 1][0] = s[0][w - 1] = s[h - 1][w - 1] = '+';
	
	for(auto v : s) cout << v << endl;
	return 0;
}



Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in=new Scanner(System.in);
		String k=in.next();
		int z=0;
		int flag=0;
		char[] a=new char[k.length()];
		char[] b=new char[k.length()];
		for(int i=0;i<k.length();i++)
		{
			a=k.toCharArray();
		}
		for(int i=0;i<k.length();i++)
		{
			if(a[i]=='C'||a[i]=='F')
			{
				b[z]=a[i];
				z++;
			}
		}
		for(int i=0;i<z;i++)
		{
			for(int j=i+1;j<=z-1;j++)
			{
				if(b[i]=='C'&&b[j]=='F')
					flag=1;
			}
		}
		if(flag==1)
			System.out.println("Yes");
		else
			System.out.println("No");

		
		in.close();
	}

}


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

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

		long A = in.nextLong();
		long B = in.nextLong();

		if (A == B) {
			System.out.println(A);
			return;
		}

		long ans;
		if (A % 2 == 0) {
			ans = 1;
			A += 2;
		} else {
			ans = A++;
		}
		if (B % 2 == 0) {
			ans ^= B--;
		}

		for (long n = 0; n < ((A + B) % 4); n += 2) {
			ans ^= 1;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
virgin = true

readlines.each do |input|
  puts "" unless virgin
  n = input.chomp.chars.map(&:to_i)
  digit_n = n.size
  zero = "* = ****"
  result = Array.new(5)
  result.map!{zero.dup}
  ri = 5 - digit_n

  0.upto(digit_n-1) do |i|
    result[ri][3] = '*' if !(n[i] % 5).zero?
    if 5 <= n[i]
      result[ri][0] = ' '
      result[ri][1] = '*'
    end
    result[ri][n[i]%5+3] = ' '
    ri += 1
    break if 4 < ri
  end

  0.upto(7) do |i|
    0.upto(4) do |j|
      print result[j][i]
      puts "" if j == 4
    end
  end

  virgin = false if virgin
end

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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N);
    for (int i=0;i<N;i++) {
        cin >> A[i];
        A[i]--;
    }
    for (int i=0;i<N;i++) cin >> B[i];
    for (int i=0;i<N-1;i++) cin >> C[i];
    int prev = A[0];
    int sat = B[A[0]];
    for (int i=1;i<N;i++){
        sat += B[A[i]];
        if (A[i] == prev + 1) sat += C[A[i-1]];
        prev = A[i];
    }
    cout << sat << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    bool ok = false;
    rep(i,N+1){
        int t = i * 108;
        if(t/100 == N){
            ok = true;
            cout << i << endl;
            break;
        }
    }
    if(!ok)cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}


using namespace std;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

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

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;
    vector<ld> v(n);
    rep(i, n){
        cin >> v[i];
    }
    sort(ALL(v));
    
    while(v.size() != 1){
        ld one = v[0];
        ld two = v[1];
        v.erase(v.begin());
        v.erase(v.begin());
        
        v.push_back((one+two)/2);
        sort(ALL(v));
    }
    
    cout << v[0] << endl;
    return 0;
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    string s;
    cin >> s;

    int min = INF;
    for (int i = 0; i < s.length() - 2; i++)
    {
        int z = (int)'0';
        int tmp = (int)(s[i] - z) * 100 + (int)(s[i + 1] - z) * 10 + (int)(s[i + 2] - z) - 753;

        if (tmp < 0)
            tmp *= -1;
        if (tmp < min)
        {
            min = tmp;
        }
    }
    cout << min << endl;
}


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

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

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

	if (a > b) {
		swap(a, b);
	}

	long long int ans;
	ans = a * b / gcd(a, b);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char ch[1000],p,ph[1000],temp=0;
    int i,l,j;
    gets(ch);
    gets(ph);
    l=strlen(ch);
    for(j=1;j<=l;j++)
    {
        
    
    p=ch[l-1];
   
    for(i=l-1;i>0;i--)
    {
        ch[i]=ch[i-1];
       
        
       } 
    ch[0]=p;
        
        if(strcmp(ch,ph)==0)
        {
            temp=1;
            printf("Yes\n");
            return 0;
            
        }
    
    
   
    }
    if(temp!=1)
    {
        printf("No\n");
    }
}

Measured memory_bytes: 128
import sys
m, k = map(int, input().split())

if (m == 1 and k == 1) or (2 ** m <= k):
    print(-1)
    sys.exit()

if m == 1 and k == 0:
    print('1 1 0 0')
    sys.exit()

if m == 0 and k == 0:
    print('0 0')
    sys.exit()

f = 1
p = 0
p2 = []

for i in range(2 ** m):
    if i == k:
        continue
    else:
        if f:
            p = i
            f = 0
        else:
            p2.append(i)

ans = [p, k, p] + p2 + [k] + list(reversed(p2))
print(' '.join(list(map(str, ans))))



Measured memory_bytes: 91928
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;


int main(void){
	int n;
	cin >> n;
	string s;
	cin >> s;
	if(s[0] == 'W'){
		cout << 0 << endl;
		return 0;
	}
	int cnt=1;
	ll ans=1;
	for(int i=1;i<2*n;i++){
		if(cnt%2 == 1){
			if(s[i] == 'W'){
				cnt++;
			}
			else{
				ans*=cnt;
				cnt--;
			}
		}
		else{
			if(s[i] == 'W'){
				ans*=cnt;
				cnt--;
			}
			else{
				cnt++;
			}
		}
		ans %= MAX;
	}

	for(int i=n;i>1;i--){
		ans *= i;
		ans %= MAX;
	}

	if(cnt == 0)cout << ans << endl;
	else cout << 0 << endl;

	return 0;

}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N;
    cin >> N;
    string s;
    cin >> s;
    ll R,B;
    R = 0; B = 0;
    for (int i = 0; i < N; ++i) {
        if(s[i] == 'R'){
            R++;
        }else{
            B++;
        }
    }
    OutputAnswerBool(R > B );
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
vector< ll > z_algorithm(string s) {
  vector< ll > prefix(s.size());
  for(ll i = 1, j = 0; i < s.size(); i++) {
    if(i + prefix[i - j] < j + prefix[j]) {
      prefix[i] = prefix[i - j];
    } else {
      ll k = max(0ll, j + prefix[j] - i);
      while(i + k < s.size() && s[k] == s[i + k]) ++k;
      prefix[i] = k;
      j = i;
    }
  }
  prefix[0] = (ll) s.size();
  return prefix;
}
int main(){
    ll n; cin>>n;
    string s; cin>>s;
    ll res=0;
    rep(i,n-1){
        vector<ll> tmp=z_algorithm(s);
        ll m=tmp.size();
        for(ll j=1; j<m; j++){
            if(tmp[j]>j) chmax(res, j);
            else chmax(res, tmp[j]);
        }
        ll x=s.size();
        s=s.substr(1, x-1);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main(){

  int n,count=0,sum=0;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==1){
      count+=1;
      if(sum<count) sum=count;
    }
    else count=0;
  }
  cout<<sum+1<<endl;
  return 0;
}
   
 
      
 
  
   
  
	
	  
	  
	  
	  
	  
	  
     
  
  
  
  
  

  

 
  


 

    
  



Measured memory_bytes: 3092
#!/usr/bin/ruby
# encoding: utf-8

# ABC 109 C Skip

def calcGcd n,m
  n,m = m,n if m > n
  r = -1 
  while r.nonzero? do
    r = n % m
    return m if r.zero?
    n,m = m,r
  end
end

N,X = gets.split.map(&:to_i)
coord = gets.split.map(&:to_i)

diffs = Array.new

coord.each do |n|
  diffs.push (n-X).abs
end

# Dはdiffsたちの最大公約数
ans = diffs[0]
(0..diffs.size-1).each do |n|
  ans = calcGcd ans,diffs[n]
end

p ans


Measured memory_bytes: 9348
import java.math.BigInteger;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String n=sc.next();
		String[] s= {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
		for(int i=0;i<s.length;i++) {
			if(n.equals(s[i])) {
				System.out.println(s[i+1]);
			}
		}
		
		sc.close();
	}
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = 0;
		for(char c : String.valueOf(n).toCharArray()){
			sum += Character.getNumericValue(c);
		}
		System.out.println(n % sum == 0 ? "Yes" : "No");
	}
}


Measured memory_bytes: 21204
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
int N;
cin>>N;
int ans;
ld min_=1e14;
ld T,A;
cin>>T>>A;
rep(i,N){
  ld H;
  cin>>H;
  if(abs(T-0.006*H-A)<min_){
    min_=abs(T-0.006*H-A);
        ans=i+1;
  }
}
cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main () {
    int a,b,c,d,cnt=0;
    cin >> a >> b >> c >> d;
    int array[101]={0};
    for(int i=a;i<b;i++) array[i]++;
    for(int i=c;i<d;i++) array[i]++;
    for(int i=0;i<100;i++) 
        if (array[i]==2) cnt++;
    cout << cnt;
    // cout << b-c;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;

inline ll read()
{
    long long f=1,sum=0;
    char c=getchar();
    while (c<'0' || c>'9')
    {
        if (c=='-')	f=-1;
        c=getchar();
    }
    while (c>='0' && c<='9')
    {
        sum=sum*10+c-'0';
        c=getchar();
    }
    return sum*f;
}
const int MAXN=45;
const int N=1<<17;
const int Mod=1e9+7;
ll f[MAXN][N]; 
int main()
{
	int n,x,y,z;
	scanf("%d%d%d%d",&n,&x,&y,&z);
	ll ans=1;
	for (int i=1;i<=n;i++)
		ans*=10,ans%=Mod;
	f[0][0]=1;
	ll S=(1<<(z-1))|(1<<(z+y-1))|(1<<(x+y+z-1));
	for (int i=1;i<=n;i++)
	{
		for (int s=0;s<(1<<(x+y+z));s++)
		{
			if (!f[i-1][s]) continue;
			for (int k=1;k<=10;k++)
			{
				int now=(s<<k)|(1<<(k-1));
				now&=((1<<(x+y+z))-1);
				if ((now&S)!=S) f[i][now]=(f[i][now]+f[i-1][s])%Mod;		
			}
		}
	}
	for (int i=0;i<(1<<(x+y+z));i++)
		ans-=f[n][i],ans+=Mod,ans%=Mod;
	cout<<ans;
    return 0;
}


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

int N;
int a[110];

int main()
{       
        cin >> N;
        for(int i=0;i<N;i++)
                cin >> a[i];
        int Alice = 0;
        int Bob = 0;
        for(int i=0;i<N;++i){
                int max = 0;
                for(int j=0;j<N-i;++j){
                        if(a[max]<a[j]){
                                max = j;
                        }       
                }       
                if(i%2==0){
                        Alice += a[max];
                }else{
                        Bob += a[max];
                }
                a[max] = a[N-i-1];
        }       
        cout << (Alice - Bob) << endl;
}       

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	vector<int> a(3);
	const int MOD = 1e9 + 7;
	ll ans = 1;
	for (int i = 0; i < n; ++i) {
		int x;
		scanf("%d", &x);
		int las, cnt = 0;
		for (int j = 0; j < 3; ++j) {
			if (a[j] == x) {
				++cnt;
				las = j;
			}
		}
		if (cnt == 0) {
			printf("0\n");
			return 0;
		}
		ans = ans * cnt % MOD;
		++a[las];
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define REP(i,a) for(int i=0;i<(a);i++)
#define REPR(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
// using ll = long long;
// using vi = vector<int>;
// using vvi = vector<vi>;
// using vl = vector<long long>;
// using vvl = vector<vl>;
// using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int main () {
  int N = si();
  ll mini=1e9+7,result = 0;
  int num=0;
  std::vector<ll> a(N);
  for (size_t i = 0; i < N; i++) {
    cin >> a[i];
    if(a[i] < 0) num++;
    mini = min(mini,abs(a[i]));
    result += abs(a[i]);
  }
  if(num%2) {
    result -= 2* mini;
  }
  cout << result << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

int main() {
	int N, x = 0, x1= 0;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'I') {
			x1++;
		}
		else {
			x1--;
		}
		x = max(x, x1);
	}
	cout << x << endl;
	return 0;
}

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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> xs(m);
    rep(i, m) cin >> xs[i];
    if (n >= m) {
        cout << "0" << nl;
        return 0;
    }
    sort(be(xs));
    vector<int> ys(m-1);
    rep(i, m-1) {
        ys[i] = abs(xs[i+1] - xs[i]);
    }
    sort(be(ys));
    cout << accumulate(begin(ys), end(ys)-n+1, 0) << nl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<cmath>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
  int N;
  cin >> N;
    
  int b[101];
  rep(i,N - 1) cin >> b[i];
  
  int a[101];
  a[0] = b[0];
  a[1] = b[0];
  for(int i = 2;i < N;i++){
    if(a[i - 1] > b[i - 1]){
      a[i - 1] = b[i - 1];
      a[i] = b[i - 1];
    }
    else{
      a[i] = b[i - 1];
    }
  }
  
  long long ans = 0;
  rep(i,N){
    ans += a[i];
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin>>K>>A>>B;
  if(B/K-(A-1)/K!=0&&K!=1){
    cout<<"OK"<<endl;
  }
  else if(K==1){
    cout<<"OK"<<endl;
  }
  else{
    cout<<"NG"<<endl;
  }
}

Measured memory_bytes: 3636
import itertools

total, select = map(int, input().split(' '))

trees = []

for _ in range(total):
  trees.append(int(input()))

"""
result = 10000000000
for t in list(itertools.combinations(trees, select)):
  result = min(result, max(t)-min(t))
"""

trees.sort()

result = 10000000000
for i in range(total-select+1):  
  result = min(result, trees[i+select-1] - trees[i])

print(result)



Measured memory_bytes: 7540
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(lambda x: int(x) - 1, input().split())
    g[a].append(b)
    g[b].append(a)
p = sorted([x, i] for i, x in enumerate(h))[::-1]
ans = 0
for i in range(n):
    s = p[i][1]
    m = 0
    for t in g[s]:
        m = max(m, h[t])
    if h[s] > m:
        ans += 1
print(ans)


Measured memory_bytes: 42168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  vector<int> vec(3);
  for(int i = 0;i < 3; i++){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());
  
  if(vec[0] == 5 && vec[1] == 5 && vec[2] == 7){
    cout << "YES" <<endl;
  }
  
  else {
    cout << "NO" << endl;
  }
  
  return 0;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int ll
//{ PXH612
using namespace std;
#define ll long long
#define db double
#define pp pair<int,int>
#define x first
#define y second

#define false(x) if(!(x))
template<typename A,typename B>bool Min(A &a,B b){if(a<=b) return 0;a=b;return 1;}
template<typename A,typename B>bool Max(A &a,B b){if(a>=b) return 0;a=b;return 1;}
#define in ({ll x=0;int o=0,c=char(),t=0;for(;!isdigit(c)&&t<1000;c=getchar(),t++) o=c=='-';for(;isdigit(c);c=getchar()) x=x*10+c-'0';o?-x:x;})
#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})

#define FOR(i,a,b) for(int i=a,ENDFOR=b;i<=ENDFOR;i++)
#define ROF(i,a,b) for(int i=b,ENDFOR=a;ENDFOR<=i;i--)
#define RR(x,a,b) {cout<<#x<<": ";FOR(_,a,b) cout<<x[_]<<" ";cout<<"\n";}
#define rr(x) " "<<#x<<'='<<(x)<<" "

#define VEC(i,a) for(auto&i:a)
#define pb push_back
#define vn(a) (int)a.size()-1

#define bit(x,i) ((x>>(i-1))&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define mu(x) (1ll<<x)
#define bitnum(x) __builtin_popcountll(x)

#define segg(a,b) (abs(a-b)+1)
#define midd(a,b) (a+(b-(a))/2)
#define mems(x,a) memset(x,a,sizeof x)
#define open(a) freopen(a,"r",stdin)
#define shut(b) freopen(b,"w",stdout)
//}/////////////////////////////////////////////////////}

const int N=1e5+5;
int n;
string s,t;
int a[2][N],b[2][N];

void INPUT(string &s,int o)
{
    FOR(i,1,vn(s))
    {
        if(s[i]=='A') a[o][i]++;
        else b[o][i]++;
    }
    FOR(i,1,vn(s))
    {
        a[o][i]+=a[o][i-1];
        b[o][i]+=b[o][i-1];
    }
}
int SUMA(int o,int u,int v){return (a[o][v]-a[o][u-1])%3;}
int SUMB(int o,int u,int v){return (b[o][v]-b[o][u-1])%3;}

bool m[10][10];
bool CHECK(int A1,int A2,int B1,int B2)
{
    int dis=A2-A1;
    int dis2=B2-B1;
    if(dis<0) dis+=3;
    if(dis2<0) dis2+=3;
    return dis==dis2;
}
main()
{
//    open("transform.inp");
    cin>>s>>t;s=' '+s;t=' '+t;
    INPUT(s,0);
    INPUT(t,1);
    FOR(i,1,in)
    {
        int x=in,y=in,u=in,v=in;
        if(CHECK(SUMA(0,x,y),SUMA(1,u,v),SUMB(0,x,y),SUMB(1,u,v))) cout<<"YES\n";
        else cout<<"NO\n";
    }
}


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

int main(){
  // long long a;
  // double b;
  // cin >> a >> b;

  // b = b*100;
  // long long bb = b;
  // cout << "bb=" << bb << endl;

  // long long ans = a*bb;
  // cout << "ans=" << ans << endl;

  // ans/=100;
  // cout << ans << endl;

  long double a;
  long double b;
  cin >> a >> b;

  long double ans = a*b;
  long long anss = floorl(ans);
  cout << anss << endl;
}

Measured memory_bytes: 3732
import java.util.Scanner;

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        double c = scanner.nextDouble();

        double area = a * b * Math.sin(Math.toRadians(c)) / 2;
        double h = b * Math.sin(Math.toRadians(c));
        double d = Math.sqrt(a*a + b * b - 2 * a * b * Math.cos(Math.toRadians(c)));

        System.out.println(area + " " + (d + a + b) + " " + h);
        scanner.close();
    }
}



Measured memory_bytes: 27780
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int s,w; cin >> s >> w;
    if(s<=w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divCeil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << A << endl; exit(0);}

int main()
{
  ll N;
  cin >> N;
  map<ll, ll> mp;
  for (ll i = 0; i < N; i++)
  {
    ll D;
    cin >> D;
    mp[D]++;
  }

  vector<bool> d(25, false);
  d.at(0) = true, d.at(24) = true;
  bool isL = false;
  for (auto x : mp)
  {
    ll D = x.first, M = x.second;

    if (M >= 3)
      FINALANS(0);
    
    if (M == 2)
    {
      if (D == 0 || D == 12)
        FINALANS(0);
      
      d.at(D) = true, d.at(24 - D) = true;
    }
    else if (M == 1)
    {
      if (D == 0)
        FINALANS(0);

      d.at((isL) ? 24 - D : D) = true;
      isL = !isL;
    }
  }

  ll ans = INF;
  ll tmp = 0;
  for (ll i = 1; i < 25; i++)
  {
    if (d.at(i))
    {
      chmin(ans, i - tmp);
      tmp = i;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var X, Y int
	fmt.Scanf("%d %d", &X, &Y)

	for i := 0; i <= X; i++ {
		// i: 鶴
		j := X - i
		sum := 2*i + 4*j
		if sum == Y {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


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

using namespace std;

const int MOD = 1000000007;

vector<long long> fact(1000001, 1);

int solve(int N, int H, int D){
    vector<long long> dp(H, 0);
    dp[0] = fact[N];
    long long factSum = 0;
    for(int i=1;i<=N;i++) factSum = (factSum + fact[i]) % MOD;
    long long sum = dp[0];
    for(int i=1;i<H;i++){
        dp[i] = (sum * factSum) % MOD;
        sum = (sum + dp[i]) % MOD;
        if(i - D >= 0) sum = (sum + MOD - dp[i-D]) % MOD;
    }
    return sum;
}

int main(){
    fact[0] = fact[1] = 1;
    for(int i=2;i<=1000000;i++) fact[i] = (fact[i-1]*i) % MOD;
    int N, H, D;
    while(cin >> N >> H >> D){
        cout << solve(N, H, D) << endl;
    }
}

Measured memory_bytes: 15872
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        final MyScanner sc = new MyScanner();
        final int a = sc.nextInt();
        final int answer = a * (1 + a * (1 + a));
        System.out.println(answer);
    }
}

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufLength = 0;

    private boolean hasNextByte() {
        if (pointer < bufLength) {
            return true;
        } else {
            pointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (final IOException e) {
                e.printStackTrace();
            }
            if (bufLength <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[pointer++];
        } else {
            return -1;
        }
    }

    private static boolean isNumberChar(final int c) {
        return '0' <= c && c <= '9';
    }

    private static boolean isPrintableChar(final int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[pointer])) {
            pointer++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        final StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long num = 0;
        boolean isNegative = false;
        int b = readByte();
        if (b == '-') {
            isNegative = true;
            b = readByte();
        }
        if (!isNumberChar(b)) {
            throw new NumberFormatException();
        }
        while (true) {
            if (isNumberChar(b)) {
                num *= 10;
                num += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return isNegative ? -num : num;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        final long temp = nextLong();
        if (temp < Integer.MIN_VALUE || Integer.MAX_VALUE < temp) {
            throw new NumberFormatException();
        }
        return (int) temp;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 32364
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()

    prev = -1
    cont_count = 1
    majic_num = 0
    for i in range(N):
        a = int(input_raw[i])
        if a == prev:
            cont_count += 1
        else:
            majic_num += cont_count/2
            cont_count = 1
        prev = a
    majic_num += cont_count/2
    print majic_num

if __name__ == '__main__':
    main()

Measured memory_bytes: 2928
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    boolean flag = false;
    for(int i=0;i<s.length();i+=2) {
      if(s.charAt(i)=='L') {
        flag = true;
      }
    }

    for(int j=1;j<s.length();j+=2) {
      if(s.charAt(j) == 'R'){
        flag = true;;
      }
    }

    if(flag==false) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
}
}


Measured memory_bytes: 23124
s = input()

sum1 = sum([(i % 2 == 0 and s[i] == '0') or (i % 2 == 1 and s[i] == '1') \
    for i in range(len(s))])
sum2 = sum([(i % 2 == 1 and s[i] == '0') or (i % 2 == 0 and s[i] == '1') \
    for i in range(len(s))])

print(min(sum1, sum2))


Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int p=0,c=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
        {
            c++;
        }
        else
        {
            p++;
        }
    }
    if(p==0||c==0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }



    return 0;
}


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

double prob[3005][3005];
void dp(int n,double *p){
	/*if(n == 0 && c == 0)
		return 1.0;
	if(n == 0)
		return 0.0;
	if(c == 0)
		return 1 - p[n-1];
	if(prob[n][c] != -1)
		return prob[n][c];
	return prob[n][c] = dp(n-1,c,p)*(1-p[n-1]) + dp(n-1,c-1,p)* p[n-1];*/
	for(int i =0;i<=n;i++)
	{
		for(int j = 0;j<=n;j++){
				if(i == 0 && j == 0)
					prob[i][j] = 1.0;
				else if(i == 0)
					prob[i][j] = 0.0;
				else if(j == 0)
					prob[i][j] = prob[i-1][j] * (1 - p[i-1]);
				else
					prob[i][j] = prob[i-1][j] * (1 - p[i-1]) + prob[i-1][j-1] * p[i-1];
		}
	}

}

int main()
{
	int n;
	cin>>n;
	double p[n];

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

	dp(n,p);
	double ans = 0.000;
	for(int j = n/2 + 1;j<=n;j++)
			ans+=prob[n][j];
	cout<<setprecision(20)<<ans;
	return 0;

}

Measured memory_bytes: 70656
#include <stdio.h>

int mem[35];

int main(void)
{
	int i, s;
	
	for (i = 0; i < 28; i++){
		scanf("%d", &s);
		mem[s - 1] = 1;
	}
	s = 1;
	for (i = 0; i < 30; i++){
		
		if (mem[i] == 0){
			printf("%d\n",i + 1);
			s++;
		}
	}
	return (0);
}

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

int main(int argc, char const *argv[])
{
    int n,k;cin>>n>>k;
    string s;cin>>s;
    s[k-1]+=0x20;
    cout << s<<endl;

    return 0;
}


Measured memory_bytes: 256
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;

bigint cnt[100000] ;
int main(){
    for( int i = 1 ; i <= 100 ; i++ ){
        for( int j = 1 ; j <= 100 ; j++ ){
            for( int k = 1 ; k <= 100 ; k++ ){
                int X = i * i + j * j + k * k + i * j + i * k + j * k ;
                cnt[X]++ ;
            }
        }
    }
    int N ; cin >> N ;
    for( int i = 1 ; i <= N ; i++ )
        cout << cnt[i] << endl ;
    return 0 ;
}


Measured memory_bytes: 4080
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#include <queue>
#define ll long long
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rep1(i,a) for(ll i = 1;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

//O(logB)
ll mpow(ll a, ll b, ll m){
	if (!b) return 1 % m;
	if (b == 1) return a % m;
	if (b % 2) return (a*mpow(a, b - 1, m)) % m;
	else return mpow((a*a) % m, b / 2, m) % m;
}

int main(){
    ll n,m; cin>>n>>m;
    if(n<=1 && m<=1){
        cout<<0<<endl;
    }
    else if(m<=1){
        cout<<(n*(n-1))/2<<endl;
    }
    else{
        cout<<((n*(n-1))/2+((m*(m-1))/2))<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 123456789012

int main(){
    ll i,j;
    ll h,w,a,b;
    cin>>h>>w>>a>>b;

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(i<b&&j<a) cout<<1;
            else if(i>=b&&j>=a) cout<<1;
            else cout<<0;
        }
        cout<<endl;
    }


    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int n;cin >> n;
    vector<pair<LL,LL>> vec;
    for(int a = 0;a < n;a++){
        int b,c;cin >> b >> c;
        vec.push_back({c,b});
    }
    sort(vec.begin(),vec.end());
    LL sum = 0;
    for(int i = 0;i < n;i++){
        int t = vec.at(i).first;
        sum += vec.at(i).second;
        if(sum > t){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


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

int main() {
  int N;
  cin >> N;
  int min = 1000, max = 0;
  for(int i=0;i<N;i++) {
    int a;
    cin >> a;
    if(a < min) min = a;
    if(a > max) max = a;
  }
  cout << max - min << endl;
  return 0;
}

Measured memory_bytes: 256