akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const double inf = 1e9;
const int mod = 1e5;
const int MAX = 5005;

struct status {int y, x, len;};

int main() {
    int h, w, K; cin >> h >> w >> K;
    vector<string> field_s(h);
    rep(i,h) cin >> field_s[i];
    vvint field_ori(h,vint(w));
    rep(i,h)rep(j,w) field_ori[i][j] = field_s[i][j] - '0';
    int ans = 0;
    rep(i,h)rep(j,w) {
        int sum = 0;
        vvint field = field_ori;
        field[i][j] = 0;
        deque<int> q;
        rep(a,h) if (field[a][j] != 0) q.push_back(field[a][j]);
        while (q.size() < h) q.push_front(0);
        rep(a,h) {
            int x = q.front(); q.pop_front();
            field[a][j] = x;
        }
        int now = 0;
        while (true) {
            bool update = false;
            rep(k,h) {
                int index = 0;
                int ct = 1;
                rep(l,w) {
                    if (field[k][l] == field[k][l+1] && l != w-1) ct++;
                    else {
                        if (ct >= K) {
                            if (field[k][index] != 0) update = true;
                            sum += field[k][index]*ct*pow(2,now);
                            for (int m = index; m < index+ct; m++) field[k][m] = 0;
                        }
                        index = l+1;
                        ct = 1;
                    }
                }
            }
            if (!update) {ans = max(ans,sum); break;}
            deque<int> q;
            rep(l,w) {
                rep(k,h) if (field[k][l] != 0) q.push_back(field[k][l]);
                while (q.size() < h) q.push_front(0);
                rep(k,h) {
                    int x = q.front(); q.pop_front();
                    field[k][l] = x;
                }
            }
            now++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[0]);
                string op = input[1];
                int b = int.Parse(input[2]);
                if (op == "?")
                {
                    break;
                } else if(op == "+") {
                    Console.WriteLine(a + b);
                } else if (op == "-") {
                    Console.WriteLine(a - b);
                } else if (op == "*") {
                    Console.WriteLine(a * b);
                } else if (op == "/") {
                    Console.WriteLine(a / b);
                }
            }

        }
    }
}


Measured memory_bytes: 17884
#include <bits/stdc++.h>
#define fr first
#define sc scanf
#define pf printf
#define se second
#define sq(x) x * x
#define ll long long
#define pb push_back
#define mk make_pair
#define ld long double
#define pr pair<int,int>
#define sz(s) int(s.size())
#define piip pair< pair<ll,ll>,ll >
#define fin(s) freopen( s, "r", stdin )
#define fout(s) freopen( s, "w", stdout )
#define TIME ios_base::sync_with_stdio(0)
using namespace std;

const ll INF = 1e9;
const ll N = 1e5 + 1;
const ll mod = 1e9 + 7;
const long double eps = 1E-7;

string s;
int main()
{
    TIME;
    cin >> s;
    sort( s.begin(), s.end() );
    if( s[0] == s[1] && s[2] == s[3] && s[0] != s[3] )
        cout << "Yes";
    else
        cout << "No";
}


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

public class Main
{
    public static void main(String[] args) throws IOException
    {
        int n = nextInt(), l = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        int q = -1;
        for (int i = 0; i < n - 1; i++) {
            if (a[i] + a[i + 1] >= l) q = i;
        }
        if (q == -1) out.println("Impossible"); else {
            out.println("Possible");
            for (int i = 0; i <= q - 1; i++) out.println(i + 1);
            for (int i = n - 2; i >= q; i--) out.println(i + 1);
        }
        out.close();
    }

    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer st = null;

