akhauriyash/Code-Regression huggingface dataset:
n = int(input())
l = list(map(int,input().split()))

ans = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]:
                continue
            else:
                ver = [l[i],l[j],l[k]]
                ver.sort()
                if ver[0] + ver[1] > ver[2]:
                    ans += 1

print(ans)


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

int main() {
  int N, r, b;
  string S;
  cin >> N >> S;
  r = 0;
  b = 0;
  for (int i = 0; i < N; i++) {
    if ( S[i] == 'R' ) r++;
    else b++;
  }
  if ( r > b ) cout << "Yes" << endl;
  else cout << "No" << endl;
}
 

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

int main(){
	int a, b, si, n = 0;
	double su;
	cin >> a >> b;
	su = a + b;
	si = a + b;
	si /= 2;
	su /= 2;
	su *= 2;
	si *= 2;
	if((int)su - si == 1) n = 1;
	int x = si / 2 + n;
	cout << x << endl;
}
	
	
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int> > data;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    for (int i=0;i<n;i++){
        vector<int> h;
        data.push_back(h);
    }
    for (int i=0; i < m; i++){
        int a, b;
        cin >> a >> b;
        data[a-1].push_back(b-1);
        data[b-1].push_back(a-1);
    }
    int v[n][2];
    for (int i=0;i<n;i++) for (int j=0; j < 2; j++) v[i][j]=0;
    vector<bool> bad(n);
    fill(bad.begin(), bad.end(), false);
    for (int i=0; i < n; i++){
        for (int j=0; j < data[i].size(); j++){
            int to = data[i][j];
            if (s[to] == 'A') v[i][0]++;
            else v[i][1]++;
        }
    }
    queue<int> q;
    int ans = n;
    //for (int i=0;i<n;i++) cout << v[i][0] << " " << v[i][1] << endl;
    for (int i=0; i < n; i++) if (min(v[i][0], v[i][1]) < 1){
        ans--;
        q.push(i);
        bad[i] = true;
    }
    while (q.size()){
        int V = q.front();
        q.pop();
        for (int i=0; i < data[V].size(); i++){
            int to = data[V][i];
            if (bad[to]) continue;
            if (s[V] == 'A') v[to][0]--;
            else v[to][1]--;
            if (min(v[to][0], v[to][1]) < 1){
                bad[to] = true;
                ans--;
                q.push(to);
            }
        }
    }
    if (ans) cout << "Yes";
    else cout << "No";
}


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

int64_t zero=0;
int64_t I=167167167167167;

int main() {
  int H,W,x1,y1,x2,y2;
  int64_t K;
  cin>>H>>W>>K;
  cin>>x1>>y1>>x2>>y2;
  x1--,y1--,x2--,y2--;
  vector<vector<char>> G(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>G[i][j];
    }
  }
  vector<vector<vector<int64_t>>> D(H,vector<vector<int64_t>>(W,vector<int64_t>(4,I)));
  priority_queue<tuple<int64_t,int,int,int>, vector<tuple<int64_t,int,int,int>>, greater<tuple<int64_t,int,int,int>>> pq;
  vector<vector<vector<int64_t>>> seen(H,vector<vector<int64_t>>(W,vector<int64_t>(4,0)));
  for(int i=0;i<4;i++){
    D[x1][y1][i]=0;
    pq.push(make_tuple(zero,x1,y1,i));
  }
  while(!pq.empty()){
    int64_t d;
    int a,b,v;
    tie(d,a,b,v)=pq.top();
    pq.pop();
    if(seen[a][b][v]){
      continue;
    }
    seen[a][b][v]=1;
    int64_t Q=((d+K-1)/K)*K;
    for(int i=0;i<4;i++){
      if(D[a][b][i]>Q){
        D[a][b][i]=Q;
        pq.push(make_tuple(Q,a,b,i));
      }
    }
    d++;
    if(v==0&&a+1<H){
      if(G[a+1][b]=='.'){
        if(D[a+1][b][v]>d){
          pq.push(make_tuple(d,a+1,b,v));
        }
      }
    }
    if(v==2&&a>0){
      if(G[a-1][b]=='.'){
        if(D[a-1][b][v]>d){
          pq.push(make_tuple(d,a-1,b,v));
        }
      }
    }
    if(v==1&&b+1<W){
      if(G[a][b+1]=='.'){
        if(D[a][b+1][v]>d){
          pq.push(make_tuple(d,a,b+1,v));
        }
      }
    }
    if(v==3&&b>0){
      if(G[a][b-1]=='.'){
        if(D[a][b-1][v]>d){
          pq.push(make_tuple(d,a,b-1,v));
        }
      }
    }
  }
  int64_t Z=min(min(D[x2][y2][0],D[x2][y2][1]),min(D[x2][y2][2],D[x2][y2][3]));
  if(Z==I){
    cout<<"-1"<<endl;
  }
  else{
    cout<<(Z+K-1)/K<<endl;
  }
}

