akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    void calc()
    {
        Scanner cin = new Scanner();
        while (true)
        {
            int N = cin.nextInt();
            if (N == 0) break;
            int MAX = 21;
            bool[,] jewel = new bool[MAX, MAX];
            for (int i = 0; i < N; i++)
            {
                int xx = cin.nextInt();
                int yy = cin.nextInt();
                jewel[yy, xx] = true;
            }

            int M = cin.nextInt();

            int y = 10; int x = 10;
            Dictionary<char, int> dic = new Dictionary<char, int>();
            dic['N'] = 0;
            dic['E'] = 1;
            dic['S'] = 2;
            dic['W'] = 3;
            int[] vy = { 1, 0, -1, 0 };
            int[] vx = { 0, 1, 0, -1 };
            jewel[y, x] = false;
            for (int i = 0; i < M; i++)
            {
                int k = dic[cin.next()[0]];
                int v = cin.nextInt();
                for (int j = 0; j < v; j++)
                {
                    y += vy[k];
                    x += vx[k];
                    jewel[y, x] = false;
                }
            }
            bool flag = false;
            for (int i = 0; i < MAX; i++)
            {
                for (int j = 0; j < MAX; j++)
                {
                    if (jewel[i, j])
                    {
                        flag = true;
                    }
                }
            }
            if (!flag) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }

    }
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        do
        {
            s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
        } while ((s.Length == 1 && s[0] == "") || s.Length == 0);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

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

