akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  
  int q, reverse, count = 0;
  
  int i;
  for( i=A; i < B + 1; i++){
      reverse = 0;
      int digit = 0;
      
      q = i;
      while(q > 0){
          q /= 10;
          digit++;
      }
      
      q = i;
      int j;
      for( j = 0; j < digit; j++){
          
          reverse += q % 10 * pow(10,digit-j-1);
          q /= 10;
      }
      
      if(i == reverse)  count++;
  }
  
  cout << count << endl;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    REP(i, N) {
        cin >> x[i] >> y[i];
    }

    map<pair<int, int>, int> pq;
    FOR(i, 0, N) {
        FOR(j, 0, N) {
            if (i == j)continue;
            pair<int, int> a{ x[j] - x[i],y[j] - y[i] };
            pq[a]++;
        }
    }

    int max = 0;
    for (auto&& it : pq) {
        max = std::max({ it.second, max });
    }

    cout << N - max << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, x) for(int i = 0; i < (x); i++)


struct UnionFind{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N): par(N, -1){
        /*rep(i, N) {
            par[i] = i;
        }*/
    }

    int root(int x) {
        //std::cout << x << std::endl;
        // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if(par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y){
        int rx = root(x); // xの根をrx
        int ry = root(y); // yの根をry
        if(rx == ry) return; // xとyの根が同じ時はそのまま
        if(par[rx] > par[ry]) std::swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx; // xとyの根が同じでない、xの根rxをyの根ryにつける

    }

    bool same(int x, int y) { //2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    int size(int x) {
        return -par[root(x)]; //何個の要素を持つツリーとなっているか
    }
};

int deg[100005];
vector<int> to[100005];


int main() {

    int N, M, K;
    cin >> N >> M >> K;
    UnionFind friendTree(N);
    //UnionFind BlockTree(N);
    int res[N];

    rep(i, M){
        int x, y;
        cin >> x >> y;
        x--, y--;
        // 枝の本数を記録
        deg[x]++;
        deg[y]++;
        friendTree.unite(x, y);
    }
    //cout << "HERE1" << endl;
    rep(i, K) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        // iN目のブロック関係者をリストであげる
        to[x].push_back(y);
        to[y].push_back(x);
        //BlockTree.unite(x, y);
    }
    /*
    rep(i, N){
        std::cout << tree.root(i) << std::endl;
    }
    rep(i, N) {
        rep(j, N) {
            cout << i << ":" << j << ":" << friendTree.same(i,j) << ":" << BlockTree.same(i,j) << endl;
            if(friendTree.same(i, j) && !BlockTree.same(i,j)) {
                res[i]++;
            }    
        }
    }*/
    //N = 4
    rep(i, N) {
        //cout << friendTree.size(i) << ":" << deg[i] << endl;
        int ans = friendTree.size(i)-1-deg[i];
        //std::cout << ans << endl;
        for(int u : to[i]) {
            // ?
            if(friendTree.same(i, u))
                --ans;
        }
        printf("%d%c", ans, i==N-1?'\n':' ');
    }
    return 0;
}

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

int main()
{
  
  int n, k;
  cin>>n>>k;
  int arr[n];
  for(int i=0; i<n; i++)
    cin>>arr[i];
  int dp[n];
  dp[0] = 0;
 	for(int i=1; i<n; i++)
    {
    	int kk = 0;
        int j = i-1;
        dp[i] = INT_MAX;
        while(j>=0 && kk<k)
        {
        	dp[i] = min(dp[i], abs(arr[i] - arr[j]) + dp[j]);
            
            j--;
            kk++;
        }
    
    }
            cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 4384
#include<iostream>
#include<cstdio>
#define LL long long
#define N 100010
using namespace std;

int main(){
	int n;LL d,c;
	LL sum=0,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&d,&c);
		sum+=d*c;
		ans+=c;
	}
	ans+=sum/9-1;
	if(sum%9==0) ans--;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan Mishra
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BMinorChange solver = new BMinorChange();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMinorChange {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            char[] c1 = in.readString().toCharArray();
            char[] c2 = in.readString().toCharArray();

            int cnt = 0;
            for (int i = 0; i < c1.length; i++) {
                if (c1[i] != c2[i])
                    cnt++;
            }

            System.out.println(cnt);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String readString() {
            final StringBuilder stringBuilder = new StringBuilder();
            int c = read();
            while (isSpaceChar(c))
                c = read();
            do {
                stringBuilder.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return stringBuilder.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 36516
#define _GLIBCXX_DEBUG
#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[i];
        a[i]--;
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int j = a[i];
        if (a[j] == i) ans++;
    }
    
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 640
#include <cstdlib>
#include <iostream>
#include <typeinfo>
//#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>

using namespace std;

int main(){
  double n;
  cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  for (double i = 0; i < n;i++){
    cin >> x.at(i) >> u.at(i);
  }

  string jpy = "JPY";
  string btc = "BTC";

  double sum = 0;
  for (int i = 0; i < n;i++){
    if(u.at(i)==btc){
      sum += x.at(i) * 380000;
    }else{
      sum += x.at(i);
    }
  }
  cout << sum << endl;
  return 0;
}

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

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

    return 0;
}

Measured memory_bytes: 1024
/*** ??£?¶?????????£??°?????? ***/

#include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
	int count, sum, i, j;
	
	cin >> N;
	while(N!=0){
		count=0;
		for(i=1; i<N/2+1; ++i){
			sum=i;
			for(j=i+1; j<=N/2+1; ++j){
				sum+=j;
				if(sum==N){
					++count;
					break;
				}
				if(sum>N) break;
			}
		}
		cout << count << endl;
		
		cin >> N;
	}
	
	return 0;
}

