akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.ball", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		vector <int> ball;
		getline (cin, str );
		stringstream ss(str);
		int b;
		while (ss >> b){
			ball.push_back(b);
		} // end while
		stack <int> A;
		stack <int> B;

		A.push (0);
		B.push (0);

		int size = ball.size();

		A.push (ball[0]);
		for (j = 1; j < size; ++j){
//			cout << "ball[" << j << "]: " << ball[j] << endl;
//			cout << "A:" << A.top() << " B: " << B.top() << endl;
			if (ball[j] < A.top() && ball[j] > B.top() ){
//				cout << "B in" << endl;
				B.push (ball[j]);
			}else if (ball[j] > A.top() && ball[j] < B.top() ){
//				cout << "A in" << endl;
				A.push (ball[j]);
			}else if (ball[j] > A.top() && ball[j] > B.top() ){
				if (ball[j] - A.top() < ball[j] - B.top() ){
//					cout << "A in" << endl;
					A.push (ball[j]);
				}else{
//					cout << "B in" << endl;
					B.push (ball[j]);
				} // end if 
			}else{
				cout << "NO" << endl;
				break;
			} // end if
		} // end for
		if (j == size ){
			cout << "YES" << endl;
		} // end if
	} // end for
		
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var H = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var higher = 0;
            var count = 0;
            for (int i = 0; i < H.Length; i++)
            {
                // 一番高い山以上であれば見える
                if (higher <= H[i])
                {
                    higher = H[i];
                    count++;
                }
            }

            Console.WriteLine($"{count}");
        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		String s = sc.next();
		int[] data = new int[n];
		data[n-1] = 0;
		for(int i = s.length()-2; i >= 0; i--) {
			data[i] = data[i+1];
			if(s.substring(i, i+2).equals("AC"))
				data[i]++;
		}
		for(int i =0; i < q; i++) {
			int l = sc.nextInt()-1;
			int r = sc.nextInt()-1;
			System.out.println(data[l] - data[r]);
		}
	}
}

