akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

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

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// 正の整数n未満の素数を全て求める
vector<ll> sieve(ll n) {
  vector<bool> is_prime(n);
  rep(i, n) is_prime[i] = true;

  is_prime[1] = false;
  for (ll i = 4; i < n; i += 2) is_prime[i] = false;
  ll lim = ll(sqrt(n));
  for (ll i = 3; i <= lim; i += 2) {
    for (ll j = 3; i * j < n; j += 2) {
      is_prime[i * j] = false;
    }
  }

  vector<ll> ret;
  for (ll i = 1; i < n; i++) {
    if (is_prime[i]) ret.push_back(i);
  }
  return ret;
}

void solve() {
  ll n; cin >> n;
  ll ans = 1;
  vector<ll> primes = sieve(n + 1);

  for (int p : primes) {
    ll cnt = 1, q = p;
    while (q <= n) {
      cnt += n / q;
      q *= p;
    }
    ans = ans * cnt % MOD;
  }

  outl(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 632
def main():
  Nums = int(input())
  numbers = map(int,input().split())

  nums_ = sorted(numbers)
  
  val = (nums_[0]+nums_[1])/2.0
  if Nums==2:
    print(val)
    return

  for i in range(2,len(nums_)):
    if i == 0:
      val = (nums_[i]+nums_[i+1])/2.0
    else:
      val = (val + nums_[i])/2.0
  print(val)  
  return


if __name__ == "__main__":
  main()





Measured memory_bytes: 3060
from collections import deque

def main():
    S = input()
    P = input()

    s = deque(S)
    n = len(S)
    for _ in range(n):
        s.append(s.popleft())
        if P in ''.join(s):
            ans = 'Yes'
            break
    else:
        ans = 'No'

    print(ans)

main()

Measured memory_bytes: 7852
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

string s, t;
int f[MAXN][26], g[26];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> s >> t;
    int n = SZ(s);
    s = " " + s + s;
    FOR(i,0,25) g[i] = -1;
    FORE(i,SZ(s)-1,0) {
        FOR(j,0,25) f[i][j] = g[j];
        if (i) {
            if (i > n) g[s[i]-'a'] = i-n;
            else g[s[i]-'a'] = i;
        }
    }
    // FOR(i,0,SZ(s)-1) {
    //     FOR(j,0,25) cout << f[i][j] << ' ';
    //     cout << endl;
    // }
    int now = 0;
    int times = 0;
    FOR(i,0,SZ(t)-1) {
        int pos = f[now][t[i]-'a'];
        // cout << pos << endl;
        if (pos == -1) {
            cout << -1;
            return 0;
        }
        if (pos <= now) times++;
        now = pos;
    }
    cout << (ll) times*n + now;
    return 0;
}


Measured memory_bytes: 20972
#include<stdio.h>

int main(void){

    int n;
    scanf("%d", &n);

    for(int i = 1; i <= n; i++){
        if(i % 3 == 0){
            printf(" %d", i);
            continue;
        }
        int temp = i;
        while(temp){
            if(temp % 10 == 3){
                printf(" %d", i);
                break;
            } else {
                temp /= 10;
            }
        }
    }
	printf("\n");
	
    return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  long long a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << std::max({a * c, a * d, b * c, b * d}) << endl;

  return 0;
}


Measured memory_bytes: 3568
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
#define ULL unsigned long long
int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define MAXN int(1e5)
#define INF 0x3f3f3f3f
bool vis[2*MAXN+5];
int fa[2*MAXN+5],hang[2*MAXN+5],lie[2*MAXN+5];
inline int Find(int x){return (x==fa[x]?x:(fa[x]=Find(fa[x])));}
int main(){
	int n=read();
	for(int i=1;i<=2*MAXN;i++)
		fa[i]=i;
	for(int i=1;i<=MAXN;i++)
		hang[i]=lie[i+MAXN]=1;
	for(int i=1;i<=n;i++){
		int x=read(),y=read()+MAXN;
		int fx=Find(x),fy=Find(y);
		if(fx!=fy)
			fa[fy]=fx,hang[fx]+=hang[fy],lie[fx]+=lie[fy];
	}
	LL ans=0;
	for(int i=1;i<=2*MAXN;i++){
		int fx=Find(i);
		if(vis[fx]) continue;
		vis[fx]=1;
		ans+=1ll*hang[fx]*lie[fx];
	}
	printf("%lld\n",ans-n);
	return 0;
}

Measured memory_bytes: 2432
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();
		if (A == 0) {
			System.out.println(1);
		} else if (B == 0) {
			System.out.println(2);
		} else if (C == 0) {
			System.out.println(3);
		} else if (D == 0) {
			System.out.println(4);
		} else {
			System.out.println(5);
		}
	}
}

