akhauriyash/Code-Regression huggingface dataset:
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int N;
    cin>>N;
    if(N%2==0){
        cout<<N<<endl;
    }
    else{
        cout<<N*2<<endl;
    }

}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N;
	cin >> N;
	vector <int> A(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii];
	}

	bool OK = true;
	for (int ii = 0; ii < N; ++ii){
		if (A[ii] % 2 == 0){
			bool cond1 = (A[ii] % 3 == 0);
			bool cond2 = (A[ii] % 5 == 0);
			if (!cond1 && !cond2){
				OK = false;
				break;
			}
		}
	}

	if (OK){
		cout << "APPROVED" << endl;
	} else {
		cout << "DENIED" << endl;		
	}


	return 0;
}


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

    if(s=="ABC")
    {
        cout<<"ARC"<<endl;
    }
    else if(s=="ARC")
    {
        cout<<"ABC"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>
typedef long long ll;
int main() {
	ll a;
	int d = 1;
	ll ans = 0;
	char b[5];
	scanf("%lld%s", &a, b);
	int nb[3];
	nb[0] = b[3] - '0';
	nb[1] = b[2] - '0';
	nb[2] = b[0] - '0';
	for (int i = 0; i < 3; i++) {
		ans += nb[i] * a * d;
		d *= 10;
	}
	printf("%lld\n", ans / 100);
	return 0;
}

Measured memory_bytes: 1732
#include <stdio.h>
 
int main(void)
{
 
    int a,b,c,d;
 
     scanf("%d%d%d%d",&a,&b,&c,&d);
 
     while(1){
           c=c-b;
           if(c<=0){
              printf("Yes\n");
              break;
           }
           a=a-d;
           if(a<=0){
              printf("No\n");
              break;
           }
     }
 
     return 0;
 
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	char b;
	cin >> b;
	if(b == 'A'){
		cout << 'T' << endl;
	}else if(b == 'C'){
		cout << 'G' << endl;
	}else if(b == 'G'){
		cout << 'C' << endl;
	}else if(b == 'T'){
		cout << 'A' << endl;
	}
}

Measured memory_bytes: 3568
#include <cstdio>
#include <tuple>
#include <vector>
#include <algorithm>

struct Node{
    int w, h;
    Node* next;
};

Node* head;

int main(){
    int N, W, D;
    
    while(scanf("%d %d %d", &N, &W, &D), N || W || D){
        head = new Node{W, D, nullptr};

        for(int i=0;i<N;i++){
            int p, s;
            scanf("%d %d", &p, &s);

            Node *prev = head, *target = head;
            for(int j=1;j<p;j++){
                prev = target;
                target = target->next;
            }
            
            int w = target->w, h = target->h;
            int w1, h1, w2, h2;

            s %= 2 * (w + h);
            
            if(0 <= s && s <= w){
                w1 = s;
                w2 = w - w1;
                h1 = h;
                h2 = h;
            }else if(w <= s && s <= w+h){
                w1 = w;
                w2 = w;
                h1 = s - w;
                h2 = h - h1;
            }else if(w+h <= s && s <= 2*w+h){
                w1 = s - (w + h);
                w2 = w - w1;
                h1 = h;
                h2 = h;
            }else{
                w1 = w;
                w2 = w;
                h1 = 2 * (w + h) - s;
                h2 = h - h1;
            }

            if(w1 * h1 > w2 * h2){std::swap(w1, w2); std::swap(h1, h2);}

            if(p == 1){
                head = head->next;
            }else{
                prev->next = target->next;
                delete target;
            }

            if(i == 0){
                head = new Node{w1, h1, new Node{w2, h2, nullptr}};          
            }else{
                target = head;
                while(target->next != nullptr){
                    target = target->next;
                }
                target->next = new Node{w1, h1, new Node{w2, h2, nullptr}};
            }
        }
        
        std::vector<int> v;
        while(head != nullptr){
            v.push_back(head->w*head->h);

            Node* next = head->next;
            delete head;
            head = next;
        }
        std::sort(v.begin(), v.end());
    
        for(int i=0;i<N+1;i++){
            printf("%d%c", v[i], " \n"[i+1==N+1]);
        }
    }
}

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

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

    int cnt = 0;
    for(int i = a; i <= b; i++) {
        if(c % i == 0) cnt++;
    }

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

Measured memory_bytes: 1164
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

ll solve(ll H, ll W) {
    ll w1 = W/2;
    ll w2 = W-w1;
    ll ans = (ll)MOD*MOD;
    FOR(i,1,H) {
        ll a1 = w1*i, a2 = w2*i, a3 = W*(H-i);
        ll temp = max(max(a1,a2),a3)-min(min(a1,a2),a3);
        ans = min(ans,temp);
    }
    return ans;
}

ll solve1(int W, int H) {
    if (W % 3 == 0) return 0;
    return H;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll H,W; cin >> H >> W;
    ll ans = min(solve(H,W),solve(W,H));
    if (W>2) ans = min(ans,solve1(W,H));
    if (H>2) ans = min(ans,solve1(H,W));
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <strstream>
#include <string>
#include <deque>
#include <vector>
#include <map>
typedef unsigned int UINT;
using namespace std;

int main(void) {
    string S;
    cin >> S;
    string pre, suf;
    pre = S.substr(0, 4);
    suf = S.substr(4);
    string ans = pre + " " + suf;
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
 
using namespace std;
 
int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "Yes" << endl;
  } else if (s[1] == s[2] && s[2] == s[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main(){
    ll n,m;
    cin>>n>>m;
    vector<P> a(n);
    for(int i=0; i<n; i++)cin>>a[i].first>>a[i].second;
    sort(a.begin(),a.end());
    int i=0;
    ll ans=0; 
    while(m>0){
        ll kau=min(m,a[i].second);
        ans+=kau*a[i].first;
        m-=kau;
        i++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int n,d,ans,a[15][15];
int main(){
	in(n);in(d);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=d;j++){
			in(a[i][j]);
		}
	}
	for(int i=1;i<=n;i++){
		for(int k=i+1;k<=n;k++){
			int s=0;
			for(int j=1;j<=d;j++){
				s+=(a[i][j]-a[k][j])*(a[i][j]-a[k][j]);
			}
			int x=(int)sqrt(s);
			if(x*x==s)ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T = list(map(int,input().split()))
total = 0

for i in range(N):
    total = total + T[i]

M = int(input())

for i in range(M):
    p,x = map(int,input().split())
    
    sub = - T[p-1] + x
    print(total+sub)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    String T = sc.next();
    sc.close();

    char[] ans = new char[N * 2];
    for (int i = 0; i < N; i++) {
      ans[i * 2] = S.charAt(i);
      ans[i * 2 + 1] = T.charAt(i);
    }
    System.out.println(new String(ans));
  }
}

Measured memory_bytes: 21076
main(n,m,i,j,S){for(;scanf(S="%d%d",&n,&m)*n;printf("%d\n",i)){int a[501][501]={0};for(;m--;a[i][j]=a[j][i]=1)scanf(S,&i,&j);for(i=n;i;i--)for(j=a[i][1]*n;j;j--)a[1][j]|=a[i][j];for(;n-1;)i+=a[1][n--];}}

Measured memory_bytes: 0
// #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#include <bits/stdc++.h>
//~ #include <atcoder/all>
using namespace std;
using ll = long long;
using P = pair<int, int>;

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//~ int A = (1<<2) | (1<<3) | (1<<5) | (1<<7);
//~ for (int bit=A; ; bit=(bit-1)&A){
//~ if (!bit) break;
//~ }
int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
//~ int n=5;
//~ int k=3; // nCkの組み合わせ、ただしk=0には対応してない
//~ int bit=(1<<k)-1; // 1000 -> 0111
//~ for(; bit < (1<<n); bit=nex_combination(bit){
//~ }
bool isPrime(int a) {
    if (a == 2) return true;
    if (a <= 1 || a % 2 == 0) return false;

    for (int i = 3; i * i <= a; i += 2) {
        if (a % i == 0) return false;
    }
    return true;
}
//~ vector<int> a = {1, 14, 32, 51, 51, 51, 243, 419, 750, 910};
vector<int> aaa;
// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (aaa[index] >= key)
        return true;
    else
        return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1;  //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok =
        (int)aaa
            .size();  // 「index =
                      // a.size()-1」が条件を満たさないこともあるので、初期値は
                      // a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key))
            ok = mid;
        else
            ng = mid;
    }
    return ok;
}

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 v[100100];
//~ int INF = 1 << 30;
//~ vector<vector<int>> dp(310, vector<int>(310));
//~ ll dp[110][100100];
//~ vector<int> dp(100100, 0));

//~ int seen[110];
//~ int ans[110][2];
//~ ll MOD = 1e9 + 7;

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

    int ans = 1;
    int mcnt = 0;
    for (int i = 1; i <= n; i *= 2) { ans = i; }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <queue>

using namespace std;

typedef pair<int, int> P;

int main() {
	int n, u, v, w, s = -1;
	cin >> n;
	vector<vector<int> > g(n, vector<int>());
	map<P, int> weight;
	vector<int> ans(n, -1);
	queue<P> q;
	for(int i = 0;i < n - 1;++i) {
		cin >> u >> v >> w;
		--u; --v;
		weight[make_pair(u, v)] = weight[make_pair(v, u)] = w % 2;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	for(int i = 0;i < n && s < 0;++i) {
		if(g[i].size() == 1) {
			s = i;
		}
	}
	q.push(make_pair(s, 0));
	while(!q.empty()) {
		P p = q.front(); q.pop();
		ans[p.first] = p.second;
		for(auto& next: g[p.first]) {
			if(ans[next] == -1) {
				q.push(make_pair(next, (p.second + weight[make_pair(p.first, next)]) % 2));
			}
		}
	}
	for(int i = 0;i < n;++i) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    int n;
    cin>>n;
    cout<<((n-2)*180)<<endl;
    
    return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    for(int i=0; i<1001000; i++){
        int aa = (int)(i*0.08);
        int bb = (int)(i*0.1);
        if(aa == a && bb == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	ans := 0
	for {
		for i := 0; i < n; i++ {
			if a[i]%2 != 0 {
				fmt.Println(ans)
				return
			}
			a[i] = a[i] / 2
		}
		ans++
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	int w,n;
	scanf("%d %d",&w,&n);
	vector<int> table;
	for(int x=0;x<=w;x++){
		table.push_back(x);
	}
	for(int x=0;x<n;++x){
		int i,j;
		scanf("%d, %d",&i,&j);
		swap(table[i],table[j]);
	}
	for(int x=1;x<=w;++x){
		cout<<table[x]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
/**
 * Author: Deb Natkh Maxim (debnatkh@gmail.com)
 * Date: 24.03.2019
 */

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;

const int MOD = 1e9 + 7;

int dp[256][1000];

inline int get(int mask, int i) {
    return (mask >> (2 * i)) & 3;
}

inline bool check(string s) {
    if (s.find("210") != string::npos) return false;
    for (size_t i = 1; i < s.size(); i++) {
        swap(s[i - 1], s[i]);
        if (s.find("210") != string::npos) return false;
        swap(s[i - 1], s[i]);
    }
    return true;
}

string by_mask(int mask) {
    string s = "";
    for (int i = 0; i < 4; i++) {
        s += '0' + get(mask, 3 - i);
    }
    return s;
}

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

    int n;
    cin >> n;
    for (int mask = 0; mask < 256; mask++) {
        if (get(mask, 3) == 3) {
            int a = get(mask, 0);
            int b = get(mask, 1);
            int c = get(mask, 2);
            if (check(by_mask(mask))) {
                dp[mask][3] = 1;
            } else {
                dp[mask][3] = 0;
            }
        }
    }
    for (int i = 4; i <= n; i++) {
        for (int mask = 0; mask < 256; mask++) {
            // cout << mask << endl;
            dp[mask][i] = 0;
            for (int prev = 0; prev < 4; prev++) {
            // cout << prev << " " << mask << " " << ((prev << 8 + mask) >> 2) << endl;
                if (check(string(1, '0' + prev) + by_mask(mask))) {
                    dp[mask][i] += dp[((prev << 8) + mask) >> 2][i - 1];
                }
            }
            dp[mask][i] %= MOD;
        }
    }


    int ans = 0;
    for (int mask = 0; mask < 256; mask++) {
        ans += dp[mask][n];
    }
    cout << ans % MOD;

    return 0;
}

Measured memory_bytes: 1536
object Main extends App {
    val w = Map(
        ('A', '0') -> 'X',
        ('A', '1') -> 'Y',
        ('B', '0') -> 'Y',
        ('B', '1') -> 'X',
        ('W', '0') -> 'B',
        ('W', '1') -> 'Y',
        ('X', '1') -> 'Z',
        ('Y', '0') -> 'X',
        ('Z', '0') -> 'W',
        ('Z', '1') -> 'B')
    for (p <- io.Source.stdin.getLines if p != "#") {
        val x = p.foldLeft('A'){case q => w.get(q) match {
            case None => ' '
            case Some(n) => n
        }}
        if (x == 'B') println("Yes")
        else println("No")
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> A;
    A.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i].first;
        A[i].second = i + 1;
    }

    sort(A.begin(), A.end());
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << A[i].second;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

int a[10];
signed main(){
    int b,c;
    cin >> a[0] >> a[1] >> a[2];
    if(a[0] * a[1] * a[2] % 2 == 0) cout << 0 << '\n';
    else{
        sort(a,a+3);
        cout << a[0] * a[1] << '\n';
    }   
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG    //空コンテナ操作禁止　Clang環境では#define _LIBCPP_DEBUG 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int A, P;
  cin >> A >> P;
  cout << ( A*3 + P )/2;

  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int com(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int main(){
  int i,n;
  scanf("%d",&n);
  int v[n+10];
  double ans=0.0;
  for(i=0;i<n;i++)
    scanf("%d",&v[i]);
  qsort(v,n,sizeof(int),com);
  ans=v[0];
  for(i=1;i<n;i++){
    ans = (double)((ans+v[i])/2.0);
  }
  printf("%f\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int A, int B) {
  if (A * B % 2 == 0) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
}

int main() {
  int A, B;
  cin >> A >> B;
  solve(A, B);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <cstdlib>
#include <algorithm>
using namespace std;
/*
int dfs(int w,int h,int noww,int nowh,int n,int b){
	++n;
	if(noww>w || nowh>h) return 0;
	if(noww==w && nowh==h) return 1;
	int ret=0;
	n=0;
	if(n)
	ret+=dfs(w,h,++noww,nowh,n,b);
	ret+=dfs(w,h,noww,++nowh,n,b);
	ret+=dfs(w,h,++noww,nowh,n,b);
	ret+=dfs(w,h,noww,++nowh,n,b);
	return ret;
}

int main()u{
	int w,h;
	cin >> w >> h;
	cout << dfs(w,h,1,1,2,0) << endl;
	return 0;
}
*/

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> x(k);
	vector<int> y(k);
	vector<int> mini(k);
	vector<int> ans(k);
	for( int i=0; i<k; ++i){
		cin >> x[i] >> y[i];
		mini[i]=min(x[i]-1,n-x[i]);
		mini[i]=min(mini[i],n-y[i]);
		mini[i]=min(mini[i],y[i]-1);
		ans[i]=mini[i]%3+1;
		cout << ans[i] << endl;
	}
	return 0;
}

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

#define X first
#define Y second

using namespace std;



int main() {
	ios_base::sync_with_stdio(0);
	
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k-1] += 'a' - 'A';
	cout << s << '\n';
	
	return 0;
}

Measured memory_bytes: 256
let n = read_int ()
let sumCanDivide m n = n*(m/n)*((m/n)+1)/2
let rec sum n = if n mod 2 = 0 then (1+n)*(n/2) else (1+n)*(n/2)+(n/2)+1
let ans = (sum n) - (sumCanDivide n 3) - (sumCanDivide n 5) + (sumCanDivide n 15)
let () = print_int ans

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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int MOD = 998244353;
const int N = 2e5 + 5;
pii arr[N];
int x[N] , nxt[N] , s[N*4];
int dp[N];
int n;

void modify(int p,int x,int id = 1,int l = 0,int r = n){
	s[id] = max(s[id],x);
	if(r - l < 2){	//	l = r - 1 = p
		return ;
	}
	int mid = (l + r)/2;
	if(p < mid)
		modify(p, x, id * 2, l, mid);
	else
		modify(p, x, id * 2 + 1, mid, r);
}

int query(int x,int y,int id = 1,int l = 0,int r = n){
	if(x >= r or l >= y)	return 0;
	if(x <= l && r <= y)	return s[id];
	int mid = (l+r)/2;
	return max(query(x, y, id * 2, l, mid) ,
	       query(x, y, id * 2 + 1, mid, r));
}

int add(int x , int y){
    int ret = x + y;
    if(ret >= MOD)ret -= MOD;
    return ret;
}

int solve(int idx){
    if(idx == n)return 1;
    int &ret = dp[idx];
    if(~ret)return ret;
    ret = solve(idx + 1);
    ret = add(ret , solve(nxt[idx]));
    return ret;
}

int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> n;
    loop(i,n)cin >> arr[i].fr >> arr[i].sc;
    sort(arr,arr+n);
    loop(i,n)x[i] = arr[i].fr;

    rloop(i,n-1){
        int idx = lower_bound(x,x+n,arr[i].fr + arr[i].sc) - x;
        if(idx == i+1){
            nxt[i] = idx;
        }else{
            nxt[i] = query(i,idx);
        }
        modify(i,nxt[i]);
    }

    memset(dp,-1,sizeof dp);
    cout <<solve(0) << endl;


    return 0;
}


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

int main()
{
	ll n, a, b, x, y;
	cin >> n;
	cin >> a >> b;
	for (int i = 1; i < n; i++)
	{
		cin >> x >> y;
		ll r1 = a / x, r2 = b / y;
		if (a % x)
			r1++;
		if (b % y)
			r2++;
		ll k = max(r1, r2);
		x *= k;
		y *= k;
		a = x;
		b = y;
	}
	cout << b + a << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

ll mod=1e9+7;

ll  Suan(ll  a, ll  n, ll  m)	//a的n次幂对m取模
{
    long long ans = 1;
    while(n)
    {
        if(n&1)
        {
            ans = (ans * a) % m;
        }
        a = (a * a) % m;
        n >>= 1;
    }
    return ans;
}

ll CC(ll n,ll m)    //n小于1e5,可以阶乘打表
{
    if(m>n)
        return 0;
    ll a=1,b=1,i;
    for(i=1; i<=m; ++i)
    {
        a=a*(n-m+i)%mod;
        b=b*i%mod;
    }
    return a*Suan(b,mod-2,mod)%mod; //费马小定理
}

ll Lucas(ll n,ll m) //C(n,m)%mod
{
    if(m==0)
        return 1;
    else
        return (CC(n%mod,m%mod)*Lucas(n/mod,m/mod))%mod;
}

int main()
{
    ll x,y,z,a,b,c,d,e,i,j;
    scanf("%lld%lld",&x,&y);
    z=x+y;
    if(z%3)
    {
        printf("0\n");
    }
    else
    {
        a=z/3,b=2*a;
        c=abs(x-a);
        d=abs(y-b);
        if(x-a<0||y-a<0)
        {
            printf("0\n");
            return 0;
        }
//        if(c!=d)
//        {
//            printf("0\n");
//        }
        else
        {
//////            if(c<=a)
////            {
                e=Lucas(a,c);
                printf("%lld\n",e);
//            }
//            else
//            {
//                while(1);
//            }
            //cout<<c<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int main()
{
//	freopen("A.in","r",stdin);
//	freopen(".out","w",stdout);
	char s[102];
	cin>>s;
	if (s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
		cout<<"Yes";else cout<<"No";cout<<endl;
	return 0;
}


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

const long NUM = 500000;
long n, S[NUM], c = 0;

void merge(long A[], long left, long mid, long right) {
  long L[NUM/2+2], R[NUM/2+2], n1 = mid - left, n2 = right - mid;

  for (int i = 0; i < n1; i++)
    L[i] = A[left+i];
  for (int i = 0; i < n2; i++)
    R[i] = A[mid+i];

  L[n1] = R[n2] = numeric_limits<long>::max();

  long i = 0, j = 0;

  for (long k = left; k < right; k++) {
    if (L[i] <= R[j]) A[k] = L[i++];
    else A[k] = R[j++];
    c++;
  }
}

void mergeSort(long A[], long left, long right) {
  if (left+1 < right) {
    long mid = (left+right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main() {
  cin >> n;
  for (long i = 0; i < n; i++)
    cin >> S[i];

  mergeSort(S, 0, n);

  for (long i = 0; i < n; i++) {
    if (i) cout << ' ';
    cout << S[i];
  }
  cout << endl;
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 8968
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,d,x[9];
map<int,int> a;
int main()
{
  for(;i<9;i++)cin>>x[i];
  for(cin>>n,j;j<n;j++){
    cin>>m;
    for(i=0;i<9;i++)if(m==x[i])x[i]=0;
  }
  for(i=0;i<3;i++) if(x[i]+x[i+3]+x[i+6]==0)return cout<<"Yes",0;
  for(i=0;i<7;i+=3)if(x[i]+x[i+1]+x[i+2]==0)return cout<<"Yes",0;
  if(x[0]+x[4]+x[8]==0)return cout<<"Yes",0;
  if(x[2]+x[4]+x[6]==0)return cout<<"Yes",0;
  cout<<"No";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<map>
#include<algorithm>
#define N 1100
#define INF 2<<30
using namespace std;
map<string,int>mp;
void bfs()
{
    int p;
    mp.clear();
    string ss="01234567";
    queue<string>q;
    int dir[4]= {1,-1,4,-4};
    q.push(ss);
    mp[ss]=0;
    while(!q.empty())
    {
        string now=q.front();
        q.pop();
        for(int i=0; i<8; i++)
        {
            if(now[i]=='0')
            {
                p=i;
                break;
            }
        }
        for(int k=0; k<=3; k++)
        {
            int tx=p+dir[k];
            if((k==1&&p==4)||(k==0&&p==3))
                continue;
            string next=now;
            if(tx>=0&&tx<8)
            {
                swap(next[tx],next[p]);
                if(mp[next]==0)
                {
                    mp[next]=mp[now]+1;
                    q.push(next);
                }
            }
        }
    }
}
int main()
{
    string s,str;
    bfs();
    while(getline(cin,s))
    {
        str.clear();
        for(int i=0; i<s.length(); i++)
        {
            if(s[i]!=' ')
                str=str+s[i];
        }
        cout<<mp[str]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5364
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int a[200010];
bool vis[200010];
map<int,int> mp;
int mnmi(int x){
	int cnt=1;
	while(cnt<=x){
		cnt*=2;
	}
	return cnt;
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;i++)mp[a[i]]++;
	int ans=0;
	for(int i=0;i<n;i++){
		if(!mp[a[i]])continue;
		mp[a[i]]--;
		int j=mnmi(a[i])-a[i];
		if(mp[j]){
			ans++;
			mp[j]--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int linearSearch(int A[], int B[], int n, int q) {
  int cnt = 0;
  for ( int i = 0; i < q; i++ ) {
    for ( int j = 0; j < n; j++ ) {
      if ( A[j] == B[i] ) {
        cnt++;
        break;
      }
    }
  }
  return cnt;
}


int main() {
  int n, q;
  string S, T;
  cin >> n;
  // vector<int > A(n);
  int A[n];
  for ( int i = 0; i < n; i++ ) cin >> A[i];
  cin >> q;
  // vector<int > B(q);
  int B[n];
  for ( int i = 0; i < q; i++ ) cin >> B[i];

  int ans;
  ans = linearSearch(A, B, n, q);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
#define PI 3.14159265358979323846264338327950L
typedef long long ll;


 void f(ll n){
	if(n == 0)return;
	n--;
	f(n/26);
	putchar('a'+(n%26));
}
 
int main(){
	char a[] = {'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'};
	ll n;
	cin>>n;
	f(n);
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  for(int i = 0;i < N ; i++){
    char s;
    cin >> s;
    if('Y' == s ){
		cout << "Four" << endl;
        return 0;
    }
  }
  
  cout << "Three" << endl;
  
  return 0;
}

Measured memory_bytes: 256
S = input()
X = 'YES'
while X == 'YES' and len(S) >= 8:
  if S[-5:] == 'dream' or S[-5:] == 'erase':
    S = S[0:-5]
  elif S[-6:] == 'eraser':
    S = S[0:-6]
  elif S[-7:] == 'dreamer':
    S = S[0:-7]
  else:
    X = 'NO'
if S == 'dream' or S == 'dreamer' or S == 'erase' or S == 'eraser':
  X = 'YES'
else:
  X = 'NO'
print(X)

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

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

typedef pair<ll,ll> Pair;

int main(){

  ll ans;

  cin >> ans;

  if(ans == 1) cout << "0" << endl;
  else  cout << "1" << endl;

  return 0;

}   


Measured memory_bytes: 3616
from collections import Counter

n = int(input())
v=list(map(int,input().split()))
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
    print(n-(a[0][1]+b[0][1]))
else:
    print(min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1])))

Measured memory_bytes: 20700
#include <iostream>
#include <string>
#include <map>
using namespace std;

 unsigned long calc(string s, int b) {
    if(b==0) return stoul(s);
    int c=0, n=s.length();
    for(;!(b&1);++c) b>>=1;
    b>>=1;
    return (stoul(s.substr(0,c+1))+calc(s.substr(c+1,n-c-1),b));
}

int main(int argc, char const *argv[])
{
    string s; cin >> s;
    int n = s.length(), b=0;
    unsigned long x=0;
    
    for(;b<(1<<(n-1));++b) {
        //cout << b << " " << calc(s, b) << " " << x << endl;
        x += (unsigned long)calc(s, b);
    }
    cout << x << endl;

    return 0;
}


Measured memory_bytes: 256
# frozen_string_literal: true

N = gets.to_i
strings = N.times.map { gets.chomp }

exists = {}
strings.each do |string|
  sort_s = string.chars.sort.join
  exists[sort_s] = 0 if exists[sort_s].nil?
  exists[sort_s] += 1
end

puts exists.values.inject(0) { |cnt, v| cnt += (v - 1) * v / 2 }


Measured memory_bytes: 25468
def gcd(a,b):
    while a:
        a,b = b%a,a
    return b
    
a = input().split()
a = [int(i) for i in a]

lis = input().split()
lis = [int(i) for i in lis]

output = lis[0] - a[1]
for i in range(len(lis)):
	lis[i] = lis[i] - a[1]
	output = gcd(output, lis[i])

print(abs(output))

Measured memory_bytes: 62576
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

int main() {
    char str[1001];
    scanf("%s", str);
    int q;
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        char command[8];
        scanf("%s", command);
        if (strcmp(command, "print") == 0) {
            int a, b;
            scanf("%d %d", &a, &b);
            for (int i = a; i <= b; i++) {
                printf("%c", str[i]);
            }
            printf("\n");
        } else if (strcmp(command, "reverse") == 0) {
            int a, b;
            scanf("%d %d", &a, &b);
            char str2[1001];
            strcpy(str2, str);
            for (int i = 0; i <= b-a; i++) {
                str[a+i] = str2[b-i];
            }
        } else {
            int a, b;
            char p[101];
            scanf("%d %d %s", &a, &b, p);
            for (int i = 0; i <= b-a; i++) {
                str[a+i] = p[i];
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2744
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;
constexpr ll modsize = 3000000;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

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

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int k;
	cin >> k;
	string s;
	cin >> s;
	int n = s.size();
	ll ans = 0;
	rep(i, k + 1) ans += modcomb(n + k, i) * modpow(25, i) % mod;
	cout << ans % mod << '\n';
}

Measured memory_bytes: 74584
#include<stdio.h>
#define STRING_MAX 101
#define TEICE 2
#define FRG_OFF 0
#define FRG_ON 1
#define ARRAY_RESET 0
#define LOOP_RESET 0
#define COUNT_RESET 0
#define RETURN 0

unsigned short s_scan_sentence(unsigned char * str, unsigned short length_max);
unsigned short s_sarch_text(unsigned char * ring, unsigned short r_length, unsigned char * look, unsigned short l_length);

int main(){
	unsigned char ubW_D_ring_text[STRING_MAX];	/* 検索元文字列の配列 */
	unsigned char ubW_D_look_text[STRING_MAX];	/* 検索文字列の配列 */
	unsigned short usW_D_ring_length;         	/* 検索元文字列の長さ */
	unsigned short usW_D_look_length;         	/* 検索文字列の長さ */
	unsigned short usW_F_frg_main = FRG_OFF;  	/* フラグ */
	unsigned short usW_C_i;                   	/* ループ変数 */
	
	/* 配列の初期化 */
	for(usW_C_i = LOOP_RESET;usW_C_i < STRING_MAX;usW_C_i++){
		ubW_D_ring_text[usW_C_i] = ARRAY_RESET;
		ubW_D_look_text[usW_C_i] = ARRAY_RESET;
	}
	
	/* 検索元文字列の入力 */
	usW_D_ring_length = s_scan_sentence(ubW_D_ring_text, STRING_MAX);
	/* 検索文字列の入力 */
	usW_D_look_length = s_scan_sentence(ubW_D_look_text, STRING_MAX);
	
	/* 文字列の検索 */
	usW_F_frg_main = s_sarch_text(ubW_D_ring_text, usW_D_ring_length, ubW_D_look_text, usW_D_look_length);
	
	/* フラグが0の場合Noを、1の場合Yesを出力 */
	if(usW_F_frg_main == FRG_OFF){
		printf("No\n");
	}
	else if(usW_F_frg_main == FRG_ON){
		printf("Yes\n");
	}
	
	return RETURN;
}


/* 関数名：文字列入力 */
/* 概要：文字列を入力する。その長さを返す */
/* 引数：文字列を格納する配列の先頭アドレス、その配列の大きさ */
/* 戻り値：入力された文字列の長さ */
unsigned short s_scan_sentence(unsigned char * str, unsigned short length_max)
{
	unsigned short usW_C_count_text = COUNT_RESET;  	/* 文字列長カウンタ */
	unsigned short usW_C_i;                         	/* ループ変数 */

	/* 文字列の入力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < length_max;usW_C_i++){
		scanf("%c", str + usW_C_i);
		/* 入力終了の処理 */
		if(*(str + usW_C_i) == '\n'){
			break;
		}
		/* 文字数をカウント */
		usW_C_count_text++;
	}

	/* 文字列長を返す */
	return usW_C_count_text;
}

unsigned short s_sarch_text(unsigned char * ring, unsigned short r_length, unsigned char * look, unsigned short l_length)
{
	unsigned char twi_ring[STRING_MAX * TEICE]; 	/* 円状の文字列を再現する配列 */
	unsigned short usW_F_frg_fanc = FRG_OFF;    	/* フラグ */
	unsigned short usW_C_i, usW_C_j;            	/* ループ変数 */
	
	/* 配列を初期化 */
	for(usW_C_i = LOOP_RESET;usW_C_i < (STRING_MAX * TEICE);usW_C_i++){
		twi_ring[usW_C_i] = ARRAY_RESET;
	}
	
	/*  */
	for(usW_C_i = LOOP_RESET;usW_C_i < r_length;usW_C_i++){
		twi_ring[usW_C_i] = *(ring + usW_C_i);
	}
	for(usW_C_i = LOOP_RESET;usW_C_i < r_length;usW_C_i++){
		twi_ring[r_length + usW_C_i] = *(ring + usW_C_i);
	}
	
	for(usW_C_i = LOOP_RESET;usW_C_i <= r_length;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j <= l_length;usW_C_j++){
			if(*(look + usW_C_j) == '\n'){
				usW_F_frg_fanc = FRG_ON;
			}
			if(twi_ring[usW_C_i + usW_C_j] != *(look + usW_C_j)){
				break;
			}
		}
	}
	
	return usW_F_frg_fanc;
}



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

int main(){
	char a, b;
	cin >> a >> b;
	if(a > b) cout << '>' << endl;
	else if(a == b) cout << '=' << endl;
	else cout << '<' << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int n, a, b;
int v[60];
int comb[60][60];

signed main() {
    memset(comb, 0, sizeof(comb));
    repq(i,0,55) comb[i][0] = 1;
    repq(i,1,55) {
        repq(j,1,i) {
            comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
        }
    }
    cin >> n >> a >> b;
    map<int, int> m;
    rep(i,0,n) {
        cin >> v[i];
        m[v[i]] += 1;
    }
    sort(v, v+n, greater<int>());
    int sum = 0;

    multiset<int> s;
    set<int> s2;
    rep(i,0,a) {
        sum += v[i];
        s.insert(v[i]);
        s2.insert(v[i]);
    }

    double ret = (double)sum / a;
    printf("%.10lf\n", ret);
    if(s2.size() != 1) {
        int ans = 1;
        set<int> used;
        rep(i,0,a) {
            if(used.count(v[i])) continue;
            used.insert(v[i]);
            int num = s.count(v[i]);
            ans *= comb[m[v[i]]][num];
        }
        cout << ans << endl;
    }
    else {
        // printf("case 2\n");
        int target = v[0];
        int ans = 0;
        repq(i,a,b) {
            if(i > m[target]) break;
            // printf("target = %lld, i = %lld, comb = %lld\n", m[target], i, comb[m[target]][i]);
            ans += comb[m[target]][i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# Coloring Colorfully

S = list(map(int, input()))

S_ = S[:]
cnt_0 = 0
for i in range(1, len(S_)):
	if S_[i] == S_[i-1]:
		S_[i] = (S_[i]+1)%2
		cnt_0 += 1

S_ = S[:]
cnt_1 = 1
S_[0] = (S_[0]+1)%2
for i in range(1, len(S_)):
	if S_[i] == S_[i-1]:
		S_[i] = (S_[i]+1)%2
		cnt_1 += 1
		
print(min(cnt_0, cnt_1)) 
	
	

Measured memory_bytes: 5536
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
    LL N;
    while (cin >> N) {
        FOR(h,1,3600) FOR(n,1,3600) {
            const LL a = N*h*n;
            const LL b = 4*h*n - N*(n+h);
            if (b && a % b == 0) {
                const LL w = a/b;
                if (w > 0) {
                    printf("%d %d %lld\n",h,n,w);
                    goto end;
                }
            }
        }
    end:
        ;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;

int main(void){
    int h,w,i,j;    

    while (1){
        cin >> h >> w;
        if (h == 0 && w == 0) break;
    
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            cout << "#";
        }
        cout << endl;
    }
    cout << endl;
    }
    return 0;

}

Measured memory_bytes: 1156
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	char s[5003];
	scanf("%s", s);
	int i, j, k;
	int ans = 0;
	int count;
	for (i = 0; i <= n - 1 - ans; i++)
	{
		for (j = i + ans; j <= n - ans; j++)
		{
			count = 0;
			for (k = 0; i + k < j && j + k < n; k++)
			{
				if (s[i + k] == s[j + k])
					count++;
				else
					break;
			}
			if (ans < count)
				ans = count;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

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

	int board[100][100];
	rep(i,50) rep(j,100) board[i][j] = 1;
	FOR(i,50,100) rep(j,100) board[i][j] = 0;

	int r = 1;
	while(true){
		for(int i = 1; i < 100; i += 2){
			if(a == 1) break;
			board[r][i] = 0;
			a--;
		}
		if(a == 1) break;
		r += 2;
	}
	
	r = 51;
	while(true){
		for(int i = 1; i < 100; i += 2){
			if(b == 1) break;
			board[r][i] = 1;
			b--;
		}
		if(b == 1) break;
		r += 2;
	}


	cout << "100 100" << endl;
	rep(i,100){
		rep(j,100){
			cout << (board[i][j] == 1 ? "#" : ".");
		}
		cout << endl;
	}
} 

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

int main(int argc, char *argv[])
{
    int i = 1;
    int n;

    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            printf(" %d", i);
        } else {
            while (x) {
                if (x % 10 == 3) {
                    printf(" %d", i);
                    break;
                }
                x /= 10;
            }
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 2092