akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	if a <= b && b <= c {
		fmt.Println(a, b, c)
	} else if a <= c && c <= b {
		fmt.Println(a, c, b)
	} else if b <= a && a <= c {
		fmt.Println(b, a, c)
	} else if b <= c && c <= a {
		fmt.Println(b, c, a)
	} else if c <= a && a <= b {
		fmt.Println(c, a, b)
	} else if c <= a && b <= a {
		fmt.Println(c, b, a)
	}
}



Measured memory_bytes: 1160
import java.util.*;
public class Main{
  public static void main(String[] args) {
    //入力
    Scanner sc = new Scanner(System.in);
//全体の個数
long N =sc.nextLong();
//Aは青の個数
long A =sc.nextLong();
//Bは赤の個数
long B =sc.nextLong();
//カウント変数
long cnt = 0;
//青と赤のセットの数
long set = (long)(N/(A+B));
cnt = set*A;
if(N%(A+B) == 0){
  System.out.println(cnt);
}else{
  //セットを並べたときの個数
  long ball =set*(A+B);
  if(N-ball >= A){
    System.out.println(cnt+A);
  }else{
    System.out.println(cnt+(N-ball));
  }
  
}

}

}


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

using namespace std;

int main()
{
    int n, m;

    map<string, int> mp;

    cin >> n;
    string s[n];
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (mp.find(s[i]) != mp.end()) mp[s[i]]++;
        else mp.insert(make_pair(s[i], 1));
    }

    cin >> m;
    for (int i = 0; i < m; i++) {
        string t;
        cin >> t;
        if (mp.find(t) != mp.end()) mp[t]--;
    }

    int ans = 0;
    for (auto x : mp) cerr << x.first << " " << x.second << endl, ans = max(ans, x.second);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n,y = map(int,input().split())

for i in range(n+1):
	for j in range(n-i+1):
		if i * 10000 + j * 5000 + (n-i-j) * 1000 == y:
			print(i,j,n-i-j)
			exit()

print(-1,-1,-1)

Measured memory_bytes: 3060
//
//  main.cpp
//  B - Resistors in Parallel
//
//  Created by Hashizo on 2019/08/18.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef LONG_MAX
#undef LONG_MIN

#define LONG_MAX	9223372036854775807
#define LONG_MIN	(-LONG_MAX  -1)