Measured memory_bytes: 215120
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  int X,A,B;
  cin >>X>>A>>B;
  if(B-A<=0 ) cout <<"delicious";
  else if(B-A <=X) cout <<"safe";
  else cout <<"dangerous"<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, K, Q = MAP()
M = [0] * N
for i in range(Q):
	M[int(input())-1] += 1

for m in M:
	print('No' if (K - Q + m) <= 0 else 'Yes')

Measured memory_bytes: 4680
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,x=0,t,r=0,i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
       cin>>a[i];
    }

    for(i=0;i<n;i++)
    {
        if(a[i]>x)
        x=a[i];

        r=r+x-a[i];
    }
    cout<<r<<endl;

}


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

int d[200010];
vector<int> adj[200010];
bool vis[200010];

void bfs(int s) {
	queue<int> q;
	vis[s] = true;
	q.push(s);
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for(int i = 0; i < adj[u].size(); ++i) {
			int v = adj[u][i];
			if (!vis[v]) {
				vis[v] = true;
				d[v] = d[u] + 1;
				q.push(v);
			}
		}
	}
}

int main() {
	// your code goes here
	int i, j, n, m, u, v;
	cin >> n >> m;
	while(m--) {
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	bfs(1);
	if (d[n] == 2)	cout << "POSSIBLE\n";
	else	cout << "IMPOSSIBLE\n";
	return 0;
}

Measured memory_bytes: 13424
<?php
$a = intval(trim(fgets(STDIN)));
$array = str_split($a);
//echo print_r($array);
$min = 10000000;
for ($i = 0; $i < count($array) - 2; ++$i) {
    $temp = (int)$array[$i] * 100 + (int)$array[$i + 1] * 10 + (int)$array[$i + 2];
    //echo $temp . "\n";
    $diff = abs($temp - 753);
    if ($diff < $min) {
        $min = $diff;
    }
}
echo $min . "\n";


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<int> ans;
    for(int i = n-1; i >= 0; i--){
        int j = i+1;
        int k = 2;
        int cnt = 0;
        while(j * k <= n){
            cnt += b[j*k-1];
            k++;
        }
        if(cnt % 2 != a[i]){
            b[i] = 1;
            ans.push_back(j);
        }
    }
    cout << ans.size() << endl;
    for(auto x : ans) cout << x << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int cb=0;
    if (s[0] == '1') ++cb;
    if (s[1] == '1') ++cb;
    if (s[2] == '1') ++cb;
    cout << cb << endl;
}

Measured memory_bytes: 3568
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    char a;
    cin >> a;
    if(a == 'a' || a == 'e' || a == 'o' || a == 'i' || a == 'u'){
        cout << "vowel";
    }
    else
    {
        cout << "consonant";
    }
    
    cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		String S = new Scanner(System.in).next();
		S = S.replaceAll("eraser", "");
		S = S.replaceAll("erase", "");
		S = S.replaceAll("dreamer", "");
		S = S.replaceAll("dream", "");
		System.out.println(S.length() == 0 ? "YES" : "NO");
	}
}

Measured memory_bytes: 30228
/**
 *    author:  Mohamad Milhem
 *    created: 2020-02-19-12.06.24
**/

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


int main(){

    FAST;

    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a + 3);
    if (a[0] == a[2]){cout << "No" << endl; return 0;}

    for (int i = 0 ; i < 2 ; i++){
        if (a[i] == a[i+1]){cout << "Yes" <<endl;return 0;}
    }


    cout << "No" <<endl;



    return 0;
}


Measured memory_bytes: 256
def fill(x, y, board):
    board[y][x] = 2
    points = [[y, x + 1], [y, x - 1], [y + 1, x], [y - 1, x]]

    if y == 0:
        points.remove([y-1, x])
    elif y == 11:
        points.remove([y+1, x])
    if x == 0:
        points.remove([y, x - 1])
    elif x == 11:
        points.remove([y, x + 1])

    for p in points:
        if board[p[0]][p[1]] == 1:
            board = fill(p[1], p[0], board)
    return board

while True:
    try:
        islands = [list(map(int, list(input()))) for i in range(12)]
        ans = 0

        for y in range(12):
            for x in range(12):
                if islands[y][x] == 1:
                    islands = fill(x, y, islands)
                    ans += 1
        print(ans)
        input()
    except:
        break