//500
//124 125 126 127

Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  int A,B;
  string U;
  
  cin >> S >> T; 
  cin >> A >> B;
  cin >> U;
  if (S == U) {
      A = A - 1;
  }else{
      B = B - 1;
   }
  

  cout << A << " " << B << endl;
}

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

int main(){
  int N,a,b=0;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> a;
    vec.at(i)=a;
    b += a;
  }
  sort(vec.begin(),vec.end());
  if(b>2*(vec.at(N-1)))
    cout << "Yes";
  else
    cout << "No";
}

Measured memory_bytes: 256
N = int(input())
strs = (input() for _ in range(0,N))

ans = {}
for string in strs:
    key = ''.join(sorted(string))
    if key not in ans:
        ans[key] = 0
    else:
        ans[key] += 1
print(sum([x*(x+1)//2 for x in ans.values()]))

Measured memory_bytes: 17888
#include <bits/stdc++.h>
using namespace std;
int main() {
    long int A, B, K; // A: Takahashi B: Aoki
    cin >> A >> B >>K;
    if (K <= A){
	cout << A-K << " "<< B << endl;
    }
    else if ( K-A <= B ){          
	  cout << 0 << " " << B- (K - A) << endl;	  
    }
    else {
	  cout << 0 << " " << 0 << endl;
    }
	  
}


Measured memory_bytes: 256
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
cnt = 0
ans = 0
for i in range(1, N+1)[::2]:
    n = 1
    cnt = 0
    while n <= i:
        if i%n == 0:
            cnt+=1
        n+=1
    if cnt == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			String line1 = scanner.next();
			if (line1.equals("0"))
				break;
			char[][] map = new char[3][3];
			map[0] = line1.toCharArray();
			for (int i = 1; i < 3; i++) {
				map[i] = scanner.next().toCharArray();
			}
			if (isTrue(map, 'b'))
				System.out.println('b');
			else if (isTrue(map, 'w'))
				System.out.println('w');
			else
				System.out.println("NA");
		}
	}

	private boolean isTrue(char[][] map, char c) {
		for (int i = 0; i < 3; i++) {
			if (map[i][0] == c && map[i][1] == c && map[i][2] == c)
				return true;
		}
		for (int i = 0; i < 3; i++) {
			if (map[0][i] == c && map[1][i] == c && map[2][i] == c)
				return true;
		}
		if (map[0][0] == c && map[1][1] == c && map[2][2] == c)
			return true;
		if (map[0][2] == c && map[1][1] == c && map[2][0] == c)
			return true;
		return false;
	}
}

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

class UnionFind {
 private:
  std::vector<int> parent;
  std::vector<int> rank;
  std::vector<int> sizes;

 public:
  UnionFind(int n) : parent(n), rank(n), sizes(n, 1) {
    for (int i = 0; i < n; i++) parent[i] = i;
  }
  void Unite(int a, int b) {
    a = Find(a);
    b = Find(b);
    if (a == b) return;
    if (rank[a] < rank[b]) {
      parent[a] = b;
    } else {
      parent[b] = a;
      if (rank[a] == rank[b]) rank[a]++;
    }
    sizes[Find(a)] = sizes[a] + sizes[b];
  }
  int Find(int a) { return parent[a] == a ? a : parent[a] = Find(parent[a]); }
  int Size(int a) { return sizes[Find(a)]; }
};

int main() {
  int n;
  cin >> n;
  vector<set<int>> xys(2e5 + 1), yxs(2e5 + 1);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x += 1e5;
    y += 1e5;
    xys[x].insert(y);
    yxs[y].insert(x);
  }

  UnionFind uf(2e5 + 1);
  for (auto s : yxs) {
    for (auto e : s) {
      uf.Unite(*begin(s), e);
    }
  }

  ll r = 0;
  for (int i = 0; i < xys.size(); i++) {
    int f = uf.Find(i);
    if (i == f) continue;
    for (auto e : xys[i]) {
      if (xys[f].count(e)) continue;
      xys[f].insert(e);
      r++;
    }
  }
  for (int i = 0; i < xys.size(); i++) {
    int f = uf.Find(i);
    if (i == f) continue;
    r += (ll)xys[f].size() - xys[i].size();
  }
  cout << r << endl;
}