    static String nextToken() throws IOException
    {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    static int nextInt() throws IOException
    {
        return Integer.parseInt(nextToken());
    }
}


Measured memory_bytes: 24836
#include<bits/stdc++.h>
using namespace std;
    int sum(int x)
    {
        int suma = 0;
        while(x)
        {
            suma += x % 10;
            x /= 10;

        }
        return suma;
    }
    main()
    {
        int n;
        cin >> n;
        int a, b;
        int ans = 1e9;
        int javob = 1e9;
        for(int i = 1; i <=n-1;i++){
             a = n - i;
             b = i;
             ans  = sum(a) + sum(b);

             javob = min(ans,javob);
        }
        cout << javob;



    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

int solve(){
    int a,b; cin >> a >> b;
    if(a+b == 15) cout << '+' << endl;
    else if(a*b == 15) cout << '*' << endl;
    else cout << 'x' << endl;
    

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 256
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()
ci = a[-1]
index = bisect.bisect_left(a, ci/2)
if abs(a[index]-ci/2)<abs(a[index-1]-ci/2):
    print(ci, a[index])
else:
    print(ci, a[index-1])

Measured memory_bytes: 84908
#include <bits/stdc++.h>
using namespace std;
int mod =1000000007;
int main(){
    int n;
    long long sum=0;
    long long x=0;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        sum = (sum+a[i]*x)%mod;
        x=(x+a[i])%mod;
    }
    cout<<sum<<endl;
    return(0);
}

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

int main() {
	int n,m,f;
	char c[200];

	cin >> n;
	cin >> c;

	f=1;
	if(n != (n/2)*2)
		f=0;
	else{
		m=n/2;
		for(int i=0;i<m;i++){
			if(c[i] != c[m+i]){
				f=0;
				break;
			}
		}
	}
	if(f==1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

class Node{
public:
    int location;
    int p, l, r;
    Node(){}
};
class Point{
public:
    int id, x, y;
    Point(){}
    Point(int id, int x, int y): id(id), x(x), y(y){}
    bool operator<(const Point &p) const{
        return id < p.id;
    }

    void print(){
        printf("%d\n", id);
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2){return p1.x < p2.x;}
bool lessY(const Point &p1, const Point &p2){return p1.y < p2.y;}

int makeKDTree(int l, int r, int depth){
    if(!(l<r)) return NIL;
    int mid = (l+r)/2;
    int t = np++;
    if(depth%2 == 0) {
        sort(P+l, P+r, lessX);
    }
    else{
        sort(P+l, P+r, lessY);
    }

    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth+1);
    T[t].r = makeKDTree(mid+1, r, depth+1);

    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans){
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if(sx <= x && x <= tx && sy <= y && y<=ty){
        ans.push_back(P[T[v].location]);
    }

    if(depth%2 == 0){
        if(T[v].l != NIL){
            if(sx<=x) find(T[v].l, sx, tx, sy, ty, depth+1, ans);
        }
        if(T[v].r != NIL){
            if(x<=tx) find(T[v].r, sx, tx, sy, ty, depth+1, ans);
        }
    }
    else{
        if(T[v].l != NIL){
            if(sy <= y) find(T[v].l, sx, tx, sy, ty, depth+1, ans);
        }
        if(T[v].r != NIL){
            if(y<=ty) find(T[v].r, sx, tx, sy, ty, depth+1, ans);
        }
    }
}

int main(int argc, char const *argv[])
{
    int x, y;
    scanf("%d", &N);
    for(int i=0; i<N; i++){
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }

    np = 0;

    int root = makeKDTree(0, N, 0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    vector<Point> ans;
    for(int i=0; i< q; i++){
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        sort(ans.begin(), ans.end());
        for(int j=0; j<ans.size(); j++){
            ans[j].print();
        }
        printf("\n");
    }

    return 0;
}




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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<long long> a(n), b(n), c(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	for(int i = 0; i < n; i++) cin >> c[i];
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for(int i = 0; i < n; i++){
		long long ida = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		long long idc = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
		ans += ida * idc;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
import sys

input = sys.stdin.buffer.readline

import numpy as np

N = int(input())

A = np.array(input().split(), dtype=np.int32) # 32ビットで9桁の数字を記述できる。今回は10^9までなので、これでOK。
B = np.array(input().split(), dtype=np.int32)
C = np.array(input().split(), dtype=np.int32)

A.sort()
B.sort()
C.sort()

num_a = np.searchsorted(A, B, side="left")
num_c = N - np.searchsorted(C, B, side="right")

res = np.dot(num_a, num_c)

print(res)

Measured memory_bytes: 20032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{


   int n,k,sz;
   cin>>n>>k;
   string s;
   cin>>s;
   sz=s.size();
   for(int i=0 ; i<sz ; i++){
    if(i==k-1){
        cout<<char(tolower(s[i]));
    }
    else
        cout<<s[i];
   }
   cout<<endl;

}


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

#include "bits/stdc++.h"

template <typename T>
class LazySkewHeap
{
    struct Node
    {
        T val, add;
        Node *l, *r;

        Node(T v) : val(v), add(0), l(NULL), r(NULL) {}
        Node() {}
    };

    Node *root;

private:
    void lazy(Node *a)
    {
        if (a->l)
            a->l->add += a->add;
        if (a->r)
            a->r->add += a->add;
        a->val += a->add;
        a->add = 0;
    }

    Node *meld(Node *a, Node *b)
    {
        if (!a)
            return b;
        if (!b)
            return a;
        // min Heap
        if (a->val + a->add > b->val + b->add)
            std::swap(a, b);
        lazy(a);
        a->r = meld(a->r, b);
        std::swap(a->l, a->r);
        return a;
    }

public:
    LazySkewHeap() : root(NULL) {}

    void meld(LazySkewHeap *lsh)
    {
        root = meld(root, lsh->root);
    }

    void push(T v)
    {
        root = meld(root, new Node(v));
    }

    void add(T add)
    {
        assert(root != NULL);
        root->add += add;
    }

    T top()
    {
        assert(root != NULL);
        return root->val + root->add;
    }

    void pop()
    {
        assert(root != NULL);
        lazy(root);
        root = meld(root->l, root->r);
    }

    bool empty()
    {
        return !root;
    }
};

using namespace std;

void solve_itp2_2_c()
{
    int n, q;
    cin >> n >> q;
    vector<LazySkewHeap<int>> que(n);
    while (q--)
    {
        int com;
        cin >> com;
        if (com == 0)
        {
            int t, x;
            cin >> t >> x;
            que[t].push(-x);
        }
        else if (com == 1)
        {
            int t;
            cin >> t;
            if (que[t].empty())
                continue;
            cout << -que[t].top() << endl;
        }
        else
        {
            int t;
            cin >> t;
            if (que[t].empty())
                continue;
            que[t].pop();
        }
    }
}

int main()
{
    solve_itp2_2_c();
}



Measured memory_bytes: 8988
#include <stdio.h>
 
int main(void) {
    int a[80];
    int b[80];
    int result[80];
    int ketaagari;
    int i,j;
    int max;
    int temp[80];
    char in;
    int overflow;
    int count,kazu;
    scanf("%d",&kazu);
    while(getchar()!='\n');
    for(count=0;count<kazu;count++) {
        for(i=0;i<80;i++) {
            a[i]=0;b[i]=0;
        }
        i=0;
        overflow=0;
        while((in=getchar())!='\n') {
            temp[i]=in-'0';
            i++;
            if(i>80) {
                overflow=1;
                while(getchar()!='\n');
                break;
            }
        }
        if(overflow==0) {
            for(j=0;j<i;j++)a[j]=temp[i-j-1];
        }
        i=0;
        while((in=getchar())!='\n') {
            temp[i]=in-'0';
            i++;
            if(i>80) {
                overflow=1;
                while(getchar()!='\n');
                break;
            }
        }
        if(overflow==0) {
            for(j=0;j<i;j++)b[j]=temp[i-j-1];
 
            for(i=0,ketaagari=0,max=0;i<80;i++) {
                result[i]=(a[i]+b[i]+ketaagari)%10;
                ketaagari=(a[i]+b[i]+ketaagari)/10;
                if(result[i]!=0)max=i;
            }
            if(ketaagari)overflow=1;
        }
        if(overflow==0) {
            for(i=max;i>=0;i--)printf("%d",result[i]);
            printf("\n");
        } else printf("overflow\n");
    }
    return 0;
}

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

int main() {
    long mod = 1e9+7;
    string S;
    cin>>S;
    long DP[13][S.size()];
    for(int i=0;i<13;++i){
        for(int j=0;j<S.size();++j){
            DP[i][j] = 0;
        }
    }

    int amari = 1;
    for(int i=S.size()-1;i>=0;--i){
        if(i==S.size()-1){
            if(S[i]=='?'){
                for(int j=0;j<=9;++j){
                    DP[j][i] = 1;
                }
            }
            else{
                DP[(S[i]-'0')][i] = 1;
            }
        }
        else{
            if(S[i]=='?'){
                for(int j=0;j<=9;++j){
                    for(int k=0;k<13;++k){
                        DP[(j*amari+k)%13][i] += DP[k][i+1];
                        DP[(j*amari+k)%13][i] %= mod;
                    }
                }
            }
            else{
                for(int k=0;k<13;++k){
                    DP[((S[i]-'0')*amari+k)%13][i] += DP[k][i+1];
                    DP[((S[i]-'0')*amari+k)%13][i] %= mod;
                }
            }
        }
        amari = (amari * 10) % 13;
    }
    /**
    for(int i=0;i<13;++i){
        for(int j=0;j<S.size();++j){
            cout<<DP[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    **/
    cout<<DP[5][0]<<endl;
}


Measured memory_bytes: 10624
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()

def main():
    a = input()

    if ord('A') <= ord(a) <= ord('Z'):
        print('A')
    else:
        print('a')




if __name__ == "__main__":
  main()

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

#define N 3
#define N2 9

struct Puzzle {
    int f[N2];
    int space;
    string path;

    bool operator = (const Puzzle &p) const {
        for (int i = 0; i < N2; i++) {
            if (f[i] != p.f[i]) return false;
        }

        return true;
    }

    bool operator < (const Puzzle &p) const {
        for (int i = 0; i < N2; i++) {
            if (f[i] == p.f[i]) continue;
            return f[i] > p.f[i];
        }

        return false;
    }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p) {
    for (int i = 0; i < N2; i++) {
        if (p.f[i] != (i + 1)) return false;
    }
    return true;
}

string bfs(Puzzle start) {
    map<Puzzle, bool> m;
    m[start] = true;
    queue<Puzzle> Q;
    Q.push(start);

    while (!Q.empty()) {
        Puzzle x = Q.front();
        Q.pop();
        if (isTarget(x)) {
            return x.path;
        }
        int spaceX = x.space / N;
        int spaceY = x.space % N;
        for (int i = 0; i < 4; i++) {
            int nextX = spaceX + dx[i];
            int nextY = spaceY + dy[i];
            if (nextX < 0 || nextX >= N || nextY < 0 || nextY >= N) {
                continue;
            }

            Puzzle nextP = x;
            nextP.space = nextX * N + nextY;
            nextP.path += dir[i];
            swap(nextP.f[x.space], nextP.f[nextX * N + nextY]);
            if (!m[nextP]) {
                m[nextP] = true;
                Q.push(nextP);
            }
        }
    }

    return "";
}

int main() {
    Puzzle p;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> p.f[N * i + j];
            if (p.f[N * i + j] == 0) {
                p.f[N * i + j] = N2;
                p.space = N * i + j;
            }
        }
    }
    p.path = "";

    string ans = bfs(p);

    cout << ans.length() << endl;

    return 0;
}


Measured memory_bytes: 33844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();
		s.nextLine();
		
		int[] heights = new int[n];
				
		for(int i = 0; i < n; i++) {
			heights[i] = s.nextInt();
		}
		
		int[] minAtN = new int[n];
		
		minAtN[0] = 0;
		
		if(minAtN.length > 1) {
			minAtN[1] = Math.abs(heights[1] - heights[0]);
		}
		
		for(int i = 2; i < n; i++) {
			
			// find minimum

			int min = minAtN[i - 1] + Math.abs(heights[i - 1] - heights[i]);
			
			int j = i - k >= 0 ? i - k : 0;
			for(; j < i - 1; j++) {
				min = Math.min(min, minAtN[j] + Math.abs(heights[j] - heights[i]));
			}
			
			minAtN[i] = min;
		}
		
		System.out.println(minAtN[n-1]);
		
	}
}


Measured memory_bytes: 50928
#include <iostream>
#include <string>

using namespace std;

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

	int former = stoi(s.substr(0, 2));
	int latter = stoi(s.substr(2, 2));

	bool formerIsYear = (former >=0);
	bool formerIsMonth = (former >= 1 && former <= 12);
	bool latterIsYear = (latter >= 0);
	bool latterIsMonth = (latter >= 1 && latter <= 12);

	if (formerIsYear && latterIsMonth)
	{
		if (latterIsYear && formerIsMonth)
		{
			cout << "AMBIGUOUS";
		}
		else
		{
			cout << "YYMM";
		}
	}
	else
	{
		if (latterIsYear && formerIsMonth)
		{
			cout << "MMYY";
		}
		else
		{
			cout << "NA";
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int t;
   t=1;
   int mod=1e9+7;
   while(t--)
   {
    int n;
    cin>>n;
    ll a[n];
    ll prefix[n]={0};
    for(int i=0;i<n;i++)
        cin>>a[i];
    prefix[1]=a[0];
    for(int i=2;i<n;i++)
        prefix[i]+=(prefix[i-1]+a[i-1]);
    ll sum=0;
    for(int i=1;i<n;i++)
         sum=((sum%mod)+((prefix[i]%mod)*(a[i]%mod))%mod)%mod;
    cout<<sum;
   }
}


Measured memory_bytes: 6716
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
int ka[214514],inv[214514];
void setkaijo(int n){
	ka[0]=1;
	for(int i=1;i<=n;i++){
		ka[i] = ka[i-1] * i;
		ka[i] %= inf;
	}
}
int modpow(int x,int k){
	// x ^ k mod inf
	int p2[55],res=1;
	p2[0]=1;p2[1]=x%inf;
	for(int i=2;i<=50;i++){
		p2[i]=p2[i-1]*p2[i-1];
		p2[i] %= inf;
	}
	for(int i=1;i<=50;i++){
		if(k%2==1){
			res *= p2[i];
			res %= inf;
		}
		k /= 2;
	}
	return res;
}
void setinv(int n){
	for(int i=0;i<=n;i++){
		inv[i] = modpow(ka[i],(ll)inf-2);
	}
}
int comb(int n,int k){
	if(k==0 || k==n)return 1;
	int res = (ka[n] * inv[k]) % inf;
	res = (res*inv[n-k]) % inf;
	return res;
}
ll cmb[214514];
ll ap[114514],bp[214514],hnv[214514],hv[214514];
signed main(){
	ll n,a,b,c;
	cin>>n>>a>>b>>c;
	setkaijo(210000);
	setinv(210000);
	for(int i=n-1;i<=2*n;i++){
		cmb[i] = comb(i,n-1);
	}
	ap[0]=1;
	bp[0]=1;
	hnv[0] = 1;
	hv[0]=1;
	ll h = modpow(a+b,(ll)inf-2);
	ll w = modpow(100-c,(ll)inf-2);
	for(int i=1;i<=2*n;i++){
		ap[i] = ap[i-1] * a;
		ap[i] %= inf;
		bp[i] = bp[i-1] * b;
		bp[i] %= inf;
		hnv[i] = hnv[i-1] * h;
		hnv[i] %= inf;
		hv[i] = hv[i-1] * (a+b);
		hv[i] %= inf;
	}
	ll ans = 0;
	for(int i=n;i<=2*n-1;i++){
		ll tmp = 1;
		tmp = (tmp * cmb[i-1]) % inf;
		tmp = (tmp * ((ap[n]*bp[i-n] + ap[i-n]*bp[n])%inf))%inf;
		tmp = (tmp * 100 * i)%inf;
		tmp = (tmp * hv[2*n-1-i])%inf;
		ans = (ans +tmp)%inf;
	}
	ans = (ans * hnv[2*n-1])%inf;
	ans = (ans * w)%inf;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11008
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

class Node{
public:
  string s;
  int p;
  vector<int> c;
  set<string> f;
  Node(){ c.clear(); f.clear(); }
  Node(string s, int p): s(s), p(p){ c.clear(); f.clear(); }
};

vector<Node> nodes;
int n, m;

void push(int s, int pos, vector<string>& vec){
  if(s + 1 == (int)vec.size()){
    if(nodes[pos].f.find(vec[s]) == nodes[pos].f.end()) nodes[pos].f.insert(vec[s]);
    return;
  }
  if(vec[s] == "." && s + 1 < (int)vec.size()) push(s + 1, pos, vec);
  if(vec[s] == "..") push(s + 1, nodes[pos].p, vec);
  bool f = false;
  for(int i=0;i<(int)nodes[pos].c.size();i++){
    int id = nodes[pos].c[i];
    if(nodes[id].s == vec[s]){
      f = true;
      push(s + 1, id, vec);
    }
  }
  if(!f){
    nodes.push_back(Node(vec[s], pos));
    nodes[pos].c.push_back((int)nodes.size()-1);
    push(s + 1, (int)nodes.size()-1, vec);
  }
}

int find(int s, int pos, vector<string>& vec){
  //cout << vec[s] << endl;
  if(s + 1 == (int)vec.size()){
    if(nodes[pos].f.find(vec[s]) == nodes[pos].f.end()) return -1;
    else return pos;
  }
  if(vec[s] == "."){
    return find(s + 1, pos, vec);
  }
  if(vec[s] == ".."){
    if(pos == 0) return -1;
    else{
      return find(s + 1, nodes[pos].p, vec);
    }
  }
  for(int i=0;i<(int)nodes[pos].c.size();i++){
    int id = nodes[pos].c[i];
    if(nodes[id].s == vec[s]){
      return find(s + 1, id, vec);
    }
  }
  return -1;
}

string path(int p){
  string res;
  if(p == 0) res = "";
  else res += nodes[p].s;
  return res;
}

vector<string> parse(string str){
  vector<string> res;
  int pre = 1;
  for(int i=1;i<(int)str.size();i++){
    if(str[i] == '/'){
      res.push_back(str.substr(pre, i - pre));
      pre = i + 1;
    }
  }
  res.push_back(str.substr(pre));
  return res;
}

int main(){
  while(cin >> n >> m && (n|m)){
    nodes.clear();
    nodes.push_back(Node("root", -1));
    for(int i=0;i<n;i++){
      string in;
      cin >> in;
      vector<string> vec = parse(in);
      push(0, 0, vec);
    }
    /*for(int i=1;i<(int)nodes.size();i++){
      cout << i << ' ' << nodes[i].s << " <= " << nodes[nodes[i].p].s << endl;
      }*/
    for(int i=0;i<m;i++){
      string a[2], b[2];
      cin >> a[0] >> b[0];
      if(a[0][(int)a[0].size()-1] == '/'){
	a[0] += "index.html";
	a[1] = a[0];
      }else{
	//a[1] = a[0];
	a[1] = a[0] + "/index.html";
      }
      if(b[0][(int)b[0].size()-1] == '/'){
	b[0] += "index.html";
	b[1] = b[0];
      }else{
	//b[1] = b[0];
	b[1] = b[0] + "/index.html";
      }
      int ans = 0;
      for(int i=0;i<2;i++){
	for(int j=0;j<2;j++){
	  vector<string> v1 = parse(a[i]);
	  vector<string> v2 = parse(b[j]);
	  int p1 = find(0, 0, v1);
	  int p2 = find(0, 0, v2);	  
	  if(p1 != -1 && p2 != -1){
	    if(path(p1) + "/" + v1[(int)v1.size()-1] == path(p2) + "/" + v2[(int)v2.size()-1]) ans = 2;
	    else ans = max(ans, 1);
	  }
	}
      }
      if(ans == 0) cout << "not found" << endl;
      else if(ans == 1) cout << "no" << endl;
      else cout << "yes" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1268
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    for(int i=0; ;i++){
        int m=sc.nextInt();
        int f=sc.nextInt();
            int r=sc.nextInt();
        if(m==-1&&f==-1&&r==-1) break;
            if(m==-1 || f==-1){
            System.out.println("F");
        }else if(m+f>=80){
             System.out.println("A");
        }else  if(m+f<80&&m+f>=65) {
               System.out.println("B");
        }else if(m+f<65&&m+f>=50) {
                 System.out.println("C");
        }else   if(m+f<50&&m+f>=30){
        if(r>=50) {
                   System.out.println("C");
        }else    System.out.println("D");
        }else if(m+f<30)System.out.println("F");
    }
    }

   
}



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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx, dy = ty - sy;
    for(int i=0;i<dx;++i){
        printf("R");
    }
    for(int i=0;i<dy;++i){
        printf("U");        
    }
    for(int i=0;i<dx;++i){
        printf("L");
    }
    for(int i=0;i<dy;++i){
        printf("D");
    }
    printf("D");
    for(int i=0;i<dx+1;++i){
        printf("R");
    }
    for(int i=0;i<dy+1;++i){
        printf("U");
    }
    printf("LU");
    for(int i=0;i<dx+1;++i){
        printf("L");
    }
    for(int i=0;i<dy+1;++i){
        printf("D");
    }
    printf("R");
    puts("");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
double MPI = 3.14159265358979;


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

  double ans;
  if ( x <= ((a*a*b)/2) ) { // x is less than half
    ans = atan( (double)(a*b*b) / (double)(2*x) );
  }
  else { // x is less than half
    ans = atan( (double)(2*(a*a*b - x) / (double)(a*a*a)) );
  }

  cout << setprecision(11) << ans * 360 / (2 * MPI) << endl;

  return 0;
}


Measured memory_bytes: 256
import re
s = input()
if len(s) >= 7 and len(s) <= 107 and (re.match('^keyence.*',s) or re.match('.*keyence$',s) or re.match('^k.*eyence$',s) or re.match('^ke.*yence$',s) or re.match('^key.*ence$',s) or re.match('^keye.*nce$',s) or re.match('^keyen.*ce$',s) or re.match('^keyenc.*e$',s)):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
# include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k, ans = 0;
	cin >> k >> n;
	vector < int > a(n + 1, 0);
	for(int i = 0; i < n; i++)cin >> a[i];
	a[n] = a[0] + k;
	for(int i = 1; i <= n; i++){
		ans = max(ans, a[i] - a[i - 1]);
	}
	cout << k - ans << endl;
}

Measured memory_bytes: 1152
import Foundation

extension String {
    
    func toStrList() -> [String] {
        return self.map{String($0)}
    }
    
    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }
    
    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }
    
    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }
    
    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]
        
        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }
    
    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }
    
    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])
    
}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]
    
    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y
    
    return [rx, ry]
}