#define ll long long

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {
	double pulus = 0.0;
	ll n;
	cin >> n;

	double a;
	REP(i, n) {
		cin >> a;
		pulus = pulus + (1/a);
	}

	
	cout << 1/pulus << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct rewrite{
    int b;  // 操作するカード枚数の上限.
    LL  c;  // 書き換え後の整数.
    bool operator < (const rewrite& rhs) const{
        if(c > rhs.c) return true;
        else          return false;
    }
};
vector<rewrite> R;

int main() {
    
    // 1. 入力情報取得.
    int N, M;
    scanf("%d %d", &N, &M);
    LL ans = 0, A[N];
    for(int i = 0; i < N; i++) scanf("%lld", A + i), ans += A[i];
    for(int i = 0; i < M; i++){
        rewrite r;
        scanf("%d %lld", &r.b, &r.c);
        R.push_back(r);
    }
    
    // 2. 昇順sort.
    sort(A, A + N);
    
    // 3. 降順sort.
    sort(R.begin(), R.end());
    
    // 4. カードの書き換え作業.
    // なるべく小さいカードA[i]を, なるべく大きい整数 C[j] に, 書き換える.
    int index = 0;
    for(auto &r : R){
        // 4-1. index ～ (index + r.b)番目 までで, 書き換えるか確認.
        int upper = min(N, index + r.b);
        for(int i = index; i < upper; i++){
            // A[i] と比較し, C[j] が 大きければ, 書き換える.
            // C[j] が 小さければ, 書き換えを終了.
            if(A[i] < r.c) ans += r.c - A[i];
            else           break;
        }

        // 4-2. 次の整数 C[j] に書き換えるための準備.
        index += r.b;
        
        // 4-3. index が N以上 ならば, 書き換え出来ないので終了.
        if(index >= N) break;
    }

    // 5. 出力 ～ 後処理.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
	int w, a, b;
	scanf("%d %d %d", &w, &a, &b);
	if (a < b)
	{
		if (a + w < b)
			printf("%d\n", b - a - w);
		else
			printf("0\n");
	}
	else
	{
		if (b + w < a)
			printf("%d\n", a - b - w);
		else
			printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <vector>

struct Game {
    int M;
    int N;
    int P;
    std::vector<int> betNum;
};

void cost(Game game); 

int main(void) {
    int M;
    int N;
    int P;
    do {
        Game game;
        std::cin >> game.M >> game.N >> game.P;

        if (game.M == 0 && game.N == 0 && game.P == 0) {
            break;
        }

        for (int i = 0; i < game.M; i++) {
            int num;
            std::cin >> num;
            game.betNum.push_back(num); 
        }
        cost(game);

    } while (1);
    return EXIT_SUCCESS;
}

void cost(Game game) {
    int total = 0;
    std::vector<int> v = game.betNum;
    for (int i = 0; i < (int)(v.size()); i ++) {
        total += v[i]; 
    }
    int winner = v[game.N - 1];
    if (winner == 0) {
        std::cout << "0" << std::endl;
    } else {
        std::cout << 100 * total * (100 - game.P) / 100 / winner << std::endl;
    }
    return;
}

Measured memory_bytes: 3088
#include <iostream>
#include<vector>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
unordered_set<string> set1;
unordered_set<string> set2;
void expand(string str, int low, int high, auto &set)
{
	while (low >= 0 && high < str.length()&& str[low] == str[high])
	{	
		set.insert(str.substr(low, high - low + 1));
		low--, high++;
	}
}

void all1(string str)
{
	for (int i = 0; i < str.length(); i++)
	{
		
		expand(str, i, i, set1);
		expand(str, i, i + 1, set1);
	}

}
void all2(string str)
{
	for (int i = 0; i < str.length(); i++)
	{
		
		expand(str, i, i, set2);
		expand(str, i, i + 1, set2);
	}

}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int res=0;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            res+=a[i]*a[j];
        }
    }
    cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		List<Integer> S = new ArrayList<>(Arrays.asList(14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14));
		List<Integer> H = new ArrayList<>(Arrays.asList(14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14));
		List<Integer> C = new ArrayList<>(Arrays.asList(14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14));
		List<Integer> D = new ArrayList<>(Arrays.asList(14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14));

		int n = scane.nextInt();

		String M = "";
		int num = 0;

		for (int i = 0; i < n; i++) {
			M = scane.next();
			num = scane.nextInt();

			switch (M) {
			case "S":
				S.set(num - 1, num);
				break;
			case "H":
				H.set(num - 1, num);
				break;
			case "C":
				C.set(num - 1, num);
				break;
			case "D":
				D.set(num - 1, num);
				break;

			default:
				break;
			}
		}
		for (int i = 0; i < 13; i++) {
			if ((i+1) == S.get(i)) {

			} else {
				System.out.println("S" + " " + (i+1));
			}

		}
		for (int i = 0; i < 13; i++) {
			if (i+1 == H.get(i)) {

			} else {
				System.out.println("H" + " " + (i+1));
			}

		}
		for (int i = 0; i < 13; i++) {
			if (i+1 == C.get(i)) {

			} else {
				System.out.println("C" + " " + (i+1));
			}

		}
		for (int i = 0; i < 13; i++) {
			if ((i+1) == D.get(i)) {

			} else {
				System.out.println("D" + " " + (i+1));
			}

		}


	}
}

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

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

    int a;
    vector<int> v(n, 0);
    for (int i=0; i<n; i++){
        cin >> a;
        a--;
        v.at(a)++;
    }

    int c = 0;
    for (int i=0; i<n; i++){
        if (v.at(i) != 0) c++;
    }


    int ans = 0;
    int c_erase = 0;
    if (c > k){
        sort(v.begin(), v.end());
        for(int i=0; i<n; i++){
            if (c_erase == c-k) break;
            if (v.at(i) != 0){
                ans += v.at(i);
                c_erase++;
            }
        }
        cout << ans << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


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

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

    int n, x, y;
    cin >> n >> x >> y;
    x--, y--;
    vector<vector<int>> adj(n);
    for (int i = 0; i < n - 1; i++) {
        adj[i].push_back(i + 1);
        adj[i + 1].push_back(i);
    }
    adj[x].push_back(y);
    adj[y].push_back(x);

    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        vector<int> dist(n, 1e9);
        queue<int> que;
        que.push(i);
        dist[i] = 0;
        while (!que.empty()) {
            int t = que.front();
            que.pop();
            for (int a : adj[t]) {
                if (dist[t] + 1 < dist[a]) {
                    dist[a] = dist[t] + 1;
                    que.push(a);
                }
            }
        }
        // for (int j = 0; j < n; j++) {
        //     cout << dist[j] << ' ';
        // }
        // cout << endl;
        for (int j = i + 1; j < n; j++) {
            ans[dist[j]]++;
        }
    }
    for (int i = 1; i < n; i++) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 384
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);

