akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

char s[60][30], buf[2];
int d[60][30][60][30][2];
struct st {
	int lx, ly, rx, ry, c;
	bool b;
};
bool operator<(st a, st b) {
	return a.c > b.c;
}
int C(char c) {
	if (isdigit(c))return c - '0';
	return 0;
}
int w, h;
void update(st p, priority_queue<st>&que) {
	for (int k = -2; k <= 2; k++) {
		for (int t = 1; t <= 3 - abs(k); t++) {
			if (p.b) {
				int nx = p.lx + k, ny = p.ly + t;
				if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&s[nx][ny] != 'X') {
					int&u = d[p.lx][p.ly][nx][ny][!p.b];
					int c = p.c + C(s[nx][ny]);
					if (u > c) {
						u = c; que.push({ p.lx,p.ly,nx,ny,u,!p.b });
					}
				}
			}
			else {
				int nx = p.rx + k, ny = p.ry - t;
				if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&s[nx][ny] != 'X') {
					int&u = d[nx][ny][p.rx][p.ry][!p.b];
					int c = p.c + C(s[nx][ny]);
					if (u > c) {
						u = c; que.push({ nx,ny,p.rx,p.ry,u,!p.b });
					}
				}
			}
		}
	}
}
int main() {
	while (scanf("%d%d", &w, &h), w) {
		memset(d, 0x3f, sizeof(d));
		priority_queue<st>que;
		rep(i, h)rep(j, w) {
			scanf("%s", buf); s[i][j] = buf[0];
		}
		rep(j, w) {
			int i = h - 1;
			if (s[i][j] == 'S') {
				update({ i,j,0,0,0,1 }, que); update({ 0,0,i,j,0,0 }, que);
			}
		}
		while (!que.empty()) {
			st p = que.top(); que.pop();
			if (d[p.lx][p.ly][p.rx][p.ry][p.b] != p.c)continue;
			update(p, que);
		}
		int Min = INF;
		rep(i, h)rep(j, w)rep(k, h)rep(t, w)rep(y, 2) {
			if (s[i][j] == 'T' || s[k][t] == 'T')Min = min(Min, d[i][j][k][t][y]);
		}
		if (Min == INF)puts("-1");
		else printf("%d\n", Min);
	}
}

Measured memory_bytes: 28628
#include<cstdio>
using namespace std;
int main()
{
	int m,n;
	scanf("%d%d",&m,&n);
	if(m!=1&&n!=1)
	{
		if(m>n)
		{
			printf("Alice");
			return 0;
		}
		if(m==n)
		{
			printf("Draw");
			return 0;
		}
		if(m<n)
		{
			printf("Bob");
			return 0;
		}
	}
	if(m==1&&n==1)
	{
		printf("Draw");
		return 0;
	}
	if(m==1&&n!=1)
	{
		printf("Alice");
		return 0;
	}
	if(m!=1&&n==1)
	{
		printf("Bob");
		return 0;
	}
}

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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int count = 0;

    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int k = 0; k <= C; k++) {
                int money = i * 500 + j * 100 + k * 50;
                if (money == X)
                    count++;
            }
        }
    }
    cout << count;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 

ll mod = 1e9 + 7;

#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
// cout<<endl;


int main()
{
	fastio();
	double h, w, n;
	cin>>h>>w>>n;
	double k = max(h, w);
	cout<<ceil(n/k)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

ll dp[200100];


int main(){cout<<fixed<<setprecision(10);
		   //dp[n] ...i番目までの通り数
           //初めての色ならスルー　2回目以降ならdp[i]=dp[i-1]+dp[x] xは直前の同色の位置
           //(x!=i-1)
           int n;
           cin>>n;
           vin c(n+1);
           rep(i,1,n+1)cin>>c[i];
           map<int,int> last;//最後にいつ出てきたか
           dp[0]=1;
           rep(i,1,n+1){
             dp[i]=dp[i-1];
             int g=last[c[i]];
             if(g>0&&g!=i-1)dp[i]+=dp[g];
             last[c[i]]=i;
             dp[i]%=inf;
           }
                     /* rep(i,0,n+1){
                       cout<<i<<" "<<dp[i]<<endl; 
                      }*/
           cout<<dp[n]<<endl;
}

Measured memory_bytes: 14872
from collections import Counter
c = Counter()
while 1:
    try:
        c[input()] += 1
    except:
        break
L = sorted(c.items(), key=lambda a:(-a[1], a[0]))
mx = L[0][1]
for x in L:
    if x[1] == mx:
        print x[0]
    else:
        break

Measured memory_bytes: 4612
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
//#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N; cin >> N;
    int P[N], cnt[N];
    rep(i, N) cin >> P[i], cnt[P[i] - 1] = i;
    int cnt1 = 1, ans = 1;
    rep(i, N - 1) {
        if(cnt[i] < cnt[i + 1]) {
            ++cnt1;
        }else {
            ans = max(ans, cnt1);
            cnt1 = 1;
        }
    }
    ans = max(ans, cnt1);
    cout << N - ans << endl;
}