Measured memory_bytes: 33152
n = int(input())
ans = 1
mod = 1000000007

a = [0 for i in range(n+1)]

for i in range(2,n+1):
    b = i
    for j in range(2,i+1):
        while b%j==0:
            a[j]+=1
            b//=j

for i in range(2,n+1):
    if a[i]>0:
        ans *= a[i]+1
        ans %= mod

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long arr[87];
	arr[0]=2;
	arr[1]=1;
	for(int i=2; i<=86; i++)
	arr[i]=arr[i-1]+arr[i-2];
	int n;
	cin>>n;
	cout<<arr[n]<<endl;
//	main();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{   ll n,m,k,t,t1,sum;
   while(cin>>n)
   {   sum=0;
       t=n/500;
      t1=n%500;
      sum=t*1000+t1/5*5;
      cout<<sum<<endl;
   }
}

Measured memory_bytes: 256
hon = set([2,4,5,7,9])
pon = set([0,1,6,8])
bon = set([3])
N = input()

if int(N[-1]) in hon:
  print('hon')
elif int(N[-1]) in pon:
  print('pon')
elif int(N[-1]) in bon:
  print('bon')

Measured memory_bytes: 9192
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def main():
    n, k = get_ints()
    a = list(get_ints())

    for i in range(k, n):
        if a[i] > a[i-k]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 31600
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	cout << c * 60 + d - a * 60 - b - e << endl;
}

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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int deg[55];
	memset(deg,0,sizeof deg);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;++i){
		int u,v;
		cin>>u>>v;
		deg[u]++;
		deg[v]++;
	}
	for(int i=1;i<=n;++i)
		cout<<deg[i]<<'\n';
}




Measured memory_bytes: 3620
#include<stdio.h>

int main(){
    int r, d, x;
    scanf("%d %d %d", &r, &d, &x);
    int x_next = x;
    for(int i = 0; i < 10; i++){
        x_next = r * x_next - d;
        printf("%d\n", x_next);
    }
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int a, b, n;
	while (scanf("%d%d", &a, &b), a|b)
	{
		scanf("%d", &n);
		bool c[16][16];
		memset(c, 0, sizeof(c));
		while (n--)
		{
			int x, y;
			scanf("%d%d", &x, &y);
			--x; --y;
			c[y][x] = true;
		}
		int dp[16][16];
		dp[0][0] = 1;
		for (int i = 0; i < b; ++i)
		{
			for (int j = i ? 0 : 1; j < a; ++j)
			{
				dp[i][j] = 0;
				if (!c[i][j])
				{
					if (j > 0)
						dp[i][j] += dp[i][j-1];
					if (i > 0)
						dp[i][j] += dp[i-1][j];
				}
			}
		}
		printf("%d\n", dp[b-1][a-1]);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int h,w;
char a[410][410];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int white,black;
int ans=0;
bool used[410][410];
void dfs(int x,int y){
	used[x][y]=true;
	if(a[x][y]=='.')white++;
	else black++;
	rep(i,4)if(a[x][y]!=a[x+dx[i]][y+dy[i]]&&!used[x+dx[i]][y+dy[i]]&&1<=x+dx[i]&&x+dx[i]<=h&&1<=y+dy[i]&&y+dy[i]<=w)dfs(x+dx[i],y+dy[i]);
}
signed main(){
	cin>>h>>w;
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)cin>>a[i][j];
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j]=='.'||used[i][j])continue;
			white=0,black=0;
			dfs(i,j);
			ans+=white*black;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const ll  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