Measured memory_bytes: 35744
#include<bits/stdc++.h>
#define ll long long int
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1)
using namespace std;

int main()
{
__

ll n;

cin >> n;

cout << (n * (n-1))/2 << '\n';

return 0;
}

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

namespace ConsoleApplication1
{
    struct Position { internal int x, y, depth; }

    class Puzzle
    {
        readonly int[] moveX = new int[] { -2, -2, -2, -1,  0, +1, +2, +2, +2, -1,  0, +1 };
        readonly int[] moveY = new int[] { -1,  0, +1, -2, -2, -2, -1,  0, +1, +2, +2, +2 };

        readonly int n;

        bool[,,] map;
        
        public Puzzle(int n)
        {
            this.n = n;
            map = new bool[n, 10, 10];
        }
        
        public void MakeMap(int depth,int x,int y)
        {
            for(int i = -1; i <= 1; i++)
            {
                for(int j = -1; j <= 1; j++)
                {
                    int tempX = x + j;
                    int tempY = y + i;

                    if (!IsValid(tempX, tempY)) continue;

                    map[depth, tempY, tempX] = true;
                }
            }
        }

        public string Solve(Position pos)
        {
            Stack<Position> stk = new Stack<Position>();
            stk.Push(pos);

            while (stk.Count > 0)
            {
                Position cur = stk.Pop();

                if (cur.depth == n - 1) return "OK";

                for (int i = 0; i < 12; i++)
                {
                    Position next;
                    next.x = cur.x + moveX[i];
                    next.y = cur.y + moveY[i];
                    next.depth = cur.depth + 1;

                    if (IsValid(next.x, next.y) && map[next.depth, next.y, next.x])
                    {
                        stk.Push(next);
                    }
                }
            }
            return "NA";
        }

        private bool IsValid(int x,int y)
        {
            if (x < 0) return false;
            if (x > 9) return false;
            if (y < 0) return false;
            if (y > 9) return false;
            return true;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();
            
            while (true)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                if (input.All(a => a == 0)) break;
                
                Position pos;
                pos.x = input[0];
                pos.y = input[1];
                pos.depth = -1;

                int n = int.Parse(Console.ReadLine());

                Puzzle pz = new Puzzle(n);

                input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                
                for(int i = 0; i < n; i++)
                {
                    int idx = i * 2;

                    pz.MakeMap(i, input[idx], input[idx + 1]);
                }
                sb.AppendLine(pz.Solve(pos));
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size();i++)
        if(s[i]=='o') ans++;
    ans+=15-s.size();
    if(ans>=8) printf("YES");
    else printf("NO");
}


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

public class Main {
	
	ArrayList<Long> sunukeList;
	
	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		sunukeList = new ArrayList<>();
		long k = fs.nextInt();
		
		for(int i = 1; i < 100; i++) {
			check(i);
		}
		
		long a = 0;
		long b = 1;
		while(a < 1_000_000_000_000L) {
			
			for(int i = 100; i < 1000; i++) {
				check(i*b + a);
			}
			
			a = a*10 + 9;
			b *= 10;
		}
		
		for(int i = 0; i < k; i++) {
			System.out.println(sunukeList.get(i));
		}
	}
	
	public void check(long i) {
		
		long is = s(i);
		
		while(true) {
			
			if(sunukeList.isEmpty()) {
				break;
			}
			
			long lastVal = sunukeList.get(sunukeList.size()-1);
			long lastValS = s(lastVal);
			
			if(is * lastVal > i * lastValS) {
				sunukeList.remove(sunukeList.size()-1);
			}else {
				break;
			}
		}
		
		sunukeList.add(i);
	}
	
	public long s(long i) {
		long retVal = 0;
		while(i > 0) {
			retVal += i % 10;
			i /= 10;
		}
		return retVal;
	}

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}


}


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