//番号ズレ注意！！
int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int minx = 0, miny = 0, maxx = W, maxy = H;
    REP(i, N) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) { minx = max(minx, x); }
        if (a == 2) { maxx = min(maxx, x); }
        if (a == 3) { miny = max(miny, y); }
        if (a == 4) { maxy = min(maxy, y); }
    }
    if (maxx <= minx || maxy <= miny) { print(0); }
    else {
        print((maxx - minx) * (maxy - miny));
    }
}


Measured memory_bytes: 256
n = int(input())
al = list(map(int, input().split()))

num = [0] * (10**5+1)

for a in al:
    num[a] += 1

ans = 0
for i in range(10**5+2):
    x_cnt = sum(num[i-1:i+2])
    ans = max(ans, x_cnt)

print(ans)

Measured memory_bytes: 13964
#include <bits/stdc++.h>//toINFandByd
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    int n,m;
    ll k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    forn(i,n) cin >> a[i];
    vector<ll> b(m);
    forn(i,m) cin >> b[i];
    int i,j;
    ll suma = 0;
    for(i=0;i<n;i++)
        suma+=a[i];
    for(i=n-1;i>=0;i--){
        if(suma<=k){
            break;
        }
        suma-=a[i];
    }
    int ans = i+1;
    int max_ans = ans;
    j = 0;
    while(j<m){
        if(suma+b[j]<=k){
            ans++;
            suma+=b[j];
            j++;
        }
        else{
            max_ans = max(max_ans,ans);
            if(i>=0){
                suma-=a[i];
                i--;
                ans--;
            }
            else{
                break;
            }
        }
    }
    max_ans = max(max_ans,ans);
    cout << max_ans << endl;
}   

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 6372
a, b, c, x, y = list(map(int, input().split()))
n = [0, 0, 0]
n[0] = a*x+b*y
if x<=y:
    n[1] = 2*c*x+b*(y-x)
else:
    n[1] = 2*c*y+a*(x-y)
n[2] = 2*c*max(x, y)
print(min(n))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<deque>
#include<cstring>
#include<climits>
#include<cassert>
#include<cctype>

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

using namespace std;