Measured memory_bytes: 1792
main = input => {
  input = input.split('\n').map(x => x.split(' ')).map(x => x.map(parseFloat));
  var N = input[0];
  var A = input[1];
  var B = input[2];
  var C = input[3];
  
  var result = 0;
  A.forEach((value,index) => {
    result += B[value - 1];
    if(index === 0){
      return true;
    }
    // 料理N食べた時に一個前に食べたものが料理N-1ならば
    if(A[index] === A[index - 1] + 1){
      result += C[value - 2];
    }
  });
  process.stdout.write(result);
}

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

Measured memory_bytes: 7624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;

    cout << H * W - h * W - H * w + h * w << endl;
    return 0;
}

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

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buffer[] = new String[2];
		int N,X,ans;

		while(true){

			try {
				buffer = br.readLine().split("\\s+");
				N = Integer.parseInt(buffer[0]);
				X = Integer.parseInt(buffer[1]);

				if(N == 0 && X == 0)break;

				ans = 0;

				for(int a = 1; a <= N-2; a++){
					for(int b = a+1; b <= N-1; b++){
						for(int c = b+1; c <= N; c++){
							if(a+b+c == X){
								ans++;
							}
						}
					}
				}

				System.out.printf("%d\n", ans);

			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}




Measured memory_bytes: 25800
#include <iostream>
#include <vector>
#include <utility>
#define INF 1000000
#define MAX_N 100
using namespace std;
int n,m;
int cost[MAX_N][MAX_N];
int mincost[MAX_N];
bool used[MAX_N];

void solve() {
  for(int i=0;i<n;i++) {
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  int res = 0;
  while(true) {
    int v = -1;
    for(int i=0;i<n;i++) {
      if(!used[i] && (v == -1 || mincost[i] < mincost[v])) v = i;
    }
    if(v == -1) break;
    res += mincost[v];
    used[v] = true;

    for(int i=0;i<n;i++) {
      mincost[i] = min(mincost[i],cost[v][i]);
    }
  }
  cout << res << endl;
}

int main() {
  while(cin >> n >> m) {
    if(n==0&&m==0) break;
    for(int i=0;i<100;i++) {
      for(int j=0;j<100;j++) {
        cost[i][j] = INF;
      }
    }
    for(int i=0;i<m;i++) {
      int f,t,c;
      cin >> f >> t >> c;
      cost[f][t] = c;
      cost[t][f] = c;
    }
    solve();
  }
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int x = 0;
 for(int k = 0; k < N; k += 2 ){
   x  += a.at(k);
 }
  int y = 0;
    for(int j = 1; j < N; j += 2){
      y += a.at(j);
    }
  cout << x - y << endl;
}

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

int main()
{
	int a[100];
	int n,i;
	cin >> n;
	double ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
    sort(&a[0], &a[0] + n);

	double tmp = a[0];
	for (int i = 1; i < n; i++)
	{
		tmp = (a[i]+ tmp)/2.0;
	}

	printf("%.5f", tmp);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M,X;
ll S,T;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	deque<ll> D;
	FOR(i,1000005) D.push_back(i);
	
	cin>>N;
	FOR(i,N-1) {
		cin>>x;
		if(i<=1) {
			if(i==0) T+=x;
			else T-=x;
		}
		else {
			S+=x;
			for(j=1;j<=x;j++) D.push_front(D[j*2-1]);
			while(D.size()>1000005) D.pop_back();
		}
	}
	
	
	cin>>M;
	while(M--) {
		cin>>X;
		if(X>=S) {
			cout<<T+X-S<<endl;
		}
		else {
			cout<<T+D[X]<<endl;
		}
	}
	
		
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 17960
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun countPattern(S: String): Long {
    val N = S.length
    val dp = Array(N+1){LongArray(2){0}}

    dp[0][0] = 1
    for (i in 0 until N) {
        when (S[i]) {
            '0' -> {
                dp[i+1][0] = dp[i][0]

                dp[i+1][1] = 0

                dp[i+1][1] += dp[i][1] % MOD
                dp[i+1][1] += dp[i][1] * 2 % MOD
                dp[i+1][1] %= MOD
            }
            '1' -> {
                dp[i+1][0] = dp[i][0] * 2 % MOD

                dp[i+1][1] = dp[i][0]

                dp[i+1][1] += dp[i][1] % MOD
                dp[i+1][1] += dp[i][1] * 2 % MOD
                dp[i+1][1] %= MOD
            }
            else -> {
                throw Exception("S[i] should be 0 or 1")
            }
        }
    }

    val res = (dp[N][0] + dp[N][1]) % MOD
    return res
}

fun solve() {
    val S = rd.readString()

    val ans = countPattern(S)

    print(ans)
}


//val rd = debug.Reader("abc", "129", "e", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
const val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 40700
#include<iostream>
#include<string.h>
using namespace std;

int dp[100];

int main(){
	int n;
	while(cin >> n){
		if(n == 0){
			break;
		}
		memset(dp,0,sizeof(dp));
		dp[1] = 1;
		dp[2] = 1;
		dp[3] = 1;
		for(int i=1;i<n;i++){
			dp[i+1] += dp[i];
			dp[i+2] += dp[i];
			dp[i+3] += dp[i];
		}

		dp[n] /= 10;
		int add = 0;
		if(dp[n]%365 != 0 || dp[n] == 0){
			add++;
		}

		cout << dp[n]/365+add << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

void Main(){
  int a,b;
  cin>>a>>b;
  cout<<ceil((double)(a+b)/2)<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(0);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	// Shojin
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int[] B = new int[N];
			int max = 0;
			int[] countArrA = new int[N + 1];
			int[] countArrB = new int[N + 1];
			for (int i = 0; i < N; i++) {
				int next = sc.nextInt();
				max = Math.max(max, next);
				countArrA[next]++;
			}
			for (int i = 0; i < N; i++) {
				int next = sc.nextInt();
				B[i] = next;
				max = Math.max(max, next);
				countArrB[next]++;
			}
			for (int i = 1; i <= max; i++) {
				if (countArrA[i] + countArrB[i] > N) {
					System.out.println("No");
					return;
				}
				countArrA[i] += countArrA[i - 1];
				countArrB[i] += countArrB[i - 1];
			}
			int move = 0;
			for (int i = 1; i <= max; i++) {
				move = Math.max(countArrA[i] - countArrB[i - 1], move);
			}
			System.out.println("Yes");
			for (int i = 0; i < N; i++) {
				int idx = (i + N - move) % N;
				System.out.print(B[idx]);
				System.out.print(' ');
			}
		}
	}
}

Measured memory_bytes: 64256
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int dy[8] = {1,1,0,-1,-1,-1,0,1}; // n ne e se s sw w nw
int dx[8] = {0,1,1,1,0,-1,-1,-1};

int m[51][51];
int cnt;

void bfs(int sx, int sy, int w, int h)
{
	rep(i,0,8) {
		int nx = sx + dx[i];
		int ny = sy + dy[i];
		if (ny < 0 || nx < 0 || ny >= h || nx >= w) continue;
		if (m[ny][nx]) {
			m[ny][nx] = 0;
			bfs(nx, ny, w, h);
		}
	}
}

int main()
{
	while(1) {
		int w, h;
		cin >> w >> h;
		if (!w && !h) break;
		rep(i,0,h) rep(j,0,w) cin >> m[i][j];
		cnt = 0;
		rep(i,0,h) rep(j,0,w) if (m[i][j])	{
			cnt++;
			m[i][j] = 0;
			bfs(j,i,w,h);
		};
		cout << cnt << endl;
	}

	return 0;
}

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

using namespace std;

const int N = 2E5 + 5;
int a[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    bool ok = true;
    for(int i = 0; i < n; i ++) {
        cin >> a[i];
        if(a[i] > i)
            ok = false;
    }
    for(int i = 0; i < n - 1; i ++) {
        if((a[i] == 0 && a[i + 1] > 1) || (a[i + 1] > a[i] + 1))
            ok = false;
    }
    if(!ok) {
        cout << -1 << '\n';
        return 0;
    }
    long long ans = 0;
    for(int i = 0; i < n - 1; i ++) {
        if(a[i] + 1 == a[i + 1])
            ans ++;
        else
            ans += a[i + 1];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1024
n,m,X,Y = map(int,input().split())
listx = list(map(int,input().split()))
listy = list(map(int,input().split()))

listx.sort()
maxX = max(listx[n-1],X)
listy.sort()
minY = min(listy[0],Y)

if maxX >= minY:
    print("War")
else:
    print("No War")


Measured memory_bytes: 3060
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var sum = 0L;
        for (int i = 1; i <= n; i++)
            if (!(i % 3 == 0 | i % 5 == 0)) sum += i;
        Console.WriteLine(sum);
    }
}


Measured memory_bytes: 17480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S,T;
  cin >> N >> S;
  if (N%2==0){
    for (int i = 0; i<N/2; i++) {
      T+=S.at(i);
    };
    if (T+T==S){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    };
  } else {
    cout << "No" << endl;
  };
}

Measured memory_bytes: 256
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e3 + 10;
const int MOD = 1e9 + 7;
long long dp[MAXN][MAXN];
char a[MAXN][MAXN];

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int w , h;
    cin>>w>>h;
    for(int i = 1 ; i <= w ; i++){
        for(int j = 1 ; j <= h ; j++){
            cin>>a[i][j];
        }
    }
    dp[1][1] = 1;
    for(int i = 1 ; i <= w ; i++){
        for(int j = 1 ; j <= h ; j++){
            if(i == 1 && j == 1) continue;
            if(a[i][j] == '.'){
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
            }
        }
    }
    cout<<dp[w][h]<<endl;
}


Measured memory_bytes: 9216
#include<bits/stdc++.h>
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

typedef tuple<int, int, int, int> TP;
TP narabi(int a, int b, int c, int d) {
	TP kari[4];
	kari[0] = tie(a, b, c, d);
	kari[1] = tie(b, c, d, a);
	kari[2] = tie(c, d, a, b);
	kari[3] = tie(d, a, b, c);
	return *min_element(kari, kari + 4);
}

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


	int N;
	cin >> N;
	TP C[400];
	rep(i, N) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		C[i] = narabi(a, b, c, d);
	}

	sort(C, C + N);
	int kazu[400] = {};
	rep(i, N) {
		int k = i;
		while (k + 1 < N && C[k + 1] == C[i]) k++;
		kazu[i] = k - i + 1;
		i = k;
	}

	ll kotae = 0;
	rep(i, N) rep(j, N) if (i != j) {
		int inum = lower_bound(C, C + N, C[i]) - C;
		int jnum = lower_bound(C, C + N, C[j]) - C;

		kazu[inum]--;
		kazu[jnum]--;

		int a, b, c, d, e, f, g, h;
		a = get<0>(C[i]);
		b = get<1>(C[i]);
		c = get<2>(C[i]);
		d = get<3>(C[i]);
		e = get<0>(C[j]);
		f = get<1>(C[j]);
		g = get<2>(C[j]);
		h = get<3>(C[j]);

		rep(x, 4) {
			TP D[4];
			D[0] = narabi(a, d, f, e);
			D[1] = narabi(a, e, h, b);
			D[2] = narabi(b, h, g, c);
			D[3] = narabi(c, g, f, d);
			TP* itr[4];
			rep(k, 4) itr[k] = lower_bound(C, C + N, D[k]);
			ll kari = 1;
			rep(k, 4) {
				if (itr[k] != C + N && *(itr[k]) == D[k]) {
					kari *= kazu[itr[k] - C]--;
					if (get<0>(D[k]) == get<2>(D[k]) && get<1>(D[k]) == get<3>(D[k])) {
						kari *= 2;
						if (get<1>(D[k]) == get<2>(D[k])) kari *= 2;
					}
				}
				else {
					kari = 0;
					break;
				}
			}
			rep(k, 4) {
				if (itr[k] != C + N && *itr[k] == D[k]) {
					kazu[itr[k] - C]++;
				}
				else break;
			}
			kotae += kari;

			int tmp = e;
			e = f;
			f = g;
			g = h;
			h = tmp;
		}
		kazu[inum]++;
		kazu[jnum]++;
	}
	co(kotae / 6);

	Would you please return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.lang.*;