using namespace std;

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

    string s;
    cin >> s;

    int ans = 0,count;

    for(int i=1;i<n;i++)
    {
        map <char,int> m;

        for(int j=0;j<i;j++)
            m[s[j]]++;

        count = 0;

        for(int j=i;j<n;j++)
        {
            if(m[s[j]] != 0)
            {
                count++;
                m[s[j]] = 0;
            }
        }

        if(count > ans)
            ans = count;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;
using ll = long long int;


int main(void){
    ll n;
    cin >> n;
    string s[n+1];
    for(ll i = 0; i < n; i++)
        cin >> s[i];
    sort(s, s+n);
    s[n] = "111111";
    ll count = 0;
    ll MAX = 0;
    for(ll i = 0; i < n; i++){
        count++;
        if(s[i]!=s[i+1]){
            MAX = max(MAX, count);
            count=0;
        }
    }
    ll check = 0;
    string ans[n];
    for(ll i = 0; i < n; i++){
        count++;
        if(s[i]!=s[i+1]){
            if(MAX==count){
                ans[check] = s[i];
                check++;
            }
            count=0;
        }
    }
    sort(ans, ans+check);
    for(ll i = 0; i < check; i++)
        cout << ans[i] << endl;
    return 0;
}

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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int MOD = 1e9+7;

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

	ll a, b; cin >> a >> b;
	cout << a*b << '\n';
	
 	return 0;
}

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

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a != c)
	{
		cout << "Yes";
	}
	else if (a == c && a != b)
	{
		cout << "Yes";
	}
	else if (b == c && b != a)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{

    ll numbers[3];

    for (int i = 0; i < 3; i++)
    {
        cin >> numbers[i];
    }

    sort(numbers, numbers + 3);

    if (numbers[0] == 5 && numbers[1] == 5 && numbers[2] == 7)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int n,m;
    cin >> n >> m;
    vector<vi> s(m);
    rep(i,m){
        int k;
        cin >> k;
        rep(j,k){
            int t;
            cin >> t;
            s[i].push_back(t-1);
        }
    }
    vi p(m);
    rep(i,m)cin >> p[i];
    int ans = 0;
    rep(bit, 1<<n){
        bool c = true;
        rep(i,m){
            int cnt = 0;
            rep(j,s[i].size()){
                if(bit & (1 << s[i][j]))cnt++;
            }
            if(cnt%2 != p[i])c = false;
        }
        if(c)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
m, d = [int(x) for x in input().split()]

counter = 0

for im in range(1, m+1):
  for id in range(1, d+1):
    if (id // 10 < 2 or id % 10 < 2):
      continue
    if (im == (id // 10) * (id % 10)):
        counter += 1
        
print(counter)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
int main(){

  string s;
  bool flag = false;

  cin >> s;

  for(int i=0; i<s.size(); i++){
    for(int j=i+1; j<s.size(); j++){
      if(s[i]==s[j]){
       flag = true; 
      }
    }
  }
  if(flag){
    cout << "no" << endl;
  } else {
    cout << "yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define NUM 10

/*
void bsort(int a[], int n){
	int i,j;
	
	for(i = 0; i < n - 1; i++){
		for(j = 0; j < n - 1 - i; j++){
			if(a[j + 1] > a[j]){
				int temp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp;
			}
		}
	}	
}

int main(void){
	int hills[NUM];
	int i;
	
	for(i = 0; i < NUM; i++){
		scanf("%d", &hills[i]);
	}
	
	bsort(hills, NUM);
	
	for(i = 0; i < 3; i++){
		printf("%d\n", hills[i]);
	}
	
	return 0;
}
*/

int main(void){
	int top1=0,top2=0,top3=0;
	int i;
	int input;
	
	for(i = 0; i < NUM; i++){
		scanf("%d", &input);
		
		if(top1 < input) {
			top3 = top2;
			top2 = top1;
			top1 = input;
		}
		else if(top2 < input){
			top3 = top2;
			top2 = input;
		}
		else if(top3 < input){
			top3 = input;
		}
	}
		
	printf("%d\n", top1);
	printf("%d\n", top2);
	printf("%d\n", top3);
	
	return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;

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

    if (K % 2 == 0) {
        cout << (K / 2) * (K / 2) << endl;
    }
    else {
        cout << (K / 2) * (K / 2 + 1) << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Numerics;

class E
{
	static void Main()
	{
		var M = 1000000007;
		var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
		long h = a[0], w = a[1], k = a[2];

		Func<BigInteger, BigInteger, BigInteger> c = (x, y) => x * (x * x - 1) / 6 * y * y;
		Console.WriteLine((c(h, w) + c(w, h)) * ModNcr(h * w - 2, k - 2, M) % M);
	}

	static long ModPow(long b, int i, int mod)
	{
		for (var r = 1L; ; b = b * b % mod)
		{
			if (i % 2 > 0) r = r * b % mod;
			if ((i /= 2) < 1) return r;
		}
	}
	static long ModInv(int x, int p) => ModPow(x, p - 2, p);

	static long ModFactorial(long n, int mod) { for (long x = 1, i = 1; ; x = x * ++i % mod) if (i >= n) return x; }
	static long ModNpr(long n, long r, int mod)
	{
		if (n < r) return 0;
		for (long x = 1, i = n - r; ; x = x * ++i % mod) if (i >= n) return x;
	}
	static long ModNcr(long n, long r, int p) => n < r ? 0 : n - r < r ? ModNcr(n, n - r, p) : ModNpr(n, r, p) * ModInv((int)ModFactorial(r, p), p) % p;
}


Measured memory_bytes: 13524
#include<iostream>

using namespace std;

int main(){

  int n,m;
  cin >> n >> m;
  int low=0;
  int high=100000;
  
  for(int i=0;i<m;i++){
  int l,r;
    cin >> l >> r;
    low=max(low,l);
    high=min(high,r);
  }
  
  high=min(high,n);
  
  if(low>high){
    cout << 0 << endl;
    }
  else{
  cout << high-low+1 <<endl;  
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int W[] = new int[N];
        int totalW = 0;
        int S1 = 0;
        int S2 = 0;
        int minAbs = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            W[i] = sc.nextInt();
            totalW = totalW + W[i];
        }

        for (int i = 0; i < N; i++) {
            S1 = S1 + W[i];
            S2 = totalW - S1;
            if (Math.abs(S1 - S2) < minAbs) {
                minAbs = Math.abs(S1 - S2);
            }
            if (minAbs == 0) {
                break;
            }
        }
        System.out.println(minAbs);
        sc.close();
    }
}

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

//create arrays outside of main()

int a[20];

int main(){

    int n;
    int numInBtw=0;

    cin >> n;

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

    for (int j=0; j<n; j++){

        if(j>0 && j<n-1){
            if(a[j-1]<a[j] && a[j]<a[j+1]){
                numInBtw += 1;
            } else if(a[j-1]>a[j] && a[j]>a[j+1]){
                numInBtw += 1;
            } 
        }
    }

    cout << numInBtw;

    return 0;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

ll MOD = (ll) 1e9 + 9;
const ll MAXN = (ll) 2e5 + 10;
const ll INF = (ll) 1e13;
const ld EPS = (ld) 1e-8;
const ll P = 104107;

ll mul(ll a, ll b){
	return (a * b) % MOD;
}

ll pw(ll b, ll p){
	if(p == 0) return 1;
	if(p & 1) return mul(b, pw(b, p - 1));
	return pw(mul(b, b), p / 2);
}
ll inv(ll x){
	return pw(x, MOD - 2);
}


int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a, b;
	cin >>n >> a >>b;
	ll d= abs(a-b);
	cout << ( d & 1 ? "Borys" : "Alice");
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N,A,B;
    cin >> N>>A>>B;
    vector <int> p1,p2,p3;
    for(int i=0;i<N;i++){
        int num;
        cin>>num;
        if(num<=A)p1.push_back(num);
        else if(num<=B)p2.push_back(num);
        else p3.push_back(num);
    }
    cout << min<int>({(int)p1.size(),(int)p2.size(),(int)p3.size()})<<endl;
}


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

int main(){
	vector<vector<string> > v;
	int n, m;
	cin >> n >> m;
	int a;
	string b;
	v.reserve(n+1);
	for(int i=1; i<=m; i++){
		cin >> a >> b;
		v[a].push_back(b);
	}
	int cor=0, pen = 0;
	for(int i=1; i<=n; i++){
		int tmp = 0;
		for(auto x : v[i]){
			if(x == "WA"){
				tmp++;
			}
			else if(x == "AC"){
				cor++;
				pen+=tmp;
				break;
			}
		}
	}
	cout << cor << " " << pen << endl;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int dif = 0;
  
  for(int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      dif += vec.at(i);
    }
    else if (i % 2 == 1) {
      dif -= vec.at(i);
    }
  }
  
  cout << dif << endl;
  return 0;
}

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

using namespace std;

const long long MOD = 1e9 + 7;

long long power (long long n,long long a) {
    if (n == 1)
        return a;
    if (n == 0)
        return 1;
    long long t = power(n/2,a);
    t = t*t%MOD;
    if (n%2)
        return t*a%MOD;
    else
        return t%MOD;
}

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

    long long n,a,b;
    cin >> n >> a >> b;
    long long ans = (power(n,2) - 1 + MOD)%MOD;
    long long tt = 1,dd = 1,t = 1,d = 1;
    for (long long i = n; i >= n - a + 1; i--) tt = tt*i%MOD;
    for (long long i = n; i >= n - b + 1; i--) dd = dd*i%MOD;
    for (long long i = 1; i <= a; i++) t = t*i%MOD;
    t = power(MOD-2,t);
    for (long long i = 1; i <= b; i++) d = d*i%MOD;
    d = power(MOD-2,d);
    cout << (ans - tt*t%MOD - dd*d%MOD + MOD*MOD)%MOD;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int MOD = 1000000007;

void mul(long long &a, long long b) {
    a *= b; a %= MOD;
}

int main() {
    long long N, M; cin >> N >> M;
    if (abs(N - M) > 1) { 
        cout << 0 << endl;
        return 0;
    }
    long long ans = 1;
    for (int i = 1; i <= N; i++) mul(ans, i);
    for (int i = 1; i <= M; i++) mul(ans, i);
    if (N == M) mul(ans, 2);
    cout << ans << endl;
}

Measured memory_bytes: 256
# v=[]
# num=251
# for i in range(num):
#     if i==0 or i==1:
#         v.append(1)
#     else:
#         v.append(i*v[i-2])
        
# for i in range(0,num,2):
#     print(i,v[i],end=' ')
#     print()

n=int(input())
if n%2!=0:
    print(0)
else:
    ans=n//10
    n=n//10
    i=1
    while(1):
        ans+=n//(5**i)
        if n//(5**i)==0:
            break
        i+=1
        
        
    print(ans)

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

int main(){
  int n;
  string a, b, c;
  cin >> n >> a >> b >> c;

  int ans = 0;
  for(int i = 0;i < n;i++){
    if(a[i] == b[i] && b[i] == c[i]){
      continue;
    }else if(a[i] == b[i] || b[i] == c[i] || a[i] == c[i]){
      ans++;
    }else{
      ans += 2;
    }
  }

  cout << ans << endl;

  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int h,m,H,M,k;
    cin >> h >> m >> H >> M >> k;
    int dist=H*60+M-h*60-m;
    cout << dist-k<<endl;

}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 100005;
vector <pair <int, int> > v[N];
int res[N];
bool vis[N];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        v[x].pb({y, i});
        v[y].pb({x, i});
    }
    queue <pair <int, int> > q;
    q.push({1, 0});
    vis[1] = true;
    int k = 0;
    while (!q.empty()) {
        auto x = q.front();
        q.pop();
        int cnt = 1;
        for (auto y : v[x.fi]) {
            if (!vis[y.fi]) {
                if (cnt == x.se) cnt++;
                res[y.se] = cnt;
                k = max(k, cnt);
                q.push({y.fi, cnt});
                vis[y.fi] = true;
                cnt++;
            }
        }
    }
    printf("%d\n", k);
    for (int i = 1; i < n; i++) {
        printf("%d\n", res[i]);
    }
    return 0;
}


Measured memory_bytes: 10328
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

int rs[100100], cs[100100];
int as[100100];

int R, C;

long long vals[200200];
bool used[200200];
int compo[200200];

int N;

struct Edge{
	int to;
	long long val;
	Edge(){}
	Edge(int a, int b){
		to = a;
		val = b;
	}
};

vector<Edge> G[200200];

void add_edge(int r, int c, int a){
	G[r].push_back(Edge(c + R, a));
	G[c + R].push_back(Edge(r, a));
}

void dfs(int v, int p, int k){
	if(p == -1){
		vals[v] = 0;
		used[v] = true;
	}
	compo[v] = k;
	for(int i = 0; i < G[v].size(); ++i){
		int u = G[v][i].to;
		if(u == p) continue;
		if(!used[u]){
			used[u] = true;
			vals[u] = G[v][i].val - vals[v];
			dfs(u, v, k);
		} else {
			if(vals[u] + vals[v] == G[v][i].val){
				continue;
			} else {
				printf("No\n");
				exit(0);
			}
		}
	}
}

long long min_rs[200200], min_cs[200200];

bool solve(){
	for(int i = 0; i < N; ++i){
		add_edge(rs[i], cs[i], as[i]);
	}
	for(int i = 0; i < R + C; ++i){
		used[i] = false;
	}
	int co = 0;
	for(int i = 0; i < R + C; ++i){
		if(!used[i]){
			dfs(i, -1, co++);
		}
	}
	for(int i = 0; i < co; ++i){
		min_rs[i] = 1e17;
		min_cs[i] = 1e17;
	}
	for(int i = 0; i < R; ++i){
		int c = compo[i];
		min_rs[c] = min(min_rs[c], vals[i]);
	}
	for(int i = 0; i < C; ++i){
		int c = compo[i + R];
		min_cs[c] = min(min_cs[c], vals[i + R]);
	}
	for(int i = 0; i < co; ++i){
		if(min_cs[i] + min_rs[i] < 0) return false;
	}
	return true;
}

void input(){
	scanf("%d%d", &R, &C);
	scanf("%d", &N);
	for(int i = 0; i < N; ++i){
		scanf("%d%d%d", rs + i, cs + i, as + i);
		rs[i]--;
		cs[i]--;
	}
}

int main(){
	input();
	bool flg = solve();
	if(flg) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 23296
#include<bits/stdc++.h>
# define    all(a)              a.begin(), a.end()
#define forn(i, a, b) for (int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define MOD int(1e9+7)
using namespace std;

typedef long long int ll;

bool cmp(int a, int b) {
    return a < b;
}

void printV(vector<int> nums) {
    for (int i: nums) {
        printf("%d ", i);// << " ";
    }
    printf("\n");
}

// void printV(vector<ll> nums) {
//     for (ll i: nums) {
//         printf("%lld ", i);// << " ";
//     }
//     printf("\n");
// }



int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

bool valid(int i, int j, int n, int m) {
    if (i >= 0 && i < n && j >=0 && j < m)
        return true;
    else 
        return false;
}

int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*c, a*d), max(b*c, b*d)) << endl;
    return 0;
}      

Measured memory_bytes: 3680
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static long solve(int N) {
        return IntStream.rangeClosed(1, N).map(i -> (i % 3 != 0 && i % 5 != 0) ? i : 0).asLongStream().sum();
    }
}

Measured memory_bytes: 36604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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 long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int n,k;
    cin >> n >> k;
    cout << n%k << "\n";
}


Measured memory_bytes: 256
S = list(input())
counter = 1

for i in S:
  if counter%2 == 1:
    if i=="R" or i == "U" or i == "D":
      counter = counter + 1
    else:
      print("No")
      break
  else:
    if i=="L" or i == "U" or i == "D":
      counter = counter + 1
    else:
      print("No")
      break

if counter == len(S)+1:
  print("Yes")

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

if N <= 9:
    result = N
elif N <= 99:
    result = 9
elif N <= 999:
    result = N - 90
elif N <= 9999:
    result = 909
elif N <= 99999:
    result = N - 9090
elif N == 100000:
    result = 90909

print(result)

Measured memory_bytes: 3060
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    ls = [0] * 60
    t = 0
    for i in range(60):
        for av in a:
            ls[i] += av >> i & 1
        t += 2 ** i * ls[i] * (n - ls[i])
        t %= mod
    print(t)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 124568
import math

a, b, x = map(int, input().split())
if a * a * b / 2 <= x:
    tan = 2 * (a * a * b - x) / a ** 3
    print(math.degrees(math.atan(tan)))
else:
    tan = a * b * b / 2 / x
    print(math.degrees(math.atan(tan)))


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline
from operator import itemgetter
from bisect import bisect_left

def main():
	n, k = map(int, input().strip().split())
	x = list(map(int, input().strip().split()))
	# zero = bisect_left(x, 0)
	# print("zero:{}".format(zero))
	ans = 10**12
	for l in range(n):
		r = l + k - 1
		if r >= n:
			break
		if x[r] <= 0:
			ans = min(ans, abs(x[l]))
		elif 0 <= x[l]:
			ans = min(ans, abs(x[r]))
		else:
			ans = min(ans, min(2*abs(x[l])+x[r], 2*x[r]+abs(x[l])))
		# print("l:{}, r:{}, ans:{}".format(left_i, right_i, ans))
	print(ans)

if __name__ == '__main__':
	main()


Measured memory_bytes: 62576
#include <bits/stdc++.h>
#pragma GCC optimize("O3")  
#define pb push_back
#define F first
#define S second
using ll = long long;
using namespace std;

const int N=10000000+9;
bool isprime[N];
int lp[N];
ll dp[N]; 


void presolve(){
	 isprime[1]=false;
	 isprime[0]=false;
	 memset(isprime,1,sizeof(isprime));
	 for(auto &x:lp){
	 	x=1;
	 }
         for(int i=2;i<N;++i){            
             if(isprime[i] && (ll)i*i<N){
             	for(int j=i+i;j<N;j+=i){
             	   isprime[j]=false;
             	   lp[j]=i;
             	}
             }
         }
         dp[1]=1;                                        
         for(int i=2;i<N;i++){
         	if(isprime[i]){
         		dp[i]=2;
         		continue;
         	}
         	map<int,int> m;
         	int x=i;
         	while(!isprime[x]){
         		m[lp[x]]++;               
         		x/=lp[x];	
         	}
         	m[x]++;
         	dp[i]=1;
         	for(auto xx:m){
         		dp[i]*=(xx.second+1);
         	}        			
         }
         
}

void solve(){
	     int n;
	     cin>>n;
	     ll ans=0;
	     for(int i=1;i<=n;i++){
	     	 ans+=(i)*(dp[i]);
	     }
	     cout<<ans<<endl;

	
	






	
}


int main(){
	ios_base::sync_with_stdio(false);
   	 cin.tie(NULL);
	presolve();
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}






Measured memory_bytes: 130608
#include <iostream>

using namespace std;

int main()
{
int n,b,a;
cin>>n;
b=n/1000;
b=b*1000;
b=n-b;
a=n/10;
if(b%111==0 || a%111==0){
    cout<<"Yes";
}
else{
    cout<<"No";
}
 return 0;
}


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

int main() {
  string s,t; cin >> s >> t;
  reverse(s.begin(), s.end());
  if(s == t){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}


Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main(){
	
	char a[7];
	int count = 0;

	cin >> a;

	for( int i = 0 ; i < 7 ; i++ ){

		if( a[i] == '1' ){
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct node 
{
	int p;
	int q;
	int r;
	
};
struct node d[1000000];
int a[1000000],b[1000000],c[1000000];
int main() {
	int x,i;
    cin>>x;
    for(i=1;i<=x;i++)
    {
    	cin>>a[i]>>b[i]>>c[i];
    }
    d[1].p=a[1];
    d[1].q=b[1];
    d[1].r=c[1];
    for(i=2;i<=x;i++)
    {
    	d[i].p=max(d[i-1].q,d[i-1].r)+a[i];
    	d[i].q=max(d[i-1].p,d[i-1].r)+b[i];
    	d[i].r=max(d[i-1].q,d[i-1].p)+c[i];
    }
    cout<<max(d[x].p,max(d[x].q,d[x].r));
	return 0;
}

Measured memory_bytes: 5920
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

n = int(input())
S = [int(x) for x in input().split()]
#S = list(map(int,input().split()))
q = int(input())
T = [int(x) for x in input().split()]
#T = list(map(int,input().split()))

def binarySearch(key, Obj_data, n):
    left = 0
    right = n
    while left < right:
        mid = int((left + right) / 2)
        if Obj_data[mid] == key:
            return True
        elif key < Obj_data[mid]:
            right = mid
        else:
            left = mid +1
    return False
ans = 0
for key in T:
    if binarySearch(key,S,n):
        ans+= 1

print("%d"%(ans))



Measured memory_bytes: 18432
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

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

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

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

ll MOD = 1000000007;

ll binPowMod(ll a, ll b) {
    a %= MOD;
    ll res = 1;
    while (b > 0) {
        if (b & 1LL) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1LL;
    }
    return res;
}

ll add(ll a, ll b) {
    return (a + b) % MOD;
}

ll sub(ll a, ll b) {
    return (a - b + MOD) % MOD;
}

ll mul(ll a, ll b) {
    return a * b % MOD;
}

int n;
map<II, int> ma1, ma2;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    ll res = 0;
    FOR(i,1,n) {
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) res = add(res, 1);
        else if (a == 0) {
            ma1[II(1,0)];
            ma2[II(0,1)]++;
        }
        else if (b == 0) {
            ma1[II(1,0)]++;
            ma2[II(0,1)];
        }
        else {
            ll g = gcd(abs(a), abs(b));
            a /= g;
            b /= g;
            if (b < 0) {
                b = -b;
                a = -a;
            }
            if (a < 0) {
                ma2[II(a,b)]++;
                ma1[II(b,-a)];
            }
            else {
                ma1[II(a,b)]++;
                ma2[II(-b,a)];
            }
        }
    }

    ll now = 1;
    FORALL(it, ma1) {
        II p = it->FI;
        int g = it->SE;
        int h = ma2[II(-p.SE, p.FI)];
        now = mul(now, sub(add(binPowMod(2, g), binPowMod(2, h)), 1));
    }
    now = sub(now, 1);
    res = add(res, now);
    cout << res;
    return 0;
}


Measured memory_bytes: 28548
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
ll f(int x, int y, int d) {
    if (d == 0) return x - y;
    return x + y;
}
/* main */
int main(){
    int n;
    cin >> n;
    vector<pll> v(n);
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        v[i] = pll(a, b);
    }

    ll ans = 0;
    ll mi0 = LINF;
    ll mx0 = -LINF;
    ll mi1 = LINF;
    ll mx1 = -LINF;
    for (int i = 0; i < n; i++) {
        mx0 = max(mx0, f(v[i].first, v[i].second, 0));
        mi0 = min(mi0, f(v[i].first, v[i].second, 0));
        mx1 = max(mx1, f(v[i].first, v[i].second, 1));
        mi1 = min(mi1, f(v[i].first, v[i].second, 1));
    }
    ans = max(mx0 - mi0, mx1 - mi1);
    cout << ans << '\n';
}

Measured memory_bytes: 4828
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 4e5 + 10, M = 2e7 + 100, mod = 1e9 + 7;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    for(int i = 0; i <= 1000000; i++){
        if(i * 8 / 100 == a && i * 10 / 100 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1\n";
}


Measured memory_bytes: 256
N = int(input())
X = [[int(a)-1 for a in input().split()] for _ in range(N)]
Y = [0] * N
Z = [-1] * N

L = [a for a in range(N)]
f = 1
d = 0
c = 0
while f:
    d += 1
    f = 0
    NL = []
    for l in L:
        a, aa = Y[l], Z[l]
        if a >= N - 1: continue
        ll = X[l][a]
        b, bb = Y[ll], Z[ll]
        if b >= N - 1: continue
        lll = X[ll][b]
        if lll == l and aa < d and bb < d:
            f = 1
            c += 1
            Y[l] += 1
            Z[l] = d
            if Y[l] < N - 1: NL.append(l)
            Y[ll] += 1
            Z[ll] = d
            if Y[ll] < N - 1: NL.append(ll)
    if c == N*(N-1)//2:
        print(d)
        break
    L = NL
else:
    print(-1)




Measured memory_bytes: 55772
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  //input
  ll n,i;
  
  cin>>n;
  
  vchar s(n);
  vll ps(n, 1);
  vll wht(n, 0);
  vll blk(n, 0);
  
  for(i = 0;i < n;i++){
  
    cin>>s[i];
   
    if(s[i] == '.'){
      
      ps[i] = 0;
      wht[i]++;/*white*/
    
    }else{
    
      blk[i]++;/*black*/
    
    }
  }
  
  
  rep(i, n-1){
    
    wht[i+1] += wht[i];
    blk[i+1] += blk[i];
    
  }
  
  ll ans = wht[n-1];
  
  rep(i, n){
    
   ll now = blk[i] + wht[n-1] - wht[i];
   if( now < ans ){ ans = now; } 
    
  }
  
  cout<<ans<<endl;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll x,y,a,b,c,z,ans=0;
	cin >> x >> y >> a >> b >> c;
	priority_queue<ll> p,q,sum;
	rep(i,a){cin >> z;  p.push(z);}
	rep(i,b){cin >> z;  q.push(z);}
	rep(i,c){cin >> z;  sum.push(z);}
	rep(i,x){
		sum.push(p.top());
		p.pop();
	}
	rep(i,y){
		sum.push(q.top());
		q.pop();
	}
	rep(i,x+y){
		ans+=sum.top();
		sum.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7920
s = input()

idx_of_a = -1
idx_of_z = -1
for i, s_i in enumerate(s):
    if s_i == 'A' and idx_of_a == -1:
        idx_of_a = i
    if s_i == 'Z':
        idx_of_z = i

print(idx_of_z - idx_of_a + 1 if idx_of_a < idx_of_z else 0)


Measured memory_bytes: 3516
#include <stdio.h>

int main() {
	int a, b;
	
	scanf("%d %d", &a, &b);
	
	int c;
	c = b%a;
	
	if(c == 0) {
		printf("%d\n", a+b);
	}
	else {
		printf("%d\n", b-a);
	}

	return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <cmath>

using namespace std;

#define _USE_MATH_DEFINES

const int NMax = 150;
const double eps = 1e-8;
const double eps1 = 1e-4;
const double gravity = 9.8;
const double PI = 3.14159265;

int N, V, X, Y;
int L[NMax], B[NMax], R[NMax], T[NMax];

int main()
{
	cin >>N >>V >>X >>Y;

	for (int i = 1; i <= N; ++i)
		cin >>L[i] >>B[i] >>R[i] >>T[i];

	for (double alpha = -eps1; alpha <= PI/2; alpha += eps1)
	{
		double V_0x = V * cos(alpha);
		double V_0y = V * sin(alpha);
		double Time = X / V_0x;
		double LandY = V_0y * Time - 0.5*gravity*(Time*Time);

		if (Y - LandY <= eps)
		{
            bool intersect = 0;

            for (int i = 1; i <= N; ++i)
                if (X - L[i] >= eps && X - R[i] <= eps &&
					LandY - B[i] >= eps && LandY - T[i] <= eps)
					intersect = 1;

            for (int i = 1; i <= N; ++i)
				for (int j = L[i]; j <= R[i]; ++j)
				{
					double TimeToJ = j / V_0x;
					if (Time - TimeToJ >= eps)
					{
                        double newY = V_0y * TimeToJ - 0.5*gravity*(TimeToJ*TimeToJ);
                        if (newY - B[i] - eps >= 0 &&
							newY - T[i] - eps <= 0)
								intersect = 1;
					}

				}

			if (!intersect)
			{
                cout <<"Yes" <<'\n';
                return 0;
			}
		}
	}

	cout <<"No" <<'\n';
    return 0;
}



Measured memory_bytes: 3484
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
 os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif


#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll h,w;
	cin>>h>>w;
	ll i,j,k;
	ll ans = h*w; 
	for(k=0;k<2;k++){
		swap(h,w);
		for(i=1;i<=h-1;i++){
			ll s1 = w*i;
			ll a = h-i;ll b = w;
			ll c,d;
			c = (a/2)*b;d = a*b - c;
			if(c!=0&&d!=0){
				ans = min(ans,max(abs(s1-c),max(abs(s1-d),abs(c-d))));
			}

			c = (a)*(b/2);d = a*b - c;
			if(c!=0&&d!=0){
				ans = min(ans,max(abs(s1-c),max(abs(s1-d),abs(c-d))));
			}
		}
	}	
	cout<<ans;
}


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

int main() {
  char com[20];
  priority_queue<int> PQ;

  while(1) {
    cin >> com;
    if (com[0] == 'i') {
      int key;
      cin >> key;
      PQ.push(key);
    } else if (com[1] == 'x') {
      cout << PQ.top() << endl;
      PQ.pop();
    } else if (com[0] == 'e') {
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 6836
n = int(input())
score = [0]*n
for i in range(n*(n-1)//2):
    x, y, a, b = map(int, input().split())
    if a > b:
        score[x-1] += 3
    elif a < b:
        score[y-1] += 3
    else:
        score[x-1] += 1
        score[y-1] += 1

s = [1]*n
for i in range(n):
    for j in range(n):
        if score[i] < score[j]:
            s[i] += 1
    print(s[i])


Measured memory_bytes: 5620
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

const lint mod = 1e9 + 7;

// 累積和
struct cumulative_sum {
    using lint = long long int;
    int sz;
    // data[i]:元の数列
    vector<lint> data;
    // cum[i]:[0,i)の和
    vector<lint> sum;
    // 要素数を指定して初期化
    cumulative_sum(const int _sz) : sz(_sz) {
        data.assign(sz, 0);
        sum.assign(sz + 1, 0);
    }
    lint& operator[](const int k) {
        return data[k];
    }
    // dataに基づいてsumを構築
    void build() {
        for (int i = 0; i < sz; i++) sum[i + 1] = sum[i] + data[i];
    }
    // [a,b)の和を求める
    lint query(const int a, const int b) {
        return sum[b] - sum[a];
    }
};

int main() {
    int n;
    cin >> n;
    cumulative_sum a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    a.build();
    lint ans = 0;
    for (int i = 0; i < n; i++) {
        lint x = a[i];
        lint y = a.query(i + 1, n) % mod;
        lint add = x * y % mod;
        ans = (ans + add) % mod;
    }
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  int h[n];
  int flag = 1;
  for (int i = 0; i < n; i++){
  	cin >> h[i];
  }
  h[0] -= 1;
  for (int j = 1; j < n-1; j++){
  	if (h[j-1] < h[j]){
    	h[j] -= 1;
    }
    if (h[j] > h[j+1]){
    	flag = 0;
      	break;
    }else{
    	continue;
    }
  }
  if (flag == 1){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 640
Uses math;
Var
n,Mx,Mn,i:longint;
a:array[0..105] of longint;
Begin
Readln(n);
Mn:=maxlongint;
For i:=1 to n do 
Begin
Read(a[i]);
Mn:=Min(Mn,a[i]);
Mx:=Max(Mx,a[i]);
End;
Write(Mx-Mn);
End.


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int n = str.length();
		int price = 700;

		for(int i = 0; i < n; i++) {
			if(str.charAt(i) == 'o') {
				price += 100;
			}else {
				price += 0;
			}
		}
	System.out.println(price);

	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,mx=0,mn=100010;
  cin>>n>>m;
  int l[m],r[m];
  for(int i=0;i<m;i++)
  {
    cin>>l[i]>>r[i];
    if(l[i]>mx)
      mx=l[i];
    if(r[i]<mn)
      mn=r[i];
  }
  if(mn<mx)
    cout<<"0";
  else
    cout<<mn-mx+1;
  return 0;
}

Measured memory_bytes: 1024
#!/bin/ruby

n = gets.to_i
if n == 1 then
	puts 1
	exit
end
bk = n
c = n % 2
if c == 1 then
	n = n - 1
end
x = ( 1 + n ) * ( n / 2 )
if c == 1 then
	x = x + bk
end
puts x


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

using namespace std;

int N;

vector<int> vec;

void rec(int N){
  if(N==0) vec.push_back(0);
  else{
  int quo = N/(-2);
  int rem = N%(-2);
  if(rem == -1 && N < 0){
    quo += 1;
    rem += 2;
  }
  // printf("(quo, rem) = (%d, %d)\n",quo,rem);

  vec.push_back(rem);

  if(quo == 1)
    vec.push_back(quo);
  else
    rec(quo);
  }
}

void solve(){
  rec(N);

  reverse(vec.begin(),vec.end());
  
  for(auto itr = vec.begin(); itr!=vec.end(); itr++)  cout << *itr;

  cout << endl;
}

int main(){
  cin >> N;

  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
//cut begin
struct UnionFind{
private:
    std::vector<int> par;
    std::vector<int> rank;
public:
    UnionFind(int size){
        par=std::vector<int>(size);
        rank=std::vector<int>(size);
        for(int i=0;i<size;++i){
            par[i]=i;
            rank[i]=1;
        }
    }

    int root(int x){
        if(par[x]==x)return x;
        else {
            par[x]=root(par[x]);
            return par[x];
        }
    }

    bool same(int x,int y){//0-indexed
        return root(x)==root(y);
    }

    void unite(int x,int y){//0-indexed
        x=root(x);
        y=root(y);
        if(x==y)return;

        if(rank[x]<rank[y]){
            par[x]=y;
        }
        else{
            par[y]=x;
            if(rank[x]==rank[y])++rank[x];
        }
    }
};
//cut end
void solve(){
    int n,q;
    std::cin>>n>>q;
    UnionFind uf(n);
    int p,a,b;
    for(int i=0;i<q;++i){
        std::cin>>p>>a>>b;
        if(p==0)uf.unite(a,b);
        else{
            if(uf.same(a,b))std::cout<<"1"<<std::endl;
            else std::cout<<"0"<<std::endl;
        }
    }
}

int main(){
    solve();
    return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	int cnt = 0;
	for (int v = 1; v <= n;) {
		if (to_string(v).size() % 2 == 0) {
			v *= 10;
			continue;
		}

		cnt++;
		v++;
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
// C - Pyramid
#include <bits/stdc++.h>
using namespace std;
using TP = tuple<int,int,int>;//<x,y,h>
using VT = vector<TP>;//[i]<x,y,h>
#define rp(i,n) for(int i=0;i<(n);i++)
#define eb(x,y,h) emplace_back((x),(y),(h))
#define manhattan(x1,y1,x2,y2) abs((x1)-(x2))+abs((y1)-(y2))
#define XMAX 100
#define YMAX 100

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

	VT A;//h!=0
	VT B;//h==0
	VT C;//center candidate

	rp(i, N){
		int x,y,h; cin>>x>>y>>h;
		if(h!=0) A.eb(x,y,h);
		else B.eb(x,y,h);
	}

	rp(y0, YMAX+1){
		rp(x0, XMAX+1){
			bool exist = true;
			int x,y,h;
			tie(x,y,h) = A[0];
			int h0 = h + manhattan(x0,y0, x,y);//h0: hight of center candidate

			for(int i=1; i<A.size(); ++i){
				tie(x,y,h) = A[i];
				if(h0 != h + manhattan(x0,y0, x,y)){
					exist = false;
					break;
				}
			}

			if(exist) C.eb(x0,y0,h0);//set center candidate
		}
	}

	for(auto c:C){// hight zero check & output
		int x0,y0,h0; tie(x0,y0,h0) = c;

		bool exist = true;
		for(auto b:B){
			int x,y,h; tie(x,y,h) = b;
			int manhattan = abs(y0 - y) + abs(x0 - x);
			int hi = max(0, h0 - manhattan);
			if(hi != h){
				exist = false;
				break;
			}
		}

		if(exist) cout<<x0<<" "<<y0<<" "<<h0<<"\n";
	}

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
    /*ll t;
    cin>>t;
    while(t--)			
    {
       
    }*/
    string s,y;
    cin>>s>>y;
    if(y.length()<=s.length())
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]!=y[i])
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(y.length()<=s.length()+1)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}


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

int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<int> dp(n,0);
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        int v1 = dp[i-1] + abs(a[i]-a[i-1]);
        int v2 = dp[i-2] + abs(a[i]-a[i-2]);
        dp[i] = min(v1,v2);
    }
    cout<<dp[n-1];
	return 0;
}

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

#define ll long long

using namespace std;
// ll dp[105][100005];
bool fn(const pair<int,int>&x, const pair<int,int>& y)
{
	if (x.second != y.second)
		return x.second < y.second;

	return x.first < y.first;
}


int main()
{
    ll n,w;
    cin>>n>>w;
    vector<pair <ll,ll>> wv;
    ll a,b;
    ll max_weight=0;
    for(int i=0;i<n;i++)
        {
            cin>>a>>b;
            //cout<<a<<b;
            wv.push_back(make_pair(a,b));
            max_weight+=b;
        }
    
    
ll dp[n+1][max_weight+1];
     for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=max_weight;j++)
            dp[i][j]=INT_MAX;
    }

    
    dp[0][0]=0;

    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=max_weight;j++)
        {
            if(j>=wv[i-1].second)
                dp[i][j]=min(dp[i-1][j-wv[i-1].second]+wv[i-1].first,dp[i-1][j]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }

    ll sum=0;
    for(int i=0;i<=max_weight;i++)
    {
        if(dp[n][i]<=w){
            sum=i;
            
        }
    }

    cout<<sum<<endl;

    return 0;

}

Measured memory_bytes: 79104