int main() {
  map<int,int> mp;
  rep(i,9) rep(j,9) {
    mp[i] = (int)mp.size();
    cout << i+1 << 'x' << j+1 << '=' << (i+1)*(j+1) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2920
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
#include<cmath>
#include<set>
using namespace std; 


int main()
{

	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	vector<int> f(n) ;
	int s = 0;
	set<int> p;

	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
		f.at(i) = 0;
		p.insert(a.at(i));
	}
	for (int i = 0; i < n; i++)
	{
		f.at(a.at(i) - 1)++;
	}
	sort(f.begin(), f.end());
	int x = p.size();
	int ans = 0;
	if (x <= k)
	{
		cout << 0 << endl;
	}
	
	else
	{
		for (int i = 0; i < n; i++)
		{
			if (f.at(i) != 0)
			{
				x--;
				ans += f.at(i);
				if (x <=k)
				{
					cout << ans << endl;
					return 0;
				}
			}

		}
	}

	

}

Measured memory_bytes: 11136
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define F first
#define S second
#define EPS 1e-10
using namespace std;
typedef pair<string,double> Pos;

bool cmp_P(const Pos &a, const Pos &b){
  if(fabs(a.S-b.S) < EPS)return a.F < b.F;
  return a.S > b.S;
}


int main(){
  int n,P,A,B,C,D,E,F,S,M;
  string L;
  double res;
  vector<Pos> vec;    
  while(cin >> n && n){
    vec.clear();
    for(int i=0;i<n;i++){
      cin >> L >> P >> A >> B >> C >> D >> E  >> F >> S >> M;
      A=A+B+C+D+E;
      A=A+(D+E)*(M-1); 
      F=F*M*S-P;
      res = (double)((double)F/(double)A);
      vec.push_back(Pos(L,res));
    }

    sort(vec.begin(),vec.end(),cmp_P);
    for(int i=0;i<n;i++){
      cout << vec[i].F << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>

int main(void)
{
	int H = 0;
	int W = 0;
	int N = 0;

	int yoko = 0;
	int tate = 0;

	int i = 0;

	while (1)
	{
		scanf("%d %d %d", &H, &W, &N);

		if (1 <= H || H <= 100) {
			if (1 <= W || W <= 100) {
				if (1 <= N || N <= H * W) {
					break;
				}
			}
		}
	}

	while (yoko < N && tate < N) {
		yoko += H;
		tate += W;

		i++;
	}

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

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MAXINT=2100000000;
int main()
{
	int minn=MAXINT;
	int n,k,i,to=0,ans;
	cin>>n>>k;
	k--;
	int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		minn=min(minn,a[i]);
	}
	for(i=0;i<n;i++)
		if(a[i]!=minn) to++;
	ans=to/k;
	if(to%k!=0) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

const int mod=1e9+7;
const int inf=-1;
const int sz=2e5;

#define pi acos(-1)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define gap ' '
#define lb lower_bound
#define ub upper_bound
#define clr(x) memset(x,0,sizeof(x))
#define all(x) sort(x.begin(),x.end())
#define rall(x) reverse(x.begin(),x.end())
#define dbg puts("finding wrong")
#define case(x,y) printf("Case %lld: %lld\n",++x,y)
#define fastio ios::sync_with_stdio(false);cin.tie(0)

const int m=1e6;
vector <int> prime;
bool sieve[m+2];
 
void primeSieve () {
    memset(sieve, true, sizeof(sieve));
 
    sieve[0]=sieve[1]=false;
 
    prime.push_back(2);
    for (int i = 4; i <=m; i += 2 ) sieve[i]=false;
 
    int sqrtn = sqrt (m);
    for ( int i = 3; i <= sqrtn; i += 2 ) {
        if (sieve[i]) {
            for (ll j = i * i; j <=m; j += 2 * i ) sieve[j]=false;
        }
    }
 
    for ( int i = 3; i <=m; i += 2 ) if (sieve[i]) prime.push_back(i);
}


int ar[sz];

int main()
{
  primeSieve();
  fastio;
  ll t, a, b, c, ans=1, i, n;
  
  cin>>n;
  
  for(i=0; i<prime.size(); i++)
  {
      ll res=0;
      a=n;
      if(prime[i]>n)break;
      while(a>0)
      {
          res+=(a/prime[i]);
          res=res%mod;
          a/=prime[i];
      }
      ans=(ans%mod*(res+1))%mod;
  }
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 4724
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

using VL = vector<long long>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;

const int mod = 1e9 + 7;

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

	vector<int> a(n + 1, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	VVL dp(n + 1, VL(k + 1, 0)); // i-1番目の人までみたときに、飴を全部でj個配ってる状態の数
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		long long add = 0;
		for (int j = 0; j <= k; j++) {
			add += dp[i][j];
			// printf("%d %d: add %lld\n", i, j, add);

			if (j >= a[i] + 1) {
				add -= dp[i][j - a[i] - 1];
				if (add < 0) {
					add += mod;
				}
			}

			dp[i+1][j] += add;
			dp[i+1][j] %= mod;
			// printf("  -> %lld\n", dp[i+1][j]);

		}
	}

	// printf("----\n");
	// for (int i = 0; i <= n; i++) {
	// 	printf("%2d: ", i);
	// 	for (int j = 0; j <= k; j++) {
	// 		printf("%3lld ", dp[i][j]);
	// 	}
	// 	printf("\n");
	// }

	cout << dp[n][k] << endl;
	return 0;
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if( a < b && a < c){
        //cout << "a ";
        if( b < c ){
            cout << a << " " << b << " "  << c << endl;
        }else{
            cout << a << " " << c << " "  << b << endl;
        }
    }else if( b < a && b < c ){
        //cout << "b " << endl;
        if( a < c ){
            cout << b << " " << a << " "  << c << endl;
        }else{
            cout << b << " " << c << " "  << a << endl;
        }
    }else{
        //cout << "c " << endl;
        if( b < a ){
            cout << c << " " << b << " "  << a << endl;
        }else{
            cout << c << " " << a << " "  << b << endl;
        }
    }
}

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

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

    for (int i = 0; i < s.length()+1; i += 2) {
        if (s[i] == 'L' || s[i+1] == 'R') {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 3532
import java.io.*;
import java.util.*;

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

int sec, min, hour;
hour = se/3600;
min =(se%3600)/60;
sec = se % 60;

System.out.println(hour+":"+min+":"+sec);

    }
}


Measured memory_bytes: 26416
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define f first
#define s second
#define inf 1000000007

ll N;
ll ans = 0;
ll prime[100] = {0};
vector<ll> Prime;

void primef(ll n){
    repi(i,2,n+1){
        ll cnt = 0;
        if (n % i == 0){
            while(n % i == 0){
                cnt ++;
                n = n/i;
            }
        }
        prime[i] +=cnt;
    }
    return;
}

int main() {
    cin >> N;
    repi(i,2,N+1) primef(i);
    repi(i,1,100){
        if (prime[i] != 0) Prime.push_back(prime[i]);
    }
    ll size = Prime.size();
    rep(i,size){
        if (Prime[i] >= 74) ans++;
    }
    rep(i,size-1){
        repi(j,i+1,size){
            if (Prime[i] >= 2 && Prime[j] >= 24) ans++;
            if (Prime[i] >= 24 && Prime[j] >= 2) ans++;
            if (Prime[i] >= 4 && Prime[j] >= 14) ans++;
            if (Prime[i] >= 14 && Prime[j] >= 4) ans++;
        }
    }
    rep(i,size-2){
        repi(j,i+1,size-1){
            repi(k,j+1,size){
                if ((Prime[i] >= 2 && Prime[j] >= 4) && Prime[k] >= 4) ans++;
                if ((Prime[i] >= 4 && Prime[j] >= 2) && Prime[k] >= 4) ans++;
                if ((Prime[i] >= 4 && Prime[j] >= 4) && Prime[k] >= 2) ans++;
                
            }
        }
    }
    

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int N, M, S, G1, G2;
    while (1)
    {
        cin >> N >> M >> S >> G1 >> G2;
        if (N == 0)
            break;
        S--, G1--, G2--;
        int d[110][110];
        rep(i, N) rep(j, N) d[i][j] = INF;
        rep(i, N) d[i][i] = 0;
        rep(i, M)
        {
            int a, b, c;
            cin >> a >> b >> c;
            a--, b--;
            d[a][b] = c;
        }
        rep(k, N) rep(i, N) rep(j, N) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        int ans = INF;
        rep(i, N) ans = min(ans, d[S][i] + d[i][G1] + d[i][G2]);
        cout << ans << endl;
    }
}


Measured memory_bytes: 3124
/* 拡張ダイクストラ */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    int a, b, k;
    cin >> k >> a >> b;
    REPN(i, a, b+1) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        } 
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3640
# include <bits/stdc++.h>
/// my holy template
# define F first    
# define S second
# define mp make_pair
# define pii pair<int,int>         
/// eveything goes according to plan
# define long long long  
# define pb push_back
# define sz(a) (int)(a.size())
/// countdown BEGAN. 10 , 9 , 8 ...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right     

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 9223372036854775807;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm("rdtsc" : "=A"(seed));
  srand(seed);
}
int n;

int p[Sz];

inline bool can (int i, int j) {
  return (p[i] != j && p[j] != i);
}
                              
int main() 
{
  Read_rap ();
  cin >> n;      
  for (int i = 1;i <= n;i ++) cin >> p[i];

  int ans = 0;
  for (int i = 1;i <= n;i ++) {
    if (p[i] == i) {
      if (i + 1 <= n && can (i, i + 1))
        swap (p[i], p[i + 1]), ans ++;
      else  if (i >= 1 && can (i, i - 1))
        swap (p[i], p[i - 1]), ans ++;
      else  
        assert (0);
    }
  }
  cout << ans;      
            
  return 0;
} 










// Coded by Z...

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double

int ans=0;

int32_t main()
{
	IOS
	int n,w;cin>>n>>w;
	vector<int>W(n),V(n);
	for(int i=0;i<n;i++)cin>>W[i]>>V[i];
	vector<int>dp(w+1);
	
	for(int i=0;i<n;i++)
	{
		//why two dps are takne ? because every w get included maximum 1 times.
		vector<int>dp2=dp;
		for(int j=0;j<=w;j++)
		{
			if( j+W[i] <= w  )dp2[j+W[i]]=max(dp2[j+W[i]],dp[j]+V[i]);
		}
		dp=dp2;
	}
	cout<<dp[w]<<endl;
	
}
			
	
	
	
	
	

	

	

	
		


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

int main(){
    int n; cin >> n;
    vector<ll> a(n+1), b(n);
    rep(i,n+1) cin >> a[i]; rep(i,n) cin >> b[i];
    ll ans = 0;
    rep(i,n) {
        if(b[i] >= a[i]){
            ans += a[i];
            b[i] -= a[i];
        }else{
            ans += b[i];
            b[i] = 0;
        }
        if(b[i] >= a[i+1]){
            ans += a[i+1];
            a[i+1] = 0;
        }else{
            ans += b[i];
            a[i+1] -= b[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4752
#include <algorithm>
#include <iostream>
#include <vector>

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

int main() {

  while (true) {
    int n, m, s, g1, g2;
    cin >> n >> m >> s >> g1 >> g2;
    if (n == 0) break;
    const int inf = 100000000;
    vector<vector<int>> d(n, vector<int>(n, inf));
    rep(i, n) d[i][i] = 0;
    rep(i, m) {
      int a, b, c;
      cin >> a >> b >> c;
      d[a - 1][b - 1] = c;
    }
    rep(k, n) rep(i, n) rep(j, n) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    auto mn = inf;
    rep(i, n) { mn = min(mn, d[s - 1][i] + d[i][g1 - 1] + d[i][g2 - 1]); }
    cout << mn << endl;
  }

  return 0;
}



Measured memory_bytes: 3152
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int d = a / b;
		int r = a % b;
		double f = (double)a / (double)b;
		System.out.println(d + " " + r + " " + String.format("%8f",f));
	}
}


Measured memory_bytes: 26412
#include <iostream>
#include <algorithm>
using namespace std;
int a[10001];
int n, m;
int main()
{
   cin >> n >> m;
   for(int i = 0 ; i < n; i++)
       cin >> a[i];
   sort(a, a + n);
   long long cnt = 0;
   for(int i = 0; i < m; i++)
   {
       cnt += a[i];
   }
   cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3640
import sys

input = sys.stdin.readline


def main():
    K = int(input())

    n_odd = 0
    n_even = 0
    for i in range(1, K + 1):
        if i % 2 == 0:
            n_even += 1
        else:
            n_odd += 1
    ans = n_odd * n_even

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int daishou[200002];

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


	int N = getint();
	int A[200001];
	rep1(i, N) A[getint()] = i;

	ll kotae = 0;
	for (int i = N; i > 0; i--) {
		int a = A[i];
		int l = daishou[a - 1];
		int r = daishou[a + 1];
		if (!l && !r) {
			daishou[a] = a;
			kotae += i;
		}
		else if (!r) {
			daishou[l] = a;
			daishou[a] = l; 
			kotae += (ll)(a - l + 1) * i;
		}
		else if (!l) {
			daishou[r] = a;
			daishou[a] = r;
			kotae += (ll)(r - a + 1) * i;
		}
		else {
			daishou[l] = r;
			daishou[r] = l;
			kotae += (ll)(a - l + 1) * (r - a + 1) * i;
		}
	}

	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    cout << n * (n - 1) / 2;
}


Measured memory_bytes: 256
N = int(input())
ar = []
br = []
cr = []
for i in range(N):
    l = input()
    ar.append(l)
    cr.append(l)
M = int(input())
for i in range(M):
    l = input()
    br.append(l)
    cr.append(l)
dr = set(cr)
er = [0]
for d in dr:
    count = 0
    if d in ar:
        count += ar.count(d)
    if d in br:
        count -= br.count(d)
    er.append(count)
print(max(er))

Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    
    int n;
    cin >> n;
    map<string,int> m;
    
    int x = 0;
    rep(i,0,n){
	string g;
	cin >> g;
	m[g]++;
	x = max(x,m[g]);
    }
    
    for(auto i:m){
	if(x == i.sd){
	    P(i.ft);
	}
    }
    return  0;
}


Measured memory_bytes: 25216
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
//#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, M;
	cin >> N >> M;
	vector<int>k(M), p(M);
	vector<vector<int>>s(M);
	vector<bool>swi(N);
	int cnt;
	int ans = 0;
	rep(i, M)
	{
		cin >> k[i];
		rep(j, k[i])
		{
			int num;
			cin >> num;
			s[i].push_back(num);
		}
	}
	rep(i, M)cin >> p[i];
	for (int i = 0; i < (1 << N); i++)   // 全探索
	{
		for (int j = 0; j < N; j++)   // onなら1offなら0
		{
			swi[j] = (i >> j) & 1;
		}
		for (int j = 0; j < M; j++)    // M個の電球,余り精査
		{
			cnt = 0;
			for (int l = 0; l < k[j]; l++)
			{
				cnt += swi[s[j][l] - 1];
			}
			if (p[j] != cnt % 2)j = M;
			if (j == M - 1)ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int K, X;
  cin>>K>>X;

  for(int i = X - K + 1; i < X + K;i++){
    if(i != X - K + 1) cout<<" ";
    cout<<i;
  }
  cout<<endl;


  return 0;
}


Measured memory_bytes: 256
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 static int a_dist[];
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        
	        int N = sc.nextInt();
	        int M = sc.nextInt();
	        int[] a = new int[M];
	        int[] b = new int[M];
	        for (int i=0 ; i<N; i++)list.add(new ArrayList<Integer>());
	        for (int i=0 ; i<M; i++) {
	            a[i] = sc.nextInt()-1;
	            b[i] = sc.nextInt()-1;
	        	list.get(a[i]).add(b[i]);
	        	list.get(b[i]).add(a[i]);	            
	        }
	        
	        long cnt=(long)N*(N-1)/2;
	        long[] ans = new long[M];
	        ans[M-1]=cnt;
	        Unionfind u = new Unionfind(N);
	        for(int i=M-1;i>=1;i--) {
	        	if(!u.same(a[i],b[i])) {
	        		cnt=cnt-u.getSize(a[i])*u.getSize(b[i]);
	        		u.union(a[i],b[i]);
	        	}
	        	ans[i-1]=cnt;
	        }
	        for(int i=0;i<M;i++) {
	        	System.out.println(ans[i]);
	        }
		 }
		 
	}

	 class Unionfind {
		 
			private int[] data;
			private int []size;
			
			public Unionfind(int size) {
				this.data = new int [size];
				this.size = new int [size];
				for(int i = 0 ;i < size ;i++) {
					initnode(i);
				}
				clear();
			}
			
			public void initnode(int i) {
				size[i] = 1;
			}
			
			public void clear() {
				Arrays.fill(data, -1);
			}
			
			public void union(int x , int y ) {
				if((x = root(x)) != (y = root(y))) {
					if(data[y] < data[x]) {
						final int t = x;
						x = y;
						y = t;
					}
					data[x] += data[y];
					size[root(x)] += size[root(y)];
					data[y] = x;
				}
			}
			
			public int getSize(int i) {
				return size[root(i)];
			}
			
			public int root(int x) {
				if(data[x] < 0) {
					return x;
				}
				else {
					return data[x] = root(data[x]);
				}
			}
			
			public boolean same(int x, int y) {
				return root(x) == root(y);
			}
			
		}

Measured memory_bytes: 77124
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] data = br.readLine().split(" ");
    br.close();
    long n = Long.parseLong(data[0]);
    long a = Long.parseLong(data[1]);
    long b = Long.parseLong(data[2]);
    long answer = n / (a + b) * a;
    answer += Math.min(a, n % (a + b));
    System.out.println(answer);
  }
}