Measured memory_bytes: 72628
#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>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#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>
#if __cplusplus >= 201103L
#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>
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>
#pragma comment(linker, "/STACK:1024000000,1024000000") 
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define set0(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
#define X first
#define Y second
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> tree_set;
typedef tree<int,int,less<int>,rb_tree_tag,tree_order_statistics_node_update> tree_map;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> heap;
typedef cc_hash_table<int,int> cc_hashmap;
typedef cc_hash_table<int,null_type> cc_hashset;
typedef gp_hash_table<int,int> gp_hashmap;
typedef gp_hash_table<int,null_type> gp_hashset;
heap q1,q2;
int n,m;
pair<int,int> p[200005];
inline bool cmp(pair<int,int> &x,pair<int,int> &y){
	if(x.X!=y.X)return x.X<y.X;
	return x.Y>y.Y;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>p[i].X>>p[i].Y;
	}
	sort(p,p+n,cmp);
	int ans=n;
	for(int i=0;i<n;i++){
		if(p[i].X==q1.size()){
			q1.push(p[i].Y);
			q2.push(q1.top());
			q1.pop();
		}
		else{
			q1.push(p[i].Y);
			ans--;
		}
	}
	for(int i=q1.size()+1;!q2.empty() && i<=m;i++){
		if(q2.top()<=i){
			q2.pop();
			ans--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl '\n';
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
    #define eprintf(...) 42
#endif

clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = (ll)1e9 + 7, INF = (ll)1e18;;
ll add(ll x, ll y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
ll sub(ll x, ll y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
ll mul(ll x, ll y) {
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(x, bin_pow(x, p - 1));
    return bin_pow(mul(x, x), p / 2);
}

const int N = 100100;
int a[N];
int n, m, ans = 0;
set <int> p;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    startTime = clock();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    cin >> n >> m;
    for (int i = 0; i < n; ++i)
        a[i] = 1;
    p.insert(0);
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        a[y]++;
        a[x]--;
        if (p.count(x)) {
            p.insert(y);
            if (a[x] == 0)
                p.erase(x);
        }
    }
    for (auto x : p) {
        if (a[x] > 0) {
            ++ans;
        }
    }
    cout << max(ans, 1) << endl;
    
    return 0;
}


Measured memory_bytes: 8748
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()


using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int H, W;
vector<string> field;
int dxy[5] = {-1, 0, 1, 0, -1};
void dfs(int y, int x, char c){
    field[y][x] = '.';

    for(int i=0; i<4; ++i){
        int ny = y + dxy[i], nx = x + dxy[i+1];

        if(ny>=0 && ny<H && nx >= 0 && nx < W && field[ny][nx] == c){
            dfs(ny, nx, c);
        }
    }
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    while(cin >> H >> W, H, W) {
        field.clear();
        rep(i, 0, H) {
            string s;
            cin >> s;
            field.push_back(s);
        }

        int cnt = 0;

        rep(i, 0, H) rep(j, 0, W) {
                if (field[i][j] != '.') {
                    cnt++;
                    dfs(i, j, field[i][j]);
                }
            }
        cout << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 4076
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,n,max,mx;
	int flg[10001];
	while(1) {
		scanf("%d",&n);
		if(n==0) break;
		for(i=2;i<=n;i++) flg[i]=1;
		for(i=2;i*i<=n;i++) {
			if(flg[i]==1) for(j=2;j*i<=n;j++) flg[i*j]=0;
		}
		max=-1;
		for(i=n;i>=5;i--)	{
			if(flg[i]==1 && flg[i-2]==1)	break;
		}
		max=i-2;
//		for(i=2;i<n;i++) {
//			if(flg[i]==1 && flg[i]==flg[i+2] && i+2<=n) {
//				if(max<i) max=i;
//			}
//		}
		printf("%d %d\n",max,max+2);
	}
	return 0;
}
		

Measured memory_bytes: 1068
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


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

 if(a < 3200) {
   cout << "red" << endl;
 }else {
   cout << s << endl;
 }
 
}

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


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;i++)arr[i]=s.nextInt();
        long min = Long.MAX_VALUE;
        for(int i=1;i<=100;i++){
            long sum=0;
            for(int j=0;j<n;j++){
                sum+=(int)(Math.pow(arr[j]-i,2));
            }
            min = Math.min(min,sum);
        }
        System.out.println(min);
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25428
n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
count=0
for a in al:
    temp=0
    v=a
    while v%2==0:
        v=v//2
        temp+=1
    count+=temp

print(count)



Measured memory_bytes: 4148
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

using ll = long long;
using Connect = pair<int, ll>;

int main() {
  int N;
  cin >> N;
  vector<vector<Connect>> nodes(N + 1);
  int u, v;
  ll w;
  for(int i = 1; i < N; ++i) {
    cin >> u >> v >> w;
    nodes[u].push_back(Connect(v, w));
    nodes[v].push_back(Connect(u, w));
  }
  vector<int> even_color(N + 1, -1); /// wが偶数のときに使う色
  vector<int> color(N + 1, -1);
  queue<Connect> qs;
  qs.push(Connect(1, 0));
  color[1] = 0;
  while(!qs.empty()) {
    auto top = qs.front();
    qs.pop();
    for(auto c : nodes[top.first]) {
      if(color[c.first] != -1) {
        continue;
      }
      if(c.second % 2 == 0) {
        color[c.first] = color[top.first];
      }else {
        color[c.first] = (color[top.first] ^ 1);
      }
      qs.push(c);
    }
  }
  for(int i = 1; i < color.size(); ++i) {
    cout << color[i] << endl;
  }
  return 0;
}

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


INF=10**20
def prime_factorize(n):
    P = []
    P_set = set()
    while n % 2 == 0:
        P.append(2)
        P_set.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            P.append(f)
            P_set.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        P.append(n)
        P_set.add(n)

    P_count = {p:0 for p in P_set}
    for p in P: P_count[p] += 1

    return P_count


def solve(A: int, B: int):
    gcd = fractions.gcd(A,B)
    P = prime_factorize(gcd).keys()
    print(len(list(P))+1)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)



if __name__ == "__main__":
    main()


Measured memory_bytes: 77548
#include<stdio.h>
int main()
{
    int x[100],i,j,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    for(i=n-1;i>=0;i--){
        if(i==0){
            printf("%d\n",x[i]);
        }
        else
        printf("%d ",x[i]);

    }
    return 0;
}



Measured memory_bytes: 2044
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <sstream>
#include <cctype>
#include <cmath>
#include <cstdio>
using namespace std;
#define MPI  3.14159265358979323846


int main(){

	double a, b, C, S, L, h;
	cin >> a >> b >> C ;

	S = a*b*sin(C*MPI / 180.0)/2;
	L = a + b + sqrt(a*a + b*b - 2 * a*b*cos(C*MPI / 180.0));
	h = b*sin(C*MPI / 180.0);

	printf("%.8f\n%.8f\n%.8f\n", S, L, h);

	return 0;
}


Measured memory_bytes: 3420
#include <iostream>
#include <cmath>
#include <utility>
#include <vector>
#include <string>
using namespace std;

typedef pair<double,double> pdd;
#define x first
#define y second
const double EPS = 1e-9;
const double INF = 1e18;

template<class T>
T sqr(T obj) { return obj * obj; }

pdd pt(pdd a0, pdd a1, pdd b0, pdd b1) {
	double div;
	pdd ret;

	div = (a1.y - a0.y) * (b1.x - b0.x) - (b1.y - b0.y) * (a1.x - a0.x);
	if(fabs(div) < EPS)
		return pdd(INF,INF);

	ret.x = (a1.x - a0.x) * (b1.x * b0.y - b0.x * b1.y) - (b1.x - b0.x) * (a1.x * a0.y - a0.x * a1.y);
	ret.y = (a1.y - a0.y) * (b1.x * b0.y - b0.x * b1.y) - (b1.y - b0.y) * (a1.x * a0.y - a0.x * a1.y);
	ret.x /= div;
	ret.y /= div;

	return ret;
}

int main() {
	while(1) {
		vector<pdd> v;
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 2; j++) {
				double a, b;
				cin >> a >> b;
				v.push_back(pdd(a,b));
			}
			if(fabs(v[0].x) < EPS && fabs(v[0].y) < EPS && fabs(v[1].x) < EPS && fabs(v[1].y) < EPS)
				goto EXIT;
		}

		vector<pdd> p;
		for(int i = 0; i < 3; i++) {
			p.push_back(pt(v[i*2 % 6], v[(i*2+1) % 6], v[(i+1)*2 % 6], v[((i+1)*2+1) % 6]));
		}

		string res = "";
		for(int i = 0; i < p.size(); i++) {
			for(int j = 0; j < 2; j++) {
				double dist0, dist1;
				dist0 = sqrt(sqr(v[(i+j)*2%6].x - v[((i+j)*2+1)%6].x) + sqr(v[(i+j)*2%6].y - v[((i+j)*2+1)%6].y));
				dist1 = sqrt(sqr(v[(i+j)*2%6].x - p[i].x) + sqr(v[(i+j)*2%6].y - p[i].y))
					+ sqrt(sqr(v[((i+j)*2+1)%6].x - p[i].x) + sqr(v[((i+j)*2+1)%6].y - p[i].y));
				if(p[i].x == INF || p[i].y == INF || fabs(dist0 - dist1) > EPS) {
					res = "kyo";
				}
				//cout << p[i].x << "," << p[i].y << endl;
			}
		}

		if(res == "") {
			double S;
			S = ((p[1].x - p[0].x) * (p[2].y - p[0].y) - (p[1].y - p[0].y) * (p[2].x - p[0].x)) / 2;
			S = fabs(S);

			if(S + EPS>= 1900000)
				res = "dai-kichi";
			else if(S + EPS >= 1000000)
				res = "chu-kichi";
			else if(S + EPS >= 100000)
				res = "kichi";
			else if(S < EPS)
				res = "kyo";
			else
				res = "syo-kichi";
		}
		cout << res << endl;
	}