/*vll adj[MAXN];ll visit[MAXN]={};
ll dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,k,d,w,summ;
string s,t;
vll a,b;

ll cnt[4000][4000];
// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN(ll _) {
	cin >> n;
	vll cnt(1e5+1,0);
	for(ll i=0;i<n;i++) {
		cin>>x;
		cnt[x]++;
	}
	ll maxi = 0;
	for(ll i=2;i<=100000;i++) {
		maxi = max(maxi, cnt[i] + cnt[i-1] + cnt[i-2]);
	}
	cout<<maxi;newl;
}

int main() {
	fastio;randomINT;
	//freopen("out_hc.txt","w+",stdout);
	//cin>>T;
	for(ll i=1;i<=T;i++) {
		MAIN(i);
	}
	return 0;
}



Measured memory_bytes: 3984
import java.util.*;

public class Main{

    static int mod = (int) 1e9 + 7;
    static int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
    static int INF = Integer.MAX_VALUE/2;

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);

        //Queue<int[]> q = new ArrayDeque<int[]>();
        String s = new String(scan.next());

        String st = "";
        for(int i=0;i<s.length();i++){
            st = st + "x";
        }
        System.out.println(st);
    }

    static int factorial(int n){
        if(n == 0){
          return 1;
        }
        return n * factorial(n-1);
    }


}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>
using namespace std;
 
int main() {
    int cnt[26] = { 0 };
    for(char ch; cin >> ch; ) {
        if(isalpha(ch)) {
            if(isupper(ch)) ch = tolower(ch);
            cnt[ch - 'a']++;
        }
    }
    for(int i = 0; i < 26; i++) {
        cout << (char)('a' + i) << " : " << cnt[i] << endl;
    }
	return 0;
}

Measured memory_bytes: 1140
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <limits>
#include <queue>
#include <iomanip>
#include <deque>
#include <stack>
#include <cstdio>
#include <cmath>
#include <complex.h>
#include <cstdio>
#include <random>
#include <chrono>

using namespace std;

int degree[100100];

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

    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; i++)
    {
        int v, u;
        cin >> v >> u;

        degree[v]++;
        degree[u]++;
    }

    bool good = true;
    for (int v = 1; v <= n; v++)
        good &= degree[v] % 2 == 0;

    cout << (good ? "YES" : "NO");
}

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

int N, M;
int A[100], B[100];
vector<int> G[100];
bool visited[100];

void dfs(int from, int a, int b) {
   visited[from] = true;
   for (int to : G[from]) {
      if (from == a && to == b) continue;
      if (to == a && from == b) continue;
      if (visited[to]) continue;
      dfs(to, a, b);
   }
}

int main() {
   cin >> N >> M;
   for (int i = 0; i < M; i++) {
      cin >> A[i] >> B[i];
      A[i]--, B[i]--;
      G[A[i]].push_back(B[i]);
      G[B[i]].push_back(A[i]);
   }

   int ans = 0;
   for (int i = 0; i < M; i++) {
      fill(visited, visited+N, false);
      dfs(0, A[i], B[i]);
      if (count(visited, visited+N, true) < N) ans++;
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    S, W = map(int, input().split())
    if W >= S:
        print("unsafe")
    else:
        print("safe")


if __name__ == '__main__':
    main()


Measured memory_bytes: 68728
from itertools import accumulate as acc
from bisect import bisect_left as bl

def ans(n):
    tmp=0
    for i in range(N):
        tmp+=abs(a[i]-a[n-1])
    return tmp


N=int(input())
a=list(map(int,input().split()))
a=list(acc(a))

ans=10**18
p=0
q=2
for j in range(1,N-2):
    q=max(q,j+1)
    while p<j-1 and abs(a[j]-a[p]*2)>abs(a[j]-a[p+1]*2):
        p+=1
    while q<N-2 and abs(a[j]+a[N-1]-a[q]*2)>abs(a[j]+a[N-1]-a[q+1]*2):
        q+=1

    P,Q,R,S=a[p], a[j]-a[p], a[q]-a[j], a[N-1]-a[q]
    ans=min(ans, max(P,Q,R,S)-min(P,Q,R,S))

print(ans)

Measured memory_bytes: 24180
/**
 * ????????? runtime error ?????????
 */

#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cassert>

using namespace std;

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



const int OP_PLUS  = -1;
const int OP_MINUS = -2;
const int OP_MUL   = -3;

vector<int> read_expr()
{
    vector<int> expr;

    int c;
    string buf;
    while((c = getchar()) != EOF) {
        if(isspace(c)) {
            if(!buf.empty()) {
                expr.push_back(atoi(buf.c_str()));
                buf.clear();
            }
            if(c == '\n') break;
        }
        else if(isdigit(c)) {
            buf += static_cast<char>(c);
        }
        else if(c == '+') {
            expr.push_back(OP_PLUS);
        }
        else if(c == '-') {
            expr.push_back(OP_MINUS);
        }
        else if(c == '*') {
            expr.push_back(OP_MUL);
        }
    }

    return expr;
}

int interpret(const vector<int>& expr)
{
    stack<int> s;

    for(int sym : expr) {
        if(sym >= 0) {
            s.push(sym);
        }
        else if(sym == OP_PLUS) {
            int rhs = s.top();
            s.pop();
            int lhs = s.top();
            s.pop();
            s.push(lhs + rhs);
        }
        else if(sym == OP_MINUS) {
            int rhs = s.top();
            s.pop();
            int lhs = s.top();
            s.pop();
            s.push(lhs - rhs);
        }
        else if(sym == OP_MUL) {
            int rhs = s.top();
            s.pop();
            int lhs = s.top();
            s.pop();
            s.push(lhs * rhs);
        }
    }

    return s.top();
}