Measured memory_bytes: 6744
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  input[0] = myconv(input[0],4);
  input[1] = myconv(input[1],4);
  input[2] = myconv(input[2],4);
  //行中の0-1番目の差、1-2番目の差がすべての行で一致している
  //または、列中の0-1番目の差、1-2番目の差がすべての列で一致している
  var output = "Yes";
  var gyo112 = Math.abs(input[0][0] - input[0][1]);
  var gyo212 = Math.abs(input[1][0] - input[1][1]);
  var gyo312 = Math.abs(input[2][0] - input[2][1]);
  var gyo123 = Math.abs(input[0][2] - input[0][1]);
  var gyo223 = Math.abs(input[1][2] - input[1][1]);
  var gyo323 = Math.abs(input[2][2] - input[2][1]);
  var retu112 = Math.abs(input[0][0] - input[1][0]);
  var retu212 = Math.abs(input[0][1] - input[1][1]);
  var retu312 = Math.abs(input[0][2] - input[1][2]);
  var retu123 = Math.abs(input[2][0] - input[1][0]);
  var retu223 = Math.abs(input[2][1] - input[1][1]);
  var retu323 = Math.abs(input[2][2] - input[1][2]);
  if(gyo112 != gyo212 || gyo212 != gyo312 || gyo112 != gyo312
    || retu112 != retu212 || retu212 != retu312 || retu112 != retu312
    || gyo123 != gyo223 || gyo223 != gyo323 || gyo123 != gyo323
    || retu123 != retu223 || retu223 != retu323 || retu123 != retu323){
    output = "No" ;
  }
  myout(output);
}
Main(myin());


Measured memory_bytes: 7372
arr = [int(input())]
pivot = 0
while pivot not in arr[:-1]:
  if arr[-1] % 2 == 0:
    arr.append(arr[-1]/2)
    pivot = arr[-1]
  else:
    arr.append(3*arr[-1] + 1)
    pivot = arr[-1]
print(len(arr))    
  

Measured memory_bytes: 2940
#include <stdio.h>
int linearSearch(int [],int,int);

int main()
{
  int i,n,A[10000],q,key,num=0;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(linearSearch(A,n,key)) num++;
  }

  printf("%d\n",num);

  return 0;
}

int linearSearch(int A[],int n,int key)
{
  int i=0;
  A[n]=key;
  while(A[i]!=key){
    i++;
  }
  return i!=n;
}

Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 30030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin>>n;
int arr[n];
rep(i,0,n)
cin>>arr[i];
int ans=0;
rep(i,1,n-1)
{
	int a[3];
	a[0]=arr[i-1];
	a[1]=arr[i];
	a[2]=arr[i+1];
	sort(a,a+3);
	if(arr[i]==a[1])
	ans++;
}
cout<<ans;
}


Measured memory_bytes: 256
def main():
    a, b = map(int, input().split())
    s = input()

    for i in range(a + b + 1):
        if i == a:
            if s[i] != "-":
                print("No")
                exit()
        else:
            if not "0" <= s[i] <= "9":
                print("No")
                exit()
    else:
        print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 61932
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	int N;
  	int long long sum=0;
  	cin >> N;
  	int M=3*N;
  	int a[M];
  
 	 for(int i=0 ; i<M; i++){
   		 cin >> a[i];
  	}
  
  sort(a, a+M);
    
     for(int i=0; i < N; i++){
     	 sum += a[3*N-2-i*2];
    }
  
  cout << sum <<endl;

}

Measured memory_bytes: 1408
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL <<60;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始


int main(){
  int a,b,h;
  cin>>a>>b>>h;
  cout<<(a+b)*h/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
struct W{
    int a;
    int b;
    bool operator<( const W& right ) const {
        return a < right.a;
    }
};
 
int main(void){
    
    int n, m;
    cin >> n >> m;
    vector<W> wars(m);
    
    for(int i = 0; i < m; i ++) cin >> wars[i].a >> wars[i].b;
    sort(wars.begin(), wars.end());
  
    int dp = 0, dp2 = n;
    for(int i = m-1; i >= 0; i --){
        if(dp2 >= wars[i].b){
            dp ++;
            dp2 = wars[i].a;
        }
    } 
    cout << dp << "\n";
}

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  auto solve = [&]() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    map<int, int> c;
    for (int i = 0; i < n; ++i) {
      ++c[a[i]];
    }
    if (c.find(0) != c.end() && c[0] == n) {
      return 1;
    }
    if (n % 3 != 0) {
      return 0;
    }
    if (c.find(0) != c.end() && c[0] == n / 3 && c.size() == 2) {
      return 1;
    }
    if (c.size() == 3) {
      vector<pair<int, int>> a;
      for (auto i : c) {
        a.push_back(i);
      }
      if (a[0].second == a[1].second && a[1].second == a[2].second) {
        if ((a[0].first ^ a[1].first) == a[2].first) {
          return 1;
        }
      }
    }
    return 0;
  };
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll n,h,w;
    cin >> n >> h >> w;
    ll co=0;
    for(int i=0;i<n;i++){
        ll a,b;
        cin >> a >> b;
        if(a>=h&&b>=w)co++;
    }
    cout << co <<endl;
    return 0;
}

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

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

int w,h,n,x[100002],y[100002];
int tx[100002],ty[100002];
vector<int> vx,vy;

signed main(){
  cin>>w>>h>>n;
  rep(i,n){
    cin>>x[i]>>y[i];
    tx[i]=x[i];
    ty[i]=y[i];
  }
  sort(x,x+n);
  sort(y,y+n);
  if(n%2){
    vx.push_back(x[n/2]);
    vy.push_back(y[n/2]);
  }else{
    vx.push_back(x[n/2-1]),vx.push_back(x[n/2]);
    vy.push_back(y[n/2-1]),vy.push_back(y[n/2]);
  }
  int t=1000000000000000,ax,ay;
  for(int sx:vx)for(int sy:vy){
    int sum=0,md=0;
    rep(i,n){
      int d=abs(tx[i]-sx)+abs(ty[i]-sy);
      sum+=d*2;
      md=max(md,d);
    }
    sum-=md;
    if(sum<t){
      t=sum;
      ax=sx;
      ay=sy;
    }
  }
  cout<<t<<endl;
  cout<<ax<<" "<<ay<<endl;
}