EXIT:;
}

Measured memory_bytes: 1232
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll ans = 0;
int a[60], b[60], c[60];
ll d[60];

void dfs(vector<int> A, int N, int M, int Q){
  int P = A.size();
  //cout << P << endl;
  if(P-1==N){
    ll tmp = 0;
    rep(i, Q){
      if(A[b[i]]-A[a[i]]==c[i]) tmp+=d[i];
    }
    ans = max(ans, tmp);
    //cout << "OK" << endl;
    return;
  }
  for(int i=A[P-1]; i<=M; i++){
    A.push_back(i);
    dfs(A, N, M, Q);
    A.pop_back();
  }
}


int main(){
  int N, M, Q; cin >> N >> M >> Q;
  rep(i, Q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  vector<int> T;
  T.push_back(1);
  dfs(T, N, M, Q);
  cout << ans << endl;
}

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

int main() {
  string s;
  long long k;
  cin >> s >> k;
  
  long long l = s.size();
  if(l == 1){
    cout << l * k / 2 << endl;
    return 0;
  }
  long long ans = 0, cnt = 0;
  for(int i = 1; i < l; i++){
    if(s.at(i) == s.at(i-1)) cnt++;
    else ans += (cnt + 1) / 2, cnt = 0;
  }
  ans += (cnt + 1) / 2;
  if(cnt + 1 == l){
    cout << l * k / 2 << endl;
    return 0;
  }
  if(s.at(0) != s.at(l-1)){
    cout << ans * k << endl;
    return 0;
  }
  long long fi = 0, la = 0;
  for(int i = 1; i < l; i++){
    if(s.at(i) == s.at(i-1)) fi++;
    else break;
  }
  for(int i = l - 1; i > 0; i--){
    if(s.at(i) == s.at(i-1)) la++;
    else break;
  }
  ans -= (fi+1) / 2 + (la+1) / 2;
  ans *= k;
  ans += (fi+1) / 2 + (la+1) / 2;
  ans += (fi + la + 2) / 2 * (k - 1);
  
  cout << ans << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define ii pair<ll,ll>
#define mod 1000000007
#define endl '\n'
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return ans;
}

void sieve(ll n){
	bool prime[n+1];
	memset(prime,true,sizeof(prime));
	for(ll p=2;p*p<=n;p++){
		if(prime[p]){
			for(ll i=p*p;i<=n;i+=p)
				prime[i]=false;
		}
	}
	for(ll p=2;p<=n;p++){
		if(prime[p])
			cout<<p<<" ";
	}
}


int main() {
	IOS;
	ll t=1;
	//cin>>t;
	while(t--){
		string s,t;
		cin>>s>>t;
		vector<ll> v[26];
		for(ll i=0;i<s.size();i++){
			v[s[i]-'a'].push_back(i);
		}
		ll cnt=0;
		ll j=-1;
		for(ll i=0;i<t.size();i++){
			if(v[t[i]-'a'].size()==0){
				cout<<-1;
				return 0;
			}
			ll kha=t[i]-'a';
			ll ind=upper_bound(v[kha].begin(),v[kha].end(),j)-v[kha].begin();
			if(ind==v[kha].size()){
				j=v[kha][0];
				cnt++;
			}
			else{
				j=v[kha][ind];
			}
		}
		cout<<cnt*s.size()+j+1;
	}
	return 0;
}

Measured memory_bytes: 1736
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int i = scanner.nextInt();
        final int kakera = a * 3 + i;
        System.out.println(kakera/2);
    }
}