Measured memory_bytes: 32572
H, W = map(int, input().split())
a = [0 for _ in range(H)]
for i in range(H):
    a[i] = list(map(str, input().split()))
    a[i].insert(0, '#')
    a[i].append('#')
line = ['#'] * (W + 2)
print(''.join(line))
for i in range(H):
    print(''.join(a[i]))
print(''.join(line))


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

#define INF INT_MAX/2
#define MOD 1000000007

using namespace std;

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

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

   int N,A;
   cin>>N>>A;
   cout<<N*N-A<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int n;

void solve(){
  int ans=0;
  string f;
  bool right=false,left=false;
  bool up=true;
  rep(i,n){
    cin>>f;
    if(f=="lu")left=true;
    else if(f=="ru")right=true;
    else if(f=="ld")left=false;
    else if(f=="rd")right=false;
    if(debug)cout<<up<<" "<<right<<" "<<left<<endl;
    if(up&&right&&left){ans++;up=false;}
    if(!up&&!right&&!left){ans++;up=true;}
  }
  cout<<ans<<endl;
}

int main(){
  while(cin>>n){
    if(n==0)break;
    solve();
  }
  return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<vector<int>> A(2, vector<int>(N, 0));

	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cin >> A[i][j];
		}
	}

	int upperSum = A[0][0];
	int lowerSum = 0;
	for (int i = 0; i < N; i++)
	{
		lowerSum += A[1][i];
	}

	int result = upperSum + lowerSum;

	for (int i = 1; i < N; i++)
	{
		upperSum += A[0][i];
		lowerSum -= A[1][i - 1];

		result = max(result, upperSum + lowerSum);
	}

	cout << result;
	
	return 0;
}