int main()
{
    int n;
    int i, ans = 0, count = 0;
    
    cin >> n;
    
    int a[n];
    
    for(i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    sort(a, a+n);
    
    for(i = 0; i < n; i++) {
        count++;
        
        if((a[i] != a[i+1]) && ((count % 2) != 0)) {
            ans++;
            count = 0;
        }
    }
    
    cout << ans << "\n";
    
    return 0;
}

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

int main(){
  int n,y;
  cin>>n>>y;
  rep(a,n+1)rep(b,n+1){
    int c=n-(a+b);
    if(10000*a+5000*b+1000*c==y and c>=0){
      cout<<a<<' '<<b<<' '<<c<<endl;
      return 0;
    }
  }
  cout<<-1<<' '<<-1<<' '<<-1<<endl;
  return 0;
}

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

int main(void){
	long x[2];
	long y[2];
	for(int i=0;i<2;i++)cin>>x[i];
	for(int i=0;i<2;i++)cin>>y[i];
	long num = x[0]*y[0];
	for(long a : x){
		for(long b : y){
			num=max(num,a*b);
		}
	}
	cout << num << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

inline int gcd(int a, int b) { return (a%b == 0) ? b : gcd(b, a%b); }
inline int fac(int n) { return (n==0) ? 1 : n * fac(n - 1); }

int main() {
    int n;
    cin >> n;
    int s[n];
    int total = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
        total += s[i];
    }

    if (total % 10 != 0) {
        cout << total << endl;
        return 0;
    }

    sort(s, s+n);
    for (int i = 0; i < n; i++) {
        if (s[i] % 10 != 0) {
            total -= s[i];
            break;
        }
    }

    cout << (total % 10 != 0 ? total : 0) << endl;
    return 0;
}


Measured memory_bytes: 3644
s = gets.chomp
len = s.length

while s.length >= 2
  a = s.chomp.split("")
  s2 = ""
  s_2 = ""
  if s.length % 2 == 0
     for j in 0...(s.length)/2 do
       s_2 += a[j]
     end
     s2 = s_2 + s_2
  end
  if s == s2 && s.length != len
    puts s.length
    break
  end
  s.chop!
end

Measured memory_bytes: 3836
S=input()
if  1<=int(S[:2])<=12:
    if 1<=int(S[2:])<=12:
        print("AMBIGUOUS")
    else:
        print('MMYY')
else:
    if 1<=int(S[2:])<=12:
        print('YYMM')
    else:
        print('NA')



Measured memory_bytes: 2940
#include <stdio.h>

int main(void){
	int a,b;
	int ans;
	int ans2;
	
	scanf("%d %d",&a,&b);
	
	ans=a*b;
	
	ans2=a+a+b+b;
	
	printf("%d %d\n",ans,ans2);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

string S;

int main()
{
	cin >> S;

	int year = (S[0] - 48) * 1000 + (S[1] - 48) * 100 + (S[2] - 48) * 10 + (S[3] - 48);
	int month = (S[5] - 48) * 10 + (S[6] - 48);
	int day = (S[8] - 48) * 10 + (S[9] - 48);

	if (year <= 2019)
	{
		if (month <= 04)
		{
			if (day <= 30)
			{
				printf("Heisei");
				return 0;
			}
		}
	}

	printf("TBD");
	return 0;
}

Measured memory_bytes: 256
N = int(input())

S_dict = dict()

for i in range(N):
    S = str(input())
    if S not in S_dict:
        S_dict[S] = 1
    else:
        S_dict[S] += 1

score_S_list = sorted(S_dict.items(), key=lambda x:x[1] ,reverse=True)

max_polled = score_S_list[0][1]

max_polled_S = list()

for S in score_S_list:
    if S[1] == max_polled:
        max_polled_S.append(S[0])
    else:
        break
        
max_polled_S.sort()

for S in max_polled_S:
    print(S)

Measured memory_bytes: 45784
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int zero_cnt;
	int[] number;
	int[] pos;
	int[] set;
	int ans;

	void run() {
		for (;;) {
			number = new int[10];
			int[] check = new int[11];
			zero_cnt = 0;
			ans = 0;
			for (int i = 0; i < 10; i++) {
				number[i] = sc.nextInt();
				if (number[i] != -1) {
					check[number[i]]++;
				}
				if (number[i] == 0) {
					zero_cnt++;
				}
			}
			if (number[0] == -1) {
				return;
			}
			set = new int[zero_cnt];
			pos = new int[zero_cnt];
			int index = 0;
			int index2 = 0;
			for (int i = 1; i <= 10; i++) {
				if (check[i] == 0) {
					set[index++] = i;
				}
			}
			for (int i = 0; i < 10; i++) {
				if (number[i] == 0) {
					pos[index2++] = i;
				}
			}
			boolean[] use = new boolean[zero_cnt];
			solve(0, use);
			System.out.println(ans);
		}
	}

	void solve(int n, boolean[] use) {
		if (n == zero_cnt) {
			judge(number);
		} else {
			for (int i = 0; i < zero_cnt; i++) {
				if (use[i]) {
					continue;
				}
				number[pos[i]] = set[n];
				use[i] = true;
				solve(n + 1, use);
				use[i] = false;
			}
		}
	}

	void judge(int[] res) {
		int rest = (res[0]+res[1] + res[2]) % res[9];
		if ((res[0] + res[1] + res[2]) % res[9] == rest
				&& (res[3] + res[4] + res[5]) % res[9] == rest
				&& (res[6] + res[7] + res[8]) % res[9] == rest
				&& (res[0] + res[3] + res[6]) % res[9] == rest
				&& (res[1] + res[4] + res[7]) % res[9] == rest
				&& (res[2] + res[5] + res[8]) % res[9] == rest
				&& (res[0] + res[4] + res[8]) % res[9] == rest
				&& (res[2] + res[4] + res[6]) % res[9] == rest) {
			ans++;
		}
	}

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

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 22388
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <algorithm>
#include <map>

using namespace std;
int makeint(string s){
    int ans = 0;
    int x = 1;
    for(int i = s.size() - 1; i >= 0; --i){
        ans += x * (int(s[i]) - 48);
        x *= 10;
    }
    return ans;
}
int main(){
    string s;
    cin >> s;
    int ans = 1000;
    for(int i = 0; i < s.size() - 2; i++){
        string tmp = "";

        tmp += s[i];
        tmp += s[i + 1];
        tmp += s[i + 2];

        ans = min(abs(makeint(tmp) - 753), ans);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N;
	cin>>N;
	int m,u;
	u=N%100;
	m=N/100;
	if(u<=12&&m<=12&&0<u&&0<m){
		cout<<"AMBIGUOUS"<<endl;
		return 0;
	}
	if(u>12&&m>12){
		cout<<"NA"<<endl;
		return 0;
	}
	if(u==0&&m==0){
		cout<<"NA"<<endl;
		return 0;
	}
	if(0<u&&u<=12){
		cout<<"YYMM"<<endl;
		return 0;
	}
	if(0<m&&m<=12){
		cout<<"MMYY"<<endl;
		return 0;
	}
	else cout<<"NA"<<endl;
}

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

#define M1 1000000007
#define M2 1000000009
#define ll long long 
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define f0(i, n) for (int i = 0; i < (int)(n); ++i)
#define f1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fc0(i,l,r) for(int i = (int)(l); i<(int)(r); ++i)
#define fc1(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define fr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
 
void init()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      freopen("error.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
}

signed main()
{
    init();

    int a,b,c,k,t=0;
    cin>>a>>b>>c;
    cin>>k;

    while(b>=c || a>=b)
    {
      if(b>=c)
      {
        c*=2;
        t++;
      }
      if(a>=b)
      {
        b*=2;
        t++;
      }
    }

    if(t<=k)
      cout<<"Yes"<<endl;
    else 
      cout<<"No"<<endl;

    cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}

Measured memory_bytes: 3788
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        var hset = new HashSet<char>();

        //多彩判定
        var ok = true;
        for (int i = 0; i < s.Length; i++)
        {
            if (!hset.Contains(s[i]))
            {
                hset.Add(s[i]);
            }
            else
            {
                ok = false;
                break;
            }
        }

        string ans = "-1";
        if (ok)
        {
            for (char i = 'a'; i <= 'z'; i++)
            {
                if (!hset.Contains(i))
                {
                    ans = s + i.ToString();
                    ok = false;
                    break;
                }
            }
        }

        if (ok && hset.Count == 26)
        {
            var t = "abcdefghijklmnopqrstuvwxyz";
            t = string.Concat(t.Reverse());
            if (s != t)
            {
                var tmp = t;
                for (int i = 24; i >= 0; i--)
                {
                    var c = s.Substring(0, i);
                    char[] l = s.Substring(i, s.Length - i).ToCharArray();
                    var st = l[0];
                    Array.Sort(l);
                    var index = Array.IndexOf(l, st);

                    if (index + 1 < l.Length)
                    {
                        var ttt = c + l[index + 1];
                        var re2 = s.CompareTo(c + l[index + 1]);
                        var re3 = tmp.CompareTo(c + l[index + 1]);
                        if (s.CompareTo(c + l[index + 1]) == -1 && tmp.CompareTo(c + l[index + 1]) == 1) tmp = c + l[index + 1];
                    }
                }

                ans = tmp;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n; cin >> n;
	ll a[n]; zep(i, 0, n)cin >> a[i];
	
	ll x = 0;
	zep(i, 0, n)x ^= a[i];
	
	zep(i, 0, n){
		cout << (x ^ a[i]) << " ";
	}
	cout << endl;
	
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n, m;
    cin >> n >> m;
    int left = 1, right = n;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        left = max(l, left);
        right = min(r, right);
    }
    if(right-left < 0)cout << 0 << endl;
    else cout << right-left+1 << endl;
    return 0;
}

Measured memory_bytes: 256
readlines.each do |line|
  n, m = line.chomp.split.map(&:to_i)
  break if n.zero? && m.zero?

  members = [*1..n]
  delete_member_idx = m - 1

  loop do
    members.delete_at(delete_member_idx)

    if members.size == 1
      puts members.first
      break
    end

    delete_member_idx = (delete_member_idx + m - 1) % members.size
  end
end

Measured memory_bytes: 8600
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//String S = sc.next();
		//int N = Integer.parseInt(sc.next());
		//out.println();
		int cnt = 0;
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		int b[] = new int[M];
		int a[][]  = new int[N][M];
		for(int i=0;i<M;i++){
			b[i] = Integer.parseInt(sc.next());
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				a[i][j] = Integer.parseInt(sc.next());
			}
			int keisan = 0;
			for(int j=0;j<M;j++){
				keisan += a[i][j]*b[j];
			}
			keisan += C;
			if(keisan>0){
				cnt++;
			}
		}
		

		out.print(cnt);
		out.flush();	
	}
}

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