Measured memory_bytes: 25044
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL r,g,b,n,ans=0;

int main()
{
	cin>>r>>g>>b>>n;
	rep(i,3010)
	{
		rep(j,3010)
		{
			if(n-r*i-g*j<0) continue;
			if((n-r*i-g*j)%b!=0) continue;
			ans++;
		}
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

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

  set<int> water, sugar;
  for (int i = 0; i <= f; i++) {
    for (int j = 0; j <= f; j++) {
      int w = 100 * a * i + 100 * b * j;
      if (w > f) {
        continue;
      }
      water.insert(w);
    }
  }
  for (int i = 0; i <= f; i++) {
    for (int j = 0; j <= f; j++) {
      int s = c * i + d * j;
      if (s > f) {
        continue;
      }
      sugar.insert(s);
    }
  }

  int ans_w = 100 * a, ans_s = 0;
  for (auto it = water.begin(); it != water.end(); it++) {
    for (auto it2 = sugar.begin(); it2 != sugar.end(); it2++) {
      int w = *it, s = *it2;
      if (w + s > f) {
        continue;
      }
      if (s * 100 > e * w) {
        continue;
      }
      if (ans_s * (s + w) < s * (ans_w + ans_s)) {
        ans_w = w;
        ans_s = s;
      }
    }
  }
  cout << ans_w + ans_s << " " << ans_s << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t;
    cin>>a>>b;
    cin>>u;
    if(u==t){
        b--;
    }
    else{
        a--;

    }
    cout<<a<<" "<<b<<endl;
    return 0;
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0); 
  char c;
  cin >> c;
  if (c != 'z') c = (char) c + 1;
  cout << c << "\n";
return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta, n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define RRep(i,sta, n) for(int i=sta;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;

    // vector<int> v(s.size(),0);
    // int tmp = 0;
    // REP(i, s.size()-1){
    //     if(s[i] == 'A' && s[i+1] == 'C')v[i]=++tmp;
    //     else v[i]=tmp;
    // }
    // v[s.size()-1]=tmp;
    vector<int> v(n+1,0);
    REP(i, n){
        v[i+1]=v[i]+((s[i] == 'A' && s[i+1] == 'C')?1:0);
    }

    vector<int> ans(q,0);
    REP(i, q){
        int l,r;
        cin >> l >> r;
        // if(r-l==1){
        //     if(s[l-1]=='A'&&s[r-1]=='C')ans[i]=1;
        //     continue;
        // }
        // int min_n;
        // int max_n;
        // if(s[l-1]=='A'&&s[l]=='C')min_n = v[l-1];
        // else min_n = v[l-1]-1;

        // if(r==n) max_n = v[r-1];
        // else max_n = v[r];

        // ans[i]=max_n-(min_n-1);
        int minn=v[l-1];
        int maxn=v[r-1];
        ans[i]=v[r-1]-v[l-1];
    }
    REP(i, q){
        pr(ans[i]);
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
ll N;
cin >> N ;
if(N/100==7 || N%10==7 || N/10%10==7){
  cout << "Yes" <<endl;
}else{
  cout << "No"<<endl;
}
}


Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args){
	
		for(;scan.hasNext();){
			int a = 0,b=0;
			
			a = scan.nextInt();
			String op = scan.next();
			b = scan.nextInt();
			
//			a = Integer.parseInt(args[i]);
//			b = Integer.parseInt(args[i+2]);
			if(op.equals("+")){
				System.out.println(a+b);
			}
			if(op.equals("-")){
				System.out.println(a-b);
			}
			if(op.equals("*")){
				System.out.println(a*b);
			}
			if(op.equals("/")){
				System.out.println(a/b);
			}
			if(op.equals("?")){
				break;
			}
		}
	}
}