Measured memory_bytes: 6288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
int v[100005];
int c1[100005],c2[100005];
int om,em,os,es;
int com,cem,Cos,ces;
int main(void){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>v[i];
        if(i%2==1) c1[v[i]]++;
        else c2[v[i]]++;
    }
    for(int i=1;i<=n;i=i+2){
        if(com<=c1[v[i]]&&v[om]!=v[i]){
            com=c1[v[i]];
            om=i;
        }
    }
    for(int i=2;i<=n;i=i+2){
        if(cem<=c2[v[i]]&&v[em]!=v[i]){
            cem=c2[v[i]];
            em=i;
        }
    }
    for(int i=1;i<=n;i=i+2){
        if(Cos<=c1[v[i]]&&v[os]!=v[i]&&v[om]!=v[i]){
            Cos=c1[v[i]];
            os=i;
        }
    }
    for(int i=2;i<=n;i=i+2){
        if(ces<=c2[v[i]]&&v[es]!=v[i]&&v[em]!=v[i]){
            ces=c2[v[i]];
            es=i;
        }
    }
    //cout<<v[om]<<" "<<v[os]<<" "<<v[em]<<" "<<v[es]<<endl;
    if(v[om]!=v[em]){
        cout<<n-c1[v[om]]-c2[v[em]]<<endl;
    }else{
        cout<<min(n-c1[v[os]]-c2[v[em]],n-c1[v[om]]-c2[v[es]])<<endl;
    }

}



Measured memory_bytes: 4732
#include <stdio.h>
/********
*	??????
*********/

/*********??¢?????´?????????
*	(1)
*	(2)
*********/

int main(void)
{
	int point = 0;		//????¨??????°
	int i       ;
	int m,f,r;	//??????????¨??????° m???
				//??????????¨??????° f???
				//???????¨??????°   r???
	char hyouka;		//??????

	
	i = 0;
	while(1){			//????¨??????°??\???
			scanf("%d %d %d\n", &m, &f, &r);
			if(m == -1 && f == -1){
				if(f == -1 && r == -1){
					break;
				}
			}
			i++;
		hyouka = 'Z';	
		point = m + f;		//????¨?
		
		if(m == -1 || f == -1){
			hyouka = 'F';
		}else {
			if(80 <= point && point <= 100){
				hyouka = 'A';
			}
			else if(65 <= point && point < 80){
					hyouka = 'B';
			}
			else if(50 <= point && point < 65){
					hyouka = 'C';
			}
			else if(30 <= point && point < 50){
				if(50 <= r){
					hyouka = 'C';
				}
				else if(r < 50){
					hyouka = 'D';
				}else {
				// ??????????????\??????
				}
			}	
			else if(0 <= point && point < 30){
				hyouka = 'F';
			}
			else{
				//??????????????\??????
			}
		}
//		for(j=0; j <i; j++ ){
			printf("%c\n",hyouka);
//		}
	}
		
    return 0;
}

Measured memory_bytes: 1032
s = list(input())
s_len = len(s)
ans_0 = 0
ans_1 = 0
for i in range(s_len):
  if i % 2 == 0 and s[i] == "0":
    ans_0+= 1
  elif i % 2 == 0 and s[i] == "1":
    ans_1+= 1
  elif i % 2 != 0 and s[i] == "0":
    ans_1+= 1
  else:
    ans_0 += 1
print(min(ans_0,ans_1))

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

using namespace std;

#define intt long long 
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 200005;

int n, t;
int a[N];

int main() {

	FAST;

	cin >> n >> t;
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
	}
	intt ans = 0;
	for (int i = 0; i < n; i ++) {
		if (a[i] - a[i - 1] > t) {
			ans += t;
		}
		else {
			ans += (a[i] - a[i - 1]);
		}
	}
	ans += t;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1024
import scala.io.StdIn

object Main extends App {
  
  def loop(x: Int, y: Int): Unit = {
    if(x != 0 || y != 0){
      if(x <= y) println(s"$x $y")
      else println(s"$y $x")

      val Array(nextx, nexty) = StdIn.readLine().trim.split(' ').map(_.toInt)
      loop(nextx, nexty)
    } 
  }

  val Array(fx, fy) = StdIn.readLine().trim.split(' ').map(_.toInt)

  loop(fx, fy)

}


Measured memory_bytes: 47920
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


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

	string res = "";
	rep(i, s.length()) {
		if (i%2==0) res += s[i];
	}
	cout << res << endl;
}

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

