akhauriyash/Code-Regression huggingface dataset:
use std::io;
use std::cmp::Ordering;
use std::str::FromStr;

fn get_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line
}

fn get_vector() -> Vec<i32> {
    let line = get_line();
    let vec : Vec<i32> = line.split_whitespace().map(|x| i32::from_str(x).unwrap()).collect();
    return vec;
}

fn main() {
    for i in 1.. {
        let mut x = String::new();
        io::stdin().read_line(&mut x).unwrap();
        let x: i32 = x.trim().parse().unwrap();
        if x == 0 {
            break;
        }
        println!("Case {}: {}", i, x);
    }
}



Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int a,b; cin >> a >> b;
  int res = max(a,b);
  if(res==a) a--;
  else b--;
  res += max(a,b);
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst;
	string label;
	Edge(){}
	Edge(int s,int d,string l):src(s),dst(d),label(l){}
	bool operator<(const Edge& e)const{return label<e.label;}
	bool operator>(const Edge& e)const{return label>e.label;}
};
typedef vector<vector<Edge>> Graph;

int main()
{
	for(int n,m,s,t;cin>>n>>m>>s>>t,n|m|s|t;){
		Graph g(n);
		rep(_,m){
			int x,y; string l; cin>>x>>y>>l;
			g[y].emplace_back(y,x,l);
		}
		
		vs res(n,"~");
		res[t]="";
		rep(_,6*n) rep(i,n) if(res[i]!="~") for(Edge e:g[i])
			res[e.dst]=min(res[e.dst],e.label+res[e.src]);
		
		if(res[s]=="~" || res[s].size()>=6*n)
			cout<<"NO"<<endl;
		else
			cout<<res[s]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1708
//IOI 2021
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

int n, m, a, b, t[MAXN];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
		cin >> a >> b, t[a]++, t[b]++;
	for (int i = 1; i <= n; i++)
		if (t[i] % 2)
			return cout << "NO" << endl, 0;
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
	string S;
	cin >> S;
	int ans = 700;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'o') {
			ans += 100;
		}
	}
	cout <<  ans << endl;
}


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<functional>

#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define rep(i, n) for(int i=0; i < (int)(n); i++)
#define rrep(i, n) for(int i=(int)(n); i>=0;i--)
#define rep1e(i, n) for(int i=1; i <= (int)(n); i++)
#define rep1ne(i, n) for(int i=1; i < (int)(n); i++)

using namespace std;

int main() {

  int A, B;
  cin >> A >> B;

  veci vec;

  vec.push_back(A + B);
  vec.push_back(A - B);
  vec.push_back(A * B);

  int ans = *max_element(vec.begin(), vec.end());
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
s = str(input())
t = str(input())

lst_s = []
lst_t = []
for i in range(len(s)):
    if lst_s.count(s[i])==0:
        lst_s.append(s[i])
    if lst_t.count(t[i])==0:
        lst_t.append(t[i])
    if lst_s.index(s[i]) != lst_t.index(t[i]):
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3632
package main

import (
	"fmt"
)

func main() {
	var n, x int
	fmt.Scanf("%d %d", &n, &x)

	ls := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&ls[i])
	}

	d := 0
	cnt := 1
	for _, l := range ls {
		d += l
		if d <= x {
			cnt++
		}
	}

	fmt.Print(cnt)

}


Measured memory_bytes: 512
import java.util.*;
import java.lang.*;
import java.io.*;
 
public class Main {
    public static void main(String args[]) {
		 Scanner sc = new Scanner(System.in);
		 String a = sc.nextLine();
		 System.out.println(myFunction(a));
	}
	
