akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  string S;
  cin >> S;
  map <char, int> mp;
  for (auto v : S) mp[v]++;
  int a = mp['a'];
  int b = mp['b'];
  int c = mp['c'];

  //cout << a << " " << b << " " << c << endl;
  bool ok = false;
  if (a == b && abs(a - c) <= 1 || a == c && abs(a - b) <= 1 || b == c && abs(b - a) <= 1) ok = true;
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 3780
fun main(args: Array<String>) {
    val (n, c, k) = readLongList()
    val t = List(n.toInt()) { readLong() }.sorted()

    var ans = 1
    var cnt = 1
    var first = t[0]
    for (i in 1 until n) {
        val time = t[i.toInt()]
        if (cnt < c && time <= first + k) {
            cnt++
        } else {
            cnt = 1
            first = time
            ans++
        }
    }
    println(ans)
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)


Measured memory_bytes: 64328
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
using namespace std;
#define Pi 3.1415926

class P {
public:
	double x, y;
	P() :x(0), y(0) {}
	P(double a, double b) :x(a), y(b) {}
	void print() {
		cout << setprecision(8) <<fixed<< x << " " << y << endl;
	}
};

void koch(int n, P p1, P p2) {
	P s, u, t;
	double th = Pi* 60 /180.0;
	if (n == 0) return;

	s.x = (2.0*p1.x + 1.0*p2.x) / 3.0;
	s.y = (2.0*p1.y + 1.0*p2.y) / 3.0;
	t.x = (1.0*p1.x + 2.0*p2.x) / 3.0;
	t.y = (1.0*p1.y + 2.0*p2.y) / 3.0;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

	koch(n - 1, p1, s);
	s.print();
	koch(n - 1, s, u);
	u.print();
	koch(n - 1, u, t);
	t.print();
	koch(n - 1, t, p2);
}

int main(){
	P a(0.0,0.0), b(100.0,0.0);
	int n;
	cin >> n;

	a.print();
	koch(n,a, b);
	b.print();

	return 0;
}

Measured memory_bytes: 3236
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


signed main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int i;
	int c = 0;
	rep(i, 3) {
		if (s[i] == 'o')
			c++;
	}
	cout << 700 + c * 100 << endl;
	return 0;
}

Measured memory_bytes: 256
import bisect
 
N = int(input())
L = list(map(int, input().split()))
L.sort()
 
c = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    c += bisect.bisect_right(L, L[i]+L[j]-1) - j - 1
 
 
print(c)

Measured memory_bytes: 3188
def main():
    n, p = map(int, input().split())
    a = list(map(int, input().split()))

    dp = [[0, 0] for i in range(n + 1)]
    dp[0][0] = 1  # 何も選ばない時あまりは０なので
    for i in range(n):
        if a[i] % 2 == 0:
            dp[i + 1][0] = dp[i][0]*2
            dp[i+1][1] = dp[i][1]*2
        else:
            dp[i + 1][0] = dp[i][0] + dp[i][1]
            dp[i + 1][1] = dp[i][0] + dp[i][1]

    print(dp[n][p])


if __name__ == '__main__':
    main()


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

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    char s[n + 1];
    cin >> s;
     if(s[k - 1]>= 65 && s[k - 1]<=90)
      s[k - 1] = s[k - 1] + 32;
    cout << s << endl;
    return (0);
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=2e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
class coin{public:llint a,b,c;};
int main(void){
	int x,y,z,i,j,k,n;cin>>x>>y>>z;n=x+y+z;
	vector<coin>hito(n);
	for(i=0;i<n;i++){cin>>hito[i].a>>hito[i].b>>hito[i].c;}
	sort(hito.begin(),hito.end(),
		[](coin me,coin at){return me.b-me.a<at.b-at.a;});
	//aをもらう＜＝＞bをもらうべき
	vector<llint>ans(z+1);
	priority_queue<coin,vector<coin>,function<bool(coin,coin)>> 
	xque( [](coin me,coin at)->bool{return me.c-me.a<at.c-at.a;});
	llint gen=0;//queに入ってる人のaと出た人のcの合計
	for(i=0;i<x;i++){xque.push(hito[i]);gen+=hito[i].a;}
	ans[0]=gen;
	for(i=x;i<x+z;i++){
		xque.push(hito[i]);gen+=hito[i].a;
		gen+=xque.top().c-xque.top().a;
		xque.pop();
		ans[i-x+1]=gen;
	}
	priority_queue<coin,vector<coin>,function<bool(coin,coin)>> 
	yque([](coin me,coin at)->bool{return me.c-me.b<at.c-at.b;});
	gen=0;//queに入ってる人のbと出た人のcの合計
	for(i=n-1;i>=x+z;i--){yque.push(hito[i]);gen+=hito[i].b;}
	ans[z]+=gen;
	for(i=x+z-1;i>=x;i--){
		yque.push(hito[i]);gen+=hito[i].b;
		gen+=yque.top().c-yque.top().b;
		yque.pop();
		ans[i-x]+=gen;
	}
	llint ret=0;
	for(i=0;i<ans.size();i++){maxeq(ret,ans[i]);}
	cout<<ret<<endl;
	return 0;
}