Measured memory_bytes: 3652
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

class Main{
    public static void main(String[] args) throws IOException {
        int num = receiveInt();
        char[] inputs = receiveCharArray();

        int flag = -1;
        int ans = 0;
        for(int i = 0; i < num; i++) {
            if(inputs[i] == 'A') flag = 1;
            else if(inputs[i] == 'B' && flag == 1) flag = 2;
            else if(inputs[i] == 'C' && flag == 2) {
                ans++;
                flag = -1;
            }
            else flag = -1;
        }
        
        println(ans);
        flush();
    }



    // 入出力関連
    static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static final PrintWriter pw = new PrintWriter(System.out);
    enum Delimiter {
        NONE(""),
        SPACE(" "),
        DOT("\\."),
        COMMA(",");

        private String regex;
        private Delimiter(String regex) {
            this.regex = regex;
        }
        public String getRegex() { return regex; }
    }

    static String receive() throws IOException { return br.readLine(); }
    static int receiveInt() throws IOException { return Integer.parseInt(br.readLine()); }
    static char receiveChar() throws IOException { return  br.readLine().charAt(0); }
    static char[] receiveCharArray() throws IOException { return  br.readLine().toCharArray(); }
    static int[] receiveIntArray(Delimiter delimiter) throws IOException {
        return Stream.of(br.readLine().split(delimiter.getRegex())).mapToInt(Integer::parseInt).toArray();
    }
    static String[] receiveStringArray(Delimiter delimiter) throws IOException {
        return Stream.of(br.readLine().split(delimiter.getRegex())).toArray(String[]::new);
    }