Measured memory_bytes: 26108
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <random>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

VI all[50], e[50];
int visit[50];

void dfs(int now){
    visit[now] = 1;
    for (int next : e[now]){
        if (visit[next]) continue;
        dfs(next);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    VI u(m), v(m);
    REP(i,m){
        cin >> u[i] >> v[i];
        u[i]--;
        v[i]--;
    }

    int ans = 0;
    REP(i,m){
        REP(j,n) e[j].clear();
        REP(j,n) visit[j] = 0;
        REP(j,m){
            if (j != i){
                e[u[j]].push_back(v[j]);
                e[v[j]].push_back(u[j]);
            }
        }
        dfs(0);
        ans += (*min_element(visit, visit+n) == 0);
        // cout << ans << endl;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <map>
using namespace std;
int main( void )
{
	map <string, int> TABLE;

	int max_length = 0;
	string max_length_word = "";
	int max_count = 0;
	string max_count_word = "";

	string text;
	string word;
	getline( cin, text );
	istringstream is( text );

	while ( is >> word )
	{
		if ( word.length() > max_length )
		{
			max_length_word = word;
			max_length = word.length();
		}

		if ( TABLE.find( word ) == TABLE.end() )
		{
			TABLE[word] = 0;
		}
		else
		{
			TABLE[word]++;
			if ( TABLE[word] > max_count )
			{
				max_count_word = word;
				max_count = TABLE[word];
			}
		}
	}

	cout << max_count_word << " " << max_length_word << endl;

	return 0;
}

Measured memory_bytes: 0
/* Creator - Glitched */

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

#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define elif else if
#define flush cout<<"\n"
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)


int main(){
  long long int a,b,k,x,y;
  cin>>a>>b>>k;
  
  x = a-k >= 0 ? a-k : 0;

  y = x==0 ? (b-k+a >= 0 ? b+a-k : 0)  : b;
  
  cout<<x<<" "<<y;
  
  cout<<endl;
}
  
  


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var (
		n, m int
	)
	fmt.Scan(&n, &m)

	point := make(map[int]int, m)
	for i := 0; i < n; i++ {
		var c int
		fmt.Scan(&c)
		for j := 0; j < c; j++ {
			var num int
			fmt.Scan(&num)
			point[num]++
		}
	}

	var count int
	for _, val := range point {
		if val == n {
			count++
		}
	}
	fmt.Print(count)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N=2e3+50,mod=924844033;
int n,k,dp[N][N][4],f[2][N],fac[N],ans;
inline int add(int x,int y) {return (x+y>=mod)?x+y-mod:x+y;}
inline int mul(int x,int y) {return (long long)x*y%mod;}
int main() {
	cin>>n>>k; fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=mul(fac[i-1],i);
	for(int i=1;i<=n;i++) {
		if(i<=k) {
			dp[i][0][0]=1;
			if(i+k<=n) dp[i][1][2]=1;
		} else {
			for(int j=0;j<=i && j<=n;j++) {
				for(int s=0;s<=3;++s) 
					dp[i][j][s>>1]=add(dp[i][j][s>>1],dp[i-k][j][s]);
				if(!j) continue;
				dp[i][j][0]=add(dp[i][j][0],dp[i-k][j-1][0]);
				dp[i][j][1]=add(dp[i][j][1],dp[i-k][j-1][2]);
				if(i+k<=n) {
					dp[i][j][2]=add(dp[i][j][2],dp[i-k][j-1][0]);
					dp[i][j][2]=add(dp[i][j][2],dp[i-k][j-1][1]);
					dp[i][j][3]=add(dp[i][j][3],dp[i-k][j-1][2]);
					dp[i][j][3]=add(dp[i][j][3],dp[i-k][j-1][3]);		
				}
			}
		}
	}
	int now=0; f[now][0]=1;
	for(int i=n;i>n-k && i;i--) {
		now^=1;
		for(int j=0;j<=n;j++) f[now][j]=0;
		for(int j=0;j<=n/k+1;++j) {
			int rs=0;
			for(int s=0;s<=3;s++) rs=add(rs,dp[i][j][s]);
			if(!rs) continue;
			for(int k=n;k>=j;k--)
				f[now][k]=add(f[now][k],mul(f[now^1][k-j],rs));
		}
	}
	for(int i=0;i<=n;i++) {
		if(i&1) ans=add(ans,mod-mul(f[now][i],fac[n-i]));
		else ans=add(ans,mul(f[now][i],fac[n-i]));
	}
	printf("%d\n",ans);
}

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

int main(){
  using Pair= pair<int64_t, int>;
  int N,M;
  cin >> N >> M;

  vector<Pair> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }
  sort(data.begin(), data.end());

  int64_t ans= 0;
  int rem= M;
  int idx= 0;
  while(rem > 0){
    int64_t price; int num;
    tie(price, num)= data.at(idx);
    
    int Nbuy= min(rem, num);
    ans+= price* Nbuy;
    rem-= Nbuy;

    idx++;
  }

  cout << ans << endl; 
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int a[1000000]={};
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(a[s[i]]!=1){
      a[s[i]]=1;
    }else{
      a[s[i]]=2;
  	}
  }
  for(int i=0;i<s.size();i++){
    if(a[s[i]]==2){
      cout<<"no\n";
      return(0);
  }
  }
  cout<<"yes\n";
}

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