func abc079a() -> String {
    let N = readLine()!.toIntList()
    if N[0] == N[1] && N[1] == N[2] {
        return "Yes"
    }
    if N[1] == N[2] && N[2] == N[3] {
        return "Yes"
    }
    return "No"
}


print(abc079a())

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

using namespace std;
typedef long long ll;
#define next asdnext
#define prev asdprev
#define all(x) (x).begin(), (x).end()
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(int argc, char const *argv[]) {
  ll n, cnt = 0, zero = 0, ans = 0, minimum = INFINITY;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < 0) cnt++;
    if (a[i] == 0) zero++;
    minimum = min(abs(a[i]), minimum);
  }

  for (int i = 0; i < n; i++) {
    ans += abs(a[i]);
  }
  if (zero > 0 || cnt % 2 == 0) {
    cout << ans;
  } else {
    cout << ans - 2 * minimum;
  }

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val vowel = Array("a", "i", "u", "e", "o")
    if (vowel.contains(sc.nextLine)) println("vowel")
    else println("consonant")
  }
}


Measured memory_bytes: 25416
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main(){
  string A,B,C; cin >>A >>B >>C;
  bool flag=false;
  if (A.back()==B.front() && B.back()==C.front()) flag=true;
  cout <<(flag ? "YES":"NO") <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,a[400005],cnt[200005],nxt[400005],lst[200005],p,q[200005],sta;
int ti[200005];
vector<int> f;
ll k;
void simulate(int x,int y){
    rep(i,1,x){
        int cur=a[(i+y-1)%n+1];
        bool flg=cnt[cur];
        while(cnt[cur]>0){
            cnt[q[p]]--;
            p--;
        }
        if(!flg) cnt[cur]++,q[++p]=cur;
        //cout<<i<<":";
        //rep(j,1,p) cout<<q[j]<<' ';
        //cout<<'\n';
    }
    rep(i,1,p) cout<<q[i]<<' ';
}
int main()
{
    cin>>n>>k;
    rep(i,1,n) cin>>a[i],a[i+n]=a[i];
    per(i,2*n,1){
        nxt[i]=lst[a[i]];
        lst[a[i]]=i;
    }
    int cur=1,len=0;
    while(1){
        if(ti[cur]) break;
        ti[cur]=len+1;
        len++;
        f.pb(nxt[cur]-cur+1);
        cur=((nxt[cur]-1)%n+1)%n+1;
    }
    sta=ti[cur]-1;
    assert(sta==0);
    ll l=0;len=0;
    rap(i,0,f.size()){
        l+=f[i];
    }
    len=l/n;
    k=(k-1)%len+1;
    l=0;
    rep(i,0,f.size()){
        if(i<f.size()) l+=f[i];
        if(l>=k*n) {simulate(k*n-(l-f[i]),(l-f[i]-1)%n+1);break; }
    }
    return 0;
}

Measured memory_bytes: 8692
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

void dfs(llong node, vector<vector<llong> > &graph, vector<bool> &seen, llong a, llong b){
    llong next_node;

    if(seen[node]){
        return;
    }
    seen[node] = true;
    for(int i=0; i<graph[node].size(); i++){
        next_node = graph[node][i];
        if(a==node && b==next_node){
            continue;
        }
        if(a==next_node && b==node){
            continue;
        }
        dfs(next_node, graph, seen, a, b);
    }
}

int main(){
    llong N,M;
    llong a,b;
    llong ans=0;
    cin >> N >> M;
    vector<vector<llong> > graph(N);
    vector<vector<llong> > graph_copy(N);
    vector<vector<llong> > edge(M);
    vector<bool> seen(N);
    char flg;
    for(int i=0; i<M; i++){
        cin >> a >> b;
        graph[a-1].push_back(b-1);
        graph[b-1].push_back(a-1);
        edge[i].push_back(a-1);
        edge[i].push_back(b-1);
    }
    for(int i=0; i<edge.size(); i++){
        seen.assign(N, false);
        flg = 0;
        dfs(0, graph, seen, edge[i][0], edge[i][1]);
        for(int j=0; j<seen.size(); j++){
            if(seen[j]==false){
                flg = 1;
            }
        }
        if(flg==1){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3152
#include<bits/stdc++.h>
int n;
char a[101010];
void solve() {
	scanf("%d", &n);
	/*for(int i=1;i<=n;++i){

		scanf("%d",a+i);

	}*/
	scanf("%s", a + 1);
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] != a[i - 1]) {
			++cnt;
		}
	}
	printf("%d\n", cnt);
}
int main() {
	solve();

	return 0;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
bool solve()
{
    int n; cin>>n;
    while(n)
    {
        if(n%10==7)
        return true;
        n=n/10;
    }
    return false;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test;test=1;
    while(test--)
    {
        if(solve())
        cout<<"Yes";
        else
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
}
 int dp[100005];
 
 /*bool memo(int k)
 {
     if(k<=0)
     return false;
     
     if(dp[k]!=-1)
     return dp[k]==1;
     for(auto x:arr)
     {
         if(k-x>=0)
         {
             bool state=memo(k-x);
             dp[k-x]=
         }
         
     }
     dp[k]=
     
 }*/
int32_t main()
{
    c_p_c();
    int n,k;
    cin>>n>>k;
    memset(dp,0,sizeof(dp));
    vi arr(n,0);
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    
    for(int i=0;i<=k;i++)
    {
        for(auto x:arr)
        {
            if(i-x>=0 and !dp[i-x])
            {
                dp[i]=1;
            }
        }
    }
    string ans="";
    if(dp[k]==1)
    ans+="First";
    else
    ans+="Second";
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int h, w;
  cin >> h >> w;
  char masu[h][w];
  rep (i, h) {
    rep (j, w) {
      cin >> masu[i][j];
    }
  }

  int tate[w];
  int yoko[h];
  rep (i, h) {
    int flag = 0;
    rep (j, w) {
      if (masu[i][j] == '#') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      yoko[i] = 1;
    } else {
      yoko[i] = 0;
    }
  }

  rep (j, w) {
    int flag = 0;
    rep (i, h) {
      if (masu[i][j] == '#') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      tate[j] = 1;
    } else {
      tate[j] = 0;
    }
  }

  rep (i, h) {
    if (yoko[i] == 1) continue;
    rep (j, w) {
      if (tate[j] == 1) continue;
      cout << masu[i][j];
    }
    cout << endl;
  }



  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long array[] = new long[num];
		for(int i = 0; i < num; i ++) {
			array[i] = sc.nextLong();
		}
		long maxFromLeft[] = new long[num];
		maxFromLeft[0] = array[0];
		for(int i = 1; i < num; i ++) {
			maxFromLeft[i] = Math.max(maxFromLeft[i - 1], array[i]);
		}
		long maxFromRight[] = new long[num];
		maxFromRight[num - 1] = array[num - 1];
		for(int i = num - 2; i >= 0; i --) {
			maxFromRight[i] = Math.max(maxFromRight[i + 1], array[i]);
		}
		System.out.println(maxFromRight[1]);
		for(int i = 1; i < num - 1; i ++) {
			System.out.println(Math.max(maxFromLeft[i - 1], maxFromRight[i + 1]));
		}
		System.out.println(maxFromLeft[num - 2]);
	}
}

Measured memory_bytes: 94776
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string s2 = System.Console.ReadLine().Trim();
            int iN = int.Parse(s2);
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            List<int> lstFlw = new List<int>();
            for (int i = 0; i < sS.Length; i++)
            {
                lstFlw.Add(int.Parse(sS[i]));                   // 規定の高さ
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iC = 0;                                         // 水やり回数
            while (true)
            {
                Boolean bWat = false;                           // 水やり中
                Boolean bOne = false;                           // 1回でも水やりやったか？
                for (int i = 0; i < lstFlw.Count; i++)          // 全ての花に対して
                {
                    if (lstFlw[i] == 0)                         // 規定の高さになった
                    {
                        bWat = false;                           // 水やり中止
                    }
                    else                                        // まだ成長中
                    {
                        lstFlw[i] -= 1;                         // 伸びた
                        bOne = true;                            // 1回でも水やり実施
                        if (!bWat) { iC += 1; bWat = true; }    // 水やり開始 水やり中はカウントしない
                    }
                }
                if (!bOne) { break; }                           // 1回も水やりしていない→全ての花が規定高さになった
            }

            // 出力
            System.Console.WriteLine("{0}", iC.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define SZ(c) int(c.size())
#define pb push_back
#define loop(i,start,n)  for(int i=start;i<n;i++)
#define rloop(i,start,n)  for(int i=start;i>n;i--)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
const ll inf = 2e9+3;

void solve(){
    int tc=1 ;
    //cin >> tc;
    while(tc--) {
        ll n; cin >> n;
        vll v(n+2,0);
        loop(x,1,101){
            loop(y,1,101){
                loop(z,1,101){
                    ll ac = x*x + y*y + z*z + x*y + y*z + z*x;
                    if(ac <= n) v[ac]++;
                }
            }
        }
        loop(i,1,n+1)
            cout << v[i] << "\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;


void solve(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cout<<"ACL";cout<<"\n";	
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var a = Console.ReadLine().Split();

        decimal b = Convert.ToDecimal(a[0]);
        decimal c = Convert.ToDecimal(a[1]);

        long d = (long)b * (long)(c * 100);
        Console.Write((long)(d / 100));
    }

  
}

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

class Program
{
    static long INF = 1000000001;
    static long cnt = 0;
    static void Merge(long[] A, int left, int mid, int right)
    {
        int n1 = mid - left;
        int n2 = right - mid;
        long[] B = new long[n1 + 1];
        long[] C = new long[n2 + 1];
        for (int i = 0; i < n1; i++) B[i] = A[left + i];
        for (int i = 0; i < n2; i++) C[i] = A[mid + i];
        B[n1] = INF;
        C[n2] = INF;
        int f1 = 0, f2 = 0;
        for (int k = left; k < right; k++)
        {
            if (B[f1] <= C[f2])
            {
                A[k] = B[f1];
                f1++;
            }
            else
            {
                A[k] = C[f2];
                f2++;
            }
            cnt++;
        }
    }

    static void MergeSort(long[] A, int left, int right)
    {
        if (left + 1 < right)
        {
            int mid = (left + right) / 2;
            MergeSort(A, left, mid);
            MergeSort(A, mid, right);
            Merge(A, left, mid, right);
        }
    }

    static void OutputArray(long[] A)
    {
        for (int i = 0; i < A.Length - 1; i++) Console.Write("{0} ", A[i]);
        Console.WriteLine(A[A.Length - 1]);
    }

    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        long[] S = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        MergeSort(S, 0, n);
        OutputArray(S);
        Console.WriteLine(cnt);
    }
}


Measured memory_bytes: 76032
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a,b;
    int cnt=0;
    a = sc.next();
    b = sc.next();
    
    for(int i=0;i<3;i++){
      if(a.charAt(i) == b.charAt(i)) cnt++;
    }
    System.out.println(cnt);
    
  }
}

Measured memory_bytes: 21844