public class Main {
	public static void main(String[] args)  throws IOException
	{
	    BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	    StringBuffer s = new StringBuffer(buf.readLine());
	    String sun = s.reverse().toString();
	    System.out.println(sun);
	}
		
}

Measured memory_bytes: 16852
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
typedef long long ll;

struct Node{
  int key;
  Node *right, *left, *parent;
};
//property
Node *root, *NIL;

void Insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z= new Node;
  z ->key = k;
  z ->left = NIL;
  z ->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x= x->left;
    else x = x-> right;
  }
  z->parent =y;
  if(y == NIL) root = z;
  else {
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}

void Inorder(Node *r){
  if(r == NIL) return;
  Inorder(r->left);
  cout << " " << r->key;
  Inorder(r->right);
}

void Preorder(Node *r){
  if(r == NIL) return;
  cout << " " << r->key;
  Preorder(r->left);
  Preorder(r->right);
}


int main(){

  int m, k;
  string com;
  cin >> m;
  rep(i,m){
    cin >> com;
    if (com == "insert"){
      cin >> k;
      Insert(k);  
    }
    else {
      Inorder(root);
      cout << endl;
      Preorder(root);
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 26620
package main

import (
	"fmt"
)

func main() {

	// 入力リスト初期化
	inputs := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&inputs[i])
	}

	result := 0
	for _, v := range inputs {
		result += v
	}

	if result <= 21 {
		fmt.Printf("win")
	} else {
		fmt.Printf("bust")
	}

}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
int a,b,c,x,y;
long long ans=0;
struct Apple{
	int col,val;
	bool operator <(const Apple x) const {
		return x.val<val;
	}
}p[300005];
int main(){
	cin>>x>>y>>a>>b>>c;
	for(int i=1,x;i<=a;i++)cin>>x,p[i]={1,x};
	for(int i=1,x;i<=b;i++)cin>>x,p[i+a]={2,x};
	for(int i=1,x;i<=c;i++)cin>>x,p[i+a+b]={0,x};
	sort(p+1,p+a+b+c+1);
	int s=x+y;
	for(int i=1;s;i++){
		if(p[i].col==1&&x){
			x--,s--,ans+=p[i].val;
		}
		else if(p[i].col==2&&y){
			y--,s--,ans+=p[i].val;
		}
		else if(p[i].col==0){
			s--,ans+=p[i].val;
		}
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 2560
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define N 200001
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
const int mod=924844033;
int n,siz[N],sum[N],L,R[1<<19],a[1<<19],b[1<<19],fac[N],inv[N],ifac[N];
int cnt,head[N],nxt[N+N],to[N+N];
int mi(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=1ll*res*a%mod;
		a=1ll*a*a%mod;
		b>>=1;
	}
	return res;
}
int add(int x)
{
	return x<mod?x:x-mod;
}
int dec(int x)
{
	return x<0?x+mod:x;
}
void fft(int x[],int n,int f)
{
	for(int i=0;i<n;++i)
		if(i<R[i])
			swap(x[i],x[R[i]]);
	for(int i=1;i<n;i<<=1)
	{
		int wn=mi(5,(mod-1)/(i<<1));
		if(!~f)wn=mi(wn,mod-2);
		for(int j=0;j<n;j+=i<<1)
			for(int k=0,w=1;k<i;++k,w=1ll*w*wn%mod)
			{
				int l=x[j+k],r=1ll*x[i+j+k]*w%mod;
				x[j+k]=add(l+r);x[i+j+k]=dec(l-r);
			}
	}
	if(!~f)
	{
		int inv=mi(n,mod-2);
		for(int i=0;i<n;++i)
			x[i]=1ll*x[i]*inv%mod;
	}
}
void dfs(int u,int fa)
{
	siz[u]=1;
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i]) != fa)
		{
			dfs(v,u);
			siz[u]+=siz[v];
		}
	if(u!=1)
		--sum[siz[u]],--sum[n-siz[u]];
}
int main()
{
	re(n);
	for(int i=1,u,v;i<n;++i)
	{
		re(u),re(v);
		add_edge(u,v);
		add_edge(v,u);
	}
	fac[0]=inv[0]=inv[1]=ifac[0]=1;
	for(int i=1;i<=n;++i)
	{
		if(i>1)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[i]=1ll*i*fac[i-1]%mod;
		ifac[i]=1ll*inv[i]*ifac[i-1]%mod;
	}
	dfs(1,0);
	sum[n]=n;
	for(int i=0;i<=n;++i)	
		a[i]=(1ll*fac[n-i]*sum[n-i]%mod+mod)%mod,
		b[i]=ifac[i];
	int nn;
	for(nn=1;nn<=n+n;nn<<=1)++L;--L;
	for(int i=0;i<nn;++i)R[i]=(R[i>>1]>>1)|((i&1)<<L);
	fft(a,nn,1);fft(b,nn,1);
	for(int i=0;i<nn;++i)
		a[i]=1ll*a[i]*b[i]%mod;
	fft(a,nn,-1);
	for(int i=1;i<=n;++i)
		printf("%lld\n",1ll*a[n-i]*ifac[i]%mod);
}