    static void print(Object obj) { pw.print(obj); }
    static void println(Object obj) { pw.println(obj); }
    static void flush() { pw.flush(); }
}

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

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    if(x==y && y==z){
        cout << 1 << endl;
        return 0;
    }else if(x==y && y!=z){
        cout << 2 << endl;
        return 0;
    }else if(z==y && y!=x){
        cout << 2 << endl;
        return 0;
    }else if(x==z && y!=z){
        cout << 2 << endl;
        return 0;
    }else{
        cout << 3 << endl;
        return 0;
    }
}

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

int main() {
	vector<int> v(6, 0);
	
	for (int i = 1; i <= 5; ++i) {
		int x; cin >> x;
		v[x] = 1;
	}
	
	int ans = 1;
	for (int i = 1; i <= 5; ++i) {
		if (v[i] == 0) {
			ans = i;
			break;
		}
	}

	cout << ans << "\n";
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    string s;cin>>s;
    sort(all(s));
    cout<<(s[0]==s[2]?"No":"Yes")<<endl;
}

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

int main() {
	long long d, n, num;
	cin >> d >> n ;
	if (n != 100) {
		num = n * pow(100, d);
	}
	else {
		num = (n + 1) * pow(100, d);
	}

	cout << num << endl;
}

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

using namespace std;