#define ll long long
#define pu push
#define pb push_back
#define ull unsigned long long
#define set_pre setprecision
#define cl clear
#define fi first
#define se second
#define For(i,a,b) for(int i = a; i <= b; i++)
#define Fors(i,a,b) for(int i = a; i < b; i++)

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int maxn = 1e6 + 7;
const int oo = 1e9 + 7;
const int mod = 1e9 + 7;
const int max_dsk = 3e5 + 7;
const int maxc_IT = 4 * maxn;

void init()
{
    freopen("A.inp","r",stdin);
    freopen("A.out","w",stdout);
}

int visited[maxn + 7];

void analyse(ll n,vector<ll>&res)
{
    //memset(visited,0,sizeof visited);
    fill(visited + 1, visited + maxn + 1, 0);
    //vector<int>res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            if(visited[i] == 0)
            {
                res.pb(i);
                visited[i] = 1;
            }
            n /= i;
        }
    }
    if (n != 1)
    {
        res.pb(n);
    }
    //for(int w : res) cout << w << ' ';
}

vector<ll>p,p1;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;
    cin >> n >> m;
    analyse(n,p);
    analyse(m,p1);
    int d = 0;
    for(ll w : p)
    {
        for(ll ans : p1)
        {
            if(w == ans) d++;
        }
    }
    cout << d + 1;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string ans1, ans2;
    cout << 0 << endl;
    cin >> ans1;
    if (ans1 == "Vacant") return 0;
    int left = 0, right = N;
    for (int i = 0; i < 20; i++) {
        int mid = (left + right) / 2;
        cout << mid << endl;
        cin >> ans2;
        if (ans2 == "Vacant") return 0;
        if ((mid + 1) % 2) {
            if (ans1 == ans2) {
                // [0,mid]に空席ない
                left = mid;
            }
            else {
                // [0,mid]に空席あり
                right = mid;
            }
        }
        else {
            if (ans1 != ans2) {
                // [0,mid]に空席ない
                left = mid;
            }
            else {
                // [0,mid]に空席あり
                right = mid;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 852
n = int(input())
a = []
for i in range(n):
	s = int(input())
	a.append(s)
a.sort()
a.append(0)
length = 0
i = 0
while i < n:
	counter = 1
	count = 0
	for k in range(i+1,n+1):
		if a[i] != a[k] and counter%2 == 1:
			length += 1
			i = i+count+1
			break
		elif a[i] != a[k] and counter%2 == 0:
			i = i+count+1
			break
		elif a[i] == a[k]:
			counter += 1
			count += 1
print(length)

Measured memory_bytes: 7512
// C - Christmas Eve
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()

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

	vector<int> H(N);
	rp(i, N) cin>>H[i];
	sort(all(H));

	int minH = INT_MAX;
	rp(i, N-K+1) minH = min(minH, H[i+K-1] - H[i]);
	cout<< minH <<endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> boss(n);
  rep(i, n) {
    if(i == 0) continue;
    int a;
    cin >> a;
    boss[a-1].push_back(i-1);
  }
  rep(i, n) cout << boss[i].size() << endl;
  return 0;
}
    

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

int main()
{
	int x;
	int five = 0;
	int seven = 0;
	for (int i = 0; i < 3; i++) {
		cin >> x;
		if (x == 5) five++;
		if (x == 7) seven++;
	}

	if (five == 2 && seven == 1) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define regi register int
ll total;
int minn=INT_MAX;
int minusnum,n;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for (regi i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if (x<0) minusnum++;
        x=abs(x);
        minn=min(minn,x);
        total+=x;
    }
    minusnum%=2;
    if (minusnum) total-=2*minn;
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	LL X,A,B;
	cin >> X >> A >> B;
	LL res = B-A;
	if( X+1 <= res ){
		cout << "dangerous" << endl;
	}else if( 1 <= res ){
		cout << "safe" << endl;
	}else{
		cout << "delicious" << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
	char[] c = {'a','e','i','o','u'};
		System.out.println(
				Arrays.binarySearch(c, s.next().charAt(0))>=0
				?
				"vowel":"consonant");
	}
}

Measured memory_bytes: 10060
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;
void solve(string s,string t)
{
    int slen =s.length();
    int tlen =t.length();
    
    int dp[slen+1][tlen+1];
    for(int d=0;d<=tlen;d++)
    {
        for(int r=0;r<=slen;r++)
        {
            dp[r][d]=0;
        }
    }
    for(int d=1;d<=tlen;d++)
    {
        for(int r=1;r<=slen;r++)
        {
           if(s[r-1]==t[d-1])
           {
               dp[r][d] = dp[r-1][d-1]+1;
           }
           else
           {
               dp[r][d] = max(dp[r-1][d],dp[r][d-1]);
           }
        }
        
    }
   
   
   int up = tlen;
   int lef= slen;
   string str="";
  // cout<<dp[1][5]<<dp[2][4]<<"one coma onw"<<endl;
  while(up>0&&lef>0)
  {
      
          
         if(dp[lef][up]==dp[lef][up-1])
         {//cout<<"up"<<up<<lef<<dp[lef][up]<<dp[lef][up-1]<<endl;
            up=up-1;
         }
         else if(dp[lef][up]==dp[lef-1][up])
         {
            // cout<<"lef"<<up<<lef<<dp[lef][up]<<dp[lef-1][up]<<endl;
             lef = lef-1;
         }
         else
         {
             // cout<<"lef"<<up<<lef<<dp[lef][up-1]<<dp[lef-1][up]<<endl;cout<<"dia"<<lef<<up<<endl;
             
             lef=lef-1;
             up=up-1;
             str = t[up]+str;
             
         }
      

      
  }

  cout<<str;
    
}
int main()
{
    string s,t;
    
    cin>>s>>t;
    solve(s,t);

    return 0;
}


Measured memory_bytes: 35456
def floor(a, b):
    return ((-a)//b)*-1


N = int(input())
ratio = []
for _ in range(N):
    ratio.append(list(map(int, input().split())))

v_T = ratio[0][0]
v_A = ratio[0][1]

for t, a in ratio[1:]:
    diff_t = t - v_T
    diff_a = a - v_A

    if diff_t < 0 or diff_a < 0:
        d = max(floor(v_T, t), floor(v_A, a))
        v_T = d*t
        v_A = d*a

    elif diff_t < 0:
        d = floor(v_T, t)
        v_T = d*t
        v_A = d*a

    elif diff_a < 0:
        d = floor(v_A, a)
        v_T = d*t
        v_A = d*a

    elif diff_t >= 0 and diff_a >= 0:
        m = max(diff_t, diff_a)
        v_T = t
        v_A = a

print(v_T+v_A)


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

int main(void){
  string S,T;
  cin >> S;
  cin >> T;
  int len = S.length();
  int count =0;
  for(int i=0;i<len;i++){
    string sub_S = S.substr(i,1);
    string sub_T = T.substr(i,1);
    if(sub_S!=sub_T){
      count += 1;
    }

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

Measured memory_bytes: 3900
#include <stdio.h>
int main(void){
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if(a == b&&a != c){
        printf("Yes\n");
    }else if(a == c&&a != b){
        printf("Yes\n");
    }else if(b == c&&b != a){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007
#define MOD2 998244353
const int INF = 1 << 28;


int main() {
    int N; cin >> N;
    vll A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    priority_queue<pair<ll, int>> pq;
    rep(i, N) pq.push(mp(B[i], i));

    bool can = true;
    ll ans = 0;

    while (!pq.empty()) {
        ll C = pq.top().F;
        int i = pq.top().S;
        pq.pop();
        ll X = B[(i - 1 + N) % N] + B[(i + 1) % N];

        if (C < A[i]) {
            can = false;
            break;
        }
        else if (C == A[i]) {
            continue;
        }
        else if (C > A[i] && C < X + A[i]) {
            can = false;
            break;
        }
        else {
            ll tmp = (C - A[i]) / X;
            C = C - X * tmp;
            B[i] = C;
            ans += tmp;
            pq.push(mp(C, i));
        }
    }

    cout << (can ? ans : -1) << endl;

}




Measured memory_bytes: 9328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	int outlet = 1;
	int count = 0;
	while (outlet < B) {
		outlet = outlet - 1 + A;
		count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

const ll MaxN=20001;

ll f[MaxN], rf[MaxN];
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    REP(i, 1, MaxN) f[i] = (f[i - 1] * i) % mod;
    REP(i, 0, MaxN) rf[i] = inv(f[i]);
}
//---------------------------------------------------------------------------------------------------
ll C(ll n, ll k) {
    ll a = f[n]; // = n!
    ll b = rf[n-k]; // = (n-k)!
    ll c = rf[k]; // = k!

    ll bc = (b * c) % mod;

    return (a * bc) % mod;
}

ll dp[5001][5001];

int main(){
    init();
    ll N; cin>>N;
    vector<P> d;
    rep(i,N){
        ll x,y; cin>>x>>y;
        d.pb(mp(x,y));
        dp[2500-x][2500-y]++;
    }
    rep(i,5000) rep(j,5000){
        dp[i+1][j]=(dp[i][j]+dp[i+1][j])%mod;
        dp[i][j+1]=(dp[i][j]+dp[i][j+1])%mod;
    }
    ll ans=0;
    rep(i,N) ans=(ans+dp[d[i].first+2500][d[i].second+2500])%mod;
    rep(i,N) ans=(ans+mod-C(2*(d[i].first+d[i].second),2*d[i].first))%mod;
    if(ans%2) ans=(ans+mod)/2;
    else ans/=2;
    cout<<ans<<endl;
}

Measured memory_bytes: 202196
function main()
  S = chomp(readline())
  a = 1
  t = S[1]
  S=replace(S,t,"")
  if length(S) != 2
    a = 0
  else
    t = S[1]
    S = replace(S,t,"")
    if length(S) != 0
      a = 0
    end
  end
  if a == 1
    println("Yes")
  else
    println("No")
  end
end

main()

Measured memory_bytes: 169848
S=input()
for i in range(ord('a'),ord('z')+1):
  if chr(i) not in S:
    print(S+chr(i))
    break
else:
  for i in range(len(S)-1,-1,-1):
    for j in range(ord('a'),ord('z')+1):
      if j>ord(S[i]) and chr(j) not in S[:i]:
        print(S[:i]+chr(j))
        exit(0)
  else:
    print(-1)
    

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

using namespace std;

typedef long long LL;

const int N = 2e5 + 10;

int a[N];
int n;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	LL suma = 0,  sumb = 0;
	LL ans = 0;
	for (int j = 1, i = 1; j <= n; j++)  //先枚举右端点, 右端点往前跑
	{
		suma ^= a[j], sumb += a[j];
		
		while (i <= j && suma != sumb)
		{
			suma ^= a[i], sumb -= a[i];
			i++;
		}
		
		ans += j - i + 1;
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 4584
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

map<int,int> factor(int num){
    map<int,int> m;
    for(int i=2; i*i <= num; i++){
        int p = 0;
        while(num%i==0){
            num /= i;
            p++;
        }
        if(p > 0) m[i] = p;
    }
    if(num != 1) m[num] = 1;
    return m;
}

signed main(){
    int n; cin >> n;
    auto m = factor(n);
    int ans = 0;
    for(auto [p, e] : m){
        for(int i = 1; e > 0; i++){
            e -= i;
            if(e < 0) break;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//キーワード入力
		Scanner sc=new Scanner(System.in);
		String W=sc.next();
		W=W.toLowerCase();
		//kwの長さをカウント：n
		int n=W.length();

		int count=0;
		int m=0;
		int o=0;

		while(true) {
			//①テキスト入力
			String T=sc.next();
			if(T.equals("END_OF_TEXT")) {
				break;
			}
			T=T.toLowerCase();
			if(W.equals(T)) {
				count++;
			}
		}
		System.out.println(count);
	}

}



Measured memory_bytes: 26236
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();
        String[] s = S.split("");
        long r = 0;
        long g = 0;
        long b = 0;
        for(int i=0; i<N; i++) {
            if(s[i].equals("R")) r++;
            if(s[i].equals("G")) g++;
            if(s[i].equals("B")) b++;
        }
        long count = r*g*b;

        for(int i=0; i<N; i++) {
            for(int j=i+1; j<N; j++) {
                if(j+j-i >= N) break;
                if(s[i].equals(s[j])) continue;
                else if(s[i].equals(s[j+j-i]) || s[j].equals(s[j+j-i])) {
                    continue;
                }else count--;
            }
        }
        System.out.println(count);
    }
    static int sa(int a, int c) {
        if(a <= c) return c-a;
        else return a-c;
    }
}


Measured memory_bytes: 36412
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm> 
using namespace std;
long long ans=0;
int main()
{
	long long n,a,b,x,y;
	cin>>n>>a>>b;
	cin>>y;
	for(long long i=2;i<=n;i++)
	{
		cin>>x;
		if((x-y)*a>=b) ans+=b;
		else ans+=((x-y)*a);
		y=x;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL c[4]={},ans=0,n;
	FOR(i,0,4)cin>>c[i];
	cin>>n;
	FORD(i,4,2){
		LL a[4]={};
		FORQ(j,0,i)a[j]=c[j]<<(i-j);
		LL mn=min({a[0],a[1],a[2]});
		if(i==3){
			mn=min(mn,a[3]);
			ans+=n/2*mn;
			n=n%2;
		}else{
			ans+=n*mn;
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

int main()
{
    int h, w;
    string line(301, '#');
    
    for(int i=0; i<301; ++i) line[i] = (i%2) ? '.' : '#';
    
    while(cin >> h >> w && h && w) {
        for(int i=0; i<h; ++i)
			cout << line.substr(i%2, w) << '\n';
        cout << endl;
        
    }
    
    return 0;
}



Measured memory_bytes: 3152
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll x,y; cin>>x>>y;
    if(y%2!=0||2*x-0.5*y<0||0.5*y-x<0){
        cout<<"No"<<endl;

    }
    else cout<<"Yes"<<endl;
}








Measured memory_bytes: 3632
N,C = map(int,input().split())
D = [list(map(int,input().split())) for i in range(C)]
L = [list(map(int,input().split())) for i in range(N)]

di = [{}, {}, {}]

for i in range(N) :
    for j in range(N) :
        num = (i+j) % 3
        before = L[i][j] - 1
        
        if before not in di[num] :
            di[num][before] = 1
        else :
            di[num][before] += 1

B = []

for d in di :
    A = []
    for after in range(C) :
        calc = 0
        for before in d :
            calc += D[before][after] * d[before]
        A.append([calc,after])

    A = sorted(A,key=lambda x:x[0],reverse=False)[:3]
    B.append(A)
    
ans = float("inf")

for i in range(3) :
    for j in range(3) :
        for k in range(3) :
            if (B[0][i][1] - B[1][j][1]) * (B[1][j][1] - B[2][k][1]) * (B[2][k][1] - B[0][i][1]) == 0 :
                continue
            
            ans = min(ans, B[0][i][0] + B[1][j][0] + B[2][k][0])

print(ans)


Measured memory_bytes: 5620
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n, m; cin >> n >> m;
    vector<long long> vec(n);
    for(long long i = 0; i < n; i++){
        cin >> vec[i];
    }
    sort(all(vec));

    vector<pair<ll,ll>> card(m);
    rep(i, m){
        ll b, c; cin >> b >> c;
        card[i] = make_pair(c, b);
    }
    sort(all(card));
    
    ll now = m-1;
    for(ll i = 0; i < n; i++){
        if(card[now].second <= 0){
            now -= 1;
        }
        if(vec[i] < card[now].first){
            vec[i] = card[now].first;
            card[now].second--;
        }
    }

    ll ans = 0;
    rep(i, n){
        ans += vec[i];
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 2560