Measured memory_bytes: 24064
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    ll r, d, x;
    cin >> r >> d >> x;
    forn(i, 0, 10) {
        x = x*r-d;
        cout << x << endl;
    }
}


Measured memory_bytes: 3564
n, m = map(int, input().split())
a_and_b = [list(map(int, input().split())) for _ in range(m)]
point = [[] for _ in range(n)]
reached = [False for _ in range(n)]
answer = 0
for i in range(m):
    for j in range(n):
        if a_and_b[i][0] == j+1:
            point[j].append(a_and_b[i][1])
        if a_and_b[i][1] == j+1:
            point[j].append(a_and_b[i][0])


def dfs(start_point=0):
    global answer
    if not (False in reached):
        answer += 1
    for k in point[start_point]:
        if reached[k-1] is False:
            reached[k-1] = True
            dfs(start_point=k-1)
            reached[k-1] = False


reached[0] = True
dfs(start_point=0)
print(answer)

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

int main(void){
    long long int N; cin >> N;
    long long int ans = N;
    for(int i = 1; i <= sqrt(N); i++){
        if((double)N/i - (N/i) == 0){
            ans = i + (N/i);
        }
    }
    ans -= 2;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int sz=3001;
ll dp[sz][sz][2];
ll solve(vector<ll>& picks,ll l,ll r,int turn){
    if(l>r){
        return 0;
    }
    if(dp[l][r][turn]!=0)
        return dp[l][r][turn];
    if(turn==1) // 1 stands for Taro
        dp[l][r][turn]=max(picks[l]+solve(picks,l+1,r,0),picks[r]+solve(picks,l,r-1,0));
    else // 1 stands for Jiro
        dp[l][r][turn]=min(solve(picks,l+1,r,1),solve(picks,l,r-1,1));
    return dp[l][r][turn];
}   

int main() {
	for(ll i=0;i<sz;++i)
        for(ll j=0;j<sz;++j)
            for(ll k=0;k<2;++k)
                dp[i][j][k]=0;
    ll n=0;cin>>n;
    vector<ll> picks(n,0);
    ll total_possible=0;
    for(int i=0;i<n;++i){
        cin>>picks[i];
        total_possible+=picks[i];
    }
    ll taro_score=solve(picks,0,n-1,1);
    ll jiro_score=total_possible-taro_score;
    cout<<taro_score-jiro_score<<'\n';
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  long ans = 1; int X = 1000000007;
  for (int i = 1; i < N+1; i++) {
    ans = (ans * i) % X;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import itertools
n = int(input())
point = []
for i in range(n):
  a,b = map(float,input().split())
  point.append((a,b))
ans = 0.0
div = 0
for pm in itertools.permutations(point):
  div += 1
  for j in range(n-1):
    ans += ((pm[j][0]-pm[j+1][0])**2 + (pm[j][1]-pm[j+1][1])**2) ** 0.5
print(ans / div)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int n, i, j;
  char c, s[4];
  for(i = 0; i < 4; ++i) s[i] = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%c", &c);
    scanf("%c", &c);
    //printf("%d ", (int)c);
    switch(c) {
      case 'G':
      s[0] = 1;
      break;
      case 'W':
      s[1] = 1;
      break;
      case 'P':
      s[2] = 1;
      break;
      case 'Y':
      s[3] = 1;
      break;
    }
  }
  int ans = 0;
  for(i = 0; i < 4; ++i) ans += s[i];
  //printf("%d\n", ans);
  if(ans == 3) printf("Three");
  else printf("Four");
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> as(n);
  rep(i, n) cin >> as[i];
  int sum = as[0];
  rep(i, n - 1) { sum = sum ^ as[i + 1]; }
  rep(i, n) {
    int ans = sum ^ as[i];
    printf("%d%c", ans, i == n - 1 ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 3944
read = input 
rn = lambda :list(map(int, read().split()))
rn()
arr = rn()
a1 = filter(lambda x:x%2==0, arr)
flag = True
for x in a1:
    if x % 3 == 0 or x % 5 == 0:
        pass
    else :
        flag = False
print("APPROVED" if flag else "DENIED")

Measured memory_bytes: 3060
#include "bits/stdc++.h"

using namespace std;

//typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


signed main(){

	int N;
	int h[123456];

	cin >> N;
	for (int i = 0; i<N; i++) cin >> h[i];

	int dp[123456] = { 0 };

	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < N; i++){
		dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]),
			dp[i - 2] + abs(h[i - 2] - h[i]));
	}
	cout << dp[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 2048
@P=map$-=$_-2,@N=1..<>+2;--$N[-1];$\+=$_*=(($N[$N[$i=$_[$_]]]-$N[$i])*($i-$P[$i])+($P[$i]-$P[$P[$i]])*(($N[$P[$N[$i]]=$P[$i]]=$N[$i])-$i))for map$_[$_]=++$i,glob<>;print

Measured memory_bytes: 43172
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int A,B,K;
    cin>>A>>B>>K;
    for(int i=100;i>0&&K>0;i--){
        if(A%i==0&&B%i==0) K--;
        if(K==0){
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
import java.io.*;

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

	String str = br.readLine();
	int num = Integer.parseInt(str);
	 int res = num*num*num;
	 System.out.println(res);    

    }
}

Measured memory_bytes: 24300
#include <bits/stdc++.h>
#define DIM 100007
#define INF 1000000000000000007LL
#define modulo 1000000007
using namespace std;

long long n,d[DIM][2];
vector<long long> a[DIM];

void dfs(int v, int par)
{
    d[v][0] = d[v][1] = 1;
    for(auto to:a[v])
        if(to!=par)
    {
        dfs(to,v);
        d[v][0]*=d[to][0]+d[to][1];
        d[v][1]*=d[to][0];
        d[v][0]%=modulo;
        d[v][1]%=modulo;
    }
}
int main()
{
    cin>>n;
    for(int i = 1; i < n; ++i)
    {
        int v1,v2;
        cin>>v1>>v2;
        a[v1].push_back(v2);
        a[v2].push_back(v1);
    }
    dfs(1,-1);
    cout<<(d[1][0]+d[1][1])%modulo;
    return 0;
}


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

void zero (int x1,int x2,int x3,int x4,int x5)
{
if(x1==0)
  cout<<"1";
  if(x2==0)
  cout<<"2";
 if(x3==0)
  cout<<"3";
  if(x4==0)
  cout<<"4";
  if(x5==0)
  cout<<"5";
   
}

int main()
{
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  zero(a,b,c,d,e);
  return 0;
}

Measured memory_bytes: 3580
def main():
    mod = 998244353
    fact = [1, 1]
    for i in range(2, 400001):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    n, m, k = map(int, input().split())
    ans = 0
    for i in range(k+1):
        ans = (ans+m*pow(m-1, n-i-1, mod)*nCr(n-1, n-i-1)) % mod

    print(ans)


main()


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

const int N = (int)1e6;

pair<int,int> dat[N+5];
int dp[N+5];

int main() {
    for (int i=0; i<N+3; i++) dp[i] = -1;
    dp[0] = 0;

    int n,t; scanf("%d %d", &n, &t);
    for (int i=1; i<=n; i++) {
        scanf("%d %d", &dat[i].first, &dat[i].second);
    }

    sort(dat+1, dat+1+n);

    int res = 0;
    for (int i=1; i<=n; i++) {
        int a = dat[i].first;
        int b = dat[i].second;

        for (int j=t-1+a; j>=a; j--) {
            if (dp[j-a] != -1) {
                dp[j] = max(dp[j], dp[j-a] + b);
                res = max(res, dp[j]);
            }
        }
    }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i < n; i++)
#define repv(i,n) for(int i = n-1; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
using namespace std;
typedef long long ll;

char BUF[3500000];
inline void I(int&a){scanf("%d",&a);}
inline void I(int&a,int&b){scanf("%d%d",&a,&b);}
inline void I(int&a,int&b,int&c){scanf("%d%d%d",&a,&b,&c);}
inline void I(int&a,int&b,int&c,int&d){scanf("%d%d%d%d",&a,&b,&c,&d);}
inline void L(ll&a){scanf("%lld",&a);}
inline void L(ll&a,ll&b){scanf("%lld%lld",&a,&b);}
inline void L(ll&a,ll&b,ll&c){scanf("%lld%lld%lld",&a,&b,&c);}
inline void L(ll&a,ll&b,ll&c,ll&d){scanf("%lld%lld%lld%lld",&a,&b,&c,&d);}
inline void S(string&str){str.clear();scanf("%s",BUF);int s=strlen(BUF);rep(i,s)str.pb(BUF[i]);}
inline void SV(vector<int>&v){v.clear();scanf("%s",BUF);int s=strlen(BUF);rep(i,s)if('a'<=BUF[i]&&BUF[i]<='z')v.pb(BUF[i]-'a');else v.pb(BUF[i]-'A');}

const auto EPS = 1e-10;
const auto INF = 100000000;
const auto MOD = 1000000007;
typedef pair<ll,ll> P;

ll n;
vector<int> ans, ans2;
int pos[200];

int main(){
    memset(pos,-1,sizeof(pos));
    L(n);
    if(n == 1){
        cout << 2 << endl;
         cout << 1 << " " << 1 << endl;
         return 0;
    }
    
    ll x = 2;
    int cnt = 1;
    ans.push_back(1);
    ans2.push_back(1);
    while(x*2 <= n){
        x *= 2;
        cnt++;
        ans.push_back(cnt);
        ans2.push_back(cnt);
    }
    n -= x;
    for(int i = 60; i >= 0; i--){
        if((1LL<<i)  <= n){
            cnt++;
            pos[i] = cnt;
            ans2.push_back(cnt);
            n -= (1LL<<i);
        }
    }
    
    cout << ans2.size()*2+2 << endl;
    vector<int> out;
    rep(i,ans.size()){
        if(pos[i] != -1){
            out.push_back(pos[i]);
        }
        out.push_back(ans[i]);
    }
    rep(i,out.size()){
        if(i != 0) cout << " " << out[i];
        else cout << out[i];
    }
    rep(i,ans2.size()){
        cout << " " << ans2[i];
    }
    cout << " " << 100 << " " << 100 << endl;
}
































Measured memory_bytes: 256
(defun read-num (&optional (stream *standard-input*))
  (parse-integer (read-line stream)))

(defun convert-vector (string)
  (let ((str-list (coerce string 'list))
	(arr (make-array (1+ (- (char-code #\z) (char-code #\a))) :initial-element 0)))
    (dolist (char str-list arr)
      (incf (aref arr (- (char-code char) (char-code #\a)))))))

(defun min-each-val (&rest arrs)
  (let ((ret-arr (make-array (1+ (- (char-code #\z) (char-code #\a))) :initial-element 0)))    
    (dotimes (n (1+ (- (char-code #\z) (char-code #\a))) ret-arr)
      (setf (aref ret-arr n)
	    (apply #'min (loop for arr in arrs collect (aref arr n)))))))

(defun doprint (o num)
  (dotimes (n num)
    (princ o)))

(defun print-freq-arr (arr)
  (dotimes (n (1+ (- (char-code #\z) (char-code #\a))))
    (doprint (code-char (+ (char-code #\a) n))
	     (aref arr n)))
  (fresh-line))

(defun solve (str-num)
  (let ((strs (loop repeat str-num collect (convert-vector (read-line)))))
    (print-freq-arr (apply #'min-each-val strs))))

(solve (read-num))

Measured memory_bytes: 17888
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  ll a;
  string b;
  cin >> a >> b;
  ll ans = 0;
  ans += a * (b[0] - '0') * 100;
  ans += a * (b[2] - '0') * 10;
  ans += a * (b[3] - '0') * 1;
  cout << ans / 100 << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数 - テスト用
#ifdef D_TEST
	static FILE *szpFpT;
#endif

// 経路出力
int
fOut(
	char pcWay					// <I> 方向
	, int piCnt					// <I> 回数
)
{
	int i;

	for (i = 0; i < piCnt; i++) {
		printf("%c", pcWay);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	char lc1Buf[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
#endif

	// 位置取得
	int liSx, liSy, liTx, liTy;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d%d%d", &liSx, &liSy, &liTx, &liTy);

	// 行き - １回目
	fOut('U', liTy - liSy);
	fOut('R', liTx - liSx);

	// 帰り - １回目
	fOut('D', liTy - liSy);
	fOut('L', liTx - liSx);

	// 行き - ２回目
	fOut('L', 1);
	fOut('U', liTy - liSy + 1);
	fOut('R', liTx - liSx + 1);
	fOut('D', 1);

	// 帰り - ２回目
	fOut('R', 1);
	fOut('D', liTy - liSy + 1);
	fOut('L', liTx - liSx + 1);
	fOut('U', 1);

	// 改行
	printf("\n");

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))

res = True
for i in range(N):
    if A[i] % 2 == 0 and (A[i] % 3 != 0 and A[i] % 5 != 0):
        res = False
        break
if res:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main(void){
	int N,T; cin >> N >> T;
	vector<int> A(N);
	for (auto &a : A) cin >> a;
	vector<pair<int, int > > mi(N);
	vector<pair<int, int > > ma(N);

	mi[0] = make_pair(A[0], 0);
	for(int i=1;i<N;++i){
		mi[i] = min(mi[i-1], make_pair(A[i], i));
	}

	ma[N-1] = make_pair(A[N-1], N-1);
	for(int i=N-2;i>=0;--i){
		ma[i] = max(ma[i+1], make_pair(A[i], i));
	}

	int maxVal = 0;
	for(int i=0;i<N-1;++i){
		int value = ma[i+1].first - mi[i].first;
		maxVal = max(maxVal, value);
	}

	vector<int> maxIndex;
	vector<bool> isChecked(N);
	for(int i=0;i<N-1;++i){
		int value = ma[i+1].first - mi[i].first;
		if(value == maxVal){
			isChecked[ma[i+1].second] = true;
			isChecked[mi[i].second] = true;
		}
	}

	int res = 0;
	for(int i=0;i<N;++i){
		res += (isChecked[i]);
	}
	cout << res/2 << endl;
	return 0;
}

Measured memory_bytes: 2176
package main

import (
    "fmt"
)

const MOD = 1000000007

func comb(x, y int) int {
    var ret, i int
    ret = 1
    for i = y - 1; i >= 0; i-- {
        ret = ret * (x - i) % MOD
    }
    ret = ret * inverse(fact(y)) % MOD
    return ret
}

func fact(y int) int  {
    var ret, i int
    ret = 1
    for i = 1;i <= y; i++ {
        ret = ret * i % MOD
    }
    return ret
}

func pow(x, y int) int {
    if y == 0 {
        return 1
    }
    if y % 2 == 0 {
        return pow(x * x % MOD, y / 2)
    } else {
        return x * pow(x, y - 1) % MOD
    }
}

func inverse(f int) int {
    return pow(f, MOD - 2)
}



func main() {
    var n, m int
    var ans, i, cnt int
    fmt.Scan(&n)
    fmt.Scan(&m)
    ans = 1
    for i = 2; i < 1000000; i++ {
        if m < i {
            break
        }
        cnt = 0
        for m % i == 0 {
            cnt++
            m /= i
        }
        ans = ans * comb(n + cnt - 1, cnt) % MOD
    }
    if m != 1 {
        ans = ans * comb(n, 1) % MOD
    }
    fmt.Println(ans)
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    int L, R, d;
    cin >> L >> R >> d;

    int ans = 0;
    for(int i = L; i <= R; ++i){
        if(i%d == 0){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3544
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

ll n,k;
int sub[222222];
void solve(istream& cin, ostream& cout) {
	cin >> n;
	vector<int> A(n-1);
	cin >>A;
	for(int x : A) sub[x]++;
	for(int i = 1; i <= n; i++) cout << sub[i] << endl;

}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> h(n);
    for (int &hi: h) cin >> hi;
    int ans = h.front();
    for (int i = 0; i + 1 < n; i++) {
        int diff = h[i + 1] - h[i];
        if (diff > 0) ans += diff;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    rep(i, 1, (ll)s.size()) {
        if (s[i-1] != s[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
n,m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if m == 1:
    print(0)
else:
    u = [0] * (100000)
    for i in range(m-1):
        u[i] = x[i+1]-x[i]
    u.sort(reverse=True)
    c = 0
    for i in range(n-1):
        c += u[i]
    print(sum(u)-c)

Measured memory_bytes: 20508
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int[] NK = ReadLineParseIntArray();
        int[] nums = ReadLineParseIntArray();
        bool[] canUse = Enumerable.Repeat(true, 10).ToArray();
        for (int i = 0; i < NK[1]; i++)
            canUse[nums[i]] = false;
        for(int i = NK[0]; ; i++)
        {
            bool isOK = true;
            for(int j = i; j > 0; j /= 10)
            {
                if (!canUse[j % 10])
                {
                    isOK = false;
                    break;
                }
            }
            if (isOK)
            {
                WriteLine(i);
                return;
            }
        }
    }

    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Measured memory_bytes: 11348
#include <iostream>
#include <map>

using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"
const int MOD = 1e9+7;

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

  IN(N);

  string S;
  cin >> S;

  map<char, int> m;
  REP(i, N) {
    ++m[S[i]];
  }
  ll ans = 1;
  REP(i, 26) {
    ans *= m[(char)i+'a']+1;
    ans %= MOD;
  }
  OUT((ans - 1) % MOD);

  return 0;
}


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

int main(void){
   // int num;
    char dir[1000];
    int n_flag=0,e_flag=0,w_flag=0,s_flag=0,i,result=0;
    scanf("%s",dir);
    for(i=0;i<strlen(dir);i++){
        if(dir[i] == 'N'){
            n_flag = 1;
        }else  if(dir[i] == 'E'){
            e_flag = 2;
        }else  if(dir[i] == 'W'){
            w_flag = -2;
        }else  if(dir[i] == 'S'){
            s_flag = -1;
        }
    }
    result = n_flag + e_flag + w_flag + s_flag;
    if(result == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int a, b;
	cin >> a >> b;
	if (a >= 10) {
		cout << -1;
		return 0;
	}
	if (b >= 10) {
		cout << -1;
		return 0;
	}
	cout << a * b;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	s := make(map[string]bool, n)
	for i := 0; i < n; i++ {
		var si string
		fmt.Scanf("%s", &si)
		if _, already := s[si]; !already {
			s[si] = true
		}
	}
	fmt.Println(len(s))
}


Measured memory_bytes: 15568