int dp[100002][3];

int main(){
    int a,b,c,N;
    cin >> N;
    for(int i=1; i<=N; i++){
        cin >> a >> b >> c;
        if (i==1){
            dp[1][0] = a;
            dp[1][1] = b;
            dp[1][2] = c;
        }else{
            dp[i][0] = a + max(dp[i-1][1], dp[i-1][2]);
            dp[i][1] = b + max(dp[i-1][2], dp[i-1][0]);
            dp[i][2] = c + max(dp[i-1][0], dp[i-1][1]);
        }
    }
    cout << max(max(dp[N][0], dp[N][1]), dp[N][2]) << endl;
    return 0;
}

Measured memory_bytes: 1408
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    double A[N];
    for (int i = 0; i < N; i++) cin >> A[i];

    double dp[N+1][N+1];
    fill(dp[0], dp[N+1], 0);
    dp[0][0] = 1;

    for (int i = 1; i < N+1; i++) {
        for (int j = 0; j <= N; j++) {
            if (j > 0) dp[i][j] += dp[i-1][j-1] * A[i-1];
            dp[i][j] += dp[i-1][j] * (1 - A[i-1]);
        }
    }

    double ret = 0;
    for (int i = ceil(N / 2.0); i <= N; i++) {
        ret += dp[N][i];
    }

    cout << setprecision(10) << ret << endl;

    return 0;
}

Measured memory_bytes: 70528
#include<stdio.h>
#define MAX 101

void depthF(int);

int n;
int v[MAX][MAX];
int d[MAX],f[MAX];
int t=0;

int main(){
  
  int i,j,k,a,b;
  int p[MAX];
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    p[i]=0;
    d[i]=0;
    f[i]=0;
    
    for(j=1;j<=n;j++){
      v[i][j]=0;
    }
    
  }
  
  for(i=1;i<=n;i++){
    
    scanf("%d%d",&a,&k);
    
    for(j=1;j<=k;j++){
      
      scanf("%d",&b);
      v[a][b]=1;
      p[b]=1;
    }
    v[i][1]=2;
  }

  for(i=1;i<=n;i++){
    
    if(i==1 || p[i]==0){
      depthF(i);
    }
    
  }

  
  for(i=1;i<=n;i++){
    
    printf("%d %d %d\n",i,d[i],f[i]);
  }
  
  return 0;
}



void depthF(int i){
  int j,k;
  
  for(j=1;j<=n;j++){

    if(v[i][j]==1){

      for(k=1;k<=n;k++) v[k][j]=2;

      if(d[i]==0){
	  t++;
	  d[i]=t;
      }
      depthF(j);
    }
      
  }

  if(d[i]==0){
    t++;
    if(d[i]==0) d[i]=t;
  }
  
  t++;
  f[i]=t;
}



Measured memory_bytes: 2104
#include <stdio.h>
typedef struct team{
    char name[21];
    int sum;
}team;
int main(void){
    int num,w,l,d,i,o,sign=0;
    team line[10],temp;
    for(;scanf("%d",&num),num;sign=1){
        if(sign)puts("");
        for(i=0;i<num;i++){
            scanf("%s %d %d %d",line[i].name,&w,&l,&d);
            line[i].sum=w*3+l*0+d*1;
            for(o=i;o>0 && line[o-1].sum < line[o].sum;o--){
                temp=line[o];
                line[o]=line[o-1];
                line[o-1]=temp;
            }
        }
        for(i=0;i<num;i++)
            printf("%s,%d\n",line[i].name,line[i].sum);
    }
    return 0;
}

Measured memory_bytes: 612