#define ll long long int
#define llu unsigned long long int
#define f(n) for(ll i=0;i<n;i++)
#define fr(n) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define mod 1000000007

using namespace std;

int main()
{
	//#ifdef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	std::ios_base::sync_with_stdio(false);

	string s;
	cin>>s;
	ll a=0,b=0;
	f(3)
	{
	if(s[i]=='A')
		a++;
	if(s[i]=='B')
		b++;
}
	if(a>0 && b>0)
	{
		cout<<"Yes";
	}
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
if n%2 != 0:
  print("No")
else:
  yes = True
  for i in range(0, n//2):
    if s[i] == s[i+n//2]:
      pass
    else:
      yes = False
  if yes:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
const int N=2e5;
char stk[N];
string s;
int p=0;
int main(){
	char c;stk[0]='T';
	cin>>s;
	int i=0;
	while(s[i]!='\0'&&s[i]!='\n'){
		c=s[i++];
		if(p==0){
			stk[++p]=c;
			continue;
		}
		if(c=='T'&&stk[p]=='S'){
			p--;
			continue;
		}
		stk[++p]=c;
	}
	cout<<p;
} 

Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N, X, Y;
  cin >> N >> X >> Y;
  vector<i64> ans(N);
  vector<i64> edge[N];
  for (i64 i = 0; i < N - 1; i++)
  {
    edge[i].push_back(i + 1);
    edge[i + 1].push_back(i);
  }
  X--;
  Y--;
  edge[X].push_back(Y);
  edge[Y].push_back(X);
  for (i64 i = 0; i < N; i++)
  {
    vector<i64> far(N, 1e9);
    queue<i64> que;
    far[i] = 0;
    que.push(i);
    while (que.size())
    {
      i64 p = que.front();
      que.pop();
      for (i64 j : edge[p])
        if (far[p] + 1 < far[j])
        {
          far[j] = far[p] + 1;
          ans[far[j] - 1]++;
          que.push(j);
        }
    }
  }
  for (i64 i = 0; i < N - 1; i++)
    cout << ans[i] / 2 << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct node *nodepointer;
struct node{
    int d;
    nodepointer next;
    nodepointer prev;
};

nodepointer makenode(int,nodepointer,nodepointer);
void insert(int);
void delete(int,int);
void listprint();

nodepointer head,tail;


int main(){
    head=makenode(-1,NULL,NULL);
    tail=makenode(-1,NULL,head);
    head->next=tail;
    int n,k,i;
    char com[12];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",com);
        if(strcmp(com,"insert")==0){
            scanf("%d",&k);
            insert(k);
        }
        else if(strcmp(com,"delete")==0){
            scanf("%d",&k);
            delete(k,0);
        }
        else if(strcmp(com,"deleteFirst")==0){
            delete(-1,1);
        }
        else{
            delete(-1,2);
        }
    }
    listprint();
}

nodepointer makenode(int keydata,nodepointer p_n,nodepointer p_p){
    nodepointer n;
    n=(nodepointer)malloc(sizeof(struct node));
    n->d=keydata;
    n->next=p_n;
    n->prev=p_p;
    return n;
}

void insert(int keydata){
    nodepointer n;
    n=makenode(keydata,head->next,head);
    head->next=n;
    n->next->prev=n;
}

void listprint(){
    int i=0;
    nodepointer p;
    for(p=head->next;p->next!=NULL;p=p->next,i++){
        if(i!=0) printf(" ");
        printf("%d",p->d);
    }
    printf("\n");
}
void delete(int keydata,int com){
    nodepointer p;
    if(com==0){
        for(p=head->next;p->next!=NULL;p=p->next){
            if(p->d==keydata){
                p->prev->next=p->next;
                p->next->prev=p->prev;
                free(p);
                break;
            }
        }  
    }
    else if(com==1){
        p=head->next;
        p->prev->next=p->next;
        p->next->prev=p->prev;
        free(p);
    }
    else{
        p=tail->prev;
        p->prev->next=p->next;
        p->next->prev=p->prev;
        free(p);
    }
}



Measured memory_bytes: 32948
N=int(input())
uvw=[[] for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    uvw[u-1].append((v-1,w))
    uvw[v-1].append((u-1,w))
# print(uvw)
color=[-1]*N 
color[0]=0
now=0
nex=[0]
from copy import deepcopy
while nex:
    now=nex.pop()
    stack=deepcopy(uvw[now])
    uvw[now]=[]
    while stack:
        a=stack.pop()
        if a[1]%2==0:
            color[a[0]]=color[now]
        else:
            color[a[0]]=color[now]^1
        nex.append(a[0])
for c in color:
    print(c)

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

int main(){
  int n, maxi = -100000000;
  cin >> n;
  for(int i = 1; i <= n; i++){
    for(int j = 2; j < n + 3; j++){
      int p = pow(i,j);
      if(n < p)break;
      maxi = max(maxi, p);
    }
  }
  cout << maxi << endl;
  return 0;
}


Measured memory_bytes: 256
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,k;
    cin>>n>>k;
    //if()
    V vec(n+1);
    rep(i,n)cin>>vec[i];
    rep(i,k){
        V vec2(n+1);
        rep(j,n){
            vec2[max(0LL,j-vec[j])]++;
            vec2[min(n,j+vec[j]+1)]--;
        }
        rep3(j,1,n){
            vec2[j]+=vec2[j-1];
        }
        vec=vec2;
        bool f=true;
        rep(i,n){
            if(vec[i]!=n){
                f=false;
                break;
            }
        }
        if(f){
            rep(i,n){
                cout<<vec[i]<<" ";
            }
            cout<<endl;
            return 0; 
        }
    }
    rep(i,n){
        cout<<vec[i]<<" ";
    }
    cout<<endl;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int mx = 0;
    int c;
    string t;
    vector<bool> v(26, true);
    for (int i = 1; i < n; i++) {
        c = 0;
        t = s.substr(i);
        v = vector<bool>(26, true);
        for (int j = 0; j < i; j++) {
            if (v[s[j] - 'a']) {
                v[s[j] - 'a'] = false;
                if (t.find(s[j]) != string::npos) {
                    c++;
                }
            }
        }
        mx = max(mx, c);
    }

    cout << mx << endl;
}


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

using ll = long long int;
ll n;

int main() {
    #ifdef LU_SERIOUS
        freopen( "in.txt", "r", stdin );
    #endif // LU_SERIOUS
    ll a, b, x, a1, b1, ans;
    while( cin >> a >> b >> x )  {
//        cerr << a << " " << b << " " << x << "\n";
        a1 = max( a-1, 0LL );
        b1 = b;
        a1 /= x;
        b1 /= x;
//        cerr << a1 << " " << b1 << "\n";
        ans = b1 - a1;
        if( !a ) ans++;
        cout << ans << "\n" ;
    }
    return 0;
}


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

int main()
{
	int ans[105], n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> ans[i];
	int M = ans[0];
	int cnt = 1;
	for(int i = 1; i < n; i++) 
	{
		if(ans[i] == M) cnt++;
		else if(ans[i] > M) { M = ans[i]; cnt++; }
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	while(true){
		String str=input.readLine();
		String[] atr=str.split(" ");
		int a=Integer.parseInt(atr[0]);
		String op=atr[1];
		int b=Integer.parseInt(atr[2]);
		if(op.equals("+")){
			System.out.println(a+b);
		}
		else if(op.equals("-")){
			System.out.println(a-b);
		}
		else if(op.equals("*")){
			System.out.println(a*b);
		}

		else if(op.equals("/")){
			System.out.println(a/b);
		}
		else if(op.equals("?")){
			break;
			}
			

		}
	
		
	}
}

Measured memory_bytes: 24120
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc088/tasks/abc088_b

_ = int(input())
A = sorted(list(map(int, input().split())))[::-1]

ans = 0
for i, a in enumerate(A):
    if i % 2 == 0:
        ans += a
    else:
        ans -= a

print(ans)


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

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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;
}

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int H, W;
vector<string> s;

bool is_no(int i, int j) {
    if (1 <= i && s[i-1][j] == '#') return false;
    if (i <= H-2 && s[i+1][j] == '#') return false;
    if (1 <= j && s[i][j-1] == '#') return false;
    if (j <= W-2 && s[i][j+1] == '#') return false;
    return true;
}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; ++i) {
        string tmp;
        cin >> tmp;
        s.push_back(tmp);
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (s[i][j] == '.') continue;
            if (is_no(i, j)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

namespace ABC114A
{
    class Program
    {
        static void Main(string[] args)
        {
           
                int x = int.Parse(Console.ReadLine());

                if ((x == 3) || (x == 5) || (x == 7))
                    Console.WriteLine("YES");
                else Console.WriteLine("NO");

                Console.ReadKey();
            
        }
    }
}

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

int main() {
  int N,T,min;
  cin>>N>>T;
  vector<int> c(N);
  vector<int> t(N);
  min=100000;
  for(int i=0;i<N;i++){
    cin>>c.at(i);
    cin>>t.at(i);
    if(T>=t.at(i)){
      if(c.at(i)<min){
        min=c.at(i);
      }
    }     
  }
  if(min==100000)
    cout<<"TLE"<<endl;
  else
    cout<<min<<endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  while(true){
	int N; cin >> N; if(!N) break;
	string str;
	int st = 0, prv = 0, ans = 0;
	REP(i,N){
	  cin >> str;
	  if(str == "lu")
		++st;
	  else if(str == "ld")
		--st;
	  else if(str == "ru")
		st += 2;
	  else
		st -= 2;
	  if(st != prv && (st == 0 || st == 3)){
		prv = st;
		++ans;
	  }
	}
	cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=998244353;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main() {
    ll n;cin>>n;
    vi v(n);
    rep(i,n){
        ll a,b;cin>>a>>b;
        if(a==b)v[i]++;
    }
    bool t=false;
    rep(i,n-2)if(v[i]&&v[i+1]&&v[i+2])t=true;
    YesNo(t);
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>

std::string S, T, U;
int A, B;

int main() {
	std::cin >> S >> T >> A >> B >> U;
	printf("%d %d", A - (U == S), B - (U == T));
	return 0;
}

Measured memory_bytes: 256