Measured memory_bytes: 7092
#include <iostream>
using namespace std;
int main(void){
    int h, w, k; cin >> h >> w >> k;
    int ans = 0;
    char table[h][w];
    
    
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            cin >> table[i][j];
            //cout << table[i][j] << " ";
        }
        //cout << endl;
    }
    
    
    for(int row=0; row<(1 << h); row++) {
        for(int col=0; col<(1 << w); col++) {
            //cout << (1<<h) << " " << (1<<w) << endl;
            int cnt = 0;
            
            for(int i=0; i<h; i++) {
                for(int j=0; j<w; j++) {
                    //cout << ((row>>i) & 1) << " " << ((col>>j) & 1) << endl;
                    if(((row >> i) & 1) == 1 || ((col >> j) & 1) == 1) continue; // 赤の場合
                    if(table[i][j] == '#') cnt++;
                }
            }
            if(cnt == k) ans++;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3536
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n;
     while(~scanf("%d",&n))
     {
        if(n%2==0)
         {
             printf("%d\n",n);
         }
        else
         printf("%d\n",2*n);


     }



    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<unordered_set>

int f(int n){
    if(n % 2 == 0) return n / 2;
    return 3 * n + 1;
}

int main(){
    int s;
    std::cin >> s;
    std::unordered_set<int> set;
    set.insert(s);
    int i = 1;
    while(1){
        i++;
        s = f(s);
        if(set.find(s) != set.end()){
            std::cout << i << std::endl;
            return 0;
        }
        set.insert(s);
    }

    return 0;
}


Measured memory_bytes: 256
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
sys.setrecursionlimit(1000000)
# do magic here
n = int(input())
heights = [int(x) for x in input().split()]

dp = [0 for x in range(n+1)]

dp[1] = abs(heights[1]-heights[0])

for x in range(2, n):
    a = abs(heights[x]-heights[x-1]) + dp[x-1]
    b = abs(heights[x]-heights[x-2]) + dp[x-2]
    dp[x] = min(a, b)

print(dp[n-1])


Measured memory_bytes: 21032
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    char c;
    cin >> c;
    int cnt = 2;
    bool res =0;
    while(cnt--){
        char l;
        cin >> l;
        if(c != l)
            res = 1;
    }
    if(res){
        cout << "Yes\n";
    }
    else
        cout << "No\n";
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;

const int INF=0x3f3f3f3f;
const int N=105;

int n, k;
int p[N], dp[100005][2];

int rek(int num, int ig) {
    if (num<0) return ig;
    if (num==0) return !ig;
    int &ret=dp[num][ig];
    if (ret!=-1) return ret;
    for (int i=0; i<n; ++i) {
        if (rek(num-p[i], !ig)==ig) {
            ret=ig;
            return ret;
        }
    }
    ret=!ig;
    return !ig;
}

int main() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) scanf("%d", p+i);
    memset(dp, -1, sizeof dp);
    printf("%s\n", rek(k, 0) ? "Second" : "First");
    return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    ll A, B;
    string b;
    cin >> A >> b;
    b = b.substr(0, b.size() - 3) + b.substr(b.size() - 2, 2);
    B = stol(b);
    cout << A * B / 100 << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin >> c;
    if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 2e9+9;
const int mod = 1e9+7;
ll n,sum;
bool done[1000009];
int main(){
    fast,cin>>n;
    for(int i=3;i<=n;i+=3){
        done[i] = 1;
    }
    for(int i=5;i<=n;i+=5){
        done[i] = 1;
    }
    for(int i=1;i<=n;i++){
        if(done[i]) continue;
        sum += i;
    }
    cout<<sum<<endl;
}


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

using static Input;
using static Util;
class Program
{
    static int N;
    static int M;
    static int L;
    static int[,] d;
    static int Q;
    static int[] s,t;

    static void INPUT()
    {
        N = NextInt();
        M = NextInt();
        L = NextInt();
        d = new int[N + 1, N + 1];
        for (int i = 1; i <= N; i++)
            for (int j = 1; j <= N; j++)
                d[i, j] = i == j ? 0 : INF;

        for (int i = 0; i < M; i++)
        {
            var a = NextInt();
            var b = NextInt();
            var c = NextInt();
            d[a, b] = c;
            d[b, a] = c;
        }

        Q = NextInt();
        s = new int[Q];
        t = new int[Q];
        for (int i = 0; i < Q; i++)
        {
            s[i] = NextInt();
            t[i] = NextInt();
        }
    }

    static void OUT()
    {
        for (int k = 1; k <= N; k++)
            for (int i = 1; i <= N; i++)
                for (int j = 1; j <= N; j++)
                    d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);

        var d2 = new int[N + 1, N + 1];
        for (int i = 1; i <= N; i++)
            for (int j = 1; j <= N; j++)
                d2[i, j] = i == j? 0 : d[i, j] <= L ? 1 : INF;

        for (int k = 1; k <= N; k++)
            for (int i = 1; i <= N; i++)
                for (int j = 1; j <= N; j++)
                    d2[i, j] = Math.Min(d2[i, j], d2[i, k] + d2[k, j]);

        var sb = new StringBuilder();
        for (int i = 0; i < Q; i++)
        {
            var dd = d2[s[i], t[i]];
            sb.Append(dd == INF ? -1 : dd - 1);
            sb.AppendLine();
        }
        Console.WriteLine(sb.ToString());
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 18760
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> h(N);
	for (Int i = 0; i < N; i++) {
		cin >> h[i];
	}

	vector<Int> high(N);
	high[0] = h[0];
	Int ans = 1;
	for (Int i = 0; i < N-1; i++) {
		if (h[i + 1] >= high[i]) {
			ans++;
			high[i + 1] = h[i + 1];
		}
		else {
			high[i + 1] = high[i];
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val k = readInputLine().toInt()
    val (a, b) = readInputLine().split(" ").map { it.toInt() }

    for (i in a..b) {
        if (i % k == 0) {
            pw.println("OK")
            pw.flush()
            return
        }
    }

    pw.println("NG")

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36440
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define	PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vll vector<ll>
#define vbl vector<bool>
#define vpll vector<pll>
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(x) x.begin(),x.end()
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define mod 1000000007
#define INF 1000000000000000
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set_pll;
#define ook order_of_key
#define fbo find_by_order
/*  
	Query 1 - order_of_key(k) : Number of items strictly smaller than k.
	Query 2 - find_by_order(k) : K-th element in the set (counting from zero).
	less<ll> means Query 1 will return numbers strictly less than k.
	greater<ll> means Query 1 will return numbers strictly greater than k.
*/
ll powmod(ll x, ll n){
	ll res = 1;
	while(n){
		if(n & 1){
			res *= x;
			res %= mod;
		}
		x *= x;
		x %= mod;
		n >>= 1;
	}
	return res;
}
ll invmod(ll a){
	return powmod(a, mod - 2);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	vbl p(200200, true);
	p[0] = false;
	p[1] = false;
	vll z;
	for(ll i = 2; i < 200200; i++){
		if(p[i]){
			z.eb(i);
			for(ll j = i * i; j < 200200; j += i){
				p[j] = false;
			}
		}
	}
	ll x;
	cin >> x;
	auto it = lower_bound(all(z), x);
	cout << *it;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		
		System.out.println(getMinNumOfRepaints(S));
	}
	
	private static int getMinNumOfRepaints(String s) {
		if(s.length() <= 1) return 0;
		
		char[] arr = s.toCharArray();
		// starting from '0'
		char[] case1 = new char[arr.length];
		// starting from '1'
		char[] case2 = new char[arr.length];
		
		// fill in case1
		for(int i = 0; i < arr.length; i++) case1[i] = i % 2 == 0? '0':'1';
		// fill in case2
		for(int i = 0; i < arr.length; i++) case2[i] = i % 2 == 0? '1':'0';
		
		int count1 = 0;
		int count2 = 0;
		for(int i = 0; i < arr.length; i++){
			// for case1
			if(case1[i] != arr[i]) count1++;
			if(case2[i] != arr[i]) count2++;
		}
		
		return Math.min(count1, count2);
	}
}


Measured memory_bytes: 27428
#include <iostream>
#include <queue>
#include <string>

using namespace std;

int main()
{
    int now_time = 0;
    queue<int> time;
    queue<string> name;
    int a;
    string b;
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        cin >> b >> a;
        time.push(a);
        name.push(b);
    }
    while (!time.empty()) {
        if (time.front() <= q) {
            now_time += time.front();
            cout << name.front() << " " << now_time << endl;
            name.pop();
            time.pop();
        } else {
            now_time += q;
            int c = time.front() - q;
            string d = name.front();
            time.pop();
            name.pop();
            time.push(c);
            name.push(d);
        }
    }
}


Measured memory_bytes: 5836
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string S;
    cin>>S;
    int a=0,b=0,c=0;
    if (S[0]=='A'){
        ++a;
    }
    for (int i = 2; i <S.length()-1 ; ++i) {
        if(S[i]=='C'){
            ++b;
        }
    }
    for (int j = 0; j <S.length() ; ++j) {
        if (isupper(S[j])){
            ++c;
        }

    }
    if (a==1 && b==1 && c==2){
        cout<<"AC";
    } else cout<<"WA";
    return 0;
}

Measured memory_bytes: 384
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,0,n)cin>>v[i];

    int q;cin>>q;
    rep(i,0,q){
        int b,m,e;
        cin>>b>>m>>e;
        swap_ranges(v.begin()+b,v.begin()+m,v.begin()+e);
    }
    rep(i,0,n){
        if(i)cout<<" ";cout<<v[i];
    }
    cout<<endl;
}