	public static String myFunction(String s) {
		if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) return "Yes";
		return "No";
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        while (true) {
            int x = scan.nextInt();
            int y = scan.nextInt();
            int s = scan.nextInt();
            if (x == 0 && y == 0 && s == 0) {
                break;
            }
            int[] data = {x + 100, y + 100, s};
            System.out.println(doMoney(data));
        }
    }

    private static int doMoney(int[] data) {
        int max = -1;
        for (int i = 1; i < data[2]; i++) {
            for (int j = 1; j < data[2]; j++) {
                if(i*data[0]/100+j*data[0]/100==data[2]){
                    int temp=i*data[1]/100+j*data[1]/100;
                    if (temp>max){
                        max=temp;
                    }
                }
            }
        }
        return max;
    }
}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int t; cin >> t;
    while(t--){
        int n; cin >> n;
        vector<pll> P, M;

        ll ans = 0;
        rep(i,n){
            ll k,l,r;
            cin >> k >> l >> r;
            if(l-r > 0) P.emplace_back(k, l-r);
            else if(k < n) M.emplace_back(n-k, r-l);
            ans += min(l, r);
        }
        sort(all(P));
        sort(all(M));

        auto add = [&](vector<pll> &v){
            ll res = 0;
            priority_queue<pll, vector<pll>, greater<pll>> Q;
            int vidx = 0;
            int x = 0;
            rep(i,n){
                while(vidx < v.size() && v[vidx].fi-1 <= i){
                    Q.emplace(v[vidx].se, v[vidx].fi);
                    vidx++;
                }
                while(Q.size() > i+1) Q.pop();
            }
            while(!Q.empty()) res += Q.top().fi, Q.pop();
            return res;
        };

        ans += add(P);
        ans += add(M);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 10068
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] x = new int[n];
        for(int i = 0; i < n; i++){
            x[i] = Integer.parseInt(sc.next());
        }
        
        int min = Integer.MAX_VALUE;
        for(int i = 1; i <= 100; i++){
            int sum = 0;
            for(int j = 0; j < n; j++){
                sum += (x[j] -i)*(x[j] -i);
            }
            if(sum < min) min = sum;
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
char map[8][9];
void solve(int x1, int x2) {
	int i, x;
	if (map[x1][x2] == '1') {
		map[x1][x2] = '0';
		for(i = 1; i < 4; i ++) {
			x = x1 + i;
			if (x < 8) solve(x, x2);
			x = x1 - i;
			if (x > -1) solve(x, x2);
			x = x2 + i;
			if (x < 8) solve(x1, x);
			x = x2 - i;
			if (x > -1) solve(x1, x);
		}
	}
}
int main() {
	int s, n, x[2];
	int i;
	scanf("%d", &n);
	for (s = 0; s < n; s ++) {
		printf("Data %d:\n", s + 1);
		for (i = 0; i < 8; i ++) scanf(" %s", map[i]);
		scanf("%d", &x[0]); scanf("%d", &x[1]);
		solve(x[1] - 1, x[0] - 1);
		for (i = 0; i < 8; i ++) printf("%s\n", map[i]);
	}
	return 0;
}

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

int main(){
	while(1){
		int a,b;
		cin >> a >> b;
		if(b==0) break;
		
		int a100, a500, a1000;
		b -= a;
		a1000 = b/1000;
		b %= 1000;
		a500 = b/500;
		b %= 500;
		a100 = b/100;
		cout << a100 << " " << a500 << " " << a1000 << endl;
	}
	return 0;
}



Measured memory_bytes: 3032
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#define M_PI 3.14159265358979323846
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
ll lcm(int a, int b) {
	return (ll)a * b / gcd(a, b);
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<int>vis(n+1,0);
	vector<int>res(n + 1);
	vector<vector<int>>vec(n+1);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	queue<int>q;
	q.push(1);
	while (!q.empty()) {
		int p = q.front();
		q.pop();
		for (int i : vec[p]) {
			if (!vis[i]) {
				q.push(i);
				vis[i] = 1;
				res[i] = p;
			}
		}
	}
	for (int i = 2; i <= n; i++) {
		if (!vis[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for (int i = 2; i <= n; i++) cout << res[i] << endl;
	return 0;
}

Measured memory_bytes: 10204
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int a,b,c; cin>>a>>b>>c;
    for(int i=1;i<=b;i++){
        if(a*i%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}


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

using namespace std;

int main() {
	int h, n, a;
	cin >> h >> n;

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

	cout << (h <= 0 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x[6],i;
  for(i=1;i<=5;i++)
  {
    cin>>x[i];
  }
  for(i=1;i<=5;i++)
  {
    if(x[i]==0)
    {
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N  = 5100;
int n,tot; ll a[N][N];
int vis[N * 20],pri[N];
void init()
{
	vis[1] = 1;
	for(int i = 2;i <= 10000;i ++)
	{
		if(!vis[i]) pri[++ tot] = i;
		for(int j = 1;j <= tot && pri[j] * i <= 10000;j ++)
		{
			vis[i * pri[j]] = 1;
			if(i % pri[j] == 0) break;
		}
	}
}
ll gcd(ll x,ll y){return y ? gcd(y,x % y) : x;}
ll lcm(ll x,ll y){if(!x || !y) return x | y; return x / gcd(x,y) * y;}
int main()
{
	n = read(); init();
	if(n == 2) {puts("4 7\n23 10"); return 0;}
	for(int i = 1;i <= n;i ++) 
		for(int j = (i + 1 & 1) + 1;j <= n;j += 2) 
			a[i][j] = pri[(i + j) / 2] * pri[n + (i - j) / 2 + (n + 1) / 2];
	for(int i = 1;i <= n;i ++) 
		for(int j = (i & 1) + 1;j <= n;j += 2) 
			a[i][j] = lcm(lcm(a[i - 1][j],a[i][j - 1]),lcm(a[i][j + 1],a[i + 1][j])) + 1; 
	
	for(int i = 1;i <= n;i ++,cout << "\n") for(int j = 1;j <= n;j ++) cout << a[i][j] << " ";
	return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

int judge_colour(int i) {
  int result;
  if (1 <= i && i <= 399) {
    result = 0;
  } else if (400 <= i && i <= 799) {
    result = 1;
  } else if (800 <= i && i <= 1199) {
    result = 2;
  } else if (1200 <= i && i <= 1599) {
    result = 3;
  } else if (1600 <= i && i <= 1999) {
    result = 4;
  } else if (2000 <= i && i <= 2399) {
    result = 5;
  } else if (2400 <= i && i <= 2799) {
    result = 6;
  } else if (2800 <= i && i <= 3199) {
    result = 7;
  } else {
    result = 8;
  }

  return result;
}

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

  int N;
  cin >> N;
  int a;
  set<int> variations;
  int count_free = 0;
  REP(i, N) {
    cin >> a;
    int c = judge_colour(a);
    if (c == 8)
      ++count_free;
    variations.insert(c);
  }

  if (count_free > 0) {
    int min_size = max((int)(variations.size() - 1), 1);
    int max_size = variations.size() - 1 + count_free;

    cout << min_size << " " << max_size << endl;
  } else {
    cout << variations.size() << " " << variations.size() << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,K; cin>>N>>K;
    vector<int> P(N);
    rep(n,0,N) cin>>P.at(n);

    int idx=0,maxSum,sum=0;
    rep(n,0,K) sum+=P.at(n);
    maxSum=sum;

    rep(n,K,N){
        sum+=P.at(n)-P.at(n-K);
        if(maxSum<sum){maxSum=sum; idx=n-K+1;}
    }

    double ans=0;
    rep(i,idx,idx+K) ans+=P.at(i)*(P.at(i)+1)/2./P.at(i);

    cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 4032
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, W, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
S = input().strip()

q = deque(S)
c = 0
while len(q):
     l = q[0]
     r = q[len(q)-1]

     if l == r:
          if len(q) != 1:
               q.pop()
          q.popleft()
     elif l == 'x':
          q.append('x')
          c += 1
     elif r == 'x':
          q.appendleft('x')
          c += 1
     else:
          print(-1)
          exit()

print(c)


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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	vector<set<int>> p(26);
	for (int i = 0; i < n; i++)
		p[s[i] - 'a'].insert(i);

	int Q;
	cin >> Q;
	while (Q--) {
		int type;
		cin >> type;

		if (type == 1) {
			int i;
			char c;
			cin >> i >> c;
			i--;

			p[s[i] - 'a'].erase(i);
			p[c - 'a'].insert(i);
			s[i] = c;
		} else {
			int l, r;
			cin >> l >> r;
			--l;

			int found = 0;
			for (int j = 0; j < 26; j++) {
				auto x = p[j].lower_bound(l);
				if (x != p[j].end() && *x < r)
					found++;
			}
			cout << found << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 27200
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    ll n = s.size();
    vector<ll> v(n+1,0);
    vector<ll> pos;
    if(s[0]=='<')
    {
        v[0]=0;
        pos.pb(0);
    }
    if(s[n-1]=='>')
    {
        v[n]=0;
        pos.pb(n);
    }
//    ContainerError(pos);
    for(ll i=1;i<(n-1);i++)
    {
        if(s[i]=='>' && s[i+1]=='<')
        {
            /// i and i+1   i+1 and i+2
            v[i+1]=0;
            pos.pb(i+1);
        }
    }
    for(auto &in:pos)
    {
        /// in+1 is responsible by in and in+1
        ll j=in-1;
        while(s[j]=='>' && j>=0)
        {
            v[j] = max(v[j],v[j+1]+1);
            j--;
        }
        j = in;
        while(s[j]=='<' && j<n)
        {
            v[j+1] = max(v[j+1],v[j]+1);
            j++;
        }
    }
//    ContainerError(v);
    ll ans=0;
    for(auto &x:v)
    {
        ans += x;
    }
    cout<<ans;
    return 0;
}































Measured memory_bytes: 6172
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll com(ll n) { return n * (n - 1) / 2; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> mp;
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll sum = 0;
    for(const auto &p : mp) {
        sum += com(p.second);
    }
    for(ll i = 0; i < n; i++) {
        ll ans = sum - com(mp[a[i]]);
        ans += com(mp[a[i]] - 1);
        cout << ans << endl;
    }
}

Measured memory_bytes: 11136
import java.util.Scanner;

public class Main { 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans =N;
    for (int i =0; i<=N; i++) {
      int cc =0;
      int t =i;
      while (t >0) {
        cc += t % 6;
        t /=6;
      }
      t = N -i;
      while (t >0) {
        cc += t % 9;
        t /=9;
      }
      if (ans > cc) ans = cc;
    }
    System.out.println(ans);
  }
}

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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

double t, x;
int main() {
    cin >> t >> x;
    cout << t/x << endl;
    return 0;
}


Measured memory_bytes: 3808
#include <stdio.h>
#include <string.h>

int main(void)
{
 char a[256],b[256];

 scanf("%s\n",a);
 scanf("%s\n",b);

 strncat(a,a,strlen(b));

 if(strstr(a,b)){
    printf("Yes\n");
 }else{
    printf("No\n");
 }
 return 0;
}

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

int main(){
    int A,B;
    int inf = pow(10,9);
    cin >> A >> B;
    bool flag = true;

    for(int K=0; K<=inf; K++){
        if(abs(A-K)==abs(B-K)){
            cout << K << endl;
            flag = false;
            break;
        }
    }
    if(flag) cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
l=[]
while(True):
    ll=[]
    H,W=(int(a) for a in input().split())
    if H==0 and W==0:
        break
    ll.append(H)
    ll.append(W)
    l.append(ll)
for i in range(len(l)):
    lll=[]
    h=l[i][0]
    w=l[i][1]
    for j in range(w):
        lll.append("#")
    wo="".join(lll)
    for k in range(h):
        print(wo)
    print("")


Measured memory_bytes: 5628
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

int main()
{
  int N, M;
  cin >> N >> M;
  DisjointSet ds(N);
  int p[N];

  REP(i,0,N){
    int pp;
    cin >> pp;
    pp--;
    p[i]=pp;
  }
  REP(i,0,M){
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    ds.unite(x, y);
  }
  
  int s = 0;
  REP(i,0,N){

    if (ds.same(i, p[i]))
    {
      s++;
    }
  }

  cout << s << endl;
  

  return 0;
}

Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()
	if N > 81 {
		no()
		return
	}
	for i := 1; i <= 9; i++ {
		if N%i == 0 {
			if N/i >= 1 && N/i <= 9 {
				yes()
				return
			}
		}
	}
	no()
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

A, B, C, K = mapint_inp()
# 1, 0, -1

ans = 0
if A >= K:
    print(K)
else:
    K -= A
    if B >= K:
        print(A)
    else:
        K -= B
        print(A+(-1)*K)

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

int main() {
    int n;
    cin >>n;
    vector<pair<int,int>>a(n);
    for(int i=0; i<n; ++i){
        cin >> a[i].first;
        a[i].second=i+1;
    }
    sort(a.begin(),a.end());
    for(int i=0; i<n; ++i){
        cout << a[i].second << endl;
    }
}

Measured memory_bytes: 1664
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    X, Y, Z = map(lambda x: int(x)-1, input().split())
    uf.union(X, Y)
print(len(uf.roots()))

Measured memory_bytes: 13844
#include <bits/stdc++.h>
#define reps(i,j,k) for(int i=j;i<k;++i)
#define rep(i,j) reps(i,0,j)
#define fr first
#define sc second
#define fs fr
#define pb push_back

using namespace std;
typedef vector<int> vi;
typedef long long ll;

vi lists[1200];

bool check(int res, int idx){
	rep(i,lists[idx].size()){
		if(lists[idx][i] == res){
			return true;
		}
	}
	return false;
}
	

int main(){
	int N;
	while(cin >> N,N){
		rep(i,1200){
			lists[i].clear();
		}
		rep(i,N){
			int A;
			cin >> A;
			rep(j,A){
				int t;
				cin >> t;
				--t;
				lists[i].pb(t);
			}
			sort(lists[i].begin(),lists[i].end());
		}

		int P;
		cin >> P;
		vi s(P);
		rep(i,P){
			cin >> s[i];
			--s[i];
		}
		sort(s.begin(),s.end());
		
		int ans = -1;
		bool is_ans = false;
		rep(i,N){
			bool flg = true;
			rep(j,P){
				if(!check(s[j],i)){
					flg = false;
					break;
				}
			}
			if(flg && ans == -1){
				ans = i;
			}
			else if(flg && ans != -1){
				is_ans = true;
				cout << -1 << endl;
				break;
			}
		}
		if(ans == -1){
			ans = -2;
		}
		if(!is_ans){
			cout << ans+1 << endl;
		}
		

	}
	return 0;
}

Measured memory_bytes: 3248
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

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

int main()
{
	int n, m, p, x[111];
	while (cin >> n >> m >> p, n) {
		--m;
		int sum = 0;
		rep (i, n) cin >> x[i];
		rep (i, n) sum += x[i];
		cout << (x[m] ? (int)floor(sum * (100 - p) / x[m]) : 0) << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;

namespace chrono = std::chrono;
using namespace std::literals;

[[gnu::constructor]]
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

void place_horiz(std::vector<std::string>& ans, int i, int j) {
    ans[i][j] = '<';
    ans[i][j + 1] = '>';
}

void place_vert(std::vector<std::string>& ans, int i, int j) {
    ans[i][j] = '^';
    ans[i + 1][j] = 'v';
}

int main() {
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    std::vector<std::string> ans(n);
    for (auto& x: ans) {
        x.assign(m, '.');
    }

    int nn = n / 2 * 2;
    int mm = m / 2 * 2;

    if (n % 2 == 1) {
        for (int j = 0; j < mm; j += 2) {
            if (a == 0) break;
            a -= 1;
            place_horiz(ans, n - 1, j);
        }
    }
    if (m % 2 == 1) {
        for (int i = 0; i < nn; i += 2) {
            if (b == 0) break;
            b -= 1;
            place_vert(ans, i, m - 1);
        }
    }

    int aa = a, bb = b;
    bool spiral = false;
    if (n % 2 == 1 && m % 2 == 1 && a % 2 == 1 && b % 2 == 1 && n > 1 && m > 1) {
        place_horiz(ans, n - 3, m - 3);
        place_vert(ans, n - 3, m - 1);
        place_vert(ans, n - 2, m - 3);
        place_horiz(ans, n - 1, m - 2);
        a -= 1;
        b -= 1;
        spiral = true;
    }


    int s = 2 * (aa + bb);
    if (s > nn * mm || (!spiral && s == nn * mm && a % 2 == 1 && b % 2 == 1)) {
        cout << "NO" << endl;
        exit(0);
    }
    for (int i = 0; i < nn; i += 2) {
        for (int j = 0; j < mm; j += 2) {
            if (spiral && i + 2 == nn && j + 2 == mm) break;
            if (a > 0) {
                place_horiz(ans, i, j);
                a -= 1;
                if (a > 0) {
                    place_horiz(ans, i + 1, j);
                    a -= 1;
                }
            } else if (b > 0) {
                place_vert(ans, i, j);
                b -= 1;
                if (b > 0) {
                    place_vert(ans, i, j + 1);
                    b -= 1;
                }
            }
        }
    }
    cout << "YES" << endl;
    for (const auto& s: ans) {
        cout << s << endl;
    }
}


Measured memory_bytes: 2304
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

double get_area(const vector<int>& vs) {
	int ang = 0;
	double res = 0;
	for (auto v : vs) {
		ang += v;
		res += sin(M_PI * v / 180.);
	}
	res += sin(M_PI * (360 - ang) / 180.);
	return res;
}

int main() {
	int m;
	while (cin >> m, m) {
		vector<int> vs1(m - 1);
		for (auto& v : vs1) cin >> v;
		int n;
		cin >> n;
		vector<int> vs2(n - 1);
		for (auto& v : vs2) cin >> v;

		double a = get_area(vs1);
		double b = get_area(vs2);
		if (eq(a, b)) cout << 0 << endl;
		else if (a > b) cout << 1 << endl;
		else cout << 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,k,ans;
    cin >> a >> b >> c >> k;
    if(k <= a) cout << k << endl;
    else{
        ans = a;
        k -= a;
        if(k <= b) cout << ans << endl;
        else{
            k -= b;
            ans -= k;
            cout << ans << endl;
        }
    }
}


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

int main()
{
    string s;
    cin >> s;
    if (((int)s.find('a') != -1) && ((int)s.find('b') != -1) && ((int)s.find('c') != -1))
        cout << "Yes" << endl;
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())

def solve(h, w):
    # 三
    h_3 = round(h/3)
    top = h_3*w
    middle = ((h - h_3) // 2)*w
    bottom = (h - (h - h_3) // 2 - h_3)*w
    ans = max(top,middle,bottom) - min(top,middle,bottom)

    # 上部と別向き
    middle = (h-h_3)*(w//2)
    bottom = (h-h_3)*(w-w//2)

    return min(ans, max(top,middle,bottom) - min(top,middle,bottom))

if h%3 == 0 or w%3 == 0:
    print(0)
else:
    print(min(solve(h,w), solve(w,h)))


Measured memory_bytes: 3188
s = list(str(input()))
l = int(len(s))
a = list(range(l))
for i in range(l):
    a[i] = 1
a = [int(j) for j in a]
for i in range(l-2):
    if s[i] == s[i+1] == 'R':
        a[i+2] += a[i]
        a[i] = 0
for i in range(l)[::-1]:
    if s[i] == s[i-1] == 'L':
        a[i-2] += a[i]
        a[i] = 0
print(' '.join(map(str,a)))

Measured memory_bytes: 11132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int X,Y; cin >>X>>Y;
    if(Y%2 == 1) {AA("No");}
    else if(X*2<=Y && X*4>=Y) {AA("Yes");}
    else AA("No");
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	
		int tmp[31000];

	void solve(){
		
		
		FOR(i,1,101){
			FOR(i1,1,101){
				FOR(i2,1,101){
					int tmp1 = i*i+i1*i1+i2*i2+(i*i1)+(i*i2)+(i1*i2);
					if(tmp1>=31000){continue;}
					else{
						tmp[tmp1]++;
					}
				}
			}
		}
		ini(n);
		FOR(i,1,n+1){
			out(tmp[i]);
		}


		
		


			
			
			


				
		


		
		
		
		

		


		
		
	}



	



















int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 3836
count = 0
N = 0
def make753num(num):
    global count
    global N
    if num > N:
        return
    if num >= 357 and min(str(num).count('3'), str(num).count('5'), str(num).count('7')) >= 1:
        count += 1
    make753num(num * 10 + 3)
    make753num(num * 10 + 5)
    make753num(num * 10 + 7)
def main():
    global count
    global N
    N = int(input())
    make753num(0)
    print(count)
main()

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

int main() {
  int n;
  cin >> n;
  vector<string> blue(n);
  for(int i=0; i<n; i++) cin >> blue[i];
  sort(blue.begin(), blue.end());
  
  int m;
  cin >> m;
  vector<string> red(m);
  for(int i=0; i<m; i++) cin >> red[i];
  
  int count = 0, ans = 0;
  for(int i=0; i<n; i++) {
    string x = blue[i]; 
    auto p = find(red.begin(), red.end(), x);
    if(p!=red.end()) {
      count--;
      red.erase(p);
    }
    count++;
    if(i==n-1) {
      if(ans<count) ans = count;
      break;
    } 
    if(blue[i]!=blue[i+1]) {
      if(ans<count) ans = count;
      count = 0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
from heapq import heappush,heappop

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int,ss_raw()))

X,Y,Z,K = ints_raw()

A = ints_raw()
B= ints_raw()
C= ints_raw()
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

arg_hash = {}

def main():
    Q = []
    heappush(Q,(-A[0]-B[0]-C[0],0,0,0))
    arg_hash[(0,0,0)]=1
    for k in range(K):
        ans = heappop(Q)
        print(-ans[0])
        a,b,c = ans[1:]

        argA = (a+1,b,c)
        if a < X-1 and (not argA in arg_hash):
            arg_hash[argA]=1
            heappush(Q,(-A[a+1]-B[b]-C[c],)+argA)
        argB = (a,b+1,c)
        if b < Y-1 and (not argB in arg_hash):
            arg_hash[argB]=1
            heappush(Q, (-A[a]-B[b+1]-C[c],)+argB)
        argC = (a,b,c+1)
        if c < Z-1 and (not argC in arg_hash):
            arg_hash[argC]=1
            heappush(Q,(-A[a]-B[b]-C[c+1],)+argC)
        
main()


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

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    ll n;
    cin >> n;
    ll sum = 0;
    for (int i=1; i<=n; i++){
        if (i % 3 == 0 || i % 5 == 0){continue;}
        else {sum += i;}
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3624
import math
N, M, C = map(int, input().split())
B = list(map(int, input().split())) 
A = [[0 for j in range(M)] for i in range(N)] 
point = 0 
count = 0 
for i in range(N):
    A[i] = list(map(int,input().split())) 
    
    point = 0
    for j in range(M):
        point = point + A[i][j] * B[j]
    point = point + C
    
    if point > 0:
        count += 1
print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <stdio.h>

using namespace std;

int main(int argc, char const *argv[]){
    int N;
    cin >> N;
    int t[N], x[N], y[N];
    for (int i = 0; i < N; i++) {
      cin >> t[i] >> x[i] >> y[i];
    }

    int now_x, now_y, now = 0;
    for (int i = 0; i < N; i++){
      int dt = t[i] - now;
      int dx = abs(x[i] - now_x);
      int dy = abs(y[i] - now_y);
      int tmp = dt - dx - dy;
      if(tmp >=0 && tmp%2 == 0){
        now = t[i];
        now_x = x[i];
        now_y = y[i];
      }else{
        cout << "No" << "\n";
        return 0;
      }
    }
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 1408
while 1:
    m,f,r=map(int,input().split())
    if m==f==r==-1:
        break
    mf = m+f
    if m==-1 or f==-1:
        print("F")
        continue
    elif mf>=80:
        print("A")
        continue
    elif mf>=65:
        print("B")
        continue
    elif mf>=50:
        print("C")
        continue
    elif mf>=30:
        if r>=50:
            print("C")
            continue
        else:
            print("D")
            continue
    else:
        print("F")


Measured memory_bytes: 5596
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.c
 * Author: Ivan
 *
 * Created on July 19, 2018, 1:58 AM
 */

#include <stdio.h>
#include <stdlib.h>
#define MAX 250

/*
 * 
 */

int parent(int i) { return i/2; }
int left(int i) { return 2*i; }
int right(int i) { return 2*i+1; }

int main(int argc, char** argv) {
    int H, T[MAX+1];
    scanf("%d", &H);
    
    for (int i = 1; i <= H; ++i) scanf("%d", &T[i]);
    for (int i = 1; i <= H; ++i) 
    {
        printf("node %d: key = %d, ", i, T[i]);
        if (parent(i) >= 1) printf("parent key = %d, ", T[parent(i)]);
        if (left(i) <= H) printf("left key = %d, ", T[left(i)]);
        if (right(i) <= H) printf("right key = %d, ", T[right(i)]);
        printf("\n");    
    }
    return (EXIT_SUCCESS);
}




Measured memory_bytes: 2056
N, C = ( int(i) for i in input().split())
dd = [[int(j) for j in input().split()] for i in range(C)]
cc = [[int(j) for j in input().split()] for i in range(N)]

cc0 = []
cc1 = []
cc2 = []
for i in range(N):
    for j in range(N):
        if (i + j)%3 == 0:
            cc0.append(cc[i][j])
        elif (i + j)%3 == 1:
            cc1.append(cc[i][j])
        else:
            cc2.append(cc[i][j])

ds = [[],[],[]]
for c1 in range(C):
    temp = 0
    for c2 in cc0:
        temp += dd[c2-1][c1]
    ds[0].append((temp,c1))
    temp = 0
    for c2 in cc1:
        temp += dd[c2-1][c1]
    ds[1].append((temp,c1))
    temp = 0
    for c2 in cc2:
        temp += dd[c2-1][c1]
    ds[2].append((temp,c1))

cut = []

for dss in ds:
    dss.sort()
    cut.append(dss[:3])

res = []
for i in range(3):
    for j in range(3):
        for k in range(3):
            dd0, c0 = cut[0][i]
            dd1, c1 = cut[1][j]
            dd2, c2 = cut[2][k]
            if c0 != c1 and c1 != c2 and c2 != c0:
                res.append(dd0 + dd1 + dd2)

res.sort()
print(res[0])

                
        


Measured memory_bytes: 56924
#include "stdio.h"

int main(void){
    int a,b;
    scanf("%d %d", &a, &b);
    
    if (a == b) {
        printf("a == b\n");
    }else if (a > b){
        printf("a > b\n");
    }else{
        printf("a < b\n");
    }
    return 0;
}

Measured memory_bytes: 580
//Solution by Tima
#include <bits/stdc++.h>
 
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
#define y1 sda
 
using namespace std;    
const int N = int(3e5) + 12, mod = int(1e9)  + 7; 

int n,m,a[N],b[N],q;


int main () {
	scanf("%d%d%d", &n, &m, &q);

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

	int ans = mod;
	for(int i = 1,x,y,z; i <= q; i++){
		scanf("%d%d%d", &x, &y, &z);
		ans = min(ans, a[x] + b[y] - z);
	}
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	ans = min(ans, a[1] + b[1]);
	printf("%d", ans);

return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>


using namespace std;


int main(){

    long long  a,b,c,d;
    cin>>a>>b>>c>>d;

    long long ans1 = a*c;
    long long ans2 = a*d;
    long long ans3 = b*c;
    long long ans4 = b*d;
    long long max_1 = max(ans1,ans2);
    long long max_2 = max(ans3,ans4);

    long long final = max(max_1,max_2);

    cout<<final;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
        long long a,x,b;
        while(cin>>a>>b)
        {
             x=abs(a-b)+1;
            if(a>0||b<0&&x%2==0)
            {
                cout<<"Positive\n";
            }
            else if(b<0)
                cout<<"Negative\n";
                else
                    cout<<"Zero\n";
        }


        return 0;

}




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


int main() {
    string S; cin >> S;
    string ans = "Yes";
    for (int i = 0; i < S.size(); i++) {
        if ((i + 1) % 2 == 0) {
            if ('L' != S[i] && 'U' != S[i] && 'D' != S[i]) {
                ans = "No";
                break;
            }
        } else {
            if ('R' != S[i] && 'U' != S[i] && 'D' != S[i]) {
                ans = "No";
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256