int intsort(const void *a, const void *b){
	return *(int*)a - *(int*)b;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int main(){
	int i,a[5],p[5],q[5];
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
		p[i]=a[i]%10;
		if(p[i]==0){
			q[i]=a[i];
		}else{
			q[i]=a[i]-p[i]+10;
		}
		if(p[i]==0)p[i]=10;
	}
	qsort(p,5,sizeof(int),intsort);

	printf("%d",q[0]+q[1]+q[2]+q[3]+q[4]-10+p[0]);

	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define llong long long
using namespace std;

const int N = 2e5;
const int C = 2000;
const int P = 1e9+7;
llong a[N+3],b[N+3];
llong fact[N+3],finv[N+3];
llong dp[C+C+7][C+C+7];
int n;

llong quickpow(llong x,llong y)
{
	llong cur = x,ret = 1ll;
	for(int i=0; y; i++)
	{
		if(y&(1ll<<i)) {ret = ret*cur%P; y-=(1ll<<i);}
		cur = cur*cur%P;
	}
	return ret;
}
llong comb(llong x,llong y) {return x<0 || y<0 || x<y ? 0ll : fact[x]*finv[x-y]%P*finv[y]%P;}

int main()
{
	fact[0] = 1ll; for(int i=1; i<=N; i++) fact[i] = fact[i-1]*i%P;
	finv[N] = quickpow(fact[N],P-2); for(int i=N-1; i>=0; i--) finv[i] = finv[i+1]*(i+1)%P;
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d%d",&a[i],&b[i]);
	for(int i=1; i<=n; i++) dp[C-a[i]][C-b[i]] += 1ll;
	for(int i=1; i<=C+C; i++) dp[0][i] += dp[0][i-1];
	for(int i=1; i<=C+C; i++) dp[i][0] += dp[i-1][0];
	for(int i=1; i<=C+C; i++)
	{
		for(int j=1; j<=C+C; j++)
		{
			dp[i][j] = dp[i][j]+dp[i-1][j]+dp[i][j-1];
			dp[i][j] %= P;
		}
	}
	llong ans = 0ll;
	for(int i=1; i<=n; i++) ans = (ans+dp[C+a[i]][C+b[i]])%P;
	for(int i=1; i<=n; i++) ans = (ans-comb(a[i]+a[i]+b[i]+b[i],a[i]+a[i])+P)%P;
	ans = ans*(P+1)/2%P;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 131840
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,I##_N=N;I<I##_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  R(A)R(B)R(C)R(D);
  for(;;){
    if((C-=B)<=0){
      P("Yes");
      return 0;
    }
    if((A-=D)<=0){
      P("No");
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<int, pair < int, int > > PP;
typedef long long ll;
ll inf = -1;
ll mod = pow(10, 9) + 7;

int main() {
	int n,d;cin>>n>>d;
	double x[10][10];
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>x[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			double far=0;
			for(int k=0;k<d;k++){
				far+=pow(x[i][k]-x[j][k],2);
			}
			far=sqrt(far);
			if(ceil(far)==floor(far)){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=510,inf=1e9;
ll n,m,x,y,z,tot,ans;
ll f[maxn][maxn],v[maxn][maxn];
void read(ll &k)
{
	int f=1;k=0;char c=getchar();
	while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	read(f[i][j]),ans+=f[i][j];
	for(int k=1;k<=n;k++)
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		if(i==j||i==k||j==k)continue;
		if(f[i][k]+f[k][j]<f[i][j])return puts("-1"),0;
		if(f[i][k]+f[k][j]==f[i][j])v[i][j]=v[j][i]=1;
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	if(v[i][j])ans-=f[i][j];
	printf("%lld\n",ans>>1);
	return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 1000000007


int32_t main(){
    int n;cin>>n;
    int a[n+1];
    int b[n+1];
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    for(int i=n;i>=1;i--){
    	if(a[i]==1){
    		int c=0;
    		int j=2;
    		while(j*i<=n){
    			c+=b[j*i];
    			j++;
    		}
    		if(c%2==0){
    			b[i]=1;
    		}
    		else{
    			b[i]=0;
    		}
    	}
    	else{
    		int c=0;
    		int j=2;
    		while(j*i<=n){
    			c+=b[j*i];
    			j++;
    		}
    		if(c%2==0){
    			b[i]=0;
    		}
    		else{
    			b[i]=1;
    		}
    	}
    }
    int c=0;
    for(int i=1;i<=n;i++){
    	if(b[i]==1){
    		c++;
    	}
    }
    cout<<c<<endl;
    for(int i=1;i<=n;i++){
    	if(b[i]==1){
    		cout<<i<<" ";
    	}
    }
    cout<<endl;



    return 0;
}

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

x = list(map(int, input().split()))
ans = 10 ** 9
for i in range(len(x)-K+1):
  if x[i] > 0:
    ans = min(ans, x[i+K-1])
  elif x[i+K-1] < 0:
    ans = min(ans, abs(x[i]))
  else:
    ans = min(ans, min(abs(x[i]), abs(x[i+K-1])) + x[i+K-1]-x[i])
print (ans)

Measured memory_bytes: 14380
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

printList [a] = print a
printList (a:as) = putStr ( show a ) >> putChar ' ' >> printList as

main = do
	[ n, k ] <- readInts
	as <- readInts
	mapM_ putStrLn $ map ( which "Yes" "No" ) $ zipWith (<) as ( drop k as )

Measured memory_bytes: 27140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


Measured memory_bytes: 23764
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, y = ns()

    tmp = y // 1000 - n
    calc = lambda x, y: 9 * x + 4 * y

    for x in range(2000 + 1):
        for y in range(2000 + 1):
            if calc(x, y) == tmp:
                if n - x - y > -1:
                    print(x, y, n - x - y)
                    exit(0)

    print(-1,-1,-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5328
# coding:utf-8

import sys
from collections import defaultdict

input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N, P = inpl()


def prime_factorization(num):
    prime_cnt = defaultdict(int)

    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

    return prime_cnt


pcnt = prime_factorization(P)

ans = 1
for key in pcnt.keys():
    tmp = pcnt[key]
    while tmp >= N:
        ans *= key
        tmp -= N

print(ans)


Measured memory_bytes: 3444
#include <iostream>
using namespace std;
 
int main() {
	ios::sync_with_stdio(0),cin.tie(0);
	int n,len=0,result=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int temp;
		cin>>temp;
		len=max(len,temp);
		if(temp>=len)
			result++;
	}
	cout<<result<<endl;
}

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

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

bool isPrime(ll x) {
	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0)
			return false;
	}
	return true;
}

void solve() {
	ll a, b;
	cin >> a >> b;
	ll g = gcd(a, b);
	int cnt = 0;
	for (ll i = 1; i * i <= g; i++) {
		if (g % i == 0) {
			ll t = g / i;
			if (isPrime(i)) cnt++;
			if (isPrime(t) && t != i) cnt++;
		}
	}
	cout << cnt;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	for (int i = 1; i <= t; i++) {
		solve();
	}
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))
b = map(str, a)
print(' '.join(b))
for i in range(1, n):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j+1] = v
    b = map(str, a)
    print(' '.join(b))


Measured memory_bytes: 5596
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const int INF = 5000;

int main(){
  int x, n; cin >> x >> n;
  set<int> s;
  rep(i, n){
    int p; cin >> p;
    s.insert(p);
  }
  
  int ans = -INF;
  int a, b; a = b = x;
  if(!s.count(x)) ans = x;
  while(ans==-INF){
    a++, b--;
    if(!s.count(a)) ans = a;
    if(!s.count(b)) ans = b;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3636
fn lower_bound<T: std::cmp::Ord>(arr: &Vec<T>, b: T) -> usize {
    let (mut lt, mut ge) = (0, arr.len());
    // lt=-1にすると型強制しなきゃなのでここで確かめる
    if arr[lt] >= b {
        return 0;
    }
    while lt + 1 < ge {
        let m = (lt + ge) / 2;
        if arr[m] < b {
            lt = m;
        } else if arr[m] > b {
            ge = m;
        } else {
            return m;
        }
    }
    ge
}

fn main() {
    let n = read();
    let mut p: Vec<usize> = vec![];
    for _ in 0..n {
        p.push(read());
    }
    let mut memo = vec![1; n + 1];
    let mut q = vec![false; n + 1];
    for i in 0..n {
        q[p[i]] = true;
        if q[p[i] - 1] {
            memo[p[i]] = memo[p[i] - 1] + 1;
        }
    }
    // println!("{:?}", memo);
    let mut anss = 0;
    for m in memo {
        anss = max(anss, m);
    }
    println!("{}", n - anss);

    // let mut dp = vec![std::usize::MAX; n];
    // let mut ans = 0;
    // for i in 0..n {
    //     let b = lower_bound(&dp, v[i]);
    //     dp[b] = v[i];
    //     ans = max(ans, b + 1);
    // }
    // println!("{}", n - ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define mxn 300005
using namespace std;

int main()
{
    FLASH
    ll n;
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ll k = (n / i);
        ll m = (k * (k + 1)) / 2;
        ans += m * i;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3640
let _ = 
  let list_of_string str = 
    let l = String.length str in
    let rec iter i lst =
      if i >= l then lst
      else iter (i + 1) ((int_of_char str.[i] - 48) :: lst) in
    iter 0 [] in
  let add lst1 lst2 = 
    let rec iter rst = function
      | (0, [], []) -> rst
      | (_, [], []) -> 1 :: rst
      | (c, [], hd :: tl) -> iter (((c + hd) mod 10) :: rst) ((c + hd) / 10, [], tl)
      | (c, hd :: tl, []) -> iter (((c + hd) mod 10) :: rst) ((c + hd) / 10, tl, [])
      | (c, hd1 :: tl1, hd2 :: tl2) -> iter (((c + hd1 + hd2) mod 10) :: rst) ((c + hd1 + hd2) / 10, tl1, tl2) in
    iter [] (0, lst1, lst2) in
  let string_of_list lst =
    if List.length lst > 80 then "overflow"
    else List.fold_left (fun s i -> s ^ (string_of_int i)) "" lst in
  let n = Scanf.scanf "%d\n" (fun x -> x) in
  for i = 1 to n do
    let x = Scanf.scanf "%s\n" (fun s -> list_of_string s) in
    let y = Scanf.scanf "%s\n" (fun s -> list_of_string s) in
    Printf.printf "%s\n"  (string_of_list (add x y))
  done

Measured memory_bytes: 2468
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e12;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

int N;
int X[101010], L[101010];
vector<P> a;

void solve() {
    FOR(N)
    a.pb(P(X[i], L[i]));
    sort(all(a), [](P a, P b) { return a.first + a.second < b.first + b.second; });
    int ans = 0;
    int tmp = -1 * INF;
    FOR(N) {
        if (tmp <= a[i].first - a[i].second) {
            ans++;
            tmp = a[i].first + a[i].second;
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(N)
    cin >> X[i] >> L[i];
    solve();
    return 0;
}


Measured memory_bytes: 3956
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion

#pragma region Combination
const int MAX = 1000000;
const int MOD = 998244353;

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;
}
#pragma endregion

int main()
{
	int n; cin >> n;
	ll a, b, k; cin >> a >> b >> k;
	COMinit();
	ll res = 0;
	rep(i, n + 1)
	{
		ll tmp = k - (a*i);
		if (tmp%b == 0 && tmp / b <= n)
		{
			res += COM(n, i)*COM(n, tmp / b);
			res %= MOD;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    int a,b,h,m; cin >> a >> b >> h >> m;
    double th1, th2;
    th1 = 0.5*m+30*h; th2 = 6*m;
    double sa = abs((th1-th2)*3.14159265358979/180);
    double ans = sqrt(a*a+b*b-2*a*b*cos(sa));
    printf("%.10f\n", ans);
}

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

int main(){

  int d, l, cnt=0;

  cin>>d>>l;

  while(d){
    if(d>=l){
      d-=l;
      cnt++;
    }else{
      d--;
      cnt++;
    }
  }

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

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

int main() {
	int n, i, j, tmp, aa[10000];
	long long int sum = 0;
    scanf("%d", &n);
	for ( i = 0; i < n; i++){
		scanf("%d", &aa[i]);
	}
	for (i = 0; i < n; i++) {
		for ( j = i+1; j<n; j++){
			if (aa[i] > aa[j]){
				tmp = aa[i];
				aa[i] = aa[j];
				aa[j] = tmp;
			}
		}
	}
	for (i = 0; i < n; i++) {
		sum += aa[i];
	}
	printf("%d %d %ld\n", aa[0], aa[n - 1], sum);

	return 0;
}

Measured memory_bytes: 1856
# coding=utf-8
import math

root_three = math.sqrt(3)


def divide_segment(left, right):
    """divide segment

    Args:
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        divided points
    """
    delta_x_quarter = (right[0] - left[0]) / 3.0
    delta_y_quarter = (right[1] - left[1]) / 3.0

    delta_x_quarter_rotated = (delta_x_quarter - root_three * delta_y_quarter) / 2.0
    delta_y_quarter_rotated = (root_three * delta_x_quarter + delta_y_quarter) / 2.0

    s = [left[0] + delta_x_quarter, left[1] + delta_y_quarter]
    t = [left[0] + delta_x_quarter * 2.0, left[1] + delta_y_quarter * 2.0]
    u = [s[0] + delta_x_quarter_rotated, s[1] + delta_y_quarter_rotated]

    return s, t, u


def make_coch_curve(depth, left, right):
    """make coch curve with depth iteration_number between point left, right
    each vertices positions are printed

    Args:
        depth: depth
        left: left edge point
        right: right edge point

    Returns:
        None
    """
    print("{0:2.8f} {1:2.8f}".format(left[0], left[1]))
    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth - 1, left, right)


def make_coch_curve_recursively(depth, left, right):
    """recursion part of coch curve

    Args:
        depth: depth
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        None
    """
    # get coordinate of divided points
    s, t, u = divide_segment(left, right)

    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(s[0], s[1]))
        print("{0:2.8f} {1:2.8f}".format(u[0], u[1]))
        print("{0:2.8f} {1:2.8f}".format(t[0], t[1]))
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth - 1, left, s)
        make_coch_curve_recursively(depth - 1, s, u)
        make_coch_curve_recursively(depth - 1, u, t)
        make_coch_curve_recursively(depth - 1, t, right)


def main():
    depth = int(input().strip())
    make_coch_curve(depth, left=[0.0, 0.0], right=[100.0, 0.0])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7868
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N;
    cin>>N;
    vector<ll> even, odd;
    ll se = 0;
    ll so = 0;
    int cnt = 0;
    rep(i, 17) {
        se += pow(4, i);
        even.push_back(se);
        so -= pow(4, i) * 2;
        odd.push_back(so);
    }
    reverse(even.begin(), even.end());
    even.push_back(0);
    reverse(odd.begin(), odd.end());
    odd = vector<ll>(odd.begin() + 1, odd.end());
    odd.push_back(0);
    bool flag = false;
    rep(i, 33) {
        if (i % 2 == 0 && N <= even[i / 2] && N > even[i / 2 + 1]) {
            cout<<1;
            N -= even[i / 2] - even[i / 2 + 1];
            flag = true;
        }
        else if (i % 2 != 0 && N >= odd[i / 2] && N < odd[i / 2 + 1]) {
            cout<<1;
            N -= odd[i / 2] - odd[i / 2 + 1];
            flag = true;
        }
        else if (!flag) continue;
        else cout<<0;
    }
    if (!flag) cout<<0;
    cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
  ll a,b,c,d,e,f,g,h;
  cin>>a>>b>>c>>d>>e>>f>>g>>h;
  cout<<max(a+b+c+d,e+f+g+h)<<endl;
  return 0;
}


Measured memory_bytes: 3092
#include <iostream>

using namespace std;

int main(){

    int a , b, c;
    cin >> a >> b >> c;
    int d;
    if(a+b+1<c){
        d=a+b+1;
    }else{
        d=c;
    }
    cout << b+d << endl;
    return 0;
    }


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main(){
	int n,m;
	cin >> n >> m;
	vector<ll> x(n+1),y(m+1);
	for(int i=1;i<=n;i++){
		cin >> x[i];
	}
	for(int i=1;i<=m;i++){
		cin >> y[i];
	}
	ll ans=0;
	ll X=0,Y=0;
	for(int i=1;i<=n;i++){
		X+=(i-1)*x[i]-(n-i)*x[i];
		X%=MOD;
	}
	for(int i=1;i<=m;i++){
		Y+=(i-1)*y[i]-(m-i)*y[i];
		Y%=MOD;
	}
	ans=X*Y%MOD;
	cout << ans << endl;
}


Measured memory_bytes: 1792
let line = readLine()!.split(separator: " ").map{Int($0)!}
var count = 0
for i in line[0] ... line[1] {
  let numArr = Array(String(i))
  if (numArr[0] == numArr[4]) && (numArr[1] == numArr[3]) {
    count += 1
  }
}
print(count)

Measured memory_bytes: 8276
import heapq
n, m = map(int, input().split())
lr = []
heap1 = []
heap2 = []
for i in range(m):
    lr.append(list(map(int, input().split())))
for j in range(m):
    heapq.heappush(heap1, -lr[j][0])
    heapq.heappush(heap2, lr[j][1])
d = heapq.heappop(heap2) + heapq.heappop(heap1) +1 
if d < 0:
    print(0)
else:
    print(d)

Measured memory_bytes: 32304
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
  int n;
  cin >> n;
  string* s = new string[100];
  for(int i=0;i<n;i++){
    cin >> s[i];
    for(int j=0;j<i;j++){
      if(s[i]==s[j]){
        cout << "No" << endl;
        return 0;
      }
    }
    if(i!=0 && s[i-1][s[i-1].length()-1]!=s[i][0]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int MAX { 3010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll st[MAX][MAX];

ll dp(int i, int t, int N, const vector<ii>& xs)
{
    if (i == N or t <= 0)
        return 0;

    if (st[i][t] != -1)
        return st[i][t];

    auto res = max(dp(i + 1, t, N, xs), dp(i + 1, t - xs[i].first, N, xs) + xs[i].second);

    st[i][t] = res;
    return res;
}

ll solve(int N, int T, vector<ii>& xs)
{
    /*sort(xs.begin(), xs.end(), [](const ii& x, const ii& y) {
        if (x.second == y.second)
            return x.first < y.first;

        return x.second > y.second;
    }); */
    sort(xs.begin(), xs.end());

#ifdef DEBUG
    cout << "xs = ";
    for (auto [a, b] : xs)
        cout << "(" << a << ", " << b << ") ";
    cout << endl;
#endif

    memset(st, -1, sizeof st);

    return dp(0, T, N, xs);
}

int main()
{
    ios::sync_with_stdio(false);

    int N, T;
    cin >> N >> T;

    vector<ii> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i].first >> xs[i].second;

    auto ans = solve(N, T, xs);

    cout << ans << '\n';

    return 0;
}


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

int main() {
	int N,T,A;
  	cin >> N >> T >> A;
  
  	vector<double> h(N);
  	for(int i = 0; i < N; i++) {
      	int H;
      	cin >> H;
    	double tmp = T - H * 0.006;
      	h.at(i) = abs(A - tmp);
    }
  
  	vector<double> ans(N);
  	for(int i = 0; i < N; i++) {
    	ans.at(i) = h.at(i);
    }
  
  	sort(h.begin(),h.end());
  	
  	for(int i = 0; i < N; i++) {
    if(ans.at(i) == h.at(0)) {
    	cout << i + 1 << endl;
      	break;
    	}
    }
  
  	
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
int main(){
    string a,b;
    cin>>a>>b;
    cout<<b<<a<<endl;
}


Measured memory_bytes: 256