/*
1 2 3 4 5

6
*/



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<P> vp;
typedef vector<T> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  string s;
  cin >> s;
  rep(_,s.size()) {
    cout << 'x';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n;
	cin >> n;
	long long int place[200001];
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		place[a] = i;
	}
	set<long long int> s;
	long long int ans = 0;
	for(long long int i = 1; i <= n; i++){
		auto tmp = s.lower_bound(place[i]);
		long long int l, r;
		if(tmp == s.end()) r = n;
		else r = *(tmp);
		if(tmp == s.begin()) l = 0;
		else l = *(--tmp) + 1;
		// cout << i << " " << place[i] << " " << l << " " << r << endl;
		ans += i * (place[i] - l + 1) * (r - place[i]);
		s.insert(place[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 11136
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

inline void work() {
    int N;
    cin >> N;
    int n = N % 10;
    set<int> s1{2, 4, 5, 7, 9};
    set<int> s2{0, 1, 6, 8};
    if (s1.count(n)) cout << "hon";
    else if (s2.count(n)) cout << "pon";
    else cout << "bon";
}

int main() {
    // freopen(".txt", "r", stdin);
    quickread();
    work();    
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n, l, ans = 0, mine = 999;
	int par[205];
	cin >> n >> l;
	for(int i = 1; i < n+1; i++){
		par[i-1] = l+i-1;
		ans += par[i-1];
		if(abs(mine) > abs(par[i-1])){
			mine = par[i-1];
		}
	}
	cout << ans - mine << endl;
}

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

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

    static class TaskD {
        public void solve(int testNumber, MyScan in, PrintWriter out) {
            int n = in.nextInt();
            int[] values = in.na(n);
            long res = 0;
            int start = -1;
            int curf = 0;
            for (int t = 0; t < n; t++) {
                while ((curf & values[t]) != 0) {
                    curf -= values[++start];
                }
                curf += values[t];
                res += t - start;
            }
            out.println(res);
        }

    }

    static class MyScan {
        private final InputStream in;
        private byte[] inbuf = new byte[1024];
        public int lenbuf = 0;
        public int ptrbuf = 0;

        public MyScan(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = in.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public int[] na(int n) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = nextInt();
            }
            return k;
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 22228
import java.util.Scanner;

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 ans = 0;

		for(int i = a; i <= b; i++){
			if(c%i == 0)ans++;
		}

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




Measured memory_bytes: 26492
n, m, q = map(int, input().split())

trains = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
    l, r = map(int, input().split())
    trains[l][r] += 1

# cum
for i in range(n + 1):
    for j in range(n):
        trains[i][j + 1] += trains[i][j]

for i in range(n):
    for j in range(n + 1):
        trains[i + 1][j] += trains[i][j]

query = []
for _ in range(q):
    a, b = map(int, input().split())
    ans = trains[b][b] - trains[b][a - 1] - trains[a - 1][b] + trains[a - 1][a - 1]
    print(ans)

Measured memory_bytes: 57432
import sys
l, r = map(int, input().split())
m = 2019
min = 2019

if r - l >= 2019:
    print(0)
else:
    l, r = l%m, r%m
    for i in range(l, r):
        for j in range(i+1, r+1):
            if min > (i * j)%m:
                min = (i * j)%m
    print(min)


Measured memory_bytes: 2940
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 q,h,s,d,n;
  cin>>q>>h>>s>>d>>n;
  int64 a=min(8*q,min(4*h,min(2*s,d)));
  int64 b=min(4*q,min(2*h,s));
  if(n%2==0){
    cout<<a*n/2;
  }else{
    cout<<a*(n-1)/2+b;
  }
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n;
    cin >> n;
    vector<lint> v(26);
    rep(i, n){
        string s;
        cin >> s;
        ++v[s[0]-'A'];
    }
    string march = "MARCH";
    lint ans = 0;
    rep(i, 5){
        REP(j, i+1, 5){
            REP(k, j+1, 5){
                ans += v[march[i]-'A'] * v[march[j]-'A'] * v[march[k]-'A'];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
constexpr ll INF = 1000000000;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, m, x;
	cin >> n >> m >> x;
	vector<int>a(m);
	rep(i, m)cin >> a[i];

	int q = 0;
	int p = 0;

	for (int i = 0; i < m; i++) {
		if (a[i] < x) {
			q++;
		}
	}
	for (int i = 0; i < m; i++) {
		if (a[i] > x) {
			p++;
		}
	}
	cout << min(q, p) << endl;
}

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

using namespace std;
using ll = long long;
const ll mod = 1000000007;


int main()
{
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw" << endl;
    }else if((a > b || a == 1) && b != 1){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		InputReader in = new InputReader();
		String str = in.next();
		
		String res = "";
		for (int i=0; i<str.length(); i++) {
			if (str.charAt(i) == 'B') {
				if (res.length() != 0)
					res = res.substring(0, res.length()-1);
			}
			else
				res += str.charAt(i);
		}
		System.out.println(res);
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;

long long A[100000];
int main(){
    int N;
    cin >> N;
    set <long long> nums;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    for(int i = 0; i < N; i++){
        if(nums.find(A[i]) == nums.end()){
            nums.insert(A[i]);
        } else {
            nums.erase(A[i]);
        }
    }
    cout << nums.size() << endl;
    return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
 
using namespace std;
 
int main() {
  int a,b,c;
  int num = 3;
  cin >> a >> b >> c;
  if (a == b) {
	num -= 1;
  	if (b == c) {
      num -= 1;
    }
  } else if (a == c) {
      num -= 1;
      if (b == c) {
        num -= 1;
      }
  } else if (b == c) {
      num -= 1;
      if (a == b) {
        num -= 1;
      }
  }   
  cout << num << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math
import itertools

# 入力
N = str(input())

if N == "SUN" :
  print (7)
elif N == "MON" :
  print (6)
elif N == "TUE" :
  print (5)
elif N == "WED" :
  print (4)
elif N == "THU" :
  print (3)
elif N == "FRI" :
  print (2)
elif N == "SAT" :
  print (1)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;

int main(){
    ll n, k;
    cin >> n >> k;
    if(k%2==0){
        ll a = pow(n/k,3);
        ll b = pow((n/(k/2)+1)/2,3);
        cout << a+b << endl;
    }
    else{
        ll a = pow(n/k,3);
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
const int inf=1e9+10;
int n;
int num[maxn];
int main()
{
    while(~scanf("%d",&n))
    {
        int minnum=inf,maxnum=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&num[i]);
            minnum=min(minnum,num[i]);
            maxnum=max(maxnum,num[i]);
        }
        if(!(minnum+1==maxnum||minnum==maxnum))
        {
            printf("No\n");
            continue;
        }
        int color=maxnum;
        int maxc=0;
        for(int i=0;i<n;i++)
        {
            if(maxnum-1==num[i]) color--;
            else maxc++;
        }
        if(minnum+1==maxnum)
        {
            if(maxc>=color*2&&color>=1)
                printf("Yes\n");
            else printf("No\n");
        }
        else
        {
            if(maxc>=color*2||maxc==color+1)
                printf("Yes\n");
            else printf("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  double x1 = ((double) a + (double) b)/2;
  int x2 = (a + b) / 2;
  if (x1 > x2) x2++;
  cout << x2 << endl;
  
}

Measured memory_bytes: 256
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int year, month, day;
    char tmp1, tmp2;
    cin >> year >> tmp1 >> month >> tmp2 >> day;
    if ( month <= 4 && day <= 30) {
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long;
using namespace std;
using pii = pair<int, int>;

int main(){
	int k;
	int sum = 0;
	scanf("%d", &k);
	for(int a = 1; a <= k; a++){
		for(int b = 1; b <= k; b++){
			for(int c= 1; c <= k; c++){
				sum += __gcd(__gcd(a,b), c);
			}
		}
	}
	printf("%d", sum);

}

Measured memory_bytes: 3828
s = input()
n = len(s)
ans = [0]*n
buf = 1
c = [0]*n
c[0]=c[-1]=1

for i in range(n-1):
    if s[i+1]=='L':
        if s[i]==s[i+1]:
            c[i+1] = c[i]+1
        else:  
            c[i+1] = 1
for i in range(n-1,0,-1):
    if s[i-1]=='R':
        if s[i-1]==s[i]:
            c[i-1] = c[i]+1
        else:
            c[i-1] = 1

for i in range(n):
    if s[i]=='R':
        if c[i]%2==0:ans[i+c[i]] += 1
        else:ans[i+c[i]-1]+=1
    else:
        if c[i]%2==0:ans[i-c[i]] += 1
        else:ans[i-c[i]+1] += 1

print(*ans)

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

int main(){
    int n,m;
    cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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


int main() {
    int h,a;
    cin >> h >> a;
    if(h%a == 0){
        cout << h/a << endl;
    }else{
        cout << h/a + 1 << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n;
    cin>>n;
    long long int result=0;
    vector<long long int> v(n);
    REP(i,n){
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<long long int>());
    REP(i,n){
        result+=v[i]*(1*(!(i&1))+-1*(i&1));
    }
    cout<<result<<endl;

    return 0;
}


Measured memory_bytes: 888
k, t = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
same_eaten = 0

a[0] -= 1
last_index = 0
k -= 1
for _ in range(k):
    eaten = False
    for i in range(len(a)):
        if i != last_index and a[i] > 0:
            eaten = True
            a[i] -= 1
            if a[i+1] > a[i]:
                last_index = i+1
            else:
                last_index = i
            a.sort()
            a.reverse()
            break
    if not eaten:
        same_eaten += 1
print(same_eaten)









Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=500010, inf=1e9;
ll l, r, ans;
inline void read(ll &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;	
} 
int main()
{
	read(l); read(r);
	while(l<=r) ans++, l<<=1;
	printf("%d\n", ans);
}

Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import Data.Maybe
import qualified Data.Set as S
import Data.Graph
import qualified Data.IntMap.Strict as IM 

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    [n,m] <- r'
    hs <- r n
    roads <- IM.fromListWith (++) <$> concat <$> replicateM m (do
        [a,b] <- r'
        return [(a,[b]),(b,[a])])
    -- let graph = buildG (1,n) (edges++edges2)
    -- print roads
    print $ length $ filter (good roads hs) [1..n]
    -- print 0

flipTup (a,b) = (b,a)

good :: IM.IntMap [Int] -> U.Vector Int -> Int -> Bool
good roads hs h = all (\k -> hs U.! (k-1) < hs U.! (h-1)) (fromMaybe [] (IM.lookup h roads))

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

using namespace std;

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

    int p[n];
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    
    int count = 0;
    for (int i = 1; i < n-1; i++)
    {
        vector<int> vec;
        vec.push_back(p[i-1]);
        vec.push_back(p[i]);
        vec.push_back(p[i+1]);
        
        sort(vec.begin(), vec.end(), greater<int>() );

        if (p[i] == vec[1])
        {
            count++;
        } 
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define Imax 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int n;
  cin>>n;
  vector<double> x(n);
  vector<string> u(n);
  rep(i,0,n) cin>>x[i]>>u[i];
  double sum=0;
  rep(i,0,n){
    if(u[i]=="JPY"){
      sum+=x[i];
    }else{
      sum+=x[i]*380000.0;
    }
  }
  cout<<sum;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

int main(){
    int a, b, c, ans=0;
    cin >> a;
    
    b = a/500;
    c = (a - b * 500)/5;
    ans = b * 1000 + c * 5;

    cout <<  ans  << endl;
}

Measured memory_bytes: 3588
a,b=map(int,input().split())
counter=0
for i in range(40):
    K=2**(i+1)
    judge=0
    u,x=divmod(a,K)
    v,y=divmod(b,K)
    if u==v:
        if y<2**i:
            pass
        elif y>=2**i:
            if x<2**i:
                judge+=(y-2**i+1)
                
            elif x>=2**i:
                judge+=(y-x+1)
    elif u<v:
        judge+=(2**(i+1)-2**i)*(v-u-1)
        if y<2**i:
            pass
        if y>=2**i:
            judge+=y-2**i+1
            
        if x<2**i:
            judge+=2**(i+1)-2**i
        if x>=2**i:
            judge+=2**(i+1)-x
    if judge%2!=0:
        counter+=2**i


print(counter)        
    

Measured memory_bytes: 3192
#include <iostream>
  #include <iomanip>
  #include <algorithm>
  #include <cmath>
  #include <queue>
  #include <list>
  #include <limits>
  #include <string>
  #include <vector>
  #include <stack>
  using namespace std;
  typedef long long ll;

  typedef pair<ll, ll> curr;
  const int MOD = 998244353;


  int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }

  ll calc(int a, int b, int p){
    if(b == 0) return 1;
    if(b % 2 == 0){
      ll d = calc(a, b/2, p);
      return (d*d)%p;
    }else{
      return (a*calc(a, b-1, p))%p;
    }

  }
  int main()
  {
    int N,num,oddmax=0,evenmax=0,oddmax2=0,evenmax2=0;
    bool flag = false, equal = true;
    int oddcount[100001] = {};
    int evencount[100001] = {};
    cin >> N;
    for(int i=0;i<N;i++){
      cin >> num;
      if(i%2==1) oddcount[num]++;
      if(i%2==0) evencount[num]++;
    }
    for(int i=0;i<100001;i++){
      flag = false;
      if(oddcount[i] > oddmax){
        oddmax2 = oddmax;
        oddmax = oddcount[i];
        equal = false;
        flag = true;
      }else if(oddcount[i] > oddmax2){
        oddmax2 = oddcount[i];
      }
      if(evencount[i] > evenmax){
        evenmax2 = evenmax;
        evenmax = evencount[i];
        equal = false;
        if(flag) equal = true;
      }else if(evencount[i] > evenmax2){
        evenmax2 = evencount[i];
      }
    }
    if(equal){
      if(oddmax+evenmax2 > oddmax2+evenmax){
        evenmax = evenmax2;
      }else{
        oddmax = oddmax2;
      }
    }
    cout << N-oddmax-evenmax;
  }


Measured memory_bytes: 1024