int main()
{
    vector<int> expr = read_expr();
#if 0
    REP(i, expr.size()) {
        printf("%d ", expr[i]);
    }
#endif

    int result = interpret(expr);
    printf("%d\n", result);
    fflush(stdout);

    return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <stdio.h>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int score[200]={};
    int a[3][n];
    for(int i=0;i<n;++i){
        for(int j=0;j<3;++j){
            cin>>a[j][i];
        }
    }
    for(int i=0;i<3;++i){
        for(int j=0;j<n;++j){
            int m=0;
            for(int k=0;k<n;++k){
                if(a[i][j]==a[i][k]){
                    ++m;
                }
            }
            if(m==1){
                score[j]+=a[i][j];
            }
        }
    }
    for(int i=0;i<n;++i){
        cout<<score[i]<<endl;
    }
}


Measured memory_bytes: 3088
#include <stdio.h>

int main()
{
	int a,b;

	while(1)
	{
		int kai;
		int i = 1;
		int j = scanf("%d %d" , &a,&b);
		if(j==EOF) break;

		kai = a+b;

		while(kai > 9)
		{
			kai /= 10;
			i++;
		}

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

Measured memory_bytes: 600
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            long k = in.nextLong();
            char midch = s.charAt(0);
            int cnt = 0;
            while (cnt < s.length() && s.charAt(cnt) == midch) ++cnt;
            if (cnt == s.length()) {
                long total = cnt * k;
                out.println(total / 2);
                return;
            }
            int cnte = 0;
            while (s.charAt(s.length() - 1 - cnte) == midch) ++cnte;
            long res = 0;
            res = cnt / 2;
            res += cnte / 2;
            res += (k - 1) * ((cnt + cnte) / 2);
            int am = 0;
            char what = midch;
            for (int i = cnt; i < s.length() - cnte; ++i) {
                if (s.charAt(i) == what) {
                    ++am;
                } else {
                    res += k * (am / 2);
                    am = 1;
                    what = s.charAt(i);
                }
            }
            res += k * (am / 2);
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 10000000000000000
#define MOD 998244353
using namespace std;


int main(){
    ll n,m,d;
    cin >> n >> m >> d;
    
    double ans=0;
    
    if(d==0){
        ans=n;
    }else{
        ans=(n-d)*2;
    }
    
    ans=ans*(m-1);
    ans=ans/n/n;

    
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int h, m, s;
  int time;
  int tmp;

  scanf("%d", &time);
  
  h = time / (60 * 60);
  tmp = time - 60 * 60 * h;
  m = tmp / 60;
  s = tmp - 60 * m;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstring>/*The header <string> and
<string.h> does not contain the useful
function 'memset' and 'memcpy'.*/
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<utility>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#define int long long
using namespace std;
int x[3][2],X;
vector<int> v;
void dfs(int pos,int L,int S)
{
	if(!v.size())
		return ;
	if(pos==v.size()-1)
	{
		X=max(X,S+L/x[v[pos]][0]*(x[v[pos]][1]-x[v[pos]][0]));
		return ;
	}
	for(int i=0;i<=L/x[v[pos]][0];i++)
		dfs(pos+1,L-x[v[pos]][0]*i,S+x[v[pos]][1]*i-x[v[pos]][0]*i);
	return ;
}
signed main()
{
	int N;
	cin>>N;
	for(int i=0;i<2;i++)
		for(int j=0;j<3;j++)
			cin>>x[j][i];
	for(int i=0;i<3;i++)
		if(x[i][0]<x[i][1])
			v.push_back(i);
	X=N;
	dfs(0,N,N);
	N=X;
	v.clear();
	for(int i=0;i<3;i++)
	{
		if(x[i][1]<x[i][0])
			v.push_back(i);
		swap(x[i][0],x[i][1]);
	}
	X=N;
	dfs(0,N,N);
	cout<<X<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long ans;
int i,n,x,y,bb;
int main() {
	scanf("%d",&n);
	int gt=1000000001;
	for (i=1;i<=n;i++) {
		scanf("%d%d",&x,&y);
		ans+=x;
		if (x>y) gt=min(gt,y);
		if (x!=y) bb=1;
	}
	if (!bb) puts("0");
	else printf("%lld\n",ans-gt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int f[MAX_N]={};
int b[MAX_N]={};

int r[2002][2002]={};
int l[2002][2002]={};
int u[2002][2002]={};
int d[2002][2002]={};
bool s[2002][2002]={};

int main() {
	int h,w;
	cin>>h>>w;
	rep(i,h){
		string str;
		cin>>str;
		rep(j,w){
			if(str[j]=='#')s[i+1][j+1]=true;
		}	
	}
	rep(i,h){
		rep(j,w){
			if(s[i+1][j+1]){
				l[i+1][j+1]=j+1;
				u[i+1][j+1]=i+1;
			}else{
				l[i+1][j+1]=l[i+1][j];
				u[i+1][j+1]=u[i][j+1];
			}
		}
	}
	for(int i=h-1;i>=0;--i){
		r[i+1][w+1]=w+1;
		for(int j=w-1;j>=0;--j){
			d[h+1][j+1]=h+1;
			if(s[i+1][j+1]){
				r[i+1][j+1]=j+1;
				d[i+1][j+1]=i+1;
			}else{
				r[i+1][j+1]=r[i+1][j+2];
				d[i+1][j+1]=d[i+2][j+1];
			}
		}
	}
	int res=0;
	rep(i,h){
		rep(j,w){
			if(!s[i+1][j+1]){
				int k=r[i+1][j+1]-l[i+1][j+1]+d[i+1][j+1]-u[i+1][j+1]-3;
				res=max(res,k);
//				cout<<k<<endl;
			}
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 67840
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 924844033
#define M 2000000000
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 2010
long long dp[N][N];
long long dp2[N];
long long ddp2[N];
long long fact[N];

int main(void) {
	int n, k;
	int x, y, z;
	long long ans, s;
	f(i, N) {
		f(j, N)dp[i][j] = 0;
	}
	dp[0][0] = 1;
	dp[1][1] = 1;
	f(i, N) {
		f(j, N) {
			if ((i - 1) >= 0)dp[i][j] += dp[i - 1][j];
			if (((i - 2) >= 0) && ((j - 1) >= 0))dp[i][j] += dp[i - 2][j - 1];
			dp[i][j] %= MOD;
		}
	}
	fact[0] = 1;
	f(i, N - 1)fact[i + 1] = (fact[i] * ((long long)(i + 1))) % MOD;
  scanf("%d %d",&n,&k);
	f(i, N) {
		dp2[N] = 0;
		ddp2[N] = 0;
	}
	dp2[0] = 1;
	f(i, 2 * k) {
		x = i / 2;
		y = (n - x - 1) / k;
		f(ii, N) {
			f(jj, (y + 3) / 2) {
				if (ii + jj < N) {
					ddp2[ii + jj] += (dp2[ii] * dp[y][jj]);
					ddp2[ii + jj] %= MOD;
				}
			}
		}
		f(ii, N) {
			dp2[ii] = ddp2[ii];
			ddp2[ii] = 0;
		}
	}
	ans = 0;
	f(i, n+1) {
		s = fact[n - i] * dp2[i];
		s %= MOD;
		if (i % 2 == 0)ans = (ans + s) % MOD;
		else ans = (ans - s + MOD) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 31744
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
"""
あるn以外の最大公約数が, 最大になる組み合わせ
7 6 8 -> gcd(7,6)=1, gcd(6,8)=2 gcd(7,8)=1
12 15 18 -> gcd(12,15)=3, gcd(15,18)=3, gcd(12, 18)=6
1 2 4 6 -> 2,4,6のやつがでかい
"""
l = [0 for _ in range(n+1)]
tmp = 0
for i in range(n):
	tmp = gcd(tmp, a[i])
	l[i+1] = tmp
r = [0 for _ in range(n+1)]
a = a[::-1]
tmp = 0
for i in range(n):
	tmp = gcd(tmp, a[i])
	r[n-i-1] = tmp

m=[gcd(l[i],r[i+1]) for i in range(n)]
print(max(m))

Measured memory_bytes: 93288
N, M = gets.split(" ").map(&:to_i)
X = gets.split(" ").map(&:to_i).sort
d = []
(M - 1).times do |i|
    d[i] = X[i + 1] - X[i]
end

d = d.sort

if N >= M 
    puts 0
else 
    puts d[0..(M - N - 1)].inject(:+)
end

Measured memory_bytes: 11248
# バケット法を用いる
def kagamiMochi():
	N = int(input())
	d = []
	for _ in range(0, N):
		d.append(int(input()))

	num = [0] * 110
	for i in range(0, N):
		num[d[i]] += 1

	count = 0
	for j in num:
		if j:
			count += 1
	print(count)

kagamiMochi()

Measured memory_bytes: 38484
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 998244353
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.push_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
const int N = 1e6 + 5;

int main()
{
	sync;
	clock_t clk=clock();
    ll n, k;
    cin >> n >> k;
    vector<pair<ll, ll > > rng(k);
    for(ll i = 0;  i < k; i++)
        cin >>  rng[i].F >> rng[i].S;
    vector<ll> dp(n + 1), pref_dp(n + 1);
    dp[1] = 1, pref_dp[1] = 1;
    for(ll i = 2; i <= n; i++)
    {
        for(ll j = 0; j < k; j++)
        {
            if(i - rng[j].F < 1)
                continue;
            ll minm = max(1ll, i - rng[j].S), maxm = i - rng[j].F;
            dp[i] = (dp[i] + pref_dp[maxm] - pref_dp[minm - 1] + mod) % mod;   
        }
        pref_dp[i] = (pref_dp[i - 1] + dp[i]) % mod;
    }
    cout << dp[n];
 	//cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';	
}


Measured memory_bytes: 6408
import itertools
while 1:
    try:
        n=list(map(int,input().split()))
        if n[0]+n[1]+n[2]+n[3]==0:break
        n_l=list(itertools.permutations(n))
        marks=["+","-","*"]
        flag=0
        for i in n_l:
            if flag==1:break
            for m1 in marks:
                if flag==1:break
                for m2 in marks:
                    if flag==1:break
                    for m3 in marks:
                        if flag==1:break
                        l=f"(({i[0]}{m1}{i[1]}){m2}({i[2]}{m3}{i[3]}))"
                        if eval(l)==10:
                            flag=1
                            break
                        l=f"((({i[0]}{m1}{i[1]}){m2}{i[2]}){m3}{i[3]})"
                        if eval(l)==10:
                            flag=1
                            break
                        l=f"(({i[0]}{m1}({i[1]}{m2}{i[2]})){m3}{i[3]})"
                        if eval(l)==10:
                            flag=1
                            break
        if flag==0:l=0
        print(l)
    except:break


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int res = 0;
	for (int i = 0; i < n; i++) {
		std::string s;
		std::cin >> s;
		if (s == "E869120") res++;
	}
	std::cout << res << std::endl;
	return 0;
}




Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
struct Score {
    int team;
    int times=0;
    int correct=0;
};
int main(void){
    int M,T,P,R;
    while (cin>>M>>T>>P>>R) {
        if (M==0&&T==0&&P==0&&R==0) {
            break;
        }
        int incorrect[T+1][P+1];
        for (int i=1;i<=T;i++) {
            for (int j=1;j<=P;j++) {
                incorrect[i][j]=0;
            }
        }
        struct Score score[T+1];
        for (int i=1;i<=T;i++) {
            score[i].team=i;
        }
        int m,t,p,j;
        for (int i=0;i<R;i++) {
            cin>>m>>t>>p>>j;
            if (j==0) {
                score[t].correct++;
                score[t].times+=incorrect[t][p]+m;
            } else {
                incorrect[t][p]+=20;
            }
        }
        for (int i=1;i<T;i++) {
            for (int j=i+1;j<=T;j++) {
                if (score[i].correct<score[j].correct) {
                    swap(score[i],score[j]);
                }
            }
        }
        for (int i=1;i<T;i++) {
            for (int j=i+1;j<=T;j++) {
                if (score[i].correct==score[j].correct) {
                    if (score[i].times>score[j].times) {
                        swap(score[i],score[j]);
                    } else if (score[i].times==score[j].times) {
                        if (score[i].team<score[j].team) {
                            swap(score[i],score[j]);
                        }
                    }
                }
            }
        }
        int tmp_correct;
        int tmp_times;
        for (int i=1;i<=T;i++) {
            if (i==1) {
                cout<<score[i].team;
            } else {
                if (score[i].correct==tmp_correct) {
                    if (score[i].times==tmp_times) {
                        cout<<"="<<score[i].team;
                    } else {
                        cout<<","<<score[i].team;
                    }
                } else {
                    cout<<","<<score[i].team;
                }
            }
            tmp_correct=score[i].correct;
            tmp_times=score[i].times;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3108
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main() { (new Solver()).Run(); }
}

class Solver
{
    public void Run()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

        for (var i = 0; i < N; i++)
        {
            if (A[i] % 2 == 0 && !(A[i] % 3 == 0 || A[i] % 5 == 0))
            {
                Console.WriteLine("DENIED");
                return;
            }
        }

        Console.WriteLine("APPROVED");
    }
}


Measured memory_bytes: 13268
A, B, C = gets.chomp.split.map(&:to_i)
K = gets.chomp.to_i
K.times do
  A *= 2 if A == [A, B, C].max
  B *= 2 if B == [A, B, C].max
  C *= 2 if C == [A, B, C].max
end
puts [A, B, C].inject(:+)

Measured memory_bytes: 1788
// AOJ DPL_3_C Largest Rectangle in a Histogram
// 2018.5.12 bal4u
 
#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
 
int in()
{
    int n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

typedef struct { int lp, h; } STACK;
STACK *stack; int top;

long long maxRectInHistogram(int n, int *h)
{
	int i;
	long long s, ans;
	
	stack = malloc(sizeof(STACK) * (n+5));
	h[n] = 0;
	
	ans = 0;
	stack[0].lp = -1, stack[0].h = -1, top = 0;
	for (i = 0; i <= n; i++) {
		if (h[i] == stack[top].h) continue;
		if (h[i] > stack[top].h) {
			stack[++top].lp = i, stack[top].h = h[i];
		} else {
			while (h[i] < stack[top].h) {
				s = (long long)stack[top].h*(i-stack[top].lp);
				top--;
				if (s > ans) ans = s;
			}
			stack[++top].h = h[i];
		}
	}
	free(stack);
	return ans;
}

int h[100002];

int main()
{
	int N, i;

	N = in();
	for (i = 0; i < N; i++) h[i] = in();

	printf("%lld\n", maxRectInHistogram(N, h));
	return 0;
}



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

using namespace std;

int a[100100];

int main()
{
    int n,l,i,k = 0;
    cin >> n >> l;
    for(i = 0; i < n; i ++)
    {
        scanf("%d",&a[i]);
    }
    for(i = 0; i < n-1; i ++)
    {
        if(a[i] + a[i+1] > a[k] + a[k+1]) k = i;
    }
    if(a[k] + a[k+1] < l) cout << "Impossible" << endl;
    else
    {
        cout << "Possible" << endl;
        k ++;
        for(i = n-2; i >= k; i --) printf("%d\n",i+1);
        for(i = 0; i < k; i ++) printf("%d\n",i+1);
    }
    return 0;
}

Measured memory_bytes: 1152
# -*- coding: utf-8 -*-
#AGC009A
import sys
#sys.setrecursionlimit(100000)


n=int(input())

ans=0
a=[]
b=[]
for i in range(0,n):
	tmp = input().split()
	hoge = list(map(lambda a: int(a), tmp))
	a.append(hoge[0])
	b.append(hoge[1])

for i in range(0,n):
	ind=n-1-i
	tmp=b[ind]-(a[n-1-i]+ans)%b[ind]
#	print(tmp)
#	print(b[ind])
	tmp%=b[ind]
	
	ans+=tmp


print(ans)


Measured memory_bytes: 11284
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int input = sc.nextInt();
        int eat = 800 * input;
        int back = (input / 15) * 200;

        System.out.println(eat - back);
    }
}

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

int main() {
    int D, N;
    cin >> D >> N;

    if (D == 0) {
        if (N <= 99) {
            cout << N << endl;
            return 0;
        } else {
            cout << 101 << endl;
            return 0;
        }
    } else if (D == 1) {
        if (N <= 99) {
            cout << N * 100 << endl;
            return 0;
        } else {
            cout << 101 * 100 << endl;
            return 0;
        }
    } else if (D == 2) {
        if (N <= 99) {
            cout << N * 10000 << endl;
            return 0;
        } else {
            cout << 101 * 10000 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

using namespace std;

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

int Read()
{
	char c;
	c=getchar();

	int tsqua=0;

	while(c!=' '&&c!='\n')
	{
		tsqua=(((tsqua<<1)<<1)<<1)+(tsqua<<1)+(int)(c-'0');

		c=getchar();
	}

	return tsqua;
}

typedef long long ll;

int n;
int cnt[100010];
int ans1,ans2;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	for(int i=0;i<n;i++){int x;cin>>x;cnt[x]++;}
	
	for(int i=1;i<=100000;i++)if(cnt[i])ans1+=cnt[i]%2,ans2+=((cnt[i]%2)^1);
	
	cout<<ans1+ans2-ans2%2;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 640
from itertools import accumulate
N,W = map(int,input().split())
V = [[] for _ in range(4)]
w0 = 0
for i in range(N):
    w,v = map(int,input().split())
    if i==0:
        V[0].append(v)
        w0 = w
    else:
        V[w - w0].append(v)

# 降順ソート
for i in range(4):
    V[i].sort(reverse=True)

# 累積和
S = [[] for _ in range(4)]
for i in range(4):
    S[i] = [0] + list(accumulate(V[i]))

# 全探索
ans = 0
for i0 in range(len(S[0])):
    for i1 in range(len(S[1])):
        for i2 in range(len(S[2])):
            for i3 in range(len(S[3])):
                if w0*i0 + (w0+1)*i1 + (w0+2)*i2 + (w0+3)*i3 <= W:
                    ans = max(ans, S[0][i0]+S[1][i1]+S[2][i2]+S[3][i3])

print(ans)


Measured memory_bytes: 3188
from sys import exit
x, y = map(int, input().split())
mod = 10**9 + 7

if (x + y) % 3 != 0:
    print(0)
    exit()

#2 * left + up * 4 = 2 * x
#left * 2 + up = y

up = (2 * x - y) // 3
left = (2 * y - x) // 3

if up < 0 or left < 0:
    print(0)
    exit()

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

#(up + left)C(up)
mod = 10**9 + 7
res = 1
for i in range(1, left + up + 1):
    res = res * i % mod
for i in range(1, up + 1):
    res = res * mod_inv(i, mod) % mod
for i in range(1, left + 1):
    res = res * mod_inv(i, mod) % mod
print(res % mod)

Measured memory_bytes: 41692